Codebase list libjs-tv4 / 73b7c61
Import upstream version 1.2.7+git20180215.1.e24bd1d Debian Janitor 2 years ago
208 changed file(s) with 122 addition(s) and 125774 deletion(s). Raw diff Collapse all Expand all
+0
-16
.gitignore less more
0 node_modules
1 npm-debug.log
2
3 /test/tmp
4 /tmp
5
6 /.idea
7 .DS_Store
8
9 /*.tgz
10
11 /*.js.map
12
13 build
14 components
15
+0
-30
.jshintrc less more
0 {
1 "curly": true,
2 "immed": true,
3 "latedef": true,
4 "newcap": true,
5 "noarg": true,
6 "sub": true,
7 "undef": true,
8 "unused": true,
9 "boss": true,
10 "eqnull": true,
11 "node": true,
12 "smarttabs": true,
13 "browser": true,
14 "laxbreak": true,
15 "eqeqeq": true,
16 "globals": {
17 "describe": true,
18 "it": true,
19 "before": true,
20 "beforeEach": true,
21 "after": true,
22 "afterEach": true,
23 "helper": true,
24 "tv4": true,
25 "assert": true,
26 "define": true,
27 "require": true
28 }
29 }
+0
-23
.npmignore less more
0 .npmignore
1 .gitignore
2 .gitmodules
3 .travis.yml
4 .jshintrc
5 bower.json
6 component.json
7 Gruntfile.js
8
9 /source
10 /.idea
11 /node_modules
12 /tests
13 /test
14 /build
15 /*.tgz
16 /*.php
17 /*.min.js
18 /*.js.map
19 /*.html
20 /*.htm
21 /try
22 /doc
+0
-3
.travis.yml less more
0 language: node_js
1 node_js:
2 - "0.10"
+0
-179
Gruntfile.js less more
0 module.exports = function (grunt) {
1 'use strict';
2
3 var path = require('path');
4 var util = require('util');
5
6 require('source-map-support').install();
7
8 grunt.loadNpmTasks('grunt-contrib-clean');
9 grunt.loadNpmTasks('grunt-contrib-copy');
10 grunt.loadNpmTasks('grunt-contrib-jshint');
11 grunt.loadNpmTasks('grunt-contrib-uglify');
12 grunt.loadNpmTasks('grunt-concat-sourcemap');
13 grunt.loadNpmTasks('grunt-mocha-test');
14 grunt.loadNpmTasks('grunt-markdown');
15 grunt.loadNpmTasks('grunt-mocha');
16 grunt.loadNpmTasks('grunt-component-io');
17 grunt.loadNpmTasks('grunt-push-release');
18 grunt.loadNpmTasks('grunt-regex-replace');
19
20 grunt.initConfig({
21 pkg: grunt.file.readJSON('package.json'),
22 push: {
23 options: {
24 updateConfigs: ['pkg'],
25 files: ['package.json', 'component.json', 'bower.json'],
26 add: false,
27 addFiles: [],
28 commit: false,
29 commitMessage: 'Release v%VERSION%',
30 commitFiles: ['-a'],
31 createTag: false,
32 tagName: 'v%VERSION%',
33 tagMessage: 'Version %VERSION%',
34 push: false,
35 pushTo: 'origin',
36 npm: false,
37 npmTag: 'Release v%VERSION%',
38 gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
39 }
40 },
41 copy: {
42 test_deps: {
43 expand: true,
44 flatten: true,
45 src: ['node_modules/mocha/mocha.js', 'node_modules/mocha/mocha.css', 'node_modules/proclaim/proclaim.js'],
46 dest: 'test/deps'
47 }
48 },
49 clean: {
50 tests: ['tmp', 'test/all_concat.js'],
51 maps: ['*.js.map'],
52 build: ['tv4.js', 'tv4.min.js', '*.js.map', 'test/all_concat.js', 'test/all_concat.js.map']
53 },
54 jshint: {
55 //lint for mistakes
56 options:{
57 reporter: './node_modules/jshint-path-reporter',
58 jshintrc: '.jshintrc'
59 },
60 tests: ['test/tests/**/*.js', 'test/all_*.js'],
61 output: ['./tv4.js']
62 },
63 'regex-replace': {
64 unmap: {
65 src: ['tv4.js', 'tv4.min.js'],
66 actions: [
67 {
68 name: 'map',
69 search: '\r?\n?\\\/\\\/[@#] sourceMappingURL=.*',
70 replace: '',
71 flags: 'g'
72 }
73 ]
74 }
75 },
76 concat_sourcemap: {
77 options: {
78 separator: '\n'
79 },
80 source: {
81 expand: true,
82 cwd: 'source',
83 rename: function (dest, src) {
84 return dest;
85 },
86 src: [
87 '../LICENSE.txt',
88 '_header.js',
89 '_polyfill.js',
90 'uri-template-fill.js',
91 'validate.js',
92 'basic.js',
93 'numeric.js',
94 'string.js',
95 'array.js',
96 'object.js',
97 'combinations.js',
98 'hypermedia.js',
99 'resolve-uri.js',
100 'normalise-schema.js',
101 'error-reporter.js',
102 'api.js',
103 '_footer.js'
104 ],
105 dest: 'tv4.js'
106 },
107 tests: {
108 src: ['test/_header.js', 'test/tests/**/*.js'],
109 dest: 'test/all_concat.js'
110 }
111 },
112 component: {
113 options: {
114 out: 'build/'
115 },
116 main: ['tv4.js', 'lang/**/*.js']
117 },
118 uglify: {
119 tv4: {
120 options: {
121 report: 'min',
122 sourceMapIn: 'tv4.js.map',
123 sourceMap: 'tv4.min.js.map'
124 },
125 files: {
126 'tv4.min.js': ['tv4.js']
127 }
128 }
129 },
130 mochaTest: {
131 //node-side
132 any: {
133 src: ['test/all_concat.js'],
134 options: {
135 reporter: 'mocha-unfunk-reporter',
136 bail: false
137 }
138 }
139 },
140 mocha: {
141 //browser-side
142 any: {
143 src: ['test/index*.html'],
144 options: {
145 reporter: 'Dot',
146 log: true,
147 run: true
148 }
149 }
150 },
151 markdown: {
152 index: {
153 options: {
154 template: 'doc/_template.html',
155 markdownOptions: {
156 gfm: true,
157 highlight: false
158 }
159 },
160 src: 'README.md',
161 dest: 'index.html'
162 }
163 }
164 });
165
166 // main cli commands
167 grunt.registerTask('default', ['test']);
168 grunt.registerTask('prepublish', ['cleanup']);
169
170 grunt.registerTask('products', ['uglify:tv4', 'component', 'markdown']);
171 grunt.registerTask('core', ['clean', 'concat_sourcemap', 'jshint', 'products', 'copy:test_deps']);
172
173 grunt.registerTask('build', ['core', 'cleanup']);
174 grunt.registerTask('test', ['core', 'mochaTest', 'mocha', 'cleanup']);
175 grunt.registerTask('cleanup', ['regex-replace:unmap', 'clean:maps']);
176
177 grunt.registerTask('dev', ['clean', 'concat_sourcemap', 'jshint', 'mochaTest']);
178 };
7979 tv4.validate(data, schema, function (isValid, validationError) { ... });
8080 ```
8181
82 `validationFailure` is simply taken from `tv4.error`.
82 `validationError` is simply taken from `tv4.error`.
8383
8484 ## Cyclical JavaScript objects
8585
+0
-42
bower.json less more
0 {
1 "name": "tv4",
2 "version": "1.2.7",
3 "description": "A public domain JSON Schema validator for JavaScript",
4 "keywords": [
5 "json-schema",
6 "schema",
7 "validator",
8 "tv4"
9 ],
10 "homepage": "https://github.com/geraintluff/tv4#tiny-validator-for-v4-json-schema",
11 "license": [
12 {
13 "type": "Public Domain",
14 "url": "http://geraintluff.github.io/tv4/LICENSE.txt"
15 },
16 {
17 "type": "MIT",
18 "url": "http://jsonary.com/LICENSE.txt"
19 }
20 ],
21 "main": "tv4.js",
22 "ignore": [
23 "*.html",
24 "*.txt",
25 "*.min.js",
26 "*.js.map",
27 "*.md",
28 "Gruntfile.js",
29 "package.json",
30 "component.json",
31 "bower.json",
32 "node_modules",
33 "test",
34 "try",
35 "build",
36 "dist",
37 "doc",
38 "source",
39 ".*"
40 ]
41 }
+0
-28
component.json less more
0 {
1 "name": "tv4",
2 "repo": "geraintluff/tv4",
3 "version": "1.2.7",
4 "description": "A public domain JSON Schema v4 validator for JavaScript",
5 "keywords": [
6 "json-schema",
7 "schema",
8 "validator",
9 "tv4"
10 ],
11 "dependencies": {},
12 "development": {},
13 "license": "MIT",
14 "main": "tv4.js",
15 "scripts": [
16 "tv4.js",
17 "lang/de.js",
18 "lang/fr.js",
19 "lang/nb.js",
20 "lang/pl-PL.js",
21 "lang/pt-PT.js",
22 "lang/sv-SE.js",
23 "lang/zh-CN.js"
24 ],
25 "styles": [],
26 "files": []
27 }
+0
-117
doc/_template.html less more
0 <html>
1 <head>
2 <title>Tiny Validator for v4 JSON Schema</title>
3 <style>
4 body {
5 background-color: #F0F0E0;
6 font-family: sans-serif;
7 }
8
9 a {
10 color: #04D;
11 text-decoration: none;
12 }
13
14 a:hover {
15 color: #08F;
16 text-decoration: underline;
17 }
18
19 #main {
20 width: 780px;
21 margin-left: auto;
22 margin-right: auto;
23 border: 1px solid #888;
24 border-radius: 3px;
25 background-color: #FFF;
26 }
27
28 h1 {
29 text-align: center;
30 font-size: 1.4em;
31 font-weight: bold;
32 border-bottom: 1px solid black;
33 margin: 0;
34 padding: 0.3em;
35 padding-left: 1em;
36 background-color: #F8F8F0;
37 border-top-left-radius: 3px;
38 border-top-right-radius: 3px;
39 }
40
41 h2 {
42 border-bottom: 1px solid #BBB;
43 }
44
45 h2, h3, h4{
46 padding-left: .8em;
47 padding-right: .8em;
48 }
49 h5, p, pre, ul, ol, .content {
50 padding-left: 1em;
51 padding-right: 1em;
52 }
53 li {
54 margin-left: 1em;
55 margin-right: 1em;
56 }
57 code, .code {
58 background-color: #F8F8F8;
59 border: 1px solid #DDD;
60 border-radius: 3px;
61 padding:.1em .2em;
62 }
63 pre code {
64 display:block;
65 margin:5px;
66 padding:.5em;
67 }
68 </style>
69 </head>
70 <body onload="enableDemos();">
71 <script src="tv4.js"></script>
72 <script>
73 function enableDemos() {
74 if (!document.querySelectorAll) {
75 return;
76 }
77 var demos = document.querySelectorAll(".inline-demo");
78 if (!demos || demos.length === 0) {
79 return;
80 }
81 for (var i = 0, ii = demos.length; i < ii; i++) {
82 linkDemo(demos[i]);
83 }
84 }
85 function linkDemo(demo) {
86 var id = demo.dataset['demo'];
87 var a = document.createElement('a');
88 a.appendChild(document.createTextNode('run demo'));
89 a.href = "javascript:runDemo('" + id + "');";
90 demo.insertBefore(a, demo.firstChild);
91 }
92
93 function getDeepNodeValue(element) {
94 var text = "";
95 for (var i = 0, ii = element.childNodes.length; i < ii; i++) {
96 var child = element.childNodes[i];
97 if (child.nodeType === 3) {
98 text += child.nodeValue;
99 }
100 else if (child.nodeType === 1){
101 text += getDeepNodeValue(child);
102 }
103 }
104 return text;
105 }
106
107 function runDemo(elementId) {
108 var element = document.getElementById(elementId);
109 eval(getDeepNodeValue(element));
110 }
111 </script>
112 <div id="main">
113 <%=content%>
114 </div>
115 </body>
116 </html>
+0
-415
index.html less more
0 <html>
1 <head>
2 <title>Tiny Validator for v4 JSON Schema</title>
3 <style>
4 body {
5 background-color: #F0F0E0;
6 font-family: sans-serif;
7 }
8
9 a {
10 color: #04D;
11 text-decoration: none;
12 }
13
14 a:hover {
15 color: #08F;
16 text-decoration: underline;
17 }
18
19 #main {
20 width: 780px;
21 margin-left: auto;
22 margin-right: auto;
23 border: 1px solid #888;
24 border-radius: 3px;
25 background-color: #FFF;
26 }
27
28 h1 {
29 text-align: center;
30 font-size: 1.4em;
31 font-weight: bold;
32 border-bottom: 1px solid black;
33 margin: 0;
34 padding: 0.3em;
35 padding-left: 1em;
36 background-color: #F8F8F0;
37 border-top-left-radius: 3px;
38 border-top-right-radius: 3px;
39 }
40
41 h2 {
42 border-bottom: 1px solid #BBB;
43 }
44
45 h2, h3, h4{
46 padding-left: .8em;
47 padding-right: .8em;
48 }
49 h5, p, pre, ul, ol, .content {
50 padding-left: 1em;
51 padding-right: 1em;
52 }
53 li {
54 margin-left: 1em;
55 margin-right: 1em;
56 }
57 code, .code {
58 background-color: #F8F8F8;
59 border: 1px solid #DDD;
60 border-radius: 3px;
61 padding:.1em .2em;
62 }
63 pre code {
64 display:block;
65 margin:5px;
66 padding:.5em;
67 }
68 </style>
69 </head>
70 <body onload="enableDemos();">
71 <script src="tv4.js"></script>
72 <script>
73 function enableDemos() {
74 if (!document.querySelectorAll) {
75 return;
76 }
77 var demos = document.querySelectorAll(".inline-demo");
78 if (!demos || demos.length === 0) {
79 return;
80 }
81 for (var i = 0, ii = demos.length; i < ii; i++) {
82 linkDemo(demos[i]);
83 }
84 }
85 function linkDemo(demo) {
86 var id = demo.dataset['demo'];
87 var a = document.createElement('a');
88 a.appendChild(document.createTextNode('run demo'));
89 a.href = "javascript:runDemo('" + id + "');";
90 demo.insertBefore(a, demo.firstChild);
91 }
92
93 function getDeepNodeValue(element) {
94 var text = "";
95 for (var i = 0, ii = element.childNodes.length; i < ii; i++) {
96 var child = element.childNodes[i];
97 if (child.nodeType === 3) {
98 text += child.nodeValue;
99 }
100 else if (child.nodeType === 1){
101 text += getDeepNodeValue(child);
102 }
103 }
104 return text;
105 }
106
107 function runDemo(elementId) {
108 var element = document.getElementById(elementId);
109 eval(getDeepNodeValue(element));
110 }
111 </script>
112 <div id="main">
113 <h1 id="tiny-validator-for-v4-json-schema-">Tiny Validator (for v4 JSON Schema)</h1>
114 <p><a href="http://travis-ci.org/geraintluff/tv4"><img src="https://secure.travis-ci.org/geraintluff/tv4.svg?branch=master" alt="Build Status"></a> <a href="https://gemnasium.com/geraintluff/tv4"><img src="https://gemnasium.com/geraintluff/tv4.svg" alt="Dependency Status"></a> <a href="http://badge.fury.io/js/tv4"><img src="https://badge.fury.io/js/tv4.svg" alt="NPM version"></a></p>
115 <p>Use <a href="http://json-schema.org/">json-schema</a> <a href="http://json-schema.org/latest/json-schema-core.html">draft v4</a> to validate simple values and complex objects using a rich <a href="http://json-schema.org/latest/json-schema-validation.html">validation vocabulary</a> (<a href="http://json-schema.org/examples.html">examples</a>).</p>
116 <p>There is support for <code>$ref</code> with JSON Pointer fragment paths (<code>other-schema.json#/properties/myKey</code>).</p>
117 <h2 id="usage-1-simple-validation">Usage 1: Simple validation</h2>
118 <pre><code class="lang-javascript">var valid = tv4.validate(data, schema);</code></pre>
119 <p>If validation returns <code>false</code>, then an explanation of why validation failed can be found in <code>tv4.error</code>.</p>
120 <p>The error object will look something like:</p>
121 <pre><code class="lang-json">{
122 &quot;code&quot;: 0,
123 &quot;message&quot;: &quot;Invalid type: string&quot;,
124 &quot;dataPath&quot;: &quot;/intKey&quot;,
125 &quot;schemaPath&quot;: &quot;/properties/intKey/type&quot;
126 }</code></pre>
127 <p>The <code>&quot;code&quot;</code> property will refer to one of the values in <code>tv4.errorCodes</code> - in this case, <code>tv4.errorCodes.INVALID_TYPE</code>.</p>
128 <p>To enable external schema to be referenced, you use:</p>
129 <pre><code class="lang-javascript">tv4.addSchema(url, schema);</code></pre>
130 <p>If schemas are referenced (<code>$ref</code>) but not known, then validation will return <code>true</code> and the missing schema(s) will be listed in <code>tv4.missing</code>. For more info see the API documentation below.</p>
131 <h2 id="usage-2-multi-threaded-validation">Usage 2: Multi-threaded validation</h2>
132 <p>Storing the error and missing schemas does not work well in multi-threaded environments, so there is an alternative syntax:</p>
133 <pre><code class="lang-javascript">var result = tv4.validateResult(data, schema);</code></pre>
134 <p>The result will look something like:</p>
135 <pre><code class="lang-json">{
136 &quot;valid&quot;: false,
137 &quot;error&quot;: {...},
138 &quot;missing&quot;: [...]
139 }</code></pre>
140 <h2 id="usage-3-multiple-errors">Usage 3: Multiple errors</h2>
141 <p>Normally, <code>tv4</code> stops when it encounters the first validation error. However, you can collect an array of validation errors using:</p>
142 <pre><code class="lang-javascript">var result = tv4.validateMultiple(data, schema);</code></pre>
143 <p>The result will look something like:</p>
144 <pre><code class="lang-json">{
145 &quot;valid&quot;: false,
146 &quot;errors&quot;: [
147 {...},
148 ...
149 ],
150 &quot;missing&quot;: [...]
151 }</code></pre>
152 <h2 id="asynchronous-validation">Asynchronous validation</h2>
153 <p>Support for asynchronous validation (where missing schemas are fetched) can be added by including an extra JavaScript file. Currently, the only version requires jQuery (<code>tv4.async-jquery.js</code>), but the code is very short and should be fairly easy to modify for other libraries (such as MooTools).</p>
154 <p>Usage:</p>
155 <pre><code class="lang-javascript">tv4.validate(data, schema, function (isValid, validationError) { ... });</code></pre>
156 <p><code>validationFailure</code> is simply taken from <code>tv4.error</code>.</p>
157 <h2 id="cyclical-javascript-objects">Cyclical JavaScript objects</h2>
158 <p>While they don&#39;t occur in proper JSON, JavaScript does support self-referencing objects. Any of the above calls support an optional third argument: <code>checkRecursive</code>. If true, tv4 will handle self-referencing objects properly - this slows down validation slightly, but that&#39;s better than a hanging script.</p>
159 <p>Consider this data, notice how both <code>a</code> and <code>b</code> refer to each other:</p>
160 <pre><code class="lang-javascript">var a = {};
161 var b = { a: a };
162 a.b = b;
163 var aSchema = { properties: { b: { $ref: &#39;bSchema&#39; }}};
164 var bSchema = { properties: { a: { $ref: &#39;aSchema&#39; }}};
165 tv4.addSchema(&#39;aSchema&#39;, aSchema);
166 tv4.addSchema(&#39;bSchema&#39;, bSchema);</code></pre>
167 <p>If the <code>checkRecursive</code> argument were missing, this would throw a &quot;too much recursion&quot; error.</p>
168 <p>To enable support for this, pass <code>true</code> as additional argument to any of the regular validation methods:</p>
169 <pre><code class="lang-javascript">tv4.validate(a, aSchema, true);
170 tv4.validateResult(data, aSchema, true);
171 tv4.validateMultiple(data, aSchema, true);</code></pre>
172 <h2 id="the-banunknownproperties-flag">The <code>banUnknownProperties</code> flag</h2>
173 <p>Sometimes, it is desirable to flag all unknown properties as an error. This is especially useful during development, to catch typos and the like, even when extra custom-defined properties are allowed.</p>
174 <p>As such, tv4 implements <a href="https://github.com/json-schema/json-schema/wiki/ban-unknown-properties-mode-\(v5-proposal\">&quot;ban unknown properties&quot; mode</a>), enabled by a fourth-argument flag:</p>
175 <pre><code class="lang-javascript">tv4.validate(data, schema, checkRecursive, true);
176 tv4.validateResult(data, schema, checkRecursive, true);
177 tv4.validateMultiple(data, schema, checkRecursive, true);</code></pre>
178 <h2 id="api">API</h2>
179 <p>There are additional api commands available for more complex use-cases:</p>
180 <h5 id="addschema-uri-schema-">addSchema(uri, schema)</h5>
181 <p>Pre-register a schema for reference by other schema and synchronous validation.</p>
182 <pre><code class="lang-js">tv4.addSchema(&#39;http://example.com/schema&#39;, { ... });</code></pre>
183 <ul>
184 <li><code>uri</code> the uri to identify this schema.</li>
185 <li><code>schema</code> the schema object.</li>
186 </ul>
187 <p>Schemas that have their <code>id</code> property set can be added directly.</p>
188 <pre><code class="lang-js">tv4.addSchema({ ... });</code></pre>
189 <h5 id="getschema-uri-">getSchema(uri)</h5>
190 <p>Return a schema from the cache.</p>
191 <ul>
192 <li><code>uri</code> the uri of the schema (may contain a <code>#</code> fragment)</li>
193 </ul>
194 <pre><code class="lang-js">var schema = tv4.getSchema(&#39;http://example.com/schema&#39;);</code></pre>
195 <h5 id="getschemamap-">getSchemaMap()</h5>
196 <p>Return a shallow copy of the schema cache, mapping schema document URIs to schema objects.</p>
197 <pre><code>var map = tv4.getSchemaMap();
198
199 var schema = map[uri];</code></pre>
200 <h5 id="getschemauris-filter-">getSchemaUris(filter)</h5>
201 <p>Return an Array with known schema document URIs.</p>
202 <ul>
203 <li><code>filter</code> optional RegExp to filter URIs</li>
204 </ul>
205 <pre><code>var arr = tv4.getSchemaUris();
206
207 // optional filter using a RegExp
208 var arr = tv4.getSchemaUris(/^https?://example.com/);</code></pre>
209 <h5 id="getmissinguris-filter-">getMissingUris(filter)</h5>
210 <p>Return an Array with schema document URIs that are used as <code>$ref</code> in known schemas but which currently have no associated schema data.</p>
211 <p>Use this in combination with <code>tv4.addSchema(uri, schema)</code> to preload the cache for complete synchronous validation with.</p>
212 <ul>
213 <li><code>filter</code> optional RegExp to filter URIs</li>
214 </ul>
215 <pre><code>var arr = tv4.getMissingUris();
216
217 // optional filter using a RegExp
218 var arr = tv4.getMissingUris(/^https?://example.com/);</code></pre>
219 <h5 id="dropschemas-">dropSchemas()</h5>
220 <p>Drop all known schema document URIs from the cache.</p>
221 <pre><code>tv4.dropSchemas();</code></pre>
222 <h5 id="freshapi-">freshApi()</h5>
223 <p>Return a new tv4 instance with no shared state.</p>
224 <pre><code>var otherTV4 = tv4.freshApi();</code></pre>
225 <h5 id="reset-">reset()</h5>
226 <p>Manually reset validation status from the simple <code>tv4.validate(data, schema)</code>. Although tv4 will self reset on each validation there are some implementation scenarios where this is useful.</p>
227 <pre><code>tv4.reset();</code></pre>
228 <h5 id="seterrorreporter-reporter-">setErrorReporter(reporter)</h5>
229 <p>Sets a custom error reporter. This is a function that accepts three arguments, and returns an error message (string):</p>
230 <pre><code>tv4.setErrorReporter(function (error, data, schema) {
231 return &quot;Error code: &quot; + error.code;
232 });</code></pre>
233 <p>The <code>error</code> object already has everything aside from the <code>.message</code> property filled in (so you can use <code>error.params</code>, <code>error.dataPath</code>, <code>error.schemaPath</code> etc.).</p>
234 <p>If nothing is returned (or the empty string), then it falls back to the default error reporter. To remove a custom error reporter, call <code>tv4.setErrorReporter(null)</code>.</p>
235 <h5 id="language-code-">language(code)</h5>
236 <p>Sets the language used by the default error reporter.</p>
237 <ul>
238 <li><code>code</code> is a language code, like <code>&#39;en&#39;</code> or <code>&#39;en-gb&#39;</code></li>
239 </ul>
240 <pre><code>tv4.language(&#39;en-gb&#39;);</code></pre>
241 <p>If you specify a multi-level language code (e.g. <code>fr-CH</code>), then it will fall back to the generic version (<code>fr</code>) if needed.</p>
242 <h5 id="addlanguage-code-map-">addLanguage(code, map)</h5>
243 <p>Add a new template-based language map for the default error reporter (used by <code>tv4.language(code)</code>)</p>
244 <ul>
245 <li><code>code</code> is new language code</li>
246 <li><code>map</code> is an object mapping error IDs or constant names (e.g. <code>103</code> or <code>&quot;NUMBER_MAXIMUM&quot;</code>) to language strings.</li>
247 </ul>
248 <pre><code>tv4.addLanguage(&#39;fr&#39;, { ... });
249
250 // select for use
251 tv4.language(&#39;fr&#39;)</code></pre>
252 <p>If you register a multi-level language code (e.g. <code>fr-FR</code>), then it will also be registered for plain <code>fr</code> if that does not already exist.</p>
253 <h5 id="addformat-format-validationfunction-">addFormat(format, validationFunction)</h5>
254 <p>Add a custom format validator. (There are no built-in format validators. Several common ones can be found <a href="https://github.com/ikr/tv4-formats">here</a> though)</p>
255 <ul>
256 <li><code>format</code> is a string, corresponding to the <code>&quot;format&quot;</code> value in schemas.</li>
257 <li><code>validationFunction</code> is a function that either returns:<ul>
258 <li><code>null</code> (meaning no error)</li>
259 <li>an error string (explaining the reason for failure)</li>
260 </ul>
261 </li>
262 </ul>
263 <pre><code>tv4.addFormat(&#39;decimal-digits&#39;, function (data, schema) {
264 if (typeof data === &#39;string&#39; &amp;&amp; !/^[0-9]+$/.test(data)) {
265 return null;
266 }
267 return &quot;must be string of decimal digits&quot;;
268 });</code></pre>
269 <p>Alternatively, multiple formats can be added at the same time using an object:</p>
270 <pre><code>tv4.addFormat({
271 &#39;my-format&#39;: function () {...},
272 &#39;other-format&#39;: function () {...}
273 });</code></pre>
274 <h5 id="definekeyword-keyword-validationfunction-">defineKeyword(keyword, validationFunction)</h5>
275 <p>Add a custom keyword validator.</p>
276 <ul>
277 <li><code>keyword</code> is a string, corresponding to a schema keyword</li>
278 <li><code>validationFunction</code> is a function that either returns:<ul>
279 <li><code>null</code> (meaning no error)</li>
280 <li>an error string (explaining the reason for failure)</li>
281 <li>an error object (containing some of: <code>code</code>/<code>message</code>/<code>dataPath</code>/<code>schemaPath</code>)</li>
282 </ul>
283 </li>
284 </ul>
285 <pre><code>tv4.defineKeyword(&#39;my-custom-keyword&#39;, function (data, value, schema) {
286 if (simpleFailure()) {
287 return &quot;Failure&quot;;
288 } else if (detailedFailure()) {
289 return {code: tv4.errorCodes.MY_CUSTOM_CODE, message: {param1: &#39;a&#39;, param2: &#39;b&#39;}};
290 } else {
291 return null;
292 }
293 });</code></pre>
294 <p><code>schema</code> is the schema upon which the keyword is defined. In the above example, <code>value === schema[&#39;my-custom-keyword&#39;]</code>.</p>
295 <p>If an object is returned from the custom validator, and its <code>message</code> is a string, then that is used as the message result. If <code>message</code> is an object, then that is used to populate the (localisable) error template.</p>
296 <h5 id="defineerror-codename-codenumber-defaultmessage-">defineError(codeName, codeNumber, defaultMessage)</h5>
297 <p>Defines a custom error code.</p>
298 <ul>
299 <li><code>codeName</code> is a string, all-caps underscore separated, e.g. <code>&quot;MY_CUSTOM_ERROR&quot;</code></li>
300 <li><code>codeNumber</code> is an integer &gt; 10000, which will be stored in <code>tv4.errorCodes</code> (e.g. <code>tv4.errorCodes.MY_CUSTOM_ERROR</code>)</li>
301 <li><code>defaultMessage</code> is an error message template to use (assuming translations have not been provided for this code)</li>
302 </ul>
303 <p>An example of <code>defaultMessage</code> might be: <code>&quot;Incorrect moon (expected {expected}, got {actual}&quot;</code>). This is filled out if a custom keyword returns a object <code>message</code> (see above). Translations will be used, if associated with the correct code name/number.</p>
304 <h2 id="demos">Demos</h2>
305 <h3 id="basic-usage">Basic usage</h3>
306 <div class="content inline-demo" markdown="1" data-demo="demo1">
307 <pre class="code" id="demo1">
308 var schema = {
309 &quot;items&quot;: {
310 &quot;type&quot;: &quot;boolean&quot;
311 }
312 };
313 var data1 = [true, false];
314 var data2 = [true, 123];
315
316 alert(&quot;data 1: &quot; + tv4.validate(data1, schema)); // true
317 alert(&quot;data 2: &quot; + tv4.validate(data2, schema)); // false
318 alert(&quot;data 2 error: &quot; + JSON.stringify(tv4.error, null, 4));
319 </pre>
320 </div>
321
322 <h3 id="use-of-code-ref-code-">Use of <code>$ref</code></h3>
323 <div class="content inline-demo" markdown="1" data-demo="demo2">
324 <pre class="code" id="demo2">
325 var schema = {
326 &quot;type&quot;: &quot;array&quot;,
327 &quot;items&quot;: {&quot;$ref&quot;: &quot;#&quot;}
328 };
329 var data1 = [[], [[]]];
330 var data2 = [[], [true, []]];
331
332 alert(&quot;data 1: &quot; + tv4.validate(data1, schema)); // true
333 alert(&quot;data 2: &quot; + tv4.validate(data2, schema)); // false
334 </pre>
335 </div>
336
337 <h3 id="missing-schema">Missing schema</h3>
338 <div class="content inline-demo" markdown="1" data-demo="demo3">
339 <pre class="code" id="demo3">
340 var schema = {
341 &quot;type&quot;: &quot;array&quot;,
342 &quot;items&quot;: {&quot;$ref&quot;: &quot;<a href="http://example.com/schema">http://example.com/schema</a>&quot; }
343 };
344 var data = [1, 2, 3];
345
346 alert(&quot;Valid: &quot; + tv4.validate(data, schema)); // true
347 alert(&quot;Missing schemas: &quot; + JSON.stringify(tv4.missing));
348 </pre>
349 </div>
350
351 <h3 id="referencing-remote-schema">Referencing remote schema</h3>
352 <div class="content inline-demo" markdown="1" data-demo="demo4">
353 <pre class="code" id="demo4">
354 tv4.addSchema(&quot;<a href="http://example.com/schema">http://example.com/schema</a>&quot;, {
355 &quot;definitions&quot;: {
356 &quot;arrayItem&quot;: {&quot;type&quot;: &quot;boolean&quot;}
357 }
358 });
359 var schema = {
360 &quot;type&quot;: &quot;array&quot;,
361 &quot;items&quot;: {&quot;$ref&quot;: &quot;<a href="http://example.com/schema#/definitions/arrayItem">http://example.com/schema#/definitions/arrayItem</a>&quot; }
362 };
363 var data1 = [true, false, true];
364 var data2 = [1, 2, 3];
365
366 alert(&quot;data 1: &quot; + tv4.validate(data1, schema)); // true
367 alert(&quot;data 2: &quot; + tv4.validate(data2, schema)); // false
368 </pre>
369 </div>
370
371 <h2 id="supported-platforms">Supported platforms</h2>
372 <ul>
373 <li>Node.js</li>
374 <li>All modern browsers</li>
375 <li>IE &gt;= 7</li>
376 </ul>
377 <h2 id="installation">Installation</h2>
378 <p>You can manually download <a href="https://raw.github.com/geraintluff/tv4/master/tv4.js"><code>tv4.js</code></a> or the minified <a href="https://raw.github.com/geraintluff/tv4/master/tv4.min.js"><code>tv4.min.js</code></a> and include it in your html to create the global <code>tv4</code> variable.</p>
379 <p>Alternately use it as a CommonJS module:</p>
380 <pre><code class="lang-js">var tv4 = require(&#39;tv4&#39;);</code></pre>
381 <p>or as an AMD module (e.g. with requirejs):</p>
382 <pre><code class="lang-js">require(&#39;tv4&#39;, function(tv4){
383 //use tv4 here
384 });</code></pre>
385 <h4 id="npm">npm</h4>
386 <pre><code>$ npm install tv4</code></pre>
387 <h4 id="bower">bower</h4>
388 <pre><code>$ bower install tv4</code></pre>
389 <h4 id="component-io">component.io</h4>
390 <pre><code>$ component install geraintluff/tv4</code></pre>
391 <h2 id="build-and-test">Build and test</h2>
392 <p>You can rebuild and run the node and browser tests using node.js and <a href="http://http://gruntjs.com/">grunt</a>:</p>
393 <p>Make sure you have the global grunt cli command:</p>
394 <pre><code>$ npm install grunt-cli -g</code></pre>
395 <p>Clone the git repos, open a shell in the root folder and install the development dependencies:</p>
396 <pre><code>$ npm install</code></pre>
397 <p>Rebuild and run the tests:</p>
398 <pre><code>$ grunt</code></pre>
399 <p>It will run a build and display one Spec-style report for the node.js and two Dot-style reports for both the plain and minified browser tests (via phantomJS). You can also use your own browser to manually run the suites by opening <a href="http://geraintluff.github.io/tv4/test/index.html"><code>test/index.html</code></a> and <a href="http://geraintluff.github.io/tv4/test/index-min.html"><code>test/index-min.html</code></a>.</p>
400 <h2 id="contributing">Contributing</h2>
401 <p>Pull-requests for fixes and expansions are welcome. Edit the partial files in <code>/source</code> and add your tests in a suitable suite or folder under <code>/test/tests</code> and run <code>grunt</code> to rebuild and run the test suite. Try to maintain an idiomatic coding style and add tests for any new features. It is recommend to discuss big changes in an Issue.</p>
402 <p>Do you speak another language? <code>tv4</code> needs internationalisation - please contribute language files to <code>/lang</code>!</p>
403 <h2 id="packages-using-tv4">Packages using tv4</h2>
404 <ul>
405 <li><a href="http://chaijs.com/plugins/chai-json-schema">chai-json-schema</a> is a <a href="http://chaijs.com">Chai Assertion Library</a> plugin to assert values against json-schema.</li>
406 <li><a href="http://www.github.com/Bartvds/grunt-tv4">grunt-tv4</a> is a plugin for <a href="http://http://gruntjs.com/">Grunt</a> that uses tv4 to bulk validate json files.</li>
407 </ul>
408 <h2 id="license">License</h2>
409 <p>The code is available as &quot;public domain&quot;, meaning that it is completely free to use, without any restrictions at all. Read the full license <a href="http://geraintluff.github.com/tv4/LICENSE.txt">here</a>.</p>
410 <p>It&#39;s also available under an <a href="http://jsonary.com/LICENSE.txt">MIT license</a>.</p>
411
412 </div>
413 </body>
414 </html>
0 (function (global) {
1 var lang = {
2 INVALID_TYPE: "Tipo inválido: {type} (se esperaba {expected})",
3 ENUM_MISMATCH: "No hay enum que corresponda con: {value}",
4 ANY_OF_MISSING: "Los datos no corresponden con ningún esquema de \"anyOf\"",
5 ONE_OF_MISSING: "Los datos no corresponden con ningún esquema de \"oneOf\"",
6 ONE_OF_MULTIPLE: "Los datos son válidos contra más de un esquema de \"oneOf\": índices {index1} y {index2}",
7 NOT_PASSED: "Los datos se corresponden con el esquema de \"not\"",
8 // Errores numéricos
9 NUMBER_MULTIPLE_OF: "El valor {value} no es múltiplo de {multipleOf}",
10 NUMBER_MINIMUM: "El {value} es inferior al mínimo {minimum}",
11 NUMBER_MINIMUM_EXCLUSIVE: "El valor {value} es igual que el mínimo exclusivo {minimum}",
12 NUMBER_MAXIMUM: "El valor {value} es mayor que el máximo {maximum}",
13 NUMBER_MAXIMUM_EXCLUSIVE: "El valor {value} es igual que el máximo exclusivo {maximum}",
14 NUMBER_NOT_A_NUMBER: "El valor {value} no es un número válido",
15 // Errores de cadena
16 STRING_LENGTH_SHORT: "La cadena es demasiado corta ({length} chars), mínimo {minimum}",
17 STRING_LENGTH_LONG: "La cadena es demasiado larga ({length} chars), máximo {maximum}",
18 STRING_PATTERN: "La cadena no se corresponde con el patrón: {pattern}",
19 // Errores de objeto
20 OBJECT_PROPERTIES_MINIMUM: "No se han definido suficientes propiedades ({propertyCount}), mínimo {minimum}",
21 OBJECT_PROPERTIES_MAXIMUM: "Se han definido demasiadas propiedades ({propertyCount}), máximo {maximum}",
22 OBJECT_REQUIRED: "Falta la propiedad requerida: {key}",
23 OBJECT_ADDITIONAL_PROPERTIES: "No se permiten propiedades adicionales",
24 OBJECT_DEPENDENCY_KEY: "Dependencia fallida - debe existir la clave: {missing} (debido a la clave: {key})",
25 // Errores de array
26 ARRAY_LENGTH_SHORT: "Array demasiado corto ({length}), mínimo {minimum}",
27 ARRAY_LENGTH_LONG: "Array demasiado largo ({length}), máximo {maximum}",
28 ARRAY_UNIQUE: "Elementos de array no únicos (índices {match1} y {match2})",
29 ARRAY_ADDITIONAL_ITEMS: "Elementos adicionales no permitidos",
30 // Errores de formato
31 FORMAT_CUSTOM: "Fallo en la validación del formato ({message})",
32 KEYWORD_CUSTOM: "Fallo en la palabra clave: {key} ({message})",
33 // Estructura de esquema
34 CIRCULAR_REFERENCE: "Referencias $refs circulares: {urls}",
35 // Opciones de validación no estándar
36 UNKNOWN_PROPERTY: "Propiedad desconocida (no existe en el esquema)"
37 };
38
39 if (typeof define === 'function' && define.amd) {
40 // AMD. Register as an anonymous module.
41 define(['../tv4'], function(tv4) {
42 tv4.addLanguage('es', lang);
43 return tv4;
44 });
45 } else if (typeof module !== 'undefined' && module.exports){
46 // CommonJS. Define export.
47 var tv4 = require('../tv4');
48 tv4.addLanguage('es', lang);
49 module.exports = tv4;
50 } else {
51 // Browser globals
52 global.tv4.addLanguage('es', lang);
53 }
54 })(this);
0 (function (global) {
1 var lang = {
2 INVALID_TYPE: "無效類型:{type} (須為 {expected})",
3 ENUM_MISMATCH: "{value} 並非可用值之一",
4 ANY_OF_MISSING: "資料不符合任何 \"anyOf\" 模式",
5 ONE_OF_MISSING: "資料不符合任何 \"oneOf\" 模式",
6 ONE_OF_MULTIPLE: "資料同時符合第 {index1} 和第 {index2} 個 \"oneOf\" 模式",
7 NOT_PASSED: "資料不應符合 \"not\" 模式",
8 // Numeric errors
9 NUMBER_MULTIPLE_OF: "數值 {value} 並非 {multipleOf} 的倍數",
10 NUMBER_MINIMUM: "數值 {value} 必須是 {minimum} 或以上",
11 NUMBER_MINIMUM_EXCLUSIVE: "數值 {value} 必須是 {minimum} 以上",
12 NUMBER_MAXIMUM: "數值 {value} 必須是 {maximum} 或以下",
13 NUMBER_MAXIMUM_EXCLUSIVE: "數值 {value} 必須是 {maximum} 以下",
14 NUMBER_NOT_A_NUMBER: "{value} 並非數字",
15 // String errors
16 STRING_LENGTH_SHORT: "字串過短 ({length} 字), 最少 {minimum} 字",
17 STRING_LENGTH_LONG: "字串過長 ({length} 字), 最多 {maximum} 字",
18 STRING_PATTERN: "字串不符合表達式 {pattern}",
19 // Object errors
20 OBJECT_PROPERTIES_MINIMUM: "屬性不足 {minimum} 個 (現在 {propertyCount} 個)",
21 OBJECT_PROPERTIES_MAXIMUM: "屬性超過 {maximum} 個 (現在 {propertyCount} 個)",
22 OBJECT_REQUIRED: "缺少必要屬性: {key}",
23 OBJECT_ADDITIONAL_PROPERTIES: "禁止額外屬性",
24 OBJECT_DEPENDENCY_KEY: "{key} 須要屬性 {missing}",
25 // Array errors
26 ARRAY_LENGTH_SHORT: "陣列長度 {length} 不足 {minimum}",
27 ARRAY_LENGTH_LONG: "陣列長度 {length} 超過 {maximum}",
28 ARRAY_UNIQUE: "陣列元素 {match1} 和 {match2} 不能重複",
29 ARRAY_ADDITIONAL_ITEMS: "禁止額外陣列元素",
30 // Format errors
31 FORMAT_CUSTOM: "自訂格式無效 ({message})",
32 KEYWORD_CUSTOM: "自訂關鍵字 {key} 無效 ({message})",
33 // Schema structure
34 CIRCULAR_REFERENCE: "循環引用 ($refs): {urls}",
35 // Non-standard validation options
36 UNKNOWN_PROPERTY: "不明屬性 (不在 schema 中)"
37 };
38
39 if (typeof define === 'function' && define.amd) {
40 // AMD. Register as an anonymous module.
41 define(['../tv4'], function(tv4) {
42 tv4.addLanguage('zh-TW', lang);
43 return tv4;
44 });
45 } else if (typeof module !== 'undefined' && module.exports){
46 // CommonJS. Define export.
47 var tv4 = require('../tv4');
48 tv4.addLanguage('zh-TW', lang);
49 module.exports = tv4;
50 } else {
51 // Browser globals
52 global.tv4.addLanguage('zh-TW', lang);
53 }
54 })(this);
2020 "type": "git",
2121 "url": "https://github.com/geraintluff/tv4.git"
2222 },
23 "license:": [
23 "license": [
2424 {
2525 "type": "Public Domain",
2626 "url": "http://geraintluff.github.io/tv4/LICENSE.txt"
+0
-1
source/_footer.js less more
0 }));
+0
-12
source/_header.js less more
0 (function (global, factory) {
1 if (typeof define === 'function' && define.amd) {
2 // AMD. Register as an anonymous module.
3 define([], factory);
4 } else if (typeof module !== 'undefined' && module.exports){
5 // CommonJS. Define export.
6 module.exports = factory();
7 } else {
8 // Browser globals
9 global.tv4 = factory();
10 }
11 }(this, function () {
+0
-110
source/_polyfill.js less more
0 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FObject%2Fkeys
1 if (!Object.keys) {
2 Object.keys = (function () {
3 var hasOwnProperty = Object.prototype.hasOwnProperty,
4 hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
5 dontEnums = [
6 'toString',
7 'toLocaleString',
8 'valueOf',
9 'hasOwnProperty',
10 'isPrototypeOf',
11 'propertyIsEnumerable',
12 'constructor'
13 ],
14 dontEnumsLength = dontEnums.length;
15
16 return function (obj) {
17 if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) {
18 throw new TypeError('Object.keys called on non-object');
19 }
20
21 var result = [];
22
23 for (var prop in obj) {
24 if (hasOwnProperty.call(obj, prop)) {
25 result.push(prop);
26 }
27 }
28
29 if (hasDontEnumBug) {
30 for (var i=0; i < dontEnumsLength; i++) {
31 if (hasOwnProperty.call(obj, dontEnums[i])) {
32 result.push(dontEnums[i]);
33 }
34 }
35 }
36 return result;
37 };
38 })();
39 }
40 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create
41 if (!Object.create) {
42 Object.create = (function(){
43 function F(){}
44
45 return function(o){
46 if (arguments.length !== 1) {
47 throw new Error('Object.create implementation only accepts one parameter.');
48 }
49 F.prototype = o;
50 return new F();
51 };
52 })();
53 }
54 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FArray%2FisArray
55 if(!Array.isArray) {
56 Array.isArray = function (vArg) {
57 return Object.prototype.toString.call(vArg) === "[object Array]";
58 };
59 }
60 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FArray%2FindexOf
61 if (!Array.prototype.indexOf) {
62 Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
63 if (this === null) {
64 throw new TypeError();
65 }
66 var t = Object(this);
67 var len = t.length >>> 0;
68
69 if (len === 0) {
70 return -1;
71 }
72 var n = 0;
73 if (arguments.length > 1) {
74 n = Number(arguments[1]);
75 if (n !== n) { // shortcut for verifying if it's NaN
76 n = 0;
77 } else if (n !== 0 && n !== Infinity && n !== -Infinity) {
78 n = (n > 0 || -1) * Math.floor(Math.abs(n));
79 }
80 }
81 if (n >= len) {
82 return -1;
83 }
84 var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
85 for (; k < len; k++) {
86 if (k in t && t[k] === searchElement) {
87 return k;
88 }
89 }
90 return -1;
91 };
92 }
93
94 // Grungey Object.isFrozen hack
95 if (!Object.isFrozen) {
96 Object.isFrozen = function (obj) {
97 var key = "tv4_test_frozen_key";
98 while (obj.hasOwnProperty(key)) {
99 key += Math.random();
100 }
101 try {
102 obj[key] = true;
103 delete obj[key];
104 return false;
105 } catch (e) {
106 return true;
107 }
108 };
109 }
+0
-306
source/api.js less more
0 var ErrorCodes = {
1 INVALID_TYPE: 0,
2 ENUM_MISMATCH: 1,
3 ANY_OF_MISSING: 10,
4 ONE_OF_MISSING: 11,
5 ONE_OF_MULTIPLE: 12,
6 NOT_PASSED: 13,
7 // Numeric errors
8 NUMBER_MULTIPLE_OF: 100,
9 NUMBER_MINIMUM: 101,
10 NUMBER_MINIMUM_EXCLUSIVE: 102,
11 NUMBER_MAXIMUM: 103,
12 NUMBER_MAXIMUM_EXCLUSIVE: 104,
13 NUMBER_NOT_A_NUMBER: 105,
14 // String errors
15 STRING_LENGTH_SHORT: 200,
16 STRING_LENGTH_LONG: 201,
17 STRING_PATTERN: 202,
18 // Object errors
19 OBJECT_PROPERTIES_MINIMUM: 300,
20 OBJECT_PROPERTIES_MAXIMUM: 301,
21 OBJECT_REQUIRED: 302,
22 OBJECT_ADDITIONAL_PROPERTIES: 303,
23 OBJECT_DEPENDENCY_KEY: 304,
24 // Array errors
25 ARRAY_LENGTH_SHORT: 400,
26 ARRAY_LENGTH_LONG: 401,
27 ARRAY_UNIQUE: 402,
28 ARRAY_ADDITIONAL_ITEMS: 403,
29 // Custom/user-defined errors
30 FORMAT_CUSTOM: 500,
31 KEYWORD_CUSTOM: 501,
32 // Schema structure
33 CIRCULAR_REFERENCE: 600,
34 // Non-standard validation options
35 UNKNOWN_PROPERTY: 1000
36 };
37 var ErrorCodeLookup = {};
38 for (var key in ErrorCodes) {
39 ErrorCodeLookup[ErrorCodes[key]] = key;
40 }
41 var ErrorMessagesDefault = {
42 INVALID_TYPE: "Invalid type: {type} (expected {expected})",
43 ENUM_MISMATCH: "No enum match for: {value}",
44 ANY_OF_MISSING: "Data does not match any schemas from \"anyOf\"",
45 ONE_OF_MISSING: "Data does not match any schemas from \"oneOf\"",
46 ONE_OF_MULTIPLE: "Data is valid against more than one schema from \"oneOf\": indices {index1} and {index2}",
47 NOT_PASSED: "Data matches schema from \"not\"",
48 // Numeric errors
49 NUMBER_MULTIPLE_OF: "Value {value} is not a multiple of {multipleOf}",
50 NUMBER_MINIMUM: "Value {value} is less than minimum {minimum}",
51 NUMBER_MINIMUM_EXCLUSIVE: "Value {value} is equal to exclusive minimum {minimum}",
52 NUMBER_MAXIMUM: "Value {value} is greater than maximum {maximum}",
53 NUMBER_MAXIMUM_EXCLUSIVE: "Value {value} is equal to exclusive maximum {maximum}",
54 NUMBER_NOT_A_NUMBER: "Value {value} is not a valid number",
55 // String errors
56 STRING_LENGTH_SHORT: "String is too short ({length} chars), minimum {minimum}",
57 STRING_LENGTH_LONG: "String is too long ({length} chars), maximum {maximum}",
58 STRING_PATTERN: "String does not match pattern: {pattern}",
59 // Object errors
60 OBJECT_PROPERTIES_MINIMUM: "Too few properties defined ({propertyCount}), minimum {minimum}",
61 OBJECT_PROPERTIES_MAXIMUM: "Too many properties defined ({propertyCount}), maximum {maximum}",
62 OBJECT_REQUIRED: "Missing required property: {key}",
63 OBJECT_ADDITIONAL_PROPERTIES: "Additional properties not allowed",
64 OBJECT_DEPENDENCY_KEY: "Dependency failed - key must exist: {missing} (due to key: {key})",
65 // Array errors
66 ARRAY_LENGTH_SHORT: "Array is too short ({length}), minimum {minimum}",
67 ARRAY_LENGTH_LONG: "Array is too long ({length}), maximum {maximum}",
68 ARRAY_UNIQUE: "Array items are not unique (indices {match1} and {match2})",
69 ARRAY_ADDITIONAL_ITEMS: "Additional items not allowed",
70 // Format errors
71 FORMAT_CUSTOM: "Format validation failed ({message})",
72 KEYWORD_CUSTOM: "Keyword failed: {key} ({message})",
73 // Schema structure
74 CIRCULAR_REFERENCE: "Circular $refs: {urls}",
75 // Non-standard validation options
76 UNKNOWN_PROPERTY: "Unknown property (not in schema)"
77 };
78
79 function ValidationError(code, params, dataPath, schemaPath, subErrors) {
80 Error.call(this);
81 if (code === undefined) {
82 throw new Error ("No error code supplied: " + schemaPath);
83 }
84 this.message = '';
85 this.params = params;
86 this.code = code;
87 this.dataPath = dataPath || "";
88 this.schemaPath = schemaPath || "";
89 this.subErrors = subErrors || null;
90
91 var err = new Error(this.message);
92 this.stack = err.stack || err.stacktrace;
93 if (!this.stack) {
94 try {
95 throw err;
96 }
97 catch(err) {
98 this.stack = err.stack || err.stacktrace;
99 }
100 }
101 }
102 ValidationError.prototype = Object.create(Error.prototype);
103 ValidationError.prototype.constructor = ValidationError;
104 ValidationError.prototype.name = 'ValidationError';
105
106 ValidationError.prototype.prefixWith = function (dataPrefix, schemaPrefix) {
107 if (dataPrefix !== null) {
108 dataPrefix = dataPrefix.replace(/~/g, "~0").replace(/\//g, "~1");
109 this.dataPath = "/" + dataPrefix + this.dataPath;
110 }
111 if (schemaPrefix !== null) {
112 schemaPrefix = schemaPrefix.replace(/~/g, "~0").replace(/\//g, "~1");
113 this.schemaPath = "/" + schemaPrefix + this.schemaPath;
114 }
115 if (this.subErrors !== null) {
116 for (var i = 0; i < this.subErrors.length; i++) {
117 this.subErrors[i].prefixWith(dataPrefix, schemaPrefix);
118 }
119 }
120 return this;
121 };
122
123 function isTrustedUrl(baseUrl, testUrl) {
124 if(testUrl.substring(0, baseUrl.length) === baseUrl){
125 var remainder = testUrl.substring(baseUrl.length);
126 if ((testUrl.length > 0 && testUrl.charAt(baseUrl.length - 1) === "/")
127 || remainder.charAt(0) === "#"
128 || remainder.charAt(0) === "?") {
129 return true;
130 }
131 }
132 return false;
133 }
134
135 var languages = {};
136 function createApi(language) {
137 var globalContext = new ValidatorContext();
138 var currentLanguage;
139 var customErrorReporter;
140 var api = {
141 setErrorReporter: function (reporter) {
142 if (typeof reporter === 'string') {
143 return this.language(reporter);
144 }
145 customErrorReporter = reporter;
146 return true;
147 },
148 addFormat: function () {
149 globalContext.addFormat.apply(globalContext, arguments);
150 },
151 language: function (code) {
152 if (!code) {
153 return currentLanguage;
154 }
155 if (!languages[code]) {
156 code = code.split('-')[0]; // fall back to base language
157 }
158 if (languages[code]) {
159 currentLanguage = code;
160 return code; // so you can tell if fall-back has happened
161 }
162 return false;
163 },
164 addLanguage: function (code, messageMap) {
165 var key;
166 for (key in ErrorCodes) {
167 if (messageMap[key] && !messageMap[ErrorCodes[key]]) {
168 messageMap[ErrorCodes[key]] = messageMap[key];
169 }
170 }
171 var rootCode = code.split('-')[0];
172 if (!languages[rootCode]) { // use for base language if not yet defined
173 languages[code] = messageMap;
174 languages[rootCode] = messageMap;
175 } else {
176 languages[code] = Object.create(languages[rootCode]);
177 for (key in messageMap) {
178 if (typeof languages[rootCode][key] === 'undefined') {
179 languages[rootCode][key] = messageMap[key];
180 }
181 languages[code][key] = messageMap[key];
182 }
183 }
184 return this;
185 },
186 freshApi: function (language) {
187 var result = createApi();
188 if (language) {
189 result.language(language);
190 }
191 return result;
192 },
193 validate: function (data, schema, checkRecursive, banUnknownProperties) {
194 var def = defaultErrorReporter(currentLanguage);
195 var errorReporter = customErrorReporter ? function (error, data, schema) {
196 return customErrorReporter(error, data, schema) || def(error, data, schema);
197 } : def;
198 var context = new ValidatorContext(globalContext, false, errorReporter, checkRecursive, banUnknownProperties);
199 if (typeof schema === "string") {
200 schema = {"$ref": schema};
201 }
202 context.addSchema("", schema);
203 var error = context.validateAll(data, schema, null, null, "");
204 if (!error && banUnknownProperties) {
205 error = context.banUnknownProperties(data, schema);
206 }
207 this.error = error;
208 this.missing = context.missing;
209 this.valid = (error === null);
210 return this.valid;
211 },
212 validateResult: function () {
213 var result = {};
214 this.validate.apply(result, arguments);
215 return result;
216 },
217 validateMultiple: function (data, schema, checkRecursive, banUnknownProperties) {
218 var def = defaultErrorReporter(currentLanguage);
219 var errorReporter = customErrorReporter ? function (error, data, schema) {
220 return customErrorReporter(error, data, schema) || def(error, data, schema);
221 } : def;
222 var context = new ValidatorContext(globalContext, true, errorReporter, checkRecursive, banUnknownProperties);
223 if (typeof schema === "string") {
224 schema = {"$ref": schema};
225 }
226 context.addSchema("", schema);
227 context.validateAll(data, schema, null, null, "");
228 if (banUnknownProperties) {
229 context.banUnknownProperties(data, schema);
230 }
231 var result = {};
232 result.errors = context.errors;
233 result.missing = context.missing;
234 result.valid = (result.errors.length === 0);
235 return result;
236 },
237 addSchema: function () {
238 return globalContext.addSchema.apply(globalContext, arguments);
239 },
240 getSchema: function () {
241 return globalContext.getSchema.apply(globalContext, arguments);
242 },
243 getSchemaMap: function () {
244 return globalContext.getSchemaMap.apply(globalContext, arguments);
245 },
246 getSchemaUris: function () {
247 return globalContext.getSchemaUris.apply(globalContext, arguments);
248 },
249 getMissingUris: function () {
250 return globalContext.getMissingUris.apply(globalContext, arguments);
251 },
252 dropSchemas: function () {
253 globalContext.dropSchemas.apply(globalContext, arguments);
254 },
255 defineKeyword: function () {
256 globalContext.defineKeyword.apply(globalContext, arguments);
257 },
258 defineError: function (codeName, codeNumber, defaultMessage) {
259 if (typeof codeName !== 'string' || !/^[A-Z]+(_[A-Z]+)*$/.test(codeName)) {
260 throw new Error('Code name must be a string in UPPER_CASE_WITH_UNDERSCORES');
261 }
262 if (typeof codeNumber !== 'number' || codeNumber%1 !== 0 || codeNumber < 10000) {
263 throw new Error('Code number must be an integer > 10000');
264 }
265 if (typeof ErrorCodes[codeName] !== 'undefined') {
266 throw new Error('Error already defined: ' + codeName + ' as ' + ErrorCodes[codeName]);
267 }
268 if (typeof ErrorCodeLookup[codeNumber] !== 'undefined') {
269 throw new Error('Error code already used: ' + ErrorCodeLookup[codeNumber] + ' as ' + codeNumber);
270 }
271 ErrorCodes[codeName] = codeNumber;
272 ErrorCodeLookup[codeNumber] = codeName;
273 ErrorMessagesDefault[codeName] = ErrorMessagesDefault[codeNumber] = defaultMessage;
274 for (var langCode in languages) {
275 var language = languages[langCode];
276 if (language[codeName]) {
277 language[codeNumber] = language[codeNumber] || language[codeName];
278 }
279 }
280 },
281 reset: function () {
282 globalContext.reset();
283 this.error = null;
284 this.missing = [];
285 this.valid = true;
286 },
287 missing: [],
288 error: null,
289 valid: true,
290 normSchema: normSchema,
291 resolveUrl: resolveUrl,
292 getDocumentUri: getDocumentUri,
293 errorCodes: ErrorCodes
294 };
295 api.language(language || 'en');
296 return api;
297 }
298
299 var tv4 = createApi();
300 tv4.addLanguage('en-gb', ErrorMessagesDefault);
301
302 //legacy property
303 tv4.tv4 = tv4;
304
305 return tv4; // used by _header.js to globalise.
+0
-80
source/array.js less more
0 ValidatorContext.prototype.validateArray = function validateArray(data, schema, dataPointerPath) {
1 if (!Array.isArray(data)) {
2 return null;
3 }
4 return this.validateArrayLength(data, schema, dataPointerPath)
5 || this.validateArrayUniqueItems(data, schema, dataPointerPath)
6 || this.validateArrayItems(data, schema, dataPointerPath)
7 || null;
8 };
9
10 ValidatorContext.prototype.validateArrayLength = function validateArrayLength(data, schema) {
11 var error;
12 if (schema.minItems !== undefined) {
13 if (data.length < schema.minItems) {
14 error = this.createError(ErrorCodes.ARRAY_LENGTH_SHORT, {length: data.length, minimum: schema.minItems}, '', '/minItems', null, data, schema);
15 if (this.handleError(error)) {
16 return error;
17 }
18 }
19 }
20 if (schema.maxItems !== undefined) {
21 if (data.length > schema.maxItems) {
22 error = this.createError(ErrorCodes.ARRAY_LENGTH_LONG, {length: data.length, maximum: schema.maxItems}, '', '/maxItems', null, data, schema);
23 if (this.handleError(error)) {
24 return error;
25 }
26 }
27 }
28 return null;
29 };
30
31 ValidatorContext.prototype.validateArrayUniqueItems = function validateArrayUniqueItems(data, schema) {
32 if (schema.uniqueItems) {
33 for (var i = 0; i < data.length; i++) {
34 for (var j = i + 1; j < data.length; j++) {
35 if (recursiveCompare(data[i], data[j])) {
36 var error = this.createError(ErrorCodes.ARRAY_UNIQUE, {match1: i, match2: j}, '', '/uniqueItems', null, data, schema);
37 if (this.handleError(error)) {
38 return error;
39 }
40 }
41 }
42 }
43 }
44 return null;
45 };
46
47 ValidatorContext.prototype.validateArrayItems = function validateArrayItems(data, schema, dataPointerPath) {
48 if (schema.items === undefined) {
49 return null;
50 }
51 var error, i;
52 if (Array.isArray(schema.items)) {
53 for (i = 0; i < data.length; i++) {
54 if (i < schema.items.length) {
55 if (error = this.validateAll(data[i], schema.items[i], [i], ["items", i], dataPointerPath + "/" + i)) {
56 return error;
57 }
58 } else if (schema.additionalItems !== undefined) {
59 if (typeof schema.additionalItems === "boolean") {
60 if (!schema.additionalItems) {
61 error = (this.createError(ErrorCodes.ARRAY_ADDITIONAL_ITEMS, {}, '/' + i, '/additionalItems', null, data, schema));
62 if (this.handleError(error)) {
63 return error;
64 }
65 }
66 } else if (error = this.validateAll(data[i], schema.additionalItems, [i], ["additionalItems"], dataPointerPath + "/" + i)) {
67 return error;
68 }
69 }
70 }
71 } else {
72 for (i = 0; i < data.length; i++) {
73 if (error = this.validateAll(data[i], schema.items, [i], ["items"], dataPointerPath + "/" + i)) {
74 return error;
75 }
76 }
77 }
78 return null;
79 };
+0
-47
source/basic.js less more
0 ValidatorContext.prototype.validateBasic = function validateBasic(data, schema, dataPointerPath) {
1 var error;
2 if (error = this.validateType(data, schema, dataPointerPath)) {
3 return error.prefixWith(null, "type");
4 }
5 if (error = this.validateEnum(data, schema, dataPointerPath)) {
6 return error.prefixWith(null, "type");
7 }
8 return null;
9 };
10
11 ValidatorContext.prototype.validateType = function validateType(data, schema) {
12 if (schema.type === undefined) {
13 return null;
14 }
15 var dataType = typeof data;
16 if (data === null) {
17 dataType = "null";
18 } else if (Array.isArray(data)) {
19 dataType = "array";
20 }
21 var allowedTypes = schema.type;
22 if (!Array.isArray(allowedTypes)) {
23 allowedTypes = [allowedTypes];
24 }
25
26 for (var i = 0; i < allowedTypes.length; i++) {
27 var type = allowedTypes[i];
28 if (type === dataType || (type === "integer" && dataType === "number" && (data % 1 === 0))) {
29 return null;
30 }
31 }
32 return this.createError(ErrorCodes.INVALID_TYPE, {type: dataType, expected: allowedTypes.join("/")}, '', '', null, data, schema);
33 };
34
35 ValidatorContext.prototype.validateEnum = function validateEnum(data, schema) {
36 if (schema["enum"] === undefined) {
37 return null;
38 }
39 for (var i = 0; i < schema["enum"].length; i++) {
40 var enumVal = schema["enum"][i];
41 if (recursiveCompare(data, enumVal)) {
42 return null;
43 }
44 }
45 return this.createError(ErrorCodes.ENUM_MISMATCH, {value: (typeof JSON !== 'undefined') ? JSON.stringify(data) : data}, '', '', null, data, schema);
46 };
+0
-161
source/combinations.js less more
0 ValidatorContext.prototype.validateCombinations = function validateCombinations(data, schema, dataPointerPath) {
1 return this.validateAllOf(data, schema, dataPointerPath)
2 || this.validateAnyOf(data, schema, dataPointerPath)
3 || this.validateOneOf(data, schema, dataPointerPath)
4 || this.validateNot(data, schema, dataPointerPath)
5 || null;
6 };
7
8 ValidatorContext.prototype.validateAllOf = function validateAllOf(data, schema, dataPointerPath) {
9 if (schema.allOf === undefined) {
10 return null;
11 }
12 var error;
13 for (var i = 0; i < schema.allOf.length; i++) {
14 var subSchema = schema.allOf[i];
15 if (error = this.validateAll(data, subSchema, [], ["allOf", i], dataPointerPath)) {
16 return error;
17 }
18 }
19 return null;
20 };
21
22 ValidatorContext.prototype.validateAnyOf = function validateAnyOf(data, schema, dataPointerPath) {
23 if (schema.anyOf === undefined) {
24 return null;
25 }
26 var errors = [];
27 var startErrorCount = this.errors.length;
28 var oldUnknownPropertyPaths, oldKnownPropertyPaths;
29 if (this.trackUnknownProperties) {
30 oldUnknownPropertyPaths = this.unknownPropertyPaths;
31 oldKnownPropertyPaths = this.knownPropertyPaths;
32 }
33 var errorAtEnd = true;
34 for (var i = 0; i < schema.anyOf.length; i++) {
35 if (this.trackUnknownProperties) {
36 this.unknownPropertyPaths = {};
37 this.knownPropertyPaths = {};
38 }
39 var subSchema = schema.anyOf[i];
40
41 var errorCount = this.errors.length;
42 var error = this.validateAll(data, subSchema, [], ["anyOf", i], dataPointerPath);
43
44 if (error === null && errorCount === this.errors.length) {
45 this.errors = this.errors.slice(0, startErrorCount);
46
47 if (this.trackUnknownProperties) {
48 for (var knownKey in this.knownPropertyPaths) {
49 oldKnownPropertyPaths[knownKey] = true;
50 delete oldUnknownPropertyPaths[knownKey];
51 }
52 for (var unknownKey in this.unknownPropertyPaths) {
53 if (!oldKnownPropertyPaths[unknownKey]) {
54 oldUnknownPropertyPaths[unknownKey] = true;
55 }
56 }
57 // We need to continue looping so we catch all the property definitions, but we don't want to return an error
58 errorAtEnd = false;
59 continue;
60 }
61
62 return null;
63 }
64 if (error) {
65 errors.push(error.prefixWith(null, "" + i).prefixWith(null, "anyOf"));
66 }
67 }
68 if (this.trackUnknownProperties) {
69 this.unknownPropertyPaths = oldUnknownPropertyPaths;
70 this.knownPropertyPaths = oldKnownPropertyPaths;
71 }
72 if (errorAtEnd) {
73 errors = errors.concat(this.errors.slice(startErrorCount));
74 this.errors = this.errors.slice(0, startErrorCount);
75 return this.createError(ErrorCodes.ANY_OF_MISSING, {}, "", "/anyOf", errors, data, schema);
76 }
77 };
78
79 ValidatorContext.prototype.validateOneOf = function validateOneOf(data, schema, dataPointerPath) {
80 if (schema.oneOf === undefined) {
81 return null;
82 }
83 var validIndex = null;
84 var errors = [];
85 var startErrorCount = this.errors.length;
86 var oldUnknownPropertyPaths, oldKnownPropertyPaths;
87 if (this.trackUnknownProperties) {
88 oldUnknownPropertyPaths = this.unknownPropertyPaths;
89 oldKnownPropertyPaths = this.knownPropertyPaths;
90 }
91 for (var i = 0; i < schema.oneOf.length; i++) {
92 if (this.trackUnknownProperties) {
93 this.unknownPropertyPaths = {};
94 this.knownPropertyPaths = {};
95 }
96 var subSchema = schema.oneOf[i];
97
98 var errorCount = this.errors.length;
99 var error = this.validateAll(data, subSchema, [], ["oneOf", i], dataPointerPath);
100
101 if (error === null && errorCount === this.errors.length) {
102 if (validIndex === null) {
103 validIndex = i;
104 } else {
105 this.errors = this.errors.slice(0, startErrorCount);
106 return this.createError(ErrorCodes.ONE_OF_MULTIPLE, {index1: validIndex, index2: i}, "", "/oneOf", null, data, schema);
107 }
108 if (this.trackUnknownProperties) {
109 for (var knownKey in this.knownPropertyPaths) {
110 oldKnownPropertyPaths[knownKey] = true;
111 delete oldUnknownPropertyPaths[knownKey];
112 }
113 for (var unknownKey in this.unknownPropertyPaths) {
114 if (!oldKnownPropertyPaths[unknownKey]) {
115 oldUnknownPropertyPaths[unknownKey] = true;
116 }
117 }
118 }
119 } else if (error) {
120 errors.push(error);
121 }
122 }
123 if (this.trackUnknownProperties) {
124 this.unknownPropertyPaths = oldUnknownPropertyPaths;
125 this.knownPropertyPaths = oldKnownPropertyPaths;
126 }
127 if (validIndex === null) {
128 errors = errors.concat(this.errors.slice(startErrorCount));
129 this.errors = this.errors.slice(0, startErrorCount);
130 return this.createError(ErrorCodes.ONE_OF_MISSING, {}, "", "/oneOf", errors, data, schema);
131 } else {
132 this.errors = this.errors.slice(0, startErrorCount);
133 }
134 return null;
135 };
136
137 ValidatorContext.prototype.validateNot = function validateNot(data, schema, dataPointerPath) {
138 if (schema.not === undefined) {
139 return null;
140 }
141 var oldErrorCount = this.errors.length;
142 var oldUnknownPropertyPaths, oldKnownPropertyPaths;
143 if (this.trackUnknownProperties) {
144 oldUnknownPropertyPaths = this.unknownPropertyPaths;
145 oldKnownPropertyPaths = this.knownPropertyPaths;
146 this.unknownPropertyPaths = {};
147 this.knownPropertyPaths = {};
148 }
149 var error = this.validateAll(data, schema.not, null, null, dataPointerPath);
150 var notErrors = this.errors.slice(oldErrorCount);
151 this.errors = this.errors.slice(0, oldErrorCount);
152 if (this.trackUnknownProperties) {
153 this.unknownPropertyPaths = oldUnknownPropertyPaths;
154 this.knownPropertyPaths = oldKnownPropertyPaths;
155 }
156 if (error === null && notErrors.length === 0) {
157 return this.createError(ErrorCodes.NOT_PASSED, {}, "", "/not", null, data, schema);
158 }
159 return null;
160 };
+0
-18
source/error-reporter.js less more
0 function defaultErrorReporter(language) {
1 language = language || 'en';
2
3 var errorMessages = languages[language];
4
5 return function (error) {
6 var messageTemplate = errorMessages[error.code] || ErrorMessagesDefault[error.code];
7 if (typeof messageTemplate !== 'string') {
8 return "Unknown error code " + error.code + ": " + JSON.stringify(error.messageParams);
9 }
10 var messageParams = error.params;
11 // Adapted from Crockford's supplant()
12 return messageTemplate.replace(/\{([^{}]*)\}/g, function (whole, varName) {
13 var subValue = messageParams[varName];
14 return typeof subValue === 'string' || typeof subValue === 'number' ? subValue : whole;
15 });
16 };
17 }
+0
-26
source/hypermedia.js less more
0 ValidatorContext.prototype.validateHypermedia = function validateCombinations(data, schema, dataPointerPath) {
1 if (!schema.links) {
2 return null;
3 }
4 var error;
5 for (var i = 0; i < schema.links.length; i++) {
6 var ldo = schema.links[i];
7 if (ldo.rel === "describedby") {
8 var template = new UriTemplate(ldo.href);
9 var allPresent = true;
10 for (var j = 0; j < template.varNames.length; j++) {
11 if (!(template.varNames[j] in data)) {
12 allPresent = false;
13 break;
14 }
15 }
16 if (allPresent) {
17 var schemaUrl = template.fillFromObject(data);
18 var subSchema = {"$ref": schemaUrl};
19 if (error = this.validateAll(data, subSchema, [], ["links", i], dataPointerPath)) {
20 return error;
21 }
22 }
23 }
24 }
25 };
+0
-24
source/normalise-schema.js less more
0 function normSchema(schema, baseUri) {
1 if (schema && typeof schema === "object") {
2 if (baseUri === undefined) {
3 baseUri = schema.id;
4 } else if (typeof schema.id === "string") {
5 baseUri = resolveUrl(baseUri, schema.id);
6 schema.id = baseUri;
7 }
8 if (Array.isArray(schema)) {
9 for (var i = 0; i < schema.length; i++) {
10 normSchema(schema[i], baseUri);
11 }
12 } else {
13 if (typeof schema['$ref'] === "string") {
14 schema['$ref'] = resolveUrl(baseUri, schema['$ref']);
15 }
16 for (var key in schema) {
17 if (key !== "enum") {
18 normSchema(schema[key], baseUri);
19 }
20 }
21 }
22 }
23 }
+0
-55
source/numeric.js less more
0 ValidatorContext.prototype.validateNumeric = function validateNumeric(data, schema, dataPointerPath) {
1 return this.validateMultipleOf(data, schema, dataPointerPath)
2 || this.validateMinMax(data, schema, dataPointerPath)
3 || this.validateNaN(data, schema, dataPointerPath)
4 || null;
5 };
6
7 var CLOSE_ENOUGH_LOW = Math.pow(2, -51);
8 var CLOSE_ENOUGH_HIGH = 1 - CLOSE_ENOUGH_LOW;
9 ValidatorContext.prototype.validateMultipleOf = function validateMultipleOf(data, schema) {
10 var multipleOf = schema.multipleOf || schema.divisibleBy;
11 if (multipleOf === undefined) {
12 return null;
13 }
14 if (typeof data === "number") {
15 var remainder = (data/multipleOf)%1;
16 if (remainder >= CLOSE_ENOUGH_LOW && remainder < CLOSE_ENOUGH_HIGH) {
17 return this.createError(ErrorCodes.NUMBER_MULTIPLE_OF, {value: data, multipleOf: multipleOf}, '', '', null, data, schema);
18 }
19 }
20 return null;
21 };
22
23 ValidatorContext.prototype.validateMinMax = function validateMinMax(data, schema) {
24 if (typeof data !== "number") {
25 return null;
26 }
27 if (schema.minimum !== undefined) {
28 if (data < schema.minimum) {
29 return this.createError(ErrorCodes.NUMBER_MINIMUM, {value: data, minimum: schema.minimum}, '', '/minimum', null, data, schema);
30 }
31 if (schema.exclusiveMinimum && data === schema.minimum) {
32 return this.createError(ErrorCodes.NUMBER_MINIMUM_EXCLUSIVE, {value: data, minimum: schema.minimum}, '', '/exclusiveMinimum', null, data, schema);
33 }
34 }
35 if (schema.maximum !== undefined) {
36 if (data > schema.maximum) {
37 return this.createError(ErrorCodes.NUMBER_MAXIMUM, {value: data, maximum: schema.maximum}, '', '/maximum', null, data, schema);
38 }
39 if (schema.exclusiveMaximum && data === schema.maximum) {
40 return this.createError(ErrorCodes.NUMBER_MAXIMUM_EXCLUSIVE, {value: data, maximum: schema.maximum}, '', '/exclusiveMaximum', null, data, schema);
41 }
42 }
43 return null;
44 };
45
46 ValidatorContext.prototype.validateNaN = function validateNaN(data, schema) {
47 if (typeof data !== "number") {
48 return null;
49 }
50 if (isNaN(data) === true || data === Infinity || data === -Infinity) {
51 return this.createError(ErrorCodes.NUMBER_NOT_A_NUMBER, {value: data}, '', '/type', null, data, schema);
52 }
53 return null;
54 };
+0
-132
source/object.js less more
0 ValidatorContext.prototype.validateObject = function validateObject(data, schema, dataPointerPath) {
1 if (typeof data !== "object" || data === null || Array.isArray(data)) {
2 return null;
3 }
4 return this.validateObjectMinMaxProperties(data, schema, dataPointerPath)
5 || this.validateObjectRequiredProperties(data, schema, dataPointerPath)
6 || this.validateObjectProperties(data, schema, dataPointerPath)
7 || this.validateObjectDependencies(data, schema, dataPointerPath)
8 || null;
9 };
10
11 ValidatorContext.prototype.validateObjectMinMaxProperties = function validateObjectMinMaxProperties(data, schema) {
12 var keys = Object.keys(data);
13 var error;
14 if (schema.minProperties !== undefined) {
15 if (keys.length < schema.minProperties) {
16 error = this.createError(ErrorCodes.OBJECT_PROPERTIES_MINIMUM, {propertyCount: keys.length, minimum: schema.minProperties}, '', '/minProperties', null, data, schema);
17 if (this.handleError(error)) {
18 return error;
19 }
20 }
21 }
22 if (schema.maxProperties !== undefined) {
23 if (keys.length > schema.maxProperties) {
24 error = this.createError(ErrorCodes.OBJECT_PROPERTIES_MAXIMUM, {propertyCount: keys.length, maximum: schema.maxProperties}, '', '/maxProperties', null, data, schema);
25 if (this.handleError(error)) {
26 return error;
27 }
28 }
29 }
30 return null;
31 };
32
33 ValidatorContext.prototype.validateObjectRequiredProperties = function validateObjectRequiredProperties(data, schema) {
34 if (schema.required !== undefined) {
35 for (var i = 0; i < schema.required.length; i++) {
36 var key = schema.required[i];
37 if (data[key] === undefined) {
38 var error = this.createError(ErrorCodes.OBJECT_REQUIRED, {key: key}, '', '/required/' + i, null, data, schema);
39 if (this.handleError(error)) {
40 return error;
41 }
42 }
43 }
44 }
45 return null;
46 };
47
48 ValidatorContext.prototype.validateObjectProperties = function validateObjectProperties(data, schema, dataPointerPath) {
49 var error;
50 for (var key in data) {
51 var keyPointerPath = dataPointerPath + "/" + key.replace(/~/g, '~0').replace(/\//g, '~1');
52 var foundMatch = false;
53 if (schema.properties !== undefined && schema.properties[key] !== undefined) {
54 foundMatch = true;
55 if (error = this.validateAll(data[key], schema.properties[key], [key], ["properties", key], keyPointerPath)) {
56 return error;
57 }
58 }
59 if (schema.patternProperties !== undefined) {
60 for (var patternKey in schema.patternProperties) {
61 var regexp = new RegExp(patternKey);
62 if (regexp.test(key)) {
63 foundMatch = true;
64 if (error = this.validateAll(data[key], schema.patternProperties[patternKey], [key], ["patternProperties", patternKey], keyPointerPath)) {
65 return error;
66 }
67 }
68 }
69 }
70 if (!foundMatch) {
71 if (schema.additionalProperties !== undefined) {
72 if (this.trackUnknownProperties) {
73 this.knownPropertyPaths[keyPointerPath] = true;
74 delete this.unknownPropertyPaths[keyPointerPath];
75 }
76 if (typeof schema.additionalProperties === "boolean") {
77 if (!schema.additionalProperties) {
78 error = this.createError(ErrorCodes.OBJECT_ADDITIONAL_PROPERTIES, {key: key}, '', '/additionalProperties', null, data, schema).prefixWith(key, null);
79 if (this.handleError(error)) {
80 return error;
81 }
82 }
83 } else {
84 if (error = this.validateAll(data[key], schema.additionalProperties, [key], ["additionalProperties"], keyPointerPath)) {
85 return error;
86 }
87 }
88 } else if (this.trackUnknownProperties && !this.knownPropertyPaths[keyPointerPath]) {
89 this.unknownPropertyPaths[keyPointerPath] = true;
90 }
91 } else if (this.trackUnknownProperties) {
92 this.knownPropertyPaths[keyPointerPath] = true;
93 delete this.unknownPropertyPaths[keyPointerPath];
94 }
95 }
96 return null;
97 };
98
99 ValidatorContext.prototype.validateObjectDependencies = function validateObjectDependencies(data, schema, dataPointerPath) {
100 var error;
101 if (schema.dependencies !== undefined) {
102 for (var depKey in schema.dependencies) {
103 if (data[depKey] !== undefined) {
104 var dep = schema.dependencies[depKey];
105 if (typeof dep === "string") {
106 if (data[dep] === undefined) {
107 error = this.createError(ErrorCodes.OBJECT_DEPENDENCY_KEY, {key: depKey, missing: dep}, '', '', null, data, schema).prefixWith(null, depKey).prefixWith(null, "dependencies");
108 if (this.handleError(error)) {
109 return error;
110 }
111 }
112 } else if (Array.isArray(dep)) {
113 for (var i = 0; i < dep.length; i++) {
114 var requiredKey = dep[i];
115 if (data[requiredKey] === undefined) {
116 error = this.createError(ErrorCodes.OBJECT_DEPENDENCY_KEY, {key: depKey, missing: requiredKey}, '', '/' + i, null, data, schema).prefixWith(null, depKey).prefixWith(null, "dependencies");
117 if (this.handleError(error)) {
118 return error;
119 }
120 }
121 }
122 } else {
123 if (error = this.validateAll(data, dep, [], ["dependencies", depKey], dataPointerPath)) {
124 return error;
125 }
126 }
127 }
128 }
129 }
130 return null;
131 };
+0
-49
source/resolve-uri.js less more
0 // parseURI() and resolveUrl() are from https://gist.github.com/1088850
1 // - released as public domain by author ("Yaffle") - see comments on gist
2
3 function parseURI(url) {
4 var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
5 // authority = '//' + user + ':' + pass '@' + hostname + ':' port
6 return (m ? {
7 href : m[0] || '',
8 protocol : m[1] || '',
9 authority: m[2] || '',
10 host : m[3] || '',
11 hostname : m[4] || '',
12 port : m[5] || '',
13 pathname : m[6] || '',
14 search : m[7] || '',
15 hash : m[8] || ''
16 } : null);
17 }
18
19 function resolveUrl(base, href) {// RFC 3986
20
21 function removeDotSegments(input) {
22 var output = [];
23 input.replace(/^(\.\.?(\/|$))+/, '')
24 .replace(/\/(\.(\/|$))+/g, '/')
25 .replace(/\/\.\.$/, '/../')
26 .replace(/\/?[^\/]*/g, function (p) {
27 if (p === '/..') {
28 output.pop();
29 } else {
30 output.push(p);
31 }
32 });
33 return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : '');
34 }
35
36 href = parseURI(href || '');
37 base = parseURI(base || '');
38
39 return !href || !base ? null : (href.protocol || base.protocol) +
40 (href.protocol || href.authority ? href.authority : base.authority) +
41 removeDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : (href.pathname ? ((base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname) : base.pathname)) +
42 (href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) +
43 href.hash;
44 }
45
46 function getDocumentUri(uri) {
47 return uri.split('#')[0];
48 }
+0
-50
source/string.js less more
0 ValidatorContext.prototype.validateString = function validateString(data, schema, dataPointerPath) {
1 return this.validateStringLength(data, schema, dataPointerPath)
2 || this.validateStringPattern(data, schema, dataPointerPath)
3 || null;
4 };
5
6 ValidatorContext.prototype.validateStringLength = function validateStringLength(data, schema) {
7 if (typeof data !== "string") {
8 return null;
9 }
10 if (schema.minLength !== undefined) {
11 if (data.length < schema.minLength) {
12 return this.createError(ErrorCodes.STRING_LENGTH_SHORT, {length: data.length, minimum: schema.minLength}, '', '/minLength', null, data, schema);
13 }
14 }
15 if (schema.maxLength !== undefined) {
16 if (data.length > schema.maxLength) {
17 return this.createError(ErrorCodes.STRING_LENGTH_LONG, {length: data.length, maximum: schema.maxLength}, '', '/maxLength', null, data, schema);
18 }
19 }
20 return null;
21 };
22
23 ValidatorContext.prototype.validateStringPattern = function validateStringPattern(data, schema) {
24 if (typeof data !== "string" || (typeof schema.pattern !== "string" && !(schema.pattern instanceof RegExp))) {
25 return null;
26 }
27 var regexp;
28 if (schema.pattern instanceof RegExp) {
29 regexp = schema.pattern;
30 }
31 else {
32 var body, flags = '';
33 // Check for regular expression literals
34 // @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5
35 var literal = schema.pattern.match(/^\/(.+)\/([img]*)$/);
36 if (literal) {
37 body = literal[1];
38 flags = literal[2];
39 }
40 else {
41 body = schema.pattern;
42 }
43 regexp = new RegExp(body, flags);
44 }
45 if (!regexp.test(data)) {
46 return this.createError(ErrorCodes.STRING_PATTERN, {pattern: schema.pattern}, '', '/pattern', null, data, schema);
47 }
48 return null;
49 };
+0
-189
source/uri-template-fill.js less more
0 // Based on: https://github.com/geraintluff/uri-templates, but with all the de-substitution stuff removed
1
2 var uriTemplateGlobalModifiers = {
3 "+": true,
4 "#": true,
5 ".": true,
6 "/": true,
7 ";": true,
8 "?": true,
9 "&": true
10 };
11 var uriTemplateSuffices = {
12 "*": true
13 };
14
15 function notReallyPercentEncode(string) {
16 return encodeURI(string).replace(/%25[0-9][0-9]/g, function (doubleEncoded) {
17 return "%" + doubleEncoded.substring(3);
18 });
19 }
20
21 function uriTemplateSubstitution(spec) {
22 var modifier = "";
23 if (uriTemplateGlobalModifiers[spec.charAt(0)]) {
24 modifier = spec.charAt(0);
25 spec = spec.substring(1);
26 }
27 var separator = "";
28 var prefix = "";
29 var shouldEscape = true;
30 var showVariables = false;
31 var trimEmptyString = false;
32 if (modifier === '+') {
33 shouldEscape = false;
34 } else if (modifier === ".") {
35 prefix = ".";
36 separator = ".";
37 } else if (modifier === "/") {
38 prefix = "/";
39 separator = "/";
40 } else if (modifier === '#') {
41 prefix = "#";
42 shouldEscape = false;
43 } else if (modifier === ';') {
44 prefix = ";";
45 separator = ";";
46 showVariables = true;
47 trimEmptyString = true;
48 } else if (modifier === '?') {
49 prefix = "?";
50 separator = "&";
51 showVariables = true;
52 } else if (modifier === '&') {
53 prefix = "&";
54 separator = "&";
55 showVariables = true;
56 }
57
58 var varNames = [];
59 var varList = spec.split(",");
60 var varSpecs = [];
61 var varSpecMap = {};
62 for (var i = 0; i < varList.length; i++) {
63 var varName = varList[i];
64 var truncate = null;
65 if (varName.indexOf(":") !== -1) {
66 var parts = varName.split(":");
67 varName = parts[0];
68 truncate = parseInt(parts[1], 10);
69 }
70 var suffices = {};
71 while (uriTemplateSuffices[varName.charAt(varName.length - 1)]) {
72 suffices[varName.charAt(varName.length - 1)] = true;
73 varName = varName.substring(0, varName.length - 1);
74 }
75 var varSpec = {
76 truncate: truncate,
77 name: varName,
78 suffices: suffices
79 };
80 varSpecs.push(varSpec);
81 varSpecMap[varName] = varSpec;
82 varNames.push(varName);
83 }
84 var subFunction = function (valueFunction) {
85 var result = "";
86 var startIndex = 0;
87 for (var i = 0; i < varSpecs.length; i++) {
88 var varSpec = varSpecs[i];
89 var value = valueFunction(varSpec.name);
90 if (value === null || value === undefined || (Array.isArray(value) && value.length === 0) || (typeof value === 'object' && Object.keys(value).length === 0)) {
91 startIndex++;
92 continue;
93 }
94 if (i === startIndex) {
95 result += prefix;
96 } else {
97 result += (separator || ",");
98 }
99 if (Array.isArray(value)) {
100 if (showVariables) {
101 result += varSpec.name + "=";
102 }
103 for (var j = 0; j < value.length; j++) {
104 if (j > 0) {
105 result += varSpec.suffices['*'] ? (separator || ",") : ",";
106 if (varSpec.suffices['*'] && showVariables) {
107 result += varSpec.name + "=";
108 }
109 }
110 result += shouldEscape ? encodeURIComponent(value[j]).replace(/!/g, "%21") : notReallyPercentEncode(value[j]);
111 }
112 } else if (typeof value === "object") {
113 if (showVariables && !varSpec.suffices['*']) {
114 result += varSpec.name + "=";
115 }
116 var first = true;
117 for (var key in value) {
118 if (!first) {
119 result += varSpec.suffices['*'] ? (separator || ",") : ",";
120 }
121 first = false;
122 result += shouldEscape ? encodeURIComponent(key).replace(/!/g, "%21") : notReallyPercentEncode(key);
123 result += varSpec.suffices['*'] ? '=' : ",";
124 result += shouldEscape ? encodeURIComponent(value[key]).replace(/!/g, "%21") : notReallyPercentEncode(value[key]);
125 }
126 } else {
127 if (showVariables) {
128 result += varSpec.name;
129 if (!trimEmptyString || value !== "") {
130 result += "=";
131 }
132 }
133 if (varSpec.truncate != null) {
134 value = value.substring(0, varSpec.truncate);
135 }
136 result += shouldEscape ? encodeURIComponent(value).replace(/!/g, "%21"): notReallyPercentEncode(value);
137 }
138 }
139 return result;
140 };
141 subFunction.varNames = varNames;
142 return {
143 prefix: prefix,
144 substitution: subFunction
145 };
146 }
147
148 function UriTemplate(template) {
149 if (!(this instanceof UriTemplate)) {
150 return new UriTemplate(template);
151 }
152 var parts = template.split("{");
153 var textParts = [parts.shift()];
154 var prefixes = [];
155 var substitutions = [];
156 var varNames = [];
157 while (parts.length > 0) {
158 var part = parts.shift();
159 var spec = part.split("}")[0];
160 var remainder = part.substring(spec.length + 1);
161 var funcs = uriTemplateSubstitution(spec);
162 substitutions.push(funcs.substitution);
163 prefixes.push(funcs.prefix);
164 textParts.push(remainder);
165 varNames = varNames.concat(funcs.substitution.varNames);
166 }
167 this.fill = function (valueFunction) {
168 var result = textParts[0];
169 for (var i = 0; i < substitutions.length; i++) {
170 var substitution = substitutions[i];
171 result += substitution(valueFunction);
172 result += textParts[i + 1];
173 }
174 return result;
175 };
176 this.varNames = varNames;
177 this.template = template;
178 }
179 UriTemplate.prototype = {
180 toString: function () {
181 return this.template;
182 },
183 fillFromObject: function (obj) {
184 return this.fill(function (varName) {
185 return obj[varName];
186 });
187 }
188 };
+0
-397
source/validate.js less more
0 var ValidatorContext = function ValidatorContext(parent, collectMultiple, errorReporter, checkRecursive, trackUnknownProperties) {
1 this.missing = [];
2 this.missingMap = {};
3 this.formatValidators = parent ? Object.create(parent.formatValidators) : {};
4 this.schemas = parent ? Object.create(parent.schemas) : {};
5 this.collectMultiple = collectMultiple;
6 this.errors = [];
7 this.handleError = collectMultiple ? this.collectError : this.returnError;
8 if (checkRecursive) {
9 this.checkRecursive = true;
10 this.scanned = [];
11 this.scannedFrozen = [];
12 this.scannedFrozenSchemas = [];
13 this.scannedFrozenValidationErrors = [];
14 this.validatedSchemasKey = 'tv4_validation_id';
15 this.validationErrorsKey = 'tv4_validation_errors_id';
16 }
17 if (trackUnknownProperties) {
18 this.trackUnknownProperties = true;
19 this.knownPropertyPaths = {};
20 this.unknownPropertyPaths = {};
21 }
22 this.errorReporter = errorReporter || defaultErrorReporter('en');
23 if (typeof this.errorReporter === 'string') {
24 throw new Error('debug');
25 }
26 this.definedKeywords = {};
27 if (parent) {
28 for (var key in parent.definedKeywords) {
29 this.definedKeywords[key] = parent.definedKeywords[key].slice(0);
30 }
31 }
32 };
33 ValidatorContext.prototype.defineKeyword = function (keyword, keywordFunction) {
34 this.definedKeywords[keyword] = this.definedKeywords[keyword] || [];
35 this.definedKeywords[keyword].push(keywordFunction);
36 };
37 ValidatorContext.prototype.createError = function (code, messageParams, dataPath, schemaPath, subErrors, data, schema) {
38 var error = new ValidationError(code, messageParams, dataPath, schemaPath, subErrors);
39 error.message = this.errorReporter(error, data, schema);
40 return error;
41 };
42 ValidatorContext.prototype.returnError = function (error) {
43 return error;
44 };
45 ValidatorContext.prototype.collectError = function (error) {
46 if (error) {
47 this.errors.push(error);
48 }
49 return null;
50 };
51 ValidatorContext.prototype.prefixErrors = function (startIndex, dataPath, schemaPath) {
52 for (var i = startIndex; i < this.errors.length; i++) {
53 this.errors[i] = this.errors[i].prefixWith(dataPath, schemaPath);
54 }
55 return this;
56 };
57 ValidatorContext.prototype.banUnknownProperties = function (data, schema) {
58 for (var unknownPath in this.unknownPropertyPaths) {
59 var error = this.createError(ErrorCodes.UNKNOWN_PROPERTY, {path: unknownPath}, unknownPath, "", null, data, schema);
60 var result = this.handleError(error);
61 if (result) {
62 return result;
63 }
64 }
65 return null;
66 };
67
68 ValidatorContext.prototype.addFormat = function (format, validator) {
69 if (typeof format === 'object') {
70 for (var key in format) {
71 this.addFormat(key, format[key]);
72 }
73 return this;
74 }
75 this.formatValidators[format] = validator;
76 };
77 ValidatorContext.prototype.resolveRefs = function (schema, urlHistory) {
78 if (schema['$ref'] !== undefined) {
79 urlHistory = urlHistory || {};
80 if (urlHistory[schema['$ref']]) {
81 return this.createError(ErrorCodes.CIRCULAR_REFERENCE, {urls: Object.keys(urlHistory).join(', ')}, '', '', null, undefined, schema);
82 }
83 urlHistory[schema['$ref']] = true;
84 schema = this.getSchema(schema['$ref'], urlHistory);
85 }
86 return schema;
87 };
88 ValidatorContext.prototype.getSchema = function (url, urlHistory) {
89 var schema;
90 if (this.schemas[url] !== undefined) {
91 schema = this.schemas[url];
92 return this.resolveRefs(schema, urlHistory);
93 }
94 var baseUrl = url;
95 var fragment = "";
96 if (url.indexOf('#') !== -1) {
97 fragment = url.substring(url.indexOf("#") + 1);
98 baseUrl = url.substring(0, url.indexOf("#"));
99 }
100 if (typeof this.schemas[baseUrl] === 'object') {
101 schema = this.schemas[baseUrl];
102 var pointerPath = decodeURIComponent(fragment);
103 if (pointerPath === "") {
104 return this.resolveRefs(schema, urlHistory);
105 } else if (pointerPath.charAt(0) !== "/") {
106 return undefined;
107 }
108 var parts = pointerPath.split("/").slice(1);
109 for (var i = 0; i < parts.length; i++) {
110 var component = parts[i].replace(/~1/g, "/").replace(/~0/g, "~");
111 if (schema[component] === undefined) {
112 schema = undefined;
113 break;
114 }
115 schema = schema[component];
116 }
117 if (schema !== undefined) {
118 return this.resolveRefs(schema, urlHistory);
119 }
120 }
121 if (this.missing[baseUrl] === undefined) {
122 this.missing.push(baseUrl);
123 this.missing[baseUrl] = baseUrl;
124 this.missingMap[baseUrl] = baseUrl;
125 }
126 };
127 ValidatorContext.prototype.searchSchemas = function (schema, url) {
128 if (Array.isArray(schema)) {
129 for (var i = 0; i < schema.length; i++) {
130 this.searchSchemas(schema[i], url);
131 }
132 } else if (schema && typeof schema === "object") {
133 if (typeof schema.id === "string") {
134 if (isTrustedUrl(url, schema.id)) {
135 if (this.schemas[schema.id] === undefined) {
136 this.schemas[schema.id] = schema;
137 }
138 }
139 }
140 for (var key in schema) {
141 if (key !== "enum") {
142 if (typeof schema[key] === "object") {
143 this.searchSchemas(schema[key], url);
144 } else if (key === "$ref") {
145 var uri = getDocumentUri(schema[key]);
146 if (uri && this.schemas[uri] === undefined && this.missingMap[uri] === undefined) {
147 this.missingMap[uri] = uri;
148 }
149 }
150 }
151 }
152 }
153 };
154 ValidatorContext.prototype.addSchema = function (url, schema) {
155 //overload
156 if (typeof url !== 'string' || typeof schema === 'undefined') {
157 if (typeof url === 'object' && typeof url.id === 'string') {
158 schema = url;
159 url = schema.id;
160 }
161 else {
162 return;
163 }
164 }
165 if (url === getDocumentUri(url) + "#") {
166 // Remove empty fragment
167 url = getDocumentUri(url);
168 }
169 this.schemas[url] = schema;
170 delete this.missingMap[url];
171 normSchema(schema, url);
172 this.searchSchemas(schema, url);
173 };
174
175 ValidatorContext.prototype.getSchemaMap = function () {
176 var map = {};
177 for (var key in this.schemas) {
178 map[key] = this.schemas[key];
179 }
180 return map;
181 };
182
183 ValidatorContext.prototype.getSchemaUris = function (filterRegExp) {
184 var list = [];
185 for (var key in this.schemas) {
186 if (!filterRegExp || filterRegExp.test(key)) {
187 list.push(key);
188 }
189 }
190 return list;
191 };
192
193 ValidatorContext.prototype.getMissingUris = function (filterRegExp) {
194 var list = [];
195 for (var key in this.missingMap) {
196 if (!filterRegExp || filterRegExp.test(key)) {
197 list.push(key);
198 }
199 }
200 return list;
201 };
202
203 ValidatorContext.prototype.dropSchemas = function () {
204 this.schemas = {};
205 this.reset();
206 };
207 ValidatorContext.prototype.reset = function () {
208 this.missing = [];
209 this.missingMap = {};
210 this.errors = [];
211 };
212
213 ValidatorContext.prototype.validateAll = function (data, schema, dataPathParts, schemaPathParts, dataPointerPath) {
214 var topLevel;
215 schema = this.resolveRefs(schema);
216 if (!schema) {
217 return null;
218 } else if (schema instanceof ValidationError) {
219 this.errors.push(schema);
220 return schema;
221 }
222
223 var startErrorCount = this.errors.length;
224 var frozenIndex, scannedFrozenSchemaIndex = null, scannedSchemasIndex = null;
225 if (this.checkRecursive && data && typeof data === 'object') {
226 topLevel = !this.scanned.length;
227 if (data[this.validatedSchemasKey]) {
228 var schemaIndex = data[this.validatedSchemasKey].indexOf(schema);
229 if (schemaIndex !== -1) {
230 this.errors = this.errors.concat(data[this.validationErrorsKey][schemaIndex]);
231 return null;
232 }
233 }
234 if (Object.isFrozen(data)) {
235 frozenIndex = this.scannedFrozen.indexOf(data);
236 if (frozenIndex !== -1) {
237 var frozenSchemaIndex = this.scannedFrozenSchemas[frozenIndex].indexOf(schema);
238 if (frozenSchemaIndex !== -1) {
239 this.errors = this.errors.concat(this.scannedFrozenValidationErrors[frozenIndex][frozenSchemaIndex]);
240 return null;
241 }
242 }
243 }
244 this.scanned.push(data);
245 if (Object.isFrozen(data)) {
246 if (frozenIndex === -1) {
247 frozenIndex = this.scannedFrozen.length;
248 this.scannedFrozen.push(data);
249 this.scannedFrozenSchemas.push([]);
250 }
251 scannedFrozenSchemaIndex = this.scannedFrozenSchemas[frozenIndex].length;
252 this.scannedFrozenSchemas[frozenIndex][scannedFrozenSchemaIndex] = schema;
253 this.scannedFrozenValidationErrors[frozenIndex][scannedFrozenSchemaIndex] = [];
254 } else {
255 if (!data[this.validatedSchemasKey]) {
256 try {
257 Object.defineProperty(data, this.validatedSchemasKey, {
258 value: [],
259 configurable: true
260 });
261 Object.defineProperty(data, this.validationErrorsKey, {
262 value: [],
263 configurable: true
264 });
265 } catch (e) {
266 //IE 7/8 workaround
267 data[this.validatedSchemasKey] = [];
268 data[this.validationErrorsKey] = [];
269 }
270 }
271 scannedSchemasIndex = data[this.validatedSchemasKey].length;
272 data[this.validatedSchemasKey][scannedSchemasIndex] = schema;
273 data[this.validationErrorsKey][scannedSchemasIndex] = [];
274 }
275 }
276
277 var errorCount = this.errors.length;
278 var error = this.validateBasic(data, schema, dataPointerPath)
279 || this.validateNumeric(data, schema, dataPointerPath)
280 || this.validateString(data, schema, dataPointerPath)
281 || this.validateArray(data, schema, dataPointerPath)
282 || this.validateObject(data, schema, dataPointerPath)
283 || this.validateCombinations(data, schema, dataPointerPath)
284 || this.validateHypermedia(data, schema, dataPointerPath)
285 || this.validateFormat(data, schema, dataPointerPath)
286 || this.validateDefinedKeywords(data, schema, dataPointerPath)
287 || null;
288
289 if (topLevel) {
290 while (this.scanned.length) {
291 var item = this.scanned.pop();
292 delete item[this.validatedSchemasKey];
293 }
294 this.scannedFrozen = [];
295 this.scannedFrozenSchemas = [];
296 }
297
298 if (error || errorCount !== this.errors.length) {
299 while ((dataPathParts && dataPathParts.length) || (schemaPathParts && schemaPathParts.length)) {
300 var dataPart = (dataPathParts && dataPathParts.length) ? "" + dataPathParts.pop() : null;
301 var schemaPart = (schemaPathParts && schemaPathParts.length) ? "" + schemaPathParts.pop() : null;
302 if (error) {
303 error = error.prefixWith(dataPart, schemaPart);
304 }
305 this.prefixErrors(errorCount, dataPart, schemaPart);
306 }
307 }
308
309 if (scannedFrozenSchemaIndex !== null) {
310 this.scannedFrozenValidationErrors[frozenIndex][scannedFrozenSchemaIndex] = this.errors.slice(startErrorCount);
311 } else if (scannedSchemasIndex !== null) {
312 data[this.validationErrorsKey][scannedSchemasIndex] = this.errors.slice(startErrorCount);
313 }
314
315 return this.handleError(error);
316 };
317 ValidatorContext.prototype.validateFormat = function (data, schema) {
318 if (typeof schema.format !== 'string' || !this.formatValidators[schema.format]) {
319 return null;
320 }
321 var errorMessage = this.formatValidators[schema.format].call(null, data, schema);
322 if (typeof errorMessage === 'string' || typeof errorMessage === 'number') {
323 return this.createError(ErrorCodes.FORMAT_CUSTOM, {message: errorMessage}, '', '/format', null, data, schema);
324 } else if (errorMessage && typeof errorMessage === 'object') {
325 return this.createError(ErrorCodes.FORMAT_CUSTOM, {message: errorMessage.message || "?"}, errorMessage.dataPath || '', errorMessage.schemaPath || "/format", null, data, schema);
326 }
327 return null;
328 };
329 ValidatorContext.prototype.validateDefinedKeywords = function (data, schema, dataPointerPath) {
330 for (var key in this.definedKeywords) {
331 if (typeof schema[key] === 'undefined') {
332 continue;
333 }
334 var validationFunctions = this.definedKeywords[key];
335 for (var i = 0; i < validationFunctions.length; i++) {
336 var func = validationFunctions[i];
337 var result = func(data, schema[key], schema, dataPointerPath);
338 if (typeof result === 'string' || typeof result === 'number') {
339 return this.createError(ErrorCodes.KEYWORD_CUSTOM, {key: key, message: result}, '', '', null, data, schema).prefixWith(null, key);
340 } else if (result && typeof result === 'object') {
341 var code = result.code;
342 if (typeof code === 'string') {
343 if (!ErrorCodes[code]) {
344 throw new Error('Undefined error code (use defineError): ' + code);
345 }
346 code = ErrorCodes[code];
347 } else if (typeof code !== 'number') {
348 code = ErrorCodes.KEYWORD_CUSTOM;
349 }
350 var messageParams = (typeof result.message === 'object') ? result.message : {key: key, message: result.message || "?"};
351 var schemaPath = result.schemaPath || ("/" + key.replace(/~/g, '~0').replace(/\//g, '~1'));
352 return this.createError(code, messageParams, result.dataPath || null, schemaPath, null, data, schema);
353 }
354 }
355 }
356 return null;
357 };
358
359 function recursiveCompare(A, B) {
360 if (A === B) {
361 return true;
362 }
363 if (A && B && typeof A === "object" && typeof B === "object") {
364 if (Array.isArray(A) !== Array.isArray(B)) {
365 return false;
366 } else if (Array.isArray(A)) {
367 if (A.length !== B.length) {
368 return false;
369 }
370 for (var i = 0; i < A.length; i++) {
371 if (!recursiveCompare(A[i], B[i])) {
372 return false;
373 }
374 }
375 } else {
376 var key;
377 for (key in A) {
378 if (B[key] === undefined && A[key] !== undefined) {
379 return false;
380 }
381 }
382 for (key in B) {
383 if (A[key] === undefined && B[key] !== undefined) {
384 return false;
385 }
386 }
387 for (key in A) {
388 if (!recursiveCompare(A[key], B[key])) {
389 return false;
390 }
391 }
392 }
393 return true;
394 }
395 return false;
396 }
+0
-145
test/_header.js less more
0 "use strict";
1
2 //need to declare these for node and modern browsers
3 var tv4;
4 var assert;
5
6 if (typeof process === 'object' && typeof process.cwd !== 'undefined') {
7 // NodeJS
8 tv4 = require('./../').tv4;
9 assert = require('proclaim');
10 require('source-map-support').install();
11
12 var fs = require('fs');
13 var getJSON = function (file) {
14 var json;
15 try {
16 json = JSON.parse(fs.readFileSync(file, 'utf8'));
17 }
18 catch (e) {
19 assert.fail(e, null, file + ': ' + String(e), 'getJSON');
20 }
21 assert.isObject(json, file);
22 return json;
23 };
24 assert.isFile = function(file, msg) {
25 if (!fs.existsSync(file)){
26 assert.fail(false, true, msg + ': missing file ' + file, 'existsSync');
27 }
28 };
29
30 describe('Verify package definition files', function (){
31 var pkg;
32 var component;
33 var bower;
34 it('pkg', function () {
35 pkg = getJSON('./package.json');
36
37 assert.property(pkg, 'main', 'main');
38 assert.isFile(pkg.main, 'main');
39 });
40 it('component', function () {
41 component = getJSON('./component.json');
42
43 assert.property(component, 'main', 'main');
44 assert.isFile(component.main, 'main');
45
46 component.scripts.forEach(function(name) {
47 assert.isFile(name, 'scripts');
48 });
49 });
50 it('bower', function () {
51 bower = getJSON('./bower.json');
52
53 assert.property(bower, 'main', 'main');
54 assert.isFile(bower.main, 'main');
55
56 // should verify ignore field
57 });
58 });
59 }
60 else if (typeof window !== 'undefined') {
61 // import for browser, use from IE7/8 global bypass
62 assert = window.refs.assert;
63 tv4 = window.refs.tv4;
64 }
65
66 //check if we got everything
67 if (!tv4) {
68 throw new Error('tv4 not found');
69 }
70 if (!assert) {
71 throw new Error('proclaim not found');
72 }
73 var helper = {};
74 helper.dumpJSON = function (value) {
75 console.log(JSON.stringify(value, null, 2));
76 };
77
78
79 beforeEach(function () {
80 tv4 = tv4.freshApi();
81 });
82
83
84 //duck patch standard assert to chai
85 //quick-and-dirty wrappers
86 assert.property = function (object, property, message) {
87 if (typeof object[property] === 'undefined') {
88 assert.fail(object, property, message, 'have property');
89 }
90 };
91 assert.notProperty = function (object, property, message) {
92 if (typeof object[property] !== 'undefined') {
93 assert.fail(object, property, message, 'not have property');
94 }
95 };
96
97 assert.ownProperty = function (object, property, message) {
98 if (!object.hasOwnProperty(property)) {
99 assert.fail(object, property, message, 'have own property');
100 }
101 };
102 assert.notOwnProperty = function (object, property, message) {
103 if (object.hasOwnProperty(property)) {
104 assert.fail(object, property, message, 'not have own property');
105 }
106 };
107
108 //not ideal at all
109 assert.propertyVal = function (object, property, value, message) {
110 assert.property(object, property, message);
111 assert.strictEqual(object[property], value, message);
112 };
113 assert.propertyNotVal = function (object, property, value, message) {
114 assert.property(object, property, message);
115 assert.notStrictEqual(object[property], value, message);
116 };
117 assert.ownPropertyVal = function (object, property, value, message) {
118 assert.ownProperty(object, property, message);
119 assert.strictEqual(object[property], value, message);
120 };
121 assert.notOwnPropertyVal = function (object, property, value, message) {
122 assert.notOwnProperty(object, property, message);
123 assert.notStrictEqual(object[property], value, message);
124 };
125 assert.propertyValues = function (object, properties, value, message) {
126 assert.isObject(object, message);
127 assert.isObject(properties, message);
128 //copy properties
129 var props = {};
130 for (var name in properties) {
131 props[name] = object[name];
132 }
133 assert.deepEqual(props, properties, message);
134 };
135 //import when fix is pushed
136 assert.notOk = function (value, message) {
137 if (!!value) {
138 assert.fail(value, true, message, '!=');
139 }
140 };
141
142 /* jshint -W060 */
143
144 //end of header.js
+0
-2636
test/all_concat.js less more
0 "use strict";
1
2 //need to declare these for node and modern browsers
3 var tv4;
4 var assert;
5
6 if (typeof process === 'object' && typeof process.cwd !== 'undefined') {
7 // NodeJS
8 tv4 = require('./../').tv4;
9 assert = require('proclaim');
10 require('source-map-support').install();
11
12 var fs = require('fs');
13 var getJSON = function (file) {
14 var json;
15 try {
16 json = JSON.parse(fs.readFileSync(file, 'utf8'));
17 }
18 catch (e) {
19 assert.fail(e, null, file + ': ' + String(e), 'getJSON');
20 }
21 assert.isObject(json, file);
22 return json;
23 };
24 assert.isFile = function(file, msg) {
25 if (!fs.existsSync(file)){
26 assert.fail(false, true, msg + ': missing file ' + file, 'existsSync');
27 }
28 };
29
30 describe('Verify package definition files', function (){
31 var pkg;
32 var component;
33 var bower;
34 it('pkg', function () {
35 pkg = getJSON('./package.json');
36
37 assert.property(pkg, 'main', 'main');
38 assert.isFile(pkg.main, 'main');
39 });
40 it('component', function () {
41 component = getJSON('./component.json');
42
43 assert.property(component, 'main', 'main');
44 assert.isFile(component.main, 'main');
45
46 component.scripts.forEach(function(name) {
47 assert.isFile(name, 'scripts');
48 });
49 });
50 it('bower', function () {
51 bower = getJSON('./bower.json');
52
53 assert.property(bower, 'main', 'main');
54 assert.isFile(bower.main, 'main');
55
56 // should verify ignore field
57 });
58 });
59 }
60 else if (typeof window !== 'undefined') {
61 // import for browser, use from IE7/8 global bypass
62 assert = window.refs.assert;
63 tv4 = window.refs.tv4;
64 }
65
66 //check if we got everything
67 if (!tv4) {
68 throw new Error('tv4 not found');
69 }
70 if (!assert) {
71 throw new Error('proclaim not found');
72 }
73 var helper = {};
74 helper.dumpJSON = function (value) {
75 console.log(JSON.stringify(value, null, 2));
76 };
77
78
79 beforeEach(function () {
80 tv4 = tv4.freshApi();
81 });
82
83
84 //duck patch standard assert to chai
85 //quick-and-dirty wrappers
86 assert.property = function (object, property, message) {
87 if (typeof object[property] === 'undefined') {
88 assert.fail(object, property, message, 'have property');
89 }
90 };
91 assert.notProperty = function (object, property, message) {
92 if (typeof object[property] !== 'undefined') {
93 assert.fail(object, property, message, 'not have property');
94 }
95 };
96
97 assert.ownProperty = function (object, property, message) {
98 if (!object.hasOwnProperty(property)) {
99 assert.fail(object, property, message, 'have own property');
100 }
101 };
102 assert.notOwnProperty = function (object, property, message) {
103 if (object.hasOwnProperty(property)) {
104 assert.fail(object, property, message, 'not have own property');
105 }
106 };
107
108 //not ideal at all
109 assert.propertyVal = function (object, property, value, message) {
110 assert.property(object, property, message);
111 assert.strictEqual(object[property], value, message);
112 };
113 assert.propertyNotVal = function (object, property, value, message) {
114 assert.property(object, property, message);
115 assert.notStrictEqual(object[property], value, message);
116 };
117 assert.ownPropertyVal = function (object, property, value, message) {
118 assert.ownProperty(object, property, message);
119 assert.strictEqual(object[property], value, message);
120 };
121 assert.notOwnPropertyVal = function (object, property, value, message) {
122 assert.notOwnProperty(object, property, message);
123 assert.notStrictEqual(object[property], value, message);
124 };
125 assert.propertyValues = function (object, properties, value, message) {
126 assert.isObject(object, message);
127 assert.isObject(properties, message);
128 //copy properties
129 var props = {};
130 for (var name in properties) {
131 props[name] = object[name];
132 }
133 assert.deepEqual(props, properties, message);
134 };
135 //import when fix is pushed
136 assert.notOk = function (value, message) {
137 if (!!value) {
138 assert.fail(value, true, message, '!=');
139 }
140 };
141
142 /* jshint -W060 */
143
144 //end of header.js
145
146 describe("Core 01", function () {
147
148 it("getDocumentUri returns only location part of url", function () {
149
150 assert.strictEqual(tv4.getDocumentUri("http://example.com"), "http://example.com");
151
152 assert.strictEqual(tv4.getDocumentUri("http://example.com/main"), "http://example.com/main");
153 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/"), "http://example.com/main/");
154 //assert.strictEqual(tv4.getDocumentUri("http://example.com/main//"), "http://example.com/main/");
155
156 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/sub"), "http://example.com/main/sub");
157 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/sub/"), "http://example.com/main/sub/");
158
159 assert.strictEqual(tv4.getDocumentUri("http://example.com/main#"), "http://example.com/main");
160 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/sub/#"), "http://example.com/main/sub/");
161
162 assert.strictEqual(tv4.getDocumentUri("http://example.com/main?"), "http://example.com/main?");
163 assert.strictEqual(tv4.getDocumentUri("http://example.com/main?q=1"), "http://example.com/main?q=1");
164 assert.strictEqual(tv4.getDocumentUri("http://example.com/main?q=1#abc"), "http://example.com/main?q=1");
165
166 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/#"), "http://example.com/main/");
167 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/#?"), "http://example.com/main/");
168 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/#?q=a/b/c"), "http://example.com/main/");
169 });
170 });
171
172 describe("Core 02", function () {
173
174 it("tv4.freshApi() produces working copy", function () {
175 var duplicate = tv4.freshApi();
176 assert.isObject(duplicate);
177 // Basic sanity checks
178 assert.isTrue(duplicate.validate({}, {type: "object"}));
179 assert.isObject(duplicate.validateMultiple("string", {}));
180 });
181
182 it("tv4.freshApi() has separate schema store", function () {
183 var duplicate = tv4.freshApi();
184
185 var schemaUrl1 = "http://example.com/schema/schema1";
186 var schemaUrl2 = "http://example.com/schema/schema2";
187 duplicate.addSchema(schemaUrl1, {});
188 tv4.addSchema(schemaUrl2, {});
189
190 assert.isObject(duplicate.getSchema(schemaUrl1));
191 assert.isUndefined(tv4.getSchema(schemaUrl1));
192 assert.isUndefined(duplicate.getSchema(schemaUrl2));
193 assert.isObject(tv4.getSchema(schemaUrl2));
194 });
195 });
196
197 describe("Core 03", function () {
198
199 it("tv4.dropSchemas() drops stored schemas", function () {
200 var schema = {
201 "items": {"$ref": "http://example.com/schema/items#"},
202 "maxItems": 2
203 };
204 tv4.addSchema("http://example.com/schema", schema);
205 assert.strictEqual(tv4.getSchema("http://example.com/schema"), schema, "has schema");
206
207 tv4.dropSchemas();
208 assert.isUndefined(tv4.getSchema("http://example.com/schema"), "doesn't have schema");
209 });
210
211 it("tv4.reset() clears errors, valid and missing", function () {
212 it("must be string, is integer", function () {
213 var data = 5;
214 var schema = {"type": "array", "items" : {"$ref" : "http://example.com"}};
215
216 assert.notOk(tv4.error, "starts with no error");
217 assert.isTrue(tv4.valid, "starts valid");
218 assert.length(tv4.missing, 0, "starts with 0 missing");
219
220 var valid = tv4.validate(data, schema);
221 assert.isFalse(valid);
222 assert.ok(tv4.error, "has error");
223 assert.isFalse(tv4.valid, "is invalid");
224 assert.length(tv4.missing, 1, "missing 1");
225
226 tv4.reset();
227 assert.notOk(tv4.error, "reset to no error");
228 assert.isTrue(tv4.valid, "reset to valid");
229 assert.length(tv4.missing, 0, "reset to 0 missing");
230 });
231 });
232 });
233
234 describe("Core 04", function () {
235
236 var schema = {
237 "type": "string"
238 };
239
240 it("ValidationError is Error subtype", function () {
241 var res = tv4.validateResult(123, schema);
242 assert.isObject(res);
243 assert.isObject(res.error);
244 assert.isInstanceOf(res.error, Error);
245 assert.isString(res.error.stack);
246 });
247
248 it("ValidationError has own stack trace", function () {
249 function errorA() {
250 var res = tv4.validateResult(123, schema);
251 assert.isFalse(res.valid);
252 assert.isString(res.error.stack);
253 assert.ok(res.error.stack.indexOf('errorA') > -1, 'has own stack trace A');
254 }
255
256 function errorB() {
257 var res = tv4.validateResult(123, schema);
258 assert.isFalse(res.valid);
259 assert.isString(res.error.stack);
260 assert.ok(res.error.stack.indexOf('errorB') > -1, 'has own stack trace B');
261 }
262 errorA();
263 errorB();
264 });
265 });
266
267 describe("Any types 01", function () {
268
269 it("no type specified", function () {
270 var data = {};
271 var schema = {};
272 var valid = tv4.validate(data, schema);
273 assert.isTrue(valid);
274 });
275
276 it("must be object, is object", function () {
277 var data = {};
278 var schema = {"type": "object"};
279 var valid = tv4.validate(data, schema);
280 assert.isTrue(valid);
281 });
282
283 it("must be object or string, is object", function () {
284 var data = {};
285 var schema = {"type": ["object", "string"]};
286 var valid = tv4.validate(data, schema);
287 assert.isTrue(valid);
288 });
289
290 it("must be object or string, is array", function () {
291 var data = [];
292 var schema = {"type": ["object", "string"]};
293 var valid = tv4.validate(data, schema);
294 assert.isFalse(valid);
295 });
296
297 it("must be array, is object", function () {
298 var data = {};
299 var schema = {"type": ["array"]};
300 var valid = tv4.validate(data, schema);
301 assert.isFalse(valid);
302 });
303
304 it("must be string, is integer", function () {
305 var data = 5;
306 var schema = {"type": ["string"]};
307 var valid = tv4.validate(data, schema);
308 assert.isFalse(valid);
309 });
310
311 it("must be object, is null", function () {
312 var data = null;
313 var schema = {"type": ["object"]};
314 var valid = tv4.validate(data, schema);
315 assert.isFalse(valid);
316 });
317
318 it("must be null, is null", function () {
319 var data = null;
320 var schema = {"type": "null"};
321 var valid = tv4.validate(data, schema);
322 assert.isTrue(valid);
323 });
324
325 it("doesn't crash on invalid type", function () {
326 var data = null;
327 var schema = {"type": {"foo": "bar"}};
328 var valid = tv4.validate(data, schema);
329 assert.isFalse(valid);
330 });
331 });
332
333 describe("Any types 01", function () {
334
335 it("enum [1], was 1", function () {
336 var data = 1;
337 var schema = {"enum": [1]};
338 var valid = tv4.validate(data, schema);
339 assert.isTrue(valid);
340 });
341
342 it("enum [1], was \"1\"", function () {
343 var data = "1";
344 var schema = {"enum": [1]};
345 var valid = tv4.validate(data, schema);
346 assert.isFalse(valid);
347 });
348
349 it("enum [{}], was {}", function () {
350 var data = {};
351 var schema = {"enum": [
352 {}
353 ]};
354 var valid = tv4.validate(data, schema);
355 assert.isTrue(valid);
356 });
357
358 it("enum [{\"key\":\"value\"], was {}", function () {
359 var data = {};
360 var schema = {"enum": [
361 {"key": "value"}
362 ]};
363 var valid = tv4.validate(data, schema);
364 assert.isFalse(valid);
365 });
366
367 it("enum [{\"key\":\"value\"], was {\"key\": \"value\"}", function () {
368 var data = {};
369 var schema = {"enum": [
370 {"key": "value"}
371 ]};
372 var valid = tv4.validate(data, schema);
373 assert.isFalse(valid);
374 });
375
376 it("Enum with array value - success", function () {
377 var data = [1, true, 0];
378 var schema = {"enum": [
379 [1, true, 0],
380 5,
381 {}
382 ]};
383 var valid = tv4.validate(data, schema);
384 assert.isTrue(valid);
385 });
386
387 it("Enum with array value - failure 1", function () {
388 var data = [1, true, 0, 5];
389 var schema = {"enum": [
390 [1, true, 0],
391 5,
392 {}
393 ]};
394 var valid = tv4.validate(data, schema);
395 assert.isFalse(valid);
396 });
397
398 it("Enum with array value - failure 2", function () {
399 var data = [1, true, 5];
400 var schema = {"enum": [
401 [1, true, 0],
402 5,
403 {}
404 ]};
405 var valid = tv4.validate(data, schema);
406 assert.isFalse(valid);
407 });
408 });
409
410 describe("Numeric - multipleOf", function () {
411
412 it("pass", function () {
413 var data = 5;
414 var schema = {"multipleOf": 2.5};
415 var valid = tv4.validate(data, schema);
416 assert.isTrue(valid);
417 });
418
419 it("fail", function () {
420 var data = 5;
421 var schema = {"multipleOf": 0.75};
422 var valid = tv4.validate(data, schema);
423 assert.isFalse(valid);
424 });
425
426 it("floating-point pass 6.6/2.2", function () {
427 var data = 6.6;
428 var schema = {"multipleOf": 2.2};
429 var valid = tv4.validate(data, schema);
430 assert.isTrue(valid);
431 });
432
433 it("floating-point pass 6.6666/2.2222", function () {
434 var data = 6.6666;
435 var schema = {"multipleOf": 2.2222};
436 var valid = tv4.validate(data, schema);
437 assert.isTrue(valid);
438 });
439 });
440 describe("Numberic 02", function () {
441
442 it("minimum success", function () {
443 var data = 5;
444 var schema = {minimum: 2.5};
445 var valid = tv4.validate(data, schema);
446 assert.isTrue(valid);
447 });
448
449 it("minimum failure", function () {
450 var data = 5;
451 var schema = {minimum: 7};
452 var valid = tv4.validate(data, schema);
453 assert.isFalse(valid);
454 });
455
456 it("minimum equality success", function () {
457 var data = 5;
458 var schema = {minimum: 5};
459 var valid = tv4.validate(data, schema);
460 assert.isTrue(valid);
461 });
462
463 it("minimum equality failure", function () {
464 var data = 5;
465 var schema = {minimum: 5, exclusiveMinimum: true};
466 var valid = tv4.validate(data, schema);
467 assert.isFalse(valid);
468 });
469
470 it("maximum success", function () {
471 var data = 5;
472 var schema = {maximum: 7};
473 var valid = tv4.validate(data, schema);
474 assert.isTrue(valid);
475 });
476
477 it("maximum failure", function () {
478 var data = -5;
479 var schema = {maximum: -10};
480 var valid = tv4.validate(data, schema);
481 assert.isFalse(valid);
482 });
483
484 it("maximum equality success", function () {
485 var data = 5;
486 var schema = {maximum: 5};
487 var valid = tv4.validate(data, schema);
488 assert.isTrue(valid);
489 });
490
491 it("maximum equality failure", function () {
492 var data = 5;
493 var schema = {maximum: 5, exclusiveMaximum: true};
494 var valid = tv4.validate(data, schema);
495 assert.isFalse(valid);
496 });
497 });
498
499 describe("Numeric 03", function () {
500
501 it("NaN failure", function() {
502 var data = NaN;
503 var schema = {};
504 var valid = tv4.validate(data, schema);
505 assert.isFalse(valid);
506 });
507
508 it("Infinity failure", function() {
509 var data = Infinity;
510 var schema = {};
511 var valid = tv4.validate(data, schema);
512 assert.isFalse(valid);
513 });
514
515 it("-Infinity failure", function() {
516 var data = -Infinity;
517 var schema = {};
518 var valid = tv4.validate(data, schema);
519 assert.isFalse(valid);
520 });
521
522 it("string to number failure", function() {
523 var data = Number('foo');
524 var schema = {};
525 var valid = tv4.validate(data, schema);
526 assert.isFalse(valid);
527 });
528
529 it("string to number success", function() {
530 var data = Number('123');
531 var schema = {};
532 var valid = tv4.validate(data, schema);
533 assert.isTrue(valid);
534 });
535
536 it("max value success", function() {
537 var data = Number.MAX_VALUE;
538 var schema = {};
539 var valid = tv4.validate(data, schema);
540 assert.isTrue(valid);
541 });
542
543 /* Travis reports: Bad number '1.798e+308' (which is a good thing, as it should be Infinity)
544 it("big number failure", function() {
545 var data = 1.798e+308;
546 var schema = {};
547 var valid = tv4.validate(data, schema);
548 assert.isFalse(valid);
549 });
550 */
551 });
552
553 describe("Strings 01", function () {
554
555 it("no length constraints", function () {
556 var data = "test";
557 var schema = {};
558 var valid = tv4.validate(data, schema);
559 assert.isTrue(valid);
560 });
561
562 it("minimum length success", function () {
563 var data = "test";
564 var schema = {minLength: 3};
565 var valid = tv4.validate(data, schema);
566 assert.isTrue(valid);
567 });
568
569 it("minimum length failure", function () {
570 var data = "test";
571 var schema = {minLength: 5};
572 var valid = tv4.validate(data, schema);
573 assert.isFalse(valid);
574 });
575
576 it("maximum length success", function () {
577 var data = "test1234";
578 var schema = {maxLength: 10};
579 var valid = tv4.validate(data, schema);
580 assert.isTrue(valid);
581 });
582
583 it("maximum length failure", function () {
584 var data = "test1234";
585 var schema = {maxLength: 5};
586 var valid = tv4.validate(data, schema);
587 assert.isFalse(valid);
588 });
589
590 it("check error message", function () {
591 var data = "test1234";
592 var schema = {maxLength: 5};
593 var valid = tv4.validate(data, schema);
594 assert.isFalse(valid);
595 //return typeof tv4.error.message !== "undefined";
596 assert.ok(tv4.error.message);
597 });
598 });
599
600 describe("Strings 02", function () {
601
602 it("pattern success", function () {
603 var data = "9test";
604 var schema = {"pattern": "^[0-9][a-zA-Z]*$"};
605 var valid = tv4.validate(data, schema);
606 assert.isTrue(valid);
607 });
608
609 it("pattern failure", function () {
610 var data = "9test9";
611 var schema = {"pattern": "^[0-9][a-zA-Z]*$"};
612 var valid = tv4.validate(data, schema);
613 assert.isFalse(valid);
614 });
615
616 it("accepts RegExp object", function () {
617 var data = "9test";
618 var schema = {"pattern": /^[0-9][a-zA-Z]*$/};
619 var valid = tv4.validate(data, schema);
620 assert.isTrue(valid);
621 });
622
623 it("accepts RegExp literal", function () {
624 var data = "9TEST";
625 var schema = {"pattern": "/^[0-9][a-z]*$/i"};
626 var valid = tv4.validate(data, schema);
627 assert.isTrue(valid);
628 });
629 });
630 describe("Arrays 01", function () {
631
632 it("no length constraints", function () {
633 var data = [1, 2, 3];
634 var schema = {};
635 var valid = tv4.validate(data, schema);
636 assert.isTrue(valid);
637 });
638
639 it("minimum length success", function () {
640 var data = [1, 2, 3];
641 var schema = {minItems: 3};
642 var valid = tv4.validate(data, schema);
643 assert.isTrue(valid);
644 });
645
646 it("minimum length failure", function () {
647 var data = [1, 2, 3];
648 var schema = {minItems: 5};
649 var valid = tv4.validate(data, schema);
650 assert.isFalse(valid);
651 });
652
653 it("maximum length success", function () {
654 var data = [1, 2, 3, 4, 5];
655 var schema = {maxItems: 10};
656 var valid = tv4.validate(data, schema);
657 assert.isTrue(valid);
658 });
659
660 it("maximum length failure", function () {
661 var data = [1, 2, 3, 4, 5];
662 var schema = {maxItems: 3};
663 var valid = tv4.validate(data, schema);
664 assert.isFalse(valid);
665 });
666 });
667
668 describe("Arrays 02", function () {
669
670 it("uniqueItems success", function () {
671 var data = [1, true, "1"];
672 var schema = {uniqueItems: true};
673 var valid = tv4.validate(data, schema);
674 assert.isTrue(valid);
675 });
676
677 it("uniqueItems failure", function () {
678 var data = [1, true, "1", 1];
679 var schema = {uniqueItems: true};
680 var valid = tv4.validate(data, schema);
681 assert.isFalse(valid);
682 });
683 });
684
685 describe("Arrays 03", function () {
686
687 it("plain items success", function () {
688 var data = [1, 2, 3, 4];
689 var schema = {
690 "items": {
691 "type": "integer"
692 }
693 };
694 var valid = tv4.validate(data, schema);
695 assert.isTrue(valid);
696 });
697
698 it("plain items failure", function () {
699 var data = [1, 2, true, 3];
700 var schema = {
701 "items": {
702 "type": "integer"
703 }
704 };
705 var valid = tv4.validate(data, schema);
706 assert.isFalse(valid);
707 });
708 });
709
710 describe("Arrays 04", function () {
711
712 it("plain items success", function () {
713 var data = [1, true, "one"];
714 var schema = {
715 "items": [
716 {"type": "integer"},
717 {"type": "boolean"}
718 ]
719 };
720 var valid = tv4.validate(data, schema);
721 assert.isTrue(valid);
722 });
723
724 it("plain items failure", function () {
725 var data = [1, null, "one"];
726 var schema = {
727 "items": [
728 {"type": "integer"},
729 {"type": "boolean"}
730 ]
731 };
732 var valid = tv4.validate(data, schema);
733 assert.isFalse(valid);
734 });
735 });
736
737 describe("Arrays 05", function () {
738
739 it("additional items schema success", function () {
740 var data = [1, true, "one", "uno"];
741 var schema = {
742 "items": [
743 {"type": "integer"},
744 {"type": "boolean"}
745 ],
746 "additionalItems": {"type": "string"}
747 };
748 var valid = tv4.validate(data, schema);
749 assert.isTrue(valid);
750 });
751
752 it("additional items schema failure", function () {
753 var data = [1, true, "one", 1];
754 var schema = {
755 "items": [
756 {"type": "integer"},
757 {"type": "boolean"}
758 ],
759 "additionalItems": {"type": "string"}
760 };
761 var valid = tv4.validate(data, schema);
762 assert.isFalse(valid);
763 });
764
765 it("additional items boolean success", function () {
766 var data = [1, true, "one", "uno"];
767 var schema = {
768 "items": [
769 {"type": "integer"},
770 {"type": "boolean"}
771 ],
772 "additionalItems": true
773 };
774 var valid = tv4.validate(data, schema);
775 assert.isTrue(valid);
776 });
777
778 it("additional items boolean failure", function () {
779 var data = [1, true, "one", "uno"];
780 var schema = {
781 "items": [
782 {"type": "integer"},
783 {"type": "boolean"}
784 ],
785 "additionalItems": false
786 };
787 var valid = tv4.validate(data, schema);
788 assert.isFalse(valid);
789 });
790 });
791
792 describe("Objects 01", function () {
793
794 it("minimum length success", function () {
795 var data = {key1: 1, key2: 2, key3: 3};
796 var schema = {minProperties: 3};
797 var valid = tv4.validate(data, schema);
798 assert.isTrue(valid);
799 });
800
801 it("minimum length failure", function () {
802 var data = {key1: 1, key2: 2, key3: 3};
803 var schema = {minProperties: 5};
804 var valid = tv4.validate(data, schema);
805 assert.isFalse(valid);
806 });
807
808 it("maximum length success", function () {
809 var data = {key1: 1, key2: 2, key3: 3};
810 var schema = {maxProperties: 5};
811 var valid = tv4.validate(data, schema);
812 assert.isTrue(valid);
813 });
814
815 it("maximum length failure", function () {
816 var data = {key1: 1, key2: 2, key3: 3};
817 var schema = {maxProperties: 2};
818 var valid = tv4.validate(data, schema);
819 assert.isFalse(valid);
820 });
821 });
822
823 describe("Objects 02", function () {
824
825 it("required success", function () {
826 var data = {key1: 1, key2: 2, key3: 3};
827 var schema = {required: ["key1", "key2"]};
828 var valid = tv4.validate(data, schema);
829 assert.isTrue(valid);
830 });
831
832 it("required failure", function () {
833 var data = {key1: 1, key2: 2, key3: 3};
834 var schema = {required: ["key1", "notDefined"]};
835 var valid = tv4.validate(data, schema);
836 assert.isFalse(valid);
837 });
838 });
839
840 describe("Objects 03", function () {
841
842 it("properties success", function () {
843 var data = {intKey: 1, stringKey: "one"};
844 var schema = {
845 properties: {
846 intKey: {"type": "integer"},
847 stringKey: {"type": "string"}
848 }
849 };
850 var valid = tv4.validate(data, schema);
851 assert.isTrue(valid);
852 });
853
854 it("properties failure", function () {
855 var data = {intKey: 1, stringKey: false};
856 var schema = {
857 properties: {
858 intKey: {"type": "integer"},
859 stringKey: {"type": "string"}
860 }
861 };
862 var valid = tv4.validate(data, schema);
863 assert.isFalse(valid);
864 });
865 });
866
867 describe("Objects 04", function () {
868
869 it("patternProperties success", function () {
870 var data = {intKey: 1, intKey2: 5};
871 var schema = {
872 properties: {
873 intKey: {"type": "integer"}
874 },
875 patternProperties: {
876 "^int": {minimum: 0}
877 }
878 };
879 var valid = tv4.validate(data, schema);
880 assert.isTrue(valid);
881 });
882
883 it("patternProperties failure 1", function () {
884 var data = {intKey: 1, intKey2: 5};
885 var schema = {
886 properties: {
887 intKey: {minimum: 5}
888 },
889 patternProperties: {
890 "^int": {"type": "integer"}
891 }
892 };
893 var valid = tv4.validate(data, schema);
894 assert.isFalse(valid);
895 });
896
897 it("patternProperties failure 2", function () {
898 var data = {intKey: 10, intKey2: "string value"};
899 var schema = {
900 properties: {
901 intKey: {minimum: 5}
902 },
903 patternProperties: {
904 "^int": {"type": "integer"}
905 }
906 };
907 var valid = tv4.validate(data, schema);
908 assert.isFalse(valid);
909 });
910 });
911
912 describe("Objects 05", function () {
913
914 it("additionalProperties schema success", function () {
915 var data = {intKey: 1, intKey2: 5, stringKey: "string"};
916 var schema = {
917 properties: {
918 intKey: {"type": "integer"}
919 },
920 patternProperties: {
921 "^int": {minimum: 0}
922 },
923 additionalProperties: {"type": "string"}
924 };
925 var valid = tv4.validate(data, schema);
926 assert.isTrue(valid);
927 });
928
929 it("patternProperties schema failure", function () {
930 var data = {intKey: 10, intKey2: 5, stringKey: null};
931 var schema = {
932 properties: {
933 intKey: {minimum: 5}
934 },
935 patternProperties: {
936 "^int": {"type": "integer"}
937 },
938 additionalProperties: {"type": "string"}
939 };
940 var valid = tv4.validate(data, schema);
941 assert.isFalse(valid);
942 });
943
944 it("patternProperties boolean success", function () {
945 var data = {intKey: 10, intKey2: 5, stringKey: null};
946 var schema = {
947 properties: {
948 intKey: {minimum: 5}
949 },
950 patternProperties: {
951 "^int": {"type": "integer"}
952 },
953 additionalProperties: true
954 };
955 var valid = tv4.validate(data, schema);
956 assert.isTrue(valid);
957 });
958
959 it("patternProperties boolean failure", function () {
960 var data = {intKey: 10, intKey2: 5, stringKey: null};
961 var schema = {
962 properties: {
963 intKey: {minimum: 5}
964 },
965 patternProperties: {
966 "^int": {"type": "integer"}
967 },
968 additionalProperties: false
969 };
970 var valid = tv4.validate(data, schema);
971 assert.isFalse(valid);
972 });
973 });
974 describe("Objects 06", function () {
975
976 it("string dependency success", function () {
977 var data = {key1: 5, key2: "string"};
978 var schema = {
979 dependencies: {
980 key1: "key2"
981 }
982 };
983 var valid = tv4.validate(data, schema);
984 assert.isTrue(valid);
985 });
986
987 it("string dependency failure", function () {
988 var data = {key1: 5};
989 var schema = {
990 dependencies: {
991 key1: "key2"
992 }
993 };
994 var valid = tv4.validate(data, schema);
995 assert.isFalse(valid);
996 });
997
998 it("array dependency success", function () {
999 var data = {key1: 5, key2: "string"};
1000 var schema = {
1001 dependencies: {
1002 key1: ["key2"]
1003 }
1004 };
1005 var valid = tv4.validate(data, schema);
1006 assert.isTrue(valid);
1007 });
1008
1009 it("array dependency failure", function () {
1010 var data = {key1: 5};
1011 var schema = {
1012 dependencies: {
1013 key1: ["key2"]
1014 }
1015 };
1016 var valid = tv4.validate(data, schema);
1017 assert.isFalse(valid);
1018 });
1019
1020 it("schema dependency success", function () {
1021 var data = {key1: 5, key2: "string"};
1022 var schema = {
1023 dependencies: {
1024 key1: {
1025 properties: {
1026 key2: {"type": "string"}
1027 }
1028 }
1029 }
1030 };
1031 var valid = tv4.validate(data, schema);
1032 assert.isTrue(valid);
1033 });
1034
1035 it("schema dependency failure", function () {
1036 var data = {key1: 5, key2: 5};
1037 var schema = {
1038 dependencies: {
1039 key1: {
1040 properties: {
1041 key2: {"type": "string"}
1042 }
1043 }
1044 }
1045 };
1046 var valid = tv4.validate(data, schema);
1047 assert.isFalse(valid);
1048 });
1049 });
1050
1051 describe("Combinators 01", function () {
1052
1053 it("allOf success", function () {
1054 var data = 10;
1055 var schema = {
1056 "allOf": [
1057 {"type": "integer"},
1058 {"minimum": 5}
1059 ]
1060 };
1061 var valid = tv4.validate(data, schema);
1062 assert.isTrue(valid);
1063 });
1064
1065 it("allOf failure", function () {
1066 var data = 1;
1067 var schema = {
1068 "allOf": [
1069 {"type": "integer"},
1070 {"minimum": 5}
1071 ]
1072 };
1073 var valid = tv4.validate(data, schema);
1074 assert.isFalse(valid);
1075 });
1076 });
1077
1078 describe("Combinators 02", function () {
1079
1080 it("anyOf success", function () {
1081 var data = "hello";
1082 var schema = {
1083 "anyOf": [
1084 {"type": "integer"},
1085 {"type": "string"},
1086 {"minLength": 1}
1087 ]
1088 };
1089 var valid = tv4.validate(data, schema);
1090 assert.isTrue(valid);
1091 });
1092
1093 it("anyOf failure", function () {
1094 var data = true;
1095 var schema = {
1096 "anyOf": [
1097 {"type": "integer"},
1098 {"type": "string"}
1099 ]
1100 };
1101 var valid = tv4.validate(data, schema);
1102 assert.isFalse(valid);
1103 });
1104 });
1105
1106 describe("Combinators 03", function () {
1107
1108 it("oneOf success", function () {
1109 var data = 5;
1110 var schema = {
1111 "oneOf": [
1112 {"type": "integer"},
1113 {"type": "string"},
1114 {"type": "string", minLength: 1}
1115 ]
1116 };
1117 var valid = tv4.validate(data, schema);
1118 assert.isTrue(valid);
1119 });
1120
1121 it("oneOf failure (too many)", function () {
1122 var data = "string";
1123 var schema = {
1124 "oneOf": [
1125 {"type": "integer"},
1126 {"type": "string"},
1127 {"minLength": 1}
1128 ]
1129 };
1130 var valid = tv4.validate(data, schema);
1131 assert.isFalse(valid);
1132 });
1133
1134 it("oneOf failure (no matches)", function () {
1135 var data = false;
1136 var schema = {
1137 "oneOf": [
1138 {"type": "integer"},
1139 {"type": "string"},
1140 {"type": "string", "minLength": 1}
1141 ]
1142 };
1143 var valid = tv4.validate(data, schema);
1144 assert.isFalse(valid);
1145 });
1146 });
1147
1148 describe("Combinators 04", function () {
1149
1150 it("not success", function () {
1151 var data = 5;
1152 var schema = {
1153 "not": {"type": "string"}
1154 };
1155 var valid = tv4.validate(data, schema);
1156 assert.isTrue(valid);
1157 });
1158
1159 it("not failure", function () {
1160 var data = "test";
1161 var schema = {
1162 "not": {"type": "string"}
1163 };
1164 var valid = tv4.validate(data, schema);
1165 assert.isFalse(valid);
1166 });
1167 });
1168
1169 describe("$ref 01", function () {
1170
1171 it("normalise - untouched immediate $ref", function () {
1172 var schema = {
1173 "items": {"$ref": "#"}
1174 };
1175 tv4.normSchema(schema);
1176 assert.propertyVal(schema.items, '$ref', "#");
1177 //return schema.items['$ref'] == "#";
1178 });
1179
1180 it("normalise - id as base", function () {
1181 var schema = {
1182 "id": "baseUrl",
1183 "items": {"$ref": "#"}
1184 };
1185 tv4.normSchema(schema);
1186 assert.propertyVal(schema.items, '$ref', "baseUrl#");
1187 //return schema.items['$ref'] == "baseUrl#";
1188 });
1189
1190 it("normalise - id relative to parent", function () {
1191 var schema = {
1192 "id": "http://example.com/schema",
1193 "items": {
1194 "id": "otherSchema",
1195 "items": {
1196 "$ref": "#"
1197 }
1198 }
1199 };
1200 tv4.normSchema(schema);
1201 assert.strictEqual(schema.items.id, "http://example.com/otherSchema", "schema.items.id");
1202 assert.strictEqual(schema.items.items['$ref'], "http://example.com/otherSchema#", "$ref");
1203 //this.assert(schema.items.id == "http://example.com/otherSchema", "schema.items.id");
1204 //this.assert(schema.items.items['$ref'] == "http://example.com/otherSchema#", "$ref");
1205 });
1206
1207 it("normalise - do not touch contents of \"enum\"", function () {
1208 var schema = {
1209 "id": "http://example.com/schema",
1210 "items": {
1211 "id": "otherSchema",
1212 "enum": [
1213 {
1214 "$ref": "#"
1215 }
1216 ]
1217 }
1218 };
1219 tv4.normSchema(schema);
1220 assert.strictEqual(schema.items['enum'][0]['$ref'], "#");
1221 //this.assert(schema.items['enum'][0]['$ref'] == "#");
1222 });
1223
1224 it("Only normalise id and $ref if they are strings", function () {
1225 var schema = {
1226 "properties": {
1227 "id": {"type": "integer"},
1228 "$ref": {"type": "integer"}
1229 }
1230 };
1231 var data = {"id": "test", "$ref": "test"};
1232 tv4.normSchema(schema);
1233 var valid = tv4.validate(data, schema);
1234 assert.isFalse(valid);
1235 });
1236 });
1237
1238 describe("$ref 02", function () {
1239
1240 it("skip unneeded", function () {
1241 var schema = {
1242 "items": {"$ref": "http://example.com/schema#"}
1243 };
1244 tv4.validate([], schema);
1245 assert.notProperty(tv4.missing, "http://example.com/schema");
1246 assert.length(tv4.missing, 0);
1247 //return !tv4.missing["http://example.com/schema"]
1248 // && tv4.missing.length == 0;
1249 });
1250
1251 it("list missing (map)", function () {
1252 var schema = {
1253 "items": {"$ref": "http://example.com/schema#"}
1254 };
1255 tv4.validate([1, 2, 3], schema);
1256 assert.property(tv4.missing, "http://example.com/schema");
1257 //return !!tv4.missing["http://example.com/schema"];
1258 });
1259
1260 it("list missing (index)", function () {
1261 var schema = {
1262 "items": {"$ref": "http://example.com/schema#"}
1263 };
1264 tv4.validate([1, 2, 3], schema);
1265 assert.length(tv4.missing, 1);
1266 assert.strictEqual(tv4.missing[0], "http://example.com/schema");
1267 //return tv4.missing[0] == "http://example.com/schema";
1268 });
1269 });
1270 describe("$ref 03", function () {
1271
1272 it("addSchema(), getSchema()", function () {
1273 var url = "http://example.com/schema";
1274 var schema = {
1275 "test": "value"
1276 };
1277 tv4.addSchema(url, schema);
1278 var fetched = tv4.getSchema(url);
1279 assert.strictEqual(fetched.test, "value");
1280 //return fetched.test == "value";
1281 });
1282
1283 it("addSchema(), getSchema() with blank fragment", function () {
1284 var url = "http://example.com/schema";
1285 var schema = {
1286 "test": "value"
1287 };
1288 tv4.addSchema(url, schema);
1289 var fetched = tv4.getSchema(url + "#");
1290 assert.strictEqual(fetched.test, "value");
1291 //return fetched.test == "value";
1292 });
1293
1294 it("addSchema(), getSchema() with pointer path fragment", function () {
1295 var url = "http://example.com/schema";
1296 var schema = {
1297 "items": {
1298 "properties": {
1299 "key[]": {
1300 "inner/key~": "value"
1301 }
1302 }
1303 }
1304 };
1305 tv4.addSchema(url, schema);
1306 var fetched = tv4.getSchema(url + "#/items/properties/key%5B%5D/inner~1key~0");
1307 assert.strictEqual(fetched, "value");
1308 //return fetched == "value";
1309 });
1310
1311 it("addSchema(), getSchema() adds referred schemas", function () {
1312 tv4 = tv4.freshApi();
1313
1314 var data = [123, true];
1315 var valid;
1316 var url = "http://example.com/schema";
1317 var schema = {
1318 "type": "array",
1319 "items": {"$ref": "http://example.com/schema/sub#item"}
1320 };
1321 tv4.addSchema(url, schema);
1322
1323 //test missing
1324 valid = tv4.validate(data, schema);
1325 assert.isTrue(valid);
1326 assert.length(tv4.missing, 1);
1327 assert.isUndefined(tv4.getSchema('http://example.com/schema/sub'));
1328
1329 var item = {
1330 "id": "#item",
1331 "type": "boolean"
1332 };
1333 var sub = {
1334 "id": "http://example.com/schema/sub",
1335 "type": "object",
1336 "lib": {
1337 "item": item
1338 }
1339 };
1340 tv4.addSchema(sub);
1341
1342 //added it?
1343 assert.equal(tv4.getSchema(url), schema);
1344 assert.equal(tv4.getSchema('http://example.com/schema/sub'), sub);
1345 assert.equal(tv4.getSchema('http://example.com/schema/sub#item'), item);
1346
1347 //now use it
1348 valid = tv4.validate(data, schema);
1349 assert.length(tv4.missing, 0);
1350 assert.isFalse(valid);
1351
1352 var error = {
1353 code: 0,
1354 message: 'Invalid type: number (expected boolean)',
1355 dataPath: '/0',
1356 schemaPath: '/items/type',
1357 subErrors: null };
1358 assert.propertyValues(tv4.error, error);
1359 });
1360 });
1361 describe("$ref 04", function () {
1362
1363 it("addSchema(), $ref", function () {
1364 var url = "http://example.com/schema";
1365 var schema = {
1366 "test": "value"
1367 };
1368 tv4.addSchema(url, schema);
1369
1370 var otherSchema = {
1371 "items": {"$ref": url}
1372 };
1373 var valid = tv4.validate([0,1,2,3], otherSchema);
1374
1375 assert.isTrue(valid, "should be valid");
1376 assert.length(tv4.missing, 0, "should have no missing schemas");
1377
1378 //this.assert(valid, "should be valid");
1379 //this.assert(tv4.missing.length == 0, "should have no missing schemas");
1380 });
1381
1382 it("internal $ref", function () {
1383 var schema = {
1384 "type": "array",
1385 "items": {"$ref": "#"}
1386 };
1387
1388 assert.isTrue(tv4.validate([[],[[]]], schema), "List of lists should be valid");
1389 assert.isTrue(!tv4.validate([0,1,2,3], schema), "List of ints should not");
1390 assert.isTrue(!tv4.validate([[true], []], schema), "List of list with boolean should not");
1391
1392 assert.length(tv4.missing, 0, "should have no missing schemas");
1393
1394 //this.assert(tv4.validate([[],[[]]], schema), "List of lists should be valid");
1395 //this.assert(!tv4.validate([0,1,2,3], schema), "List of ints should not");
1396 //this.assert(!tv4.validate([[true], []], schema), "List of list with boolean should not");
1397
1398 //this.assert(tv4.missing.length == 0, "should have no missing schemas");
1399 });
1400 });
1401
1402 describe("$ref 05", function () {
1403
1404 it("inline addressing for fragments", function () {
1405 var schema = {
1406 "type": "array",
1407 "items": {"$ref": "#test"},
1408 "testSchema": {
1409 "id": "#test",
1410 "type": "boolean"
1411 }
1412 };
1413 var error = {
1414 code: 0,
1415 message: 'Invalid type: number (expected boolean)',
1416 dataPath: '/0',
1417 schemaPath: '/items/type',
1418 subErrors: null
1419 };
1420
1421 var data = [0, false];
1422 var valid = tv4.validate(data, schema);
1423 assert.isFalse(valid, 'inline addressing invalid 0, false');
1424 assert.propertyValues(tv4.error, error, 'errors equal');
1425 });
1426
1427 it("don't trust non sub-paths", function () {
1428 var examplePathBase = "http://example.com/schema";
1429 var examplePath = examplePathBase + "/schema";
1430 var schema = {
1431 "id": examplePath,
1432 "type": "array",
1433 "items": {"$ref": "other-schema"},
1434 "testSchema": {
1435 "id": "/other-schema",
1436 "type": "boolean"
1437 }
1438 };
1439 tv4.addSchema(examplePath, schema);
1440 var data = [0, false];
1441 var valid = tv4.validate(data, examplePath);
1442
1443 assert.length(tv4.missing, 1, "should have missing schema");
1444 assert.strictEqual(tv4.missing[0], examplePathBase + "/other-schema", "incorrect schema missing: " + tv4.missing[0]);
1445 assert.isTrue(valid, "should pass, as remote schema not found");
1446
1447 //this.assert(tv4.missing.length == 1, "should have missing schema");
1448 //this.assert(tv4.missing[0] == examplePathBase + "/other-schema", "incorrect schema missing: " + tv4.missing[0]);
1449 //this.assert(valid, "should pass, as remote schema not found");
1450 });
1451 });
1452
1453 describe("$refs to $refs", function () {
1454 it("addSchema(), $ref", function () {
1455 var schema = {
1456 id: "http://example.com/schema",
1457 some: {
1458 other: {type: "number"}
1459 },
1460 data: {'$ref': "#/some/other"}
1461 };
1462
1463 tv4.addSchema(schema);
1464 assert.isTrue(tv4.validate(42, {"$ref": "http://example.com/schema#/data"}), "42 valid");
1465 //assert.isFalse(tv4.validate(42, {"$ref": "http://example.com/schema#/data"}), "\"42\" invalid");
1466
1467 assert.length(tv4.missing, 0, "should have no missing schemas");
1468 });
1469
1470 it("Don't hang on circle", function () {
1471 var schema = {
1472 id: "http://example.com/schema",
1473 ref1: {"$ref": "#/ref2"},
1474 ref2: {"$ref": "#/ref1"}
1475 };
1476
1477 tv4.addSchema(schema);
1478 var result = tv4.validateResult(42, "http://example.com/schema#/ref1");
1479
1480 assert.isFalse(result.valid, "not valid");
1481 assert.equal(result.error.code, tv4.errorCodes.CIRCULAR_REFERENCE, 'Error code correct');
1482 });
1483 });
1484
1485 describe("API 01", function () {
1486
1487 it("validateResult returns object with appropriate properties", function () {
1488 var data = {};
1489 var schema = {"type": "array"};
1490 tv4.error = null;
1491 tv4.missing = [];
1492 var result = tv4.validateResult(data, schema);
1493
1494 assert.isFalse(result.valid, "result.valid === false");
1495 assert.isTypeOf(result.error, "object", "result.error is object");
1496 assert.isArray(result.missing, "result.missing is array");
1497 assert.isFalse(!!tv4.error, "tv4.error == null");
1498
1499 //this.assert(result.valid === false, "result.valid === false");
1500 //this.assert(typeof result.error == "object", "result.error is object");
1501 //this.assert(Array.isArray(result.missing), "result.missing is array");
1502 //this.assert(tv4.error == null, "tv4.error == null");
1503 });
1504 });
1505
1506 describe("API 02", function () {
1507
1508 it("tv4.errorCodes exists", function () {
1509 assert.isObject(tv4.errorCodes);
1510 //return typeof tv4.errorCodes == "object";
1511 });
1512 });
1513
1514 describe("API 03", function () {
1515
1516 it("getSchemaUris() on clean tv4 returns an empty array", function () {
1517 var list = tv4.getSchemaUris();
1518 assert.isArray(list);
1519 assert.length(list, 0);
1520 });
1521
1522 it("getSchemaUris() returns newly added schema urls", function () {
1523 tv4.addSchema("http://example.com/schema", {type: "object"});
1524 var list = tv4.getSchemaUris();
1525 assert.isArray(list);
1526 assert.length(list, 1);
1527 assert.strictEqual(list[0], "http://example.com/schema");
1528 });
1529
1530 it("getMissingUris() returns only missing items", function () {
1531 var schema = {
1532 "items": {"$ref": "http://example.com/schema/item#"}
1533 };
1534 tv4.addSchema("http://example.com/schema/main", schema);
1535
1536 var item = {
1537 "id": "http://example.com/schema/item",
1538 "type": "boolean"
1539 };
1540
1541 var list;
1542 list = tv4.getSchemaUris();
1543 assert.isArray(list);
1544 assert.length(list, 1);
1545 assert.includes(list, "http://example.com/schema/main", 'map has main uri');
1546
1547 list = tv4.getMissingUris();
1548 assert.isArray(list);
1549 assert.length(list, 1);
1550 assert.includes(list, "http://example.com/schema/item", 'map has item uri');
1551
1552 tv4.addSchema(item);
1553
1554 list = tv4.getMissingUris();
1555 assert.isArray(list);
1556 assert.length(list, 0);
1557 });
1558
1559 it("getSchemaUris() optionally return filtered items", function () {
1560 var schema = {
1561 "items": {"$ref": "http://example.com/schema/item#"}
1562 };
1563 tv4.addSchema("http://example.com/schema/main", schema);
1564
1565 var list;
1566 list = tv4.getSchemaUris(/schema\/main/);
1567 assert.isArray(list);
1568 assert.length(list, 1, 'list 1 main');
1569 assert.includes(list, "http://example.com/schema/main");
1570
1571 list = tv4.getMissingUris(/^https?/);
1572 assert.isArray(list);
1573 assert.length(list, 1, 'list 1 item');
1574 assert.includes(list, "http://example.com/schema/item");
1575 });
1576
1577 it("getSchemaUris() returns unique uris without fragment", function () {
1578 var schema = {
1579 "properties": {
1580 "alpha": {
1581 "$ref": "http://example.com/schema/lib#alpha"
1582 },
1583 "beta": {
1584 "$ref": "http://example.com/schema/lib#beta"
1585 }
1586 }
1587 };
1588 tv4.addSchema("http://example.com/schema/main", schema);
1589 var sub = {
1590 "id": "http://example.com/schema/item",
1591 "items": {
1592 "type": "boolean"
1593 }
1594 };
1595 tv4.addSchema(sub);
1596
1597 var list;
1598 list = tv4.getSchemaUris();
1599 assert.isArray(list);
1600 assert.length(list, 2);
1601 assert.includes(list, "http://example.com/schema/main");
1602 assert.includes(list, "http://example.com/schema/item");
1603
1604 list = tv4.getMissingUris();
1605 assert.isArray(list);
1606 assert.length(list, 1);
1607 assert.includes(list, "http://example.com/schema/lib");
1608 });
1609
1610
1611 it("getSchemaMap() on clean tv4 returns an empty object", function () {
1612 var map = tv4.getSchemaMap();
1613 assert.isObject(map);
1614 assert.isNotArray(map);
1615 var list = Object.keys(map);
1616 assert.length(list, 0);
1617 });
1618
1619 it("getSchemaMap() returns an object mapping uris to schemas", function () {
1620 var schema = {
1621 "properties": {
1622 "alpha": {
1623 "$ref": "http://example.com/schema/lib#alpha"
1624 },
1625 "beta": {
1626 "$ref": "http://example.com/schema/lib#beta"
1627 }
1628 }
1629 };
1630 tv4.addSchema("http://example.com/schema/main", schema);
1631 var sub = {
1632 "id": "http://example.com/schema/item",
1633 "items": {
1634 "type": "boolean"
1635 }
1636 };
1637 tv4.addSchema(sub);
1638
1639 var map;
1640 map = tv4.getSchemaMap();
1641 assert.length(Object.keys(map), 2);
1642 assert.ownPropertyVal(map, "http://example.com/schema/main", schema);
1643 assert.ownPropertyVal(map, "http://example.com/schema/item", sub);
1644 });
1645 });
1646
1647 describe("Multiple errors 01", function () {
1648
1649 it("validateMultiple returns array of errors", function () {
1650 var data = {};
1651 var schema = {"type": "array"};
1652 var result = tv4.validateMultiple(data, schema);
1653
1654 assert.isFalse(result.valid, "data should not be valid");
1655 assert.strictEqual(typeof result.errors, "object", "result.errors must be object");
1656 assert.isNumber(result.errors.length, "result.errors have numberic length");
1657
1658 //-> weird: test says be object but it's an array
1659
1660 //assert.isArray(result.errors, "result.errors must be array-like");
1661 //assert.isObject(result.errors, "result.errors must be object");
1662
1663 //this.assert(result.valid == false, "data should not be valid");
1664 //this.assert(typeof result.errors == "object" && typeof result.errors.length == "number", "result.errors must be array-like");
1665 });
1666
1667 it("validateMultiple has multiple entries", function () {
1668 var data = {"a": 1, "b": 2};
1669 var schema = {"additionalProperties": {"type": "string"}};
1670 var result = tv4.validateMultiple(data, schema);
1671
1672 assert.length(result.errors, 2, "should return two errors");
1673 //this.assert(result.errors.length == 2, "should return two errors");
1674 });
1675
1676 it("validateMultiple correctly fails anyOf", function () {
1677 var data = {};
1678 var schema = {
1679 "anyOf": [
1680 {"type": "string"},
1681 {"type": "integer"}
1682 ]
1683 };
1684 var result = tv4.validateMultiple(data, schema);
1685
1686 assert.isFalse(result.valid, "should not validate");
1687 assert.length(result.errors, 1, "should list one error");
1688
1689 //this.assert(result.valid == false, "should not validate");
1690 //this.assert(result.errors.length == 1, "should list one error");
1691 });
1692
1693 it("validateMultiple correctly fails not", function () {
1694 var data = {};
1695 var schema = {
1696 "not": {"type": "object"}
1697 };
1698 var result = tv4.validateMultiple(data, schema);
1699
1700 assert.isFalse(result.valid, "should not validate");
1701 assert.length(result.errors, 1, "should list one error");
1702
1703 //this.assert(result.valid == false, "should not validate");
1704 //this.assert(result.errors.length == 1, "should list one error");
1705 });
1706
1707 it("validateMultiple correctly passes not", function () {
1708 var data = {};
1709 var schema = {
1710 "not": {"type": "string"}
1711 };
1712 var result = tv4.validateMultiple(data, schema);
1713
1714 assert.isTrue(result.valid, "should validate");
1715 assert.length(result.errors, 0, "no errors");
1716
1717 //this.assert(result.valid == true, "should validate");
1718 //this.assert(result.errors.length == 0, "no errors");
1719 });
1720
1721 it("validateMultiple correctly fails multiple oneOf", function () {
1722 var data = 5;
1723 var schema = {
1724 "oneOf": [
1725 {"type": "integer"},
1726 {"type": "number"}
1727 ]
1728 };
1729 var result = tv4.validateMultiple(data, schema);
1730
1731 assert.isFalse(result.valid, "should not validate");
1732 assert.length(result.errors, 1, "only one error");
1733
1734 //this.assert(result.valid == false, "should not validate");
1735 //this.assert(result.errors.length == 1, "only one error");
1736 });
1737
1738 it("validateMultiple handles multiple missing properties", function () {
1739 var data = {};
1740 var schema = {
1741 required: ["one", "two"]
1742 };
1743 var result = tv4.validateMultiple(data, schema);
1744
1745 assert.isFalse(result.valid, "should not validate");
1746 assert.length(result.errors, 2, "two errors");
1747
1748 //this.assert(result.valid == false, "should not validate");
1749 //this.assert(result.errors.length == 2, "exactly two errors, not " + result.errors.length);
1750 });
1751 });
1752 describe("Multiple errors 02", function () {
1753
1754 it("validateMultiple returns array of errors", function () {
1755 var data = {
1756 "alternatives": {
1757 "option1": "pattern for option 1"
1758 }
1759 };
1760
1761 var schema = {
1762 "type": "object",
1763 "properties": {
1764 "alternatives": {
1765 "type": "object",
1766 "description": "Some options",
1767 "oneOf": [
1768 {
1769 "properties": {
1770 "option1": {
1771 "type": "string",
1772 "pattern": "^pattern for option 1$"
1773 }
1774 },
1775 "additionalProperties": false,
1776 "required": [
1777 "option1"
1778 ]
1779 },
1780 {
1781 "properties": {
1782 "option2": {
1783 "type": "string",
1784 "pattern": "^pattern for option 2$"
1785 }
1786 },
1787 "additionalProperties": false,
1788 "required": [
1789 "option2"
1790 ]
1791 },
1792 {
1793 "properties": {
1794 "option3": {
1795 "type": "string",
1796 "pattern": "^pattern for option 3$"
1797 }
1798 },
1799 "additionalProperties": false,
1800 "required": [
1801 "option3"
1802 ]
1803 }
1804 ]
1805 }
1806 }
1807 };
1808 var result = tv4.validateMultiple(data, schema);
1809
1810 assert.isTrue(result.valid, "data should be valid");
1811 assert.length(result.errors, 0, "should have no errors");
1812
1813 //this.assert(result.valid == true, "data should be valid");
1814 //this.assert(result.errors.length == 0, "should have no errors");
1815 });
1816 });
1817 describe("Recursive objects 01", function () {
1818 it("validate and variants do not choke on recursive objects", function () {
1819 var itemA = {};
1820 var itemB = { a: itemA };
1821 itemA.b = itemB;
1822 var aSchema = { properties: { b: { $ref: 'bSchema' }}};
1823 var bSchema = { properties: { a: { $ref: 'aSchema' }}};
1824 tv4.addSchema('aSchema', aSchema);
1825 tv4.addSchema('bSchema', bSchema);
1826 tv4.validate(itemA, aSchema, true);
1827 tv4.validate(itemA, aSchema, function () {}, true);
1828 tv4.validateResult(itemA, aSchema, true);
1829 tv4.validateMultiple(itemA, aSchema, true);
1830 });
1831 });
1832
1833 // We don't handle this in general (atm), but some users have had particular problems with things added to the Array prototype
1834 describe("Recursive schemas", function () {
1835 it("due to extra Array.prototype entries", function () {
1836 var testSchema = {
1837 items: []
1838 };
1839 Array.prototype._testSchema = testSchema;
1840
1841 // Failure mode will be a RangeError (stack size limit)
1842 tv4.addSchema('testSchema', testSchema);
1843
1844 delete Array.prototype._testSchema;
1845 });
1846 });
1847
1848 describe("Registering custom validator", function () {
1849 it("Allows registration of custom validator codes for \"format\" values", function () {
1850 tv4.addFormat('test-format', function () {
1851 return null;
1852 });
1853 });
1854
1855 it("Custom validator is correctly selected", function () {
1856 tv4.addFormat('test-format', function (data) {
1857 if (data !== "test string") {
1858 return "string does not match";
1859 }
1860 });
1861
1862 var schema = {format: 'test-format'};
1863 var data1 = "test string";
1864 var data2 = "other string";
1865
1866 assert.isTrue(tv4.validate(data1, schema));
1867 assert.isFalse(tv4.validate(data2, schema));
1868 assert.includes(tv4.error.message, 'string does not match');
1869 });
1870
1871 it("Custom validator object error format", function () {
1872 tv4.addFormat('test-format', function (data) {
1873 if (data !== "test string") {
1874 return {
1875 dataPath: "",
1876 schemaPath: "/flah",
1877 message: "Error message"
1878 };
1879 }
1880 });
1881
1882 var schema = {format: 'test-format'};
1883 var data1 = "test string";
1884 var data2 = "other string";
1885
1886 assert.isTrue(tv4.validate(data1, schema));
1887 assert.isFalse(tv4.validate(data2, schema));
1888 assert.includes(tv4.error.message, 'Error message');
1889 assert.equal(tv4.error.schemaPath, '/flah');
1890 });
1891
1892 it("Register multiple using object", function () {
1893 tv4.addFormat({
1894 'test1': function () {return 'break 1';},
1895 'test2': function () {return 'break 2';}
1896 });
1897
1898 var schema1 = {format: 'test1'};
1899 var result1 = tv4.validateResult("test string", schema1);
1900 assert.isFalse(result1.valid);
1901 assert.includes(result1.error.message, 'break 1');
1902
1903 var schema2 = {format: 'test2'};
1904 var result2 = tv4.validateResult("test string", schema2);
1905 assert.isFalse(result2.valid);
1906 assert.includes(result2.error.message, 'break 2');
1907 });
1908 });
1909
1910 describe("Ban unknown properties 01", function () {
1911 it("Additional argument to ban additional properties", function () {
1912 var schema = {
1913 properties: {
1914 propA: {},
1915 propB: {}
1916 }
1917 };
1918 var data = {
1919 propA: true,
1920 propUnknown: true
1921 };
1922 var data2 = {
1923 propA: true
1924 };
1925
1926 var result = tv4.validateMultiple(data, schema, false, true);
1927 assert.isFalse(result.valid, "Must not be valid");
1928
1929 var result2 = tv4.validateMultiple(data2, schema, false, true);
1930 assert.isTrue(result2.valid, "Must still validate");
1931 });
1932
1933 it("Works with validateResult()", function () {
1934 var schema = {
1935 properties: {
1936 propA: {},
1937 propB: {}
1938 }
1939 };
1940 var data = {
1941 propA: true,
1942 propUnknown: true
1943 };
1944 var data2 = {
1945 propA: true
1946 };
1947
1948 var result = tv4.validateResult(data, schema, false, true);
1949 assert.isFalse(result.valid, "Must not be valid");
1950
1951 var result2 = tv4.validateResult(data2, schema, false, true);
1952 assert.isTrue(result2.valid, "Must be valid");
1953 });
1954
1955 it("Do not complain if additionalArguments is specified", function () {
1956 var schema = {
1957 properties: {
1958 propA: {},
1959 propB: {}
1960 },
1961 additionalProperties: true
1962 };
1963 var data = {
1964 propA: true,
1965 propUnknown: true
1966 };
1967 var data2 = {
1968 propA: true
1969 };
1970
1971 var result = tv4.validateMultiple(data, schema, false, true);
1972 assert.isTrue(result.valid, "Must be valid");
1973
1974 var result2 = tv4.validateMultiple(data2, schema, false, true);
1975 assert.isTrue(result2.valid, "Must still validate");
1976 });
1977 });
1978
1979 describe("Ban unknown properties 02", function () {
1980 it("Do not track property definitions from \"not\"", function () {
1981 var schema = {
1982 "not": {
1983 properties: {
1984 propA: {"type": "string"},
1985 }
1986 }
1987 };
1988 var data = {
1989 propA: true,
1990 };
1991
1992 var result = tv4.validateMultiple(data, schema, false, true);
1993 assert.isFalse(result.valid, "Must not be valid");
1994 });
1995
1996 it("Do not track property definitions from unselected \"oneOf\"", function () {
1997 var schema = {
1998 "oneOf": [
1999 {
2000 "type": "object",
2001 "properties": {
2002 "propA": {"type": "string"}
2003 }
2004 },
2005 {
2006 "type": "object",
2007 "properties": {
2008 "propB": {"type": "boolean"}
2009 }
2010 }
2011 ]
2012 };
2013 var data = {
2014 propA: true,
2015 propB: true
2016 };
2017
2018 var result = tv4.validateMultiple(data, schema, false, true);
2019 assert.isFalse(result.valid, "Must not be valid");
2020
2021 var result2 = tv4.validateMultiple(data, schema, false);
2022 assert.isTrue(result2.valid, "Must still be valid without flag");
2023 });
2024
2025
2026 it("Do not track property definitions from unselected \"anyOf\"", function () {
2027 var schema = {
2028 "anyOf": [
2029 {
2030 "type": "object",
2031 "properties": {
2032 "propA": {"type": "string"}
2033 }
2034 },
2035 {
2036 "type": "object",
2037 "properties": {
2038 "propB": {"type": "boolean"}
2039 }
2040 }
2041 ]
2042 };
2043 var data = {
2044 propA: true,
2045 propB: true
2046 };
2047
2048 var result = tv4.validateMultiple(data, schema, false, true);
2049 assert.isFalse(result.valid, "Must not be valid");
2050
2051 var result2 = tv4.validateMultiple(data, schema, false);
2052 assert.isTrue(result2.valid, "Must still be valid without flag");
2053 });
2054 });
2055
2056 describe("Fill dataPath for \"required\" (GitHub Issue #103)", function () {
2057 it("Blank for first-level properties", function () {
2058 var schema = {
2059 required: ['A']
2060 };
2061 var data = {};
2062
2063 var result = tv4.validateMultiple(data, schema, false, true);
2064 assert.isFalse(result.valid, "Must not be valid");
2065 assert.deepEqual(result.errors[0].dataPath, '');
2066 });
2067
2068 it("Filled for second-level properties", function () {
2069 var schema = {
2070 properties: {
2071 "foo": {
2072 required: ["bar"]
2073 }
2074 }
2075 };
2076 var data = {"foo": {}};
2077
2078 var result = tv4.validateMultiple(data, schema, false, true);
2079 assert.isFalse(result.valid, "Must not be valid");
2080 assert.deepEqual(result.errors[0].dataPath, '/foo');
2081 });
2082 });
2083
2084 describe("Valid schemaPath for \"oneOf\" (GitHub Issue #117)", function () {
2085 it("valid schemaPath in error (simple types)", function () {
2086 var data = {};
2087 var schema = {
2088 "oneOf": [
2089 { "type": "string" },
2090 { "type": "bool" }
2091 ]
2092 };
2093
2094 var result = tv4.validateMultiple(data, schema);
2095 var suberr = result.errors[0].subErrors;
2096 assert.equal(suberr[0].schemaPath, '/oneOf/0/type');
2097 assert.equal(suberr[1].schemaPath, '/oneOf/1/type');
2098 });
2099
2100 it("valid schemaPath in error (required properties)", function () {
2101 /* Test case provided on GitHub Issue #117 */
2102 var data = {};
2103 var schema = {
2104 "$schema": "http://json-schema.org/draft-04/schema#",
2105 "oneOf": [
2106 {
2107 "type": "object",
2108 "properties": {
2109 "data": {
2110 "type": "object"
2111 }
2112 },
2113 "required": ["data"]
2114 },
2115 {
2116 "type": "object",
2117 "properties": {
2118 "error": {
2119 "type": "object"
2120 }
2121 },
2122 "required": ["error"]
2123 }
2124 ]
2125 };
2126
2127 var result = tv4.validateMultiple(data, schema);
2128 var suberr = result.errors[0].subErrors;
2129 assert.equal(suberr[0].schemaPath, "/oneOf/0/required/0");
2130 assert.equal(suberr[1].schemaPath, "/oneOf/1/required/0");
2131 });
2132 });
2133
2134 describe("Register custom keyword", function () {
2135 it("function called", function () {
2136 var schema = {
2137 customKeyword: "A"
2138 };
2139 var data = {};
2140
2141 tv4.defineKeyword('customKeyword', function () {
2142 return "Custom failure";
2143 });
2144
2145 var result = tv4.validateMultiple(data, schema, false, true);
2146 assert.isFalse(result.valid, "Must not be valid");
2147 assert.deepEqual(result.errors[0].message, 'Keyword failed: customKeyword (Custom failure)');
2148 });
2149
2150 it("custom error code", function () {
2151 var schema = {
2152 customKeywordFoo: "A"
2153 };
2154 var data = "test test test";
2155
2156 tv4.defineKeyword('customKeywordFoo', function (data, value) {
2157 return {
2158 code: 'CUSTOM_KEYWORD_FOO',
2159 message: {data: data, value: value}
2160 };
2161 });
2162 tv4.defineError('CUSTOM_KEYWORD_FOO', 123456789, "{value}: {data}");
2163
2164 var result = tv4.validateMultiple(data, schema, false, true);
2165 assert.isFalse(result.valid, "Must not be valid");
2166 assert.deepEqual(result.errors[0].message, 'A: test test test');
2167 assert.deepEqual(result.errors[0].code, 123456789);
2168 });
2169
2170 it("custom error code (numeric)", function () {
2171 var schema = {
2172 customKeywordBar: "A"
2173 };
2174 var data = "test test test";
2175
2176 tv4.defineKeyword('customKeywordBar', function (data, value) {
2177 return {
2178 code: 1234567890,
2179 message: {data: data, value: value}
2180 };
2181 });
2182 tv4.defineError('CUSTOM_KEYWORD_BAR', 1234567890, "{value}: {data}");
2183
2184 var result = tv4.validateMultiple(data, schema, false, true);
2185 assert.isFalse(result.valid, "Must not be valid");
2186 assert.deepEqual(result.errors[0].message, 'A: test test test');
2187 assert.deepEqual(result.errors[0].code, 1234567890);
2188 });
2189
2190 it("restrict custom error codes", function () {
2191 assert.throws(function () {
2192 tv4.defineError('CUSTOM_KEYWORD_BLAH', 9999, "{value}: {data}");
2193 });
2194 });
2195
2196 it("restrict custom error names", function () {
2197 assert.throws(function () {
2198 tv4.defineError('doesnotmatchpattern', 10002, "{value}: {data}");
2199 });
2200 });
2201
2202 it("can't defined the same code twice", function () {
2203 assert.throws(function () {
2204 tv4.defineError('CUSTOM_ONE', 10005, "{value}: {data}");
2205 tv4.defineError('CUSTOM_TWO', 10005, "{value}: {data}");
2206 });
2207 });
2208
2209 it("function can return existing (non-custom) codes", function () {
2210 var schema = {
2211 "type": "object",
2212 "properties": {
2213 "aStringValue": {
2214 "type": "string",
2215 "my-custom-keyword": "something"
2216 },
2217 "aBooleanValue": {
2218 "type": "boolean"
2219 }
2220 }
2221 };
2222 var data = {
2223 "aStringValue": "a string",
2224 "aBooleanValue": true
2225 };
2226
2227 tv4.defineKeyword('my-custom-keyword', function () {
2228 return {code: 0, message: "test"};
2229 });
2230
2231 var result = tv4.validateMultiple(data, schema, false, true);
2232 assert.equal(result.errors[0].code, tv4.errorCodes.INVALID_TYPE);
2233 });
2234
2235 it("function only called when keyword present", function () {
2236 var schema = {
2237 "type": "object",
2238 "properties": {
2239 "aStringValue": {
2240 "type": "string",
2241 "my-custom-keyword": "something"
2242 },
2243 "aBooleanValue": {
2244 "type": "boolean"
2245 }
2246 }
2247 };
2248 var data = {
2249 "aStringValue": "a string",
2250 "aBooleanValue": true
2251 };
2252
2253 var callCount = 0;
2254 tv4.defineKeyword('my-custom-keyword', function () {
2255 callCount++;
2256 });
2257
2258 tv4.validateMultiple(data, schema, false, true);
2259 assert.deepEqual(callCount, 1, "custom function must be called exactly once");
2260 });
2261
2262 it("function knows dataPointerPath", function () {
2263 var schema = {
2264 "type": "object",
2265 "properties": {
2266 "obj": {
2267 "type": "object",
2268 "properties":{
2269 "test":{
2270 "my-custom-keyword": "something",
2271 "type":"string"
2272 }
2273 }
2274 }
2275 }
2276 };
2277 var data = { "obj":{ "test": "a string"} };
2278
2279 var path = null;
2280 tv4.defineKeyword('my-custom-keyword', function (data,value,schema,dataPointerPath) {
2281 path = dataPointerPath;
2282 });
2283
2284 tv4.validateMultiple(data, schema, false, true);
2285 assert.strictEqual(path, "/obj/test", "custom function must know its context path");
2286 });
2287 });
2288
2289 describe("Load language file", function () {
2290 if (typeof process !== 'object' || typeof require !== 'function') {
2291 it.skip("commonjs language", function () {
2292 // dummy
2293 });
2294 }
2295 else {
2296 it("commonjs language: de", function () {
2297 var tv4 = require('../lang/de');
2298
2299 tv4.language('de');
2300
2301 var schema = {
2302 properties: {
2303 intKey: {"type": "integer"}
2304 }
2305 };
2306 var res = tv4.validateResult({intKey: 'bad'}, schema);
2307 assert.isFalse(res.valid);
2308 assert.equal(res.error.message, 'Ungültiger Typ: string (erwartet wurde: integer)');
2309 });
2310 }
2311 });
2312
2313 describe("Custom error reporting", function () {
2314 it('provides custom message', function () {
2315 var api = tv4.freshApi();
2316
2317 api.setErrorReporter(function (error, data, schema) {
2318 assert.deepEqual(data, 5);
2319 assert.deepEqual(schema, {minimum: 10});
2320 return 'Code: ' + error.code;
2321 });
2322
2323 var res = api.validateResult(5, {minimum: 10});
2324 assert.isFalse(res.valid);
2325 assert.equal(res.error.message, 'Code: 101');
2326 });
2327
2328 it('falls back to default', function () {
2329 var api = tv4.freshApi();
2330
2331 api.setErrorReporter(function (error, data, schema) {
2332 assert.deepEqual(data, 5);
2333 assert.deepEqual(schema, {minimum: 10});
2334 return null;
2335 });
2336
2337 var res = api.validateResult(5, {minimum: 10});
2338 assert.isFalse(res.valid);
2339 assert.isString(res.error.message);
2340 });
2341 });
2342
2343 describe("Load language file", function () {
2344 it("commonjs language: de", function () {
2345 var freshTv4 = tv4.freshApi();
2346
2347 freshTv4.addSchema('/polymorphic', {
2348 type: "object",
2349 properties: {
2350 "type": {type: "string"}
2351 },
2352 required: ["type"],
2353 links: [{
2354 rel: "describedby",
2355 href: "/schemas/{type}.json"
2356 }]
2357 });
2358
2359 var res = freshTv4.validateResult({type: 'monkey'}, "/polymorphic");
2360 assert.isTrue(res.valid);
2361 assert.includes(res.missing, "/schemas/monkey.json");
2362
2363 freshTv4.addSchema('/schemas/tiger.json', {
2364 properties: {
2365 "stripes": {"type": "integer", "minimum": 1}
2366 },
2367 required: ["stripes"]
2368 });
2369
2370 var res2 = freshTv4.validateResult({type: 'tiger', stripes: -1}, "/polymorphic");
2371 assert.isFalse(res2.valid);
2372 assert.deepEqual(res2.missing.length, 0, "no schemas should be missing");
2373
2374 var res3 = freshTv4.validateResult({type: 'tiger', stripes: 50}, "/polymorphic");
2375 assert.isTrue(res3.valid);
2376 });
2377 });
2378
2379 describe("Issue 108", function () {
2380
2381 it("Normalise schemas even inside $ref", function () {
2382
2383 var schema = {
2384 "id": "http://example.com/schema" + Math.random(),
2385 "$ref": "#whatever",
2386 "properties": {
2387 "foo": {
2388 "id": "#test",
2389 "type": "string"
2390 }
2391 }
2392 };
2393
2394 tv4.addSchema(schema);
2395
2396 var result = tv4.validateMultiple("test data", schema.id + '#test');
2397 assert.isTrue(result.valid, 'validateMultiple() should return valid');
2398 assert.deepEqual(result.missing.length, 0, 'should have no missing schemas');
2399
2400 var result2 = tv4.validateMultiple({"foo":"bar"}, schema.id + '#test');
2401 assert.isFalse(result2.valid, 'validateMultiple() should return invalid');
2402 assert.deepEqual(result2.missing.length, 0, 'should have no missing schemas');
2403 });
2404 });
2405 describe("Issue 109", function () {
2406
2407 it("Don't break on null values with banUnknownProperties", function () {
2408
2409 var schema = {
2410 "type": "object",
2411 "properties": {
2412 "foo": {
2413 "type": "object",
2414 "additionalProperties": {"type": "string"}
2415 }
2416 }
2417 };
2418
2419 var data = {foo: null};
2420
2421 var result = tv4.validateMultiple(data, schema, true, true);
2422
2423 assert.isFalse(result.valid, 'validateMultiple() should return invalid');
2424 });
2425 });
2426 describe("Issue 32", function () {
2427
2428 it("Example from GitHub issue #32", function () {
2429 var subSchema = {
2430 "title": "SubSchema",
2431 "type": "object",
2432 "properties": {
2433 "attribute": {"type": "string"}
2434 },
2435 "additionalProperties": false
2436 };
2437
2438 var mySchema = {
2439 "title": "My Schema",
2440 "type": "object",
2441 "properties": {
2442 "name": {"type": "string"},
2443 "subschemas": {"type": "array", "items": {"$ref": "#/definitions/subSchema"}}
2444 },
2445 "definitions": {
2446 "subSchema": subSchema
2447 },
2448 "additionalProperties": false
2449 };
2450
2451 /* unused variable
2452 var data1 = {
2453 "name": "Joe",
2454 "subschemas": [
2455 {"attribute": "Hello"}
2456 ]
2457 };*/
2458
2459 var addlPropInSubSchema = {
2460 "name": "Joe",
2461 "subschemas": [
2462 {"attribute": "Hello", "extra": "Not Allowed"}
2463 ]
2464 };
2465
2466 // Usage 1
2467 var expectedUsage1Result = tv4.validate(addlPropInSubSchema, mySchema);
2468 assert.isFalse(expectedUsage1Result, 'plain validate should fail');
2469 //this.assert(!expectedUsage1Result, 'plain validate should fail');
2470
2471 // Usage 2
2472 var expectedUsage2Result = tv4.validateResult(addlPropInSubSchema, mySchema);
2473 assert.isFalse(expectedUsage2Result.valid, 'validateResult should fail');
2474
2475 //-> this has a typo that didn't show because of type conversion!
2476
2477 //this.assert(!expectedUsage1Result.valud, 'validateResult should fail');
2478
2479 // Usage 3
2480 var expectedMultipleErrorResult = tv4.validateMultiple(addlPropInSubSchema, mySchema);
2481 assert.isFalse(expectedMultipleErrorResult.valid, 'validateMultiple should fail');
2482 assert.length(expectedMultipleErrorResult.errors, 1, 'validateMultiple should have exactly one error');
2483 //this.assert(!expectedMultipleErrorResult.valid, 'validateMultiple should fail');
2484 //this.assert(expectedMultipleErrorResult.errors.length == 1, 'validateMultiple should have exactly one error');
2485 });
2486 });
2487 describe("Issue 67", function () {
2488
2489 it("Example from GitHub issue #67", function () {
2490 // Make sure null values don't trip up the normalisation
2491 tv4.validate(null, {default: null});
2492 });
2493 });
2494 describe("Issue 86", function () {
2495
2496 it("Example from GitHub issue #86", function () {
2497 // The "checkRecursive" flag skips some data nodes if it actually needs to check the same data/schema pair twice
2498
2499 var schema = {
2500 "type": "object",
2501 "properties": {
2502 "shape": {
2503 "oneOf": [
2504 { "$ref": "#/definitions/squareSchema" },
2505 { "$ref": "#/definitions/circleSchema" }
2506 ]
2507 }
2508 },
2509 "definitions": {
2510 "squareSchema": {
2511 "type": "object",
2512 "properties": {
2513 "thetype": {
2514 "type": "string",
2515 "enum": ["square"]
2516 },
2517 "colour": {},
2518 "shade": {},
2519 "boxname": {
2520 "type": "string"
2521 }
2522 },
2523 "oneOf": [
2524 { "$ref": "#/definitions/colourSchema" },
2525 { "$ref": "#/definitions/shadeSchema" }
2526 ],
2527 "required": ["thetype", "boxname"],
2528 "additionalProperties": false
2529 },
2530 "circleSchema": {
2531 "type": "object",
2532 "properties": {
2533 "thetype": {
2534 "type": "string",
2535 "enum": ["circle"]
2536 },
2537 "colour": {},
2538 "shade": {}
2539 },
2540 "oneOf": [
2541 { "$ref": "#/definitions/colourSchema" },
2542 { "$ref": "#/definitions/shadeSchema" }
2543 ],
2544 "additionalProperties": false
2545 },
2546 "colourSchema": {
2547 "type": "object",
2548 "properties": {
2549 "colour": {
2550 "type": "string"
2551 },
2552 "shade": {
2553 "type": "null"
2554 }
2555 }
2556 },
2557 "shadeSchema": {
2558 "type": "object",
2559 "properties": {
2560 "shade": {
2561 "type": "string"
2562 },
2563 "colour": {
2564 "type": "null"
2565 }
2566 }
2567 }
2568 }
2569 };
2570
2571
2572 var circle = {
2573 "shape": {
2574 "thetype": "circle",
2575 "shade": "red"
2576 }
2577 };
2578
2579 var simpleResult = tv4.validate(circle, schema, true);
2580 var multipleResult = tv4.validateMultiple(circle, schema, true);
2581
2582 assert.isTrue(simpleResult, 'validate() should return valid');
2583 assert.isTrue(multipleResult.valid, 'validateMultiple() should return valid');
2584 });
2585
2586 it("Second example", function () {
2587 var schema = {
2588 "allOf": [
2589 {
2590 "oneOf": [
2591 {"$ref": "#/definitions/option1"},
2592 {"$ref": "#/definitions/option2"},
2593 ]
2594 },
2595 {
2596 "not": {"$ref": "#/definitions/option2"}
2597 }
2598 ],
2599 "definitions": {
2600 "option1": {
2601 "allOf": [{"type": "string"}]
2602 },
2603 "option2": {
2604 "allOf": [{"type": "number"}]
2605 }
2606 }
2607 };
2608
2609 var simpleResult = tv4.validate("test", schema, true);
2610
2611 assert.isTrue(simpleResult, "validate() should return valid");
2612 });
2613 });
2614 describe("Enum object/null failure", function () {
2615
2616 it("Doesn't crash", function () {
2617
2618 var schema = {
2619 "type": "object",
2620 "required": ["value"],
2621 "properties": {
2622 "value": {
2623 "enum": [6, "foo", [], true, {"foo": 12}]
2624 }
2625 }
2626 };
2627
2628 var data = {value: null}; // Somehow this is only a problem when a *property* is null, not the root
2629
2630 var result = tv4.validateMultiple(data, schema);
2631
2632 assert.isFalse(result.valid, 'validateMultiple() should return invalid');
2633 });
2634 });
2635 //@ sourceMappingURL=all_concat.js.map
+0
-64
test/all_concat.js.map less more
0 {
1 "version": 3,
2 "sources": [
3 "test/_header.js",
4 "test/tests/00 - Core/01 - utils.js",
5 "test/tests/00 - Core/02 - duplicateApi.js",
6 "test/tests/00 - Core/03 - resetAndDrop.js",
7 "test/tests/00 - Core/04 - error.js",
8 "test/tests/01 - Any types/01 - type.js",
9 "test/tests/01 - Any types/02 - enum.js",
10 "test/tests/02 - Numeric/01 - multipleOf.js",
11 "test/tests/02 - Numeric/02 - min-max.js",
12 "test/tests/02 - Numeric/03 - NaN.js",
13 "test/tests/03 - Strings/01 - min-max length.js",
14 "test/tests/03 - Strings/02 - pattern.js",
15 "test/tests/04 - Arrays/01 - min-max length.js",
16 "test/tests/04 - Arrays/02 - uniqueItems.js",
17 "test/tests/04 - Arrays/03 - items (plain).js",
18 "test/tests/04 - Arrays/04 - items (tuple-typing).js",
19 "test/tests/04 - Arrays/05 - additionalItems.js",
20 "test/tests/05 - Objects/01 - min-max properties.js",
21 "test/tests/05 - Objects/02 - required.js",
22 "test/tests/05 - Objects/03 - properties.js",
23 "test/tests/05 - Objects/04 - patternProperties.js",
24 "test/tests/05 - Objects/05 - additionalProperties.js",
25 "test/tests/05 - Objects/06 - dependencies.js",
26 "test/tests/06 - Combinations/01 - allOf.js",
27 "test/tests/06 - Combinations/02- anyOf.js",
28 "test/tests/06 - Combinations/03 - oneOf.js",
29 "test/tests/06 - Combinations/04 - not.js",
30 "test/tests/07 - $ref/01 - normalise.js",
31 "test/tests/07 - $ref/02 - list missing URLs.js",
32 "test/tests/07 - $ref/03 - getSchema.js",
33 "test/tests/07 - $ref/04 - ref.js",
34 "test/tests/07 - $ref/05 - inline addressing.js",
35 "test/tests/07 - $ref/06 - multiple refs.js",
36 "test/tests/08 - API/01 - validateResult.js",
37 "test/tests/08 - API/02 - errorCodes existence.js",
38 "test/tests/08 - API/03 - get schema URIs.js",
39 "test/tests/09 - Multiple errors/01 - validateMultiple.js",
40 "test/tests/09 - Multiple errors/02 - validateMultiple 2.js",
41 "test/tests/10 - Recursive objects/01 - validate.js",
42 "test/tests/10 - Recursive objects/02 - scan.js",
43 "test/tests/11 - format/01 - register validator.js",
44 "test/tests/12 - banUnknownProperties/01 - simple case.js",
45 "test/tests/12 - banUnknownProperties/02 - composite behaviour.js",
46 "test/tests/13 - error reporting/01 - required dataPath.js",
47 "test/tests/13 - error reporting/02 - oneOf schemaPath.js",
48 "test/tests/14 - custom validation/01 - custom keywords.js",
49 "test/tests/15 - language/01 - language file.js",
50 "test/tests/15 - language/02 - custom reporter.js",
51 "test/tests/16 - hypermedia/02 - describedby link.js",
52 "test/tests/Misc/Issue 108.js",
53 "test/tests/Misc/Issue 109.js",
54 "test/tests/Misc/Issue 32.js",
55 "test/tests/Misc/Issue 67.js",
56 "test/tests/Misc/Issue 86.js",
57 "test/tests/Misc/enum null failure.js"
58 ],
59 "names": [],
60 "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA,G;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G;ACvHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,G",
61 "file": "all_concat.js",
62 "sourceRoot": ""
63 }
+0
-4254
test/deps/chai.js less more
0 ;(function(){
1
2 /**
3 * Require the given path.
4 *
5 * @param {String} path
6 * @return {Object} exports
7 * @api public
8 */
9
10 function require(path, parent, orig) {
11 var resolved = require.resolve(path);
12
13 // lookup failed
14 if (null == resolved) {
15 orig = orig || path;
16 parent = parent || 'root';
17 var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
18 err.path = orig;
19 err.parent = parent;
20 err.require = true;
21 throw err;
22 }
23
24 var module = require.modules[resolved];
25
26 // perform real require()
27 // by invoking the module's
28 // registered function
29 if (!module.exports) {
30 module.exports = {};
31 module.client = module.component = true;
32 module.call(this, module.exports, require.relative(resolved), module);
33 }
34
35 return module.exports;
36 }
37
38 /**
39 * Registered modules.
40 */
41
42 require.modules = {};
43
44 /**
45 * Registered aliases.
46 */
47
48 require.aliases = {};
49
50 /**
51 * Resolve `path`.
52 *
53 * Lookup:
54 *
55 * - PATH/index.js
56 * - PATH.js
57 * - PATH
58 *
59 * @param {String} path
60 * @return {String} path or null
61 * @api private
62 */
63
64 require.resolve = function(path) {
65 if (path.charAt(0) === '/') path = path.slice(1);
66 var index = path + '/index.js';
67
68 var paths = [
69 path,
70 path + '.js',
71 path + '.json',
72 path + '/index.js',
73 path + '/index.json'
74 ];
75
76 for (var i = 0; i < paths.length; i++) {
77 var path = paths[i];
78 if (require.modules.hasOwnProperty(path)) return path;
79 }
80
81 if (require.aliases.hasOwnProperty(index)) {
82 return require.aliases[index];
83 }
84 };
85
86 /**
87 * Normalize `path` relative to the current path.
88 *
89 * @param {String} curr
90 * @param {String} path
91 * @return {String}
92 * @api private
93 */
94
95 require.normalize = function(curr, path) {
96 var segs = [];
97
98 if ('.' != path.charAt(0)) return path;
99
100 curr = curr.split('/');
101 path = path.split('/');
102
103 for (var i = 0; i < path.length; ++i) {
104 if ('..' == path[i]) {
105 curr.pop();
106 } else if ('.' != path[i] && '' != path[i]) {
107 segs.push(path[i]);
108 }
109 }
110
111 return curr.concat(segs).join('/');
112 };
113
114 /**
115 * Register module at `path` with callback `definition`.
116 *
117 * @param {String} path
118 * @param {Function} definition
119 * @api private
120 */
121
122 require.register = function(path, definition) {
123 require.modules[path] = definition;
124 };
125
126 /**
127 * Alias a module definition.
128 *
129 * @param {String} from
130 * @param {String} to
131 * @api private
132 */
133
134 require.alias = function(from, to) {
135 if (!require.modules.hasOwnProperty(from)) {
136 throw new Error('Failed to alias "' + from + '", it does not exist');
137 }
138 require.aliases[to] = from;
139 };
140
141 /**
142 * Return a require function relative to the `parent` path.
143 *
144 * @param {String} parent
145 * @return {Function}
146 * @api private
147 */
148
149 require.relative = function(parent) {
150 var p = require.normalize(parent, '..');
151
152 /**
153 * lastIndexOf helper.
154 */
155
156 function lastIndexOf(arr, obj) {
157 var i = arr.length;
158 while (i--) {
159 if (arr[i] === obj) return i;
160 }
161 return -1;
162 }
163
164 /**
165 * The relative require() itself.
166 */
167
168 function localRequire(path) {
169 var resolved = localRequire.resolve(path);
170 return require(resolved, parent, path);
171 }
172
173 /**
174 * Resolve relative to the parent.
175 */
176
177 localRequire.resolve = function(path) {
178 var c = path.charAt(0);
179 if ('/' == c) return path.slice(1);
180 if ('.' == c) return require.normalize(p, path);
181
182 // resolve deps by returning
183 // the dep in the nearest "deps"
184 // directory
185 var segs = parent.split('/');
186 var i = lastIndexOf(segs, 'deps') + 1;
187 if (!i) i = 0;
188 path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
189 return path;
190 };
191
192 /**
193 * Check if module is defined at `path`.
194 */
195
196 localRequire.exists = function(path) {
197 return require.modules.hasOwnProperty(localRequire.resolve(path));
198 };
199
200 return localRequire;
201 };
202 require.register("chai/index.js", function(exports, require, module){
203 module.exports = require('./lib/chai');
204
205 });
206 require.register("chai/lib/chai.js", function(exports, require, module){
207 /*!
208 * chai
209 * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
210 * MIT Licensed
211 */
212
213 var used = []
214 , exports = module.exports = {};
215
216 /*!
217 * Chai version
218 */
219
220 exports.version = '1.6.1';
221
222 /*!
223 * Primary `Assertion` prototype
224 */
225
226 exports.Assertion = require('./chai/assertion');
227
228 /*!
229 * Assertion Error
230 */
231
232 exports.AssertionError = require('./chai/error');
233
234 /*!
235 * Utils for plugins (not exported)
236 */
237
238 var util = require('./chai/utils');
239
240 /**
241 * # .use(function)
242 *
243 * Provides a way to extend the internals of Chai
244 *
245 * @param {Function}
246 * @returns {this} for chaining
247 * @api public
248 */
249
250 exports.use = function (fn) {
251 if (!~used.indexOf(fn)) {
252 fn(this, util);
253 used.push(fn);
254 }
255
256 return this;
257 };
258
259 /*!
260 * Core Assertions
261 */
262
263 var core = require('./chai/core/assertions');
264 exports.use(core);
265
266 /*!
267 * Expect interface
268 */
269
270 var expect = require('./chai/interface/expect');
271 exports.use(expect);
272
273 /*!
274 * Should interface
275 */
276
277 var should = require('./chai/interface/should');
278 exports.use(should);
279
280 /*!
281 * Assert interface
282 */
283
284 var assert = require('./chai/interface/assert');
285 exports.use(assert);
286
287 });
288 require.register("chai/lib/chai/assertion.js", function(exports, require, module){
289 /*!
290 * chai
291 * http://chaijs.com
292 * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
293 * MIT Licensed
294 */
295
296 /*!
297 * Module dependencies.
298 */
299
300 var AssertionError = require('./error')
301 , util = require('./utils')
302 , flag = util.flag;
303
304 /*!
305 * Module export.
306 */
307
308 module.exports = Assertion;
309
310
311 /*!
312 * Assertion Constructor
313 *
314 * Creates object for chaining.
315 *
316 * @api private
317 */
318
319 function Assertion (obj, msg, stack) {
320 flag(this, 'ssfi', stack || arguments.callee);
321 flag(this, 'object', obj);
322 flag(this, 'message', msg);
323 }
324
325 /*!
326 * ### Assertion.includeStack
327 *
328 * User configurable property, influences whether stack trace
329 * is included in Assertion error message. Default of false
330 * suppresses stack trace in the error message
331 *
332 * Assertion.includeStack = true; // enable stack on error
333 *
334 * @api public
335 */
336
337 Assertion.includeStack = false;
338
339 /*!
340 * ### Assertion.showDiff
341 *
342 * User configurable property, influences whether or not
343 * the `showDiff` flag should be included in the thrown
344 * AssertionErrors. `false` will always be `false`; `true`
345 * will be true when the assertion has requested a diff
346 * be shown.
347 *
348 * @api public
349 */
350
351 Assertion.showDiff = true;
352
353 Assertion.addProperty = function (name, fn) {
354 util.addProperty(this.prototype, name, fn);
355 };
356
357 Assertion.addMethod = function (name, fn) {
358 util.addMethod(this.prototype, name, fn);
359 };
360
361 Assertion.addChainableMethod = function (name, fn, chainingBehavior) {
362 util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
363 };
364
365 Assertion.overwriteProperty = function (name, fn) {
366 util.overwriteProperty(this.prototype, name, fn);
367 };
368
369 Assertion.overwriteMethod = function (name, fn) {
370 util.overwriteMethod(this.prototype, name, fn);
371 };
372
373 /*!
374 * ### .assert(expression, message, negateMessage, expected, actual)
375 *
376 * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
377 *
378 * @name assert
379 * @param {Philosophical} expression to be tested
380 * @param {String} message to display if fails
381 * @param {String} negatedMessage to display if negated expression fails
382 * @param {Mixed} expected value (remember to check for negation)
383 * @param {Mixed} actual (optional) will default to `this.obj`
384 * @api private
385 */
386
387 Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
388 var ok = util.test(this, arguments);
389 if (true !== showDiff) showDiff = false;
390 if (true !== Assertion.showDiff) showDiff = false;
391
392 if (!ok) {
393 var msg = util.getMessage(this, arguments)
394 , actual = util.getActual(this, arguments);
395 throw new AssertionError({
396 message: msg
397 , actual: actual
398 , expected: expected
399 , stackStartFunction: (Assertion.includeStack) ? this.assert : flag(this, 'ssfi')
400 , showDiff: showDiff
401 });
402 }
403 };
404
405 /*!
406 * ### ._obj
407 *
408 * Quick reference to stored `actual` value for plugin developers.
409 *
410 * @api private
411 */
412
413 Object.defineProperty(Assertion.prototype, '_obj',
414 { get: function () {
415 return flag(this, 'object');
416 }
417 , set: function (val) {
418 flag(this, 'object', val);
419 }
420 });
421
422 });
423 require.register("chai/lib/chai/error.js", function(exports, require, module){
424 /*!
425 * chai
426 * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
427 * MIT Licensed
428 */
429
430 /*!
431 * Main export
432 */
433
434 module.exports = AssertionError;
435
436 /**
437 * # AssertionError (constructor)
438 *
439 * Create a new assertion error based on the Javascript
440 * `Error` prototype.
441 *
442 * **Options**
443 * - message
444 * - actual
445 * - expected
446 * - operator
447 * - startStackFunction
448 *
449 * @param {Object} options
450 * @api public
451 */
452
453 function AssertionError (options) {
454 options = options || {};
455 this.message = options.message;
456 this.actual = options.actual;
457 this.expected = options.expected;
458 this.operator = options.operator;
459 this.showDiff = options.showDiff;
460
461 if (options.stackStartFunction && Error.captureStackTrace) {
462 var stackStartFunction = options.stackStartFunction;
463 Error.captureStackTrace(this, stackStartFunction);
464 }
465 }
466
467 /*!
468 * Inherit from Error
469 */
470
471 AssertionError.prototype = Object.create(Error.prototype);
472 AssertionError.prototype.name = 'AssertionError';
473 AssertionError.prototype.constructor = AssertionError;
474
475 /**
476 * # toString()
477 *
478 * Override default to string method
479 */
480
481 AssertionError.prototype.toString = function() {
482 return this.message;
483 };
484
485 });
486 require.register("chai/lib/chai/core/assertions.js", function(exports, require, module){
487 /*!
488 * chai
489 * http://chaijs.com
490 * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
491 * MIT Licensed
492 */
493
494 module.exports = function (chai, _) {
495 var Assertion = chai.Assertion
496 , toString = Object.prototype.toString
497 , flag = _.flag;
498
499 /**
500 * ### Language Chains
501 *
502 * The following are provide as chainable getters to
503 * improve the readability of your assertions. They
504 * do not provide an testing capability unless they
505 * have been overwritten by a plugin.
506 *
507 * **Chains**
508 *
509 * - to
510 * - be
511 * - been
512 * - is
513 * - that
514 * - and
515 * - have
516 * - with
517 * - at
518 * - of
519 * - same
520 *
521 * @name language chains
522 * @api public
523 */
524
525 [ 'to', 'be', 'been'
526 , 'is', 'and', 'have'
527 , 'with', 'that', 'at'
528 , 'of', 'same' ].forEach(function (chain) {
529 Assertion.addProperty(chain, function () {
530 return this;
531 });
532 });
533
534 /**
535 * ### .not
536 *
537 * Negates any of assertions following in the chain.
538 *
539 * expect(foo).to.not.equal('bar');
540 * expect(goodFn).to.not.throw(Error);
541 * expect({ foo: 'baz' }).to.have.property('foo')
542 * .and.not.equal('bar');
543 *
544 * @name not
545 * @api public
546 */
547
548 Assertion.addProperty('not', function () {
549 flag(this, 'negate', true);
550 });
551
552 /**
553 * ### .deep
554 *
555 * Sets the `deep` flag, later used by the `equal` and
556 * `property` assertions.
557 *
558 * expect(foo).to.deep.equal({ bar: 'baz' });
559 * expect({ foo: { bar: { baz: 'quux' } } })
560 * .to.have.deep.property('foo.bar.baz', 'quux');
561 *
562 * @name deep
563 * @api public
564 */
565
566 Assertion.addProperty('deep', function () {
567 flag(this, 'deep', true);
568 });
569
570 /**
571 * ### .a(type)
572 *
573 * The `a` and `an` assertions are aliases that can be
574 * used either as language chains or to assert a value's
575 * type.
576 *
577 * // typeof
578 * expect('test').to.be.a('string');
579 * expect({ foo: 'bar' }).to.be.an('object');
580 * expect(null).to.be.a('null');
581 * expect(undefined).to.be.an('undefined');
582 *
583 * // language chain
584 * expect(foo).to.be.an.instanceof(Foo);
585 *
586 * @name a
587 * @alias an
588 * @param {String} type
589 * @param {String} message _optional_
590 * @api public
591 */
592
593 function an (type, msg) {
594 if (msg) flag(this, 'message', msg);
595 type = type.toLowerCase();
596 var obj = flag(this, 'object')
597 , article = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(type.charAt(0)) ? 'an ' : 'a ';
598
599 this.assert(
600 type === _.type(obj)
601 , 'expected #{this} to be ' + article + type
602 , 'expected #{this} not to be ' + article + type
603 );
604 }
605
606 Assertion.addChainableMethod('an', an);
607 Assertion.addChainableMethod('a', an);
608
609 /**
610 * ### .include(value)
611 *
612 * The `include` and `contain` assertions can be used as either property
613 * based language chains or as methods to assert the inclusion of an object
614 * in an array or a substring in a string. When used as language chains,
615 * they toggle the `contain` flag for the `keys` assertion.
616 *
617 * expect([1,2,3]).to.include(2);
618 * expect('foobar').to.contain('foo');
619 * expect({ foo: 'bar', hello: 'universe' }).to.include.keys('foo');
620 *
621 * @name include
622 * @alias contain
623 * @param {Object|String|Number} obj
624 * @param {String} message _optional_
625 * @api public
626 */
627
628 function includeChainingBehavior () {
629 flag(this, 'contains', true);
630 }
631
632 function include (val, msg) {
633 if (msg) flag(this, 'message', msg);
634 var obj = flag(this, 'object')
635 this.assert(
636 ~obj.indexOf(val)
637 , 'expected #{this} to include ' + _.inspect(val)
638 , 'expected #{this} to not include ' + _.inspect(val));
639 }
640
641 Assertion.addChainableMethod('include', include, includeChainingBehavior);
642 Assertion.addChainableMethod('contain', include, includeChainingBehavior);
643
644 /**
645 * ### .ok
646 *
647 * Asserts that the target is truthy.
648 *
649 * expect('everthing').to.be.ok;
650 * expect(1).to.be.ok;
651 * expect(false).to.not.be.ok;
652 * expect(undefined).to.not.be.ok;
653 * expect(null).to.not.be.ok;
654 *
655 * @name ok
656 * @api public
657 */
658
659 Assertion.addProperty('ok', function () {
660 this.assert(
661 flag(this, 'object')
662 , 'expected #{this} to be truthy'
663 , 'expected #{this} to be falsy');
664 });
665
666 /**
667 * ### .true
668 *
669 * Asserts that the target is `true`.
670 *
671 * expect(true).to.be.true;
672 * expect(1).to.not.be.true;
673 *
674 * @name true
675 * @api public
676 */
677
678 Assertion.addProperty('true', function () {
679 this.assert(
680 true === flag(this, 'object')
681 , 'expected #{this} to be true'
682 , 'expected #{this} to be false'
683 , this.negate ? false : true
684 );
685 });
686
687 /**
688 * ### .false
689 *
690 * Asserts that the target is `false`.
691 *
692 * expect(false).to.be.false;
693 * expect(0).to.not.be.false;
694 *
695 * @name false
696 * @api public
697 */
698
699 Assertion.addProperty('false', function () {
700 this.assert(
701 false === flag(this, 'object')
702 , 'expected #{this} to be false'
703 , 'expected #{this} to be true'
704 , this.negate ? true : false
705 );
706 });
707
708 /**
709 * ### .null
710 *
711 * Asserts that the target is `null`.
712 *
713 * expect(null).to.be.null;
714 * expect(undefined).not.to.be.null;
715 *
716 * @name null
717 * @api public
718 */
719
720 Assertion.addProperty('null', function () {
721 this.assert(
722 null === flag(this, 'object')
723 , 'expected #{this} to be null'
724 , 'expected #{this} not to be null'
725 );
726 });
727
728 /**
729 * ### .undefined
730 *
731 * Asserts that the target is `undefined`.
732 *
733 * expect(undefined).to.be.undefined;
734 * expect(null).to.not.be.undefined;
735 *
736 * @name undefined
737 * @api public
738 */
739
740 Assertion.addProperty('undefined', function () {
741 this.assert(
742 undefined === flag(this, 'object')
743 , 'expected #{this} to be undefined'
744 , 'expected #{this} not to be undefined'
745 );
746 });
747
748 /**
749 * ### .exist
750 *
751 * Asserts that the target is neither `null` nor `undefined`.
752 *
753 * var foo = 'hi'
754 * , bar = null
755 * , baz;
756 *
757 * expect(foo).to.exist;
758 * expect(bar).to.not.exist;
759 * expect(baz).to.not.exist;
760 *
761 * @name exist
762 * @api public
763 */
764
765 Assertion.addProperty('exist', function () {
766 this.assert(
767 null != flag(this, 'object')
768 , 'expected #{this} to exist'
769 , 'expected #{this} to not exist'
770 );
771 });
772
773
774 /**
775 * ### .empty
776 *
777 * Asserts that the target's length is `0`. For arrays, it checks
778 * the `length` property. For objects, it gets the count of
779 * enumerable keys.
780 *
781 * expect([]).to.be.empty;
782 * expect('').to.be.empty;
783 * expect({}).to.be.empty;
784 *
785 * @name empty
786 * @api public
787 */
788
789 Assertion.addProperty('empty', function () {
790 var obj = flag(this, 'object')
791 , expected = obj;
792
793 if (Array.isArray(obj) || 'string' === typeof object) {
794 expected = obj.length;
795 } else if (typeof obj === 'object') {
796 expected = Object.keys(obj).length;
797 }
798
799 this.assert(
800 !expected
801 , 'expected #{this} to be empty'
802 , 'expected #{this} not to be empty'
803 );
804 });
805
806 /**
807 * ### .arguments
808 *
809 * Asserts that the target is an arguments object.
810 *
811 * function test () {
812 * expect(arguments).to.be.arguments;
813 * }
814 *
815 * @name arguments
816 * @alias Arguments
817 * @api public
818 */
819
820 function checkArguments () {
821 var obj = flag(this, 'object')
822 , type = Object.prototype.toString.call(obj);
823 this.assert(
824 '[object Arguments]' === type
825 , 'expected #{this} to be arguments but got ' + type
826 , 'expected #{this} to not be arguments'
827 );
828 }
829
830 Assertion.addProperty('arguments', checkArguments);
831 Assertion.addProperty('Arguments', checkArguments);
832
833 /**
834 * ### .equal(value)
835 *
836 * Asserts that the target is strictly equal (`===`) to `value`.
837 * Alternately, if the `deep` flag is set, asserts that
838 * the target is deeply equal to `value`.
839 *
840 * expect('hello').to.equal('hello');
841 * expect(42).to.equal(42);
842 * expect(1).to.not.equal(true);
843 * expect({ foo: 'bar' }).to.not.equal({ foo: 'bar' });
844 * expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' });
845 *
846 * @name equal
847 * @alias equals
848 * @alias eq
849 * @alias deep.equal
850 * @param {Mixed} value
851 * @param {String} message _optional_
852 * @api public
853 */
854
855 function assertEqual (val, msg) {
856 if (msg) flag(this, 'message', msg);
857 var obj = flag(this, 'object');
858 if (flag(this, 'deep')) {
859 return this.eql(val);
860 } else {
861 this.assert(
862 val === obj
863 , 'expected #{this} to equal #{exp}'
864 , 'expected #{this} to not equal #{exp}'
865 , val
866 , this._obj
867 , true
868 );
869 }
870 }
871
872 Assertion.addMethod('equal', assertEqual);
873 Assertion.addMethod('equals', assertEqual);
874 Assertion.addMethod('eq', assertEqual);
875
876 /**
877 * ### .eql(value)
878 *
879 * Asserts that the target is deeply equal to `value`.
880 *
881 * expect({ foo: 'bar' }).to.eql({ foo: 'bar' });
882 * expect([ 1, 2, 3 ]).to.eql([ 1, 2, 3 ]);
883 *
884 * @name eql
885 * @alias eqls
886 * @param {Mixed} value
887 * @param {String} message _optional_
888 * @api public
889 */
890
891 function assertEql(obj, msg) {
892 if (msg) flag(this, 'message', msg);
893 this.assert(
894 _.eql(obj, flag(this, 'object'))
895 , 'expected #{this} to deeply equal #{exp}'
896 , 'expected #{this} to not deeply equal #{exp}'
897 , obj
898 , this._obj
899 , true
900 );
901 }
902
903 Assertion.addMethod('eql', assertEql);
904 Assertion.addMethod('eqls', assertEql);
905
906 /**
907 * ### .above(value)
908 *
909 * Asserts that the target is greater than `value`.
910 *
911 * expect(10).to.be.above(5);
912 *
913 * Can also be used in conjunction with `length` to
914 * assert a minimum length. The benefit being a
915 * more informative error message than if the length
916 * was supplied directly.
917 *
918 * expect('foo').to.have.length.above(2);
919 * expect([ 1, 2, 3 ]).to.have.length.above(2);
920 *
921 * @name above
922 * @alias gt
923 * @alias greaterThan
924 * @param {Number} value
925 * @param {String} message _optional_
926 * @api public
927 */
928
929 function assertAbove (n, msg) {
930 if (msg) flag(this, 'message', msg);
931 var obj = flag(this, 'object');
932 if (flag(this, 'doLength')) {
933 new Assertion(obj, msg).to.have.property('length');
934 var len = obj.length;
935 this.assert(
936 len > n
937 , 'expected #{this} to have a length above #{exp} but got #{act}'
938 , 'expected #{this} to not have a length above #{exp}'
939 , n
940 , len
941 );
942 } else {
943 this.assert(
944 obj > n
945 , 'expected #{this} to be above ' + n
946 , 'expected #{this} to be at most ' + n
947 );
948 }
949 }
950
951 Assertion.addMethod('above', assertAbove);
952 Assertion.addMethod('gt', assertAbove);
953 Assertion.addMethod('greaterThan', assertAbove);
954
955 /**
956 * ### .least(value)
957 *
958 * Asserts that the target is greater than or equal to `value`.
959 *
960 * expect(10).to.be.at.least(10);
961 *
962 * Can also be used in conjunction with `length` to
963 * assert a minimum length. The benefit being a
964 * more informative error message than if the length
965 * was supplied directly.
966 *
967 * expect('foo').to.have.length.of.at.least(2);
968 * expect([ 1, 2, 3 ]).to.have.length.of.at.least(3);
969 *
970 * @name least
971 * @alias gte
972 * @param {Number} value
973 * @param {String} message _optional_
974 * @api public
975 */
976
977 function assertLeast (n, msg) {
978 if (msg) flag(this, 'message', msg);
979 var obj = flag(this, 'object');
980 if (flag(this, 'doLength')) {
981 new Assertion(obj, msg).to.have.property('length');
982 var len = obj.length;
983 this.assert(
984 len >= n
985 , 'expected #{this} to have a length at least #{exp} but got #{act}'
986 , 'expected #{this} to have a length below #{exp}'
987 , n
988 , len
989 );
990 } else {
991 this.assert(
992 obj >= n
993 , 'expected #{this} to be at least ' + n
994 , 'expected #{this} to be below ' + n
995 );
996 }
997 }
998
999 Assertion.addMethod('least', assertLeast);
1000 Assertion.addMethod('gte', assertLeast);
1001
1002 /**
1003 * ### .below(value)
1004 *
1005 * Asserts that the target is less than `value`.
1006 *
1007 * expect(5).to.be.below(10);
1008 *
1009 * Can also be used in conjunction with `length` to
1010 * assert a maximum length. The benefit being a
1011 * more informative error message than if the length
1012 * was supplied directly.
1013 *
1014 * expect('foo').to.have.length.below(4);
1015 * expect([ 1, 2, 3 ]).to.have.length.below(4);
1016 *
1017 * @name below
1018 * @alias lt
1019 * @alias lessThan
1020 * @param {Number} value
1021 * @param {String} message _optional_
1022 * @api public
1023 */
1024
1025 function assertBelow (n, msg) {
1026 if (msg) flag(this, 'message', msg);
1027 var obj = flag(this, 'object');
1028 if (flag(this, 'doLength')) {
1029 new Assertion(obj, msg).to.have.property('length');
1030 var len = obj.length;
1031 this.assert(
1032 len < n
1033 , 'expected #{this} to have a length below #{exp} but got #{act}'
1034 , 'expected #{this} to not have a length below #{exp}'
1035 , n
1036 , len
1037 );
1038 } else {
1039 this.assert(
1040 obj < n
1041 , 'expected #{this} to be below ' + n
1042 , 'expected #{this} to be at least ' + n
1043 );
1044 }
1045 }
1046
1047 Assertion.addMethod('below', assertBelow);
1048 Assertion.addMethod('lt', assertBelow);
1049 Assertion.addMethod('lessThan', assertBelow);
1050
1051 /**
1052 * ### .most(value)
1053 *
1054 * Asserts that the target is less than or equal to `value`.
1055 *
1056 * expect(5).to.be.at.most(5);
1057 *
1058 * Can also be used in conjunction with `length` to
1059 * assert a maximum length. The benefit being a
1060 * more informative error message than if the length
1061 * was supplied directly.
1062 *
1063 * expect('foo').to.have.length.of.at.most(4);
1064 * expect([ 1, 2, 3 ]).to.have.length.of.at.most(3);
1065 *
1066 * @name most
1067 * @alias lte
1068 * @param {Number} value
1069 * @param {String} message _optional_
1070 * @api public
1071 */
1072
1073 function assertMost (n, msg) {
1074 if (msg) flag(this, 'message', msg);
1075 var obj = flag(this, 'object');
1076 if (flag(this, 'doLength')) {
1077 new Assertion(obj, msg).to.have.property('length');
1078 var len = obj.length;
1079 this.assert(
1080 len <= n
1081 , 'expected #{this} to have a length at most #{exp} but got #{act}'
1082 , 'expected #{this} to have a length above #{exp}'
1083 , n
1084 , len
1085 );
1086 } else {
1087 this.assert(
1088 obj <= n
1089 , 'expected #{this} to be at most ' + n
1090 , 'expected #{this} to be above ' + n
1091 );
1092 }
1093 }
1094
1095 Assertion.addMethod('most', assertMost);
1096 Assertion.addMethod('lte', assertMost);
1097
1098 /**
1099 * ### .within(start, finish)
1100 *
1101 * Asserts that the target is within a range.
1102 *
1103 * expect(7).to.be.within(5,10);
1104 *
1105 * Can also be used in conjunction with `length` to
1106 * assert a length range. The benefit being a
1107 * more informative error message than if the length
1108 * was supplied directly.
1109 *
1110 * expect('foo').to.have.length.within(2,4);
1111 * expect([ 1, 2, 3 ]).to.have.length.within(2,4);
1112 *
1113 * @name within
1114 * @param {Number} start lowerbound inclusive
1115 * @param {Number} finish upperbound inclusive
1116 * @param {String} message _optional_
1117 * @api public
1118 */
1119
1120 Assertion.addMethod('within', function (start, finish, msg) {
1121 if (msg) flag(this, 'message', msg);
1122 var obj = flag(this, 'object')
1123 , range = start + '..' + finish;
1124 if (flag(this, 'doLength')) {
1125 new Assertion(obj, msg).to.have.property('length');
1126 var len = obj.length;
1127 this.assert(
1128 len >= start && len <= finish
1129 , 'expected #{this} to have a length within ' + range
1130 , 'expected #{this} to not have a length within ' + range
1131 );
1132 } else {
1133 this.assert(
1134 obj >= start && obj <= finish
1135 , 'expected #{this} to be within ' + range
1136 , 'expected #{this} to not be within ' + range
1137 );
1138 }
1139 });
1140
1141 /**
1142 * ### .instanceof(constructor)
1143 *
1144 * Asserts that the target is an instance of `constructor`.
1145 *
1146 * var Tea = function (name) { this.name = name; }
1147 * , Chai = new Tea('chai');
1148 *
1149 * expect(Chai).to.be.an.instanceof(Tea);
1150 * expect([ 1, 2, 3 ]).to.be.instanceof(Array);
1151 *
1152 * @name instanceof
1153 * @param {Constructor} constructor
1154 * @param {String} message _optional_
1155 * @alias instanceOf
1156 * @api public
1157 */
1158
1159 function assertInstanceOf (constructor, msg) {
1160 if (msg) flag(this, 'message', msg);
1161 var name = _.getName(constructor);
1162 this.assert(
1163 flag(this, 'object') instanceof constructor
1164 , 'expected #{this} to be an instance of ' + name
1165 , 'expected #{this} to not be an instance of ' + name
1166 );
1167 };
1168
1169 Assertion.addMethod('instanceof', assertInstanceOf);
1170 Assertion.addMethod('instanceOf', assertInstanceOf);
1171
1172 /**
1173 * ### .property(name, [value])
1174 *
1175 * Asserts that the target has a property `name`, optionally asserting that
1176 * the value of that property is strictly equal to `value`.
1177 * If the `deep` flag is set, you can use dot- and bracket-notation for deep
1178 * references into objects and arrays.
1179 *
1180 * // simple referencing
1181 * var obj = { foo: 'bar' };
1182 * expect(obj).to.have.property('foo');
1183 * expect(obj).to.have.property('foo', 'bar');
1184 *
1185 * // deep referencing
1186 * var deepObj = {
1187 * green: { tea: 'matcha' }
1188 * , teas: [ 'chai', 'matcha', { tea: 'konacha' } ]
1189 * };
1190
1191 * expect(deepObj).to.have.deep.property('green.tea', 'matcha');
1192 * expect(deepObj).to.have.deep.property('teas[1]', 'matcha');
1193 * expect(deepObj).to.have.deep.property('teas[2].tea', 'konacha');
1194 *
1195 * You can also use an array as the starting point of a `deep.property`
1196 * assertion, or traverse nested arrays.
1197 *
1198 * var arr = [
1199 * [ 'chai', 'matcha', 'konacha' ]
1200 * , [ { tea: 'chai' }
1201 * , { tea: 'matcha' }
1202 * , { tea: 'konacha' } ]
1203 * ];
1204 *
1205 * expect(arr).to.have.deep.property('[0][1]', 'matcha');
1206 * expect(arr).to.have.deep.property('[1][2].tea', 'konacha');
1207 *
1208 * Furthermore, `property` changes the subject of the assertion
1209 * to be the value of that property from the original object. This
1210 * permits for further chainable assertions on that property.
1211 *
1212 * expect(obj).to.have.property('foo')
1213 * .that.is.a('string');
1214 * expect(deepObj).to.have.property('green')
1215 * .that.is.an('object')
1216 * .that.deep.equals({ tea: 'matcha' });
1217 * expect(deepObj).to.have.property('teas')
1218 * .that.is.an('array')
1219 * .with.deep.property('[2]')
1220 * .that.deep.equals({ tea: 'konacha' });
1221 *
1222 * @name property
1223 * @alias deep.property
1224 * @param {String} name
1225 * @param {Mixed} value (optional)
1226 * @param {String} message _optional_
1227 * @returns value of property for chaining
1228 * @api public
1229 */
1230
1231 Assertion.addMethod('property', function (name, val, msg) {
1232 if (msg) flag(this, 'message', msg);
1233
1234 var descriptor = flag(this, 'deep') ? 'deep property ' : 'property '
1235 , negate = flag(this, 'negate')
1236 , obj = flag(this, 'object')
1237 , value = flag(this, 'deep')
1238 ? _.getPathValue(name, obj)
1239 : obj[name];
1240
1241 if (negate && undefined !== val) {
1242 if (undefined === value) {
1243 msg = (msg != null) ? msg + ': ' : '';
1244 throw new Error(msg + _.inspect(obj) + ' has no ' + descriptor + _.inspect(name));
1245 }
1246 } else {
1247 this.assert(
1248 undefined !== value
1249 , 'expected #{this} to have a ' + descriptor + _.inspect(name)
1250 , 'expected #{this} to not have ' + descriptor + _.inspect(name));
1251 }
1252
1253 if (undefined !== val) {
1254 this.assert(
1255 val === value
1256 , 'expected #{this} to have a ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}'
1257 , 'expected #{this} to not have a ' + descriptor + _.inspect(name) + ' of #{act}'
1258 , val
1259 , value
1260 );
1261 }
1262
1263 flag(this, 'object', value);
1264 });
1265
1266
1267 /**
1268 * ### .ownProperty(name)
1269 *
1270 * Asserts that the target has an own property `name`.
1271 *
1272 * expect('test').to.have.ownProperty('length');
1273 *
1274 * @name ownProperty
1275 * @alias haveOwnProperty
1276 * @param {String} name
1277 * @param {String} message _optional_
1278 * @api public
1279 */
1280
1281 function assertOwnProperty (name, msg) {
1282 if (msg) flag(this, 'message', msg);
1283 var obj = flag(this, 'object');
1284 this.assert(
1285 obj.hasOwnProperty(name)
1286 , 'expected #{this} to have own property ' + _.inspect(name)
1287 , 'expected #{this} to not have own property ' + _.inspect(name)
1288 );
1289 }
1290
1291 Assertion.addMethod('ownProperty', assertOwnProperty);
1292 Assertion.addMethod('haveOwnProperty', assertOwnProperty);
1293
1294 /**
1295 * ### .length(value)
1296 *
1297 * Asserts that the target's `length` property has
1298 * the expected value.
1299 *
1300 * expect([ 1, 2, 3]).to.have.length(3);
1301 * expect('foobar').to.have.length(6);
1302 *
1303 * Can also be used as a chain precursor to a value
1304 * comparison for the length property.
1305 *
1306 * expect('foo').to.have.length.above(2);
1307 * expect([ 1, 2, 3 ]).to.have.length.above(2);
1308 * expect('foo').to.have.length.below(4);
1309 * expect([ 1, 2, 3 ]).to.have.length.below(4);
1310 * expect('foo').to.have.length.within(2,4);
1311 * expect([ 1, 2, 3 ]).to.have.length.within(2,4);
1312 *
1313 * @name length
1314 * @alias lengthOf
1315 * @param {Number} length
1316 * @param {String} message _optional_
1317 * @api public
1318 */
1319
1320 function assertLengthChain () {
1321 flag(this, 'doLength', true);
1322 }
1323
1324 function assertLength (n, msg) {
1325 if (msg) flag(this, 'message', msg);
1326 var obj = flag(this, 'object');
1327 new Assertion(obj, msg).to.have.property('length');
1328 var len = obj.length;
1329
1330 this.assert(
1331 len == n
1332 , 'expected #{this} to have a length of #{exp} but got #{act}'
1333 , 'expected #{this} to not have a length of #{act}'
1334 , n
1335 , len
1336 );
1337 }
1338
1339 Assertion.addChainableMethod('length', assertLength, assertLengthChain);
1340 Assertion.addMethod('lengthOf', assertLength, assertLengthChain);
1341
1342 /**
1343 * ### .match(regexp)
1344 *
1345 * Asserts that the target matches a regular expression.
1346 *
1347 * expect('foobar').to.match(/^foo/);
1348 *
1349 * @name match
1350 * @param {RegExp} RegularExpression
1351 * @param {String} message _optional_
1352 * @api public
1353 */
1354
1355 Assertion.addMethod('match', function (re, msg) {
1356 if (msg) flag(this, 'message', msg);
1357 var obj = flag(this, 'object');
1358 this.assert(
1359 re.exec(obj)
1360 , 'expected #{this} to match ' + re
1361 , 'expected #{this} not to match ' + re
1362 );
1363 });
1364
1365 /**
1366 * ### .string(string)
1367 *
1368 * Asserts that the string target contains another string.
1369 *
1370 * expect('foobar').to.have.string('bar');
1371 *
1372 * @name string
1373 * @param {String} string
1374 * @param {String} message _optional_
1375 * @api public
1376 */
1377
1378 Assertion.addMethod('string', function (str, msg) {
1379 if (msg) flag(this, 'message', msg);
1380 var obj = flag(this, 'object');
1381 new Assertion(obj, msg).is.a('string');
1382
1383 this.assert(
1384 ~obj.indexOf(str)
1385 , 'expected #{this} to contain ' + _.inspect(str)
1386 , 'expected #{this} to not contain ' + _.inspect(str)
1387 );
1388 });
1389
1390
1391 /**
1392 * ### .keys(key1, [key2], [...])
1393 *
1394 * Asserts that the target has exactly the given keys, or
1395 * asserts the inclusion of some keys when using the
1396 * `include` or `contain` modifiers.
1397 *
1398 * expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']);
1399 * expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('foo', 'bar');
1400 *
1401 * @name keys
1402 * @alias key
1403 * @param {String...|Array} keys
1404 * @api public
1405 */
1406
1407 function assertKeys (keys) {
1408 var obj = flag(this, 'object')
1409 , str
1410 , ok = true;
1411
1412 keys = keys instanceof Array
1413 ? keys
1414 : Array.prototype.slice.call(arguments);
1415
1416 if (!keys.length) throw new Error('keys required');
1417
1418 var actual = Object.keys(obj)
1419 , len = keys.length;
1420
1421 // Inclusion
1422 ok = keys.every(function(key){
1423 return ~actual.indexOf(key);
1424 });
1425
1426 // Strict
1427 if (!flag(this, 'negate') && !flag(this, 'contains')) {
1428 ok = ok && keys.length == actual.length;
1429 }
1430
1431 // Key string
1432 if (len > 1) {
1433 keys = keys.map(function(key){
1434 return _.inspect(key);
1435 });
1436 var last = keys.pop();
1437 str = keys.join(', ') + ', and ' + last;
1438 } else {
1439 str = _.inspect(keys[0]);
1440 }
1441
1442 // Form
1443 str = (len > 1 ? 'keys ' : 'key ') + str;
1444
1445 // Have / include
1446 str = (flag(this, 'contains') ? 'contain ' : 'have ') + str;
1447
1448 // Assertion
1449 this.assert(
1450 ok
1451 , 'expected #{this} to ' + str
1452 , 'expected #{this} to not ' + str
1453 );
1454 }
1455
1456 Assertion.addMethod('keys', assertKeys);
1457 Assertion.addMethod('key', assertKeys);
1458
1459 /**
1460 * ### .throw(constructor)
1461 *
1462 * Asserts that the function target will throw a specific error, or specific type of error
1463 * (as determined using `instanceof`), optionally with a RegExp or string inclusion test
1464 * for the error's message.
1465 *
1466 * var err = new ReferenceError('This is a bad function.');
1467 * var fn = function () { throw err; }
1468 * expect(fn).to.throw(ReferenceError);
1469 * expect(fn).to.throw(Error);
1470 * expect(fn).to.throw(/bad function/);
1471 * expect(fn).to.not.throw('good function');
1472 * expect(fn).to.throw(ReferenceError, /bad function/);
1473 * expect(fn).to.throw(err);
1474 * expect(fn).to.not.throw(new RangeError('Out of range.'));
1475 *
1476 * Please note that when a throw expectation is negated, it will check each
1477 * parameter independently, starting with error constructor type. The appropriate way
1478 * to check for the existence of a type of error but for a message that does not match
1479 * is to use `and`.
1480 *
1481 * expect(fn).to.throw(ReferenceError)
1482 * .and.not.throw(/good function/);
1483 *
1484 * @name throw
1485 * @alias throws
1486 * @alias Throw
1487 * @param {ErrorConstructor} constructor
1488 * @param {String|RegExp} expected error message
1489 * @param {String} message _optional_
1490 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
1491 * @api public
1492 */
1493
1494 function assertThrows (constructor, errMsg, msg) {
1495 if (msg) flag(this, 'message', msg);
1496 var obj = flag(this, 'object');
1497 new Assertion(obj, msg).is.a('function');
1498
1499 var thrown = false
1500 , desiredError = null
1501 , name = null
1502 , thrownError = null;
1503
1504 if (arguments.length === 0) {
1505 errMsg = null;
1506 constructor = null;
1507 } else if (constructor && (constructor instanceof RegExp || 'string' === typeof constructor)) {
1508 errMsg = constructor;
1509 constructor = null;
1510 } else if (constructor && constructor instanceof Error) {
1511 desiredError = constructor;
1512 constructor = null;
1513 errMsg = null;
1514 } else if (typeof constructor === 'function') {
1515 name = (new constructor()).name;
1516 } else {
1517 constructor = null;
1518 }
1519
1520 try {
1521 obj();
1522 } catch (err) {
1523 // first, check desired error
1524 if (desiredError) {
1525 this.assert(
1526 err === desiredError
1527 , 'expected #{this} to throw #{exp} but #{act} was thrown'
1528 , 'expected #{this} to not throw #{exp}'
1529 , desiredError
1530 , err
1531 );
1532
1533 return this;
1534 }
1535 // next, check constructor
1536 if (constructor) {
1537 this.assert(
1538 err instanceof constructor
1539 , 'expected #{this} to throw #{exp} but #{act} was thrown'
1540 , 'expected #{this} to not throw #{exp} but #{act} was thrown'
1541 , name
1542 , err
1543 );
1544
1545 if (!errMsg) return this;
1546 }
1547 // next, check message
1548 var message = 'object' === _.type(err) && "message" in err
1549 ? err.message
1550 : '' + err;
1551
1552 if ((message != null) && errMsg && errMsg instanceof RegExp) {
1553 this.assert(
1554 errMsg.exec(message)
1555 , 'expected #{this} to throw error matching #{exp} but got #{act}'
1556 , 'expected #{this} to throw error not matching #{exp}'
1557 , errMsg
1558 , message
1559 );
1560
1561 return this;
1562 } else if ((message != null) && errMsg && 'string' === typeof errMsg) {
1563 this.assert(
1564 ~message.indexOf(errMsg)
1565 , 'expected #{this} to throw error including #{exp} but got #{act}'
1566 , 'expected #{this} to throw error not including #{act}'
1567 , errMsg
1568 , message
1569 );
1570
1571 return this;
1572 } else {
1573 thrown = true;
1574 thrownError = err;
1575 }
1576 }
1577
1578 var actuallyGot = ''
1579 , expectedThrown = name !== null
1580 ? name
1581 : desiredError
1582 ? '#{exp}' //_.inspect(desiredError)
1583 : 'an error';
1584
1585 if (thrown) {
1586 actuallyGot = ' but #{act} was thrown'
1587 }
1588
1589 this.assert(
1590 thrown === true
1591 , 'expected #{this} to throw ' + expectedThrown + actuallyGot
1592 , 'expected #{this} to not throw ' + expectedThrown + actuallyGot
1593 , desiredError
1594 , thrownError
1595 );
1596 };
1597
1598 Assertion.addMethod('throw', assertThrows);
1599 Assertion.addMethod('throws', assertThrows);
1600 Assertion.addMethod('Throw', assertThrows);
1601
1602 /**
1603 * ### .respondTo(method)
1604 *
1605 * Asserts that the object or class target will respond to a method.
1606 *
1607 * Klass.prototype.bar = function(){};
1608 * expect(Klass).to.respondTo('bar');
1609 * expect(obj).to.respondTo('bar');
1610 *
1611 * To check if a constructor will respond to a static function,
1612 * set the `itself` flag.
1613 *
1614 * Klass.baz = function(){};
1615 * expect(Klass).itself.to.respondTo('baz');
1616 *
1617 * @name respondTo
1618 * @param {String} method
1619 * @param {String} message _optional_
1620 * @api public
1621 */
1622
1623 Assertion.addMethod('respondTo', function (method, msg) {
1624 if (msg) flag(this, 'message', msg);
1625 var obj = flag(this, 'object')
1626 , itself = flag(this, 'itself')
1627 , context = ('function' === _.type(obj) && !itself)
1628 ? obj.prototype[method]
1629 : obj[method];
1630
1631 this.assert(
1632 'function' === typeof context
1633 , 'expected #{this} to respond to ' + _.inspect(method)
1634 , 'expected #{this} to not respond to ' + _.inspect(method)
1635 );
1636 });
1637
1638 /**
1639 * ### .itself
1640 *
1641 * Sets the `itself` flag, later used by the `respondTo` assertion.
1642 *
1643 * function Foo() {}
1644 * Foo.bar = function() {}
1645 * Foo.prototype.baz = function() {}
1646 *
1647 * expect(Foo).itself.to.respondTo('bar');
1648 * expect(Foo).itself.not.to.respondTo('baz');
1649 *
1650 * @name itself
1651 * @api public
1652 */
1653
1654 Assertion.addProperty('itself', function () {
1655 flag(this, 'itself', true);
1656 });
1657
1658 /**
1659 * ### .satisfy(method)
1660 *
1661 * Asserts that the target passes a given truth test.
1662 *
1663 * expect(1).to.satisfy(function(num) { return num > 0; });
1664 *
1665 * @name satisfy
1666 * @param {Function} matcher
1667 * @param {String} message _optional_
1668 * @api public
1669 */
1670
1671 Assertion.addMethod('satisfy', function (matcher, msg) {
1672 if (msg) flag(this, 'message', msg);
1673 var obj = flag(this, 'object');
1674 this.assert(
1675 matcher(obj)
1676 , 'expected #{this} to satisfy ' + _.objDisplay(matcher)
1677 , 'expected #{this} to not satisfy' + _.objDisplay(matcher)
1678 , this.negate ? false : true
1679 , matcher(obj)
1680 );
1681 });
1682
1683 /**
1684 * ### .closeTo(expected, delta)
1685 *
1686 * Asserts that the target is equal `expected`, to within a +/- `delta` range.
1687 *
1688 * expect(1.5).to.be.closeTo(1, 0.5);
1689 *
1690 * @name closeTo
1691 * @param {Number} expected
1692 * @param {Number} delta
1693 * @param {String} message _optional_
1694 * @api public
1695 */
1696
1697 Assertion.addMethod('closeTo', function (expected, delta, msg) {
1698 if (msg) flag(this, 'message', msg);
1699 var obj = flag(this, 'object');
1700 this.assert(
1701 Math.abs(obj - expected) <= delta
1702 , 'expected #{this} to be close to ' + expected + ' +/- ' + delta
1703 , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta
1704 );
1705 });
1706
1707 function isSubsetOf(subset, superset) {
1708 return subset.every(function(elem) {
1709 return superset.indexOf(elem) !== -1;
1710 })
1711 }
1712
1713 /**
1714 * ### .members
1715 *
1716 * Asserts that the target is a superset of `set`,
1717 * or that the target and `set` have the same members.
1718 *
1719 * expect([1, 2, 3]).to.include.members([3, 2]);
1720 * expect([1, 2, 3]).to.not.include.members([3, 2, 8]);
1721 *
1722 * expect([4, 2]).to.have.members([2, 4]);
1723 * expect([5, 2]).to.not.have.members([5, 2, 1]);
1724 *
1725 * @name members
1726 * @param {Array} set
1727 * @param {String} message _optional_
1728 * @api public
1729 */
1730
1731 Assertion.addMethod('members', function (subset, msg) {
1732 if (msg) flag(this, 'message', msg);
1733 var obj = flag(this, 'object');
1734
1735 new Assertion(obj).to.be.an('array');
1736 new Assertion(subset).to.be.an('array');
1737
1738 if (flag(this, 'contains')) {
1739 return this.assert(
1740 isSubsetOf(subset, obj)
1741 , 'expected #{this} to be a superset of #{act}'
1742 , 'expected #{this} to not be a superset of #{act}'
1743 , obj
1744 , subset
1745 );
1746 }
1747
1748 this.assert(
1749 isSubsetOf(obj, subset) && isSubsetOf(subset, obj)
1750 , 'expected #{this} to have the same members as #{act}'
1751 , 'expected #{this} to not have the same members as #{act}'
1752 , obj
1753 , subset
1754 );
1755 });
1756 };
1757
1758 });
1759 require.register("chai/lib/chai/interface/assert.js", function(exports, require, module){
1760 /*!
1761 * chai
1762 * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
1763 * MIT Licensed
1764 */
1765
1766
1767 module.exports = function (chai, util) {
1768
1769 /*!
1770 * Chai dependencies.
1771 */
1772
1773 var Assertion = chai.Assertion
1774 , flag = util.flag;
1775
1776 /*!
1777 * Module export.
1778 */
1779
1780 /**
1781 * ### assert(expression, message)
1782 *
1783 * Write your own test expressions.
1784 *
1785 * assert('foo' !== 'bar', 'foo is not bar');
1786 * assert(Array.isArray([]), 'empty arrays are arrays');
1787 *
1788 * @param {Mixed} expression to test for truthiness
1789 * @param {String} message to display on error
1790 * @name assert
1791 * @api public
1792 */
1793
1794 var assert = chai.assert = function (express, errmsg) {
1795 var test = new Assertion(null);
1796 test.assert(
1797 express
1798 , errmsg
1799 , '[ negation message unavailable ]'
1800 );
1801 };
1802
1803 /**
1804 * ### .fail(actual, expected, [message], [operator])
1805 *
1806 * Throw a failure. Node.js `assert` module-compatible.
1807 *
1808 * @name fail
1809 * @param {Mixed} actual
1810 * @param {Mixed} expected
1811 * @param {String} message
1812 * @param {String} operator
1813 * @api public
1814 */
1815
1816 assert.fail = function (actual, expected, message, operator) {
1817 throw new chai.AssertionError({
1818 actual: actual
1819 , expected: expected
1820 , message: message
1821 , operator: operator
1822 , stackStartFunction: assert.fail
1823 });
1824 };
1825
1826 /**
1827 * ### .ok(object, [message])
1828 *
1829 * Asserts that `object` is truthy.
1830 *
1831 * assert.ok('everything', 'everything is ok');
1832 * assert.ok(false, 'this will fail');
1833 *
1834 * @name ok
1835 * @param {Mixed} object to test
1836 * @param {String} message
1837 * @api public
1838 */
1839
1840 assert.ok = function (val, msg) {
1841 new Assertion(val, msg).is.ok;
1842 };
1843
1844 /**
1845 * ### .equal(actual, expected, [message])
1846 *
1847 * Asserts non-strict equality (`==`) of `actual` and `expected`.
1848 *
1849 * assert.equal(3, '3', '== coerces values to strings');
1850 *
1851 * @name equal
1852 * @param {Mixed} actual
1853 * @param {Mixed} expected
1854 * @param {String} message
1855 * @api public
1856 */
1857
1858 assert.equal = function (act, exp, msg) {
1859 var test = new Assertion(act, msg);
1860
1861 test.assert(
1862 exp == flag(test, 'object')
1863 , 'expected #{this} to equal #{exp}'
1864 , 'expected #{this} to not equal #{act}'
1865 , exp
1866 , act
1867 );
1868 };
1869
1870 /**
1871 * ### .notEqual(actual, expected, [message])
1872 *
1873 * Asserts non-strict inequality (`!=`) of `actual` and `expected`.
1874 *
1875 * assert.notEqual(3, 4, 'these numbers are not equal');
1876 *
1877 * @name notEqual
1878 * @param {Mixed} actual
1879 * @param {Mixed} expected
1880 * @param {String} message
1881 * @api public
1882 */
1883
1884 assert.notEqual = function (act, exp, msg) {
1885 var test = new Assertion(act, msg);
1886
1887 test.assert(
1888 exp != flag(test, 'object')
1889 , 'expected #{this} to not equal #{exp}'
1890 , 'expected #{this} to equal #{act}'
1891 , exp
1892 , act
1893 );
1894 };
1895
1896 /**
1897 * ### .strictEqual(actual, expected, [message])
1898 *
1899 * Asserts strict equality (`===`) of `actual` and `expected`.
1900 *
1901 * assert.strictEqual(true, true, 'these booleans are strictly equal');
1902 *
1903 * @name strictEqual
1904 * @param {Mixed} actual
1905 * @param {Mixed} expected
1906 * @param {String} message
1907 * @api public
1908 */
1909
1910 assert.strictEqual = function (act, exp, msg) {
1911 new Assertion(act, msg).to.equal(exp);
1912 };
1913
1914 /**
1915 * ### .notStrictEqual(actual, expected, [message])
1916 *
1917 * Asserts strict inequality (`!==`) of `actual` and `expected`.
1918 *
1919 * assert.notStrictEqual(3, '3', 'no coercion for strict equality');
1920 *
1921 * @name notStrictEqual
1922 * @param {Mixed} actual
1923 * @param {Mixed} expected
1924 * @param {String} message
1925 * @api public
1926 */
1927
1928 assert.notStrictEqual = function (act, exp, msg) {
1929 new Assertion(act, msg).to.not.equal(exp);
1930 };
1931
1932 /**
1933 * ### .deepEqual(actual, expected, [message])
1934 *
1935 * Asserts that `actual` is deeply equal to `expected`.
1936 *
1937 * assert.deepEqual({ tea: 'green' }, { tea: 'green' });
1938 *
1939 * @name deepEqual
1940 * @param {Mixed} actual
1941 * @param {Mixed} expected
1942 * @param {String} message
1943 * @api public
1944 */
1945
1946 assert.deepEqual = function (act, exp, msg) {
1947 new Assertion(act, msg).to.eql(exp);
1948 };
1949
1950 /**
1951 * ### .notDeepEqual(actual, expected, [message])
1952 *
1953 * Assert that `actual` is not deeply equal to `expected`.
1954 *
1955 * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' });
1956 *
1957 * @name notDeepEqual
1958 * @param {Mixed} actual
1959 * @param {Mixed} expected
1960 * @param {String} message
1961 * @api public
1962 */
1963
1964 assert.notDeepEqual = function (act, exp, msg) {
1965 new Assertion(act, msg).to.not.eql(exp);
1966 };
1967
1968 /**
1969 * ### .isTrue(value, [message])
1970 *
1971 * Asserts that `value` is true.
1972 *
1973 * var teaServed = true;
1974 * assert.isTrue(teaServed, 'the tea has been served');
1975 *
1976 * @name isTrue
1977 * @param {Mixed} value
1978 * @param {String} message
1979 * @api public
1980 */
1981
1982 assert.isTrue = function (val, msg) {
1983 new Assertion(val, msg).is['true'];
1984 };
1985
1986 /**
1987 * ### .isFalse(value, [message])
1988 *
1989 * Asserts that `value` is false.
1990 *
1991 * var teaServed = false;
1992 * assert.isFalse(teaServed, 'no tea yet? hmm...');
1993 *
1994 * @name isFalse
1995 * @param {Mixed} value
1996 * @param {String} message
1997 * @api public
1998 */
1999
2000 assert.isFalse = function (val, msg) {
2001 new Assertion(val, msg).is['false'];
2002 };
2003
2004 /**
2005 * ### .isNull(value, [message])
2006 *
2007 * Asserts that `value` is null.
2008 *
2009 * assert.isNull(err, 'there was no error');
2010 *
2011 * @name isNull
2012 * @param {Mixed} value
2013 * @param {String} message
2014 * @api public
2015 */
2016
2017 assert.isNull = function (val, msg) {
2018 new Assertion(val, msg).to.equal(null);
2019 };
2020
2021 /**
2022 * ### .isNotNull(value, [message])
2023 *
2024 * Asserts that `value` is not null.
2025 *
2026 * var tea = 'tasty chai';
2027 * assert.isNotNull(tea, 'great, time for tea!');
2028 *
2029 * @name isNotNull
2030 * @param {Mixed} value
2031 * @param {String} message
2032 * @api public
2033 */
2034
2035 assert.isNotNull = function (val, msg) {
2036 new Assertion(val, msg).to.not.equal(null);
2037 };
2038
2039 /**
2040 * ### .isUndefined(value, [message])
2041 *
2042 * Asserts that `value` is `undefined`.
2043 *
2044 * var tea;
2045 * assert.isUndefined(tea, 'no tea defined');
2046 *
2047 * @name isUndefined
2048 * @param {Mixed} value
2049 * @param {String} message
2050 * @api public
2051 */
2052
2053 assert.isUndefined = function (val, msg) {
2054 new Assertion(val, msg).to.equal(undefined);
2055 };
2056
2057 /**
2058 * ### .isDefined(value, [message])
2059 *
2060 * Asserts that `value` is not `undefined`.
2061 *
2062 * var tea = 'cup of chai';
2063 * assert.isDefined(tea, 'tea has been defined');
2064 *
2065 * @name isDefined
2066 * @param {Mixed} value
2067 * @param {String} message
2068 * @api public
2069 */
2070
2071 assert.isDefined = function (val, msg) {
2072 new Assertion(val, msg).to.not.equal(undefined);
2073 };
2074
2075 /**
2076 * ### .isFunction(value, [message])
2077 *
2078 * Asserts that `value` is a function.
2079 *
2080 * function serveTea() { return 'cup of tea'; };
2081 * assert.isFunction(serveTea, 'great, we can have tea now');
2082 *
2083 * @name isFunction
2084 * @param {Mixed} value
2085 * @param {String} message
2086 * @api public
2087 */
2088
2089 assert.isFunction = function (val, msg) {
2090 new Assertion(val, msg).to.be.a('function');
2091 };
2092
2093 /**
2094 * ### .isNotFunction(value, [message])
2095 *
2096 * Asserts that `value` is _not_ a function.
2097 *
2098 * var serveTea = [ 'heat', 'pour', 'sip' ];
2099 * assert.isNotFunction(serveTea, 'great, we have listed the steps');
2100 *
2101 * @name isNotFunction
2102 * @param {Mixed} value
2103 * @param {String} message
2104 * @api public
2105 */
2106
2107 assert.isNotFunction = function (val, msg) {
2108 new Assertion(val, msg).to.not.be.a('function');
2109 };
2110
2111 /**
2112 * ### .isObject(value, [message])
2113 *
2114 * Asserts that `value` is an object (as revealed by
2115 * `Object.prototype.toString`).
2116 *
2117 * var selection = { name: 'Chai', serve: 'with spices' };
2118 * assert.isObject(selection, 'tea selection is an object');
2119 *
2120 * @name isObject
2121 * @param {Mixed} value
2122 * @param {String} message
2123 * @api public
2124 */
2125
2126 assert.isObject = function (val, msg) {
2127 new Assertion(val, msg).to.be.a('object');
2128 };
2129
2130 /**
2131 * ### .isNotObject(value, [message])
2132 *
2133 * Asserts that `value` is _not_ an object.
2134 *
2135 * var selection = 'chai'
2136 * assert.isObject(selection, 'tea selection is not an object');
2137 * assert.isObject(null, 'null is not an object');
2138 *
2139 * @name isNotObject
2140 * @param {Mixed} value
2141 * @param {String} message
2142 * @api public
2143 */
2144
2145 assert.isNotObject = function (val, msg) {
2146 new Assertion(val, msg).to.not.be.a('object');
2147 };
2148
2149 /**
2150 * ### .isArray(value, [message])
2151 *
2152 * Asserts that `value` is an array.
2153 *
2154 * var menu = [ 'green', 'chai', 'oolong' ];
2155 * assert.isArray(menu, 'what kind of tea do we want?');
2156 *
2157 * @name isArray
2158 * @param {Mixed} value
2159 * @param {String} message
2160 * @api public
2161 */
2162
2163 assert.isArray = function (val, msg) {
2164 new Assertion(val, msg).to.be.an('array');
2165 };
2166
2167 /**
2168 * ### .isNotArray(value, [message])
2169 *
2170 * Asserts that `value` is _not_ an array.
2171 *
2172 * var menu = 'green|chai|oolong';
2173 * assert.isNotArray(menu, 'what kind of tea do we want?');
2174 *
2175 * @name isNotArray
2176 * @param {Mixed} value
2177 * @param {String} message
2178 * @api public
2179 */
2180
2181 assert.isNotArray = function (val, msg) {
2182 new Assertion(val, msg).to.not.be.an('array');
2183 };
2184
2185 /**
2186 * ### .isString(value, [message])
2187 *
2188 * Asserts that `value` is a string.
2189 *
2190 * var teaOrder = 'chai';
2191 * assert.isString(teaOrder, 'order placed');
2192 *
2193 * @name isString
2194 * @param {Mixed} value
2195 * @param {String} message
2196 * @api public
2197 */
2198
2199 assert.isString = function (val, msg) {
2200 new Assertion(val, msg).to.be.a('string');
2201 };
2202
2203 /**
2204 * ### .isNotString(value, [message])
2205 *
2206 * Asserts that `value` is _not_ a string.
2207 *
2208 * var teaOrder = 4;
2209 * assert.isNotString(teaOrder, 'order placed');
2210 *
2211 * @name isNotString
2212 * @param {Mixed} value
2213 * @param {String} message
2214 * @api public
2215 */
2216
2217 assert.isNotString = function (val, msg) {
2218 new Assertion(val, msg).to.not.be.a('string');
2219 };
2220
2221 /**
2222 * ### .isNumber(value, [message])
2223 *
2224 * Asserts that `value` is a number.
2225 *
2226 * var cups = 2;
2227 * assert.isNumber(cups, 'how many cups');
2228 *
2229 * @name isNumber
2230 * @param {Number} value
2231 * @param {String} message
2232 * @api public
2233 */
2234
2235 assert.isNumber = function (val, msg) {
2236 new Assertion(val, msg).to.be.a('number');
2237 };
2238
2239 /**
2240 * ### .isNotNumber(value, [message])
2241 *
2242 * Asserts that `value` is _not_ a number.
2243 *
2244 * var cups = '2 cups please';
2245 * assert.isNotNumber(cups, 'how many cups');
2246 *
2247 * @name isNotNumber
2248 * @param {Mixed} value
2249 * @param {String} message
2250 * @api public
2251 */
2252
2253 assert.isNotNumber = function (val, msg) {
2254 new Assertion(val, msg).to.not.be.a('number');
2255 };
2256
2257 /**
2258 * ### .isBoolean(value, [message])
2259 *
2260 * Asserts that `value` is a boolean.
2261 *
2262 * var teaReady = true
2263 * , teaServed = false;
2264 *
2265 * assert.isBoolean(teaReady, 'is the tea ready');
2266 * assert.isBoolean(teaServed, 'has tea been served');
2267 *
2268 * @name isBoolean
2269 * @param {Mixed} value
2270 * @param {String} message
2271 * @api public
2272 */
2273
2274 assert.isBoolean = function (val, msg) {
2275 new Assertion(val, msg).to.be.a('boolean');
2276 };
2277
2278 /**
2279 * ### .isNotBoolean(value, [message])
2280 *
2281 * Asserts that `value` is _not_ a boolean.
2282 *
2283 * var teaReady = 'yep'
2284 * , teaServed = 'nope';
2285 *
2286 * assert.isNotBoolean(teaReady, 'is the tea ready');
2287 * assert.isNotBoolean(teaServed, 'has tea been served');
2288 *
2289 * @name isNotBoolean
2290 * @param {Mixed} value
2291 * @param {String} message
2292 * @api public
2293 */
2294
2295 assert.isNotBoolean = function (val, msg) {
2296 new Assertion(val, msg).to.not.be.a('boolean');
2297 };
2298
2299 /**
2300 * ### .typeOf(value, name, [message])
2301 *
2302 * Asserts that `value`'s type is `name`, as determined by
2303 * `Object.prototype.toString`.
2304 *
2305 * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object');
2306 * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array');
2307 * assert.typeOf('tea', 'string', 'we have a string');
2308 * assert.typeOf(/tea/, 'regexp', 'we have a regular expression');
2309 * assert.typeOf(null, 'null', 'we have a null');
2310 * assert.typeOf(undefined, 'undefined', 'we have an undefined');
2311 *
2312 * @name typeOf
2313 * @param {Mixed} value
2314 * @param {String} name
2315 * @param {String} message
2316 * @api public
2317 */
2318
2319 assert.typeOf = function (val, type, msg) {
2320 new Assertion(val, msg).to.be.a(type);
2321 };
2322
2323 /**
2324 * ### .notTypeOf(value, name, [message])
2325 *
2326 * Asserts that `value`'s type is _not_ `name`, as determined by
2327 * `Object.prototype.toString`.
2328 *
2329 * assert.notTypeOf('tea', 'number', 'strings are not numbers');
2330 *
2331 * @name notTypeOf
2332 * @param {Mixed} value
2333 * @param {String} typeof name
2334 * @param {String} message
2335 * @api public
2336 */
2337
2338 assert.notTypeOf = function (val, type, msg) {
2339 new Assertion(val, msg).to.not.be.a(type);
2340 };
2341
2342 /**
2343 * ### .instanceOf(object, constructor, [message])
2344 *
2345 * Asserts that `value` is an instance of `constructor`.
2346 *
2347 * var Tea = function (name) { this.name = name; }
2348 * , chai = new Tea('chai');
2349 *
2350 * assert.instanceOf(chai, Tea, 'chai is an instance of tea');
2351 *
2352 * @name instanceOf
2353 * @param {Object} object
2354 * @param {Constructor} constructor
2355 * @param {String} message
2356 * @api public
2357 */
2358
2359 assert.instanceOf = function (val, type, msg) {
2360 new Assertion(val, msg).to.be.instanceOf(type);
2361 };
2362
2363 /**
2364 * ### .notInstanceOf(object, constructor, [message])
2365 *
2366 * Asserts `value` is not an instance of `constructor`.
2367 *
2368 * var Tea = function (name) { this.name = name; }
2369 * , chai = new String('chai');
2370 *
2371 * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea');
2372 *
2373 * @name notInstanceOf
2374 * @param {Object} object
2375 * @param {Constructor} constructor
2376 * @param {String} message
2377 * @api public
2378 */
2379
2380 assert.notInstanceOf = function (val, type, msg) {
2381 new Assertion(val, msg).to.not.be.instanceOf(type);
2382 };
2383
2384 /**
2385 * ### .include(haystack, needle, [message])
2386 *
2387 * Asserts that `haystack` includes `needle`. Works
2388 * for strings and arrays.
2389 *
2390 * assert.include('foobar', 'bar', 'foobar contains string "bar"');
2391 * assert.include([ 1, 2, 3 ], 3, 'array contains value');
2392 *
2393 * @name include
2394 * @param {Array|String} haystack
2395 * @param {Mixed} needle
2396 * @param {String} message
2397 * @api public
2398 */
2399
2400 assert.include = function (exp, inc, msg) {
2401 var obj = new Assertion(exp, msg);
2402
2403 if (Array.isArray(exp)) {
2404 obj.to.include(inc);
2405 } else if ('string' === typeof exp) {
2406 obj.to.contain.string(inc);
2407 } else {
2408 throw new chai.AssertionError({
2409 message: 'expected an array or string'
2410 , stackStartFunction: assert.include
2411 });
2412 }
2413 };
2414
2415 /**
2416 * ### .notInclude(haystack, needle, [message])
2417 *
2418 * Asserts that `haystack` does not include `needle`. Works
2419 * for strings and arrays.
2420 *i
2421 * assert.notInclude('foobar', 'baz', 'string not include substring');
2422 * assert.notInclude([ 1, 2, 3 ], 4, 'array not include contain value');
2423 *
2424 * @name notInclude
2425 * @param {Array|String} haystack
2426 * @param {Mixed} needle
2427 * @param {String} message
2428 * @api public
2429 */
2430
2431 assert.notInclude = function (exp, inc, msg) {
2432 var obj = new Assertion(exp, msg);
2433
2434 if (Array.isArray(exp)) {
2435 obj.to.not.include(inc);
2436 } else if ('string' === typeof exp) {
2437 obj.to.not.contain.string(inc);
2438 } else {
2439 throw new chai.AssertionError({
2440 message: 'expected an array or string'
2441 , stackStartFunction: assert.include
2442 });
2443 }
2444 };
2445
2446 /**
2447 * ### .match(value, regexp, [message])
2448 *
2449 * Asserts that `value` matches the regular expression `regexp`.
2450 *
2451 * assert.match('foobar', /^foo/, 'regexp matches');
2452 *
2453 * @name match
2454 * @param {Mixed} value
2455 * @param {RegExp} regexp
2456 * @param {String} message
2457 * @api public
2458 */
2459
2460 assert.match = function (exp, re, msg) {
2461 new Assertion(exp, msg).to.match(re);
2462 };
2463
2464 /**
2465 * ### .notMatch(value, regexp, [message])
2466 *
2467 * Asserts that `value` does not match the regular expression `regexp`.
2468 *
2469 * assert.notMatch('foobar', /^foo/, 'regexp does not match');
2470 *
2471 * @name notMatch
2472 * @param {Mixed} value
2473 * @param {RegExp} regexp
2474 * @param {String} message
2475 * @api public
2476 */
2477
2478 assert.notMatch = function (exp, re, msg) {
2479 new Assertion(exp, msg).to.not.match(re);
2480 };
2481
2482 /**
2483 * ### .property(object, property, [message])
2484 *
2485 * Asserts that `object` has a property named by `property`.
2486 *
2487 * assert.property({ tea: { green: 'matcha' }}, 'tea');
2488 *
2489 * @name property
2490 * @param {Object} object
2491 * @param {String} property
2492 * @param {String} message
2493 * @api public
2494 */
2495
2496 assert.property = function (obj, prop, msg) {
2497 new Assertion(obj, msg).to.have.property(prop);
2498 };
2499
2500 /**
2501 * ### .notProperty(object, property, [message])
2502 *
2503 * Asserts that `object` does _not_ have a property named by `property`.
2504 *
2505 * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee');
2506 *
2507 * @name notProperty
2508 * @param {Object} object
2509 * @param {String} property
2510 * @param {String} message
2511 * @api public
2512 */
2513
2514 assert.notProperty = function (obj, prop, msg) {
2515 new Assertion(obj, msg).to.not.have.property(prop);
2516 };
2517
2518 /**
2519 * ### .deepProperty(object, property, [message])
2520 *
2521 * Asserts that `object` has a property named by `property`, which can be a
2522 * string using dot- and bracket-notation for deep reference.
2523 *
2524 * assert.deepProperty({ tea: { green: 'matcha' }}, 'tea.green');
2525 *
2526 * @name deepProperty
2527 * @param {Object} object
2528 * @param {String} property
2529 * @param {String} message
2530 * @api public
2531 */
2532
2533 assert.deepProperty = function (obj, prop, msg) {
2534 new Assertion(obj, msg).to.have.deep.property(prop);
2535 };
2536
2537 /**
2538 * ### .notDeepProperty(object, property, [message])
2539 *
2540 * Asserts that `object` does _not_ have a property named by `property`, which
2541 * can be a string using dot- and bracket-notation for deep reference.
2542 *
2543 * assert.notDeepProperty({ tea: { green: 'matcha' }}, 'tea.oolong');
2544 *
2545 * @name notDeepProperty
2546 * @param {Object} object
2547 * @param {String} property
2548 * @param {String} message
2549 * @api public
2550 */
2551
2552 assert.notDeepProperty = function (obj, prop, msg) {
2553 new Assertion(obj, msg).to.not.have.deep.property(prop);
2554 };
2555
2556 /**
2557 * ### .propertyVal(object, property, value, [message])
2558 *
2559 * Asserts that `object` has a property named by `property` with value given
2560 * by `value`.
2561 *
2562 * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good');
2563 *
2564 * @name propertyVal
2565 * @param {Object} object
2566 * @param {String} property
2567 * @param {Mixed} value
2568 * @param {String} message
2569 * @api public
2570 */
2571
2572 assert.propertyVal = function (obj, prop, val, msg) {
2573 new Assertion(obj, msg).to.have.property(prop, val);
2574 };
2575
2576 /**
2577 * ### .propertyNotVal(object, property, value, [message])
2578 *
2579 * Asserts that `object` has a property named by `property`, but with a value
2580 * different from that given by `value`.
2581 *
2582 * assert.propertyNotVal({ tea: 'is good' }, 'tea', 'is bad');
2583 *
2584 * @name propertyNotVal
2585 * @param {Object} object
2586 * @param {String} property
2587 * @param {Mixed} value
2588 * @param {String} message
2589 * @api public
2590 */
2591
2592 assert.propertyNotVal = function (obj, prop, val, msg) {
2593 new Assertion(obj, msg).to.not.have.property(prop, val);
2594 };
2595
2596 /**
2597 * ### .deepPropertyVal(object, property, value, [message])
2598 *
2599 * Asserts that `object` has a property named by `property` with value given
2600 * by `value`. `property` can use dot- and bracket-notation for deep
2601 * reference.
2602 *
2603 * assert.deepPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha');
2604 *
2605 * @name deepPropertyVal
2606 * @param {Object} object
2607 * @param {String} property
2608 * @param {Mixed} value
2609 * @param {String} message
2610 * @api public
2611 */
2612
2613 assert.deepPropertyVal = function (obj, prop, val, msg) {
2614 new Assertion(obj, msg).to.have.deep.property(prop, val);
2615 };
2616
2617 /**
2618 * ### .deepPropertyNotVal(object, property, value, [message])
2619 *
2620 * Asserts that `object` has a property named by `property`, but with a value
2621 * different from that given by `value`. `property` can use dot- and
2622 * bracket-notation for deep reference.
2623 *
2624 * assert.deepPropertyNotVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha');
2625 *
2626 * @name deepPropertyNotVal
2627 * @param {Object} object
2628 * @param {String} property
2629 * @param {Mixed} value
2630 * @param {String} message
2631 * @api public
2632 */
2633
2634 assert.deepPropertyNotVal = function (obj, prop, val, msg) {
2635 new Assertion(obj, msg).to.not.have.deep.property(prop, val);
2636 };
2637
2638 /**
2639 * ### .lengthOf(object, length, [message])
2640 *
2641 * Asserts that `object` has a `length` property with the expected value.
2642 *
2643 * assert.lengthOf([1,2,3], 3, 'array has length of 3');
2644 * assert.lengthOf('foobar', 5, 'string has length of 6');
2645 *
2646 * @name lengthOf
2647 * @param {Mixed} object
2648 * @param {Number} length
2649 * @param {String} message
2650 * @api public
2651 */
2652
2653 assert.lengthOf = function (exp, len, msg) {
2654 new Assertion(exp, msg).to.have.length(len);
2655 };
2656
2657 /**
2658 * ### .throws(function, [constructor/string/regexp], [string/regexp], [message])
2659 *
2660 * Asserts that `function` will throw an error that is an instance of
2661 * `constructor`, or alternately that it will throw an error with message
2662 * matching `regexp`.
2663 *
2664 * assert.throw(fn, 'function throws a reference error');
2665 * assert.throw(fn, /function throws a reference error/);
2666 * assert.throw(fn, ReferenceError);
2667 * assert.throw(fn, ReferenceError, 'function throws a reference error');
2668 * assert.throw(fn, ReferenceError, /function throws a reference error/);
2669 *
2670 * @name throws
2671 * @alias throw
2672 * @alias Throw
2673 * @param {Function} function
2674 * @param {ErrorConstructor} constructor
2675 * @param {RegExp} regexp
2676 * @param {String} message
2677 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
2678 * @api public
2679 */
2680
2681 assert.Throw = function (fn, errt, errs, msg) {
2682 if ('string' === typeof errt || errt instanceof RegExp) {
2683 errs = errt;
2684 errt = null;
2685 }
2686
2687 new Assertion(fn, msg).to.Throw(errt, errs);
2688 };
2689
2690 /**
2691 * ### .doesNotThrow(function, [constructor/regexp], [message])
2692 *
2693 * Asserts that `function` will _not_ throw an error that is an instance of
2694 * `constructor`, or alternately that it will not throw an error with message
2695 * matching `regexp`.
2696 *
2697 * assert.doesNotThrow(fn, Error, 'function does not throw');
2698 *
2699 * @name doesNotThrow
2700 * @param {Function} function
2701 * @param {ErrorConstructor} constructor
2702 * @param {RegExp} regexp
2703 * @param {String} message
2704 * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
2705 * @api public
2706 */
2707
2708 assert.doesNotThrow = function (fn, type, msg) {
2709 if ('string' === typeof type) {
2710 msg = type;
2711 type = null;
2712 }
2713
2714 new Assertion(fn, msg).to.not.Throw(type);
2715 };
2716
2717 /**
2718 * ### .operator(val1, operator, val2, [message])
2719 *
2720 * Compares two values using `operator`.
2721 *
2722 * assert.operator(1, '<', 2, 'everything is ok');
2723 * assert.operator(1, '>', 2, 'this will fail');
2724 *
2725 * @name operator
2726 * @param {Mixed} val1
2727 * @param {String} operator
2728 * @param {Mixed} val2
2729 * @param {String} message
2730 * @api public
2731 */
2732
2733 assert.operator = function (val, operator, val2, msg) {
2734 if (!~['==', '===', '>', '>=', '<', '<=', '!=', '!=='].indexOf(operator)) {
2735 throw new Error('Invalid operator "' + operator + '"');
2736 }
2737 var test = new Assertion(eval(val + operator + val2), msg);
2738 test.assert(
2739 true === flag(test, 'object')
2740 , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2)
2741 , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) );
2742 };
2743
2744 /**
2745 * ### .closeTo(actual, expected, delta, [message])
2746 *
2747 * Asserts that the target is equal `expected`, to within a +/- `delta` range.
2748 *
2749 * assert.closeTo(1.5, 1, 0.5, 'numbers are close');
2750 *
2751 * @name closeTo
2752 * @param {Number} actual
2753 * @param {Number} expected
2754 * @param {Number} delta
2755 * @param {String} message
2756 * @api public
2757 */
2758
2759 assert.closeTo = function (act, exp, delta, msg) {
2760 new Assertion(act, msg).to.be.closeTo(exp, delta);
2761 };
2762
2763 /**
2764 * ### .sameMembers(set1, set2, [message])
2765 *
2766 * Asserts that `set1` and `set2` have the same members.
2767 * Order is not taken into account.
2768 *
2769 * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');
2770 *
2771 * @name sameMembers
2772 * @param {Array} superset
2773 * @param {Array} subset
2774 * @param {String} message
2775 * @api public
2776 */
2777
2778 assert.sameMembers = function (set1, set2, msg) {
2779 new Assertion(set1, msg).to.have.same.members(set2);
2780 }
2781
2782 /**
2783 * ### .includeMembers(superset, subset, [message])
2784 *
2785 * Asserts that `subset` is included in `superset`.
2786 * Order is not taken into account.
2787 *
2788 * assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members');
2789 *
2790 * @name includeMembers
2791 * @param {Array} superset
2792 * @param {Array} subset
2793 * @param {String} message
2794 * @api public
2795 */
2796
2797 assert.includeMembers = function (superset, subset, msg) {
2798 new Assertion(superset, msg).to.include.members(subset);
2799 }
2800
2801 /*!
2802 * Undocumented / untested
2803 */
2804
2805 assert.ifError = function (val, msg) {
2806 new Assertion(val, msg).to.not.be.ok;
2807 };
2808
2809 /*!
2810 * Aliases.
2811 */
2812
2813 (function alias(name, as){
2814 assert[as] = assert[name];
2815 return alias;
2816 })
2817 ('Throw', 'throw')
2818 ('Throw', 'throws');
2819 };
2820
2821 });
2822 require.register("chai/lib/chai/interface/expect.js", function(exports, require, module){
2823 /*!
2824 * chai
2825 * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
2826 * MIT Licensed
2827 */
2828
2829 module.exports = function (chai, util) {
2830 chai.expect = function (val, message) {
2831 return new chai.Assertion(val, message);
2832 };
2833 };
2834
2835
2836 });
2837 require.register("chai/lib/chai/interface/should.js", function(exports, require, module){
2838 /*!
2839 * chai
2840 * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
2841 * MIT Licensed
2842 */
2843
2844 module.exports = function (chai, util) {
2845 var Assertion = chai.Assertion;
2846
2847 function loadShould () {
2848 // modify Object.prototype to have `should`
2849 Object.defineProperty(Object.prototype, 'should',
2850 {
2851 set: function (value) {
2852 // See https://github.com/chaijs/chai/issues/86: this makes
2853 // `whatever.should = someValue` actually set `someValue`, which is
2854 // especially useful for `global.should = require('chai').should()`.
2855 //
2856 // Note that we have to use [[DefineProperty]] instead of [[Put]]
2857 // since otherwise we would trigger this very setter!
2858 Object.defineProperty(this, 'should', {
2859 value: value,
2860 enumerable: true,
2861 configurable: true,
2862 writable: true
2863 });
2864 }
2865 , get: function(){
2866 if (this instanceof String || this instanceof Number) {
2867 return new Assertion(this.constructor(this));
2868 } else if (this instanceof Boolean) {
2869 return new Assertion(this == true);
2870 }
2871 return new Assertion(this);
2872 }
2873 , configurable: true
2874 });
2875
2876 var should = {};
2877
2878 should.equal = function (val1, val2, msg) {
2879 new Assertion(val1, msg).to.equal(val2);
2880 };
2881
2882 should.Throw = function (fn, errt, errs, msg) {
2883 new Assertion(fn, msg).to.Throw(errt, errs);
2884 };
2885
2886 should.exist = function (val, msg) {
2887 new Assertion(val, msg).to.exist;
2888 }
2889
2890 // negation
2891 should.not = {}
2892
2893 should.not.equal = function (val1, val2, msg) {
2894 new Assertion(val1, msg).to.not.equal(val2);
2895 };
2896
2897 should.not.Throw = function (fn, errt, errs, msg) {
2898 new Assertion(fn, msg).to.not.Throw(errt, errs);
2899 };
2900
2901 should.not.exist = function (val, msg) {
2902 new Assertion(val, msg).to.not.exist;
2903 }
2904
2905 should['throw'] = should['Throw'];
2906 should.not['throw'] = should.not['Throw'];
2907
2908 return should;
2909 };
2910
2911 chai.should = loadShould;
2912 chai.Should = loadShould;
2913 };
2914
2915 });
2916 require.register("chai/lib/chai/utils/addChainableMethod.js", function(exports, require, module){
2917 /*!
2918 * Chai - addChainingMethod utility
2919 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
2920 * MIT Licensed
2921 */
2922
2923 /*!
2924 * Module dependencies
2925 */
2926
2927 var transferFlags = require('./transferFlags');
2928
2929 /*!
2930 * Module variables
2931 */
2932
2933 // Check whether `__proto__` is supported
2934 var hasProtoSupport = '__proto__' in Object;
2935
2936 // Without `__proto__` support, this module will need to add properties to a function.
2937 // However, some Function.prototype methods cannot be overwritten,
2938 // and there seems no easy cross-platform way to detect them (@see chaijs/chai/issues/69).
2939 var excludeNames = /^(?:length|name|arguments|caller)$/;
2940
2941 // Cache `Function` properties
2942 var call = Function.prototype.call,
2943 apply = Function.prototype.apply;
2944
2945 /**
2946 * ### addChainableMethod (ctx, name, method, chainingBehavior)
2947 *
2948 * Adds a method to an object, such that the method can also be chained.
2949 *
2950 * utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) {
2951 * var obj = utils.flag(this, 'object');
2952 * new chai.Assertion(obj).to.be.equal(str);
2953 * });
2954 *
2955 * Can also be accessed directly from `chai.Assertion`.
2956 *
2957 * chai.Assertion.addChainableMethod('foo', fn, chainingBehavior);
2958 *
2959 * The result can then be used as both a method assertion, executing both `method` and
2960 * `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`.
2961 *
2962 * expect(fooStr).to.be.foo('bar');
2963 * expect(fooStr).to.be.foo.equal('foo');
2964 *
2965 * @param {Object} ctx object to which the method is added
2966 * @param {String} name of method to add
2967 * @param {Function} method function to be used for `name`, when called
2968 * @param {Function} chainingBehavior function to be called every time the property is accessed
2969 * @name addChainableMethod
2970 * @api public
2971 */
2972
2973 module.exports = function (ctx, name, method, chainingBehavior) {
2974 if (typeof chainingBehavior !== 'function')
2975 chainingBehavior = function () { };
2976
2977 Object.defineProperty(ctx, name,
2978 { get: function () {
2979 chainingBehavior.call(this);
2980
2981 var assert = function () {
2982 var result = method.apply(this, arguments);
2983 return result === undefined ? this : result;
2984 };
2985
2986 // Use `__proto__` if available
2987 if (hasProtoSupport) {
2988 // Inherit all properties from the object by replacing the `Function` prototype
2989 var prototype = assert.__proto__ = Object.create(this);
2990 // Restore the `call` and `apply` methods from `Function`
2991 prototype.call = call;
2992 prototype.apply = apply;
2993 }
2994 // Otherwise, redefine all properties (slow!)
2995 else {
2996 var asserterNames = Object.getOwnPropertyNames(ctx);
2997 asserterNames.forEach(function (asserterName) {
2998 if (!excludeNames.test(asserterName)) {
2999 var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
3000 Object.defineProperty(assert, asserterName, pd);
3001 }
3002 });
3003 }
3004
3005 transferFlags(this, assert);
3006 return assert;
3007 }
3008 , configurable: true
3009 });
3010 };
3011
3012 });
3013 require.register("chai/lib/chai/utils/addMethod.js", function(exports, require, module){
3014 /*!
3015 * Chai - addMethod utility
3016 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3017 * MIT Licensed
3018 */
3019
3020 /**
3021 * ### .addMethod (ctx, name, method)
3022 *
3023 * Adds a method to the prototype of an object.
3024 *
3025 * utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {
3026 * var obj = utils.flag(this, 'object');
3027 * new chai.Assertion(obj).to.be.equal(str);
3028 * });
3029 *
3030 * Can also be accessed directly from `chai.Assertion`.
3031 *
3032 * chai.Assertion.addMethod('foo', fn);
3033 *
3034 * Then can be used as any other assertion.
3035 *
3036 * expect(fooStr).to.be.foo('bar');
3037 *
3038 * @param {Object} ctx object to which the method is added
3039 * @param {String} name of method to add
3040 * @param {Function} method function to be used for name
3041 * @name addMethod
3042 * @api public
3043 */
3044
3045 module.exports = function (ctx, name, method) {
3046 ctx[name] = function () {
3047 var result = method.apply(this, arguments);
3048 return result === undefined ? this : result;
3049 };
3050 };
3051
3052 });
3053 require.register("chai/lib/chai/utils/addProperty.js", function(exports, require, module){
3054 /*!
3055 * Chai - addProperty utility
3056 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3057 * MIT Licensed
3058 */
3059
3060 /**
3061 * ### addProperty (ctx, name, getter)
3062 *
3063 * Adds a property to the prototype of an object.
3064 *
3065 * utils.addProperty(chai.Assertion.prototype, 'foo', function () {
3066 * var obj = utils.flag(this, 'object');
3067 * new chai.Assertion(obj).to.be.instanceof(Foo);
3068 * });
3069 *
3070 * Can also be accessed directly from `chai.Assertion`.
3071 *
3072 * chai.Assertion.addProperty('foo', fn);
3073 *
3074 * Then can be used as any other assertion.
3075 *
3076 * expect(myFoo).to.be.foo;
3077 *
3078 * @param {Object} ctx object to which the property is added
3079 * @param {String} name of property to add
3080 * @param {Function} getter function to be used for name
3081 * @name addProperty
3082 * @api public
3083 */
3084
3085 module.exports = function (ctx, name, getter) {
3086 Object.defineProperty(ctx, name,
3087 { get: function () {
3088 var result = getter.call(this);
3089 return result === undefined ? this : result;
3090 }
3091 , configurable: true
3092 });
3093 };
3094
3095 });
3096 require.register("chai/lib/chai/utils/eql.js", function(exports, require, module){
3097 // This is (almost) directly from Node.js assert
3098 // https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/assert.js
3099
3100 module.exports = _deepEqual;
3101
3102 var getEnumerableProperties = require('./getEnumerableProperties');
3103
3104 // for the browser
3105 var Buffer;
3106 try {
3107 Buffer = require('buffer').Buffer;
3108 } catch (ex) {
3109 Buffer = {
3110 isBuffer: function () { return false; }
3111 };
3112 }
3113
3114 function _deepEqual(actual, expected, memos) {
3115
3116 // 7.1. All identical values are equivalent, as determined by ===.
3117 if (actual === expected) {
3118 return true;
3119
3120 } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
3121 if (actual.length != expected.length) return false;
3122
3123 for (var i = 0; i < actual.length; i++) {
3124 if (actual[i] !== expected[i]) return false;
3125 }
3126
3127 return true;
3128
3129 // 7.2. If the expected value is a Date object, the actual value is
3130 // equivalent if it is also a Date object that refers to the same time.
3131 } else if (actual instanceof Date && expected instanceof Date) {
3132 return actual.getTime() === expected.getTime();
3133
3134 // 7.3. Other pairs that do not both pass typeof value == 'object',
3135 // equivalence is determined by ==.
3136 } else if (typeof actual != 'object' && typeof expected != 'object') {
3137 return actual === expected;
3138
3139 } else if (actual instanceof RegExp && expected instanceof RegExp){
3140 return actual.toString() === expected.toString();
3141
3142 // 7.4. For all other Object pairs, including Array objects, equivalence is
3143 // determined by having the same number of owned properties (as verified
3144 // with Object.prototype.hasOwnProperty.call), the same set of keys
3145 // (although not necessarily the same order), equivalent values for every
3146 // corresponding key, and an identical 'prototype' property. Note: this
3147 // accounts for both named and indexed properties on Arrays.
3148 } else {
3149 return objEquiv(actual, expected, memos);
3150 }
3151 }
3152
3153 function isUndefinedOrNull(value) {
3154 return value === null || value === undefined;
3155 }
3156
3157 function isArguments(object) {
3158 return Object.prototype.toString.call(object) == '[object Arguments]';
3159 }
3160
3161 function objEquiv(a, b, memos) {
3162 if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
3163 return false;
3164
3165 // an identical 'prototype' property.
3166 if (a.prototype !== b.prototype) return false;
3167
3168 // check if we have already compared a and b
3169 var i;
3170 if (memos) {
3171 for(i = 0; i < memos.length; i++) {
3172 if ((memos[i][0] === a && memos[i][1] === b) ||
3173 (memos[i][0] === b && memos[i][1] === a))
3174 return true;
3175 }
3176 } else {
3177 memos = [];
3178 }
3179
3180 //~~~I've managed to break Object.keys through screwy arguments passing.
3181 // Converting to array solves the problem.
3182 if (isArguments(a)) {
3183 if (!isArguments(b)) {
3184 return false;
3185 }
3186 a = pSlice.call(a);
3187 b = pSlice.call(b);
3188 return _deepEqual(a, b, memos);
3189 }
3190 try {
3191 var ka = getEnumerableProperties(a),
3192 kb = getEnumerableProperties(b),
3193 key;
3194 } catch (e) {//happens when one is a string literal and the other isn't
3195 return false;
3196 }
3197
3198 // having the same number of owned properties (keys incorporates
3199 // hasOwnProperty)
3200 if (ka.length != kb.length)
3201 return false;
3202
3203 //the same set of keys (although not necessarily the same order),
3204 ka.sort();
3205 kb.sort();
3206 //~~~cheap key test
3207 for (i = ka.length - 1; i >= 0; i--) {
3208 if (ka[i] != kb[i])
3209 return false;
3210 }
3211
3212 // remember objects we have compared to guard against circular references
3213 memos.push([ a, b ]);
3214
3215 //equivalent values for every corresponding key, and
3216 //~~~possibly expensive deep test
3217 for (i = ka.length - 1; i >= 0; i--) {
3218 key = ka[i];
3219 if (!_deepEqual(a[key], b[key], memos)) return false;
3220 }
3221
3222 return true;
3223 }
3224
3225 });
3226 require.register("chai/lib/chai/utils/flag.js", function(exports, require, module){
3227 /*!
3228 * Chai - flag utility
3229 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3230 * MIT Licensed
3231 */
3232
3233 /**
3234 * ### flag(object ,key, [value])
3235 *
3236 * Get or set a flag value on an object. If a
3237 * value is provided it will be set, else it will
3238 * return the currently set value or `undefined` if
3239 * the value is not set.
3240 *
3241 * utils.flag(this, 'foo', 'bar'); // setter
3242 * utils.flag(this, 'foo'); // getter, returns `bar`
3243 *
3244 * @param {Object} object (constructed Assertion
3245 * @param {String} key
3246 * @param {Mixed} value (optional)
3247 * @name flag
3248 * @api private
3249 */
3250
3251 module.exports = function (obj, key, value) {
3252 var flags = obj.__flags || (obj.__flags = Object.create(null));
3253 if (arguments.length === 3) {
3254 flags[key] = value;
3255 } else {
3256 return flags[key];
3257 }
3258 };
3259
3260 });
3261 require.register("chai/lib/chai/utils/getActual.js", function(exports, require, module){
3262 /*!
3263 * Chai - getActual utility
3264 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3265 * MIT Licensed
3266 */
3267
3268 /**
3269 * # getActual(object, [actual])
3270 *
3271 * Returns the `actual` value for an Assertion
3272 *
3273 * @param {Object} object (constructed Assertion)
3274 * @param {Arguments} chai.Assertion.prototype.assert arguments
3275 */
3276
3277 module.exports = function (obj, args) {
3278 var actual = args[4];
3279 return 'undefined' !== typeof actual ? actual : obj._obj;
3280 };
3281
3282 });
3283 require.register("chai/lib/chai/utils/getEnumerableProperties.js", function(exports, require, module){
3284 /*!
3285 * Chai - getEnumerableProperties utility
3286 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3287 * MIT Licensed
3288 */
3289
3290 /**
3291 * ### .getEnumerableProperties(object)
3292 *
3293 * This allows the retrieval of enumerable property names of an object,
3294 * inherited or not.
3295 *
3296 * @param {Object} object
3297 * @returns {Array}
3298 * @name getEnumerableProperties
3299 * @api public
3300 */
3301
3302 module.exports = function getEnumerableProperties(object) {
3303 var result = [];
3304 for (var name in object) {
3305 result.push(name);
3306 }
3307 return result;
3308 };
3309
3310 });
3311 require.register("chai/lib/chai/utils/getMessage.js", function(exports, require, module){
3312 /*!
3313 * Chai - message composition utility
3314 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3315 * MIT Licensed
3316 */
3317
3318 /*!
3319 * Module dependancies
3320 */
3321
3322 var flag = require('./flag')
3323 , getActual = require('./getActual')
3324 , inspect = require('./inspect')
3325 , objDisplay = require('./objDisplay');
3326
3327 /**
3328 * ### .getMessage(object, message, negateMessage)
3329 *
3330 * Construct the error message based on flags
3331 * and template tags. Template tags will return
3332 * a stringified inspection of the object referenced.
3333 *
3334 * Messsage template tags:
3335 * - `#{this}` current asserted object
3336 * - `#{act}` actual value
3337 * - `#{exp}` expected value
3338 *
3339 * @param {Object} object (constructed Assertion)
3340 * @param {Arguments} chai.Assertion.prototype.assert arguments
3341 * @name getMessage
3342 * @api public
3343 */
3344
3345 module.exports = function (obj, args) {
3346 var negate = flag(obj, 'negate')
3347 , val = flag(obj, 'object')
3348 , expected = args[3]
3349 , actual = getActual(obj, args)
3350 , msg = negate ? args[2] : args[1]
3351 , flagMsg = flag(obj, 'message');
3352
3353 msg = msg || '';
3354 msg = msg
3355 .replace(/#{this}/g, objDisplay(val))
3356 .replace(/#{act}/g, objDisplay(actual))
3357 .replace(/#{exp}/g, objDisplay(expected));
3358
3359 return flagMsg ? flagMsg + ': ' + msg : msg;
3360 };
3361
3362 });
3363 require.register("chai/lib/chai/utils/getName.js", function(exports, require, module){
3364 /*!
3365 * Chai - getName utility
3366 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3367 * MIT Licensed
3368 */
3369
3370 /**
3371 * # getName(func)
3372 *
3373 * Gets the name of a function, in a cross-browser way.
3374 *
3375 * @param {Function} a function (usually a constructor)
3376 */
3377
3378 module.exports = function (func) {
3379 if (func.name) return func.name;
3380
3381 var match = /^\s?function ([^(]*)\(/.exec(func);
3382 return match && match[1] ? match[1] : "";
3383 };
3384
3385 });
3386 require.register("chai/lib/chai/utils/getPathValue.js", function(exports, require, module){
3387 /*!
3388 * Chai - getPathValue utility
3389 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3390 * @see https://github.com/logicalparadox/filtr
3391 * MIT Licensed
3392 */
3393
3394 /**
3395 * ### .getPathValue(path, object)
3396 *
3397 * This allows the retrieval of values in an
3398 * object given a string path.
3399 *
3400 * var obj = {
3401 * prop1: {
3402 * arr: ['a', 'b', 'c']
3403 * , str: 'Hello'
3404 * }
3405 * , prop2: {
3406 * arr: [ { nested: 'Universe' } ]
3407 * , str: 'Hello again!'
3408 * }
3409 * }
3410 *
3411 * The following would be the results.
3412 *
3413 * getPathValue('prop1.str', obj); // Hello
3414 * getPathValue('prop1.att[2]', obj); // b
3415 * getPathValue('prop2.arr[0].nested', obj); // Universe
3416 *
3417 * @param {String} path
3418 * @param {Object} object
3419 * @returns {Object} value or `undefined`
3420 * @name getPathValue
3421 * @api public
3422 */
3423
3424 var getPathValue = module.exports = function (path, obj) {
3425 var parsed = parsePath(path);
3426 return _getPathValue(parsed, obj);
3427 };
3428
3429 /*!
3430 * ## parsePath(path)
3431 *
3432 * Helper function used to parse string object
3433 * paths. Use in conjunction with `_getPathValue`.
3434 *
3435 * var parsed = parsePath('myobject.property.subprop');
3436 *
3437 * ### Paths:
3438 *
3439 * * Can be as near infinitely deep and nested
3440 * * Arrays are also valid using the formal `myobject.document[3].property`.
3441 *
3442 * @param {String} path
3443 * @returns {Object} parsed
3444 * @api private
3445 */
3446
3447 function parsePath (path) {
3448 var str = path.replace(/\[/g, '.[')
3449 , parts = str.match(/(\\\.|[^.]+?)+/g);
3450 return parts.map(function (value) {
3451 var re = /\[(\d+)\]$/
3452 , mArr = re.exec(value)
3453 if (mArr) return { i: parseFloat(mArr[1]) };
3454 else return { p: value };
3455 });
3456 };
3457
3458 /*!
3459 * ## _getPathValue(parsed, obj)
3460 *
3461 * Helper companion function for `.parsePath` that returns
3462 * the value located at the parsed address.
3463 *
3464 * var value = getPathValue(parsed, obj);
3465 *
3466 * @param {Object} parsed definition from `parsePath`.
3467 * @param {Object} object to search against
3468 * @returns {Object|Undefined} value
3469 * @api private
3470 */
3471
3472 function _getPathValue (parsed, obj) {
3473 var tmp = obj
3474 , res;
3475 for (var i = 0, l = parsed.length; i < l; i++) {
3476 var part = parsed[i];
3477 if (tmp) {
3478 if ('undefined' !== typeof part.p)
3479 tmp = tmp[part.p];
3480 else if ('undefined' !== typeof part.i)
3481 tmp = tmp[part.i];
3482 if (i == (l - 1)) res = tmp;
3483 } else {
3484 res = undefined;
3485 }
3486 }
3487 return res;
3488 };
3489
3490 });
3491 require.register("chai/lib/chai/utils/getProperties.js", function(exports, require, module){
3492 /*!
3493 * Chai - getProperties utility
3494 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3495 * MIT Licensed
3496 */
3497
3498 /**
3499 * ### .getProperties(object)
3500 *
3501 * This allows the retrieval of property names of an object, enumerable or not,
3502 * inherited or not.
3503 *
3504 * @param {Object} object
3505 * @returns {Array}
3506 * @name getProperties
3507 * @api public
3508 */
3509
3510 module.exports = function getProperties(object) {
3511 var result = Object.getOwnPropertyNames(subject);
3512
3513 function addProperty(property) {
3514 if (result.indexOf(property) === -1) {
3515 result.push(property);
3516 }
3517 }
3518
3519 var proto = Object.getPrototypeOf(subject);
3520 while (proto !== null) {
3521 Object.getOwnPropertyNames(proto).forEach(addProperty);
3522 proto = Object.getPrototypeOf(proto);
3523 }
3524
3525 return result;
3526 };
3527
3528 });
3529 require.register("chai/lib/chai/utils/index.js", function(exports, require, module){
3530 /*!
3531 * chai
3532 * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
3533 * MIT Licensed
3534 */
3535
3536 /*!
3537 * Main exports
3538 */
3539
3540 var exports = module.exports = {};
3541
3542 /*!
3543 * test utility
3544 */
3545
3546 exports.test = require('./test');
3547
3548 /*!
3549 * type utility
3550 */
3551
3552 exports.type = require('./type');
3553
3554 /*!
3555 * message utility
3556 */
3557
3558 exports.getMessage = require('./getMessage');
3559
3560 /*!
3561 * actual utility
3562 */
3563
3564 exports.getActual = require('./getActual');
3565
3566 /*!
3567 * Inspect util
3568 */
3569
3570 exports.inspect = require('./inspect');
3571
3572 /*!
3573 * Object Display util
3574 */
3575
3576 exports.objDisplay = require('./objDisplay');
3577
3578 /*!
3579 * Flag utility
3580 */
3581
3582 exports.flag = require('./flag');
3583
3584 /*!
3585 * Flag transferring utility
3586 */
3587
3588 exports.transferFlags = require('./transferFlags');
3589
3590 /*!
3591 * Deep equal utility
3592 */
3593
3594 exports.eql = require('./eql');
3595
3596 /*!
3597 * Deep path value
3598 */
3599
3600 exports.getPathValue = require('./getPathValue');
3601
3602 /*!
3603 * Function name
3604 */
3605
3606 exports.getName = require('./getName');
3607
3608 /*!
3609 * add Property
3610 */
3611
3612 exports.addProperty = require('./addProperty');
3613
3614 /*!
3615 * add Method
3616 */
3617
3618 exports.addMethod = require('./addMethod');
3619
3620 /*!
3621 * overwrite Property
3622 */
3623
3624 exports.overwriteProperty = require('./overwriteProperty');
3625
3626 /*!
3627 * overwrite Method
3628 */
3629
3630 exports.overwriteMethod = require('./overwriteMethod');
3631
3632 /*!
3633 * Add a chainable method
3634 */
3635
3636 exports.addChainableMethod = require('./addChainableMethod');
3637
3638
3639 });
3640 require.register("chai/lib/chai/utils/inspect.js", function(exports, require, module){
3641 // This is (almost) directly from Node.js utils
3642 // https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
3643
3644 var getName = require('./getName');
3645 var getProperties = require('./getProperties');
3646 var getEnumerableProperties = require('./getEnumerableProperties');
3647
3648 module.exports = inspect;
3649
3650 /**
3651 * Echos the value of a value. Trys to print the value out
3652 * in the best way possible given the different types.
3653 *
3654 * @param {Object} obj The object to print out.
3655 * @param {Boolean} showHidden Flag that shows hidden (not enumerable)
3656 * properties of objects.
3657 * @param {Number} depth Depth in which to descend in object. Default is 2.
3658 * @param {Boolean} colors Flag to turn on ANSI escape codes to color the
3659 * output. Default is false (no coloring).
3660 */
3661 function inspect(obj, showHidden, depth, colors) {
3662 var ctx = {
3663 showHidden: showHidden,
3664 seen: [],
3665 stylize: function (str) { return str; }
3666 };
3667 return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth));
3668 }
3669
3670 // https://gist.github.com/1044128/
3671 var getOuterHTML = function(element) {
3672 if ('outerHTML' in element) return element.outerHTML;
3673 var ns = "http://www.w3.org/1999/xhtml";
3674 var container = document.createElementNS(ns, '_');
3675 var elemProto = (window.HTMLElement || window.Element).prototype;
3676 var xmlSerializer = new XMLSerializer();
3677 var html;
3678 if (document.xmlVersion) {
3679 return xmlSerializer.serializeToString(element);
3680 } else {
3681 container.appendChild(element.cloneNode(false));
3682 html = container.innerHTML.replace('><', '>' + element.innerHTML + '<');
3683 container.innerHTML = '';
3684 return html;
3685 }
3686 };
3687
3688 // Returns true if object is a DOM element.
3689 var isDOMElement = function (object) {
3690 if (typeof HTMLElement === 'object') {
3691 return object instanceof HTMLElement;
3692 } else {
3693 return object &&
3694 typeof object === 'object' &&
3695 object.nodeType === 1 &&
3696 typeof object.nodeName === 'string';
3697 }
3698 };
3699
3700 function formatValue(ctx, value, recurseTimes) {
3701 // Provide a hook for user-specified inspect functions.
3702 // Check that value is an object with an inspect function on it
3703 if (value && typeof value.inspect === 'function' &&
3704 // Filter out the util module, it's inspect function is special
3705 value.inspect !== exports.inspect &&
3706 // Also filter out any prototype objects using the circular check.
3707 !(value.constructor && value.constructor.prototype === value)) {
3708 return value.inspect(recurseTimes);
3709 }
3710
3711 // Primitive types cannot have properties
3712 var primitive = formatPrimitive(ctx, value);
3713 if (primitive) {
3714 return primitive;
3715 }
3716
3717 // If it's DOM elem, get outer HTML.
3718 if (isDOMElement(value)) {
3719 return getOuterHTML(value);
3720 }
3721
3722 // Look up the keys of the object.
3723 var visibleKeys = getEnumerableProperties(value);
3724 var keys = ctx.showHidden ? getProperties(value) : visibleKeys;
3725
3726 // Some type of object without properties can be shortcutted.
3727 // In IE, errors have a single `stack` property, or if they are vanilla `Error`,
3728 // a `stack` plus `description` property; ignore those for consistency.
3729 if (keys.length === 0 || (isError(value) && (
3730 (keys.length === 1 && keys[0] === 'stack') ||
3731 (keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack')
3732 ))) {
3733 if (typeof value === 'function') {
3734 var name = getName(value);
3735 var nameSuffix = name ? ': ' + name : '';
3736 return ctx.stylize('[Function' + nameSuffix + ']', 'special');
3737 }
3738 if (isRegExp(value)) {
3739 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
3740 }
3741 if (isDate(value)) {
3742 return ctx.stylize(Date.prototype.toUTCString.call(value), 'date');
3743 }
3744 if (isError(value)) {
3745 return formatError(value);
3746 }
3747 }
3748
3749 var base = '', array = false, braces = ['{', '}'];
3750
3751 // Make Array say that they are Array
3752 if (isArray(value)) {
3753 array = true;
3754 braces = ['[', ']'];
3755 }
3756
3757 // Make functions say that they are functions
3758 if (typeof value === 'function') {
3759 var name = getName(value);
3760 var nameSuffix = name ? ': ' + name : '';
3761 base = ' [Function' + nameSuffix + ']';
3762 }
3763
3764 // Make RegExps say that they are RegExps
3765 if (isRegExp(value)) {
3766 base = ' ' + RegExp.prototype.toString.call(value);
3767 }
3768
3769 // Make dates with properties first say the date
3770 if (isDate(value)) {
3771 base = ' ' + Date.prototype.toUTCString.call(value);
3772 }
3773
3774 // Make error with message first say the error
3775 if (isError(value)) {
3776 return formatError(value);
3777 }
3778
3779 if (keys.length === 0 && (!array || value.length == 0)) {
3780 return braces[0] + base + braces[1];
3781 }
3782
3783 if (recurseTimes < 0) {
3784 if (isRegExp(value)) {
3785 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
3786 } else {
3787 return ctx.stylize('[Object]', 'special');
3788 }
3789 }
3790
3791 ctx.seen.push(value);
3792
3793 var output;
3794 if (array) {
3795 output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
3796 } else {
3797 output = keys.map(function(key) {
3798 return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
3799 });
3800 }
3801
3802 ctx.seen.pop();
3803
3804 return reduceToSingleString(output, base, braces);
3805 }
3806
3807
3808 function formatPrimitive(ctx, value) {
3809 switch (typeof value) {
3810 case 'undefined':
3811 return ctx.stylize('undefined', 'undefined');
3812
3813 case 'string':
3814 var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
3815 .replace(/'/g, "\\'")
3816 .replace(/\\"/g, '"') + '\'';
3817 return ctx.stylize(simple, 'string');
3818
3819 case 'number':
3820 return ctx.stylize('' + value, 'number');
3821
3822 case 'boolean':
3823 return ctx.stylize('' + value, 'boolean');
3824 }
3825 // For some reason typeof null is "object", so special case here.
3826 if (value === null) {
3827 return ctx.stylize('null', 'null');
3828 }
3829 }
3830
3831
3832 function formatError(value) {
3833 return '[' + Error.prototype.toString.call(value) + ']';
3834 }
3835
3836
3837 function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
3838 var output = [];
3839 for (var i = 0, l = value.length; i < l; ++i) {
3840 if (Object.prototype.hasOwnProperty.call(value, String(i))) {
3841 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
3842 String(i), true));
3843 } else {
3844 output.push('');
3845 }
3846 }
3847 keys.forEach(function(key) {
3848 if (!key.match(/^\d+$/)) {
3849 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
3850 key, true));
3851 }
3852 });
3853 return output;
3854 }
3855
3856
3857 function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
3858 var name, str;
3859 if (value.__lookupGetter__) {
3860 if (value.__lookupGetter__(key)) {
3861 if (value.__lookupSetter__(key)) {
3862 str = ctx.stylize('[Getter/Setter]', 'special');
3863 } else {
3864 str = ctx.stylize('[Getter]', 'special');
3865 }
3866 } else {
3867 if (value.__lookupSetter__(key)) {
3868 str = ctx.stylize('[Setter]', 'special');
3869 }
3870 }
3871 }
3872 if (visibleKeys.indexOf(key) < 0) {
3873 name = '[' + key + ']';
3874 }
3875 if (!str) {
3876 if (ctx.seen.indexOf(value[key]) < 0) {
3877 if (recurseTimes === null) {
3878 str = formatValue(ctx, value[key], null);
3879 } else {
3880 str = formatValue(ctx, value[key], recurseTimes - 1);
3881 }
3882 if (str.indexOf('\n') > -1) {
3883 if (array) {
3884 str = str.split('\n').map(function(line) {
3885 return ' ' + line;
3886 }).join('\n').substr(2);
3887 } else {
3888 str = '\n' + str.split('\n').map(function(line) {
3889 return ' ' + line;
3890 }).join('\n');
3891 }
3892 }
3893 } else {
3894 str = ctx.stylize('[Circular]', 'special');
3895 }
3896 }
3897 if (typeof name === 'undefined') {
3898 if (array && key.match(/^\d+$/)) {
3899 return str;
3900 }
3901 name = JSON.stringify('' + key);
3902 if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
3903 name = name.substr(1, name.length - 2);
3904 name = ctx.stylize(name, 'name');
3905 } else {
3906 name = name.replace(/'/g, "\\'")
3907 .replace(/\\"/g, '"')
3908 .replace(/(^"|"$)/g, "'");
3909 name = ctx.stylize(name, 'string');
3910 }
3911 }
3912
3913 return name + ': ' + str;
3914 }
3915
3916
3917 function reduceToSingleString(output, base, braces) {
3918 var numLinesEst = 0;
3919 var length = output.reduce(function(prev, cur) {
3920 numLinesEst++;
3921 if (cur.indexOf('\n') >= 0) numLinesEst++;
3922 return prev + cur.length + 1;
3923 }, 0);
3924
3925 if (length > 60) {
3926 return braces[0] +
3927 (base === '' ? '' : base + '\n ') +
3928 ' ' +
3929 output.join(',\n ') +
3930 ' ' +
3931 braces[1];
3932 }
3933
3934 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
3935 }
3936
3937 function isArray(ar) {
3938 return Array.isArray(ar) ||
3939 (typeof ar === 'object' && objectToString(ar) === '[object Array]');
3940 }
3941
3942 function isRegExp(re) {
3943 return typeof re === 'object' && objectToString(re) === '[object RegExp]';
3944 }
3945
3946 function isDate(d) {
3947 return typeof d === 'object' && objectToString(d) === '[object Date]';
3948 }
3949
3950 function isError(e) {
3951 return typeof e === 'object' && objectToString(e) === '[object Error]';
3952 }
3953
3954 function objectToString(o) {
3955 return Object.prototype.toString.call(o);
3956 }
3957
3958 });
3959 require.register("chai/lib/chai/utils/objDisplay.js", function(exports, require, module){
3960 /*!
3961 * Chai - flag utility
3962 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
3963 * MIT Licensed
3964 */
3965
3966 /*!
3967 * Module dependancies
3968 */
3969
3970 var inspect = require('./inspect');
3971
3972 /**
3973 * ### .objDisplay (object)
3974 *
3975 * Determines if an object or an array matches
3976 * criteria to be inspected in-line for error
3977 * messages or should be truncated.
3978 *
3979 * @param {Mixed} javascript object to inspect
3980 * @name objDisplay
3981 * @api public
3982 */
3983
3984 module.exports = function (obj) {
3985 var str = inspect(obj)
3986 , type = Object.prototype.toString.call(obj);
3987
3988 if (str.length >= 40) {
3989 if (type === '[object Function]') {
3990 return !obj.name || obj.name === ''
3991 ? '[Function]'
3992 : '[Function: ' + obj.name + ']';
3993 } else if (type === '[object Array]') {
3994 return '[ Array(' + obj.length + ') ]';
3995 } else if (type === '[object Object]') {
3996 var keys = Object.keys(obj)
3997 , kstr = keys.length > 2
3998 ? keys.splice(0, 2).join(', ') + ', ...'
3999 : keys.join(', ');
4000 return '{ Object (' + kstr + ') }';
4001 } else {
4002 return str;
4003 }
4004 } else {
4005 return str;
4006 }
4007 };
4008
4009 });
4010 require.register("chai/lib/chai/utils/overwriteMethod.js", function(exports, require, module){
4011 /*!
4012 * Chai - overwriteMethod utility
4013 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4014 * MIT Licensed
4015 */
4016
4017 /**
4018 * ### overwriteMethod (ctx, name, fn)
4019 *
4020 * Overwites an already existing method and provides
4021 * access to previous function. Must return function
4022 * to be used for name.
4023 *
4024 * utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) {
4025 * return function (str) {
4026 * var obj = utils.flag(this, 'object');
4027 * if (obj instanceof Foo) {
4028 * new chai.Assertion(obj.value).to.equal(str);
4029 * } else {
4030 * _super.apply(this, arguments);
4031 * }
4032 * }
4033 * });
4034 *
4035 * Can also be accessed directly from `chai.Assertion`.
4036 *
4037 * chai.Assertion.overwriteMethod('foo', fn);
4038 *
4039 * Then can be used as any other assertion.
4040 *
4041 * expect(myFoo).to.equal('bar');
4042 *
4043 * @param {Object} ctx object whose method is to be overwritten
4044 * @param {String} name of method to overwrite
4045 * @param {Function} method function that returns a function to be used for name
4046 * @name overwriteMethod
4047 * @api public
4048 */
4049
4050 module.exports = function (ctx, name, method) {
4051 var _method = ctx[name]
4052 , _super = function () { return this; };
4053
4054 if (_method && 'function' === typeof _method)
4055 _super = _method;
4056
4057 ctx[name] = function () {
4058 var result = method(_super).apply(this, arguments);
4059 return result === undefined ? this : result;
4060 }
4061 };
4062
4063 });
4064 require.register("chai/lib/chai/utils/overwriteProperty.js", function(exports, require, module){
4065 /*!
4066 * Chai - overwriteProperty utility
4067 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4068 * MIT Licensed
4069 */
4070
4071 /**
4072 * ### overwriteProperty (ctx, name, fn)
4073 *
4074 * Overwites an already existing property getter and provides
4075 * access to previous value. Must return function to use as getter.
4076 *
4077 * utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) {
4078 * return function () {
4079 * var obj = utils.flag(this, 'object');
4080 * if (obj instanceof Foo) {
4081 * new chai.Assertion(obj.name).to.equal('bar');
4082 * } else {
4083 * _super.call(this);
4084 * }
4085 * }
4086 * });
4087 *
4088 *
4089 * Can also be accessed directly from `chai.Assertion`.
4090 *
4091 * chai.Assertion.overwriteProperty('foo', fn);
4092 *
4093 * Then can be used as any other assertion.
4094 *
4095 * expect(myFoo).to.be.ok;
4096 *
4097 * @param {Object} ctx object whose property is to be overwritten
4098 * @param {String} name of property to overwrite
4099 * @param {Function} getter function that returns a getter function to be used for name
4100 * @name overwriteProperty
4101 * @api public
4102 */
4103
4104 module.exports = function (ctx, name, getter) {
4105 var _get = Object.getOwnPropertyDescriptor(ctx, name)
4106 , _super = function () {};
4107
4108 if (_get && 'function' === typeof _get.get)
4109 _super = _get.get
4110
4111 Object.defineProperty(ctx, name,
4112 { get: function () {
4113 var result = getter(_super).call(this);
4114 return result === undefined ? this : result;
4115 }
4116 , configurable: true
4117 });
4118 };
4119
4120 });
4121 require.register("chai/lib/chai/utils/test.js", function(exports, require, module){
4122 /*!
4123 * Chai - test utility
4124 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4125 * MIT Licensed
4126 */
4127
4128 /*!
4129 * Module dependancies
4130 */
4131
4132 var flag = require('./flag');
4133
4134 /**
4135 * # test(object, expression)
4136 *
4137 * Test and object for expression.
4138 *
4139 * @param {Object} object (constructed Assertion)
4140 * @param {Arguments} chai.Assertion.prototype.assert arguments
4141 */
4142
4143 module.exports = function (obj, args) {
4144 var negate = flag(obj, 'negate')
4145 , expr = args[0];
4146 return negate ? !expr : expr;
4147 };
4148
4149 });
4150 require.register("chai/lib/chai/utils/transferFlags.js", function(exports, require, module){
4151 /*!
4152 * Chai - transferFlags utility
4153 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4154 * MIT Licensed
4155 */
4156
4157 /**
4158 * ### transferFlags(assertion, object, includeAll = true)
4159 *
4160 * Transfer all the flags for `assertion` to `object`. If
4161 * `includeAll` is set to `false`, then the base Chai
4162 * assertion flags (namely `object`, `ssfi`, and `message`)
4163 * will not be transferred.
4164 *
4165 *
4166 * var newAssertion = new Assertion();
4167 * utils.transferFlags(assertion, newAssertion);
4168 *
4169 * var anotherAsseriton = new Assertion(myObj);
4170 * utils.transferFlags(assertion, anotherAssertion, false);
4171 *
4172 * @param {Assertion} assertion the assertion to transfer the flags from
4173 * @param {Object} object the object to transfer the flags too; usually a new assertion
4174 * @param {Boolean} includeAll
4175 * @name getAllFlags
4176 * @api private
4177 */
4178
4179 module.exports = function (assertion, object, includeAll) {
4180 var flags = assertion.__flags || (assertion.__flags = Object.create(null));
4181
4182 if (!object.__flags) {
4183 object.__flags = Object.create(null);
4184 }
4185
4186 includeAll = arguments.length === 3 ? includeAll : true;
4187
4188 for (var flag in flags) {
4189 if (includeAll ||
4190 (flag !== 'object' && flag !== 'ssfi' && flag != 'message')) {
4191 object.__flags[flag] = flags[flag];
4192 }
4193 }
4194 };
4195
4196 });
4197 require.register("chai/lib/chai/utils/type.js", function(exports, require, module){
4198 /*!
4199 * Chai - type utility
4200 * Copyright(c) 2012-2013 Jake Luer <jake@alogicalparadox.com>
4201 * MIT Licensed
4202 */
4203
4204 /*!
4205 * Detectable javascript natives
4206 */
4207
4208 var natives = {
4209 '[object Arguments]': 'arguments'
4210 , '[object Array]': 'array'
4211 , '[object Date]': 'date'
4212 , '[object Function]': 'function'
4213 , '[object Number]': 'number'
4214 , '[object RegExp]': 'regexp'
4215 , '[object String]': 'string'
4216 };
4217
4218 /**
4219 * ### type(object)
4220 *
4221 * Better implementation of `typeof` detection that can
4222 * be used cross-browser. Handles the inconsistencies of
4223 * Array, `null`, and `undefined` detection.
4224 *
4225 * utils.type({}) // 'object'
4226 * utils.type(null) // `null'
4227 * utils.type(undefined) // `undefined`
4228 * utils.type([]) // `array`
4229 *
4230 * @param {Mixed} object to detect type of
4231 * @name type
4232 * @api private
4233 */
4234
4235 module.exports = function (obj) {
4236 var str = Object.prototype.toString.call(obj);
4237 if (natives[str]) return natives[str];
4238 if (obj === null) return 'null';
4239 if (obj === undefined) return 'undefined';
4240 if (obj === Object(obj)) return 'object';
4241 return typeof obj;
4242 };
4243
4244 });
4245 require.alias("chai/index.js", "chai/index.js");
4246
4247 if (typeof exports == "object") {
4248 module.exports = require("chai");
4249 } else if (typeof define == "function" && define.amd) {
4250 define(function(){ return require("chai"); });
4251 } else {
4252 this["chai"] = require("chai");
4253 }})();
+0
-250
test/deps/mocha.css less more
0 @charset "utf-8";
1
2 body {
3 margin:0;
4 }
5
6 #mocha {
7 font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
8 margin: 60px 50px;
9 }
10
11 #mocha ul, #mocha li {
12 margin: 0;
13 padding: 0;
14 }
15
16 #mocha ul {
17 list-style: none;
18 }
19
20 #mocha h1, #mocha h2 {
21 margin: 0;
22 }
23
24 #mocha h1 {
25 margin-top: 15px;
26 font-size: 1em;
27 font-weight: 200;
28 }
29
30 #mocha h1 a {
31 text-decoration: none;
32 color: inherit;
33 }
34
35 #mocha h1 a:hover {
36 text-decoration: underline;
37 }
38
39 #mocha .suite .suite h1 {
40 margin-top: 0;
41 font-size: .8em;
42 }
43
44 #mocha .hidden {
45 display: none;
46 }
47
48 #mocha h2 {
49 font-size: 12px;
50 font-weight: normal;
51 cursor: pointer;
52 }
53
54 #mocha .suite {
55 margin-left: 15px;
56 }
57
58 #mocha .test {
59 margin-left: 15px;
60 overflow: hidden;
61 }
62
63 #mocha .test.pending:hover h2::after {
64 content: '(pending)';
65 font-family: arial, sans-serif;
66 }
67
68 #mocha .test.pass.medium .duration {
69 background: #C09853;
70 }
71
72 #mocha .test.pass.slow .duration {
73 background: #B94A48;
74 }
75
76 #mocha .test.pass::before {
77 content: '✓';
78 font-size: 12px;
79 display: block;
80 float: left;
81 margin-right: 5px;
82 color: #00d6b2;
83 }
84
85 #mocha .test.pass .duration {
86 font-size: 9px;
87 margin-left: 5px;
88 padding: 2px 5px;
89 color: white;
90 -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
91 -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
92 box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
93 -webkit-border-radius: 5px;
94 -moz-border-radius: 5px;
95 -ms-border-radius: 5px;
96 -o-border-radius: 5px;
97 border-radius: 5px;
98 }
99
100 #mocha .test.pass.fast .duration {
101 display: none;
102 }
103
104 #mocha .test.pending {
105 color: #0b97c4;
106 }
107
108 #mocha .test.pending::before {
109 content: '◦';
110 color: #0b97c4;
111 }
112
113 #mocha .test.fail {
114 color: #c00;
115 }
116
117 #mocha .test.fail pre {
118 color: black;
119 }
120
121 #mocha .test.fail::before {
122 content: '✖';
123 font-size: 12px;
124 display: block;
125 float: left;
126 margin-right: 5px;
127 color: #c00;
128 }
129
130 #mocha .test pre.error {
131 color: #c00;
132 max-height: 300px;
133 overflow: auto;
134 }
135
136 #mocha .test pre {
137 display: block;
138 float: left;
139 clear: left;
140 font: 12px/1.5 monaco, monospace;
141 margin: 5px;
142 padding: 15px;
143 border: 1px solid #eee;
144 border-bottom-color: #ddd;
145 -webkit-border-radius: 3px;
146 -webkit-box-shadow: 0 1px 3px #eee;
147 -moz-border-radius: 3px;
148 -moz-box-shadow: 0 1px 3px #eee;
149 }
150
151 #mocha .test h2 {
152 position: relative;
153 }
154
155 #mocha .test a.replay {
156 position: absolute;
157 top: 3px;
158 right: 0;
159 text-decoration: none;
160 vertical-align: middle;
161 display: block;
162 width: 15px;
163 height: 15px;
164 line-height: 15px;
165 text-align: center;
166 background: #eee;
167 font-size: 15px;
168 -moz-border-radius: 15px;
169 border-radius: 15px;
170 -webkit-transition: opacity 200ms;
171 -moz-transition: opacity 200ms;
172 transition: opacity 200ms;
173 opacity: 0.3;
174 color: #888;
175 }
176
177 #mocha .test:hover a.replay {
178 opacity: 1;
179 }
180
181 #mocha-report.pass .test.fail {
182 display: none;
183 }
184
185 #mocha-report.fail .test.pass {
186 display: none;
187 }
188
189 #mocha-error {
190 color: #c00;
191 font-size: 1.5em;
192 font-weight: 100;
193 letter-spacing: 1px;
194 }
195
196 #mocha-stats {
197 position: fixed;
198 top: 15px;
199 right: 10px;
200 font-size: 12px;
201 margin: 0;
202 color: #888;
203 }
204
205 #mocha-stats .progress {
206 float: right;
207 padding-top: 0;
208 }
209
210 #mocha-stats em {
211 color: black;
212 }
213
214 #mocha-stats a {
215 text-decoration: none;
216 color: inherit;
217 }
218
219 #mocha-stats a:hover {
220 border-bottom: 1px solid #eee;
221 }
222
223 #mocha-stats li {
224 display: inline-block;
225 margin: 0 5px;
226 list-style: none;
227 padding-top: 11px;
228 }
229
230 #mocha-stats canvas {
231 width: 40px;
232 height: 40px;
233 }
234
235 #mocha code .comment { color: #ddd }
236 #mocha code .init { color: #2F6FAD }
237 #mocha code .string { color: #5890AD }
238 #mocha code .keyword { color: #8A6343 }
239 #mocha code .number { color: #2F6FAD }
240
241 @media screen and (max-device-width: 480px) {
242 #mocha {
243 margin: 60px 0px;
244 }
245
246 #mocha #stats {
247 position: absolute;
248 }
249 }
+0
-5373
test/deps/mocha.js less more
0 ;(function(){
1
2 // CommonJS require()
3
4 function require(p){
5 var path = require.resolve(p)
6 , mod = require.modules[path];
7 if (!mod) throw new Error('failed to require "' + p + '"');
8 if (!mod.exports) {
9 mod.exports = {};
10 mod.call(mod.exports, mod, mod.exports, require.relative(path));
11 }
12 return mod.exports;
13 }
14
15 require.modules = {};
16
17 require.resolve = function (path){
18 var orig = path
19 , reg = path + '.js'
20 , index = path + '/index.js';
21 return require.modules[reg] && reg
22 || require.modules[index] && index
23 || orig;
24 };
25
26 require.register = function (path, fn){
27 require.modules[path] = fn;
28 };
29
30 require.relative = function (parent) {
31 return function(p){
32 if ('.' != p.charAt(0)) return require(p);
33
34 var path = parent.split('/')
35 , segs = p.split('/');
36 path.pop();
37
38 for (var i = 0; i < segs.length; i++) {
39 var seg = segs[i];
40 if ('..' == seg) path.pop();
41 else if ('.' != seg) path.push(seg);
42 }
43
44 return require(path.join('/'));
45 };
46 };
47
48
49 require.register("browser/debug.js", function(module, exports, require){
50
51 module.exports = function(type){
52 return function(){
53 }
54 };
55
56 }); // module: browser/debug.js
57
58 require.register("browser/diff.js", function(module, exports, require){
59 /* See license.txt for terms of usage */
60
61 /*
62 * Text diff implementation.
63 *
64 * This library supports the following APIS:
65 * JsDiff.diffChars: Character by character diff
66 * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
67 * JsDiff.diffLines: Line based diff
68 *
69 * JsDiff.diffCss: Diff targeted at CSS content
70 *
71 * These methods are based on the implementation proposed in
72 * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
73 * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
74 */
75 var JsDiff = (function() {
76 function clonePath(path) {
77 return { newPos: path.newPos, components: path.components.slice(0) };
78 }
79 function removeEmpty(array) {
80 var ret = [];
81 for (var i = 0; i < array.length; i++) {
82 if (array[i]) {
83 ret.push(array[i]);
84 }
85 }
86 return ret;
87 }
88 function escapeHTML(s) {
89 var n = s;
90 n = n.replace(/&/g, "&amp;");
91 n = n.replace(/</g, "&lt;");
92 n = n.replace(/>/g, "&gt;");
93 n = n.replace(/"/g, "&quot;");
94
95 return n;
96 }
97
98
99 var fbDiff = function(ignoreWhitespace) {
100 this.ignoreWhitespace = ignoreWhitespace;
101 };
102 fbDiff.prototype = {
103 diff: function(oldString, newString) {
104 // Handle the identity case (this is due to unrolling editLength == 0
105 if (newString == oldString) {
106 return [{ value: newString }];
107 }
108 if (!newString) {
109 return [{ value: oldString, removed: true }];
110 }
111 if (!oldString) {
112 return [{ value: newString, added: true }];
113 }
114
115 newString = this.tokenize(newString);
116 oldString = this.tokenize(oldString);
117
118 var newLen = newString.length, oldLen = oldString.length;
119 var maxEditLength = newLen + oldLen;
120 var bestPath = [{ newPos: -1, components: [] }];
121
122 // Seed editLength = 0
123 var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
124 if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) {
125 return bestPath[0].components;
126 }
127
128 for (var editLength = 1; editLength <= maxEditLength; editLength++) {
129 for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) {
130 var basePath;
131 var addPath = bestPath[diagonalPath-1],
132 removePath = bestPath[diagonalPath+1];
133 oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
134 if (addPath) {
135 // No one else is going to attempt to use this value, clear it
136 bestPath[diagonalPath-1] = undefined;
137 }
138
139 var canAdd = addPath && addPath.newPos+1 < newLen;
140 var canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
141 if (!canAdd && !canRemove) {
142 bestPath[diagonalPath] = undefined;
143 continue;
144 }
145
146 // Select the diagonal that we want to branch from. We select the prior
147 // path whose position in the new string is the farthest from the origin
148 // and does not pass the bounds of the diff graph
149 if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
150 basePath = clonePath(removePath);
151 this.pushComponent(basePath.components, oldString[oldPos], undefined, true);
152 } else {
153 basePath = clonePath(addPath);
154 basePath.newPos++;
155 this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined);
156 }
157
158 var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath);
159
160 if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) {
161 return basePath.components;
162 } else {
163 bestPath[diagonalPath] = basePath;
164 }
165 }
166 }
167 },
168
169 pushComponent: function(components, value, added, removed) {
170 var last = components[components.length-1];
171 if (last && last.added === added && last.removed === removed) {
172 // We need to clone here as the component clone operation is just
173 // as shallow array clone
174 components[components.length-1] =
175 {value: this.join(last.value, value), added: added, removed: removed };
176 } else {
177 components.push({value: value, added: added, removed: removed });
178 }
179 },
180 extractCommon: function(basePath, newString, oldString, diagonalPath) {
181 var newLen = newString.length,
182 oldLen = oldString.length,
183 newPos = basePath.newPos,
184 oldPos = newPos - diagonalPath;
185 while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {
186 newPos++;
187 oldPos++;
188
189 this.pushComponent(basePath.components, newString[newPos], undefined, undefined);
190 }
191 basePath.newPos = newPos;
192 return oldPos;
193 },
194
195 equals: function(left, right) {
196 var reWhitespace = /\S/;
197 if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) {
198 return true;
199 } else {
200 return left == right;
201 }
202 },
203 join: function(left, right) {
204 return left + right;
205 },
206 tokenize: function(value) {
207 return value;
208 }
209 };
210
211 var CharDiff = new fbDiff();
212
213 var WordDiff = new fbDiff(true);
214 WordDiff.tokenize = function(value) {
215 return removeEmpty(value.split(/(\s+|\b)/));
216 };
217
218 var CssDiff = new fbDiff(true);
219 CssDiff.tokenize = function(value) {
220 return removeEmpty(value.split(/([{}:;,]|\s+)/));
221 };
222
223 var LineDiff = new fbDiff();
224 LineDiff.tokenize = function(value) {
225 return value.split(/^/m);
226 };
227
228 return {
229 diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },
230 diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },
231 diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); },
232
233 diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); },
234
235 createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
236 var ret = [];
237
238 ret.push("Index: " + fileName);
239 ret.push("===================================================================");
240 ret.push("--- " + fileName + (typeof oldHeader === "undefined" ? "" : "\t" + oldHeader));
241 ret.push("+++ " + fileName + (typeof newHeader === "undefined" ? "" : "\t" + newHeader));
242
243 var diff = LineDiff.diff(oldStr, newStr);
244 if (!diff[diff.length-1].value) {
245 diff.pop(); // Remove trailing newline add
246 }
247 diff.push({value: "", lines: []}); // Append an empty value to make cleanup easier
248
249 function contextLines(lines) {
250 return lines.map(function(entry) { return ' ' + entry; });
251 }
252 function eofNL(curRange, i, current) {
253 var last = diff[diff.length-2],
254 isLast = i === diff.length-2,
255 isLastOfType = i === diff.length-3 && (current.added === !last.added || current.removed === !last.removed);
256
257 // Figure out if this is the last line for the given file and missing NL
258 if (!/\n$/.test(current.value) && (isLast || isLastOfType)) {
259 curRange.push('\\ No newline at end of file');
260 }
261 }
262
263 var oldRangeStart = 0, newRangeStart = 0, curRange = [],
264 oldLine = 1, newLine = 1;
265 for (var i = 0; i < diff.length; i++) {
266 var current = diff[i],
267 lines = current.lines || current.value.replace(/\n$/, "").split("\n");
268 current.lines = lines;
269
270 if (current.added || current.removed) {
271 if (!oldRangeStart) {
272 var prev = diff[i-1];
273 oldRangeStart = oldLine;
274 newRangeStart = newLine;
275
276 if (prev) {
277 curRange = contextLines(prev.lines.slice(-4));
278 oldRangeStart -= curRange.length;
279 newRangeStart -= curRange.length;
280 }
281 }
282 curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?"+":"-") + entry; }));
283 eofNL(curRange, i, current);
284
285 if (current.added) {
286 newLine += lines.length;
287 } else {
288 oldLine += lines.length;
289 }
290 } else {
291 if (oldRangeStart) {
292 // Close out any changes that have been output (or join overlapping)
293 if (lines.length <= 8 && i < diff.length-2) {
294 // Overlapping
295 curRange.push.apply(curRange, contextLines(lines));
296 } else {
297 // end the range and output
298 var contextSize = Math.min(lines.length, 4);
299 ret.push(
300 "@@ -" + oldRangeStart + "," + (oldLine-oldRangeStart+contextSize)
301 + " +" + newRangeStart + "," + (newLine-newRangeStart+contextSize)
302 + " @@");
303 ret.push.apply(ret, curRange);
304 ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
305 if (lines.length <= 4) {
306 eofNL(ret, i, current);
307 }
308
309 oldRangeStart = 0; newRangeStart = 0; curRange = [];
310 }
311 }
312 oldLine += lines.length;
313 newLine += lines.length;
314 }
315 }
316
317 return ret.join('\n') + '\n';
318 },
319
320 convertChangesToXML: function(changes){
321 var ret = [];
322 for ( var i = 0; i < changes.length; i++) {
323 var change = changes[i];
324 if (change.added) {
325 ret.push("<ins>");
326 } else if (change.removed) {
327 ret.push("<del>");
328 }
329
330 ret.push(escapeHTML(change.value));
331
332 if (change.added) {
333 ret.push("</ins>");
334 } else if (change.removed) {
335 ret.push("</del>");
336 }
337 }
338 return ret.join("");
339 }
340 };
341 })();
342
343 if (typeof module !== "undefined") {
344 module.exports = JsDiff;
345 }
346
347 }); // module: browser/diff.js
348
349 require.register("browser/events.js", function(module, exports, require){
350
351 /**
352 * Module exports.
353 */
354
355 exports.EventEmitter = EventEmitter;
356
357 /**
358 * Check if `obj` is an array.
359 */
360
361 function isArray(obj) {
362 return '[object Array]' == {}.toString.call(obj);
363 }
364
365 /**
366 * Event emitter constructor.
367 *
368 * @api public
369 */
370
371 function EventEmitter(){};
372
373 /**
374 * Adds a listener.
375 *
376 * @api public
377 */
378
379 EventEmitter.prototype.on = function (name, fn) {
380 if (!this.$events) {
381 this.$events = {};
382 }
383
384 if (!this.$events[name]) {
385 this.$events[name] = fn;
386 } else if (isArray(this.$events[name])) {
387 this.$events[name].push(fn);
388 } else {
389 this.$events[name] = [this.$events[name], fn];
390 }
391
392 return this;
393 };
394
395 EventEmitter.prototype.addListener = EventEmitter.prototype.on;
396
397 /**
398 * Adds a volatile listener.
399 *
400 * @api public
401 */
402
403 EventEmitter.prototype.once = function (name, fn) {
404 var self = this;
405
406 function on () {
407 self.removeListener(name, on);
408 fn.apply(this, arguments);
409 };
410
411 on.listener = fn;
412 this.on(name, on);
413
414 return this;
415 };
416
417 /**
418 * Removes a listener.
419 *
420 * @api public
421 */
422
423 EventEmitter.prototype.removeListener = function (name, fn) {
424 if (this.$events && this.$events[name]) {
425 var list = this.$events[name];
426
427 if (isArray(list)) {
428 var pos = -1;
429
430 for (var i = 0, l = list.length; i < l; i++) {
431 if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {
432 pos = i;
433 break;
434 }
435 }
436
437 if (pos < 0) {
438 return this;
439 }
440
441 list.splice(pos, 1);
442
443 if (!list.length) {
444 delete this.$events[name];
445 }
446 } else if (list === fn || (list.listener && list.listener === fn)) {
447 delete this.$events[name];
448 }
449 }
450
451 return this;
452 };
453
454 /**
455 * Removes all listeners for an event.
456 *
457 * @api public
458 */
459
460 EventEmitter.prototype.removeAllListeners = function (name) {
461 if (name === undefined) {
462 this.$events = {};
463 return this;
464 }
465
466 if (this.$events && this.$events[name]) {
467 this.$events[name] = null;
468 }
469
470 return this;
471 };
472
473 /**
474 * Gets all listeners for a certain event.
475 *
476 * @api public
477 */
478
479 EventEmitter.prototype.listeners = function (name) {
480 if (!this.$events) {
481 this.$events = {};
482 }
483
484 if (!this.$events[name]) {
485 this.$events[name] = [];
486 }
487
488 if (!isArray(this.$events[name])) {
489 this.$events[name] = [this.$events[name]];
490 }
491
492 return this.$events[name];
493 };
494
495 /**
496 * Emits an event.
497 *
498 * @api public
499 */
500
501 EventEmitter.prototype.emit = function (name) {
502 if (!this.$events) {
503 return false;
504 }
505
506 var handler = this.$events[name];
507
508 if (!handler) {
509 return false;
510 }
511
512 var args = [].slice.call(arguments, 1);
513
514 if ('function' == typeof handler) {
515 handler.apply(this, args);
516 } else if (isArray(handler)) {
517 var listeners = handler.slice();
518
519 for (var i = 0, l = listeners.length; i < l; i++) {
520 listeners[i].apply(this, args);
521 }
522 } else {
523 return false;
524 }
525
526 return true;
527 };
528 }); // module: browser/events.js
529
530 require.register("browser/fs.js", function(module, exports, require){
531
532 }); // module: browser/fs.js
533
534 require.register("browser/path.js", function(module, exports, require){
535
536 }); // module: browser/path.js
537
538 require.register("browser/progress.js", function(module, exports, require){
539
540 /**
541 * Expose `Progress`.
542 */
543
544 module.exports = Progress;
545
546 /**
547 * Initialize a new `Progress` indicator.
548 */
549
550 function Progress() {
551 this.percent = 0;
552 this.size(0);
553 this.fontSize(11);
554 this.font('helvetica, arial, sans-serif');
555 }
556
557 /**
558 * Set progress size to `n`.
559 *
560 * @param {Number} n
561 * @return {Progress} for chaining
562 * @api public
563 */
564
565 Progress.prototype.size = function(n){
566 this._size = n;
567 return this;
568 };
569
570 /**
571 * Set text to `str`.
572 *
573 * @param {String} str
574 * @return {Progress} for chaining
575 * @api public
576 */
577
578 Progress.prototype.text = function(str){
579 this._text = str;
580 return this;
581 };
582
583 /**
584 * Set font size to `n`.
585 *
586 * @param {Number} n
587 * @return {Progress} for chaining
588 * @api public
589 */
590
591 Progress.prototype.fontSize = function(n){
592 this._fontSize = n;
593 return this;
594 };
595
596 /**
597 * Set font `family`.
598 *
599 * @param {String} family
600 * @return {Progress} for chaining
601 */
602
603 Progress.prototype.font = function(family){
604 this._font = family;
605 return this;
606 };
607
608 /**
609 * Update percentage to `n`.
610 *
611 * @param {Number} n
612 * @return {Progress} for chaining
613 */
614
615 Progress.prototype.update = function(n){
616 this.percent = n;
617 return this;
618 };
619
620 /**
621 * Draw on `ctx`.
622 *
623 * @param {CanvasRenderingContext2d} ctx
624 * @return {Progress} for chaining
625 */
626
627 Progress.prototype.draw = function(ctx){
628 var percent = Math.min(this.percent, 100)
629 , size = this._size
630 , half = size / 2
631 , x = half
632 , y = half
633 , rad = half - 1
634 , fontSize = this._fontSize;
635
636 ctx.font = fontSize + 'px ' + this._font;
637
638 var angle = Math.PI * 2 * (percent / 100);
639 ctx.clearRect(0, 0, size, size);
640
641 // outer circle
642 ctx.strokeStyle = '#9f9f9f';
643 ctx.beginPath();
644 ctx.arc(x, y, rad, 0, angle, false);
645 ctx.stroke();
646
647 // inner circle
648 ctx.strokeStyle = '#eee';
649 ctx.beginPath();
650 ctx.arc(x, y, rad - 1, 0, angle, true);
651 ctx.stroke();
652
653 // text
654 var text = this._text || (percent | 0) + '%'
655 , w = ctx.measureText(text).width;
656
657 ctx.fillText(
658 text
659 , x - w / 2 + 1
660 , y + fontSize / 2 - 1);
661
662 return this;
663 };
664
665 }); // module: browser/progress.js
666
667 require.register("browser/tty.js", function(module, exports, require){
668
669 exports.isatty = function(){
670 return true;
671 };
672
673 exports.getWindowSize = function(){
674 return [window.innerHeight, window.innerWidth];
675 };
676 }); // module: browser/tty.js
677
678 require.register("context.js", function(module, exports, require){
679
680 /**
681 * Expose `Context`.
682 */
683
684 module.exports = Context;
685
686 /**
687 * Initialize a new `Context`.
688 *
689 * @api private
690 */
691
692 function Context(){}
693
694 /**
695 * Set or get the context `Runnable` to `runnable`.
696 *
697 * @param {Runnable} runnable
698 * @return {Context}
699 * @api private
700 */
701
702 Context.prototype.runnable = function(runnable){
703 if (0 == arguments.length) return this._runnable;
704 this.test = this._runnable = runnable;
705 return this;
706 };
707
708 /**
709 * Set test timeout `ms`.
710 *
711 * @param {Number} ms
712 * @return {Context} self
713 * @api private
714 */
715
716 Context.prototype.timeout = function(ms){
717 this.runnable().timeout(ms);
718 return this;
719 };
720
721 /**
722 * Set test slowness threshold `ms`.
723 *
724 * @param {Number} ms
725 * @return {Context} self
726 * @api private
727 */
728
729 Context.prototype.slow = function(ms){
730 this.runnable().slow(ms);
731 return this;
732 };
733
734 /**
735 * Inspect the context void of `._runnable`.
736 *
737 * @return {String}
738 * @api private
739 */
740
741 Context.prototype.inspect = function(){
742 return JSON.stringify(this, function(key, val){
743 if ('_runnable' == key) return;
744 if ('test' == key) return;
745 return val;
746 }, 2);
747 };
748
749 }); // module: context.js
750
751 require.register("hook.js", function(module, exports, require){
752
753 /**
754 * Module dependencies.
755 */
756
757 var Runnable = require('./runnable');
758
759 /**
760 * Expose `Hook`.
761 */
762
763 module.exports = Hook;
764
765 /**
766 * Initialize a new `Hook` with the given `title` and callback `fn`.
767 *
768 * @param {String} title
769 * @param {Function} fn
770 * @api private
771 */
772
773 function Hook(title, fn) {
774 Runnable.call(this, title, fn);
775 this.type = 'hook';
776 }
777
778 /**
779 * Inherit from `Runnable.prototype`.
780 */
781
782 function F(){};
783 F.prototype = Runnable.prototype;
784 Hook.prototype = new F;
785 Hook.prototype.constructor = Hook;
786
787
788 /**
789 * Get or set the test `err`.
790 *
791 * @param {Error} err
792 * @return {Error}
793 * @api public
794 */
795
796 Hook.prototype.error = function(err){
797 if (0 == arguments.length) {
798 var err = this._error;
799 this._error = null;
800 return err;
801 }
802
803 this._error = err;
804 };
805
806 }); // module: hook.js
807
808 require.register("interfaces/bdd.js", function(module, exports, require){
809
810 /**
811 * Module dependencies.
812 */
813
814 var Suite = require('../suite')
815 , Test = require('../test');
816
817 /**
818 * BDD-style interface:
819 *
820 * describe('Array', function(){
821 * describe('#indexOf()', function(){
822 * it('should return -1 when not present', function(){
823 *
824 * });
825 *
826 * it('should return the index when present', function(){
827 *
828 * });
829 * });
830 * });
831 *
832 */
833
834 module.exports = function(suite){
835 var suites = [suite];
836
837 suite.on('pre-require', function(context, file, mocha){
838
839 /**
840 * Execute before running tests.
841 */
842
843 context.before = function(fn){
844 suites[0].beforeAll(fn);
845 };
846
847 /**
848 * Execute after running tests.
849 */
850
851 context.after = function(fn){
852 suites[0].afterAll(fn);
853 };
854
855 /**
856 * Execute before each test case.
857 */
858
859 context.beforeEach = function(fn){
860 suites[0].beforeEach(fn);
861 };
862
863 /**
864 * Execute after each test case.
865 */
866
867 context.afterEach = function(fn){
868 suites[0].afterEach(fn);
869 };
870
871 /**
872 * Describe a "suite" with the given `title`
873 * and callback `fn` containing nested suites
874 * and/or tests.
875 */
876
877 context.describe = context.context = function(title, fn){
878 var suite = Suite.create(suites[0], title);
879 suites.unshift(suite);
880 fn.call(suite);
881 suites.shift();
882 return suite;
883 };
884
885 /**
886 * Pending describe.
887 */
888
889 context.xdescribe =
890 context.xcontext =
891 context.describe.skip = function(title, fn){
892 var suite = Suite.create(suites[0], title);
893 suite.pending = true;
894 suites.unshift(suite);
895 fn.call(suite);
896 suites.shift();
897 };
898
899 /**
900 * Exclusive suite.
901 */
902
903 context.describe.only = function(title, fn){
904 var suite = context.describe(title, fn);
905 mocha.grep(suite.fullTitle());
906 };
907
908 /**
909 * Describe a specification or test-case
910 * with the given `title` and callback `fn`
911 * acting as a thunk.
912 */
913
914 context.it = context.specify = function(title, fn){
915 var suite = suites[0];
916 if (suite.pending) var fn = null;
917 var test = new Test(title, fn);
918 suite.addTest(test);
919 return test;
920 };
921
922 /**
923 * Exclusive test-case.
924 */
925
926 context.it.only = function(title, fn){
927 var test = context.it(title, fn);
928 mocha.grep(test.fullTitle());
929 };
930
931 /**
932 * Pending test case.
933 */
934
935 context.xit =
936 context.xspecify =
937 context.it.skip = function(title){
938 context.it(title);
939 };
940 });
941 };
942
943 }); // module: interfaces/bdd.js
944
945 require.register("interfaces/exports.js", function(module, exports, require){
946
947 /**
948 * Module dependencies.
949 */
950
951 var Suite = require('../suite')
952 , Test = require('../test');
953
954 /**
955 * TDD-style interface:
956 *
957 * exports.Array = {
958 * '#indexOf()': {
959 * 'should return -1 when the value is not present': function(){
960 *
961 * },
962 *
963 * 'should return the correct index when the value is present': function(){
964 *
965 * }
966 * }
967 * };
968 *
969 */
970
971 module.exports = function(suite){
972 var suites = [suite];
973
974 suite.on('require', visit);
975
976 function visit(obj) {
977 var suite;
978 for (var key in obj) {
979 if ('function' == typeof obj[key]) {
980 var fn = obj[key];
981 switch (key) {
982 case 'before':
983 suites[0].beforeAll(fn);
984 break;
985 case 'after':
986 suites[0].afterAll(fn);
987 break;
988 case 'beforeEach':
989 suites[0].beforeEach(fn);
990 break;
991 case 'afterEach':
992 suites[0].afterEach(fn);
993 break;
994 default:
995 suites[0].addTest(new Test(key, fn));
996 }
997 } else {
998 var suite = Suite.create(suites[0], key);
999 suites.unshift(suite);
1000 visit(obj[key]);
1001 suites.shift();
1002 }
1003 }
1004 }
1005 };
1006
1007 }); // module: interfaces/exports.js
1008
1009 require.register("interfaces/index.js", function(module, exports, require){
1010
1011 exports.bdd = require('./bdd');
1012 exports.tdd = require('./tdd');
1013 exports.qunit = require('./qunit');
1014 exports.exports = require('./exports');
1015
1016 }); // module: interfaces/index.js
1017
1018 require.register("interfaces/qunit.js", function(module, exports, require){
1019
1020 /**
1021 * Module dependencies.
1022 */
1023
1024 var Suite = require('../suite')
1025 , Test = require('../test');
1026
1027 /**
1028 * QUnit-style interface:
1029 *
1030 * suite('Array');
1031 *
1032 * test('#length', function(){
1033 * var arr = [1,2,3];
1034 * ok(arr.length == 3);
1035 * });
1036 *
1037 * test('#indexOf()', function(){
1038 * var arr = [1,2,3];
1039 * ok(arr.indexOf(1) == 0);
1040 * ok(arr.indexOf(2) == 1);
1041 * ok(arr.indexOf(3) == 2);
1042 * });
1043 *
1044 * suite('String');
1045 *
1046 * test('#length', function(){
1047 * ok('foo'.length == 3);
1048 * });
1049 *
1050 */
1051
1052 module.exports = function(suite){
1053 var suites = [suite];
1054
1055 suite.on('pre-require', function(context, file, mocha){
1056
1057 /**
1058 * Execute before running tests.
1059 */
1060
1061 context.before = function(fn){
1062 suites[0].beforeAll(fn);
1063 };
1064
1065 /**
1066 * Execute after running tests.
1067 */
1068
1069 context.after = function(fn){
1070 suites[0].afterAll(fn);
1071 };
1072
1073 /**
1074 * Execute before each test case.
1075 */
1076
1077 context.beforeEach = function(fn){
1078 suites[0].beforeEach(fn);
1079 };
1080
1081 /**
1082 * Execute after each test case.
1083 */
1084
1085 context.afterEach = function(fn){
1086 suites[0].afterEach(fn);
1087 };
1088
1089 /**
1090 * Describe a "suite" with the given `title`.
1091 */
1092
1093 context.suite = function(title){
1094 if (suites.length > 1) suites.shift();
1095 var suite = Suite.create(suites[0], title);
1096 suites.unshift(suite);
1097 return suite;
1098 };
1099
1100 /**
1101 * Exclusive test-case.
1102 */
1103
1104 context.suite.only = function(title, fn){
1105 var suite = context.suite(title, fn);
1106 mocha.grep(suite.fullTitle());
1107 };
1108
1109 /**
1110 * Describe a specification or test-case
1111 * with the given `title` and callback `fn`
1112 * acting as a thunk.
1113 */
1114
1115 context.test = function(title, fn){
1116 var test = new Test(title, fn);
1117 suites[0].addTest(test);
1118 return test;
1119 };
1120
1121 /**
1122 * Exclusive test-case.
1123 */
1124
1125 context.test.only = function(title, fn){
1126 var test = context.test(title, fn);
1127 mocha.grep(test.fullTitle());
1128 };
1129
1130 /**
1131 * Pending test case.
1132 */
1133
1134 context.test.skip = function(title){
1135 context.test(title);
1136 };
1137 });
1138 };
1139
1140 }); // module: interfaces/qunit.js
1141
1142 require.register("interfaces/tdd.js", function(module, exports, require){
1143
1144 /**
1145 * Module dependencies.
1146 */
1147
1148 var Suite = require('../suite')
1149 , Test = require('../test');
1150
1151 /**
1152 * TDD-style interface:
1153 *
1154 * suite('Array', function(){
1155 * suite('#indexOf()', function(){
1156 * suiteSetup(function(){
1157 *
1158 * });
1159 *
1160 * test('should return -1 when not present', function(){
1161 *
1162 * });
1163 *
1164 * test('should return the index when present', function(){
1165 *
1166 * });
1167 *
1168 * suiteTeardown(function(){
1169 *
1170 * });
1171 * });
1172 * });
1173 *
1174 */
1175
1176 module.exports = function(suite){
1177 var suites = [suite];
1178
1179 suite.on('pre-require', function(context, file, mocha){
1180
1181 /**
1182 * Execute before each test case.
1183 */
1184
1185 context.setup = function(fn){
1186 suites[0].beforeEach(fn);
1187 };
1188
1189 /**
1190 * Execute after each test case.
1191 */
1192
1193 context.teardown = function(fn){
1194 suites[0].afterEach(fn);
1195 };
1196
1197 /**
1198 * Execute before the suite.
1199 */
1200
1201 context.suiteSetup = function(fn){
1202 suites[0].beforeAll(fn);
1203 };
1204
1205 /**
1206 * Execute after the suite.
1207 */
1208
1209 context.suiteTeardown = function(fn){
1210 suites[0].afterAll(fn);
1211 };
1212
1213 /**
1214 * Describe a "suite" with the given `title`
1215 * and callback `fn` containing nested suites
1216 * and/or tests.
1217 */
1218
1219 context.suite = function(title, fn){
1220 var suite = Suite.create(suites[0], title);
1221 suites.unshift(suite);
1222 fn.call(suite);
1223 suites.shift();
1224 return suite;
1225 };
1226
1227 /**
1228 * Exclusive test-case.
1229 */
1230
1231 context.suite.only = function(title, fn){
1232 var suite = context.suite(title, fn);
1233 mocha.grep(suite.fullTitle());
1234 };
1235
1236 /**
1237 * Describe a specification or test-case
1238 * with the given `title` and callback `fn`
1239 * acting as a thunk.
1240 */
1241
1242 context.test = function(title, fn){
1243 var test = new Test(title, fn);
1244 suites[0].addTest(test);
1245 return test;
1246 };
1247
1248 /**
1249 * Exclusive test-case.
1250 */
1251
1252 context.test.only = function(title, fn){
1253 var test = context.test(title, fn);
1254 mocha.grep(test.fullTitle());
1255 };
1256
1257 /**
1258 * Pending test case.
1259 */
1260
1261 context.test.skip = function(title){
1262 context.test(title);
1263 };
1264 });
1265 };
1266
1267 }); // module: interfaces/tdd.js
1268
1269 require.register("mocha.js", function(module, exports, require){
1270 /*!
1271 * mocha
1272 * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
1273 * MIT Licensed
1274 */
1275
1276 /**
1277 * Module dependencies.
1278 */
1279
1280 var path = require('browser/path')
1281 , utils = require('./utils');
1282
1283 /**
1284 * Expose `Mocha`.
1285 */
1286
1287 exports = module.exports = Mocha;
1288
1289 /**
1290 * Expose internals.
1291 */
1292
1293 exports.utils = utils;
1294 exports.interfaces = require('./interfaces');
1295 exports.reporters = require('./reporters');
1296 exports.Runnable = require('./runnable');
1297 exports.Context = require('./context');
1298 exports.Runner = require('./runner');
1299 exports.Suite = require('./suite');
1300 exports.Hook = require('./hook');
1301 exports.Test = require('./test');
1302
1303 /**
1304 * Return image `name` path.
1305 *
1306 * @param {String} name
1307 * @return {String}
1308 * @api private
1309 */
1310
1311 function image(name) {
1312 return __dirname + '/../images/' + name + '.png';
1313 }
1314
1315 /**
1316 * Setup mocha with `options`.
1317 *
1318 * Options:
1319 *
1320 * - `ui` name "bdd", "tdd", "exports" etc
1321 * - `reporter` reporter instance, defaults to `mocha.reporters.Dot`
1322 * - `globals` array of accepted globals
1323 * - `timeout` timeout in milliseconds
1324 * - `bail` bail on the first test failure
1325 * - `slow` milliseconds to wait before considering a test slow
1326 * - `ignoreLeaks` ignore global leaks
1327 * - `grep` string or regexp to filter tests with
1328 *
1329 * @param {Object} options
1330 * @api public
1331 */
1332
1333 function Mocha(options) {
1334 options = options || {};
1335 this.files = [];
1336 this.options = options;
1337 this.grep(options.grep);
1338 this.suite = new exports.Suite('', new exports.Context);
1339 this.ui(options.ui);
1340 this.bail(options.bail);
1341 this.reporter(options.reporter);
1342 if (options.timeout) this.timeout(options.timeout);
1343 if (options.slow) this.slow(options.slow);
1344 }
1345
1346 /**
1347 * Enable or disable bailing on the first failure.
1348 *
1349 * @param {Boolean} [bail]
1350 * @api public
1351 */
1352
1353 Mocha.prototype.bail = function(bail){
1354 if (0 == arguments.length) bail = true;
1355 this.suite.bail(bail);
1356 return this;
1357 };
1358
1359 /**
1360 * Add test `file`.
1361 *
1362 * @param {String} file
1363 * @api public
1364 */
1365
1366 Mocha.prototype.addFile = function(file){
1367 this.files.push(file);
1368 return this;
1369 };
1370
1371 /**
1372 * Set reporter to `reporter`, defaults to "dot".
1373 *
1374 * @param {String|Function} reporter name or constructor
1375 * @api public
1376 */
1377
1378 Mocha.prototype.reporter = function(reporter){
1379 if ('function' == typeof reporter) {
1380 this._reporter = reporter;
1381 } else {
1382 reporter = reporter || 'dot';
1383 try {
1384 this._reporter = require('./reporters/' + reporter);
1385 } catch (err) {
1386 this._reporter = require(reporter);
1387 }
1388 if (!this._reporter) throw new Error('invalid reporter "' + reporter + '"');
1389 }
1390 return this;
1391 };
1392
1393 /**
1394 * Set test UI `name`, defaults to "bdd".
1395 *
1396 * @param {String} bdd
1397 * @api public
1398 */
1399
1400 Mocha.prototype.ui = function(name){
1401 name = name || 'bdd';
1402 this._ui = exports.interfaces[name];
1403 if (!this._ui) throw new Error('invalid interface "' + name + '"');
1404 this._ui = this._ui(this.suite);
1405 return this;
1406 };
1407
1408 /**
1409 * Load registered files.
1410 *
1411 * @api private
1412 */
1413
1414 Mocha.prototype.loadFiles = function(fn){
1415 var self = this;
1416 var suite = this.suite;
1417 var pending = this.files.length;
1418 this.files.forEach(function(file){
1419 file = path.resolve(file);
1420 suite.emit('pre-require', global, file, self);
1421 suite.emit('require', require(file), file, self);
1422 suite.emit('post-require', global, file, self);
1423 --pending || (fn && fn());
1424 });
1425 };
1426
1427 /**
1428 * Enable growl support.
1429 *
1430 * @api private
1431 */
1432
1433 Mocha.prototype._growl = function(runner, reporter) {
1434 var notify = require('growl');
1435
1436 runner.on('end', function(){
1437 var stats = reporter.stats;
1438 if (stats.failures) {
1439 var msg = stats.failures + ' of ' + runner.total + ' tests failed';
1440 notify(msg, { name: 'mocha', title: 'Failed', image: image('error') });
1441 } else {
1442 notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', {
1443 name: 'mocha'
1444 , title: 'Passed'
1445 , image: image('ok')
1446 });
1447 }
1448 });
1449 };
1450
1451 /**
1452 * Add regexp to grep, if `re` is a string it is escaped.
1453 *
1454 * @param {RegExp|String} re
1455 * @return {Mocha}
1456 * @api public
1457 */
1458
1459 Mocha.prototype.grep = function(re){
1460 this.options.grep = 'string' == typeof re
1461 ? new RegExp(utils.escapeRegexp(re))
1462 : re;
1463 return this;
1464 };
1465
1466 /**
1467 * Invert `.grep()` matches.
1468 *
1469 * @return {Mocha}
1470 * @api public
1471 */
1472
1473 Mocha.prototype.invert = function(){
1474 this.options.invert = true;
1475 return this;
1476 };
1477
1478 /**
1479 * Ignore global leaks.
1480 *
1481 * @return {Mocha}
1482 * @api public
1483 */
1484
1485 Mocha.prototype.ignoreLeaks = function(){
1486 this.options.ignoreLeaks = true;
1487 return this;
1488 };
1489
1490 /**
1491 * Enable global leak checking.
1492 *
1493 * @return {Mocha}
1494 * @api public
1495 */
1496
1497 Mocha.prototype.checkLeaks = function(){
1498 this.options.ignoreLeaks = false;
1499 return this;
1500 };
1501
1502 /**
1503 * Enable growl support.
1504 *
1505 * @return {Mocha}
1506 * @api public
1507 */
1508
1509 Mocha.prototype.growl = function(){
1510 this.options.growl = true;
1511 return this;
1512 };
1513
1514 /**
1515 * Ignore `globals` array or string.
1516 *
1517 * @param {Array|String} globals
1518 * @return {Mocha}
1519 * @api public
1520 */
1521
1522 Mocha.prototype.globals = function(globals){
1523 this.options.globals = (this.options.globals || []).concat(globals);
1524 return this;
1525 };
1526
1527 /**
1528 * Set the timeout in milliseconds.
1529 *
1530 * @param {Number} timeout
1531 * @return {Mocha}
1532 * @api public
1533 */
1534
1535 Mocha.prototype.timeout = function(timeout){
1536 this.suite.timeout(timeout);
1537 return this;
1538 };
1539
1540 /**
1541 * Set slowness threshold in milliseconds.
1542 *
1543 * @param {Number} slow
1544 * @return {Mocha}
1545 * @api public
1546 */
1547
1548 Mocha.prototype.slow = function(slow){
1549 this.suite.slow(slow);
1550 return this;
1551 };
1552
1553 /**
1554 * Makes all tests async (accepting a callback)
1555 *
1556 * @return {Mocha}
1557 * @api public
1558 */
1559
1560 Mocha.prototype.asyncOnly = function(){
1561 this.options.asyncOnly = true;
1562 return this;
1563 };
1564
1565 /**
1566 * Run tests and invoke `fn()` when complete.
1567 *
1568 * @param {Function} fn
1569 * @return {Runner}
1570 * @api public
1571 */
1572
1573 Mocha.prototype.run = function(fn){
1574 if (this.files.length) this.loadFiles();
1575 var suite = this.suite;
1576 var options = this.options;
1577 var runner = new exports.Runner(suite);
1578 var reporter = new this._reporter(runner);
1579 runner.ignoreLeaks = false !== options.ignoreLeaks;
1580 runner.asyncOnly = options.asyncOnly;
1581 if (options.grep) runner.grep(options.grep, options.invert);
1582 if (options.globals) runner.globals(options.globals);
1583 if (options.growl) this._growl(runner, reporter);
1584 return runner.run(fn);
1585 };
1586
1587 }); // module: mocha.js
1588
1589 require.register("ms.js", function(module, exports, require){
1590
1591 /**
1592 * Helpers.
1593 */
1594
1595 var s = 1000;
1596 var m = s * 60;
1597 var h = m * 60;
1598 var d = h * 24;
1599
1600 /**
1601 * Parse or format the given `val`.
1602 *
1603 * @param {String|Number} val
1604 * @return {String|Number}
1605 * @api public
1606 */
1607
1608 module.exports = function(val){
1609 if ('string' == typeof val) return parse(val);
1610 return format(val);
1611 }
1612
1613 /**
1614 * Parse the given `str` and return milliseconds.
1615 *
1616 * @param {String} str
1617 * @return {Number}
1618 * @api private
1619 */
1620
1621 function parse(str) {
1622 var m = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str);
1623 if (!m) return;
1624 var n = parseFloat(m[1]);
1625 var type = (m[2] || 'ms').toLowerCase();
1626 switch (type) {
1627 case 'years':
1628 case 'year':
1629 case 'y':
1630 return n * 31557600000;
1631 case 'days':
1632 case 'day':
1633 case 'd':
1634 return n * 86400000;
1635 case 'hours':
1636 case 'hour':
1637 case 'h':
1638 return n * 3600000;
1639 case 'minutes':
1640 case 'minute':
1641 case 'm':
1642 return n * 60000;
1643 case 'seconds':
1644 case 'second':
1645 case 's':
1646 return n * 1000;
1647 case 'ms':
1648 return n;
1649 }
1650 }
1651
1652 /**
1653 * Format the given `ms`.
1654 *
1655 * @param {Number} ms
1656 * @return {String}
1657 * @api public
1658 */
1659
1660 function format(ms) {
1661 if (ms == d) return Math.round(ms / d) + ' day';
1662 if (ms > d) return Math.round(ms / d) + ' days';
1663 if (ms == h) return Math.round(ms / h) + ' hour';
1664 if (ms > h) return Math.round(ms / h) + ' hours';
1665 if (ms == m) return Math.round(ms / m) + ' minute';
1666 if (ms > m) return Math.round(ms / m) + ' minutes';
1667 if (ms == s) return Math.round(ms / s) + ' second';
1668 if (ms > s) return Math.round(ms / s) + ' seconds';
1669 return ms + ' ms';
1670 }
1671 }); // module: ms.js
1672
1673 require.register("reporters/base.js", function(module, exports, require){
1674
1675 /**
1676 * Module dependencies.
1677 */
1678
1679 var tty = require('browser/tty')
1680 , diff = require('browser/diff')
1681 , ms = require('../ms');
1682
1683 /**
1684 * Save timer references to avoid Sinon interfering (see GH-237).
1685 */
1686
1687 var Date = global.Date
1688 , setTimeout = global.setTimeout
1689 , setInterval = global.setInterval
1690 , clearTimeout = global.clearTimeout
1691 , clearInterval = global.clearInterval;
1692
1693 /**
1694 * Check if both stdio streams are associated with a tty.
1695 */
1696
1697 var isatty = tty.isatty(1) && tty.isatty(2);
1698
1699 /**
1700 * Expose `Base`.
1701 */
1702
1703 exports = module.exports = Base;
1704
1705 /**
1706 * Enable coloring by default.
1707 */
1708
1709 exports.useColors = isatty;
1710
1711 /**
1712 * Default color map.
1713 */
1714
1715 exports.colors = {
1716 'pass': 90
1717 , 'fail': 31
1718 , 'bright pass': 92
1719 , 'bright fail': 91
1720 , 'bright yellow': 93
1721 , 'pending': 36
1722 , 'suite': 0
1723 , 'error title': 0
1724 , 'error message': 31
1725 , 'error stack': 90
1726 , 'checkmark': 32
1727 , 'fast': 90
1728 , 'medium': 33
1729 , 'slow': 31
1730 , 'green': 32
1731 , 'light': 90
1732 , 'diff gutter': 90
1733 , 'diff added': 42
1734 , 'diff removed': 41
1735 };
1736
1737 /**
1738 * Default symbol map.
1739 */
1740
1741 exports.symbols = {
1742 ok: '✓',
1743 err: '✖',
1744 dot: '․'
1745 };
1746
1747 // With node.js on Windows: use symbols available in terminal default fonts
1748 if ('win32' == process.platform) {
1749 exports.symbols.ok = '\u221A';
1750 exports.symbols.err = '\u00D7';
1751 exports.symbols.dot = '.';
1752 }
1753
1754 /**
1755 * Color `str` with the given `type`,
1756 * allowing colors to be disabled,
1757 * as well as user-defined color
1758 * schemes.
1759 *
1760 * @param {String} type
1761 * @param {String} str
1762 * @return {String}
1763 * @api private
1764 */
1765
1766 var color = exports.color = function(type, str) {
1767 if (!exports.useColors) return str;
1768 return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
1769 };
1770
1771 /**
1772 * Expose term window size, with some
1773 * defaults for when stderr is not a tty.
1774 */
1775
1776 exports.window = {
1777 width: isatty
1778 ? process.stdout.getWindowSize
1779 ? process.stdout.getWindowSize(1)[0]
1780 : tty.getWindowSize()[1]
1781 : 75
1782 };
1783
1784 /**
1785 * Expose some basic cursor interactions
1786 * that are common among reporters.
1787 */
1788
1789 exports.cursor = {
1790 hide: function(){
1791 process.stdout.write('\u001b[?25l');
1792 },
1793
1794 show: function(){
1795 process.stdout.write('\u001b[?25h');
1796 },
1797
1798 deleteLine: function(){
1799 process.stdout.write('\u001b[2K');
1800 },
1801
1802 beginningOfLine: function(){
1803 process.stdout.write('\u001b[0G');
1804 },
1805
1806 CR: function(){
1807 exports.cursor.deleteLine();
1808 exports.cursor.beginningOfLine();
1809 }
1810 };
1811
1812 /**
1813 * Outut the given `failures` as a list.
1814 *
1815 * @param {Array} failures
1816 * @api public
1817 */
1818
1819 exports.list = function(failures){
1820 console.error();
1821 failures.forEach(function(test, i){
1822 // format
1823 var fmt = color('error title', ' %s) %s:\n')
1824 + color('error message', ' %s')
1825 + color('error stack', '\n%s\n');
1826
1827 // msg
1828 var err = test.err
1829 , message = err.message || ''
1830 , stack = err.stack || message
1831 , index = stack.indexOf(message) + message.length
1832 , msg = stack.slice(0, index)
1833 , actual = err.actual
1834 , expected = err.expected
1835 , escape = true;
1836
1837 // explicitly show diff
1838 if (err.showDiff) {
1839 escape = false;
1840 err.actual = actual = JSON.stringify(actual, null, 2);
1841 err.expected = expected = JSON.stringify(expected, null, 2);
1842 }
1843
1844 // actual / expected diff
1845 if ('string' == typeof actual && 'string' == typeof expected) {
1846 msg = errorDiff(err, 'Words', escape);
1847
1848 // linenos
1849 var lines = msg.split('\n');
1850 if (lines.length > 4) {
1851 var width = String(lines.length).length;
1852 msg = lines.map(function(str, i){
1853 return pad(++i, width) + ' |' + ' ' + str;
1854 }).join('\n');
1855 }
1856
1857 // legend
1858 msg = '\n'
1859 + color('diff removed', 'actual')
1860 + ' '
1861 + color('diff added', 'expected')
1862 + '\n\n'
1863 + msg
1864 + '\n';
1865
1866 // indent
1867 msg = msg.replace(/^/gm, ' ');
1868
1869 fmt = color('error title', ' %s) %s:\n%s')
1870 + color('error stack', '\n%s\n');
1871 }
1872
1873 // indent stack trace without msg
1874 stack = stack.slice(index ? index + 1 : index)
1875 .replace(/^/gm, ' ');
1876
1877 console.error(fmt, (i + 1), test.fullTitle(), msg, stack);
1878 });
1879 };
1880
1881 /**
1882 * Initialize a new `Base` reporter.
1883 *
1884 * All other reporters generally
1885 * inherit from this reporter, providing
1886 * stats such as test duration, number
1887 * of tests passed / failed etc.
1888 *
1889 * @param {Runner} runner
1890 * @api public
1891 */
1892
1893 function Base(runner) {
1894 var self = this
1895 , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 }
1896 , failures = this.failures = [];
1897
1898 if (!runner) return;
1899 this.runner = runner;
1900
1901 runner.stats = stats;
1902
1903 runner.on('start', function(){
1904 stats.start = new Date;
1905 });
1906
1907 runner.on('suite', function(suite){
1908 stats.suites = stats.suites || 0;
1909 suite.root || stats.suites++;
1910 });
1911
1912 runner.on('test end', function(test){
1913 stats.tests = stats.tests || 0;
1914 stats.tests++;
1915 });
1916
1917 runner.on('pass', function(test){
1918 stats.passes = stats.passes || 0;
1919
1920 var medium = test.slow() / 2;
1921 test.speed = test.duration > test.slow()
1922 ? 'slow'
1923 : test.duration > medium
1924 ? 'medium'
1925 : 'fast';
1926
1927 stats.passes++;
1928 });
1929
1930 runner.on('fail', function(test, err){
1931 stats.failures = stats.failures || 0;
1932 stats.failures++;
1933 test.err = err;
1934 failures.push(test);
1935 });
1936
1937 runner.on('end', function(){
1938 stats.end = new Date;
1939 stats.duration = new Date - stats.start;
1940 });
1941
1942 runner.on('pending', function(){
1943 stats.pending++;
1944 });
1945 }
1946
1947 /**
1948 * Output common epilogue used by many of
1949 * the bundled reporters.
1950 *
1951 * @api public
1952 */
1953
1954 Base.prototype.epilogue = function(){
1955 var stats = this.stats
1956 , fmt
1957 , tests;
1958
1959 console.log();
1960
1961 function pluralize(n) {
1962 return 1 == n ? 'test' : 'tests';
1963 }
1964
1965 // failure
1966 if (stats.failures) {
1967 fmt = color('bright fail', ' ' + exports.symbols.err)
1968 + color('fail', ' %d of %d %s failed')
1969 + color('light', ':')
1970
1971 console.error(fmt,
1972 stats.failures,
1973 this.runner.total,
1974 pluralize(this.runner.total));
1975
1976 Base.list(this.failures);
1977 console.error();
1978 return;
1979 }
1980
1981 // pass
1982 fmt = color('bright pass', ' ')
1983 + color('green', ' %d %s complete')
1984 + color('light', ' (%s)');
1985
1986 console.log(fmt,
1987 stats.tests || 0,
1988 pluralize(stats.tests),
1989 ms(stats.duration));
1990
1991 // pending
1992 if (stats.pending) {
1993 fmt = color('pending', ' ')
1994 + color('pending', ' %d %s pending');
1995
1996 console.log(fmt, stats.pending, pluralize(stats.pending));
1997 }
1998
1999 console.log();
2000 };
2001
2002 /**
2003 * Pad the given `str` to `len`.
2004 *
2005 * @param {String} str
2006 * @param {String} len
2007 * @return {String}
2008 * @api private
2009 */
2010
2011 function pad(str, len) {
2012 str = String(str);
2013 return Array(len - str.length + 1).join(' ') + str;
2014 }
2015
2016 /**
2017 * Return a character diff for `err`.
2018 *
2019 * @param {Error} err
2020 * @return {String}
2021 * @api private
2022 */
2023
2024 function errorDiff(err, type, escape) {
2025 return diff['diff' + type](err.actual, err.expected).map(function(str){
2026 if (escape) {
2027 str.value = str.value
2028 .replace(/\t/g, '<tab>')
2029 .replace(/\r/g, '<CR>')
2030 .replace(/\n/g, '<LF>\n');
2031 }
2032 if (str.added) return colorLines('diff added', str.value);
2033 if (str.removed) return colorLines('diff removed', str.value);
2034 return str.value;
2035 }).join('');
2036 }
2037
2038 /**
2039 * Color lines for `str`, using the color `name`.
2040 *
2041 * @param {String} name
2042 * @param {String} str
2043 * @return {String}
2044 * @api private
2045 */
2046
2047 function colorLines(name, str) {
2048 return str.split('\n').map(function(str){
2049 return color(name, str);
2050 }).join('\n');
2051 }
2052
2053 }); // module: reporters/base.js
2054
2055 require.register("reporters/doc.js", function(module, exports, require){
2056
2057 /**
2058 * Module dependencies.
2059 */
2060
2061 var Base = require('./base')
2062 , utils = require('../utils');
2063
2064 /**
2065 * Expose `Doc`.
2066 */
2067
2068 exports = module.exports = Doc;
2069
2070 /**
2071 * Initialize a new `Doc` reporter.
2072 *
2073 * @param {Runner} runner
2074 * @api public
2075 */
2076
2077 function Doc(runner) {
2078 Base.call(this, runner);
2079
2080 var self = this
2081 , stats = this.stats
2082 , total = runner.total
2083 , indents = 2;
2084
2085 function indent() {
2086 return Array(indents).join(' ');
2087 }
2088
2089 runner.on('suite', function(suite){
2090 if (suite.root) return;
2091 ++indents;
2092 console.log('%s<section class="suite">', indent());
2093 ++indents;
2094 console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
2095 console.log('%s<dl>', indent());
2096 });
2097
2098 runner.on('suite end', function(suite){
2099 if (suite.root) return;
2100 console.log('%s</dl>', indent());
2101 --indents;
2102 console.log('%s</section>', indent());
2103 --indents;
2104 });
2105
2106 runner.on('pass', function(test){
2107 console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
2108 var code = utils.escape(utils.clean(test.fn.toString()));
2109 console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
2110 });
2111 }
2112
2113 }); // module: reporters/doc.js
2114
2115 require.register("reporters/dot.js", function(module, exports, require){
2116
2117 /**
2118 * Module dependencies.
2119 */
2120
2121 var Base = require('./base')
2122 , color = Base.color;
2123
2124 /**
2125 * Expose `Dot`.
2126 */
2127
2128 exports = module.exports = Dot;
2129
2130 /**
2131 * Initialize a new `Dot` matrix test reporter.
2132 *
2133 * @param {Runner} runner
2134 * @api public
2135 */
2136
2137 function Dot(runner) {
2138 Base.call(this, runner);
2139
2140 var self = this
2141 , stats = this.stats
2142 , width = Base.window.width * .75 | 0
2143 , n = 0;
2144
2145 runner.on('start', function(){
2146 process.stdout.write('\n ');
2147 });
2148
2149 runner.on('pending', function(test){
2150 process.stdout.write(color('pending', Base.symbols.dot));
2151 });
2152
2153 runner.on('pass', function(test){
2154 if (++n % width == 0) process.stdout.write('\n ');
2155 if ('slow' == test.speed) {
2156 process.stdout.write(color('bright yellow', Base.symbols.dot));
2157 } else {
2158 process.stdout.write(color(test.speed, Base.symbols.dot));
2159 }
2160 });
2161
2162 runner.on('fail', function(test, err){
2163 if (++n % width == 0) process.stdout.write('\n ');
2164 process.stdout.write(color('fail', Base.symbols.dot));
2165 });
2166
2167 runner.on('end', function(){
2168 console.log();
2169 self.epilogue();
2170 });
2171 }
2172
2173 /**
2174 * Inherit from `Base.prototype`.
2175 */
2176
2177 function F(){};
2178 F.prototype = Base.prototype;
2179 Dot.prototype = new F;
2180 Dot.prototype.constructor = Dot;
2181
2182 }); // module: reporters/dot.js
2183
2184 require.register("reporters/html-cov.js", function(module, exports, require){
2185
2186 /**
2187 * Module dependencies.
2188 */
2189
2190 var JSONCov = require('./json-cov')
2191 , fs = require('browser/fs');
2192
2193 /**
2194 * Expose `HTMLCov`.
2195 */
2196
2197 exports = module.exports = HTMLCov;
2198
2199 /**
2200 * Initialize a new `JsCoverage` reporter.
2201 *
2202 * @param {Runner} runner
2203 * @api public
2204 */
2205
2206 function HTMLCov(runner) {
2207 var jade = require('jade')
2208 , file = __dirname + '/templates/coverage.jade'
2209 , str = fs.readFileSync(file, 'utf8')
2210 , fn = jade.compile(str, { filename: file })
2211 , self = this;
2212
2213 JSONCov.call(this, runner, false);
2214
2215 runner.on('end', function(){
2216 process.stdout.write(fn({
2217 cov: self.cov
2218 , coverageClass: coverageClass
2219 }));
2220 });
2221 }
2222
2223 /**
2224 * Return coverage class for `n`.
2225 *
2226 * @return {String}
2227 * @api private
2228 */
2229
2230 function coverageClass(n) {
2231 if (n >= 75) return 'high';
2232 if (n >= 50) return 'medium';
2233 if (n >= 25) return 'low';
2234 return 'terrible';
2235 }
2236 }); // module: reporters/html-cov.js
2237
2238 require.register("reporters/html.js", function(module, exports, require){
2239
2240 /**
2241 * Module dependencies.
2242 */
2243
2244 var Base = require('./base')
2245 , utils = require('../utils')
2246 , Progress = require('../browser/progress')
2247 , escape = utils.escape;
2248
2249 /**
2250 * Save timer references to avoid Sinon interfering (see GH-237).
2251 */
2252
2253 var Date = global.Date
2254 , setTimeout = global.setTimeout
2255 , setInterval = global.setInterval
2256 , clearTimeout = global.clearTimeout
2257 , clearInterval = global.clearInterval;
2258
2259 /**
2260 * Expose `Doc`.
2261 */
2262
2263 exports = module.exports = HTML;
2264
2265 /**
2266 * Stats template.
2267 */
2268
2269 var statsTemplate = '<ul id="mocha-stats">'
2270 + '<li class="progress"><canvas width="40" height="40"></canvas></li>'
2271 + '<li class="passes"><a href="#">passes:</a> <em>0</em></li>'
2272 + '<li class="failures"><a href="#">failures:</a> <em>0</em></li>'
2273 + '<li class="duration">duration: <em>0</em>s</li>'
2274 + '</ul>';
2275
2276 /**
2277 * Initialize a new `Doc` reporter.
2278 *
2279 * @param {Runner} runner
2280 * @api public
2281 */
2282
2283 function HTML(runner, root) {
2284 Base.call(this, runner);
2285
2286 var self = this
2287 , stats = this.stats
2288 , total = runner.total
2289 , stat = fragment(statsTemplate)
2290 , items = stat.getElementsByTagName('li')
2291 , passes = items[1].getElementsByTagName('em')[0]
2292 , passesLink = items[1].getElementsByTagName('a')[0]
2293 , failures = items[2].getElementsByTagName('em')[0]
2294 , failuresLink = items[2].getElementsByTagName('a')[0]
2295 , duration = items[3].getElementsByTagName('em')[0]
2296 , canvas = stat.getElementsByTagName('canvas')[0]
2297 , report = fragment('<ul id="mocha-report"></ul>')
2298 , stack = [report]
2299 , progress
2300 , ctx
2301
2302 root = root || document.getElementById('mocha');
2303
2304 if (canvas.getContext) {
2305 var ratio = window.devicePixelRatio || 1;
2306 canvas.style.width = canvas.width;
2307 canvas.style.height = canvas.height;
2308 canvas.width *= ratio;
2309 canvas.height *= ratio;
2310 ctx = canvas.getContext('2d');
2311 ctx.scale(ratio, ratio);
2312 progress = new Progress;
2313 }
2314
2315 if (!root) return error('#mocha div missing, add it to your document');
2316
2317 // pass toggle
2318 on(passesLink, 'click', function(){
2319 unhide();
2320 var name = /pass/.test(report.className) ? '' : ' pass';
2321 report.className = report.className.replace(/fail|pass/g, '') + name;
2322 if (report.className.trim()) hideSuitesWithout('test pass');
2323 });
2324
2325 // failure toggle
2326 on(failuresLink, 'click', function(){
2327 unhide();
2328 var name = /fail/.test(report.className) ? '' : ' fail';
2329 report.className = report.className.replace(/fail|pass/g, '') + name;
2330 if (report.className.trim()) hideSuitesWithout('test fail');
2331 });
2332
2333 root.appendChild(stat);
2334 root.appendChild(report);
2335
2336 if (progress) progress.size(40);
2337
2338 runner.on('suite', function(suite){
2339 if (suite.root) return;
2340
2341 // suite
2342 var url = '?grep=' + encodeURIComponent(suite.fullTitle());
2343 var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, escape(suite.title));
2344
2345 // container
2346 stack[0].appendChild(el);
2347 stack.unshift(document.createElement('ul'));
2348 el.appendChild(stack[0]);
2349 });
2350
2351 runner.on('suite end', function(suite){
2352 if (suite.root) return;
2353 stack.shift();
2354 });
2355
2356 runner.on('fail', function(test, err){
2357 if ('hook' == test.type) runner.emit('test end', test);
2358 });
2359
2360 runner.on('test end', function(test){
2361 // TODO: add to stats
2362 var percent = stats.tests / this.total * 100 | 0;
2363 if (progress) progress.update(percent).draw(ctx);
2364
2365 // update stats
2366 var ms = new Date - stats.start;
2367 text(passes, stats.passes);
2368 text(failures, stats.failures);
2369 text(duration, (ms / 1000).toFixed(2));
2370
2371 // test
2372 if ('passed' == test.state) {
2373 var el = fragment('<li class="test pass %e"><h2>%e<span class="duration">%ems</span> <a href="?grep=%e" class="replay">‣</a></h2></li>', test.speed, test.title, test.duration, encodeURIComponent(test.fullTitle()));
2374 } else if (test.pending) {
2375 var el = fragment('<li class="test pass pending"><h2>%e</h2></li>', test.title);
2376 } else {
2377 var el = fragment('<li class="test fail"><h2>%e <a href="?grep=%e" class="replay">‣</a></h2></li>', test.title, encodeURIComponent(test.fullTitle()));
2378 var str = test.err.stack || test.err.toString();
2379
2380 // FF / Opera do not add the message
2381 if (!~str.indexOf(test.err.message)) {
2382 str = test.err.message + '\n' + str;
2383 }
2384
2385 // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
2386 // check for the result of the stringifying.
2387 if ('[object Error]' == str) str = test.err.message;
2388
2389 // Safari doesn't give you a stack. Let's at least provide a source line.
2390 if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) {
2391 str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")";
2392 }
2393
2394 el.appendChild(fragment('<pre class="error">%e</pre>', str));
2395 }
2396
2397 // toggle code
2398 // TODO: defer
2399 if (!test.pending) {
2400 var h2 = el.getElementsByTagName('h2')[0];
2401
2402 on(h2, 'click', function(){
2403 pre.style.display = 'none' == pre.style.display
2404 ? 'block'
2405 : 'none';
2406 });
2407
2408 var pre = fragment('<pre><code>%e</code></pre>', utils.clean(test.fn.toString()));
2409 el.appendChild(pre);
2410 pre.style.display = 'none';
2411 }
2412
2413 // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
2414 if (stack[0]) stack[0].appendChild(el);
2415 });
2416 }
2417
2418 /**
2419 * Display error `msg`.
2420 */
2421
2422 function error(msg) {
2423 document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
2424 }
2425
2426 /**
2427 * Return a DOM fragment from `html`.
2428 */
2429
2430 function fragment(html) {
2431 var args = arguments
2432 , div = document.createElement('div')
2433 , i = 1;
2434
2435 div.innerHTML = html.replace(/%([se])/g, function(_, type){
2436 switch (type) {
2437 case 's': return String(args[i++]);
2438 case 'e': return escape(args[i++]);
2439 }
2440 });
2441
2442 return div.firstChild;
2443 }
2444
2445 /**
2446 * Check for suites that do not have elements
2447 * with `classname`, and hide them.
2448 */
2449
2450 function hideSuitesWithout(classname) {
2451 var suites = document.getElementsByClassName('suite');
2452 for (var i = 0; i < suites.length; i++) {
2453 var els = suites[i].getElementsByClassName(classname);
2454 if (0 == els.length) suites[i].className += ' hidden';
2455 }
2456 }
2457
2458 /**
2459 * Unhide .hidden suites.
2460 */
2461
2462 function unhide() {
2463 var els = document.getElementsByClassName('suite hidden');
2464 for (var i = 0; i < els.length; ++i) {
2465 els[i].className = els[i].className.replace('suite hidden', 'suite');
2466 }
2467 }
2468
2469 /**
2470 * Set `el` text to `str`.
2471 */
2472
2473 function text(el, str) {
2474 if (el.textContent) {
2475 el.textContent = str;
2476 } else {
2477 el.innerText = str;
2478 }
2479 }
2480
2481 /**
2482 * Listen on `event` with callback `fn`.
2483 */
2484
2485 function on(el, event, fn) {
2486 if (el.addEventListener) {
2487 el.addEventListener(event, fn, false);
2488 } else {
2489 el.attachEvent('on' + event, fn);
2490 }
2491 }
2492
2493 }); // module: reporters/html.js
2494
2495 require.register("reporters/index.js", function(module, exports, require){
2496
2497 exports.Base = require('./base');
2498 exports.Dot = require('./dot');
2499 exports.Doc = require('./doc');
2500 exports.TAP = require('./tap');
2501 exports.JSON = require('./json');
2502 exports.HTML = require('./html');
2503 exports.List = require('./list');
2504 exports.Min = require('./min');
2505 exports.Spec = require('./spec');
2506 exports.Nyan = require('./nyan');
2507 exports.XUnit = require('./xunit');
2508 exports.Markdown = require('./markdown');
2509 exports.Progress = require('./progress');
2510 exports.Landing = require('./landing');
2511 exports.JSONCov = require('./json-cov');
2512 exports.HTMLCov = require('./html-cov');
2513 exports.JSONStream = require('./json-stream');
2514 exports.Teamcity = require('./teamcity');
2515
2516 }); // module: reporters/index.js
2517
2518 require.register("reporters/json-cov.js", function(module, exports, require){
2519
2520 /**
2521 * Module dependencies.
2522 */
2523
2524 var Base = require('./base');
2525
2526 /**
2527 * Expose `JSONCov`.
2528 */
2529
2530 exports = module.exports = JSONCov;
2531
2532 /**
2533 * Initialize a new `JsCoverage` reporter.
2534 *
2535 * @param {Runner} runner
2536 * @param {Boolean} output
2537 * @api public
2538 */
2539
2540 function JSONCov(runner, output) {
2541 var self = this
2542 , output = 1 == arguments.length ? true : output;
2543
2544 Base.call(this, runner);
2545
2546 var tests = []
2547 , failures = []
2548 , passes = [];
2549
2550 runner.on('test end', function(test){
2551 tests.push(test);
2552 });
2553
2554 runner.on('pass', function(test){
2555 passes.push(test);
2556 });
2557
2558 runner.on('fail', function(test){
2559 failures.push(test);
2560 });
2561
2562 runner.on('end', function(){
2563 var cov = global._$jscoverage || {};
2564 var result = self.cov = map(cov);
2565 result.stats = self.stats;
2566 result.tests = tests.map(clean);
2567 result.failures = failures.map(clean);
2568 result.passes = passes.map(clean);
2569 if (!output) return;
2570 process.stdout.write(JSON.stringify(result, null, 2 ));
2571 });
2572 }
2573
2574 /**
2575 * Map jscoverage data to a JSON structure
2576 * suitable for reporting.
2577 *
2578 * @param {Object} cov
2579 * @return {Object}
2580 * @api private
2581 */
2582
2583 function map(cov) {
2584 var ret = {
2585 instrumentation: 'node-jscoverage'
2586 , sloc: 0
2587 , hits: 0
2588 , misses: 0
2589 , coverage: 0
2590 , files: []
2591 };
2592
2593 for (var filename in cov) {
2594 var data = coverage(filename, cov[filename]);
2595 ret.files.push(data);
2596 ret.hits += data.hits;
2597 ret.misses += data.misses;
2598 ret.sloc += data.sloc;
2599 }
2600
2601 ret.files.sort(function(a, b) {
2602 return a.filename.localeCompare(b.filename);
2603 });
2604
2605 if (ret.sloc > 0) {
2606 ret.coverage = (ret.hits / ret.sloc) * 100;
2607 }
2608
2609 return ret;
2610 };
2611
2612 /**
2613 * Map jscoverage data for a single source file
2614 * to a JSON structure suitable for reporting.
2615 *
2616 * @param {String} filename name of the source file
2617 * @param {Object} data jscoverage coverage data
2618 * @return {Object}
2619 * @api private
2620 */
2621
2622 function coverage(filename, data) {
2623 var ret = {
2624 filename: filename,
2625 coverage: 0,
2626 hits: 0,
2627 misses: 0,
2628 sloc: 0,
2629 source: {}
2630 };
2631
2632 data.source.forEach(function(line, num){
2633 num++;
2634
2635 if (data[num] === 0) {
2636 ret.misses++;
2637 ret.sloc++;
2638 } else if (data[num] !== undefined) {
2639 ret.hits++;
2640 ret.sloc++;
2641 }
2642
2643 ret.source[num] = {
2644 source: line
2645 , coverage: data[num] === undefined
2646 ? ''
2647 : data[num]
2648 };
2649 });
2650
2651 ret.coverage = ret.hits / ret.sloc * 100;
2652
2653 return ret;
2654 }
2655
2656 /**
2657 * Return a plain-object representation of `test`
2658 * free of cyclic properties etc.
2659 *
2660 * @param {Object} test
2661 * @return {Object}
2662 * @api private
2663 */
2664
2665 function clean(test) {
2666 return {
2667 title: test.title
2668 , fullTitle: test.fullTitle()
2669 , duration: test.duration
2670 }
2671 }
2672
2673 }); // module: reporters/json-cov.js
2674
2675 require.register("reporters/json-stream.js", function(module, exports, require){
2676
2677 /**
2678 * Module dependencies.
2679 */
2680
2681 var Base = require('./base')
2682 , color = Base.color;
2683
2684 /**
2685 * Expose `List`.
2686 */
2687
2688 exports = module.exports = List;
2689
2690 /**
2691 * Initialize a new `List` test reporter.
2692 *
2693 * @param {Runner} runner
2694 * @api public
2695 */
2696
2697 function List(runner) {
2698 Base.call(this, runner);
2699
2700 var self = this
2701 , stats = this.stats
2702 , total = runner.total;
2703
2704 runner.on('start', function(){
2705 console.log(JSON.stringify(['start', { total: total }]));
2706 });
2707
2708 runner.on('pass', function(test){
2709 console.log(JSON.stringify(['pass', clean(test)]));
2710 });
2711
2712 runner.on('fail', function(test, err){
2713 console.log(JSON.stringify(['fail', clean(test)]));
2714 });
2715
2716 runner.on('end', function(){
2717 process.stdout.write(JSON.stringify(['end', self.stats]));
2718 });
2719 }
2720
2721 /**
2722 * Return a plain-object representation of `test`
2723 * free of cyclic properties etc.
2724 *
2725 * @param {Object} test
2726 * @return {Object}
2727 * @api private
2728 */
2729
2730 function clean(test) {
2731 return {
2732 title: test.title
2733 , fullTitle: test.fullTitle()
2734 , duration: test.duration
2735 }
2736 }
2737 }); // module: reporters/json-stream.js
2738
2739 require.register("reporters/json.js", function(module, exports, require){
2740
2741 /**
2742 * Module dependencies.
2743 */
2744
2745 var Base = require('./base')
2746 , cursor = Base.cursor
2747 , color = Base.color;
2748
2749 /**
2750 * Expose `JSON`.
2751 */
2752
2753 exports = module.exports = JSONReporter;
2754
2755 /**
2756 * Initialize a new `JSON` reporter.
2757 *
2758 * @param {Runner} runner
2759 * @api public
2760 */
2761
2762 function JSONReporter(runner) {
2763 var self = this;
2764 Base.call(this, runner);
2765
2766 var tests = []
2767 , failures = []
2768 , passes = [];
2769
2770 runner.on('test end', function(test){
2771 tests.push(test);
2772 });
2773
2774 runner.on('pass', function(test){
2775 passes.push(test);
2776 });
2777
2778 runner.on('fail', function(test){
2779 failures.push(test);
2780 });
2781
2782 runner.on('end', function(){
2783 var obj = {
2784 stats: self.stats
2785 , tests: tests.map(clean)
2786 , failures: failures.map(clean)
2787 , passes: passes.map(clean)
2788 };
2789
2790 process.stdout.write(JSON.stringify(obj, null, 2));
2791 });
2792 }
2793
2794 /**
2795 * Return a plain-object representation of `test`
2796 * free of cyclic properties etc.
2797 *
2798 * @param {Object} test
2799 * @return {Object}
2800 * @api private
2801 */
2802
2803 function clean(test) {
2804 return {
2805 title: test.title
2806 , fullTitle: test.fullTitle()
2807 , duration: test.duration
2808 }
2809 }
2810 }); // module: reporters/json.js
2811
2812 require.register("reporters/landing.js", function(module, exports, require){
2813
2814 /**
2815 * Module dependencies.
2816 */
2817
2818 var Base = require('./base')
2819 , cursor = Base.cursor
2820 , color = Base.color;
2821
2822 /**
2823 * Expose `Landing`.
2824 */
2825
2826 exports = module.exports = Landing;
2827
2828 /**
2829 * Airplane color.
2830 */
2831
2832 Base.colors.plane = 0;
2833
2834 /**
2835 * Airplane crash color.
2836 */
2837
2838 Base.colors['plane crash'] = 31;
2839
2840 /**
2841 * Runway color.
2842 */
2843
2844 Base.colors.runway = 90;
2845
2846 /**
2847 * Initialize a new `Landing` reporter.
2848 *
2849 * @param {Runner} runner
2850 * @api public
2851 */
2852
2853 function Landing(runner) {
2854 Base.call(this, runner);
2855
2856 var self = this
2857 , stats = this.stats
2858 , width = Base.window.width * .75 | 0
2859 , total = runner.total
2860 , stream = process.stdout
2861 , plane = color('plane', '✈')
2862 , crashed = -1
2863 , n = 0;
2864
2865 function runway() {
2866 var buf = Array(width).join('-');
2867 return ' ' + color('runway', buf);
2868 }
2869
2870 runner.on('start', function(){
2871 stream.write('\n ');
2872 cursor.hide();
2873 });
2874
2875 runner.on('test end', function(test){
2876 // check if the plane crashed
2877 var col = -1 == crashed
2878 ? width * ++n / total | 0
2879 : crashed;
2880
2881 // show the crash
2882 if ('failed' == test.state) {
2883 plane = color('plane crash', '✈');
2884 crashed = col;
2885 }
2886
2887 // render landing strip
2888 stream.write('\u001b[4F\n\n');
2889 stream.write(runway());
2890 stream.write('\n ');
2891 stream.write(color('runway', Array(col).join('⋅')));
2892 stream.write(plane)
2893 stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
2894 stream.write(runway());
2895 stream.write('\u001b[0m');
2896 });
2897
2898 runner.on('end', function(){
2899 cursor.show();
2900 console.log();
2901 self.epilogue();
2902 });
2903 }
2904
2905 /**
2906 * Inherit from `Base.prototype`.
2907 */
2908
2909 function F(){};
2910 F.prototype = Base.prototype;
2911 Landing.prototype = new F;
2912 Landing.prototype.constructor = Landing;
2913
2914 }); // module: reporters/landing.js
2915
2916 require.register("reporters/list.js", function(module, exports, require){
2917
2918 /**
2919 * Module dependencies.
2920 */
2921
2922 var Base = require('./base')
2923 , cursor = Base.cursor
2924 , color = Base.color;
2925
2926 /**
2927 * Expose `List`.
2928 */
2929
2930 exports = module.exports = List;
2931
2932 /**
2933 * Initialize a new `List` test reporter.
2934 *
2935 * @param {Runner} runner
2936 * @api public
2937 */
2938
2939 function List(runner) {
2940 Base.call(this, runner);
2941
2942 var self = this
2943 , stats = this.stats
2944 , n = 0;
2945
2946 runner.on('start', function(){
2947 console.log();
2948 });
2949
2950 runner.on('test', function(test){
2951 process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
2952 });
2953
2954 runner.on('pending', function(test){
2955 var fmt = color('checkmark', ' -')
2956 + color('pending', ' %s');
2957 console.log(fmt, test.fullTitle());
2958 });
2959
2960 runner.on('pass', function(test){
2961 var fmt = color('checkmark', ' '+Base.symbols.dot)
2962 + color('pass', ' %s: ')
2963 + color(test.speed, '%dms');
2964 cursor.CR();
2965 console.log(fmt, test.fullTitle(), test.duration);
2966 });
2967
2968 runner.on('fail', function(test, err){
2969 cursor.CR();
2970 console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());
2971 });
2972
2973 runner.on('end', self.epilogue.bind(self));
2974 }
2975
2976 /**
2977 * Inherit from `Base.prototype`.
2978 */
2979
2980 function F(){};
2981 F.prototype = Base.prototype;
2982 List.prototype = new F;
2983 List.prototype.constructor = List;
2984
2985
2986 }); // module: reporters/list.js
2987
2988 require.register("reporters/markdown.js", function(module, exports, require){
2989 /**
2990 * Module dependencies.
2991 */
2992
2993 var Base = require('./base')
2994 , utils = require('../utils');
2995
2996 /**
2997 * Expose `Markdown`.
2998 */
2999
3000 exports = module.exports = Markdown;
3001
3002 /**
3003 * Initialize a new `Markdown` reporter.
3004 *
3005 * @param {Runner} runner
3006 * @api public
3007 */
3008
3009 function Markdown(runner) {
3010 Base.call(this, runner);
3011
3012 var self = this
3013 , stats = this.stats
3014 , level = 0
3015 , buf = '';
3016
3017 function title(str) {
3018 return Array(level).join('#') + ' ' + str;
3019 }
3020
3021 function indent() {
3022 return Array(level).join(' ');
3023 }
3024
3025 function mapTOC(suite, obj) {
3026 var ret = obj;
3027 obj = obj[suite.title] = obj[suite.title] || { suite: suite };
3028 suite.suites.forEach(function(suite){
3029 mapTOC(suite, obj);
3030 });
3031 return ret;
3032 }
3033
3034 function stringifyTOC(obj, level) {
3035 ++level;
3036 var buf = '';
3037 var link;
3038 for (var key in obj) {
3039 if ('suite' == key) continue;
3040 if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
3041 if (key) buf += Array(level).join(' ') + link;
3042 buf += stringifyTOC(obj[key], level);
3043 }
3044 --level;
3045 return buf;
3046 }
3047
3048 function generateTOC(suite) {
3049 var obj = mapTOC(suite, {});
3050 return stringifyTOC(obj, 0);
3051 }
3052
3053 generateTOC(runner.suite);
3054
3055 runner.on('suite', function(suite){
3056 ++level;
3057 var slug = utils.slug(suite.fullTitle());
3058 buf += '<a name="' + slug + '"></a>' + '\n';
3059 buf += title(suite.title) + '\n';
3060 });
3061
3062 runner.on('suite end', function(suite){
3063 --level;
3064 });
3065
3066 runner.on('pass', function(test){
3067 var code = utils.clean(test.fn.toString());
3068 buf += test.title + '.\n';
3069 buf += '\n```js\n';
3070 buf += code + '\n';
3071 buf += '```\n\n';
3072 });
3073
3074 runner.on('end', function(){
3075 process.stdout.write('# TOC\n');
3076 process.stdout.write(generateTOC(runner.suite));
3077 process.stdout.write(buf);
3078 });
3079 }
3080 }); // module: reporters/markdown.js
3081
3082 require.register("reporters/min.js", function(module, exports, require){
3083
3084 /**
3085 * Module dependencies.
3086 */
3087
3088 var Base = require('./base');
3089
3090 /**
3091 * Expose `Min`.
3092 */
3093
3094 exports = module.exports = Min;
3095
3096 /**
3097 * Initialize a new `Min` minimal test reporter (best used with --watch).
3098 *
3099 * @param {Runner} runner
3100 * @api public
3101 */
3102
3103 function Min(runner) {
3104 Base.call(this, runner);
3105
3106 runner.on('start', function(){
3107 // clear screen
3108 process.stdout.write('\u001b[2J');
3109 // set cursor position
3110 process.stdout.write('\u001b[1;3H');
3111 });
3112
3113 runner.on('end', this.epilogue.bind(this));
3114 }
3115
3116 /**
3117 * Inherit from `Base.prototype`.
3118 */
3119
3120 function F(){};
3121 F.prototype = Base.prototype;
3122 Min.prototype = new F;
3123 Min.prototype.constructor = Min;
3124
3125
3126 }); // module: reporters/min.js
3127
3128 require.register("reporters/nyan.js", function(module, exports, require){
3129 /**
3130 * Module dependencies.
3131 */
3132
3133 var Base = require('./base')
3134 , color = Base.color;
3135
3136 /**
3137 * Expose `Dot`.
3138 */
3139
3140 exports = module.exports = NyanCat;
3141
3142 /**
3143 * Initialize a new `Dot` matrix test reporter.
3144 *
3145 * @param {Runner} runner
3146 * @api public
3147 */
3148
3149 function NyanCat(runner) {
3150 Base.call(this, runner);
3151
3152 var self = this
3153 , stats = this.stats
3154 , width = Base.window.width * .75 | 0
3155 , rainbowColors = this.rainbowColors = self.generateColors()
3156 , colorIndex = this.colorIndex = 0
3157 , numerOfLines = this.numberOfLines = 4
3158 , trajectories = this.trajectories = [[], [], [], []]
3159 , nyanCatWidth = this.nyanCatWidth = 11
3160 , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth)
3161 , scoreboardWidth = this.scoreboardWidth = 5
3162 , tick = this.tick = 0
3163 , n = 0;
3164
3165 runner.on('start', function(){
3166 Base.cursor.hide();
3167 self.draw('start');
3168 });
3169
3170 runner.on('pending', function(test){
3171 self.draw('pending');
3172 });
3173
3174 runner.on('pass', function(test){
3175 self.draw('pass');
3176 });
3177
3178 runner.on('fail', function(test, err){
3179 self.draw('fail');
3180 });
3181
3182 runner.on('end', function(){
3183 Base.cursor.show();
3184 for (var i = 0; i < self.numberOfLines; i++) write('\n');
3185 self.epilogue();
3186 });
3187 }
3188
3189 /**
3190 * Draw the nyan cat with runner `status`.
3191 *
3192 * @param {String} status
3193 * @api private
3194 */
3195
3196 NyanCat.prototype.draw = function(status){
3197 this.appendRainbow();
3198 this.drawScoreboard();
3199 this.drawRainbow();
3200 this.drawNyanCat(status);
3201 this.tick = !this.tick;
3202 };
3203
3204 /**
3205 * Draw the "scoreboard" showing the number
3206 * of passes, failures and pending tests.
3207 *
3208 * @api private
3209 */
3210
3211 NyanCat.prototype.drawScoreboard = function(){
3212 var stats = this.stats;
3213 var colors = Base.colors;
3214
3215 function draw(color, n) {
3216 write(' ');
3217 write('\u001b[' + color + 'm' + n + '\u001b[0m');
3218 write('\n');
3219 }
3220
3221 draw(colors.green, stats.passes);
3222 draw(colors.fail, stats.failures);
3223 draw(colors.pending, stats.pending);
3224 write('\n');
3225
3226 this.cursorUp(this.numberOfLines);
3227 };
3228
3229 /**
3230 * Append the rainbow.
3231 *
3232 * @api private
3233 */
3234
3235 NyanCat.prototype.appendRainbow = function(){
3236 var segment = this.tick ? '_' : '-';
3237 var rainbowified = this.rainbowify(segment);
3238
3239 for (var index = 0; index < this.numberOfLines; index++) {
3240 var trajectory = this.trajectories[index];
3241 if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift();
3242 trajectory.push(rainbowified);
3243 }
3244 };
3245
3246 /**
3247 * Draw the rainbow.
3248 *
3249 * @api private
3250 */
3251
3252 NyanCat.prototype.drawRainbow = function(){
3253 var self = this;
3254
3255 this.trajectories.forEach(function(line, index) {
3256 write('\u001b[' + self.scoreboardWidth + 'C');
3257 write(line.join(''));
3258 write('\n');
3259 });
3260
3261 this.cursorUp(this.numberOfLines);
3262 };
3263
3264 /**
3265 * Draw the nyan cat with `status`.
3266 *
3267 * @param {String} status
3268 * @api private
3269 */
3270
3271 NyanCat.prototype.drawNyanCat = function(status) {
3272 var self = this;
3273 var startWidth = this.scoreboardWidth + this.trajectories[0].length;
3274 var color = '\u001b[' + startWidth + 'C';
3275 var padding = '';
3276
3277 write(color);
3278 write('_,------,');
3279 write('\n');
3280
3281 write(color);
3282 padding = self.tick ? ' ' : ' ';
3283 write('_|' + padding + '/\\_/\\ ');
3284 write('\n');
3285
3286 write(color);
3287 padding = self.tick ? '_' : '__';
3288 var tail = self.tick ? '~' : '^';
3289 var face;
3290 switch (status) {
3291 case 'pass':
3292 face = '( ^ .^)';
3293 break;
3294 case 'fail':
3295 face = '( o .o)';
3296 break;
3297 default:
3298 face = '( - .-)';
3299 }
3300 write(tail + '|' + padding + face + ' ');
3301 write('\n');
3302
3303 write(color);
3304 padding = self.tick ? ' ' : ' ';
3305 write(padding + '"" "" ');
3306 write('\n');
3307
3308 this.cursorUp(this.numberOfLines);
3309 };
3310
3311 /**
3312 * Move cursor up `n`.
3313 *
3314 * @param {Number} n
3315 * @api private
3316 */
3317
3318 NyanCat.prototype.cursorUp = function(n) {
3319 write('\u001b[' + n + 'A');
3320 };
3321
3322 /**
3323 * Move cursor down `n`.
3324 *
3325 * @param {Number} n
3326 * @api private
3327 */
3328
3329 NyanCat.prototype.cursorDown = function(n) {
3330 write('\u001b[' + n + 'B');
3331 };
3332
3333 /**
3334 * Generate rainbow colors.
3335 *
3336 * @return {Array}
3337 * @api private
3338 */
3339
3340 NyanCat.prototype.generateColors = function(){
3341 var colors = [];
3342
3343 for (var i = 0; i < (6 * 7); i++) {
3344 var pi3 = Math.floor(Math.PI / 3);
3345 var n = (i * (1.0 / 6));
3346 var r = Math.floor(3 * Math.sin(n) + 3);
3347 var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
3348 var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
3349 colors.push(36 * r + 6 * g + b + 16);
3350 }
3351
3352 return colors;
3353 };
3354
3355 /**
3356 * Apply rainbow to the given `str`.
3357 *
3358 * @param {String} str
3359 * @return {String}
3360 * @api private
3361 */
3362
3363 NyanCat.prototype.rainbowify = function(str){
3364 var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
3365 this.colorIndex += 1;
3366 return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
3367 };
3368
3369 /**
3370 * Stdout helper.
3371 */
3372
3373 function write(string) {
3374 process.stdout.write(string);
3375 }
3376
3377 /**
3378 * Inherit from `Base.prototype`.
3379 */
3380
3381 function F(){};
3382 F.prototype = Base.prototype;
3383 NyanCat.prototype = new F;
3384 NyanCat.prototype.constructor = NyanCat;
3385
3386
3387 }); // module: reporters/nyan.js
3388
3389 require.register("reporters/progress.js", function(module, exports, require){
3390
3391 /**
3392 * Module dependencies.
3393 */
3394
3395 var Base = require('./base')
3396 , cursor = Base.cursor
3397 , color = Base.color;
3398
3399 /**
3400 * Expose `Progress`.
3401 */
3402
3403 exports = module.exports = Progress;
3404
3405 /**
3406 * General progress bar color.
3407 */
3408
3409 Base.colors.progress = 90;
3410
3411 /**
3412 * Initialize a new `Progress` bar test reporter.
3413 *
3414 * @param {Runner} runner
3415 * @param {Object} options
3416 * @api public
3417 */
3418
3419 function Progress(runner, options) {
3420 Base.call(this, runner);
3421
3422 var self = this
3423 , options = options || {}
3424 , stats = this.stats
3425 , width = Base.window.width * .50 | 0
3426 , total = runner.total
3427 , complete = 0
3428 , max = Math.max;
3429
3430 // default chars
3431 options.open = options.open || '[';
3432 options.complete = options.complete || '▬';
3433 options.incomplete = options.incomplete || Base.symbols.dot;
3434 options.close = options.close || ']';
3435 options.verbose = false;
3436
3437 // tests started
3438 runner.on('start', function(){
3439 console.log();
3440 cursor.hide();
3441 });
3442
3443 // tests complete
3444 runner.on('test end', function(){
3445 complete++;
3446 var incomplete = total - complete
3447 , percent = complete / total
3448 , n = width * percent | 0
3449 , i = width - n;
3450
3451 cursor.CR();
3452 process.stdout.write('\u001b[J');
3453 process.stdout.write(color('progress', ' ' + options.open));
3454 process.stdout.write(Array(n).join(options.complete));
3455 process.stdout.write(Array(i).join(options.incomplete));
3456 process.stdout.write(color('progress', options.close));
3457 if (options.verbose) {
3458 process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
3459 }
3460 });
3461
3462 // tests are complete, output some stats
3463 // and the failures if any
3464 runner.on('end', function(){
3465 cursor.show();
3466 console.log();
3467 self.epilogue();
3468 });
3469 }
3470
3471 /**
3472 * Inherit from `Base.prototype`.
3473 */
3474
3475 function F(){};
3476 F.prototype = Base.prototype;
3477 Progress.prototype = new F;
3478 Progress.prototype.constructor = Progress;
3479
3480
3481 }); // module: reporters/progress.js
3482
3483 require.register("reporters/spec.js", function(module, exports, require){
3484
3485 /**
3486 * Module dependencies.
3487 */
3488
3489 var Base = require('./base')
3490 , cursor = Base.cursor
3491 , color = Base.color;
3492
3493 /**
3494 * Expose `Spec`.
3495 */
3496
3497 exports = module.exports = Spec;
3498
3499 /**
3500 * Initialize a new `Spec` test reporter.
3501 *
3502 * @param {Runner} runner
3503 * @api public
3504 */
3505
3506 function Spec(runner) {
3507 Base.call(this, runner);
3508
3509 var self = this
3510 , stats = this.stats
3511 , indents = 0
3512 , n = 0;
3513
3514 function indent() {
3515 return Array(indents).join(' ')
3516 }
3517
3518 runner.on('start', function(){
3519 console.log();
3520 });
3521
3522 runner.on('suite', function(suite){
3523 ++indents;
3524 console.log(color('suite', '%s%s'), indent(), suite.title);
3525 });
3526
3527 runner.on('suite end', function(suite){
3528 --indents;
3529 if (1 == indents) console.log();
3530 });
3531
3532 runner.on('test', function(test){
3533 process.stdout.write(indent() + color('pass', ' ◦ ' + test.title + ': '));
3534 });
3535
3536 runner.on('pending', function(test){
3537 var fmt = indent() + color('pending', ' - %s');
3538 console.log(fmt, test.title);
3539 });
3540
3541 runner.on('pass', function(test){
3542 if ('fast' == test.speed) {
3543 var fmt = indent()
3544 + color('checkmark', ' ' + Base.symbols.ok)
3545 + color('pass', ' %s ');
3546 cursor.CR();
3547 console.log(fmt, test.title);
3548 } else {
3549 var fmt = indent()
3550 + color('checkmark', ' ' + Base.symbols.ok)
3551 + color('pass', ' %s ')
3552 + color(test.speed, '(%dms)');
3553 cursor.CR();
3554 console.log(fmt, test.title, test.duration);
3555 }
3556 });
3557
3558 runner.on('fail', function(test, err){
3559 cursor.CR();
3560 console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
3561 });
3562
3563 runner.on('end', self.epilogue.bind(self));
3564 }
3565
3566 /**
3567 * Inherit from `Base.prototype`.
3568 */
3569
3570 function F(){};
3571 F.prototype = Base.prototype;
3572 Spec.prototype = new F;
3573 Spec.prototype.constructor = Spec;
3574
3575
3576 }); // module: reporters/spec.js
3577
3578 require.register("reporters/tap.js", function(module, exports, require){
3579
3580 /**
3581 * Module dependencies.
3582 */
3583
3584 var Base = require('./base')
3585 , cursor = Base.cursor
3586 , color = Base.color;
3587
3588 /**
3589 * Expose `TAP`.
3590 */
3591
3592 exports = module.exports = TAP;
3593
3594 /**
3595 * Initialize a new `TAP` reporter.
3596 *
3597 * @param {Runner} runner
3598 * @api public
3599 */
3600
3601 function TAP(runner) {
3602 Base.call(this, runner);
3603
3604 var self = this
3605 , stats = this.stats
3606 , n = 1
3607 , passes = 0
3608 , failures = 0;
3609
3610 runner.on('start', function(){
3611 var total = runner.grepTotal(runner.suite);
3612 console.log('%d..%d', 1, total);
3613 });
3614
3615 runner.on('test end', function(){
3616 ++n;
3617 });
3618
3619 runner.on('pending', function(test){
3620 console.log('ok %d %s # SKIP -', n, title(test));
3621 });
3622
3623 runner.on('pass', function(test){
3624 passes++;
3625 console.log('ok %d %s', n, title(test));
3626 });
3627
3628 runner.on('fail', function(test, err){
3629 failures++;
3630 console.log('not ok %d %s', n, title(test));
3631 if (err.stack) console.log(err.stack.replace(/^/gm, ' '));
3632 });
3633
3634 runner.on('end', function(){
3635 console.log('# tests ' + (passes + failures));
3636 console.log('# pass ' + passes);
3637 console.log('# fail ' + failures);
3638 });
3639 }
3640
3641 /**
3642 * Return a TAP-safe title of `test`
3643 *
3644 * @param {Object} test
3645 * @return {String}
3646 * @api private
3647 */
3648
3649 function title(test) {
3650 return test.fullTitle().replace(/#/g, '');
3651 }
3652
3653 }); // module: reporters/tap.js
3654
3655 require.register("reporters/teamcity.js", function(module, exports, require){
3656
3657 /**
3658 * Module dependencies.
3659 */
3660
3661 var Base = require('./base');
3662
3663 /**
3664 * Expose `Teamcity`.
3665 */
3666
3667 exports = module.exports = Teamcity;
3668
3669 /**
3670 * Initialize a new `Teamcity` reporter.
3671 *
3672 * @param {Runner} runner
3673 * @api public
3674 */
3675
3676 function Teamcity(runner) {
3677 Base.call(this, runner);
3678 var stats = this.stats;
3679
3680 runner.on('start', function() {
3681 console.log("##teamcity[testSuiteStarted name='mocha.suite']");
3682 });
3683
3684 runner.on('test', function(test) {
3685 console.log("##teamcity[testStarted name='" + escape(test.fullTitle()) + "']");
3686 });
3687
3688 runner.on('fail', function(test, err) {
3689 console.log("##teamcity[testFailed name='" + escape(test.fullTitle()) + "' message='" + escape(err.message) + "']");
3690 });
3691
3692 runner.on('pending', function(test) {
3693 console.log("##teamcity[testIgnored name='" + escape(test.fullTitle()) + "' message='pending']");
3694 });
3695
3696 runner.on('test end', function(test) {
3697 console.log("##teamcity[testFinished name='" + escape(test.fullTitle()) + "' duration='" + test.duration + "']");
3698 });
3699
3700 runner.on('end', function() {
3701 console.log("##teamcity[testSuiteFinished name='mocha.suite' duration='" + stats.duration + "']");
3702 });
3703 }
3704
3705 /**
3706 * Escape the given `str`.
3707 */
3708
3709 function escape(str) {
3710 return str
3711 .replace(/\|/g, "||")
3712 .replace(/\n/g, "|n")
3713 .replace(/\r/g, "|r")
3714 .replace(/\[/g, "|[")
3715 .replace(/\]/g, "|]")
3716 .replace(/\u0085/g, "|x")
3717 .replace(/\u2028/g, "|l")
3718 .replace(/\u2029/g, "|p")
3719 .replace(/'/g, "|'");
3720 }
3721
3722 }); // module: reporters/teamcity.js
3723
3724 require.register("reporters/xunit.js", function(module, exports, require){
3725
3726 /**
3727 * Module dependencies.
3728 */
3729
3730 var Base = require('./base')
3731 , utils = require('../utils')
3732 , escape = utils.escape;
3733
3734 /**
3735 * Save timer references to avoid Sinon interfering (see GH-237).
3736 */
3737
3738 var Date = global.Date
3739 , setTimeout = global.setTimeout
3740 , setInterval = global.setInterval
3741 , clearTimeout = global.clearTimeout
3742 , clearInterval = global.clearInterval;
3743
3744 /**
3745 * Expose `XUnit`.
3746 */
3747
3748 exports = module.exports = XUnit;
3749
3750 /**
3751 * Initialize a new `XUnit` reporter.
3752 *
3753 * @param {Runner} runner
3754 * @api public
3755 */
3756
3757 function XUnit(runner) {
3758 Base.call(this, runner);
3759 var stats = this.stats
3760 , tests = []
3761 , self = this;
3762
3763 runner.on('pass', function(test){
3764 tests.push(test);
3765 });
3766
3767 runner.on('fail', function(test){
3768 tests.push(test);
3769 });
3770
3771 runner.on('end', function(){
3772 console.log(tag('testsuite', {
3773 name: 'Mocha Tests'
3774 , tests: stats.tests
3775 , failures: stats.failures
3776 , errors: stats.failures
3777 , skip: stats.tests - stats.failures - stats.passes
3778 , timestamp: (new Date).toUTCString()
3779 , time: stats.duration / 1000
3780 }, false));
3781
3782 tests.forEach(test);
3783 console.log('</testsuite>');
3784 });
3785 }
3786
3787 /**
3788 * Inherit from `Base.prototype`.
3789 */
3790
3791 function F(){};
3792 F.prototype = Base.prototype;
3793 XUnit.prototype = new F;
3794 XUnit.prototype.constructor = XUnit;
3795
3796
3797 /**
3798 * Output tag for the given `test.`
3799 */
3800
3801 function test(test) {
3802 var attrs = {
3803 classname: test.parent.fullTitle()
3804 , name: test.title
3805 , time: test.duration / 1000
3806 };
3807
3808 if ('failed' == test.state) {
3809 var err = test.err;
3810 attrs.message = escape(err.message);
3811 console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack))));
3812 } else if (test.pending) {
3813 console.log(tag('testcase', attrs, false, tag('skipped', {}, true)));
3814 } else {
3815 console.log(tag('testcase', attrs, true) );
3816 }
3817 }
3818
3819 /**
3820 * HTML tag helper.
3821 */
3822
3823 function tag(name, attrs, close, content) {
3824 var end = close ? '/>' : '>'
3825 , pairs = []
3826 , tag;
3827
3828 for (var key in attrs) {
3829 pairs.push(key + '="' + escape(attrs[key]) + '"');
3830 }
3831
3832 tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
3833 if (content) tag += content + '</' + name + end;
3834 return tag;
3835 }
3836
3837 /**
3838 * Return cdata escaped CDATA `str`.
3839 */
3840
3841 function cdata(str) {
3842 return '<![CDATA[' + escape(str) + ']]>';
3843 }
3844
3845 }); // module: reporters/xunit.js
3846
3847 require.register("runnable.js", function(module, exports, require){
3848
3849 /**
3850 * Module dependencies.
3851 */
3852
3853 var EventEmitter = require('browser/events').EventEmitter
3854 , debug = require('browser/debug')('mocha:runnable')
3855 , milliseconds = require('./ms');
3856
3857 /**
3858 * Save timer references to avoid Sinon interfering (see GH-237).
3859 */
3860
3861 var Date = global.Date
3862 , setTimeout = global.setTimeout
3863 , setInterval = global.setInterval
3864 , clearTimeout = global.clearTimeout
3865 , clearInterval = global.clearInterval;
3866
3867 /**
3868 * Object#toString().
3869 */
3870
3871 var toString = Object.prototype.toString;
3872
3873 /**
3874 * Expose `Runnable`.
3875 */
3876
3877 module.exports = Runnable;
3878
3879 /**
3880 * Initialize a new `Runnable` with the given `title` and callback `fn`.
3881 *
3882 * @param {String} title
3883 * @param {Function} fn
3884 * @api private
3885 */
3886
3887 function Runnable(title, fn) {
3888 this.title = title;
3889 this.fn = fn;
3890 this.async = fn && fn.length;
3891 this.sync = ! this.async;
3892 this._timeout = 2000;
3893 this._slow = 75;
3894 this.timedOut = false;
3895 }
3896
3897 /**
3898 * Inherit from `EventEmitter.prototype`.
3899 */
3900
3901 function F(){};
3902 F.prototype = EventEmitter.prototype;
3903 Runnable.prototype = new F;
3904 Runnable.prototype.constructor = Runnable;
3905
3906
3907 /**
3908 * Set & get timeout `ms`.
3909 *
3910 * @param {Number|String} ms
3911 * @return {Runnable|Number} ms or self
3912 * @api private
3913 */
3914
3915 Runnable.prototype.timeout = function(ms){
3916 if (0 == arguments.length) return this._timeout;
3917 if ('string' == typeof ms) ms = milliseconds(ms);
3918 debug('timeout %d', ms);
3919 this._timeout = ms;
3920 if (this.timer) this.resetTimeout();
3921 return this;
3922 };
3923
3924 /**
3925 * Set & get slow `ms`.
3926 *
3927 * @param {Number|String} ms
3928 * @return {Runnable|Number} ms or self
3929 * @api private
3930 */
3931
3932 Runnable.prototype.slow = function(ms){
3933 if (0 === arguments.length) return this._slow;
3934 if ('string' == typeof ms) ms = milliseconds(ms);
3935 debug('timeout %d', ms);
3936 this._slow = ms;
3937 return this;
3938 };
3939
3940 /**
3941 * Return the full title generated by recursively
3942 * concatenating the parent's full title.
3943 *
3944 * @return {String}
3945 * @api public
3946 */
3947
3948 Runnable.prototype.fullTitle = function(){
3949 return this.parent.fullTitle() + ' ' + this.title;
3950 };
3951
3952 /**
3953 * Clear the timeout.
3954 *
3955 * @api private
3956 */
3957
3958 Runnable.prototype.clearTimeout = function(){
3959 clearTimeout(this.timer);
3960 };
3961
3962 /**
3963 * Inspect the runnable void of private properties.
3964 *
3965 * @return {String}
3966 * @api private
3967 */
3968
3969 Runnable.prototype.inspect = function(){
3970 return JSON.stringify(this, function(key, val){
3971 if ('_' == key[0]) return;
3972 if ('parent' == key) return '#<Suite>';
3973 if ('ctx' == key) return '#<Context>';
3974 return val;
3975 }, 2);
3976 };
3977
3978 /**
3979 * Reset the timeout.
3980 *
3981 * @api private
3982 */
3983
3984 Runnable.prototype.resetTimeout = function(){
3985 var self = this
3986 , ms = this.timeout();
3987
3988 this.clearTimeout();
3989 if (ms) {
3990 this.timer = setTimeout(function(){
3991 self.callback(new Error('timeout of ' + ms + 'ms exceeded'));
3992 self.timedOut = true;
3993 }, ms);
3994 }
3995 };
3996
3997 /**
3998 * Run the test and invoke `fn(err)`.
3999 *
4000 * @param {Function} fn
4001 * @api private
4002 */
4003
4004 Runnable.prototype.run = function(fn){
4005 var self = this
4006 , ms = this.timeout()
4007 , start = new Date
4008 , ctx = this.ctx
4009 , finished
4010 , emitted;
4011
4012 if (ctx) ctx.runnable(this);
4013
4014 // timeout
4015 if (this.async) {
4016 if (ms) {
4017 this.timer = setTimeout(function(){
4018 done(new Error('timeout of ' + ms + 'ms exceeded'));
4019 self.timedOut = true;
4020 }, ms);
4021 }
4022 }
4023
4024 // called multiple times
4025 function multiple(err) {
4026 if (emitted) return;
4027 emitted = true;
4028 self.emit('error', err || new Error('done() called multiple times'));
4029 }
4030
4031 // finished
4032 function done(err) {
4033 if (self.timedOut) return;
4034 if (finished) return multiple(err);
4035 self.clearTimeout();
4036 self.duration = new Date - start;
4037 finished = true;
4038 fn(err);
4039 }
4040
4041 // for .resetTimeout()
4042 this.callback = done;
4043
4044 // async
4045 if (this.async) {
4046 try {
4047 this.fn.call(ctx, function(err){
4048 if (err instanceof Error || toString.call(err) === "[object Error]") return done(err);
4049 if (null != err) return done(new Error('done() invoked with non-Error: ' + err));
4050 done();
4051 });
4052 } catch (err) {
4053 done(err);
4054 }
4055 return;
4056 }
4057
4058 if (this.asyncOnly) {
4059 return done(new Error('--async-only option in use without declaring `done()`'));
4060 }
4061
4062 // sync
4063 try {
4064 if (!this.pending) this.fn.call(ctx);
4065 this.duration = new Date - start;
4066 fn();
4067 } catch (err) {
4068 fn(err);
4069 }
4070 };
4071
4072 }); // module: runnable.js
4073
4074 require.register("runner.js", function(module, exports, require){
4075
4076 /**
4077 * Module dependencies.
4078 */
4079
4080 var EventEmitter = require('browser/events').EventEmitter
4081 , debug = require('browser/debug')('mocha:runner')
4082 , Test = require('./test')
4083 , utils = require('./utils')
4084 , filter = utils.filter
4085 , keys = utils.keys;
4086
4087 /**
4088 * Non-enumerable globals.
4089 */
4090
4091 var globals = [
4092 'setTimeout',
4093 'clearTimeout',
4094 'setInterval',
4095 'clearInterval',
4096 'XMLHttpRequest',
4097 'Date'
4098 ];
4099
4100 /**
4101 * Expose `Runner`.
4102 */
4103
4104 module.exports = Runner;
4105
4106 /**
4107 * Initialize a `Runner` for the given `suite`.
4108 *
4109 * Events:
4110 *
4111 * - `start` execution started
4112 * - `end` execution complete
4113 * - `suite` (suite) test suite execution started
4114 * - `suite end` (suite) all tests (and sub-suites) have finished
4115 * - `test` (test) test execution started
4116 * - `test end` (test) test completed
4117 * - `hook` (hook) hook execution started
4118 * - `hook end` (hook) hook complete
4119 * - `pass` (test) test passed
4120 * - `fail` (test, err) test failed
4121 *
4122 * @api public
4123 */
4124
4125 function Runner(suite) {
4126 var self = this;
4127 this._globals = [];
4128 this.suite = suite;
4129 this.total = suite.total();
4130 this.failures = 0;
4131 this.on('test end', function(test){ self.checkGlobals(test); });
4132 this.on('hook end', function(hook){ self.checkGlobals(hook); });
4133 this.grep(/.*/);
4134 this.globals(this.globalProps().concat(['errno']));
4135 }
4136
4137 /**
4138 * Wrapper for setImmediate, process.nextTick, or browser polyfill.
4139 *
4140 * @param {Function} fn
4141 * @api private
4142 */
4143
4144 Runner.immediately = global.setImmediate || process.nextTick;
4145
4146 /**
4147 * Inherit from `EventEmitter.prototype`.
4148 */
4149
4150 function F(){};
4151 F.prototype = EventEmitter.prototype;
4152 Runner.prototype = new F;
4153 Runner.prototype.constructor = Runner;
4154
4155
4156 /**
4157 * Run tests with full titles matching `re`. Updates runner.total
4158 * with number of tests matched.
4159 *
4160 * @param {RegExp} re
4161 * @param {Boolean} invert
4162 * @return {Runner} for chaining
4163 * @api public
4164 */
4165
4166 Runner.prototype.grep = function(re, invert){
4167 debug('grep %s', re);
4168 this._grep = re;
4169 this._invert = invert;
4170 this.total = this.grepTotal(this.suite);
4171 return this;
4172 };
4173
4174 /**
4175 * Returns the number of tests matching the grep search for the
4176 * given suite.
4177 *
4178 * @param {Suite} suite
4179 * @return {Number}
4180 * @api public
4181 */
4182
4183 Runner.prototype.grepTotal = function(suite) {
4184 var self = this;
4185 var total = 0;
4186
4187 suite.eachTest(function(test){
4188 var match = self._grep.test(test.fullTitle());
4189 if (self._invert) match = !match;
4190 if (match) total++;
4191 });
4192
4193 return total;
4194 };
4195
4196 /**
4197 * Return a list of global properties.
4198 *
4199 * @return {Array}
4200 * @api private
4201 */
4202
4203 Runner.prototype.globalProps = function() {
4204 var props = utils.keys(global);
4205
4206 // non-enumerables
4207 for (var i = 0; i < globals.length; ++i) {
4208 if (~utils.indexOf(props, globals[i])) continue;
4209 props.push(globals[i]);
4210 }
4211
4212 return props;
4213 };
4214
4215 /**
4216 * Allow the given `arr` of globals.
4217 *
4218 * @param {Array} arr
4219 * @return {Runner} for chaining
4220 * @api public
4221 */
4222
4223 Runner.prototype.globals = function(arr){
4224 if (0 == arguments.length) return this._globals;
4225 debug('globals %j', arr);
4226 utils.forEach(arr, function(arr){
4227 this._globals.push(arr);
4228 }, this);
4229 return this;
4230 };
4231
4232 /**
4233 * Check for global variable leaks.
4234 *
4235 * @api private
4236 */
4237
4238 Runner.prototype.checkGlobals = function(test){
4239 if (this.ignoreLeaks) return;
4240 var ok = this._globals;
4241 var globals = this.globalProps();
4242 var isNode = process.kill;
4243 var leaks;
4244
4245 // check length - 2 ('errno' and 'location' globals)
4246 if (isNode && 1 == ok.length - globals.length) return
4247 else if (2 == ok.length - globals.length) return;
4248
4249 leaks = filterLeaks(ok, globals);
4250 this._globals = this._globals.concat(leaks);
4251
4252 if (leaks.length > 1) {
4253 this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + ''));
4254 } else if (leaks.length) {
4255 this.fail(test, new Error('global leak detected: ' + leaks[0]));
4256 }
4257 };
4258
4259 /**
4260 * Fail the given `test`.
4261 *
4262 * @param {Test} test
4263 * @param {Error} err
4264 * @api private
4265 */
4266
4267 Runner.prototype.fail = function(test, err){
4268 ++this.failures;
4269 test.state = 'failed';
4270
4271 if ('string' == typeof err) {
4272 err = new Error('the string "' + err + '" was thrown, throw an Error :)');
4273 }
4274
4275 this.emit('fail', test, err);
4276 };
4277
4278 /**
4279 * Fail the given `hook` with `err`.
4280 *
4281 * Hook failures (currently) hard-end due
4282 * to that fact that a failing hook will
4283 * surely cause subsequent tests to fail,
4284 * causing jumbled reporting.
4285 *
4286 * @param {Hook} hook
4287 * @param {Error} err
4288 * @api private
4289 */
4290
4291 Runner.prototype.failHook = function(hook, err){
4292 this.fail(hook, err);
4293 this.emit('end');
4294 };
4295
4296 /**
4297 * Run hook `name` callbacks and then invoke `fn()`.
4298 *
4299 * @param {String} name
4300 * @param {Function} function
4301 * @api private
4302 */
4303
4304 Runner.prototype.hook = function(name, fn){
4305 var suite = this.suite
4306 , hooks = suite['_' + name]
4307 , self = this
4308 , timer;
4309
4310 function next(i) {
4311 var hook = hooks[i];
4312 if (!hook) return fn();
4313 self.currentRunnable = hook;
4314
4315 self.emit('hook', hook);
4316
4317 hook.on('error', function(err){
4318 self.failHook(hook, err);
4319 });
4320
4321 hook.run(function(err){
4322 hook.removeAllListeners('error');
4323 var testError = hook.error();
4324 if (testError) self.fail(self.test, testError);
4325 if (err) return self.failHook(hook, err);
4326 self.emit('hook end', hook);
4327 next(++i);
4328 });
4329 }
4330
4331 Runner.immediately(function(){
4332 next(0);
4333 });
4334 };
4335
4336 /**
4337 * Run hook `name` for the given array of `suites`
4338 * in order, and callback `fn(err)`.
4339 *
4340 * @param {String} name
4341 * @param {Array} suites
4342 * @param {Function} fn
4343 * @api private
4344 */
4345
4346 Runner.prototype.hooks = function(name, suites, fn){
4347 var self = this
4348 , orig = this.suite;
4349
4350 function next(suite) {
4351 self.suite = suite;
4352
4353 if (!suite) {
4354 self.suite = orig;
4355 return fn();
4356 }
4357
4358 self.hook(name, function(err){
4359 if (err) {
4360 self.suite = orig;
4361 return fn(err);
4362 }
4363
4364 next(suites.pop());
4365 });
4366 }
4367
4368 next(suites.pop());
4369 };
4370
4371 /**
4372 * Run hooks from the top level down.
4373 *
4374 * @param {String} name
4375 * @param {Function} fn
4376 * @api private
4377 */
4378
4379 Runner.prototype.hookUp = function(name, fn){
4380 var suites = [this.suite].concat(this.parents()).reverse();
4381 this.hooks(name, suites, fn);
4382 };
4383
4384 /**
4385 * Run hooks from the bottom up.
4386 *
4387 * @param {String} name
4388 * @param {Function} fn
4389 * @api private
4390 */
4391
4392 Runner.prototype.hookDown = function(name, fn){
4393 var suites = [this.suite].concat(this.parents());
4394 this.hooks(name, suites, fn);
4395 };
4396
4397 /**
4398 * Return an array of parent Suites from
4399 * closest to furthest.
4400 *
4401 * @return {Array}
4402 * @api private
4403 */
4404
4405 Runner.prototype.parents = function(){
4406 var suite = this.suite
4407 , suites = [];
4408 while (suite = suite.parent) suites.push(suite);
4409 return suites;
4410 };
4411
4412 /**
4413 * Run the current test and callback `fn(err)`.
4414 *
4415 * @param {Function} fn
4416 * @api private
4417 */
4418
4419 Runner.prototype.runTest = function(fn){
4420 var test = this.test
4421 , self = this;
4422
4423 if (this.asyncOnly) test.asyncOnly = true;
4424
4425 try {
4426 test.on('error', function(err){
4427 self.fail(test, err);
4428 });
4429 test.run(fn);
4430 } catch (err) {
4431 fn(err);
4432 }
4433 };
4434
4435 /**
4436 * Run tests in the given `suite` and invoke
4437 * the callback `fn()` when complete.
4438 *
4439 * @param {Suite} suite
4440 * @param {Function} fn
4441 * @api private
4442 */
4443
4444 Runner.prototype.runTests = function(suite, fn){
4445 var self = this
4446 , tests = suite.tests.slice()
4447 , test;
4448
4449 function next(err) {
4450 // if we bail after first err
4451 if (self.failures && suite._bail) return fn();
4452
4453 // next test
4454 test = tests.shift();
4455
4456 // all done
4457 if (!test) return fn();
4458
4459 // grep
4460 var match = self._grep.test(test.fullTitle());
4461 if (self._invert) match = !match;
4462 if (!match) return next();
4463
4464 // pending
4465 if (test.pending) {
4466 self.emit('pending', test);
4467 self.emit('test end', test);
4468 return next();
4469 }
4470
4471 // execute test and hook(s)
4472 self.emit('test', self.test = test);
4473 self.hookDown('beforeEach', function(){
4474 self.currentRunnable = self.test;
4475 self.runTest(function(err){
4476 test = self.test;
4477
4478 if (err) {
4479 self.fail(test, err);
4480 self.emit('test end', test);
4481 return self.hookUp('afterEach', next);
4482 }
4483
4484 test.state = 'passed';
4485 self.emit('pass', test);
4486 self.emit('test end', test);
4487 self.hookUp('afterEach', next);
4488 });
4489 });
4490 }
4491
4492 this.next = next;
4493 next();
4494 };
4495
4496 /**
4497 * Run the given `suite` and invoke the
4498 * callback `fn()` when complete.
4499 *
4500 * @param {Suite} suite
4501 * @param {Function} fn
4502 * @api private
4503 */
4504
4505 Runner.prototype.runSuite = function(suite, fn){
4506 var total = this.grepTotal(suite)
4507 , self = this
4508 , i = 0;
4509
4510 debug('run suite %s', suite.fullTitle());
4511
4512 if (!total) return fn();
4513
4514 this.emit('suite', this.suite = suite);
4515
4516 function next() {
4517 var curr = suite.suites[i++];
4518 if (!curr) return done();
4519 self.runSuite(curr, next);
4520 }
4521
4522 function done() {
4523 self.suite = suite;
4524 self.hook('afterAll', function(){
4525 self.emit('suite end', suite);
4526 fn();
4527 });
4528 }
4529
4530 this.hook('beforeAll', function(){
4531 self.runTests(suite, next);
4532 });
4533 };
4534
4535 /**
4536 * Handle uncaught exceptions.
4537 *
4538 * @param {Error} err
4539 * @api private
4540 */
4541
4542 Runner.prototype.uncaught = function(err){
4543 debug('uncaught exception %s', err.message);
4544 var runnable = this.currentRunnable;
4545 if (!runnable || 'failed' == runnable.state) return;
4546 runnable.clearTimeout();
4547 err.uncaught = true;
4548 this.fail(runnable, err);
4549
4550 // recover from test
4551 if ('test' == runnable.type) {
4552 this.emit('test end', runnable);
4553 this.hookUp('afterEach', this.next);
4554 return;
4555 }
4556
4557 // bail on hooks
4558 this.emit('end');
4559 };
4560
4561 /**
4562 * Run the root suite and invoke `fn(failures)`
4563 * on completion.
4564 *
4565 * @param {Function} fn
4566 * @return {Runner} for chaining
4567 * @api public
4568 */
4569
4570 Runner.prototype.run = function(fn){
4571 var self = this
4572 , fn = fn || function(){};
4573
4574 function uncaught(err){
4575 self.uncaught(err);
4576 }
4577
4578 debug('start');
4579
4580 // callback
4581 this.on('end', function(){
4582 debug('end');
4583 process.removeListener('uncaughtException', uncaught);
4584 fn(self.failures);
4585 });
4586
4587 // run suites
4588 this.emit('start');
4589 this.runSuite(this.suite, function(){
4590 debug('finished running');
4591 self.emit('end');
4592 });
4593
4594 // uncaught exception
4595 process.on('uncaughtException', uncaught);
4596
4597 return this;
4598 };
4599
4600 /**
4601 * Filter leaks with the given globals flagged as `ok`.
4602 *
4603 * @param {Array} ok
4604 * @param {Array} globals
4605 * @return {Array}
4606 * @api private
4607 */
4608
4609 function filterLeaks(ok, globals) {
4610 return filter(globals, function(key){
4611 // Firefox and Chrome exposes iframes as index inside the window object
4612 if (/^d+/.test(key)) return false;
4613 var matched = filter(ok, function(ok){
4614 if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);
4615 // Opera and IE expose global variables for HTML element IDs (issue #243)
4616 if (/^mocha-/.test(key)) return true;
4617 return key == ok;
4618 });
4619 return matched.length == 0 && (!global.navigator || 'onerror' !== key);
4620 });
4621 }
4622
4623 }); // module: runner.js
4624
4625 require.register("suite.js", function(module, exports, require){
4626
4627 /**
4628 * Module dependencies.
4629 */
4630
4631 var EventEmitter = require('browser/events').EventEmitter
4632 , debug = require('browser/debug')('mocha:suite')
4633 , milliseconds = require('./ms')
4634 , utils = require('./utils')
4635 , Hook = require('./hook');
4636
4637 /**
4638 * Expose `Suite`.
4639 */
4640
4641 exports = module.exports = Suite;
4642
4643 /**
4644 * Create a new `Suite` with the given `title`
4645 * and parent `Suite`. When a suite with the
4646 * same title is already present, that suite
4647 * is returned to provide nicer reporter
4648 * and more flexible meta-testing.
4649 *
4650 * @param {Suite} parent
4651 * @param {String} title
4652 * @return {Suite}
4653 * @api public
4654 */
4655
4656 exports.create = function(parent, title){
4657 var suite = new Suite(title, parent.ctx);
4658 suite.parent = parent;
4659 if (parent.pending) suite.pending = true;
4660 title = suite.fullTitle();
4661 parent.addSuite(suite);
4662 return suite;
4663 };
4664
4665 /**
4666 * Initialize a new `Suite` with the given
4667 * `title` and `ctx`.
4668 *
4669 * @param {String} title
4670 * @param {Context} ctx
4671 * @api private
4672 */
4673
4674 function Suite(title, ctx) {
4675 this.title = title;
4676 this.ctx = ctx;
4677 this.suites = [];
4678 this.tests = [];
4679 this.pending = false;
4680 this._beforeEach = [];
4681 this._beforeAll = [];
4682 this._afterEach = [];
4683 this._afterAll = [];
4684 this.root = !title;
4685 this._timeout = 2000;
4686 this._slow = 75;
4687 this._bail = false;
4688 }
4689
4690 /**
4691 * Inherit from `EventEmitter.prototype`.
4692 */
4693
4694 function F(){};
4695 F.prototype = EventEmitter.prototype;
4696 Suite.prototype = new F;
4697 Suite.prototype.constructor = Suite;
4698
4699
4700 /**
4701 * Return a clone of this `Suite`.
4702 *
4703 * @return {Suite}
4704 * @api private
4705 */
4706
4707 Suite.prototype.clone = function(){
4708 var suite = new Suite(this.title);
4709 debug('clone');
4710 suite.ctx = this.ctx;
4711 suite.timeout(this.timeout());
4712 suite.slow(this.slow());
4713 suite.bail(this.bail());
4714 return suite;
4715 };
4716
4717 /**
4718 * Set timeout `ms` or short-hand such as "2s".
4719 *
4720 * @param {Number|String} ms
4721 * @return {Suite|Number} for chaining
4722 * @api private
4723 */
4724
4725 Suite.prototype.timeout = function(ms){
4726 if (0 == arguments.length) return this._timeout;
4727 if ('string' == typeof ms) ms = milliseconds(ms);
4728 debug('timeout %d', ms);
4729 this._timeout = parseInt(ms, 10);
4730 return this;
4731 };
4732
4733 /**
4734 * Set slow `ms` or short-hand such as "2s".
4735 *
4736 * @param {Number|String} ms
4737 * @return {Suite|Number} for chaining
4738 * @api private
4739 */
4740
4741 Suite.prototype.slow = function(ms){
4742 if (0 === arguments.length) return this._slow;
4743 if ('string' == typeof ms) ms = milliseconds(ms);
4744 debug('slow %d', ms);
4745 this._slow = ms;
4746 return this;
4747 };
4748
4749 /**
4750 * Sets whether to bail after first error.
4751 *
4752 * @parma {Boolean} bail
4753 * @return {Suite|Number} for chaining
4754 * @api private
4755 */
4756
4757 Suite.prototype.bail = function(bail){
4758 if (0 == arguments.length) return this._bail;
4759 debug('bail %s', bail);
4760 this._bail = bail;
4761 return this;
4762 };
4763
4764 /**
4765 * Run `fn(test[, done])` before running tests.
4766 *
4767 * @param {Function} fn
4768 * @return {Suite} for chaining
4769 * @api private
4770 */
4771
4772 Suite.prototype.beforeAll = function(fn){
4773 if (this.pending) return this;
4774 var hook = new Hook('"before all" hook', fn);
4775 hook.parent = this;
4776 hook.timeout(this.timeout());
4777 hook.slow(this.slow());
4778 hook.ctx = this.ctx;
4779 this._beforeAll.push(hook);
4780 this.emit('beforeAll', hook);
4781 return this;
4782 };
4783
4784 /**
4785 * Run `fn(test[, done])` after running tests.
4786 *
4787 * @param {Function} fn
4788 * @return {Suite} for chaining
4789 * @api private
4790 */
4791
4792 Suite.prototype.afterAll = function(fn){
4793 if (this.pending) return this;
4794 var hook = new Hook('"after all" hook', fn);
4795 hook.parent = this;
4796 hook.timeout(this.timeout());
4797 hook.slow(this.slow());
4798 hook.ctx = this.ctx;
4799 this._afterAll.push(hook);
4800 this.emit('afterAll', hook);
4801 return this;
4802 };
4803
4804 /**
4805 * Run `fn(test[, done])` before each test case.
4806 *
4807 * @param {Function} fn
4808 * @return {Suite} for chaining
4809 * @api private
4810 */
4811
4812 Suite.prototype.beforeEach = function(fn){
4813 if (this.pending) return this;
4814 var hook = new Hook('"before each" hook', fn);
4815 hook.parent = this;
4816 hook.timeout(this.timeout());
4817 hook.slow(this.slow());
4818 hook.ctx = this.ctx;
4819 this._beforeEach.push(hook);
4820 this.emit('beforeEach', hook);
4821 return this;
4822 };
4823
4824 /**
4825 * Run `fn(test[, done])` after each test case.
4826 *
4827 * @param {Function} fn
4828 * @return {Suite} for chaining
4829 * @api private
4830 */
4831
4832 Suite.prototype.afterEach = function(fn){
4833 if (this.pending) return this;
4834 var hook = new Hook('"after each" hook', fn);
4835 hook.parent = this;
4836 hook.timeout(this.timeout());
4837 hook.slow(this.slow());
4838 hook.ctx = this.ctx;
4839 this._afterEach.push(hook);
4840 this.emit('afterEach', hook);
4841 return this;
4842 };
4843
4844 /**
4845 * Add a test `suite`.
4846 *
4847 * @param {Suite} suite
4848 * @return {Suite} for chaining
4849 * @api private
4850 */
4851
4852 Suite.prototype.addSuite = function(suite){
4853 suite.parent = this;
4854 suite.timeout(this.timeout());
4855 suite.slow(this.slow());
4856 suite.bail(this.bail());
4857 this.suites.push(suite);
4858 this.emit('suite', suite);
4859 return this;
4860 };
4861
4862 /**
4863 * Add a `test` to this suite.
4864 *
4865 * @param {Test} test
4866 * @return {Suite} for chaining
4867 * @api private
4868 */
4869
4870 Suite.prototype.addTest = function(test){
4871 test.parent = this;
4872 test.timeout(this.timeout());
4873 test.slow(this.slow());
4874 test.ctx = this.ctx;
4875 this.tests.push(test);
4876 this.emit('test', test);
4877 return this;
4878 };
4879
4880 /**
4881 * Return the full title generated by recursively
4882 * concatenating the parent's full title.
4883 *
4884 * @return {String}
4885 * @api public
4886 */
4887
4888 Suite.prototype.fullTitle = function(){
4889 if (this.parent) {
4890 var full = this.parent.fullTitle();
4891 if (full) return full + ' ' + this.title;
4892 }
4893 return this.title;
4894 };
4895
4896 /**
4897 * Return the total number of tests.
4898 *
4899 * @return {Number}
4900 * @api public
4901 */
4902
4903 Suite.prototype.total = function(){
4904 return utils.reduce(this.suites, function(sum, suite){
4905 return sum + suite.total();
4906 }, 0) + this.tests.length;
4907 };
4908
4909 /**
4910 * Iterates through each suite recursively to find
4911 * all tests. Applies a function in the format
4912 * `fn(test)`.
4913 *
4914 * @param {Function} fn
4915 * @return {Suite}
4916 * @api private
4917 */
4918
4919 Suite.prototype.eachTest = function(fn){
4920 utils.forEach(this.tests, fn);
4921 utils.forEach(this.suites, function(suite){
4922 suite.eachTest(fn);
4923 });
4924 return this;
4925 };
4926
4927 }); // module: suite.js
4928
4929 require.register("test.js", function(module, exports, require){
4930
4931 /**
4932 * Module dependencies.
4933 */
4934
4935 var Runnable = require('./runnable');
4936
4937 /**
4938 * Expose `Test`.
4939 */
4940
4941 module.exports = Test;
4942
4943 /**
4944 * Initialize a new `Test` with the given `title` and callback `fn`.
4945 *
4946 * @param {String} title
4947 * @param {Function} fn
4948 * @api private
4949 */
4950
4951 function Test(title, fn) {
4952 Runnable.call(this, title, fn);
4953 this.pending = !fn;
4954 this.type = 'test';
4955 }
4956
4957 /**
4958 * Inherit from `Runnable.prototype`.
4959 */
4960
4961 function F(){};
4962 F.prototype = Runnable.prototype;
4963 Test.prototype = new F;
4964 Test.prototype.constructor = Test;
4965
4966
4967 }); // module: test.js
4968
4969 require.register("utils.js", function(module, exports, require){
4970
4971 /**
4972 * Module dependencies.
4973 */
4974
4975 var fs = require('browser/fs')
4976 , path = require('browser/path')
4977 , join = path.join
4978 , debug = require('browser/debug')('mocha:watch');
4979
4980 /**
4981 * Ignored directories.
4982 */
4983
4984 var ignore = ['node_modules', '.git'];
4985
4986 /**
4987 * Escape special characters in the given string of html.
4988 *
4989 * @param {String} html
4990 * @return {String}
4991 * @api private
4992 */
4993
4994 exports.escape = function(html){
4995 return String(html)
4996 .replace(/&/g, '&amp;')
4997 .replace(/"/g, '&quot;')
4998 .replace(/</g, '&lt;')
4999 .replace(/>/g, '&gt;');
5000 };
5001
5002 /**
5003 * Array#forEach (<=IE8)
5004 *
5005 * @param {Array} array
5006 * @param {Function} fn
5007 * @param {Object} scope
5008 * @api private
5009 */
5010
5011 exports.forEach = function(arr, fn, scope){
5012 for (var i = 0, l = arr.length; i < l; i++)
5013 fn.call(scope, arr[i], i);
5014 };
5015
5016 /**
5017 * Array#indexOf (<=IE8)
5018 *
5019 * @parma {Array} arr
5020 * @param {Object} obj to find index of
5021 * @param {Number} start
5022 * @api private
5023 */
5024
5025 exports.indexOf = function(arr, obj, start){
5026 for (var i = start || 0, l = arr.length; i < l; i++) {
5027 if (arr[i] === obj)
5028 return i;
5029 }
5030 return -1;
5031 };
5032
5033 /**
5034 * Array#reduce (<=IE8)
5035 *
5036 * @param {Array} array
5037 * @param {Function} fn
5038 * @param {Object} initial value
5039 * @api private
5040 */
5041
5042 exports.reduce = function(arr, fn, val){
5043 var rval = val;
5044
5045 for (var i = 0, l = arr.length; i < l; i++) {
5046 rval = fn(rval, arr[i], i, arr);
5047 }
5048
5049 return rval;
5050 };
5051
5052 /**
5053 * Array#filter (<=IE8)
5054 *
5055 * @param {Array} array
5056 * @param {Function} fn
5057 * @api private
5058 */
5059
5060 exports.filter = function(arr, fn){
5061 var ret = [];
5062
5063 for (var i = 0, l = arr.length; i < l; i++) {
5064 var val = arr[i];
5065 if (fn(val, i, arr)) ret.push(val);
5066 }
5067
5068 return ret;
5069 };
5070
5071 /**
5072 * Object.keys (<=IE8)
5073 *
5074 * @param {Object} obj
5075 * @return {Array} keys
5076 * @api private
5077 */
5078
5079 exports.keys = Object.keys || function(obj) {
5080 var keys = []
5081 , has = Object.prototype.hasOwnProperty // for `window` on <=IE8
5082
5083 for (var key in obj) {
5084 if (has.call(obj, key)) {
5085 keys.push(key);
5086 }
5087 }
5088
5089 return keys;
5090 };
5091
5092 /**
5093 * Watch the given `files` for changes
5094 * and invoke `fn(file)` on modification.
5095 *
5096 * @param {Array} files
5097 * @param {Function} fn
5098 * @api private
5099 */
5100
5101 exports.watch = function(files, fn){
5102 var options = { interval: 100 };
5103 files.forEach(function(file){
5104 debug('file %s', file);
5105 fs.watchFile(file, options, function(curr, prev){
5106 if (prev.mtime < curr.mtime) fn(file);
5107 });
5108 });
5109 };
5110
5111 /**
5112 * Ignored files.
5113 */
5114
5115 function ignored(path){
5116 return !~ignore.indexOf(path);
5117 }
5118
5119 /**
5120 * Lookup files in the given `dir`.
5121 *
5122 * @return {Array}
5123 * @api private
5124 */
5125
5126 exports.files = function(dir, ret){
5127 ret = ret || [];
5128
5129 fs.readdirSync(dir)
5130 .filter(ignored)
5131 .forEach(function(path){
5132 path = join(dir, path);
5133 if (fs.statSync(path).isDirectory()) {
5134 exports.files(path, ret);
5135 } else if (path.match(/\.(js|coffee)$/)) {
5136 ret.push(path);
5137 }
5138 });
5139
5140 return ret;
5141 };
5142
5143 /**
5144 * Compute a slug from the given `str`.
5145 *
5146 * @param {String} str
5147 * @return {String}
5148 * @api private
5149 */
5150
5151 exports.slug = function(str){
5152 return str
5153 .toLowerCase()
5154 .replace(/ +/g, '-')
5155 .replace(/[^-\w]/g, '');
5156 };
5157
5158 /**
5159 * Strip the function definition from `str`,
5160 * and re-indent for pre whitespace.
5161 */
5162
5163 exports.clean = function(str) {
5164 str = str
5165 .replace(/^function *\(.*\) *{/, '')
5166 .replace(/\s+\}$/, '');
5167
5168 var spaces = str.match(/^\n?( *)/)[1].length
5169 , re = new RegExp('^ {' + spaces + '}', 'gm');
5170
5171 str = str.replace(re, '');
5172
5173 return exports.trim(str);
5174 };
5175
5176 /**
5177 * Escape regular expression characters in `str`.
5178 *
5179 * @param {String} str
5180 * @return {String}
5181 * @api private
5182 */
5183
5184 exports.escapeRegexp = function(str){
5185 return str.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&");
5186 };
5187
5188 /**
5189 * Trim the given `str`.
5190 *
5191 * @param {String} str
5192 * @return {String}
5193 * @api private
5194 */
5195
5196 exports.trim = function(str){
5197 return str.replace(/^\s+|\s+$/g, '');
5198 };
5199
5200 /**
5201 * Parse the given `qs`.
5202 *
5203 * @param {String} qs
5204 * @return {Object}
5205 * @api private
5206 */
5207
5208 exports.parseQuery = function(qs){
5209 return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){
5210 var i = pair.indexOf('=')
5211 , key = pair.slice(0, i)
5212 , val = pair.slice(++i);
5213
5214 obj[key] = decodeURIComponent(val);
5215 return obj;
5216 }, {});
5217 };
5218
5219 /**
5220 * Highlight the given string of `js`.
5221 *
5222 * @param {String} js
5223 * @return {String}
5224 * @api private
5225 */
5226
5227 function highlight(js) {
5228 return js
5229 .replace(/</g, '&lt;')
5230 .replace(/>/g, '&gt;')
5231 .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
5232 .replace(/('.*?')/gm, '<span class="string">$1</span>')
5233 .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
5234 .replace(/(\d+)/gm, '<span class="number">$1</span>')
5235 .replace(/\bnew *(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
5236 .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')
5237 }
5238
5239 /**
5240 * Highlight the contents of tag `name`.
5241 *
5242 * @param {String} name
5243 * @api private
5244 */
5245
5246 exports.highlightTags = function(name) {
5247 var code = document.getElementsByTagName(name);
5248 for (var i = 0, len = code.length; i < len; ++i) {
5249 code[i].innerHTML = highlight(code[i].innerHTML);
5250 }
5251 };
5252
5253 }); // module: utils.js
5254
5255 /**
5256 * Save timer references to avoid Sinon interfering (see GH-237).
5257 */
5258
5259 var Date = window.Date;
5260 var setTimeout = window.setTimeout;
5261 var setInterval = window.setInterval;
5262 var clearTimeout = window.clearTimeout;
5263 var clearInterval = window.clearInterval;
5264
5265 /**
5266 * Node shims.
5267 *
5268 * These are meant only to allow
5269 * mocha.js to run untouched, not
5270 * to allow running node code in
5271 * the browser.
5272 */
5273
5274 var process = {};
5275 process.exit = function(status){};
5276 process.stdout = {};
5277 global = window;
5278
5279 /**
5280 * Remove uncaughtException listener.
5281 */
5282
5283 process.removeListener = function(e){
5284 if ('uncaughtException' == e) {
5285 window.onerror = null;
5286 }
5287 };
5288
5289 /**
5290 * Implements uncaughtException listener.
5291 */
5292
5293 process.on = function(e, fn){
5294 if ('uncaughtException' == e) {
5295 window.onerror = function(err, url, line){
5296 fn(new Error(err + ' (' + url + ':' + line + ')'));
5297 };
5298 }
5299 };
5300
5301 /**
5302 * Expose mocha.
5303 */
5304
5305 var Mocha = window.Mocha = require('mocha'),
5306 mocha = window.mocha = new Mocha({ reporter: 'html' });
5307
5308 var immediateQueue = []
5309 , immediateTimeout;
5310
5311 function timeslice() {
5312 var immediateStart = new Date().getTime();
5313 while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) {
5314 immediateQueue.shift()();
5315 }
5316 if (immediateQueue.length) {
5317 immediateTimeout = setTimeout(timeslice, 0);
5318 } else {
5319 immediateTimeout = null;
5320 }
5321 }
5322
5323 /**
5324 * High-performance override of Runner.immediately.
5325 */
5326
5327 Mocha.Runner.immediately = function(callback) {
5328 immediateQueue.push(callback);
5329 if (!immediateTimeout) {
5330 immediateTimeout = setTimeout(timeslice, 0);
5331 }
5332 };
5333
5334 /**
5335 * Override ui to ensure that the ui functions are initialized.
5336 * Normally this would happen in Mocha.prototype.loadFiles.
5337 */
5338
5339 mocha.ui = function(ui){
5340 Mocha.prototype.ui.call(this, ui);
5341 this.suite.emit('pre-require', window, null, this);
5342 return this;
5343 };
5344
5345 /**
5346 * Setup mocha with the given setting options.
5347 */
5348
5349 mocha.setup = function(opts){
5350 if ('string' == typeof opts) opts = { ui: opts };
5351 for (var opt in opts) this[opt](opts[opt]);
5352 return this;
5353 };
5354
5355 /**
5356 * Run mocha, returning the Runner.
5357 */
5358
5359 mocha.run = function(fn){
5360 var options = mocha.options;
5361 mocha.globals('location');
5362
5363 var query = Mocha.utils.parseQuery(window.location.search || '');
5364 if (query.grep) mocha.grep(query.grep);
5365 if (query.invert) mocha.invert();
5366
5367 return Mocha.prototype.run.call(mocha, function(){
5368 Mocha.utils.highlightTags('code');
5369 if (fn) fn();
5370 });
5371 };
5372 })();
+0
-473
test/deps/proclaim.js less more
0 /* global define */
1 (function (root, proclaim) {
2 'use strict';
3
4
5 // Utilities
6 // ---------
7
8 // Utility for checking whether a value is undefined or null
9 function isUndefinedOrNull (val) {
10 return (val === null || typeof val === 'undefined');
11 }
12
13 // Utility for checking whether a value is an arguments object
14 function isArgumentsObject (val) {
15 return (Object.prototype.toString.call(val) === '[object Arguments]');
16 }
17
18 // Utility for checking whether a value is plain object
19 function isPlainObject (val) {
20 return Object.prototype.toString.call(val) === '[object Object]';
21 }
22
23 // Utility for checking whether an object contains another object
24 function includes (haystack, needle) {
25 /* jshint maxdepth: 3*/
26 var i;
27
28 // Array#indexOf, but ie...
29 if (isArray(haystack)) {
30 for (i = haystack.length - 1; i >= 0; i = i - 1) {
31 if (haystack[i] === needle) {
32 return true;
33 }
34 }
35 }
36
37 // String#indexOf
38 if (typeof haystack === 'string') {
39 if (haystack.indexOf(needle) !== -1) {
40 return true;
41 }
42 }
43
44 // Object#hasOwnProperty
45 if (isPlainObject(haystack)) {
46 if (haystack.hasOwnProperty(needle)) {
47 return true;
48 }
49 }
50
51 return false;
52 }
53
54 // Utility for checking whether a value is an array
55 var isArray = Array.isArray || function (val) {
56 return (Object.prototype.toString.call(val) === '[object Array]');
57 };
58
59 // Utility for getting object keys
60 function getObjectKeys (obj) {
61 var key, keys = [];
62 for (key in obj) {
63 if (obj.hasOwnProperty(key)) {
64 keys.push(key);
65 }
66 }
67 return keys;
68 }
69
70 // Utility for deep equality testing of objects
71 // Note: this function does an awful lot, look into sorting this
72 function objectsEqual (obj1, obj2) {
73 /* jshint eqeqeq: false */
74
75 // Check for undefined or null
76 if (isUndefinedOrNull(obj1) || isUndefinedOrNull(obj2)) {
77 return false;
78 }
79
80 // Object prototypes must be the same
81 if (obj1.prototype !== obj2.prototype) {
82 return false;
83 }
84
85 // Handle argument objects
86 if (isArgumentsObject(obj1)) {
87 if (!isArgumentsObject(obj2)) {
88 return false;
89 }
90 obj1 = Array.prototype.slice.call(obj1);
91 obj2 = Array.prototype.slice.call(obj2);
92 }
93
94 // Check number of own properties
95 var obj1Keys = getObjectKeys(obj1);
96 var obj2Keys = getObjectKeys(obj2);
97 if (obj1Keys.length !== obj2Keys.length) {
98 return false;
99 }
100
101 obj1Keys.sort();
102 obj2Keys.sort();
103
104 // Cheap initial key test (see https://github.com/joyent/node/blob/master/lib/assert.js)
105 var key, i, len = obj1Keys.length;
106 for (i = 0; i < len; i += 1) {
107 if (obj1Keys[i] != obj2Keys[i]) {
108 return false;
109 }
110 }
111
112 // Expensive deep test
113 for (i = 0; i < len; i += 1) {
114 key = obj1Keys[i];
115 if (!isDeepEqual(obj1[key], obj2[key])) {
116 return false;
117 }
118 }
119
120 // If it got this far...
121 return true;
122 }
123
124 // Utility for deep equality testing
125 function isDeepEqual (actual, expected) {
126 /* jshint eqeqeq: false */
127 if (actual === expected) {
128 return true;
129 }
130 if (expected instanceof Date && actual instanceof Date) {
131 return actual.getTime() === expected.getTime();
132 }
133 if (typeof actual !== 'object' && typeof expected !== 'object') {
134 return actual == expected;
135 }
136 return objectsEqual(actual, expected);
137 }
138
139 // Utility for testing whether a function throws an error
140 function functionThrows (fn, expected) {
141
142 // Try/catch
143 var thrown = false;
144 var thrownError;
145 try {
146 fn();
147 } catch (err) {
148 thrown = true;
149 thrownError = err;
150 }
151
152 // Check error
153 if (thrown && expected) {
154 thrown = errorMatches(thrownError, expected);
155 }
156
157 return thrown;
158 }
159
160 // Utility for checking whether an error matches a given constructor, regexp or string
161 function errorMatches (actual, expected) {
162 if (typeof expected === 'string') {
163 return actual.message === expected;
164 }
165 if (Object.prototype.toString.call(expected) === '[object RegExp]') {
166 return expected.test(actual.message);
167 }
168 if (actual instanceof expected) {
169 return true;
170 }
171 return false;
172 }
173
174
175 // Error handling
176 // --------------
177
178 // Assertion error class
179 function AssertionError (opts) {
180 opts = opts || {};
181 this.name = 'AssertionError';
182 this.actual = opts.actual;
183 this.expected = opts.expected;
184 this.operator = opts.operator || '';
185 this.message = opts.message;
186
187 if (Error.captureStackTrace) {
188 Error.captureStackTrace(this, opts.stackStartFunction || fail);
189 }
190 }
191 AssertionError.prototype = (Object.create ? Object.create(Error.prototype) : new Error());
192 AssertionError.prototype.name = 'AssertionError';
193 AssertionError.prototype.constructor = AssertionError;
194
195 // Assertion error to string
196 AssertionError.prototype.toString = function () {
197 if (this.message) {
198 return this.name + ': ' +this.message;
199 } else {
200 return this.name + ': ' +
201 this.actual + ' ' +
202 this.operator + ' ' +
203 this.expected;
204 }
205 };
206
207 // Fail a test
208 function fail (actual, expected, message, operator, stackStartFunction) {
209 throw new AssertionError({
210 message: message,
211 actual: actual,
212 expected: expected,
213 operator: operator,
214 stackStartFunction: stackStartFunction
215 });
216 }
217
218 // Expose error handling tools
219 proclaim.AssertionError = AssertionError;
220 proclaim.fail = fail;
221
222
223 // Assertions as outlined in
224 // http://wiki.commonjs.org/wiki/Unit_Testing/1.0#Assert
225 // -----------------------------------------------------
226
227 // Assert that a value is truthy
228 proclaim.ok = function (val, msg) {
229 if (!!!val) {
230 fail(val, true, msg, '==');
231 }
232 };
233
234 // Assert that two values are equal
235 proclaim.equal = function (actual, expected, msg) {
236 /* jshint eqeqeq: false */
237 if (actual != expected) {
238 fail(actual, expected, msg, '==');
239 }
240 };
241
242 // Assert that two values are not equal
243 proclaim.notEqual = function (actual, expected, msg) {
244 /* jshint eqeqeq: false */
245 if (actual == expected) {
246 fail(actual, expected, msg, '!=');
247 }
248 };
249
250 // Assert that two values are equal with strict comparison
251 proclaim.strictEqual = function (actual, expected, msg) {
252 if (actual !== expected) {
253 fail(actual, expected, msg, '===');
254 }
255 };
256
257 // Assert that two values are not equal with strict comparison
258 proclaim.notStrictEqual = function (actual, expected, msg) {
259 if (actual === expected) {
260 fail(actual, expected, msg, '!==');
261 }
262 };
263
264 // Assert that two values are deeply equal
265 proclaim.deepEqual = function (actual, expected, msg) {
266 if (!isDeepEqual(actual, expected)) {
267 fail(actual, expected, msg, 'deepEqual');
268 }
269 };
270
271 // Assert that two values are not deeply equal
272 proclaim.notDeepEqual = function (actual, expected, msg) {
273 if (isDeepEqual(actual, expected)) {
274 fail(actual, expected, msg, '!deepEqual');
275 }
276 };
277
278 // Assert that a function throws an error
279 proclaim.throws = function (fn, expected, msg) {
280 if (!functionThrows(fn, expected)) {
281 fail(fn, expected, msg, 'throws');
282 }
283 };
284
285
286 // Additional assertions
287 // ---------------------
288
289 // Assert that a function does not throw an error
290 proclaim.doesNotThrow = function (fn, expected, msg) {
291 if (functionThrows(fn, expected)) {
292 fail(fn, expected, msg, '!throws');
293 }
294 };
295
296 // Assert that a value is a specific type
297 proclaim.isTypeOf = function (val, type, msg) {
298 proclaim.strictEqual(typeof val, type, msg);
299 };
300
301 // Assert that a value is not a specific type
302 proclaim.isNotTypeOf = function (val, type, msg) {
303 proclaim.notStrictEqual(typeof val, type, msg);
304 };
305
306 // Assert that a value is an instance of a constructor
307 proclaim.isInstanceOf = function (val, constructor, msg) {
308 if (!(val instanceof constructor)) {
309 fail(val, constructor, msg, 'instanceof');
310 }
311 };
312
313 // Assert that a value not an instance of a constructor
314 proclaim.isNotInstanceOf = function (val, constructor, msg) {
315 if (val instanceof constructor) {
316 fail(val, constructor, msg, '!instanceof');
317 }
318 };
319
320 // Assert that a value is an array
321 proclaim.isArray = function (val, msg) {
322 if (!isArray(val)) {
323 fail(typeof val, 'array', msg, '===');
324 }
325 };
326
327 // Assert that a value is not an array
328 proclaim.isNotArray = function (val, msg) {
329 if (isArray(val)) {
330 fail(typeof val, 'array', msg, '!==');
331 }
332 };
333
334 // Assert that a value is a boolean
335 proclaim.isBoolean = function (val, msg) {
336 proclaim.isTypeOf(val, 'boolean', msg);
337 };
338
339 // Assert that a value is not a boolean
340 proclaim.isNotBoolean = function (val, msg) {
341 proclaim.isNotTypeOf(val, 'boolean', msg);
342 };
343
344 // Assert that a value is true
345 proclaim.isTrue = function (val, msg) {
346 proclaim.strictEqual(val, true, msg);
347 };
348
349 // Assert that a value is false
350 proclaim.isFalse = function (val, msg) {
351 proclaim.strictEqual(val, false, msg);
352 };
353
354 // Assert that a value is a function
355 proclaim.isFunction = function (val, msg) {
356 proclaim.isTypeOf(val, 'function', msg);
357 };
358
359 // Assert that a value is not a function
360 proclaim.isNotFunction = function (val, msg) {
361 proclaim.isNotTypeOf(val, 'function', msg);
362 };
363
364 // Assert that a value is null
365 proclaim.isNull = function (val, msg) {
366 proclaim.strictEqual(val, null, msg);
367 };
368
369 // Assert that a value is not null
370 proclaim.isNotNull = function (val, msg) {
371 proclaim.notStrictEqual(val, null, msg);
372 };
373
374 // Assert that a value is a number
375 proclaim.isNumber = function (val, msg) {
376 proclaim.isTypeOf(val, 'number', msg);
377 };
378
379 // Assert that a value is not a number
380 proclaim.isNotNumber = function (val, msg) {
381 proclaim.isNotTypeOf(val, 'number', msg);
382 };
383
384 // Assert that a value is an object
385 proclaim.isObject = function (val, msg) {
386 proclaim.isTypeOf(val, 'object', msg);
387 };
388
389 // Assert that a value is not an object
390 proclaim.isNotObject = function (val, msg) {
391 proclaim.isNotTypeOf(val, 'object', msg);
392 };
393
394 // Assert that a value is a string
395 proclaim.isString = function (val, msg) {
396 proclaim.isTypeOf(val, 'string', msg);
397 };
398
399 // Assert that a value is not a string
400 proclaim.isNotString = function (val, msg) {
401 proclaim.isNotTypeOf(val, 'string', msg);
402 };
403
404 // Assert that a value is undefined
405 proclaim.isUndefined = function (val, msg) {
406 proclaim.isTypeOf(val, 'undefined', msg);
407 };
408
409 // Assert that a value is defined
410 proclaim.isDefined = function (val, msg) {
411 proclaim.isNotTypeOf(val, 'undefined', msg);
412 };
413
414 // Assert that a value matches a regular expression
415 proclaim.match = function (actual, expected, msg) {
416 if (!expected.test(actual)) {
417 fail(actual, expected, msg, 'match');
418 }
419 };
420
421 // Assert that a value does not match a regular expression
422 proclaim.notMatch = function (actual, expected, msg) {
423 if (expected.test(actual)) {
424 fail(actual, expected, msg, '!match');
425 }
426 };
427
428 // Assert that an object includes something
429 proclaim.includes = function (haystack, needle, msg) {
430 if (!includes(haystack, needle)) {
431 fail(haystack, needle, msg, 'include');
432 }
433 };
434
435 // Assert that an object does not include something
436 proclaim.doesNotInclude = function (haystack, needle, msg) {
437 if (includes(haystack, needle)) {
438 fail(haystack, needle, msg, '!include');
439 }
440 };
441
442 // Assert that an object (Array, String, etc.) has an expected length
443 proclaim.length = function (obj, expected, msg) {
444 if (isUndefinedOrNull(obj)) {
445 return fail(void 0, expected, msg, 'length');
446 }
447 if (obj.length !== expected) {
448 fail(obj.length, expected, msg, 'length');
449 }
450 };
451
452
453 // Exports
454 // -------
455
456 // AMD
457 if (typeof define !== 'undefined' && define.amd) {
458 define([], function () {
459 return proclaim;
460 });
461 }
462 // CommonJS
463 else if (typeof module !== 'undefined' && module.exports) {
464 module.exports = proclaim;
465 }
466 // Script tag
467 else {
468 root.proclaim = proclaim;
469 }
470
471
472 } (this, {}));
+0
-57
test/index-amd.html less more
0 <!DOCTYPE html>
1 <html>
2 <head>
3 <title>tv4</title>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <link rel="stylesheet" href="./deps/mocha.css"/>
6 <script src="./deps/jquery.js"></script>
7 <script src="./deps/mocha.js"></script>
8 <script src="./deps/proclaim.js"></script>
9 <script src="../node_modules/requirejs/require.js"></script>
10 <script>
11 mocha.setup('bdd');
12 window.onload = function () {
13 if (navigator.userAgent.indexOf('PhantomJS') < 0) {
14 mocha.run();
15 }
16 };
17
18 describe("tv4 amd loading", function () {
19 it("should load tv4 using require", function (done) {
20 require(['../tv4'], function (tv4) {
21 proclaim.isDefined(tv4);
22 var schema = {
23 properties: {
24 intKey: {"type": "integer"},
25 stringKey: {"type": "string"}
26 }
27 };
28 proclaim.isTrue(tv4.validate({intKey: 1, stringKey: "one"}, schema));
29 proclaim.isFalse(tv4.validate({intKey: false, stringKey: "one"}, schema));
30 done();
31 });
32 });
33 it("should load german language as AMD module", function (done) {
34 require(['../lang/de'], function (tv4) {
35 proclaim.isDefined(tv4);
36
37 tv4.language('de');
38
39 var schema = {
40 properties: {
41 intKey: {"type": "integer"}
42 }
43 };
44 var res = tv4.validateResult({intKey: 'bad'}, schema);
45 proclaim.isFalse(res.valid);
46 proclaim.equal(res.error.message, 'Ungültiger Typ: string (erwartet wurde: integer)');
47 done();
48 });
49 });
50 });
51 </script>
52 </head>
53 <body>
54 <div id="mocha"></div>
55 </body>
56 </html>
+0
-31
test/index-component.html less more
0 <!DOCTYPE html>
1 <html>
2 <head>
3 <title>tv4-component</title>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <link rel="stylesheet" href="./deps/mocha.css"/>
6 <script src="./deps/jquery.js"></script>
7 <script src="./deps/mocha.js"></script>
8 <script src="./deps/proclaim.js"></script>
9 <script src="../build/build.js"></script>
10 <script>
11 var tv4 = require('tv4');
12
13 //save globals so tests can be shared between node an browsers
14 window.refs = {tv4:tv4, assert:proclaim};
15 mocha.setup('bdd');
16 window.onload = function () {
17 if (navigator.userAgent.indexOf('PhantomJS') < 0) {
18 mocha.run();
19 }
20 };
21 </script>
22 <script src="./all_concat.js"></script>
23 </head>
24 <body>
25 <p style="font-family:sans-serif;padding:10px;"><strong>Note:</strong> this test requires grunt to build the required files.</p>
26 <div id="mocha">
27
28 </div>
29 </body>
30 </html>
+0
-54
test/index-globals.html less more
0 <!DOCTYPE html>
1 <html>
2 <head>
3 <title>tv4</title>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <link rel="stylesheet" href="./deps/mocha.css"/>
6 <script src="./deps/jquery.js"></script>
7 <script src="./deps/mocha.js"></script>
8 <script src="./deps/proclaim.js"></script>
9 <script src="../tv4.js"></script>
10 <script src="../lang/de.js"></script>
11 <script>
12 mocha.setup('bdd');
13 window.onload = function () {
14 if (navigator.userAgent.indexOf('PhantomJS') < 0) {
15 mocha.run();
16 }
17 };
18
19 describe("tv4 globals", function () {
20 it("should have global tv4", function () {
21 proclaim.isDefined(tv4);
22 var schema = {
23 properties: {
24 intKey: {"type": "integer"},
25 stringKey: {"type": "string"}
26 }
27 };
28 proclaim.isTrue(tv4.validate({intKey: 1, stringKey: "one"}, schema));
29 proclaim.isFalse(tv4.validate({intKey: false, stringKey: "one"}, schema));
30 });
31 it("should have german language added to global", function () {
32 proclaim.isDefined(tv4);
33
34 tv4 = tv4.freshApi();
35
36 tv4.language('de');
37
38 var schema = {
39 properties: {
40 intKey: {"type": "integer"}
41 }
42 };
43 var res = tv4.validateResult({intKey: 'bad'}, schema);
44 proclaim.isFalse(res.valid);
45 proclaim.equal(res.error.message, 'Ungültiger Typ: string (erwartet wurde: integer)');
46 });
47 });
48 </script>
49 </head>
50 <body>
51 <div id="mocha"></div>
52 </body>
53 </html>
+0
-26
test/index-min.html less more
0 <!DOCTYPE html>
1 <html>
2 <head>
3 <title>tv4-min</title>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <link rel="stylesheet" href="./deps/mocha.css"/>
6 <script src="./deps/jquery.js"></script>
7 <script src="./deps/mocha.js"></script>
8 <script src="./deps/proclaim.js"></script>
9 <script src="../tv4.min.js"></script>
10 <script>
11 //save globals so tests can be shared between node an browsers
12 window.refs = {tv4:tv4, assert:proclaim};
13 mocha.setup('bdd');
14 window.onload = function () {
15 if (navigator.userAgent.indexOf('PhantomJS') < 0) {
16 mocha.run();
17 }
18 };
19 </script>
20 <script src="./all_concat.js"></script>
21 </head>
22 <body>
23 <div id="mocha"></div>
24 </body>
25 </html>
+0
-26
test/index.html less more
0 <!DOCTYPE html>
1 <html>
2 <head>
3 <title>tv4</title>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <link rel="stylesheet" href="./deps/mocha.css"/>
6 <script src="./deps/jquery.js"></script>
7 <script src="./deps/mocha.js"></script>
8 <script src="./deps/proclaim.js"></script>
9 <script src="../tv4.js"></script>
10 <script>
11 //save globals so tests can be shared between node an browsers
12 window.refs = {tv4:tv4, assert:proclaim};
13 mocha.setup('bdd');
14 window.onload = function () {
15 if (navigator.userAgent.indexOf('PhantomJS') < 0) {
16 mocha.run();
17 }
18 };
19 </script>
20 <script src="./all_concat.js"></script>
21 </head>
22 <body>
23 <div id="mocha"></div>
24 </body>
25 </html>
+0
-2
test/mocha.opts less more
0 --reporter Spec
1 test/all_concat
+0
-25
test/tests/00 - Core/01 - utils.js less more
0 describe("Core 01", function () {
1
2 it("getDocumentUri returns only location part of url", function () {
3
4 assert.strictEqual(tv4.getDocumentUri("http://example.com"), "http://example.com");
5
6 assert.strictEqual(tv4.getDocumentUri("http://example.com/main"), "http://example.com/main");
7 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/"), "http://example.com/main/");
8 //assert.strictEqual(tv4.getDocumentUri("http://example.com/main//"), "http://example.com/main/");
9
10 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/sub"), "http://example.com/main/sub");
11 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/sub/"), "http://example.com/main/sub/");
12
13 assert.strictEqual(tv4.getDocumentUri("http://example.com/main#"), "http://example.com/main");
14 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/sub/#"), "http://example.com/main/sub/");
15
16 assert.strictEqual(tv4.getDocumentUri("http://example.com/main?"), "http://example.com/main?");
17 assert.strictEqual(tv4.getDocumentUri("http://example.com/main?q=1"), "http://example.com/main?q=1");
18 assert.strictEqual(tv4.getDocumentUri("http://example.com/main?q=1#abc"), "http://example.com/main?q=1");
19
20 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/#"), "http://example.com/main/");
21 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/#?"), "http://example.com/main/");
22 assert.strictEqual(tv4.getDocumentUri("http://example.com/main/#?q=a/b/c"), "http://example.com/main/");
23 });
24 });
+0
-24
test/tests/00 - Core/02 - duplicateApi.js less more
0 describe("Core 02", function () {
1
2 it("tv4.freshApi() produces working copy", function () {
3 var duplicate = tv4.freshApi();
4 assert.isObject(duplicate);
5 // Basic sanity checks
6 assert.isTrue(duplicate.validate({}, {type: "object"}));
7 assert.isObject(duplicate.validateMultiple("string", {}));
8 });
9
10 it("tv4.freshApi() has separate schema store", function () {
11 var duplicate = tv4.freshApi();
12
13 var schemaUrl1 = "http://example.com/schema/schema1";
14 var schemaUrl2 = "http://example.com/schema/schema2";
15 duplicate.addSchema(schemaUrl1, {});
16 tv4.addSchema(schemaUrl2, {});
17
18 assert.isObject(duplicate.getSchema(schemaUrl1));
19 assert.isUndefined(tv4.getSchema(schemaUrl1));
20 assert.isUndefined(duplicate.getSchema(schemaUrl2));
21 assert.isObject(tv4.getSchema(schemaUrl2));
22 });
23 });
+0
-36
test/tests/00 - Core/03 - resetAndDrop.js less more
0 describe("Core 03", function () {
1
2 it("tv4.dropSchemas() drops stored schemas", function () {
3 var schema = {
4 "items": {"$ref": "http://example.com/schema/items#"},
5 "maxItems": 2
6 };
7 tv4.addSchema("http://example.com/schema", schema);
8 assert.strictEqual(tv4.getSchema("http://example.com/schema"), schema, "has schema");
9
10 tv4.dropSchemas();
11 assert.isUndefined(tv4.getSchema("http://example.com/schema"), "doesn't have schema");
12 });
13
14 it("tv4.reset() clears errors, valid and missing", function () {
15 it("must be string, is integer", function () {
16 var data = 5;
17 var schema = {"type": "array", "items" : {"$ref" : "http://example.com"}};
18
19 assert.notOk(tv4.error, "starts with no error");
20 assert.isTrue(tv4.valid, "starts valid");
21 assert.length(tv4.missing, 0, "starts with 0 missing");
22
23 var valid = tv4.validate(data, schema);
24 assert.isFalse(valid);
25 assert.ok(tv4.error, "has error");
26 assert.isFalse(tv4.valid, "is invalid");
27 assert.length(tv4.missing, 1, "missing 1");
28
29 tv4.reset();
30 assert.notOk(tv4.error, "reset to no error");
31 assert.isTrue(tv4.valid, "reset to valid");
32 assert.length(tv4.missing, 0, "reset to 0 missing");
33 });
34 });
35 });
+0
-32
test/tests/00 - Core/04 - error.js less more
0 describe("Core 04", function () {
1
2 var schema = {
3 "type": "string"
4 };
5
6 it("ValidationError is Error subtype", function () {
7 var res = tv4.validateResult(123, schema);
8 assert.isObject(res);
9 assert.isObject(res.error);
10 assert.isInstanceOf(res.error, Error);
11 assert.isString(res.error.stack);
12 });
13
14 it("ValidationError has own stack trace", function () {
15 function errorA() {
16 var res = tv4.validateResult(123, schema);
17 assert.isFalse(res.valid);
18 assert.isString(res.error.stack);
19 assert.ok(res.error.stack.indexOf('errorA') > -1, 'has own stack trace A');
20 }
21
22 function errorB() {
23 var res = tv4.validateResult(123, schema);
24 assert.isFalse(res.valid);
25 assert.isString(res.error.stack);
26 assert.ok(res.error.stack.indexOf('errorB') > -1, 'has own stack trace B');
27 }
28 errorA();
29 errorB();
30 });
31 });
+0
-65
test/tests/01 - Any types/01 - type.js less more
0 describe("Any types 01", function () {
1
2 it("no type specified", function () {
3 var data = {};
4 var schema = {};
5 var valid = tv4.validate(data, schema);
6 assert.isTrue(valid);
7 });
8
9 it("must be object, is object", function () {
10 var data = {};
11 var schema = {"type": "object"};
12 var valid = tv4.validate(data, schema);
13 assert.isTrue(valid);
14 });
15
16 it("must be object or string, is object", function () {
17 var data = {};
18 var schema = {"type": ["object", "string"]};
19 var valid = tv4.validate(data, schema);
20 assert.isTrue(valid);
21 });
22
23 it("must be object or string, is array", function () {
24 var data = [];
25 var schema = {"type": ["object", "string"]};
26 var valid = tv4.validate(data, schema);
27 assert.isFalse(valid);
28 });
29
30 it("must be array, is object", function () {
31 var data = {};
32 var schema = {"type": ["array"]};
33 var valid = tv4.validate(data, schema);
34 assert.isFalse(valid);
35 });
36
37 it("must be string, is integer", function () {
38 var data = 5;
39 var schema = {"type": ["string"]};
40 var valid = tv4.validate(data, schema);
41 assert.isFalse(valid);
42 });
43
44 it("must be object, is null", function () {
45 var data = null;
46 var schema = {"type": ["object"]};
47 var valid = tv4.validate(data, schema);
48 assert.isFalse(valid);
49 });
50
51 it("must be null, is null", function () {
52 var data = null;
53 var schema = {"type": "null"};
54 var valid = tv4.validate(data, schema);
55 assert.isTrue(valid);
56 });
57
58 it("doesn't crash on invalid type", function () {
59 var data = null;
60 var schema = {"type": {"foo": "bar"}};
61 var valid = tv4.validate(data, schema);
62 assert.isFalse(valid);
63 });
64 });
+0
-76
test/tests/01 - Any types/02 - enum.js less more
0 describe("Any types 01", function () {
1
2 it("enum [1], was 1", function () {
3 var data = 1;
4 var schema = {"enum": [1]};
5 var valid = tv4.validate(data, schema);
6 assert.isTrue(valid);
7 });
8
9 it("enum [1], was \"1\"", function () {
10 var data = "1";
11 var schema = {"enum": [1]};
12 var valid = tv4.validate(data, schema);
13 assert.isFalse(valid);
14 });
15
16 it("enum [{}], was {}", function () {
17 var data = {};
18 var schema = {"enum": [
19 {}
20 ]};
21 var valid = tv4.validate(data, schema);
22 assert.isTrue(valid);
23 });
24
25 it("enum [{\"key\":\"value\"], was {}", function () {
26 var data = {};
27 var schema = {"enum": [
28 {"key": "value"}
29 ]};
30 var valid = tv4.validate(data, schema);
31 assert.isFalse(valid);
32 });
33
34 it("enum [{\"key\":\"value\"], was {\"key\": \"value\"}", function () {
35 var data = {};
36 var schema = {"enum": [
37 {"key": "value"}
38 ]};
39 var valid = tv4.validate(data, schema);
40 assert.isFalse(valid);
41 });
42
43 it("Enum with array value - success", function () {
44 var data = [1, true, 0];
45 var schema = {"enum": [
46 [1, true, 0],
47 5,
48 {}
49 ]};
50 var valid = tv4.validate(data, schema);
51 assert.isTrue(valid);
52 });
53
54 it("Enum with array value - failure 1", function () {
55 var data = [1, true, 0, 5];
56 var schema = {"enum": [
57 [1, true, 0],
58 5,
59 {}
60 ]};
61 var valid = tv4.validate(data, schema);
62 assert.isFalse(valid);
63 });
64
65 it("Enum with array value - failure 2", function () {
66 var data = [1, true, 5];
67 var schema = {"enum": [
68 [1, true, 0],
69 5,
70 {}
71 ]};
72 var valid = tv4.validate(data, schema);
73 assert.isFalse(valid);
74 });
75 });
+0
-30
test/tests/02 - Numeric/01 - multipleOf.js less more
0 describe("Numeric - multipleOf", function () {
1
2 it("pass", function () {
3 var data = 5;
4 var schema = {"multipleOf": 2.5};
5 var valid = tv4.validate(data, schema);
6 assert.isTrue(valid);
7 });
8
9 it("fail", function () {
10 var data = 5;
11 var schema = {"multipleOf": 0.75};
12 var valid = tv4.validate(data, schema);
13 assert.isFalse(valid);
14 });
15
16 it("floating-point pass 6.6/2.2", function () {
17 var data = 6.6;
18 var schema = {"multipleOf": 2.2};
19 var valid = tv4.validate(data, schema);
20 assert.isTrue(valid);
21 });
22
23 it("floating-point pass 6.6666/2.2222", function () {
24 var data = 6.6666;
25 var schema = {"multipleOf": 2.2222};
26 var valid = tv4.validate(data, schema);
27 assert.isTrue(valid);
28 });
29 });
+0
-58
test/tests/02 - Numeric/02 - min-max.js less more
0 describe("Numberic 02", function () {
1
2 it("minimum success", function () {
3 var data = 5;
4 var schema = {minimum: 2.5};
5 var valid = tv4.validate(data, schema);
6 assert.isTrue(valid);
7 });
8
9 it("minimum failure", function () {
10 var data = 5;
11 var schema = {minimum: 7};
12 var valid = tv4.validate(data, schema);
13 assert.isFalse(valid);
14 });
15
16 it("minimum equality success", function () {
17 var data = 5;
18 var schema = {minimum: 5};
19 var valid = tv4.validate(data, schema);
20 assert.isTrue(valid);
21 });
22
23 it("minimum equality failure", function () {
24 var data = 5;
25 var schema = {minimum: 5, exclusiveMinimum: true};
26 var valid = tv4.validate(data, schema);
27 assert.isFalse(valid);
28 });
29
30 it("maximum success", function () {
31 var data = 5;
32 var schema = {maximum: 7};
33 var valid = tv4.validate(data, schema);
34 assert.isTrue(valid);
35 });
36
37 it("maximum failure", function () {
38 var data = -5;
39 var schema = {maximum: -10};
40 var valid = tv4.validate(data, schema);
41 assert.isFalse(valid);
42 });
43
44 it("maximum equality success", function () {
45 var data = 5;
46 var schema = {maximum: 5};
47 var valid = tv4.validate(data, schema);
48 assert.isTrue(valid);
49 });
50
51 it("maximum equality failure", function () {
52 var data = 5;
53 var schema = {maximum: 5, exclusiveMaximum: true};
54 var valid = tv4.validate(data, schema);
55 assert.isFalse(valid);
56 });
57 });
+0
-53
test/tests/02 - Numeric/03 - NaN.js less more
0 describe("Numeric 03", function () {
1
2 it("NaN failure", function() {
3 var data = NaN;
4 var schema = {};
5 var valid = tv4.validate(data, schema);
6 assert.isFalse(valid);
7 });
8
9 it("Infinity failure", function() {
10 var data = Infinity;
11 var schema = {};
12 var valid = tv4.validate(data, schema);
13 assert.isFalse(valid);
14 });
15
16 it("-Infinity failure", function() {
17 var data = -Infinity;
18 var schema = {};
19 var valid = tv4.validate(data, schema);
20 assert.isFalse(valid);
21 });
22
23 it("string to number failure", function() {
24 var data = Number('foo');
25 var schema = {};
26 var valid = tv4.validate(data, schema);
27 assert.isFalse(valid);
28 });
29
30 it("string to number success", function() {
31 var data = Number('123');
32 var schema = {};
33 var valid = tv4.validate(data, schema);
34 assert.isTrue(valid);
35 });
36
37 it("max value success", function() {
38 var data = Number.MAX_VALUE;
39 var schema = {};
40 var valid = tv4.validate(data, schema);
41 assert.isTrue(valid);
42 });
43
44 /* Travis reports: Bad number '1.798e+308' (which is a good thing, as it should be Infinity)
45 it("big number failure", function() {
46 var data = 1.798e+308;
47 var schema = {};
48 var valid = tv4.validate(data, schema);
49 assert.isFalse(valid);
50 });
51 */
52 });
+0
-46
test/tests/03 - Strings/01 - min-max length.js less more
0 describe("Strings 01", function () {
1
2 it("no length constraints", function () {
3 var data = "test";
4 var schema = {};
5 var valid = tv4.validate(data, schema);
6 assert.isTrue(valid);
7 });
8
9 it("minimum length success", function () {
10 var data = "test";
11 var schema = {minLength: 3};
12 var valid = tv4.validate(data, schema);
13 assert.isTrue(valid);
14 });
15
16 it("minimum length failure", function () {
17 var data = "test";
18 var schema = {minLength: 5};
19 var valid = tv4.validate(data, schema);
20 assert.isFalse(valid);
21 });
22
23 it("maximum length success", function () {
24 var data = "test1234";
25 var schema = {maxLength: 10};
26 var valid = tv4.validate(data, schema);
27 assert.isTrue(valid);
28 });
29
30 it("maximum length failure", function () {
31 var data = "test1234";
32 var schema = {maxLength: 5};
33 var valid = tv4.validate(data, schema);
34 assert.isFalse(valid);
35 });
36
37 it("check error message", function () {
38 var data = "test1234";
39 var schema = {maxLength: 5};
40 var valid = tv4.validate(data, schema);
41 assert.isFalse(valid);
42 //return typeof tv4.error.message !== "undefined";
43 assert.ok(tv4.error.message);
44 });
45 });
+0
-30
test/tests/03 - Strings/02 - pattern.js less more
0 describe("Strings 02", function () {
1
2 it("pattern success", function () {
3 var data = "9test";
4 var schema = {"pattern": "^[0-9][a-zA-Z]*$"};
5 var valid = tv4.validate(data, schema);
6 assert.isTrue(valid);
7 });
8
9 it("pattern failure", function () {
10 var data = "9test9";
11 var schema = {"pattern": "^[0-9][a-zA-Z]*$"};
12 var valid = tv4.validate(data, schema);
13 assert.isFalse(valid);
14 });
15
16 it("accepts RegExp object", function () {
17 var data = "9test";
18 var schema = {"pattern": /^[0-9][a-zA-Z]*$/};
19 var valid = tv4.validate(data, schema);
20 assert.isTrue(valid);
21 });
22
23 it("accepts RegExp literal", function () {
24 var data = "9TEST";
25 var schema = {"pattern": "/^[0-9][a-z]*$/i"};
26 var valid = tv4.validate(data, schema);
27 assert.isTrue(valid);
28 });
29 });
+0
-37
test/tests/04 - Arrays/01 - min-max length.js less more
0 describe("Arrays 01", function () {
1
2 it("no length constraints", function () {
3 var data = [1, 2, 3];
4 var schema = {};
5 var valid = tv4.validate(data, schema);
6 assert.isTrue(valid);
7 });
8
9 it("minimum length success", function () {
10 var data = [1, 2, 3];
11 var schema = {minItems: 3};
12 var valid = tv4.validate(data, schema);
13 assert.isTrue(valid);
14 });
15
16 it("minimum length failure", function () {
17 var data = [1, 2, 3];
18 var schema = {minItems: 5};
19 var valid = tv4.validate(data, schema);
20 assert.isFalse(valid);
21 });
22
23 it("maximum length success", function () {
24 var data = [1, 2, 3, 4, 5];
25 var schema = {maxItems: 10};
26 var valid = tv4.validate(data, schema);
27 assert.isTrue(valid);
28 });
29
30 it("maximum length failure", function () {
31 var data = [1, 2, 3, 4, 5];
32 var schema = {maxItems: 3};
33 var valid = tv4.validate(data, schema);
34 assert.isFalse(valid);
35 });
36 });
+0
-16
test/tests/04 - Arrays/02 - uniqueItems.js less more
0 describe("Arrays 02", function () {
1
2 it("uniqueItems success", function () {
3 var data = [1, true, "1"];
4 var schema = {uniqueItems: true};
5 var valid = tv4.validate(data, schema);
6 assert.isTrue(valid);
7 });
8
9 it("uniqueItems failure", function () {
10 var data = [1, true, "1", 1];
11 var schema = {uniqueItems: true};
12 var valid = tv4.validate(data, schema);
13 assert.isFalse(valid);
14 });
15 });
+0
-24
test/tests/04 - Arrays/03 - items (plain).js less more
0 describe("Arrays 03", function () {
1
2 it("plain items success", function () {
3 var data = [1, 2, 3, 4];
4 var schema = {
5 "items": {
6 "type": "integer"
7 }
8 };
9 var valid = tv4.validate(data, schema);
10 assert.isTrue(valid);
11 });
12
13 it("plain items failure", function () {
14 var data = [1, 2, true, 3];
15 var schema = {
16 "items": {
17 "type": "integer"
18 }
19 };
20 var valid = tv4.validate(data, schema);
21 assert.isFalse(valid);
22 });
23 });
+0
-26
test/tests/04 - Arrays/04 - items (tuple-typing).js less more
0 describe("Arrays 04", function () {
1
2 it("plain items success", function () {
3 var data = [1, true, "one"];
4 var schema = {
5 "items": [
6 {"type": "integer"},
7 {"type": "boolean"}
8 ]
9 };
10 var valid = tv4.validate(data, schema);
11 assert.isTrue(valid);
12 });
13
14 it("plain items failure", function () {
15 var data = [1, null, "one"];
16 var schema = {
17 "items": [
18 {"type": "integer"},
19 {"type": "boolean"}
20 ]
21 };
22 var valid = tv4.validate(data, schema);
23 assert.isFalse(valid);
24 });
25 });
+0
-54
test/tests/04 - Arrays/05 - additionalItems.js less more
0 describe("Arrays 05", function () {
1
2 it("additional items schema success", function () {
3 var data = [1, true, "one", "uno"];
4 var schema = {
5 "items": [
6 {"type": "integer"},
7 {"type": "boolean"}
8 ],
9 "additionalItems": {"type": "string"}
10 };
11 var valid = tv4.validate(data, schema);
12 assert.isTrue(valid);
13 });
14
15 it("additional items schema failure", function () {
16 var data = [1, true, "one", 1];
17 var schema = {
18 "items": [
19 {"type": "integer"},
20 {"type": "boolean"}
21 ],
22 "additionalItems": {"type": "string"}
23 };
24 var valid = tv4.validate(data, schema);
25 assert.isFalse(valid);
26 });
27
28 it("additional items boolean success", function () {
29 var data = [1, true, "one", "uno"];
30 var schema = {
31 "items": [
32 {"type": "integer"},
33 {"type": "boolean"}
34 ],
35 "additionalItems": true
36 };
37 var valid = tv4.validate(data, schema);
38 assert.isTrue(valid);
39 });
40
41 it("additional items boolean failure", function () {
42 var data = [1, true, "one", "uno"];
43 var schema = {
44 "items": [
45 {"type": "integer"},
46 {"type": "boolean"}
47 ],
48 "additionalItems": false
49 };
50 var valid = tv4.validate(data, schema);
51 assert.isFalse(valid);
52 });
53 });
+0
-30
test/tests/05 - Objects/01 - min-max properties.js less more
0 describe("Objects 01", function () {
1
2 it("minimum length success", function () {
3 var data = {key1: 1, key2: 2, key3: 3};
4 var schema = {minProperties: 3};
5 var valid = tv4.validate(data, schema);
6 assert.isTrue(valid);
7 });
8
9 it("minimum length failure", function () {
10 var data = {key1: 1, key2: 2, key3: 3};
11 var schema = {minProperties: 5};
12 var valid = tv4.validate(data, schema);
13 assert.isFalse(valid);
14 });
15
16 it("maximum length success", function () {
17 var data = {key1: 1, key2: 2, key3: 3};
18 var schema = {maxProperties: 5};
19 var valid = tv4.validate(data, schema);
20 assert.isTrue(valid);
21 });
22
23 it("maximum length failure", function () {
24 var data = {key1: 1, key2: 2, key3: 3};
25 var schema = {maxProperties: 2};
26 var valid = tv4.validate(data, schema);
27 assert.isFalse(valid);
28 });
29 });
+0
-16
test/tests/05 - Objects/02 - required.js less more
0 describe("Objects 02", function () {
1
2 it("required success", function () {
3 var data = {key1: 1, key2: 2, key3: 3};
4 var schema = {required: ["key1", "key2"]};
5 var valid = tv4.validate(data, schema);
6 assert.isTrue(valid);
7 });
8
9 it("required failure", function () {
10 var data = {key1: 1, key2: 2, key3: 3};
11 var schema = {required: ["key1", "notDefined"]};
12 var valid = tv4.validate(data, schema);
13 assert.isFalse(valid);
14 });
15 });
+0
-26
test/tests/05 - Objects/03 - properties.js less more
0 describe("Objects 03", function () {
1
2 it("properties success", function () {
3 var data = {intKey: 1, stringKey: "one"};
4 var schema = {
5 properties: {
6 intKey: {"type": "integer"},
7 stringKey: {"type": "string"}
8 }
9 };
10 var valid = tv4.validate(data, schema);
11 assert.isTrue(valid);
12 });
13
14 it("properties failure", function () {
15 var data = {intKey: 1, stringKey: false};
16 var schema = {
17 properties: {
18 intKey: {"type": "integer"},
19 stringKey: {"type": "string"}
20 }
21 };
22 var valid = tv4.validate(data, schema);
23 assert.isFalse(valid);
24 });
25 });
+0
-44
test/tests/05 - Objects/04 - patternProperties.js less more
0 describe("Objects 04", function () {
1
2 it("patternProperties success", function () {
3 var data = {intKey: 1, intKey2: 5};
4 var schema = {
5 properties: {
6 intKey: {"type": "integer"}
7 },
8 patternProperties: {
9 "^int": {minimum: 0}
10 }
11 };
12 var valid = tv4.validate(data, schema);
13 assert.isTrue(valid);
14 });
15
16 it("patternProperties failure 1", function () {
17 var data = {intKey: 1, intKey2: 5};
18 var schema = {
19 properties: {
20 intKey: {minimum: 5}
21 },
22 patternProperties: {
23 "^int": {"type": "integer"}
24 }
25 };
26 var valid = tv4.validate(data, schema);
27 assert.isFalse(valid);
28 });
29
30 it("patternProperties failure 2", function () {
31 var data = {intKey: 10, intKey2: "string value"};
32 var schema = {
33 properties: {
34 intKey: {minimum: 5}
35 },
36 patternProperties: {
37 "^int": {"type": "integer"}
38 }
39 };
40 var valid = tv4.validate(data, schema);
41 assert.isFalse(valid);
42 });
43 });
+0
-62
test/tests/05 - Objects/05 - additionalProperties.js less more
0 describe("Objects 05", function () {
1
2 it("additionalProperties schema success", function () {
3 var data = {intKey: 1, intKey2: 5, stringKey: "string"};
4 var schema = {
5 properties: {
6 intKey: {"type": "integer"}
7 },
8 patternProperties: {
9 "^int": {minimum: 0}
10 },
11 additionalProperties: {"type": "string"}
12 };
13 var valid = tv4.validate(data, schema);
14 assert.isTrue(valid);
15 });
16
17 it("patternProperties schema failure", function () {
18 var data = {intKey: 10, intKey2: 5, stringKey: null};
19 var schema = {
20 properties: {
21 intKey: {minimum: 5}
22 },
23 patternProperties: {
24 "^int": {"type": "integer"}
25 },
26 additionalProperties: {"type": "string"}
27 };
28 var valid = tv4.validate(data, schema);
29 assert.isFalse(valid);
30 });
31
32 it("patternProperties boolean success", function () {
33 var data = {intKey: 10, intKey2: 5, stringKey: null};
34 var schema = {
35 properties: {
36 intKey: {minimum: 5}
37 },
38 patternProperties: {
39 "^int": {"type": "integer"}
40 },
41 additionalProperties: true
42 };
43 var valid = tv4.validate(data, schema);
44 assert.isTrue(valid);
45 });
46
47 it("patternProperties boolean failure", function () {
48 var data = {intKey: 10, intKey2: 5, stringKey: null};
49 var schema = {
50 properties: {
51 intKey: {minimum: 5}
52 },
53 patternProperties: {
54 "^int": {"type": "integer"}
55 },
56 additionalProperties: false
57 };
58 var valid = tv4.validate(data, schema);
59 assert.isFalse(valid);
60 });
61 });
+0
-76
test/tests/05 - Objects/06 - dependencies.js less more
0 describe("Objects 06", function () {
1
2 it("string dependency success", function () {
3 var data = {key1: 5, key2: "string"};
4 var schema = {
5 dependencies: {
6 key1: "key2"
7 }
8 };
9 var valid = tv4.validate(data, schema);
10 assert.isTrue(valid);
11 });
12
13 it("string dependency failure", function () {
14 var data = {key1: 5};
15 var schema = {
16 dependencies: {
17 key1: "key2"
18 }
19 };
20 var valid = tv4.validate(data, schema);
21 assert.isFalse(valid);
22 });
23
24 it("array dependency success", function () {
25 var data = {key1: 5, key2: "string"};
26 var schema = {
27 dependencies: {
28 key1: ["key2"]
29 }
30 };
31 var valid = tv4.validate(data, schema);
32 assert.isTrue(valid);
33 });
34
35 it("array dependency failure", function () {
36 var data = {key1: 5};
37 var schema = {
38 dependencies: {
39 key1: ["key2"]
40 }
41 };
42 var valid = tv4.validate(data, schema);
43 assert.isFalse(valid);
44 });
45
46 it("schema dependency success", function () {
47 var data = {key1: 5, key2: "string"};
48 var schema = {
49 dependencies: {
50 key1: {
51 properties: {
52 key2: {"type": "string"}
53 }
54 }
55 }
56 };
57 var valid = tv4.validate(data, schema);
58 assert.isTrue(valid);
59 });
60
61 it("schema dependency failure", function () {
62 var data = {key1: 5, key2: 5};
63 var schema = {
64 dependencies: {
65 key1: {
66 properties: {
67 key2: {"type": "string"}
68 }
69 }
70 }
71 };
72 var valid = tv4.validate(data, schema);
73 assert.isFalse(valid);
74 });
75 });
+0
-26
test/tests/06 - Combinations/01 - allOf.js less more
0 describe("Combinators 01", function () {
1
2 it("allOf success", function () {
3 var data = 10;
4 var schema = {
5 "allOf": [
6 {"type": "integer"},
7 {"minimum": 5}
8 ]
9 };
10 var valid = tv4.validate(data, schema);
11 assert.isTrue(valid);
12 });
13
14 it("allOf failure", function () {
15 var data = 1;
16 var schema = {
17 "allOf": [
18 {"type": "integer"},
19 {"minimum": 5}
20 ]
21 };
22 var valid = tv4.validate(data, schema);
23 assert.isFalse(valid);
24 });
25 });
+0
-27
test/tests/06 - Combinations/02- anyOf.js less more
0 describe("Combinators 02", function () {
1
2 it("anyOf success", function () {
3 var data = "hello";
4 var schema = {
5 "anyOf": [
6 {"type": "integer"},
7 {"type": "string"},
8 {"minLength": 1}
9 ]
10 };
11 var valid = tv4.validate(data, schema);
12 assert.isTrue(valid);
13 });
14
15 it("anyOf failure", function () {
16 var data = true;
17 var schema = {
18 "anyOf": [
19 {"type": "integer"},
20 {"type": "string"}
21 ]
22 };
23 var valid = tv4.validate(data, schema);
24 assert.isFalse(valid);
25 });
26 });
+0
-41
test/tests/06 - Combinations/03 - oneOf.js less more
0 describe("Combinators 03", function () {
1
2 it("oneOf success", function () {
3 var data = 5;
4 var schema = {
5 "oneOf": [
6 {"type": "integer"},
7 {"type": "string"},
8 {"type": "string", minLength: 1}
9 ]
10 };
11 var valid = tv4.validate(data, schema);
12 assert.isTrue(valid);
13 });
14
15 it("oneOf failure (too many)", function () {
16 var data = "string";
17 var schema = {
18 "oneOf": [
19 {"type": "integer"},
20 {"type": "string"},
21 {"minLength": 1}
22 ]
23 };
24 var valid = tv4.validate(data, schema);
25 assert.isFalse(valid);
26 });
27
28 it("oneOf failure (no matches)", function () {
29 var data = false;
30 var schema = {
31 "oneOf": [
32 {"type": "integer"},
33 {"type": "string"},
34 {"type": "string", "minLength": 1}
35 ]
36 };
37 var valid = tv4.validate(data, schema);
38 assert.isFalse(valid);
39 });
40 });
+0
-20
test/tests/06 - Combinations/04 - not.js less more
0 describe("Combinators 04", function () {
1
2 it("not success", function () {
3 var data = 5;
4 var schema = {
5 "not": {"type": "string"}
6 };
7 var valid = tv4.validate(data, schema);
8 assert.isTrue(valid);
9 });
10
11 it("not failure", function () {
12 var data = "test";
13 var schema = {
14 "not": {"type": "string"}
15 };
16 var valid = tv4.validate(data, schema);
17 assert.isFalse(valid);
18 });
19 });
+0
-68
test/tests/07 - $ref/01 - normalise.js less more
0 describe("$ref 01", function () {
1
2 it("normalise - untouched immediate $ref", function () {
3 var schema = {
4 "items": {"$ref": "#"}
5 };
6 tv4.normSchema(schema);
7 assert.propertyVal(schema.items, '$ref', "#");
8 //return schema.items['$ref'] == "#";
9 });
10
11 it("normalise - id as base", function () {
12 var schema = {
13 "id": "baseUrl",
14 "items": {"$ref": "#"}
15 };
16 tv4.normSchema(schema);
17 assert.propertyVal(schema.items, '$ref', "baseUrl#");
18 //return schema.items['$ref'] == "baseUrl#";
19 });
20
21 it("normalise - id relative to parent", function () {
22 var schema = {
23 "id": "http://example.com/schema",
24 "items": {
25 "id": "otherSchema",
26 "items": {
27 "$ref": "#"
28 }
29 }
30 };
31 tv4.normSchema(schema);
32 assert.strictEqual(schema.items.id, "http://example.com/otherSchema", "schema.items.id");
33 assert.strictEqual(schema.items.items['$ref'], "http://example.com/otherSchema#", "$ref");
34 //this.assert(schema.items.id == "http://example.com/otherSchema", "schema.items.id");
35 //this.assert(schema.items.items['$ref'] == "http://example.com/otherSchema#", "$ref");
36 });
37
38 it("normalise - do not touch contents of \"enum\"", function () {
39 var schema = {
40 "id": "http://example.com/schema",
41 "items": {
42 "id": "otherSchema",
43 "enum": [
44 {
45 "$ref": "#"
46 }
47 ]
48 }
49 };
50 tv4.normSchema(schema);
51 assert.strictEqual(schema.items['enum'][0]['$ref'], "#");
52 //this.assert(schema.items['enum'][0]['$ref'] == "#");
53 });
54
55 it("Only normalise id and $ref if they are strings", function () {
56 var schema = {
57 "properties": {
58 "id": {"type": "integer"},
59 "$ref": {"type": "integer"}
60 }
61 };
62 var data = {"id": "test", "$ref": "test"};
63 tv4.normSchema(schema);
64 var valid = tv4.validate(data, schema);
65 assert.isFalse(valid);
66 });
67 });
+0
-32
test/tests/07 - $ref/02 - list missing URLs.js less more
0 describe("$ref 02", function () {
1
2 it("skip unneeded", function () {
3 var schema = {
4 "items": {"$ref": "http://example.com/schema#"}
5 };
6 tv4.validate([], schema);
7 assert.notProperty(tv4.missing, "http://example.com/schema");
8 assert.length(tv4.missing, 0);
9 //return !tv4.missing["http://example.com/schema"]
10 // && tv4.missing.length == 0;
11 });
12
13 it("list missing (map)", function () {
14 var schema = {
15 "items": {"$ref": "http://example.com/schema#"}
16 };
17 tv4.validate([1, 2, 3], schema);
18 assert.property(tv4.missing, "http://example.com/schema");
19 //return !!tv4.missing["http://example.com/schema"];
20 });
21
22 it("list missing (index)", function () {
23 var schema = {
24 "items": {"$ref": "http://example.com/schema#"}
25 };
26 tv4.validate([1, 2, 3], schema);
27 assert.length(tv4.missing, 1);
28 assert.strictEqual(tv4.missing[0], "http://example.com/schema");
29 //return tv4.missing[0] == "http://example.com/schema";
30 });
31 });
+0
-91
test/tests/07 - $ref/03 - getSchema.js less more
0 describe("$ref 03", function () {
1
2 it("addSchema(), getSchema()", function () {
3 var url = "http://example.com/schema";
4 var schema = {
5 "test": "value"
6 };
7 tv4.addSchema(url, schema);
8 var fetched = tv4.getSchema(url);
9 assert.strictEqual(fetched.test, "value");
10 //return fetched.test == "value";
11 });
12
13 it("addSchema(), getSchema() with blank fragment", function () {
14 var url = "http://example.com/schema";
15 var schema = {
16 "test": "value"
17 };
18 tv4.addSchema(url, schema);
19 var fetched = tv4.getSchema(url + "#");
20 assert.strictEqual(fetched.test, "value");
21 //return fetched.test == "value";
22 });
23
24 it("addSchema(), getSchema() with pointer path fragment", function () {
25 var url = "http://example.com/schema";
26 var schema = {
27 "items": {
28 "properties": {
29 "key[]": {
30 "inner/key~": "value"
31 }
32 }
33 }
34 };
35 tv4.addSchema(url, schema);
36 var fetched = tv4.getSchema(url + "#/items/properties/key%5B%5D/inner~1key~0");
37 assert.strictEqual(fetched, "value");
38 //return fetched == "value";
39 });
40
41 it("addSchema(), getSchema() adds referred schemas", function () {
42 tv4 = tv4.freshApi();
43
44 var data = [123, true];
45 var valid;
46 var url = "http://example.com/schema";
47 var schema = {
48 "type": "array",
49 "items": {"$ref": "http://example.com/schema/sub#item"}
50 };
51 tv4.addSchema(url, schema);
52
53 //test missing
54 valid = tv4.validate(data, schema);
55 assert.isTrue(valid);
56 assert.length(tv4.missing, 1);
57 assert.isUndefined(tv4.getSchema('http://example.com/schema/sub'));
58
59 var item = {
60 "id": "#item",
61 "type": "boolean"
62 };
63 var sub = {
64 "id": "http://example.com/schema/sub",
65 "type": "object",
66 "lib": {
67 "item": item
68 }
69 };
70 tv4.addSchema(sub);
71
72 //added it?
73 assert.equal(tv4.getSchema(url), schema);
74 assert.equal(tv4.getSchema('http://example.com/schema/sub'), sub);
75 assert.equal(tv4.getSchema('http://example.com/schema/sub#item'), item);
76
77 //now use it
78 valid = tv4.validate(data, schema);
79 assert.length(tv4.missing, 0);
80 assert.isFalse(valid);
81
82 var error = {
83 code: 0,
84 message: 'Invalid type: number (expected boolean)',
85 dataPath: '/0',
86 schemaPath: '/items/type',
87 subErrors: null };
88 assert.propertyValues(tv4.error, error);
89 });
90 });
+0
-40
test/tests/07 - $ref/04 - ref.js less more
0 describe("$ref 04", function () {
1
2 it("addSchema(), $ref", function () {
3 var url = "http://example.com/schema";
4 var schema = {
5 "test": "value"
6 };
7 tv4.addSchema(url, schema);
8
9 var otherSchema = {
10 "items": {"$ref": url}
11 };
12 var valid = tv4.validate([0,1,2,3], otherSchema);
13
14 assert.isTrue(valid, "should be valid");
15 assert.length(tv4.missing, 0, "should have no missing schemas");
16
17 //this.assert(valid, "should be valid");
18 //this.assert(tv4.missing.length == 0, "should have no missing schemas");
19 });
20
21 it("internal $ref", function () {
22 var schema = {
23 "type": "array",
24 "items": {"$ref": "#"}
25 };
26
27 assert.isTrue(tv4.validate([[],[[]]], schema), "List of lists should be valid");
28 assert.isTrue(!tv4.validate([0,1,2,3], schema), "List of ints should not");
29 assert.isTrue(!tv4.validate([[true], []], schema), "List of list with boolean should not");
30
31 assert.length(tv4.missing, 0, "should have no missing schemas");
32
33 //this.assert(tv4.validate([[],[[]]], schema), "List of lists should be valid");
34 //this.assert(!tv4.validate([0,1,2,3], schema), "List of ints should not");
35 //this.assert(!tv4.validate([[true], []], schema), "List of list with boolean should not");
36
37 //this.assert(tv4.missing.length == 0, "should have no missing schemas");
38 });
39 });
+0
-50
test/tests/07 - $ref/05 - inline addressing.js less more
0 describe("$ref 05", function () {
1
2 it("inline addressing for fragments", function () {
3 var schema = {
4 "type": "array",
5 "items": {"$ref": "#test"},
6 "testSchema": {
7 "id": "#test",
8 "type": "boolean"
9 }
10 };
11 var error = {
12 code: 0,
13 message: 'Invalid type: number (expected boolean)',
14 dataPath: '/0',
15 schemaPath: '/items/type',
16 subErrors: null
17 };
18
19 var data = [0, false];
20 var valid = tv4.validate(data, schema);
21 assert.isFalse(valid, 'inline addressing invalid 0, false');
22 assert.propertyValues(tv4.error, error, 'errors equal');
23 });
24
25 it("don't trust non sub-paths", function () {
26 var examplePathBase = "http://example.com/schema";
27 var examplePath = examplePathBase + "/schema";
28 var schema = {
29 "id": examplePath,
30 "type": "array",
31 "items": {"$ref": "other-schema"},
32 "testSchema": {
33 "id": "/other-schema",
34 "type": "boolean"
35 }
36 };
37 tv4.addSchema(examplePath, schema);
38 var data = [0, false];
39 var valid = tv4.validate(data, examplePath);
40
41 assert.length(tv4.missing, 1, "should have missing schema");
42 assert.strictEqual(tv4.missing[0], examplePathBase + "/other-schema", "incorrect schema missing: " + tv4.missing[0]);
43 assert.isTrue(valid, "should pass, as remote schema not found");
44
45 //this.assert(tv4.missing.length == 1, "should have missing schema");
46 //this.assert(tv4.missing[0] == examplePathBase + "/other-schema", "incorrect schema missing: " + tv4.missing[0]);
47 //this.assert(valid, "should pass, as remote schema not found");
48 });
49 });
+0
-31
test/tests/07 - $ref/06 - multiple refs.js less more
0 describe("$refs to $refs", function () {
1 it("addSchema(), $ref", function () {
2 var schema = {
3 id: "http://example.com/schema",
4 some: {
5 other: {type: "number"}
6 },
7 data: {'$ref': "#/some/other"}
8 };
9
10 tv4.addSchema(schema);
11 assert.isTrue(tv4.validate(42, {"$ref": "http://example.com/schema#/data"}), "42 valid");
12 //assert.isFalse(tv4.validate(42, {"$ref": "http://example.com/schema#/data"}), "\"42\" invalid");
13
14 assert.length(tv4.missing, 0, "should have no missing schemas");
15 });
16
17 it("Don't hang on circle", function () {
18 var schema = {
19 id: "http://example.com/schema",
20 ref1: {"$ref": "#/ref2"},
21 ref2: {"$ref": "#/ref1"}
22 };
23
24 tv4.addSchema(schema);
25 var result = tv4.validateResult(42, "http://example.com/schema#/ref1");
26
27 assert.isFalse(result.valid, "not valid");
28 assert.equal(result.error.code, tv4.errorCodes.CIRCULAR_REFERENCE, 'Error code correct');
29 });
30 });
+0
-20
test/tests/08 - API/01 - validateResult.js less more
0 describe("API 01", function () {
1
2 it("validateResult returns object with appropriate properties", function () {
3 var data = {};
4 var schema = {"type": "array"};
5 tv4.error = null;
6 tv4.missing = [];
7 var result = tv4.validateResult(data, schema);
8
9 assert.isFalse(result.valid, "result.valid === false");
10 assert.isTypeOf(result.error, "object", "result.error is object");
11 assert.isArray(result.missing, "result.missing is array");
12 assert.isFalse(!!tv4.error, "tv4.error == null");
13
14 //this.assert(result.valid === false, "result.valid === false");
15 //this.assert(typeof result.error == "object", "result.error is object");
16 //this.assert(Array.isArray(result.missing), "result.missing is array");
17 //this.assert(tv4.error == null, "tv4.error == null");
18 });
19 });
+0
-7
test/tests/08 - API/02 - errorCodes existence.js less more
0 describe("API 02", function () {
1
2 it("tv4.errorCodes exists", function () {
3 assert.isObject(tv4.errorCodes);
4 //return typeof tv4.errorCodes == "object";
5 });
6 });
+0
-132
test/tests/08 - API/03 - get schema URIs.js less more
0 describe("API 03", function () {
1
2 it("getSchemaUris() on clean tv4 returns an empty array", function () {
3 var list = tv4.getSchemaUris();
4 assert.isArray(list);
5 assert.length(list, 0);
6 });
7
8 it("getSchemaUris() returns newly added schema urls", function () {
9 tv4.addSchema("http://example.com/schema", {type: "object"});
10 var list = tv4.getSchemaUris();
11 assert.isArray(list);
12 assert.length(list, 1);
13 assert.strictEqual(list[0], "http://example.com/schema");
14 });
15
16 it("getMissingUris() returns only missing items", function () {
17 var schema = {
18 "items": {"$ref": "http://example.com/schema/item#"}
19 };
20 tv4.addSchema("http://example.com/schema/main", schema);
21
22 var item = {
23 "id": "http://example.com/schema/item",
24 "type": "boolean"
25 };
26
27 var list;
28 list = tv4.getSchemaUris();
29 assert.isArray(list);
30 assert.length(list, 1);
31 assert.includes(list, "http://example.com/schema/main", 'map has main uri');
32
33 list = tv4.getMissingUris();
34 assert.isArray(list);
35 assert.length(list, 1);
36 assert.includes(list, "http://example.com/schema/item", 'map has item uri');
37
38 tv4.addSchema(item);
39
40 list = tv4.getMissingUris();
41 assert.isArray(list);
42 assert.length(list, 0);
43 });
44
45 it("getSchemaUris() optionally return filtered items", function () {
46 var schema = {
47 "items": {"$ref": "http://example.com/schema/item#"}
48 };
49 tv4.addSchema("http://example.com/schema/main", schema);
50
51 var list;
52 list = tv4.getSchemaUris(/schema\/main/);
53 assert.isArray(list);
54 assert.length(list, 1, 'list 1 main');
55 assert.includes(list, "http://example.com/schema/main");
56
57 list = tv4.getMissingUris(/^https?/);
58 assert.isArray(list);
59 assert.length(list, 1, 'list 1 item');
60 assert.includes(list, "http://example.com/schema/item");
61 });
62
63 it("getSchemaUris() returns unique uris without fragment", function () {
64 var schema = {
65 "properties": {
66 "alpha": {
67 "$ref": "http://example.com/schema/lib#alpha"
68 },
69 "beta": {
70 "$ref": "http://example.com/schema/lib#beta"
71 }
72 }
73 };
74 tv4.addSchema("http://example.com/schema/main", schema);
75 var sub = {
76 "id": "http://example.com/schema/item",
77 "items": {
78 "type": "boolean"
79 }
80 };
81 tv4.addSchema(sub);
82
83 var list;
84 list = tv4.getSchemaUris();
85 assert.isArray(list);
86 assert.length(list, 2);
87 assert.includes(list, "http://example.com/schema/main");
88 assert.includes(list, "http://example.com/schema/item");
89
90 list = tv4.getMissingUris();
91 assert.isArray(list);
92 assert.length(list, 1);
93 assert.includes(list, "http://example.com/schema/lib");
94 });
95
96
97 it("getSchemaMap() on clean tv4 returns an empty object", function () {
98 var map = tv4.getSchemaMap();
99 assert.isObject(map);
100 assert.isNotArray(map);
101 var list = Object.keys(map);
102 assert.length(list, 0);
103 });
104
105 it("getSchemaMap() returns an object mapping uris to schemas", function () {
106 var schema = {
107 "properties": {
108 "alpha": {
109 "$ref": "http://example.com/schema/lib#alpha"
110 },
111 "beta": {
112 "$ref": "http://example.com/schema/lib#beta"
113 }
114 }
115 };
116 tv4.addSchema("http://example.com/schema/main", schema);
117 var sub = {
118 "id": "http://example.com/schema/item",
119 "items": {
120 "type": "boolean"
121 }
122 };
123 tv4.addSchema(sub);
124
125 var map;
126 map = tv4.getSchemaMap();
127 assert.length(Object.keys(map), 2);
128 assert.ownPropertyVal(map, "http://example.com/schema/main", schema);
129 assert.ownPropertyVal(map, "http://example.com/schema/item", sub);
130 });
131 });
+0
-105
test/tests/09 - Multiple errors/01 - validateMultiple.js less more
0 describe("Multiple errors 01", function () {
1
2 it("validateMultiple returns array of errors", function () {
3 var data = {};
4 var schema = {"type": "array"};
5 var result = tv4.validateMultiple(data, schema);
6
7 assert.isFalse(result.valid, "data should not be valid");
8 assert.strictEqual(typeof result.errors, "object", "result.errors must be object");
9 assert.isNumber(result.errors.length, "result.errors have numberic length");
10
11 //-> weird: test says be object but it's an array
12
13 //assert.isArray(result.errors, "result.errors must be array-like");
14 //assert.isObject(result.errors, "result.errors must be object");
15
16 //this.assert(result.valid == false, "data should not be valid");
17 //this.assert(typeof result.errors == "object" && typeof result.errors.length == "number", "result.errors must be array-like");
18 });
19
20 it("validateMultiple has multiple entries", function () {
21 var data = {"a": 1, "b": 2};
22 var schema = {"additionalProperties": {"type": "string"}};
23 var result = tv4.validateMultiple(data, schema);
24
25 assert.length(result.errors, 2, "should return two errors");
26 //this.assert(result.errors.length == 2, "should return two errors");
27 });
28
29 it("validateMultiple correctly fails anyOf", function () {
30 var data = {};
31 var schema = {
32 "anyOf": [
33 {"type": "string"},
34 {"type": "integer"}
35 ]
36 };
37 var result = tv4.validateMultiple(data, schema);
38
39 assert.isFalse(result.valid, "should not validate");
40 assert.length(result.errors, 1, "should list one error");
41
42 //this.assert(result.valid == false, "should not validate");
43 //this.assert(result.errors.length == 1, "should list one error");
44 });
45
46 it("validateMultiple correctly fails not", function () {
47 var data = {};
48 var schema = {
49 "not": {"type": "object"}
50 };
51 var result = tv4.validateMultiple(data, schema);
52
53 assert.isFalse(result.valid, "should not validate");
54 assert.length(result.errors, 1, "should list one error");
55
56 //this.assert(result.valid == false, "should not validate");
57 //this.assert(result.errors.length == 1, "should list one error");
58 });
59
60 it("validateMultiple correctly passes not", function () {
61 var data = {};
62 var schema = {
63 "not": {"type": "string"}
64 };
65 var result = tv4.validateMultiple(data, schema);
66
67 assert.isTrue(result.valid, "should validate");
68 assert.length(result.errors, 0, "no errors");
69
70 //this.assert(result.valid == true, "should validate");
71 //this.assert(result.errors.length == 0, "no errors");
72 });
73
74 it("validateMultiple correctly fails multiple oneOf", function () {
75 var data = 5;
76 var schema = {
77 "oneOf": [
78 {"type": "integer"},
79 {"type": "number"}
80 ]
81 };
82 var result = tv4.validateMultiple(data, schema);
83
84 assert.isFalse(result.valid, "should not validate");
85 assert.length(result.errors, 1, "only one error");
86
87 //this.assert(result.valid == false, "should not validate");
88 //this.assert(result.errors.length == 1, "only one error");
89 });
90
91 it("validateMultiple handles multiple missing properties", function () {
92 var data = {};
93 var schema = {
94 required: ["one", "two"]
95 };
96 var result = tv4.validateMultiple(data, schema);
97
98 assert.isFalse(result.valid, "should not validate");
99 assert.length(result.errors, 2, "two errors");
100
101 //this.assert(result.valid == false, "should not validate");
102 //this.assert(result.errors.length == 2, "exactly two errors, not " + result.errors.length);
103 });
104 });
+0
-65
test/tests/09 - Multiple errors/02 - validateMultiple 2.js less more
0 describe("Multiple errors 02", function () {
1
2 it("validateMultiple returns array of errors", function () {
3 var data = {
4 "alternatives": {
5 "option1": "pattern for option 1"
6 }
7 };
8
9 var schema = {
10 "type": "object",
11 "properties": {
12 "alternatives": {
13 "type": "object",
14 "description": "Some options",
15 "oneOf": [
16 {
17 "properties": {
18 "option1": {
19 "type": "string",
20 "pattern": "^pattern for option 1$"
21 }
22 },
23 "additionalProperties": false,
24 "required": [
25 "option1"
26 ]
27 },
28 {
29 "properties": {
30 "option2": {
31 "type": "string",
32 "pattern": "^pattern for option 2$"
33 }
34 },
35 "additionalProperties": false,
36 "required": [
37 "option2"
38 ]
39 },
40 {
41 "properties": {
42 "option3": {
43 "type": "string",
44 "pattern": "^pattern for option 3$"
45 }
46 },
47 "additionalProperties": false,
48 "required": [
49 "option3"
50 ]
51 }
52 ]
53 }
54 }
55 };
56 var result = tv4.validateMultiple(data, schema);
57
58 assert.isTrue(result.valid, "data should be valid");
59 assert.length(result.errors, 0, "should have no errors");
60
61 //this.assert(result.valid == true, "data should be valid");
62 //this.assert(result.errors.length == 0, "should have no errors");
63 });
64 });
+0
-15
test/tests/10 - Recursive objects/01 - validate.js less more
0 describe("Recursive objects 01", function () {
1 it("validate and variants do not choke on recursive objects", function () {
2 var itemA = {};
3 var itemB = { a: itemA };
4 itemA.b = itemB;
5 var aSchema = { properties: { b: { $ref: 'bSchema' }}};
6 var bSchema = { properties: { a: { $ref: 'aSchema' }}};
7 tv4.addSchema('aSchema', aSchema);
8 tv4.addSchema('bSchema', bSchema);
9 tv4.validate(itemA, aSchema, true);
10 tv4.validate(itemA, aSchema, function () {}, true);
11 tv4.validateResult(itemA, aSchema, true);
12 tv4.validateMultiple(itemA, aSchema, true);
13 });
14 });
+0
-14
test/tests/10 - Recursive objects/02 - scan.js less more
0 // We don't handle this in general (atm), but some users have had particular problems with things added to the Array prototype
1 describe("Recursive schemas", function () {
2 it("due to extra Array.prototype entries", function () {
3 var testSchema = {
4 items: []
5 };
6 Array.prototype._testSchema = testSchema;
7
8 // Failure mode will be a RangeError (stack size limit)
9 tv4.addSchema('testSchema', testSchema);
10
11 delete Array.prototype._testSchema;
12 });
13 });
+0
-61
test/tests/11 - format/01 - register validator.js less more
0 describe("Registering custom validator", function () {
1 it("Allows registration of custom validator codes for \"format\" values", function () {
2 tv4.addFormat('test-format', function () {
3 return null;
4 });
5 });
6
7 it("Custom validator is correctly selected", function () {
8 tv4.addFormat('test-format', function (data) {
9 if (data !== "test string") {
10 return "string does not match";
11 }
12 });
13
14 var schema = {format: 'test-format'};
15 var data1 = "test string";
16 var data2 = "other string";
17
18 assert.isTrue(tv4.validate(data1, schema));
19 assert.isFalse(tv4.validate(data2, schema));
20 assert.includes(tv4.error.message, 'string does not match');
21 });
22
23 it("Custom validator object error format", function () {
24 tv4.addFormat('test-format', function (data) {
25 if (data !== "test string") {
26 return {
27 dataPath: "",
28 schemaPath: "/flah",
29 message: "Error message"
30 };
31 }
32 });
33
34 var schema = {format: 'test-format'};
35 var data1 = "test string";
36 var data2 = "other string";
37
38 assert.isTrue(tv4.validate(data1, schema));
39 assert.isFalse(tv4.validate(data2, schema));
40 assert.includes(tv4.error.message, 'Error message');
41 assert.equal(tv4.error.schemaPath, '/flah');
42 });
43
44 it("Register multiple using object", function () {
45 tv4.addFormat({
46 'test1': function () {return 'break 1';},
47 'test2': function () {return 'break 2';}
48 });
49
50 var schema1 = {format: 'test1'};
51 var result1 = tv4.validateResult("test string", schema1);
52 assert.isFalse(result1.valid);
53 assert.includes(result1.error.message, 'break 1');
54
55 var schema2 = {format: 'test2'};
56 var result2 = tv4.validateResult("test string", schema2);
57 assert.isFalse(result2.valid);
58 assert.includes(result2.error.message, 'break 2');
59 });
60 });
+0
-68
test/tests/12 - banUnknownProperties/01 - simple case.js less more
0 describe("Ban unknown properties 01", function () {
1 it("Additional argument to ban additional properties", function () {
2 var schema = {
3 properties: {
4 propA: {},
5 propB: {}
6 }
7 };
8 var data = {
9 propA: true,
10 propUnknown: true
11 };
12 var data2 = {
13 propA: true
14 };
15
16 var result = tv4.validateMultiple(data, schema, false, true);
17 assert.isFalse(result.valid, "Must not be valid");
18
19 var result2 = tv4.validateMultiple(data2, schema, false, true);
20 assert.isTrue(result2.valid, "Must still validate");
21 });
22
23 it("Works with validateResult()", function () {
24 var schema = {
25 properties: {
26 propA: {},
27 propB: {}
28 }
29 };
30 var data = {
31 propA: true,
32 propUnknown: true
33 };
34 var data2 = {
35 propA: true
36 };
37
38 var result = tv4.validateResult(data, schema, false, true);
39 assert.isFalse(result.valid, "Must not be valid");
40
41 var result2 = tv4.validateResult(data2, schema, false, true);
42 assert.isTrue(result2.valid, "Must be valid");
43 });
44
45 it("Do not complain if additionalArguments is specified", function () {
46 var schema = {
47 properties: {
48 propA: {},
49 propB: {}
50 },
51 additionalProperties: true
52 };
53 var data = {
54 propA: true,
55 propUnknown: true
56 };
57 var data2 = {
58 propA: true
59 };
60
61 var result = tv4.validateMultiple(data, schema, false, true);
62 assert.isTrue(result.valid, "Must be valid");
63
64 var result2 = tv4.validateMultiple(data2, schema, false, true);
65 assert.isTrue(result2.valid, "Must still validate");
66 });
67 });
+0
-76
test/tests/12 - banUnknownProperties/02 - composite behaviour.js less more
0 describe("Ban unknown properties 02", function () {
1 it("Do not track property definitions from \"not\"", function () {
2 var schema = {
3 "not": {
4 properties: {
5 propA: {"type": "string"},
6 }
7 }
8 };
9 var data = {
10 propA: true,
11 };
12
13 var result = tv4.validateMultiple(data, schema, false, true);
14 assert.isFalse(result.valid, "Must not be valid");
15 });
16
17 it("Do not track property definitions from unselected \"oneOf\"", function () {
18 var schema = {
19 "oneOf": [
20 {
21 "type": "object",
22 "properties": {
23 "propA": {"type": "string"}
24 }
25 },
26 {
27 "type": "object",
28 "properties": {
29 "propB": {"type": "boolean"}
30 }
31 }
32 ]
33 };
34 var data = {
35 propA: true,
36 propB: true
37 };
38
39 var result = tv4.validateMultiple(data, schema, false, true);
40 assert.isFalse(result.valid, "Must not be valid");
41
42 var result2 = tv4.validateMultiple(data, schema, false);
43 assert.isTrue(result2.valid, "Must still be valid without flag");
44 });
45
46
47 it("Do not track property definitions from unselected \"anyOf\"", function () {
48 var schema = {
49 "anyOf": [
50 {
51 "type": "object",
52 "properties": {
53 "propA": {"type": "string"}
54 }
55 },
56 {
57 "type": "object",
58 "properties": {
59 "propB": {"type": "boolean"}
60 }
61 }
62 ]
63 };
64 var data = {
65 propA: true,
66 propB: true
67 };
68
69 var result = tv4.validateMultiple(data, schema, false, true);
70 assert.isFalse(result.valid, "Must not be valid");
71
72 var result2 = tv4.validateMultiple(data, schema, false);
73 assert.isTrue(result2.valid, "Must still be valid without flag");
74 });
75 });
+0
-27
test/tests/13 - error reporting/01 - required dataPath.js less more
0 describe("Fill dataPath for \"required\" (GitHub Issue #103)", function () {
1 it("Blank for first-level properties", function () {
2 var schema = {
3 required: ['A']
4 };
5 var data = {};
6
7 var result = tv4.validateMultiple(data, schema, false, true);
8 assert.isFalse(result.valid, "Must not be valid");
9 assert.deepEqual(result.errors[0].dataPath, '');
10 });
11
12 it("Filled for second-level properties", function () {
13 var schema = {
14 properties: {
15 "foo": {
16 required: ["bar"]
17 }
18 }
19 };
20 var data = {"foo": {}};
21
22 var result = tv4.validateMultiple(data, schema, false, true);
23 assert.isFalse(result.valid, "Must not be valid");
24 assert.deepEqual(result.errors[0].dataPath, '/foo');
25 });
26 });
+0
-49
test/tests/13 - error reporting/02 - oneOf schemaPath.js less more
0 describe("Valid schemaPath for \"oneOf\" (GitHub Issue #117)", function () {
1 it("valid schemaPath in error (simple types)", function () {
2 var data = {};
3 var schema = {
4 "oneOf": [
5 { "type": "string" },
6 { "type": "bool" }
7 ]
8 };
9
10 var result = tv4.validateMultiple(data, schema);
11 var suberr = result.errors[0].subErrors;
12 assert.equal(suberr[0].schemaPath, '/oneOf/0/type');
13 assert.equal(suberr[1].schemaPath, '/oneOf/1/type');
14 });
15
16 it("valid schemaPath in error (required properties)", function () {
17 /* Test case provided on GitHub Issue #117 */
18 var data = {};
19 var schema = {
20 "$schema": "http://json-schema.org/draft-04/schema#",
21 "oneOf": [
22 {
23 "type": "object",
24 "properties": {
25 "data": {
26 "type": "object"
27 }
28 },
29 "required": ["data"]
30 },
31 {
32 "type": "object",
33 "properties": {
34 "error": {
35 "type": "object"
36 }
37 },
38 "required": ["error"]
39 }
40 ]
41 };
42
43 var result = tv4.validateMultiple(data, schema);
44 var suberr = result.errors[0].subErrors;
45 assert.equal(suberr[0].schemaPath, "/oneOf/0/required/0");
46 assert.equal(suberr[1].schemaPath, "/oneOf/1/required/0");
47 });
48 });
+0
-154
test/tests/14 - custom validation/01 - custom keywords.js less more
0 describe("Register custom keyword", function () {
1 it("function called", function () {
2 var schema = {
3 customKeyword: "A"
4 };
5 var data = {};
6
7 tv4.defineKeyword('customKeyword', function () {
8 return "Custom failure";
9 });
10
11 var result = tv4.validateMultiple(data, schema, false, true);
12 assert.isFalse(result.valid, "Must not be valid");
13 assert.deepEqual(result.errors[0].message, 'Keyword failed: customKeyword (Custom failure)');
14 });
15
16 it("custom error code", function () {
17 var schema = {
18 customKeywordFoo: "A"
19 };
20 var data = "test test test";
21
22 tv4.defineKeyword('customKeywordFoo', function (data, value) {
23 return {
24 code: 'CUSTOM_KEYWORD_FOO',
25 message: {data: data, value: value}
26 };
27 });
28 tv4.defineError('CUSTOM_KEYWORD_FOO', 123456789, "{value}: {data}");
29
30 var result = tv4.validateMultiple(data, schema, false, true);
31 assert.isFalse(result.valid, "Must not be valid");
32 assert.deepEqual(result.errors[0].message, 'A: test test test');
33 assert.deepEqual(result.errors[0].code, 123456789);
34 });
35
36 it("custom error code (numeric)", function () {
37 var schema = {
38 customKeywordBar: "A"
39 };
40 var data = "test test test";
41
42 tv4.defineKeyword('customKeywordBar', function (data, value) {
43 return {
44 code: 1234567890,
45 message: {data: data, value: value}
46 };
47 });
48 tv4.defineError('CUSTOM_KEYWORD_BAR', 1234567890, "{value}: {data}");
49
50 var result = tv4.validateMultiple(data, schema, false, true);
51 assert.isFalse(result.valid, "Must not be valid");
52 assert.deepEqual(result.errors[0].message, 'A: test test test');
53 assert.deepEqual(result.errors[0].code, 1234567890);
54 });
55
56 it("restrict custom error codes", function () {
57 assert.throws(function () {
58 tv4.defineError('CUSTOM_KEYWORD_BLAH', 9999, "{value}: {data}");
59 });
60 });
61
62 it("restrict custom error names", function () {
63 assert.throws(function () {
64 tv4.defineError('doesnotmatchpattern', 10002, "{value}: {data}");
65 });
66 });
67
68 it("can't defined the same code twice", function () {
69 assert.throws(function () {
70 tv4.defineError('CUSTOM_ONE', 10005, "{value}: {data}");
71 tv4.defineError('CUSTOM_TWO', 10005, "{value}: {data}");
72 });
73 });
74
75 it("function can return existing (non-custom) codes", function () {
76 var schema = {
77 "type": "object",
78 "properties": {
79 "aStringValue": {
80 "type": "string",
81 "my-custom-keyword": "something"
82 },
83 "aBooleanValue": {
84 "type": "boolean"
85 }
86 }
87 };
88 var data = {
89 "aStringValue": "a string",
90 "aBooleanValue": true
91 };
92
93 tv4.defineKeyword('my-custom-keyword', function () {
94 return {code: 0, message: "test"};
95 });
96
97 var result = tv4.validateMultiple(data, schema, false, true);
98 assert.equal(result.errors[0].code, tv4.errorCodes.INVALID_TYPE);
99 });
100
101 it("function only called when keyword present", function () {
102 var schema = {
103 "type": "object",
104 "properties": {
105 "aStringValue": {
106 "type": "string",
107 "my-custom-keyword": "something"
108 },
109 "aBooleanValue": {
110 "type": "boolean"
111 }
112 }
113 };
114 var data = {
115 "aStringValue": "a string",
116 "aBooleanValue": true
117 };
118
119 var callCount = 0;
120 tv4.defineKeyword('my-custom-keyword', function () {
121 callCount++;
122 });
123
124 tv4.validateMultiple(data, schema, false, true);
125 assert.deepEqual(callCount, 1, "custom function must be called exactly once");
126 });
127
128 it("function knows dataPointerPath", function () {
129 var schema = {
130 "type": "object",
131 "properties": {
132 "obj": {
133 "type": "object",
134 "properties":{
135 "test":{
136 "my-custom-keyword": "something",
137 "type":"string"
138 }
139 }
140 }
141 }
142 };
143 var data = { "obj":{ "test": "a string"} };
144
145 var path = null;
146 tv4.defineKeyword('my-custom-keyword', function (data,value,schema,dataPointerPath) {
147 path = dataPointerPath;
148 });
149
150 tv4.validateMultiple(data, schema, false, true);
151 assert.strictEqual(path, "/obj/test", "custom function must know its context path");
152 });
153 });
+0
-23
test/tests/15 - language/01 - language file.js less more
0 describe("Load language file", function () {
1 if (typeof process !== 'object' || typeof require !== 'function') {
2 it.skip("commonjs language", function () {
3 // dummy
4 });
5 }
6 else {
7 it("commonjs language: de", function () {
8 var tv4 = require('../lang/de');
9
10 tv4.language('de');
11
12 var schema = {
13 properties: {
14 intKey: {"type": "integer"}
15 }
16 };
17 var res = tv4.validateResult({intKey: 'bad'}, schema);
18 assert.isFalse(res.valid);
19 assert.equal(res.error.message, 'Ungültiger Typ: string (erwartet wurde: integer)');
20 });
21 }
22 });
+0
-29
test/tests/15 - language/02 - custom reporter.js less more
0 describe("Custom error reporting", function () {
1 it('provides custom message', function () {
2 var api = tv4.freshApi();
3
4 api.setErrorReporter(function (error, data, schema) {
5 assert.deepEqual(data, 5);
6 assert.deepEqual(schema, {minimum: 10});
7 return 'Code: ' + error.code;
8 });
9
10 var res = api.validateResult(5, {minimum: 10});
11 assert.isFalse(res.valid);
12 assert.equal(res.error.message, 'Code: 101');
13 });
14
15 it('falls back to default', function () {
16 var api = tv4.freshApi();
17
18 api.setErrorReporter(function (error, data, schema) {
19 assert.deepEqual(data, 5);
20 assert.deepEqual(schema, {minimum: 10});
21 return null;
22 });
23
24 var res = api.validateResult(5, {minimum: 10});
25 assert.isFalse(res.valid);
26 assert.isString(res.error.message);
27 });
28 });
+0
-35
test/tests/16 - hypermedia/02 - describedby link.js less more
0 describe("Load language file", function () {
1 it("commonjs language: de", function () {
2 var freshTv4 = tv4.freshApi();
3
4 freshTv4.addSchema('/polymorphic', {
5 type: "object",
6 properties: {
7 "type": {type: "string"}
8 },
9 required: ["type"],
10 links: [{
11 rel: "describedby",
12 href: "/schemas/{type}.json"
13 }]
14 });
15
16 var res = freshTv4.validateResult({type: 'monkey'}, "/polymorphic");
17 assert.isTrue(res.valid);
18 assert.includes(res.missing, "/schemas/monkey.json");
19
20 freshTv4.addSchema('/schemas/tiger.json', {
21 properties: {
22 "stripes": {"type": "integer", "minimum": 1}
23 },
24 required: ["stripes"]
25 });
26
27 var res2 = freshTv4.validateResult({type: 'tiger', stripes: -1}, "/polymorphic");
28 assert.isFalse(res2.valid);
29 assert.deepEqual(res2.missing.length, 0, "no schemas should be missing");
30
31 var res3 = freshTv4.validateResult({type: 'tiger', stripes: 50}, "/polymorphic");
32 assert.isTrue(res3.valid);
33 });
34 });
+0
-26
test/tests/Misc/Issue 108.js less more
0 describe("Issue 108", function () {
1
2 it("Normalise schemas even inside $ref", function () {
3
4 var schema = {
5 "id": "http://example.com/schema" + Math.random(),
6 "$ref": "#whatever",
7 "properties": {
8 "foo": {
9 "id": "#test",
10 "type": "string"
11 }
12 }
13 };
14
15 tv4.addSchema(schema);
16
17 var result = tv4.validateMultiple("test data", schema.id + '#test');
18 assert.isTrue(result.valid, 'validateMultiple() should return valid');
19 assert.deepEqual(result.missing.length, 0, 'should have no missing schemas');
20
21 var result2 = tv4.validateMultiple({"foo":"bar"}, schema.id + '#test');
22 assert.isFalse(result2.valid, 'validateMultiple() should return invalid');
23 assert.deepEqual(result2.missing.length, 0, 'should have no missing schemas');
24 });
25 });
+0
-21
test/tests/Misc/Issue 109.js less more
0 describe("Issue 109", function () {
1
2 it("Don't break on null values with banUnknownProperties", function () {
3
4 var schema = {
5 "type": "object",
6 "properties": {
7 "foo": {
8 "type": "object",
9 "additionalProperties": {"type": "string"}
10 }
11 }
12 };
13
14 var data = {foo: null};
15
16 var result = tv4.validateMultiple(data, schema, true, true);
17
18 assert.isFalse(result.valid, 'validateMultiple() should return invalid');
19 });
20 });
+0
-61
test/tests/Misc/Issue 32.js less more
0 describe("Issue 32", function () {
1
2 it("Example from GitHub issue #32", function () {
3 var subSchema = {
4 "title": "SubSchema",
5 "type": "object",
6 "properties": {
7 "attribute": {"type": "string"}
8 },
9 "additionalProperties": false
10 };
11
12 var mySchema = {
13 "title": "My Schema",
14 "type": "object",
15 "properties": {
16 "name": {"type": "string"},
17 "subschemas": {"type": "array", "items": {"$ref": "#/definitions/subSchema"}}
18 },
19 "definitions": {
20 "subSchema": subSchema
21 },
22 "additionalProperties": false
23 };
24
25 /* unused variable
26 var data1 = {
27 "name": "Joe",
28 "subschemas": [
29 {"attribute": "Hello"}
30 ]
31 };*/
32
33 var addlPropInSubSchema = {
34 "name": "Joe",
35 "subschemas": [
36 {"attribute": "Hello", "extra": "Not Allowed"}
37 ]
38 };
39
40 // Usage 1
41 var expectedUsage1Result = tv4.validate(addlPropInSubSchema, mySchema);
42 assert.isFalse(expectedUsage1Result, 'plain validate should fail');
43 //this.assert(!expectedUsage1Result, 'plain validate should fail');
44
45 // Usage 2
46 var expectedUsage2Result = tv4.validateResult(addlPropInSubSchema, mySchema);
47 assert.isFalse(expectedUsage2Result.valid, 'validateResult should fail');
48
49 //-> this has a typo that didn't show because of type conversion!
50
51 //this.assert(!expectedUsage1Result.valud, 'validateResult should fail');
52
53 // Usage 3
54 var expectedMultipleErrorResult = tv4.validateMultiple(addlPropInSubSchema, mySchema);
55 assert.isFalse(expectedMultipleErrorResult.valid, 'validateMultiple should fail');
56 assert.length(expectedMultipleErrorResult.errors, 1, 'validateMultiple should have exactly one error');
57 //this.assert(!expectedMultipleErrorResult.valid, 'validateMultiple should fail');
58 //this.assert(expectedMultipleErrorResult.errors.length == 1, 'validateMultiple should have exactly one error');
59 });
60 });
+0
-7
test/tests/Misc/Issue 67.js less more
0 describe("Issue 67", function () {
1
2 it("Example from GitHub issue #67", function () {
3 // Make sure null values don't trip up the normalisation
4 tv4.validate(null, {default: null});
5 });
6 });
+0
-120
test/tests/Misc/Issue 86.js less more
0 describe("Issue 86", function () {
1
2 it("Example from GitHub issue #86", function () {
3 // The "checkRecursive" flag skips some data nodes if it actually needs to check the same data/schema pair twice
4
5 var schema = {
6 "type": "object",
7 "properties": {
8 "shape": {
9 "oneOf": [
10 { "$ref": "#/definitions/squareSchema" },
11 { "$ref": "#/definitions/circleSchema" }
12 ]
13 }
14 },
15 "definitions": {
16 "squareSchema": {
17 "type": "object",
18 "properties": {
19 "thetype": {
20 "type": "string",
21 "enum": ["square"]
22 },
23 "colour": {},
24 "shade": {},
25 "boxname": {
26 "type": "string"
27 }
28 },
29 "oneOf": [
30 { "$ref": "#/definitions/colourSchema" },
31 { "$ref": "#/definitions/shadeSchema" }
32 ],
33 "required": ["thetype", "boxname"],
34 "additionalProperties": false
35 },
36 "circleSchema": {
37 "type": "object",
38 "properties": {
39 "thetype": {
40 "type": "string",
41 "enum": ["circle"]
42 },
43 "colour": {},
44 "shade": {}
45 },
46 "oneOf": [
47 { "$ref": "#/definitions/colourSchema" },
48 { "$ref": "#/definitions/shadeSchema" }
49 ],
50 "additionalProperties": false
51 },
52 "colourSchema": {
53 "type": "object",
54 "properties": {
55 "colour": {
56 "type": "string"
57 },
58 "shade": {
59 "type": "null"
60 }
61 }
62 },
63 "shadeSchema": {
64 "type": "object",
65 "properties": {
66 "shade": {
67 "type": "string"
68 },
69 "colour": {
70 "type": "null"
71 }
72 }
73 }
74 }
75 };
76
77
78 var circle = {
79 "shape": {
80 "thetype": "circle",
81 "shade": "red"
82 }
83 };
84
85 var simpleResult = tv4.validate(circle, schema, true);
86 var multipleResult = tv4.validateMultiple(circle, schema, true);
87
88 assert.isTrue(simpleResult, 'validate() should return valid');
89 assert.isTrue(multipleResult.valid, 'validateMultiple() should return valid');
90 });
91
92 it("Second example", function () {
93 var schema = {
94 "allOf": [
95 {
96 "oneOf": [
97 {"$ref": "#/definitions/option1"},
98 {"$ref": "#/definitions/option2"},
99 ]
100 },
101 {
102 "not": {"$ref": "#/definitions/option2"}
103 }
104 ],
105 "definitions": {
106 "option1": {
107 "allOf": [{"type": "string"}]
108 },
109 "option2": {
110 "allOf": [{"type": "number"}]
111 }
112 }
113 };
114
115 var simpleResult = tv4.validate("test", schema, true);
116
117 assert.isTrue(simpleResult, "validate() should return valid");
118 });
119 });
+0
-21
test/tests/Misc/enum null failure.js less more
0 describe("Enum object/null failure", function () {
1
2 it("Doesn't crash", function () {
3
4 var schema = {
5 "type": "object",
6 "required": ["value"],
7 "properties": {
8 "value": {
9 "enum": [6, "foo", [], true, {"foo": 12}]
10 }
11 }
12 };
13
14 var data = {value: null}; // Somehow this is only a problem when a *property* is null, not the root
15
16 var result = tv4.validateMultiple(data, schema);
17
18 assert.isFalse(result.valid, 'validateMultiple() should return invalid');
19 });
20 });
+0
-15548
try/ace/ace.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 (function() {
31
32 var ACE_NAMESPACE = "";
33
34 var global = (function() {
35 return this;
36 })();
37
38
39 if (!ACE_NAMESPACE && typeof requirejs !== "undefined")
40 return;
41
42
43 var _define = function(module, deps, payload) {
44 if (typeof module !== 'string') {
45 if (_define.original)
46 _define.original.apply(window, arguments);
47 else {
48 console.error('dropping module because define wasn\'t a string.');
49 console.trace();
50 }
51 return;
52 }
53
54 if (arguments.length == 2)
55 payload = deps;
56
57 if (!_define.modules) {
58 _define.modules = {};
59 _define.payloads = {};
60 }
61
62 _define.payloads[module] = payload;
63 _define.modules[module] = null;
64 };
65 var _require = function(parentId, module, callback) {
66 if (Object.prototype.toString.call(module) === "[object Array]") {
67 var params = [];
68 for (var i = 0, l = module.length; i < l; ++i) {
69 var dep = lookup(parentId, module[i]);
70 if (!dep && _require.original)
71 return _require.original.apply(window, arguments);
72 params.push(dep);
73 }
74 if (callback) {
75 callback.apply(null, params);
76 }
77 }
78 else if (typeof module === 'string') {
79 var payload = lookup(parentId, module);
80 if (!payload && _require.original)
81 return _require.original.apply(window, arguments);
82
83 if (callback) {
84 callback();
85 }
86
87 return payload;
88 }
89 else {
90 if (_require.original)
91 return _require.original.apply(window, arguments);
92 }
93 };
94
95 var normalizeModule = function(parentId, moduleName) {
96 if (moduleName.indexOf("!") !== -1) {
97 var chunks = moduleName.split("!");
98 return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
99 }
100 if (moduleName.charAt(0) == ".") {
101 var base = parentId.split("/").slice(0, -1).join("/");
102 moduleName = base + "/" + moduleName;
103
104 while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
105 var previous = moduleName;
106 moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
107 }
108 }
109
110 return moduleName;
111 };
112 var lookup = function(parentId, moduleName) {
113
114 moduleName = normalizeModule(parentId, moduleName);
115
116 var module = _define.modules[moduleName];
117 if (!module) {
118 module = _define.payloads[moduleName];
119 if (typeof module === 'function') {
120 var exports = {};
121 var mod = {
122 id: moduleName,
123 uri: '',
124 exports: exports,
125 packaged: true
126 };
127
128 var req = function(module, callback) {
129 return _require(moduleName, module, callback);
130 };
131
132 var returnValue = module(req, exports, mod);
133 exports = returnValue || mod.exports;
134 _define.modules[moduleName] = exports;
135 delete _define.payloads[moduleName];
136 }
137 module = _define.modules[moduleName] = exports || module;
138 }
139 return module;
140 };
141
142 function exportAce(ns) {
143 var require = function(module, callback) {
144 return _require("", module, callback);
145 };
146
147 var root = global;
148 if (ns) {
149 if (!global[ns])
150 global[ns] = {};
151 root = global[ns];
152 }
153
154 if (!root.define || !root.define.packaged) {
155 _define.original = root.define;
156 root.define = _define;
157 root.define.packaged = true;
158 }
159
160 if (!root.require || !root.require.packaged) {
161 _require.original = root.require;
162 root.require = require;
163 root.require.packaged = true;
164 }
165 }
166
167 exportAce(ACE_NAMESPACE);
168
169 })();
170
171 define('ace/ace', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/dom', 'ace/lib/event', 'ace/editor', 'ace/edit_session', 'ace/undomanager', 'ace/virtual_renderer', 'ace/multi_select', 'ace/worker/worker_client', 'ace/keyboard/hash_handler', 'ace/placeholder', 'ace/mode/folding/fold_mode', 'ace/theme/textmate', 'ace/config'], function(require, exports, module) {
172
173
174 require("./lib/fixoldbrowsers");
175
176 var dom = require("./lib/dom");
177 var event = require("./lib/event");
178
179 var Editor = require("./editor").Editor;
180 var EditSession = require("./edit_session").EditSession;
181 var UndoManager = require("./undomanager").UndoManager;
182 var Renderer = require("./virtual_renderer").VirtualRenderer;
183 var MultiSelect = require("./multi_select").MultiSelect;
184 require("./worker/worker_client");
185 require("./keyboard/hash_handler");
186 require("./placeholder");
187 require("./mode/folding/fold_mode");
188 require("./theme/textmate");
189
190 exports.config = require("./config");
191 exports.require = require;
192 exports.edit = function(el) {
193 if (typeof(el) == "string") {
194 var _id = el;
195 var el = document.getElementById(_id);
196 if (!el)
197 throw "ace.edit can't find div #" + _id;
198 }
199
200 if (el.env && el.env.editor instanceof Editor)
201 return el.env.editor;
202
203 var doc = exports.createEditSession(dom.getInnerText(el));
204 el.innerHTML = '';
205
206 var editor = new Editor(new Renderer(el));
207 new MultiSelect(editor);
208 editor.setSession(doc);
209
210 var env = {
211 document: doc,
212 editor: editor,
213 onResize: editor.resize.bind(editor, null)
214 };
215 event.addListener(window, "resize", env.onResize);
216 editor.on("destroy", function() {
217 event.removeListener(window, "resize", env.onResize);
218 });
219 el.env = editor.env = env;
220 return editor;
221 };
222 exports.createEditSession = function(text, mode) {
223 var doc = new EditSession(text, mode);
224 doc.setUndoManager(new UndoManager());
225 return doc;
226 }
227 exports.EditSession = EditSession;
228 exports.UndoManager = UndoManager;
229 });
230
231 define('ace/lib/fixoldbrowsers', ['require', 'exports', 'module' , 'ace/lib/regexp', 'ace/lib/es5-shim'], function(require, exports, module) {
232
233
234 require("./regexp");
235 require("./es5-shim");
236
237 });
238
239 define('ace/lib/regexp', ['require', 'exports', 'module' ], function(require, exports, module) {
240
241 var real = {
242 exec: RegExp.prototype.exec,
243 test: RegExp.prototype.test,
244 match: String.prototype.match,
245 replace: String.prototype.replace,
246 split: String.prototype.split
247 },
248 compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
249 compliantLastIndexIncrement = function () {
250 var x = /^/g;
251 real.test.call(x, "");
252 return !x.lastIndex;
253 }();
254
255 if (compliantLastIndexIncrement && compliantExecNpcg)
256 return;
257 RegExp.prototype.exec = function (str) {
258 var match = real.exec.apply(this, arguments),
259 name, r2;
260 if ( typeof(str) == 'string' && match) {
261 if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
262 r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", ""));
263 real.replace.call(str.slice(match.index), r2, function () {
264 for (var i = 1; i < arguments.length - 2; i++) {
265 if (arguments[i] === undefined)
266 match[i] = undefined;
267 }
268 });
269 }
270 if (this._xregexp && this._xregexp.captureNames) {
271 for (var i = 1; i < match.length; i++) {
272 name = this._xregexp.captureNames[i - 1];
273 if (name)
274 match[name] = match[i];
275 }
276 }
277 if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
278 this.lastIndex--;
279 }
280 return match;
281 };
282 if (!compliantLastIndexIncrement) {
283 RegExp.prototype.test = function (str) {
284 var match = real.exec.call(this, str);
285 if (match && this.global && !match[0].length && (this.lastIndex > match.index))
286 this.lastIndex--;
287 return !!match;
288 };
289 }
290
291 function getNativeFlags (regex) {
292 return (regex.global ? "g" : "") +
293 (regex.ignoreCase ? "i" : "") +
294 (regex.multiline ? "m" : "") +
295 (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
296 (regex.sticky ? "y" : "");
297 }
298
299 function indexOf (array, item, from) {
300 if (Array.prototype.indexOf) // Use the native array method if available
301 return array.indexOf(item, from);
302 for (var i = from || 0; i < array.length; i++) {
303 if (array[i] === item)
304 return i;
305 }
306 return -1;
307 }
308
309 });
310
311 define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) {
312
313 function Empty() {}
314
315 if (!Function.prototype.bind) {
316 Function.prototype.bind = function bind(that) { // .length is 1
317 var target = this;
318 if (typeof target != "function") {
319 throw new TypeError("Function.prototype.bind called on incompatible " + target);
320 }
321 var args = slice.call(arguments, 1); // for normal call
322 var bound = function () {
323
324 if (this instanceof bound) {
325
326 var result = target.apply(
327 this,
328 args.concat(slice.call(arguments))
329 );
330 if (Object(result) === result) {
331 return result;
332 }
333 return this;
334
335 } else {
336 return target.apply(
337 that,
338 args.concat(slice.call(arguments))
339 );
340
341 }
342
343 };
344 if(target.prototype) {
345 Empty.prototype = target.prototype;
346 bound.prototype = new Empty();
347 Empty.prototype = null;
348 }
349 return bound;
350 };
351 }
352 var call = Function.prototype.call;
353 var prototypeOfArray = Array.prototype;
354 var prototypeOfObject = Object.prototype;
355 var slice = prototypeOfArray.slice;
356 var _toString = call.bind(prototypeOfObject.toString);
357 var owns = call.bind(prototypeOfObject.hasOwnProperty);
358 var defineGetter;
359 var defineSetter;
360 var lookupGetter;
361 var lookupSetter;
362 var supportsAccessors;
363 if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
364 defineGetter = call.bind(prototypeOfObject.__defineGetter__);
365 defineSetter = call.bind(prototypeOfObject.__defineSetter__);
366 lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
367 lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
368 }
369 if ([1,2].splice(0).length != 2) {
370 if(function() { // test IE < 9 to splice bug - see issue #138
371 function makeArray(l) {
372 var a = new Array(l+2);
373 a[0] = a[1] = 0;
374 return a;
375 }
376 var array = [], lengthBefore;
377
378 array.splice.apply(array, makeArray(20));
379 array.splice.apply(array, makeArray(26));
380
381 lengthBefore = array.length; //46
382 array.splice(5, 0, "XXX"); // add one element
383
384 lengthBefore + 1 == array.length
385
386 if (lengthBefore + 1 == array.length) {
387 return true;// has right splice implementation without bugs
388 }
389 }()) {//IE 6/7
390 var array_splice = Array.prototype.splice;
391 Array.prototype.splice = function(start, deleteCount) {
392 if (!arguments.length) {
393 return [];
394 } else {
395 return array_splice.apply(this, [
396 start === void 0 ? 0 : start,
397 deleteCount === void 0 ? (this.length - start) : deleteCount
398 ].concat(slice.call(arguments, 2)))
399 }
400 };
401 } else {//IE8
402 Array.prototype.splice = function(pos, removeCount){
403 var length = this.length;
404 if (pos > 0) {
405 if (pos > length)
406 pos = length;
407 } else if (pos == void 0) {
408 pos = 0;
409 } else if (pos < 0) {
410 pos = Math.max(length + pos, 0);
411 }
412
413 if (!(pos+removeCount < length))
414 removeCount = length - pos;
415
416 var removed = this.slice(pos, pos+removeCount);
417 var insert = slice.call(arguments, 2);
418 var add = insert.length;
419 if (pos === length) {
420 if (add) {
421 this.push.apply(this, insert);
422 }
423 } else {
424 var remove = Math.min(removeCount, length - pos);
425 var tailOldPos = pos + remove;
426 var tailNewPos = tailOldPos + add - remove;
427 var tailCount = length - tailOldPos;
428 var lengthAfterRemove = length - remove;
429
430 if (tailNewPos < tailOldPos) { // case A
431 for (var i = 0; i < tailCount; ++i) {
432 this[tailNewPos+i] = this[tailOldPos+i];
433 }
434 } else if (tailNewPos > tailOldPos) { // case B
435 for (i = tailCount; i--; ) {
436 this[tailNewPos+i] = this[tailOldPos+i];
437 }
438 } // else, add == remove (nothing to do)
439
440 if (add && pos === lengthAfterRemove) {
441 this.length = lengthAfterRemove; // truncate array
442 this.push.apply(this, insert);
443 } else {
444 this.length = lengthAfterRemove + add; // reserves space
445 for (i = 0; i < add; ++i) {
446 this[pos+i] = insert[i];
447 }
448 }
449 }
450 return removed;
451 };
452 }
453 }
454 if (!Array.isArray) {
455 Array.isArray = function isArray(obj) {
456 return _toString(obj) == "[object Array]";
457 };
458 }
459 var boxedString = Object("a"),
460 splitString = boxedString[0] != "a" || !(0 in boxedString);
461
462 if (!Array.prototype.forEach) {
463 Array.prototype.forEach = function forEach(fun /*, thisp*/) {
464 var object = toObject(this),
465 self = splitString && _toString(this) == "[object String]" ?
466 this.split("") :
467 object,
468 thisp = arguments[1],
469 i = -1,
470 length = self.length >>> 0;
471 if (_toString(fun) != "[object Function]") {
472 throw new TypeError(); // TODO message
473 }
474
475 while (++i < length) {
476 if (i in self) {
477 fun.call(thisp, self[i], i, object);
478 }
479 }
480 };
481 }
482 if (!Array.prototype.map) {
483 Array.prototype.map = function map(fun /*, thisp*/) {
484 var object = toObject(this),
485 self = splitString && _toString(this) == "[object String]" ?
486 this.split("") :
487 object,
488 length = self.length >>> 0,
489 result = Array(length),
490 thisp = arguments[1];
491 if (_toString(fun) != "[object Function]") {
492 throw new TypeError(fun + " is not a function");
493 }
494
495 for (var i = 0; i < length; i++) {
496 if (i in self)
497 result[i] = fun.call(thisp, self[i], i, object);
498 }
499 return result;
500 };
501 }
502 if (!Array.prototype.filter) {
503 Array.prototype.filter = function filter(fun /*, thisp */) {
504 var object = toObject(this),
505 self = splitString && _toString(this) == "[object String]" ?
506 this.split("") :
507 object,
508 length = self.length >>> 0,
509 result = [],
510 value,
511 thisp = arguments[1];
512 if (_toString(fun) != "[object Function]") {
513 throw new TypeError(fun + " is not a function");
514 }
515
516 for (var i = 0; i < length; i++) {
517 if (i in self) {
518 value = self[i];
519 if (fun.call(thisp, value, i, object)) {
520 result.push(value);
521 }
522 }
523 }
524 return result;
525 };
526 }
527 if (!Array.prototype.every) {
528 Array.prototype.every = function every(fun /*, thisp */) {
529 var object = toObject(this),
530 self = splitString && _toString(this) == "[object String]" ?
531 this.split("") :
532 object,
533 length = self.length >>> 0,
534 thisp = arguments[1];
535 if (_toString(fun) != "[object Function]") {
536 throw new TypeError(fun + " is not a function");
537 }
538
539 for (var i = 0; i < length; i++) {
540 if (i in self && !fun.call(thisp, self[i], i, object)) {
541 return false;
542 }
543 }
544 return true;
545 };
546 }
547 if (!Array.prototype.some) {
548 Array.prototype.some = function some(fun /*, thisp */) {
549 var object = toObject(this),
550 self = splitString && _toString(this) == "[object String]" ?
551 this.split("") :
552 object,
553 length = self.length >>> 0,
554 thisp = arguments[1];
555 if (_toString(fun) != "[object Function]") {
556 throw new TypeError(fun + " is not a function");
557 }
558
559 for (var i = 0; i < length; i++) {
560 if (i in self && fun.call(thisp, self[i], i, object)) {
561 return true;
562 }
563 }
564 return false;
565 };
566 }
567 if (!Array.prototype.reduce) {
568 Array.prototype.reduce = function reduce(fun /*, initial*/) {
569 var object = toObject(this),
570 self = splitString && _toString(this) == "[object String]" ?
571 this.split("") :
572 object,
573 length = self.length >>> 0;
574 if (_toString(fun) != "[object Function]") {
575 throw new TypeError(fun + " is not a function");
576 }
577 if (!length && arguments.length == 1) {
578 throw new TypeError("reduce of empty array with no initial value");
579 }
580
581 var i = 0;
582 var result;
583 if (arguments.length >= 2) {
584 result = arguments[1];
585 } else {
586 do {
587 if (i in self) {
588 result = self[i++];
589 break;
590 }
591 if (++i >= length) {
592 throw new TypeError("reduce of empty array with no initial value");
593 }
594 } while (true);
595 }
596
597 for (; i < length; i++) {
598 if (i in self) {
599 result = fun.call(void 0, result, self[i], i, object);
600 }
601 }
602
603 return result;
604 };
605 }
606 if (!Array.prototype.reduceRight) {
607 Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
608 var object = toObject(this),
609 self = splitString && _toString(this) == "[object String]" ?
610 this.split("") :
611 object,
612 length = self.length >>> 0;
613 if (_toString(fun) != "[object Function]") {
614 throw new TypeError(fun + " is not a function");
615 }
616 if (!length && arguments.length == 1) {
617 throw new TypeError("reduceRight of empty array with no initial value");
618 }
619
620 var result, i = length - 1;
621 if (arguments.length >= 2) {
622 result = arguments[1];
623 } else {
624 do {
625 if (i in self) {
626 result = self[i--];
627 break;
628 }
629 if (--i < 0) {
630 throw new TypeError("reduceRight of empty array with no initial value");
631 }
632 } while (true);
633 }
634
635 do {
636 if (i in this) {
637 result = fun.call(void 0, result, self[i], i, object);
638 }
639 } while (i--);
640
641 return result;
642 };
643 }
644 if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
645 Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
646 var self = splitString && _toString(this) == "[object String]" ?
647 this.split("") :
648 toObject(this),
649 length = self.length >>> 0;
650
651 if (!length) {
652 return -1;
653 }
654
655 var i = 0;
656 if (arguments.length > 1) {
657 i = toInteger(arguments[1]);
658 }
659 i = i >= 0 ? i : Math.max(0, length + i);
660 for (; i < length; i++) {
661 if (i in self && self[i] === sought) {
662 return i;
663 }
664 }
665 return -1;
666 };
667 }
668 if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
669 Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
670 var self = splitString && _toString(this) == "[object String]" ?
671 this.split("") :
672 toObject(this),
673 length = self.length >>> 0;
674
675 if (!length) {
676 return -1;
677 }
678 var i = length - 1;
679 if (arguments.length > 1) {
680 i = Math.min(i, toInteger(arguments[1]));
681 }
682 i = i >= 0 ? i : length - Math.abs(i);
683 for (; i >= 0; i--) {
684 if (i in self && sought === self[i]) {
685 return i;
686 }
687 }
688 return -1;
689 };
690 }
691 if (!Object.getPrototypeOf) {
692 Object.getPrototypeOf = function getPrototypeOf(object) {
693 return object.__proto__ || (
694 object.constructor ?
695 object.constructor.prototype :
696 prototypeOfObject
697 );
698 };
699 }
700 if (!Object.getOwnPropertyDescriptor) {
701 var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
702 "non-object: ";
703 Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
704 if ((typeof object != "object" && typeof object != "function") || object === null)
705 throw new TypeError(ERR_NON_OBJECT + object);
706 if (!owns(object, property))
707 return;
708
709 var descriptor, getter, setter;
710 descriptor = { enumerable: true, configurable: true };
711 if (supportsAccessors) {
712 var prototype = object.__proto__;
713 object.__proto__ = prototypeOfObject;
714
715 var getter = lookupGetter(object, property);
716 var setter = lookupSetter(object, property);
717 object.__proto__ = prototype;
718
719 if (getter || setter) {
720 if (getter) descriptor.get = getter;
721 if (setter) descriptor.set = setter;
722 return descriptor;
723 }
724 }
725 descriptor.value = object[property];
726 return descriptor;
727 };
728 }
729 if (!Object.getOwnPropertyNames) {
730 Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
731 return Object.keys(object);
732 };
733 }
734 if (!Object.create) {
735 var createEmpty;
736 if (Object.prototype.__proto__ === null) {
737 createEmpty = function () {
738 return { "__proto__": null };
739 };
740 } else {
741 createEmpty = function () {
742 var empty = {};
743 for (var i in empty)
744 empty[i] = null;
745 empty.constructor =
746 empty.hasOwnProperty =
747 empty.propertyIsEnumerable =
748 empty.isPrototypeOf =
749 empty.toLocaleString =
750 empty.toString =
751 empty.valueOf =
752 empty.__proto__ = null;
753 return empty;
754 }
755 }
756
757 Object.create = function create(prototype, properties) {
758 var object;
759 if (prototype === null) {
760 object = createEmpty();
761 } else {
762 if (typeof prototype != "object")
763 throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
764 var Type = function () {};
765 Type.prototype = prototype;
766 object = new Type();
767 object.__proto__ = prototype;
768 }
769 if (properties !== void 0)
770 Object.defineProperties(object, properties);
771 return object;
772 };
773 }
774
775 function doesDefinePropertyWork(object) {
776 try {
777 Object.defineProperty(object, "sentinel", {});
778 return "sentinel" in object;
779 } catch (exception) {
780 }
781 }
782 if (Object.defineProperty) {
783 var definePropertyWorksOnObject = doesDefinePropertyWork({});
784 var definePropertyWorksOnDom = typeof document == "undefined" ||
785 doesDefinePropertyWork(document.createElement("div"));
786 if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
787 var definePropertyFallback = Object.defineProperty;
788 }
789 }
790
791 if (!Object.defineProperty || definePropertyFallback) {
792 var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
793 var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
794 var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
795 "on this javascript engine";
796
797 Object.defineProperty = function defineProperty(object, property, descriptor) {
798 if ((typeof object != "object" && typeof object != "function") || object === null)
799 throw new TypeError(ERR_NON_OBJECT_TARGET + object);
800 if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
801 throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
802 if (definePropertyFallback) {
803 try {
804 return definePropertyFallback.call(Object, object, property, descriptor);
805 } catch (exception) {
806 }
807 }
808 if (owns(descriptor, "value")) {
809
810 if (supportsAccessors && (lookupGetter(object, property) ||
811 lookupSetter(object, property)))
812 {
813 var prototype = object.__proto__;
814 object.__proto__ = prototypeOfObject;
815 delete object[property];
816 object[property] = descriptor.value;
817 object.__proto__ = prototype;
818 } else {
819 object[property] = descriptor.value;
820 }
821 } else {
822 if (!supportsAccessors)
823 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
824 if (owns(descriptor, "get"))
825 defineGetter(object, property, descriptor.get);
826 if (owns(descriptor, "set"))
827 defineSetter(object, property, descriptor.set);
828 }
829
830 return object;
831 };
832 }
833 if (!Object.defineProperties) {
834 Object.defineProperties = function defineProperties(object, properties) {
835 for (var property in properties) {
836 if (owns(properties, property))
837 Object.defineProperty(object, property, properties[property]);
838 }
839 return object;
840 };
841 }
842 if (!Object.seal) {
843 Object.seal = function seal(object) {
844 return object;
845 };
846 }
847 if (!Object.freeze) {
848 Object.freeze = function freeze(object) {
849 return object;
850 };
851 }
852 try {
853 Object.freeze(function () {});
854 } catch (exception) {
855 Object.freeze = (function freeze(freezeObject) {
856 return function freeze(object) {
857 if (typeof object == "function") {
858 return object;
859 } else {
860 return freezeObject(object);
861 }
862 };
863 })(Object.freeze);
864 }
865 if (!Object.preventExtensions) {
866 Object.preventExtensions = function preventExtensions(object) {
867 return object;
868 };
869 }
870 if (!Object.isSealed) {
871 Object.isSealed = function isSealed(object) {
872 return false;
873 };
874 }
875 if (!Object.isFrozen) {
876 Object.isFrozen = function isFrozen(object) {
877 return false;
878 };
879 }
880 if (!Object.isExtensible) {
881 Object.isExtensible = function isExtensible(object) {
882 if (Object(object) === object) {
883 throw new TypeError(); // TODO message
884 }
885 var name = '';
886 while (owns(object, name)) {
887 name += '?';
888 }
889 object[name] = true;
890 var returnValue = owns(object, name);
891 delete object[name];
892 return returnValue;
893 };
894 }
895 if (!Object.keys) {
896 var hasDontEnumBug = true,
897 dontEnums = [
898 "toString",
899 "toLocaleString",
900 "valueOf",
901 "hasOwnProperty",
902 "isPrototypeOf",
903 "propertyIsEnumerable",
904 "constructor"
905 ],
906 dontEnumsLength = dontEnums.length;
907
908 for (var key in {"toString": null}) {
909 hasDontEnumBug = false;
910 }
911
912 Object.keys = function keys(object) {
913
914 if (
915 (typeof object != "object" && typeof object != "function") ||
916 object === null
917 ) {
918 throw new TypeError("Object.keys called on a non-object");
919 }
920
921 var keys = [];
922 for (var name in object) {
923 if (owns(object, name)) {
924 keys.push(name);
925 }
926 }
927
928 if (hasDontEnumBug) {
929 for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
930 var dontEnum = dontEnums[i];
931 if (owns(object, dontEnum)) {
932 keys.push(dontEnum);
933 }
934 }
935 }
936 return keys;
937 };
938
939 }
940 if (!Date.now) {
941 Date.now = function now() {
942 return new Date().getTime();
943 };
944 }
945 var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
946 "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
947 "\u2029\uFEFF";
948 if (!String.prototype.trim || ws.trim()) {
949 ws = "[" + ws + "]";
950 var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
951 trimEndRegexp = new RegExp(ws + ws + "*$");
952 String.prototype.trim = function trim() {
953 return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
954 };
955 }
956
957 function toInteger(n) {
958 n = +n;
959 if (n !== n) { // isNaN
960 n = 0;
961 } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
962 n = (n > 0 || -1) * Math.floor(Math.abs(n));
963 }
964 return n;
965 }
966
967 function isPrimitive(input) {
968 var type = typeof input;
969 return (
970 input === null ||
971 type === "undefined" ||
972 type === "boolean" ||
973 type === "number" ||
974 type === "string"
975 );
976 }
977
978 function toPrimitive(input) {
979 var val, valueOf, toString;
980 if (isPrimitive(input)) {
981 return input;
982 }
983 valueOf = input.valueOf;
984 if (typeof valueOf === "function") {
985 val = valueOf.call(input);
986 if (isPrimitive(val)) {
987 return val;
988 }
989 }
990 toString = input.toString;
991 if (typeof toString === "function") {
992 val = toString.call(input);
993 if (isPrimitive(val)) {
994 return val;
995 }
996 }
997 throw new TypeError();
998 }
999 var toObject = function (o) {
1000 if (o == null) { // this matches both null and undefined
1001 throw new TypeError("can't convert "+o+" to object");
1002 }
1003 return Object(o);
1004 };
1005
1006 });
1007
1008 define('ace/lib/dom', ['require', 'exports', 'module' ], function(require, exports, module) {
1009
1010
1011 if (typeof document == "undefined")
1012 return;
1013
1014 var XHTML_NS = "http://www.w3.org/1999/xhtml";
1015
1016 exports.getDocumentHead = function(doc) {
1017 if (!doc)
1018 doc = document;
1019 return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement;
1020 }
1021
1022 exports.createElement = function(tag, ns) {
1023 return document.createElementNS ?
1024 document.createElementNS(ns || XHTML_NS, tag) :
1025 document.createElement(tag);
1026 };
1027
1028 exports.hasCssClass = function(el, name) {
1029 var classes = el.className.split(/\s+/g);
1030 return classes.indexOf(name) !== -1;
1031 };
1032 exports.addCssClass = function(el, name) {
1033 if (!exports.hasCssClass(el, name)) {
1034 el.className += " " + name;
1035 }
1036 };
1037 exports.removeCssClass = function(el, name) {
1038 var classes = el.className.split(/\s+/g);
1039 while (true) {
1040 var index = classes.indexOf(name);
1041 if (index == -1) {
1042 break;
1043 }
1044 classes.splice(index, 1);
1045 }
1046 el.className = classes.join(" ");
1047 };
1048
1049 exports.toggleCssClass = function(el, name) {
1050 var classes = el.className.split(/\s+/g), add = true;
1051 while (true) {
1052 var index = classes.indexOf(name);
1053 if (index == -1) {
1054 break;
1055 }
1056 add = false;
1057 classes.splice(index, 1);
1058 }
1059 if(add)
1060 classes.push(name);
1061
1062 el.className = classes.join(" ");
1063 return add;
1064 };
1065 exports.setCssClass = function(node, className, include) {
1066 if (include) {
1067 exports.addCssClass(node, className);
1068 } else {
1069 exports.removeCssClass(node, className);
1070 }
1071 };
1072
1073 exports.hasCssString = function(id, doc) {
1074 var index = 0, sheets;
1075 doc = doc || document;
1076
1077 if (doc.createStyleSheet && (sheets = doc.styleSheets)) {
1078 while (index < sheets.length)
1079 if (sheets[index++].owningElement.id === id) return true;
1080 } else if ((sheets = doc.getElementsByTagName("style"))) {
1081 while (index < sheets.length)
1082 if (sheets[index++].id === id) return true;
1083 }
1084
1085 return false;
1086 };
1087
1088 exports.importCssString = function importCssString(cssText, id, doc) {
1089 doc = doc || document;
1090 if (id && exports.hasCssString(id, doc))
1091 return null;
1092
1093 var style;
1094
1095 if (doc.createStyleSheet) {
1096 style = doc.createStyleSheet();
1097 style.cssText = cssText;
1098 if (id)
1099 style.owningElement.id = id;
1100 } else {
1101 style = doc.createElementNS
1102 ? doc.createElementNS(XHTML_NS, "style")
1103 : doc.createElement("style");
1104
1105 style.appendChild(doc.createTextNode(cssText));
1106 if (id)
1107 style.id = id;
1108
1109 exports.getDocumentHead(doc).appendChild(style);
1110 }
1111 };
1112
1113 exports.importCssStylsheet = function(uri, doc) {
1114 if (doc.createStyleSheet) {
1115 doc.createStyleSheet(uri);
1116 } else {
1117 var link = exports.createElement('link');
1118 link.rel = 'stylesheet';
1119 link.href = uri;
1120
1121 exports.getDocumentHead(doc).appendChild(link);
1122 }
1123 };
1124
1125 exports.getInnerWidth = function(element) {
1126 return (
1127 parseInt(exports.computedStyle(element, "paddingLeft"), 10) +
1128 parseInt(exports.computedStyle(element, "paddingRight"), 10) +
1129 element.clientWidth
1130 );
1131 };
1132
1133 exports.getInnerHeight = function(element) {
1134 return (
1135 parseInt(exports.computedStyle(element, "paddingTop"), 10) +
1136 parseInt(exports.computedStyle(element, "paddingBottom"), 10) +
1137 element.clientHeight
1138 );
1139 };
1140
1141 if (window.pageYOffset !== undefined) {
1142 exports.getPageScrollTop = function() {
1143 return window.pageYOffset;
1144 };
1145
1146 exports.getPageScrollLeft = function() {
1147 return window.pageXOffset;
1148 };
1149 }
1150 else {
1151 exports.getPageScrollTop = function() {
1152 return document.body.scrollTop;
1153 };
1154
1155 exports.getPageScrollLeft = function() {
1156 return document.body.scrollLeft;
1157 };
1158 }
1159
1160 if (window.getComputedStyle)
1161 exports.computedStyle = function(element, style) {
1162 if (style)
1163 return (window.getComputedStyle(element, "") || {})[style] || "";
1164 return window.getComputedStyle(element, "") || {};
1165 };
1166 else
1167 exports.computedStyle = function(element, style) {
1168 if (style)
1169 return element.currentStyle[style];
1170 return element.currentStyle;
1171 };
1172
1173 exports.scrollbarWidth = function(document) {
1174 var inner = exports.createElement("ace_inner");
1175 inner.style.width = "100%";
1176 inner.style.minWidth = "0px";
1177 inner.style.height = "200px";
1178 inner.style.display = "block";
1179
1180 var outer = exports.createElement("ace_outer");
1181 var style = outer.style;
1182
1183 style.position = "absolute";
1184 style.left = "-10000px";
1185 style.overflow = "hidden";
1186 style.width = "200px";
1187 style.minWidth = "0px";
1188 style.height = "150px";
1189 style.display = "block";
1190
1191 outer.appendChild(inner);
1192
1193 var body = document.documentElement;
1194 body.appendChild(outer);
1195
1196 var noScrollbar = inner.offsetWidth;
1197
1198 style.overflow = "scroll";
1199 var withScrollbar = inner.offsetWidth;
1200
1201 if (noScrollbar == withScrollbar) {
1202 withScrollbar = outer.clientWidth;
1203 }
1204
1205 body.removeChild(outer);
1206
1207 return noScrollbar-withScrollbar;
1208 };
1209 exports.setInnerHtml = function(el, innerHtml) {
1210 var element = el.cloneNode(false);//document.createElement("div");
1211 element.innerHTML = innerHtml;
1212 el.parentNode.replaceChild(element, el);
1213 return element;
1214 };
1215
1216 if ("textContent" in document.documentElement) {
1217 exports.setInnerText = function(el, innerText) {
1218 el.textContent = innerText;
1219 };
1220
1221 exports.getInnerText = function(el) {
1222 return el.textContent;
1223 };
1224 }
1225 else {
1226 exports.setInnerText = function(el, innerText) {
1227 el.innerText = innerText;
1228 };
1229
1230 exports.getInnerText = function(el) {
1231 return el.innerText;
1232 };
1233 }
1234
1235 exports.getParentWindow = function(document) {
1236 return document.defaultView || document.parentWindow;
1237 };
1238
1239 });
1240
1241 define('ace/lib/event', ['require', 'exports', 'module' , 'ace/lib/keys', 'ace/lib/useragent', 'ace/lib/dom'], function(require, exports, module) {
1242
1243
1244 var keys = require("./keys");
1245 var useragent = require("./useragent");
1246 var dom = require("./dom");
1247
1248 exports.addListener = function(elem, type, callback) {
1249 if (elem.addEventListener) {
1250 return elem.addEventListener(type, callback, false);
1251 }
1252 if (elem.attachEvent) {
1253 var wrapper = function() {
1254 callback(window.event);
1255 };
1256 callback._wrapper = wrapper;
1257 elem.attachEvent("on" + type, wrapper);
1258 }
1259 };
1260
1261 exports.removeListener = function(elem, type, callback) {
1262 if (elem.removeEventListener) {
1263 return elem.removeEventListener(type, callback, false);
1264 }
1265 if (elem.detachEvent) {
1266 elem.detachEvent("on" + type, callback._wrapper || callback);
1267 }
1268 };
1269 exports.stopEvent = function(e) {
1270 exports.stopPropagation(e);
1271 exports.preventDefault(e);
1272 return false;
1273 };
1274
1275 exports.stopPropagation = function(e) {
1276 if (e.stopPropagation)
1277 e.stopPropagation();
1278 else
1279 e.cancelBubble = true;
1280 };
1281
1282 exports.preventDefault = function(e) {
1283 if (e.preventDefault)
1284 e.preventDefault();
1285 else
1286 e.returnValue = false;
1287 };
1288 exports.getButton = function(e) {
1289 if (e.type == "dblclick")
1290 return 0;
1291 if (e.type == "contextmenu" || (e.ctrlKey && useragent.isMac))
1292 return 2;
1293 if (e.preventDefault) {
1294 return e.button;
1295 }
1296 else {
1297 return {1:0, 2:2, 4:1}[e.button];
1298 }
1299 };
1300
1301 if (document.documentElement.setCapture) {
1302 exports.capture = function(el, eventHandler, releaseCaptureHandler) {
1303 var called = false;
1304 function onReleaseCapture(e) {
1305 eventHandler(e);
1306
1307 if (!called) {
1308 called = true;
1309 releaseCaptureHandler(e);
1310 }
1311
1312 exports.removeListener(el, "mousemove", eventHandler);
1313 exports.removeListener(el, "mouseup", onReleaseCapture);
1314 exports.removeListener(el, "losecapture", onReleaseCapture);
1315
1316 el.releaseCapture();
1317 }
1318
1319 exports.addListener(el, "mousemove", eventHandler);
1320 exports.addListener(el, "mouseup", onReleaseCapture);
1321 exports.addListener(el, "losecapture", onReleaseCapture);
1322 el.setCapture();
1323 };
1324 }
1325 else {
1326 exports.capture = function(el, eventHandler, releaseCaptureHandler) {
1327 function onMouseUp(e) {
1328 eventHandler && eventHandler(e);
1329 releaseCaptureHandler && releaseCaptureHandler(e);
1330
1331 document.removeEventListener("mousemove", eventHandler, true);
1332 document.removeEventListener("mouseup", onMouseUp, true);
1333
1334 e.stopPropagation();
1335 }
1336
1337 document.addEventListener("mousemove", eventHandler, true);
1338 document.addEventListener("mouseup", onMouseUp, true);
1339 };
1340 }
1341
1342 exports.addMouseWheelListener = function(el, callback) {
1343 var factor = 8;
1344 var listener = function(e) {
1345 if (e.wheelDelta !== undefined) {
1346 if (e.wheelDeltaX !== undefined) {
1347 e.wheelX = -e.wheelDeltaX / factor;
1348 e.wheelY = -e.wheelDeltaY / factor;
1349 } else {
1350 e.wheelX = 0;
1351 e.wheelY = -e.wheelDelta / factor;
1352 }
1353 }
1354 else {
1355 if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
1356 e.wheelX = (e.detail || 0) * 5;
1357 e.wheelY = 0;
1358 } else {
1359 e.wheelX = 0;
1360 e.wheelY = (e.detail || 0) * 5;
1361 }
1362 }
1363 callback(e);
1364 };
1365 exports.addListener(el, "DOMMouseScroll", listener);
1366 exports.addListener(el, "mousewheel", listener);
1367 };
1368
1369 exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbackName) {
1370 var clicks = 0;
1371 var startX, startY, timer;
1372 var eventNames = {
1373 2: "dblclick",
1374 3: "tripleclick",
1375 4: "quadclick"
1376 };
1377
1378 exports.addListener(el, "mousedown", function(e) {
1379 if (exports.getButton(e) != 0) {
1380 clicks = 0;
1381 } else {
1382 var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;
1383
1384 if (!timer || isNewClick)
1385 clicks = 0;
1386
1387 clicks += 1;
1388
1389 if (timer)
1390 clearTimeout(timer)
1391 timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
1392 }
1393 if (clicks == 1) {
1394 startX = e.clientX;
1395 startY = e.clientY;
1396 }
1397
1398 eventHandler[callbackName]("mousedown", e);
1399
1400 if (clicks > 4)
1401 clicks = 0;
1402 else if (clicks > 1)
1403 return eventHandler[callbackName](eventNames[clicks], e);
1404 });
1405
1406 if (useragent.isOldIE) {
1407 exports.addListener(el, "dblclick", function(e) {
1408 clicks = 2;
1409 if (timer)
1410 clearTimeout(timer);
1411 timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
1412 eventHandler[callbackName]("mousedown", e);
1413 eventHandler[callbackName](eventNames[clicks], e);
1414 });
1415 }
1416 };
1417
1418 function normalizeCommandKeys(callback, e, keyCode) {
1419 var hashId = 0;
1420 if ((useragent.isOpera && !("KeyboardEvent" in window)) && useragent.isMac) {
1421 hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
1422 | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
1423 } else {
1424 hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0)
1425 | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
1426 }
1427
1428 if (keyCode in keys.MODIFIER_KEYS) {
1429 switch (keys.MODIFIER_KEYS[keyCode]) {
1430 case "Alt":
1431 hashId = 2;
1432 break;
1433 case "Shift":
1434 hashId = 4;
1435 break;
1436 case "Ctrl":
1437 hashId = 1;
1438 break;
1439 default:
1440 hashId = 8;
1441 break;
1442 }
1443 keyCode = 0;
1444 }
1445
1446 if (!useragent.isMac && pressedKeys[91] || pressedKeys[92])
1447 hashId |= 8;
1448
1449 if (hashId & 8 && (keyCode == 91 || keyCode == 93)) {
1450 keyCode = 0;
1451 }
1452 if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {
1453 return false;
1454 }
1455 return callback(e, hashId, keyCode);
1456 }
1457
1458 var pressedKeys = Object.create(null);
1459 exports.addCommandKeyListener = function(el, callback) {
1460 var addListener = exports.addListener;
1461 if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) {
1462 var lastKeyDownKeyCode = null;
1463 addListener(el, "keydown", function(e) {
1464 lastKeyDownKeyCode = e.keyCode;
1465 });
1466 addListener(el, "keypress", function(e) {
1467 return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
1468 });
1469 } else {
1470 var lastDefaultPrevented = null;
1471
1472 addListener(el, "keydown", function(e) {
1473 pressedKeys[e.keyCode] = true;
1474 var result = normalizeCommandKeys(callback, e, e.keyCode);
1475 lastDefaultPrevented = e.defaultPrevented;
1476 return result;
1477 });
1478
1479 addListener(el, "keypress", function(e) {
1480 if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) {
1481 exports.stopEvent(e);
1482 lastDefaultPrevented = null;
1483 }
1484 });
1485
1486 addListener(el, "keyup", function(e) {
1487 pressedKeys[e.keyCode] = null;
1488 });
1489
1490 addListener(el, "focus", function(e) {
1491 pressedKeys = Object.create(null);
1492 });
1493 }
1494 };
1495
1496 if (window.postMessage && !useragent.isOldIE) {
1497 var postMessageId = 1;
1498 exports.nextTick = function(callback, win) {
1499 win = win || window;
1500 var messageName = "zero-timeout-message-" + postMessageId;
1501 exports.addListener(win, "message", function listener(e) {
1502 if (e.data == messageName) {
1503 exports.stopPropagation(e);
1504 exports.removeListener(win, "message", listener);
1505 callback();
1506 }
1507 });
1508 win.postMessage(messageName, "*");
1509 };
1510 }
1511
1512
1513 exports.nextFrame = window.requestAnimationFrame ||
1514 window.mozRequestAnimationFrame ||
1515 window.webkitRequestAnimationFrame ||
1516 window.msRequestAnimationFrame ||
1517 window.oRequestAnimationFrame;
1518
1519 if (exports.nextFrame)
1520 exports.nextFrame = exports.nextFrame.bind(window);
1521 else
1522 exports.nextFrame = function(callback) {
1523 setTimeout(callback, 17);
1524 };
1525 });
1526
1527 define('ace/lib/keys', ['require', 'exports', 'module' , 'ace/lib/oop'], function(require, exports, module) {
1528
1529
1530 var oop = require("./oop");
1531 var Keys = (function() {
1532 var ret = {
1533 MODIFIER_KEYS: {
1534 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'
1535 },
1536
1537 KEY_MODS: {
1538 "ctrl": 1, "alt": 2, "option" : 2,
1539 "shift": 4, "meta": 8, "command": 8, "cmd": 8
1540 },
1541
1542 FUNCTION_KEYS : {
1543 8 : "Backspace",
1544 9 : "Tab",
1545 13 : "Return",
1546 19 : "Pause",
1547 27 : "Esc",
1548 32 : "Space",
1549 33 : "PageUp",
1550 34 : "PageDown",
1551 35 : "End",
1552 36 : "Home",
1553 37 : "Left",
1554 38 : "Up",
1555 39 : "Right",
1556 40 : "Down",
1557 44 : "Print",
1558 45 : "Insert",
1559 46 : "Delete",
1560 96 : "Numpad0",
1561 97 : "Numpad1",
1562 98 : "Numpad2",
1563 99 : "Numpad3",
1564 100: "Numpad4",
1565 101: "Numpad5",
1566 102: "Numpad6",
1567 103: "Numpad7",
1568 104: "Numpad8",
1569 105: "Numpad9",
1570 112: "F1",
1571 113: "F2",
1572 114: "F3",
1573 115: "F4",
1574 116: "F5",
1575 117: "F6",
1576 118: "F7",
1577 119: "F8",
1578 120: "F9",
1579 121: "F10",
1580 122: "F11",
1581 123: "F12",
1582 144: "Numlock",
1583 145: "Scrolllock"
1584 },
1585
1586 PRINTABLE_KEYS: {
1587 32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',
1588 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',
1589 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',
1590 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
1591 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
1592 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
1593 188: ',', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\',
1594 221: ']', 222: '\''
1595 }
1596 };
1597 for (var i in ret.FUNCTION_KEYS) {
1598 var name = ret.FUNCTION_KEYS[i].toLowerCase();
1599 ret[name] = parseInt(i, 10);
1600 }
1601 oop.mixin(ret, ret.MODIFIER_KEYS);
1602 oop.mixin(ret, ret.PRINTABLE_KEYS);
1603 oop.mixin(ret, ret.FUNCTION_KEYS);
1604 ret.enter = ret["return"];
1605 ret.escape = ret.esc;
1606 ret.del = ret["delete"];
1607 ret[173] = '-';
1608
1609 return ret;
1610 })();
1611 oop.mixin(exports, Keys);
1612
1613 exports.keyCodeToString = function(keyCode) {
1614 return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase();
1615 }
1616
1617 });
1618
1619 define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
1620
1621
1622 exports.inherits = (function() {
1623 var tempCtor = function() {};
1624 return function(ctor, superCtor) {
1625 tempCtor.prototype = superCtor.prototype;
1626 ctor.super_ = superCtor.prototype;
1627 ctor.prototype = new tempCtor();
1628 ctor.prototype.constructor = ctor;
1629 };
1630 }());
1631
1632 exports.mixin = function(obj, mixin) {
1633 for (var key in mixin) {
1634 obj[key] = mixin[key];
1635 }
1636 return obj;
1637 };
1638
1639 exports.implement = function(proto, mixin) {
1640 exports.mixin(proto, mixin);
1641 };
1642
1643 });
1644
1645 define('ace/lib/useragent', ['require', 'exports', 'module' ], function(require, exports, module) {
1646 exports.OS = {
1647 LINUX: "LINUX",
1648 MAC: "MAC",
1649 WINDOWS: "WINDOWS"
1650 };
1651 exports.getOS = function() {
1652 if (exports.isMac) {
1653 return exports.OS.MAC;
1654 } else if (exports.isLinux) {
1655 return exports.OS.LINUX;
1656 } else {
1657 return exports.OS.WINDOWS;
1658 }
1659 };
1660 if (typeof navigator != "object")
1661 return;
1662
1663 var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
1664 var ua = navigator.userAgent;
1665 exports.isWin = (os == "win");
1666 exports.isMac = (os == "mac");
1667 exports.isLinux = (os == "linux");
1668 exports.isIE =
1669 (navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0)
1670 && parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1]);
1671
1672 exports.isOldIE = exports.isIE && exports.isIE < 9;
1673 exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
1674 exports.isOldGecko = exports.isGecko && parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1], 10) < 4;
1675 exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
1676 exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
1677
1678 exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
1679
1680 exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
1681
1682 exports.isIPad = ua.indexOf("iPad") >= 0;
1683
1684 exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
1685
1686 });
1687
1688 define('ace/editor', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/mouse/fold_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'ace/lib/event_emitter', 'ace/commands/command_manager', 'ace/commands/default_commands', 'ace/config'], function(require, exports, module) {
1689
1690
1691 require("./lib/fixoldbrowsers");
1692
1693 var oop = require("./lib/oop");
1694 var dom = require("./lib/dom");
1695 var lang = require("./lib/lang");
1696 var useragent = require("./lib/useragent");
1697 var TextInput = require("./keyboard/textinput").TextInput;
1698 var MouseHandler = require("./mouse/mouse_handler").MouseHandler;
1699 var FoldHandler = require("./mouse/fold_handler").FoldHandler;
1700 var KeyBinding = require("./keyboard/keybinding").KeyBinding;
1701 var EditSession = require("./edit_session").EditSession;
1702 var Search = require("./search").Search;
1703 var Range = require("./range").Range;
1704 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1705 var CommandManager = require("./commands/command_manager").CommandManager;
1706 var defaultCommands = require("./commands/default_commands").commands;
1707 var config = require("./config");
1708 var Editor = function(renderer, session) {
1709 var container = renderer.getContainerElement();
1710 this.container = container;
1711 this.renderer = renderer;
1712
1713 this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
1714 this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
1715 this.renderer.textarea = this.textInput.getElement();
1716 this.keyBinding = new KeyBinding(this);
1717 this.$mouseHandler = new MouseHandler(this);
1718 new FoldHandler(this);
1719
1720 this.$blockScrolling = 0;
1721 this.$search = new Search().set({
1722 wrap: true
1723 });
1724
1725 this.setSession(session || new EditSession(""));
1726 config.resetOptions(this);
1727 config._emit("editor", this);
1728 };
1729
1730 (function(){
1731
1732 oop.implement(this, EventEmitter);
1733 this.setKeyboardHandler = function(keyboardHandler) {
1734 if (!keyboardHandler) {
1735 this.keyBinding.setKeyboardHandler(null);
1736 } else if (typeof keyboardHandler == "string") {
1737 this.$keybindingId = keyboardHandler;
1738 var _self = this;
1739 config.loadModule(["keybinding", keyboardHandler], function(module) {
1740 if (_self.$keybindingId == keyboardHandler)
1741 _self.keyBinding.setKeyboardHandler(module && module.handler);
1742 });
1743 } else {
1744 delete this.$keybindingId;
1745 this.keyBinding.setKeyboardHandler(keyboardHandler);
1746 }
1747 };
1748 this.getKeyboardHandler = function() {
1749 return this.keyBinding.getKeyboardHandler();
1750 };
1751 this.setSession = function(session) {
1752 if (this.session == session)
1753 return;
1754
1755 if (this.session) {
1756 var oldSession = this.session;
1757 this.session.removeEventListener("change", this.$onDocumentChange);
1758 this.session.removeEventListener("changeMode", this.$onChangeMode);
1759 this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
1760 this.session.removeEventListener("changeTabSize", this.$onChangeTabSize);
1761 this.session.removeEventListener("changeWrapLimit", this.$onChangeWrapLimit);
1762 this.session.removeEventListener("changeWrapMode", this.$onChangeWrapMode);
1763 this.session.removeEventListener("onChangeFold", this.$onChangeFold);
1764 this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker);
1765 this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker);
1766 this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint);
1767 this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation);
1768 this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
1769 this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange);
1770 this.session.removeEventListener("changeScrollLeft", this.$onScrollLeftChange);
1771
1772 var selection = this.session.getSelection();
1773 selection.removeEventListener("changeCursor", this.$onCursorChange);
1774 selection.removeEventListener("changeSelection", this.$onSelectionChange);
1775 }
1776
1777 this.session = session;
1778
1779 this.$onDocumentChange = this.onDocumentChange.bind(this);
1780 session.addEventListener("change", this.$onDocumentChange);
1781 this.renderer.setSession(session);
1782
1783 this.$onChangeMode = this.onChangeMode.bind(this);
1784 session.addEventListener("changeMode", this.$onChangeMode);
1785
1786 this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
1787 session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
1788
1789 this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);
1790 session.addEventListener("changeTabSize", this.$onChangeTabSize);
1791
1792 this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
1793 session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit);
1794
1795 this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
1796 session.addEventListener("changeWrapMode", this.$onChangeWrapMode);
1797
1798 this.$onChangeFold = this.onChangeFold.bind(this);
1799 session.addEventListener("changeFold", this.$onChangeFold);
1800
1801 this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
1802 this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
1803
1804 this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
1805 this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
1806
1807 this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
1808 this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint);
1809
1810 this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
1811 this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation);
1812
1813 this.$onCursorChange = this.onCursorChange.bind(this);
1814 this.session.addEventListener("changeOverwrite", this.$onCursorChange);
1815
1816 this.$onScrollTopChange = this.onScrollTopChange.bind(this);
1817 this.session.addEventListener("changeScrollTop", this.$onScrollTopChange);
1818
1819 this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
1820 this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange);
1821
1822 this.selection = session.getSelection();
1823 this.selection.addEventListener("changeCursor", this.$onCursorChange);
1824
1825 this.$onSelectionChange = this.onSelectionChange.bind(this);
1826 this.selection.addEventListener("changeSelection", this.$onSelectionChange);
1827
1828 this.onChangeMode();
1829
1830 this.$blockScrolling += 1;
1831 this.onCursorChange();
1832 this.$blockScrolling -= 1;
1833
1834 this.onScrollTopChange();
1835 this.onScrollLeftChange();
1836 this.onSelectionChange();
1837 this.onChangeFrontMarker();
1838 this.onChangeBackMarker();
1839 this.onChangeBreakpoint();
1840 this.onChangeAnnotation();
1841 this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
1842 this.renderer.updateFull();
1843
1844 this._emit("changeSession", {
1845 session: session,
1846 oldSession: oldSession
1847 });
1848 };
1849 this.getSession = function() {
1850 return this.session;
1851 };
1852 this.setValue = function(val, cursorPos) {
1853 this.session.doc.setValue(val);
1854
1855 if (!cursorPos)
1856 this.selectAll();
1857 else if (cursorPos == 1)
1858 this.navigateFileEnd();
1859 else if (cursorPos == -1)
1860 this.navigateFileStart();
1861
1862 return val;
1863 };
1864 this.getValue = function() {
1865 return this.session.getValue();
1866 };
1867 this.getSelection = function() {
1868 return this.selection;
1869 };
1870 this.resize = function(force) {
1871 this.renderer.onResize(force);
1872 };
1873 this.setTheme = function(theme) {
1874 this.renderer.setTheme(theme);
1875 };
1876 this.getTheme = function() {
1877 return this.renderer.getTheme();
1878 };
1879 this.setStyle = function(style) {
1880 this.renderer.setStyle(style);
1881 };
1882 this.unsetStyle = function(style) {
1883 this.renderer.unsetStyle(style);
1884 };
1885 this.getFontSize = function () {
1886 return this.getOption("fontSize") ||
1887 dom.computedStyle(this.container, "fontSize");
1888 };
1889 this.setFontSize = function(size) {
1890 this.setOption("fontSize", size);
1891 };
1892
1893 this.$highlightBrackets = function() {
1894 if (this.session.$bracketHighlight) {
1895 this.session.removeMarker(this.session.$bracketHighlight);
1896 this.session.$bracketHighlight = null;
1897 }
1898
1899 if (this.$highlightPending) {
1900 return;
1901 }
1902 var self = this;
1903 this.$highlightPending = true;
1904 setTimeout(function() {
1905 self.$highlightPending = false;
1906
1907 var pos = self.session.findMatchingBracket(self.getCursorPosition());
1908 if (pos) {
1909 var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
1910 } else if (self.session.$mode.getMatching) {
1911 var range = self.session.$mode.getMatching(self.session);
1912 }
1913 if (range)
1914 self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text");
1915 }, 50);
1916 };
1917 this.focus = function() {
1918 var _self = this;
1919 setTimeout(function() {
1920 _self.textInput.focus();
1921 });
1922 this.textInput.focus();
1923 };
1924 this.isFocused = function() {
1925 return this.textInput.isFocused();
1926 };
1927 this.blur = function() {
1928 this.textInput.blur();
1929 };
1930 this.onFocus = function() {
1931 if (this.$isFocused)
1932 return;
1933 this.$isFocused = true;
1934 this.renderer.showCursor();
1935 this.renderer.visualizeFocus();
1936 this._emit("focus");
1937 };
1938 this.onBlur = function() {
1939 if (!this.$isFocused)
1940 return;
1941 this.$isFocused = false;
1942 this.renderer.hideCursor();
1943 this.renderer.visualizeBlur();
1944 this._emit("blur");
1945 };
1946
1947 this.$cursorChange = function() {
1948 this.renderer.updateCursor();
1949 };
1950 this.onDocumentChange = function(e) {
1951 var delta = e.data;
1952 var range = delta.range;
1953 var lastRow;
1954
1955 if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines")
1956 lastRow = range.end.row;
1957 else
1958 lastRow = Infinity;
1959 this.renderer.updateLines(range.start.row, lastRow);
1960
1961 this._emit("change", e);
1962 this.$cursorChange();
1963 };
1964
1965 this.onTokenizerUpdate = function(e) {
1966 var rows = e.data;
1967 this.renderer.updateLines(rows.first, rows.last);
1968 };
1969
1970
1971 this.onScrollTopChange = function() {
1972 this.renderer.scrollToY(this.session.getScrollTop());
1973 };
1974
1975 this.onScrollLeftChange = function() {
1976 this.renderer.scrollToX(this.session.getScrollLeft());
1977 };
1978 this.onCursorChange = function() {
1979 this.$cursorChange();
1980
1981 if (!this.$blockScrolling) {
1982 this.renderer.scrollCursorIntoView();
1983 }
1984
1985 this.$highlightBrackets();
1986 this.$updateHighlightActiveLine();
1987 this._emit("changeSelection");
1988 };
1989
1990 this.$updateHighlightActiveLine = function() {
1991 var session = this.getSession();
1992
1993 var highlight;
1994 if (this.$highlightActiveLine) {
1995 if ((this.$selectionStyle != "line" || !this.selection.isMultiLine()))
1996 highlight = this.getCursorPosition();
1997 }
1998
1999 if (session.$highlightLineMarker && !highlight) {
2000 session.removeMarker(session.$highlightLineMarker.id);
2001 session.$highlightLineMarker = null;
2002 } else if (!session.$highlightLineMarker && highlight) {
2003 var range = new Range(highlight.row, highlight.column, highlight.row, Infinity);
2004 range.id = session.addMarker(range, "ace_active-line", "screenLine");
2005 session.$highlightLineMarker = range;
2006 } else if (highlight) {
2007 session.$highlightLineMarker.start.row = highlight.row;
2008 session.$highlightLineMarker.end.row = highlight.row;
2009 session.$highlightLineMarker.start.column = highlight.column;
2010 session._emit("changeBackMarker");
2011 }
2012 };
2013
2014 this.onSelectionChange = function(e) {
2015 var session = this.session;
2016
2017 if (session.$selectionMarker) {
2018 session.removeMarker(session.$selectionMarker);
2019 }
2020 session.$selectionMarker = null;
2021
2022 if (!this.selection.isEmpty()) {
2023 var range = this.selection.getRange();
2024 var style = this.getSelectionStyle();
2025 session.$selectionMarker = session.addMarker(range, "ace_selection", style);
2026 } else {
2027 this.$updateHighlightActiveLine();
2028 }
2029
2030 var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()
2031 this.session.highlight(re);
2032
2033 this._emit("changeSelection");
2034 };
2035
2036 this.$getSelectionHighLightRegexp = function() {
2037 var session = this.session;
2038
2039 var selection = this.getSelectionRange();
2040 if (selection.isEmpty() || selection.isMultiLine())
2041 return;
2042
2043 var startOuter = selection.start.column - 1;
2044 var endOuter = selection.end.column + 1;
2045 var line = session.getLine(selection.start.row);
2046 var lineCols = line.length;
2047 var needle = line.substring(Math.max(startOuter, 0),
2048 Math.min(endOuter, lineCols));
2049 if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
2050 (endOuter <= lineCols && /[\w\d]$/.test(needle)))
2051 return;
2052
2053 needle = line.substring(selection.start.column, selection.end.column);
2054 if (!/^[\w\d]+$/.test(needle))
2055 return;
2056
2057 var re = this.$search.$assembleRegExp({
2058 wholeWord: true,
2059 caseSensitive: true,
2060 needle: needle
2061 });
2062
2063 return re;
2064 };
2065
2066
2067 this.onChangeFrontMarker = function() {
2068 this.renderer.updateFrontMarkers();
2069 };
2070
2071 this.onChangeBackMarker = function() {
2072 this.renderer.updateBackMarkers();
2073 };
2074
2075
2076 this.onChangeBreakpoint = function() {
2077 this.renderer.updateBreakpoints();
2078 };
2079
2080 this.onChangeAnnotation = function() {
2081 this.renderer.setAnnotations(this.session.getAnnotations());
2082 };
2083
2084
2085 this.onChangeMode = function(e) {
2086 this.renderer.updateText();
2087 this._emit("changeMode", e);
2088 };
2089
2090
2091 this.onChangeWrapLimit = function() {
2092 this.renderer.updateFull();
2093 };
2094
2095 this.onChangeWrapMode = function() {
2096 this.renderer.onResize(true);
2097 };
2098
2099
2100 this.onChangeFold = function() {
2101 this.$updateHighlightActiveLine();
2102 this.renderer.updateFull();
2103 };
2104
2105 this.getCopyText = function() {
2106 var text = "";
2107 if (!this.selection.isEmpty())
2108 text = this.session.getTextRange(this.getSelectionRange());
2109
2110 this._emit("copy", text);
2111 return text;
2112 };
2113 this.onCopy = function() {
2114 this.commands.exec("copy", this);
2115 };
2116 this.onCut = function() {
2117 this.commands.exec("cut", this);
2118 };
2119 this.onPaste = function(text) {
2120 if (this.$readOnly)
2121 return;
2122 this._emit("paste", text);
2123 this.insert(text);
2124 };
2125
2126
2127 this.execCommand = function(command, args) {
2128 this.commands.exec(command, this, args);
2129 };
2130 this.insert = function(text) {
2131 var session = this.session;
2132 var mode = session.getMode();
2133 var cursor = this.getCursorPosition();
2134
2135 if (this.getBehavioursEnabled()) {
2136 var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);
2137 if (transform)
2138 text = transform.text;
2139 }
2140
2141 text = text.replace("\t", this.session.getTabString());
2142 if (!this.selection.isEmpty()) {
2143 cursor = this.session.remove(this.getSelectionRange());
2144 this.clearSelection();
2145 }
2146 else if (this.session.getOverwrite()) {
2147 var range = new Range.fromPoints(cursor, cursor);
2148 range.end.column += text.length;
2149 this.session.remove(range);
2150 }
2151
2152 this.clearSelection();
2153
2154 var start = cursor.column;
2155 var lineState = session.getState(cursor.row);
2156 var line = session.getLine(cursor.row);
2157 var shouldOutdent = mode.checkOutdent(lineState, line, text);
2158 var end = session.insert(cursor, text);
2159
2160 if (transform && transform.selection) {
2161 if (transform.selection.length == 2) { // Transform relative to the current column
2162 this.selection.setSelectionRange(
2163 new Range(cursor.row, start + transform.selection[0],
2164 cursor.row, start + transform.selection[1]));
2165 } else { // Transform relative to the current row.
2166 this.selection.setSelectionRange(
2167 new Range(cursor.row + transform.selection[0],
2168 transform.selection[1],
2169 cursor.row + transform.selection[2],
2170 transform.selection[3]));
2171 }
2172 }
2173 if (session.getDocument().isNewLine(text)) {
2174 var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
2175
2176 this.moveCursorTo(cursor.row+1, 0);
2177
2178 var size = session.getTabSize();
2179 var minIndent = Number.MAX_VALUE;
2180
2181 for (var row = cursor.row + 1; row <= end.row; ++row) {
2182 var indent = 0;
2183
2184 line = session.getLine(row);
2185 for (var i = 0; i < line.length; ++i)
2186 if (line.charAt(i) == '\t')
2187 indent += size;
2188 else if (line.charAt(i) == ' ')
2189 indent += 1;
2190 else
2191 break;
2192 if (/[^\s]/.test(line))
2193 minIndent = Math.min(indent, minIndent);
2194 }
2195
2196 for (var row = cursor.row + 1; row <= end.row; ++row) {
2197 var outdent = minIndent;
2198
2199 line = session.getLine(row);
2200 for (var i = 0; i < line.length && outdent > 0; ++i)
2201 if (line.charAt(i) == '\t')
2202 outdent -= size;
2203 else if (line.charAt(i) == ' ')
2204 outdent -= 1;
2205 session.remove(new Range(row, 0, row, i));
2206 }
2207 session.indentRows(cursor.row + 1, end.row, lineIndent);
2208 }
2209 if (shouldOutdent)
2210 mode.autoOutdent(lineState, session, cursor.row);
2211 };
2212
2213 this.onTextInput = function(text) {
2214 this.keyBinding.onTextInput(text);
2215 };
2216
2217 this.onCommandKey = function(e, hashId, keyCode) {
2218 this.keyBinding.onCommandKey(e, hashId, keyCode);
2219 };
2220 this.setOverwrite = function(overwrite) {
2221 this.session.setOverwrite(overwrite);
2222 };
2223 this.getOverwrite = function() {
2224 return this.session.getOverwrite();
2225 };
2226 this.toggleOverwrite = function() {
2227 this.session.toggleOverwrite();
2228 };
2229 this.setScrollSpeed = function(speed) {
2230 this.setOption("scrollSpeed", speed);
2231 };
2232 this.getScrollSpeed = function() {
2233 return this.getOption("scrollSpeed");
2234 };
2235 this.setDragDelay = function(dragDelay) {
2236 this.setOption("dragDelay", dragDelay);
2237 };
2238 this.getDragDelay = function() {
2239 return this.getOption("dragDelay");
2240 };
2241 this.setSelectionStyle = function(val) {
2242 this.setOption("selectionStyle", val);
2243 };
2244 this.getSelectionStyle = function() {
2245 return this.getOption("selectionStyle");
2246 };
2247 this.setHighlightActiveLine = function(shouldHighlight) {
2248 this.setOption("highlightActiveLine", shouldHighlight);
2249 };
2250 this.getHighlightActiveLine = function() {
2251 return this.getOption("highlightActiveLine");
2252 };
2253 this.setHighlightGutterLine = function(shouldHighlight) {
2254 this.setOption("highlightGutterLine", shouldHighlight);
2255 };
2256
2257 this.getHighlightGutterLine = function() {
2258 return this.getOption("highlightGutterLine");
2259 };
2260 this.setHighlightSelectedWord = function(shouldHighlight) {
2261 this.setOption("highlightSelectedWord", shouldHighlight);
2262 };
2263 this.getHighlightSelectedWord = function() {
2264 return this.$highlightSelectedWord;
2265 };
2266
2267 this.setAnimatedScroll = function(shouldAnimate){
2268 this.renderer.setAnimatedScroll(shouldAnimate);
2269 };
2270
2271 this.getAnimatedScroll = function(){
2272 return this.renderer.getAnimatedScroll();
2273 };
2274 this.setShowInvisibles = function(showInvisibles) {
2275 this.renderer.setShowInvisibles(showInvisibles);
2276 };
2277 this.getShowInvisibles = function() {
2278 return this.renderer.getShowInvisibles();
2279 };
2280
2281 this.setDisplayIndentGuides = function(display) {
2282 this.renderer.setDisplayIndentGuides(display);
2283 };
2284
2285 this.getDisplayIndentGuides = function() {
2286 return this.renderer.getDisplayIndentGuides();
2287 };
2288 this.setShowPrintMargin = function(showPrintMargin) {
2289 this.renderer.setShowPrintMargin(showPrintMargin);
2290 };
2291 this.getShowPrintMargin = function() {
2292 return this.renderer.getShowPrintMargin();
2293 };
2294 this.setPrintMarginColumn = function(showPrintMargin) {
2295 this.renderer.setPrintMarginColumn(showPrintMargin);
2296 };
2297 this.getPrintMarginColumn = function() {
2298 return this.renderer.getPrintMarginColumn();
2299 };
2300 this.setReadOnly = function(readOnly) {
2301 this.setOption("readOnly", readOnly);
2302 };
2303 this.getReadOnly = function() {
2304 return this.getOption("readOnly");
2305 };
2306 this.setBehavioursEnabled = function (enabled) {
2307 this.setOption("behavioursEnabled", enabled);
2308 };
2309 this.getBehavioursEnabled = function () {
2310 return this.getOption("behavioursEnabled");
2311 };
2312 this.setWrapBehavioursEnabled = function (enabled) {
2313 this.setOption("wrapBehavioursEnabled", enabled);
2314 };
2315 this.getWrapBehavioursEnabled = function () {
2316 return this.getOption("wrapBehavioursEnabled");
2317 };
2318 this.setShowFoldWidgets = function(show) {
2319 this.setOption("showFoldWidgets", show);
2320
2321 };
2322 this.getShowFoldWidgets = function() {
2323 return this.getOption("showFoldWidgets");
2324 };
2325
2326 this.setFadeFoldWidgets = function(fade) {
2327 this.setOption("fadeFoldWidgets", fade);
2328 };
2329
2330 this.getFadeFoldWidgets = function() {
2331 return this.getOption("fadeFoldWidgets");
2332 };
2333 this.remove = function(dir) {
2334 if (this.selection.isEmpty()){
2335 if (dir == "left")
2336 this.selection.selectLeft();
2337 else
2338 this.selection.selectRight();
2339 }
2340
2341 var range = this.getSelectionRange();
2342 if (this.getBehavioursEnabled()) {
2343 var session = this.session;
2344 var state = session.getState(range.start.row);
2345 var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
2346 if (new_range)
2347 range = new_range;
2348 }
2349
2350 this.session.remove(range);
2351 this.clearSelection();
2352 };
2353 this.removeWordRight = function() {
2354 if (this.selection.isEmpty())
2355 this.selection.selectWordRight();
2356
2357 this.session.remove(this.getSelectionRange());
2358 this.clearSelection();
2359 };
2360 this.removeWordLeft = function() {
2361 if (this.selection.isEmpty())
2362 this.selection.selectWordLeft();
2363
2364 this.session.remove(this.getSelectionRange());
2365 this.clearSelection();
2366 };
2367 this.removeToLineStart = function() {
2368 if (this.selection.isEmpty())
2369 this.selection.selectLineStart();
2370
2371 this.session.remove(this.getSelectionRange());
2372 this.clearSelection();
2373 };
2374 this.removeToLineEnd = function() {
2375 if (this.selection.isEmpty())
2376 this.selection.selectLineEnd();
2377
2378 var range = this.getSelectionRange();
2379 if (range.start.column == range.end.column && range.start.row == range.end.row) {
2380 range.end.column = 0;
2381 range.end.row++;
2382 }
2383
2384 this.session.remove(range);
2385 this.clearSelection();
2386 };
2387 this.splitLine = function() {
2388 if (!this.selection.isEmpty()) {
2389 this.session.remove(this.getSelectionRange());
2390 this.clearSelection();
2391 }
2392
2393 var cursor = this.getCursorPosition();
2394 this.insert("\n");
2395 this.moveCursorToPosition(cursor);
2396 };
2397 this.transposeLetters = function() {
2398 if (!this.selection.isEmpty()) {
2399 return;
2400 }
2401
2402 var cursor = this.getCursorPosition();
2403 var column = cursor.column;
2404 if (column === 0)
2405 return;
2406
2407 var line = this.session.getLine(cursor.row);
2408 var swap, range;
2409 if (column < line.length) {
2410 swap = line.charAt(column) + line.charAt(column-1);
2411 range = new Range(cursor.row, column-1, cursor.row, column+1);
2412 }
2413 else {
2414 swap = line.charAt(column-1) + line.charAt(column-2);
2415 range = new Range(cursor.row, column-2, cursor.row, column);
2416 }
2417 this.session.replace(range, swap);
2418 };
2419 this.toLowerCase = function() {
2420 var originalRange = this.getSelectionRange();
2421 if (this.selection.isEmpty()) {
2422 this.selection.selectWord();
2423 }
2424
2425 var range = this.getSelectionRange();
2426 var text = this.session.getTextRange(range);
2427 this.session.replace(range, text.toLowerCase());
2428 this.selection.setSelectionRange(originalRange);
2429 };
2430 this.toUpperCase = function() {
2431 var originalRange = this.getSelectionRange();
2432 if (this.selection.isEmpty()) {
2433 this.selection.selectWord();
2434 }
2435
2436 var range = this.getSelectionRange();
2437 var text = this.session.getTextRange(range);
2438 this.session.replace(range, text.toUpperCase());
2439 this.selection.setSelectionRange(originalRange);
2440 };
2441 this.indent = function() {
2442 var session = this.session;
2443 var range = this.getSelectionRange();
2444
2445 if (range.start.row < range.end.row || range.start.column < range.end.column) {
2446 var rows = this.$getSelectedRows();
2447 session.indentRows(rows.first, rows.last, "\t");
2448 } else {
2449 var indentString;
2450
2451 if (this.session.getUseSoftTabs()) {
2452 var size = session.getTabSize(),
2453 position = this.getCursorPosition(),
2454 column = session.documentToScreenColumn(position.row, position.column),
2455 count = (size - column % size);
2456
2457 indentString = lang.stringRepeat(" ", count);
2458 } else
2459 indentString = "\t";
2460 return this.insert(indentString);
2461 }
2462 };
2463 this.blockIndent = function() {
2464 var rows = this.$getSelectedRows();
2465 this.session.indentRows(rows.first, rows.last, "\t");
2466 };
2467 this.blockOutdent = function() {
2468 var selection = this.session.getSelection();
2469 this.session.outdentRows(selection.getRange());
2470 };
2471 this.sortLines = function() {
2472 var rows = this.$getSelectedRows();
2473 var session = this.session;
2474
2475 var lines = [];
2476 for (i = rows.first; i <= rows.last; i++)
2477 lines.push(session.getLine(i));
2478
2479 lines.sort(function(a, b) {
2480 if (a.toLowerCase() < b.toLowerCase()) return -1;
2481 if (a.toLowerCase() > b.toLowerCase()) return 1;
2482 return 0;
2483 });
2484
2485 var deleteRange = new Range(0, 0, 0, 0);
2486 for (var i = rows.first; i <= rows.last; i++) {
2487 var line = session.getLine(i);
2488 deleteRange.start.row = i;
2489 deleteRange.end.row = i;
2490 deleteRange.end.column = line.length;
2491 session.replace(deleteRange, lines[i-rows.first]);
2492 }
2493 };
2494 this.toggleCommentLines = function() {
2495 var state = this.session.getState(this.getCursorPosition().row);
2496 var rows = this.$getSelectedRows();
2497 this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
2498 };
2499
2500 this.toggleBlockComment = function() {
2501 var cursor = this.getCursorPosition();
2502 var state = this.session.getState(cursor.row);
2503 var range = this.getSelectionRange();
2504 this.session.getMode().toggleBlockComment(state, this.session, range, cursor);
2505 };
2506 this.getNumberAt = function( row, column ) {
2507 var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g
2508 _numberRx.lastIndex = 0
2509
2510 var s = this.session.getLine(row)
2511 while (_numberRx.lastIndex < column) {
2512 var m = _numberRx.exec(s)
2513 if(m.index <= column && m.index+m[0].length >= column){
2514 var number = {
2515 value: m[0],
2516 start: m.index,
2517 end: m.index+m[0].length
2518 }
2519 return number;
2520 }
2521 }
2522 return null;
2523 };
2524 this.modifyNumber = function(amount) {
2525 var row = this.selection.getCursor().row;
2526 var column = this.selection.getCursor().column;
2527 var charRange = new Range(row, column-1, row, column);
2528
2529 var c = this.session.getTextRange(charRange);
2530 if (!isNaN(parseFloat(c)) && isFinite(c)) {
2531 var nr = this.getNumberAt(row, column);
2532 if (nr) {
2533 var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end;
2534 var decimals = nr.start + nr.value.length - fp;
2535
2536 var t = parseFloat(nr.value);
2537 t *= Math.pow(10, decimals);
2538
2539
2540 if(fp !== nr.end && column < fp){
2541 amount *= Math.pow(10, nr.end - column - 1);
2542 } else {
2543 amount *= Math.pow(10, nr.end - column);
2544 }
2545
2546 t += amount;
2547 t /= Math.pow(10, decimals);
2548 var nnr = t.toFixed(decimals);
2549 var replaceRange = new Range(row, nr.start, row, nr.end);
2550 this.session.replace(replaceRange, nnr);
2551 this.moveCursorTo(row, Math.max(nr.start +1, column + nnr.length - nr.value.length));
2552
2553 }
2554 }
2555 };
2556 this.removeLines = function() {
2557 var rows = this.$getSelectedRows();
2558 var range;
2559 if (rows.first === 0 || rows.last+1 < this.session.getLength())
2560 range = new Range(rows.first, 0, rows.last+1, 0);
2561 else
2562 range = new Range(
2563 rows.first-1, this.session.getLine(rows.first-1).length,
2564 rows.last, this.session.getLine(rows.last).length
2565 );
2566 this.session.remove(range);
2567 this.clearSelection();
2568 };
2569
2570 this.duplicateSelection = function() {
2571 var sel = this.selection;
2572 var doc = this.session;
2573 var range = sel.getRange();
2574 var reverse = sel.isBackwards();
2575 if (range.isEmpty()) {
2576 var row = range.start.row;
2577 doc.duplicateLines(row, row);
2578 } else {
2579 var point = reverse ? range.start : range.end;
2580 var endPoint = doc.insert(point, doc.getTextRange(range), false);
2581 range.start = point;
2582 range.end = endPoint;
2583
2584 sel.setSelectionRange(range, reverse)
2585 }
2586 };
2587 this.moveLinesDown = function() {
2588 this.$moveLines(function(firstRow, lastRow) {
2589 return this.session.moveLinesDown(firstRow, lastRow);
2590 });
2591 };
2592 this.moveLinesUp = function() {
2593 this.$moveLines(function(firstRow, lastRow) {
2594 return this.session.moveLinesUp(firstRow, lastRow);
2595 });
2596 };
2597 this.moveText = function(range, toPosition) {
2598 return this.session.moveText(range, toPosition);
2599 };
2600 this.copyLinesUp = function() {
2601 this.$moveLines(function(firstRow, lastRow) {
2602 this.session.duplicateLines(firstRow, lastRow);
2603 return 0;
2604 });
2605 };
2606 this.copyLinesDown = function() {
2607 this.$moveLines(function(firstRow, lastRow) {
2608 return this.session.duplicateLines(firstRow, lastRow);
2609 });
2610 };
2611 this.$moveLines = function(mover) {
2612 var selection = this.selection;
2613 if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
2614 var range = selection.toOrientedRange();
2615 var rows = this.$getSelectedRows(range);
2616 var linesMoved = mover.call(this, rows.first, rows.last);
2617 range.moveBy(linesMoved, 0);
2618 selection.fromOrientedRange(range);
2619 } else {
2620 var ranges = selection.rangeList.ranges;
2621 selection.rangeList.detach(this.session);
2622
2623 for (var i = ranges.length; i--; ) {
2624 var rangeIndex = i;
2625 var rows = ranges[i].collapseRows();
2626 var last = rows.end.row;
2627 var first = rows.start.row;
2628 while (i--) {
2629 var rows = ranges[i].collapseRows();
2630 if (first - rows.end.row <= 1)
2631 first = rows.end.row;
2632 else
2633 break;
2634 }
2635 i++;
2636
2637 var linesMoved = mover.call(this, first, last);
2638 while (rangeIndex >= i) {
2639 ranges[rangeIndex].moveBy(linesMoved, 0);
2640 rangeIndex--;
2641 }
2642 }
2643 selection.fromOrientedRange(selection.ranges[0]);
2644 selection.rangeList.attach(this.session);
2645 }
2646 };
2647 this.$getSelectedRows = function() {
2648 var range = this.getSelectionRange().collapseRows();
2649
2650 return {
2651 first: range.start.row,
2652 last: range.end.row
2653 };
2654 };
2655
2656 this.onCompositionStart = function(text) {
2657 this.renderer.showComposition(this.getCursorPosition());
2658 };
2659
2660 this.onCompositionUpdate = function(text) {
2661 this.renderer.setCompositionText(text);
2662 };
2663
2664 this.onCompositionEnd = function() {
2665 this.renderer.hideComposition();
2666 };
2667 this.getFirstVisibleRow = function() {
2668 return this.renderer.getFirstVisibleRow();
2669 };
2670 this.getLastVisibleRow = function() {
2671 return this.renderer.getLastVisibleRow();
2672 };
2673 this.isRowVisible = function(row) {
2674 return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
2675 };
2676 this.isRowFullyVisible = function(row) {
2677 return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
2678 };
2679 this.$getVisibleRowCount = function() {
2680 return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
2681 };
2682
2683 this.$moveByPage = function(dir, select) {
2684 var renderer = this.renderer;
2685 var config = this.renderer.layerConfig;
2686 var rows = dir * Math.floor(config.height / config.lineHeight);
2687
2688 this.$blockScrolling++;
2689 if (select == true) {
2690 this.selection.$moveSelection(function(){
2691 this.moveCursorBy(rows, 0);
2692 });
2693 } else if (select == false) {
2694 this.selection.moveCursorBy(rows, 0);
2695 this.selection.clearSelection();
2696 }
2697 this.$blockScrolling--;
2698
2699 var scrollTop = renderer.scrollTop;
2700
2701 renderer.scrollBy(0, rows * config.lineHeight);
2702 if (select != null)
2703 renderer.scrollCursorIntoView(null, 0.5);
2704
2705 renderer.animateScrolling(scrollTop);
2706 };
2707 this.selectPageDown = function() {
2708 this.$moveByPage(1, true);
2709 };
2710 this.selectPageUp = function() {
2711 this.$moveByPage(-1, true);
2712 };
2713 this.gotoPageDown = function() {
2714 this.$moveByPage(1, false);
2715 };
2716 this.gotoPageUp = function() {
2717 this.$moveByPage(-1, false);
2718 };
2719 this.scrollPageDown = function() {
2720 this.$moveByPage(1);
2721 };
2722 this.scrollPageUp = function() {
2723 this.$moveByPage(-1);
2724 };
2725 this.scrollToRow = function(row) {
2726 this.renderer.scrollToRow(row);
2727 };
2728 this.scrollToLine = function(line, center, animate, callback) {
2729 this.renderer.scrollToLine(line, center, animate, callback);
2730 };
2731 this.centerSelection = function() {
2732 var range = this.getSelectionRange();
2733 var pos = {
2734 row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
2735 column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
2736 }
2737 this.renderer.alignCursor(pos, 0.5);
2738 };
2739 this.getCursorPosition = function() {
2740 return this.selection.getCursor();
2741 };
2742 this.getCursorPositionScreen = function() {
2743 return this.session.documentToScreenPosition(this.getCursorPosition());
2744 };
2745 this.getSelectionRange = function() {
2746 return this.selection.getRange();
2747 };
2748 this.selectAll = function() {
2749 this.$blockScrolling += 1;
2750 this.selection.selectAll();
2751 this.$blockScrolling -= 1;
2752 };
2753 this.clearSelection = function() {
2754 this.selection.clearSelection();
2755 };
2756 this.moveCursorTo = function(row, column) {
2757 this.selection.moveCursorTo(row, column);
2758 };
2759 this.moveCursorToPosition = function(pos) {
2760 this.selection.moveCursorToPosition(pos);
2761 };
2762 this.jumpToMatching = function(select) {
2763 var cursor = this.getCursorPosition();
2764
2765 var range = this.session.getBracketRange(cursor);
2766 if (!range) {
2767 range = this.find({
2768 needle: /[{}()\[\]]/g,
2769 preventScroll:true,
2770 start: {row: cursor.row, column: cursor.column - 1}
2771 });
2772 if (!range)
2773 return;
2774 var pos = range.start;
2775 if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
2776 range = this.session.getBracketRange(pos);
2777 }
2778
2779 pos = range && range.cursor || pos;
2780 if (pos) {
2781 if (select) {
2782 if (range && range.isEqual(this.getSelectionRange()))
2783 this.clearSelection();
2784 else
2785 this.selection.selectTo(pos.row, pos.column);
2786 } else {
2787 this.clearSelection();
2788 this.moveCursorTo(pos.row, pos.column);
2789 }
2790 }
2791 };
2792 this.gotoLine = function(lineNumber, column, animate) {
2793 this.selection.clearSelection();
2794 this.session.unfold({row: lineNumber - 1, column: column || 0});
2795
2796 this.$blockScrolling += 1;
2797 this.exitMultiSelectMode && this.exitMultiSelectMode();
2798 this.moveCursorTo(lineNumber - 1, column || 0);
2799 this.$blockScrolling -= 1;
2800
2801 if (!this.isRowFullyVisible(lineNumber - 1))
2802 this.scrollToLine(lineNumber - 1, true, animate);
2803 };
2804 this.navigateTo = function(row, column) {
2805 this.clearSelection();
2806 this.moveCursorTo(row, column);
2807 };
2808 this.navigateUp = function(times) {
2809 if (this.selection.isMultiLine() && !this.selection.isBackwards()) {
2810 var selectionStart = this.selection.anchor.getPosition();
2811 return this.moveCursorToPosition(selectionStart);
2812 }
2813 this.selection.clearSelection();
2814 times = times || 1;
2815 this.selection.moveCursorBy(-times, 0);
2816 };
2817 this.navigateDown = function(times) {
2818 if (this.selection.isMultiLine() && this.selection.isBackwards()) {
2819 var selectionEnd = this.selection.anchor.getPosition();
2820 return this.moveCursorToPosition(selectionEnd);
2821 }
2822 this.selection.clearSelection();
2823 times = times || 1;
2824 this.selection.moveCursorBy(times, 0);
2825 };
2826 this.navigateLeft = function(times) {
2827 if (!this.selection.isEmpty()) {
2828 var selectionStart = this.getSelectionRange().start;
2829 this.moveCursorToPosition(selectionStart);
2830 }
2831 else {
2832 times = times || 1;
2833 while (times--) {
2834 this.selection.moveCursorLeft();
2835 }
2836 }
2837 this.clearSelection();
2838 };
2839 this.navigateRight = function(times) {
2840 if (!this.selection.isEmpty()) {
2841 var selectionEnd = this.getSelectionRange().end;
2842 this.moveCursorToPosition(selectionEnd);
2843 }
2844 else {
2845 times = times || 1;
2846 while (times--) {
2847 this.selection.moveCursorRight();
2848 }
2849 }
2850 this.clearSelection();
2851 };
2852 this.navigateLineStart = function() {
2853 this.selection.moveCursorLineStart();
2854 this.clearSelection();
2855 };
2856 this.navigateLineEnd = function() {
2857 this.selection.moveCursorLineEnd();
2858 this.clearSelection();
2859 };
2860 this.navigateFileEnd = function() {
2861 var scrollTop = this.renderer.scrollTop;
2862 this.selection.moveCursorFileEnd();
2863 this.clearSelection();
2864 this.renderer.animateScrolling(scrollTop);
2865 };
2866 this.navigateFileStart = function() {
2867 var scrollTop = this.renderer.scrollTop;
2868 this.selection.moveCursorFileStart();
2869 this.clearSelection();
2870 this.renderer.animateScrolling(scrollTop);
2871 };
2872 this.navigateWordRight = function() {
2873 this.selection.moveCursorWordRight();
2874 this.clearSelection();
2875 };
2876 this.navigateWordLeft = function() {
2877 this.selection.moveCursorWordLeft();
2878 this.clearSelection();
2879 };
2880 this.replace = function(replacement, options) {
2881 if (options)
2882 this.$search.set(options);
2883
2884 var range = this.$search.find(this.session);
2885 var replaced = 0;
2886 if (!range)
2887 return replaced;
2888
2889 if (this.$tryReplace(range, replacement)) {
2890 replaced = 1;
2891 }
2892 if (range !== null) {
2893 this.selection.setSelectionRange(range);
2894 this.renderer.scrollSelectionIntoView(range.start, range.end);
2895 }
2896
2897 return replaced;
2898 };
2899 this.replaceAll = function(replacement, options) {
2900 if (options) {
2901 this.$search.set(options);
2902 }
2903
2904 var ranges = this.$search.findAll(this.session);
2905 var replaced = 0;
2906 if (!ranges.length)
2907 return replaced;
2908
2909 this.$blockScrolling += 1;
2910
2911 var selection = this.getSelectionRange();
2912 this.clearSelection();
2913 this.selection.moveCursorTo(0, 0);
2914
2915 for (var i = ranges.length - 1; i >= 0; --i) {
2916 if(this.$tryReplace(ranges[i], replacement)) {
2917 replaced++;
2918 }
2919 }
2920
2921 this.selection.setSelectionRange(selection);
2922 this.$blockScrolling -= 1;
2923
2924 return replaced;
2925 };
2926
2927 this.$tryReplace = function(range, replacement) {
2928 var input = this.session.getTextRange(range);
2929 replacement = this.$search.replace(input, replacement);
2930 if (replacement !== null) {
2931 range.end = this.session.replace(range, replacement);
2932 return range;
2933 } else {
2934 return null;
2935 }
2936 };
2937 this.getLastSearchOptions = function() {
2938 return this.$search.getOptions();
2939 };
2940 this.find = function(needle, options, animate) {
2941 if (!options)
2942 options = {};
2943
2944 if (typeof needle == "string" || needle instanceof RegExp)
2945 options.needle = needle;
2946 else if (typeof needle == "object")
2947 oop.mixin(options, needle);
2948
2949 var range = this.selection.getRange();
2950 if (options.needle == null) {
2951 needle = this.session.getTextRange(range)
2952 || this.$search.$options.needle;
2953 if (!needle) {
2954 range = this.session.getWordRange(range.start.row, range.start.column);
2955 needle = this.session.getTextRange(range);
2956 }
2957 this.$search.set({needle: needle});
2958 }
2959
2960 this.$search.set(options);
2961 if (!options.start)
2962 this.$search.set({start: range});
2963
2964 var newRange = this.$search.find(this.session);
2965 if (options.preventScroll)
2966 return newRange;
2967 if (newRange) {
2968 this.revealRange(newRange, animate);
2969 return newRange;
2970 }
2971 if (options.backwards)
2972 range.start = range.end;
2973 else
2974 range.end = range.start;
2975 this.selection.setRange(range);
2976 };
2977 this.findNext = function(options, animate) {
2978 this.find({skipCurrent: true, backwards: false}, options, animate);
2979 };
2980 this.findPrevious = function(options, animate) {
2981 this.find(options, {skipCurrent: true, backwards: true}, animate);
2982 };
2983
2984 this.revealRange = function(range, animate) {
2985 this.$blockScrolling += 1;
2986 this.session.unfold(range);
2987 this.selection.setSelectionRange(range);
2988 this.$blockScrolling -= 1;
2989
2990 var scrollTop = this.renderer.scrollTop;
2991 this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);
2992 if (animate != false)
2993 this.renderer.animateScrolling(scrollTop);
2994 };
2995 this.undo = function() {
2996 this.$blockScrolling++;
2997 this.session.getUndoManager().undo();
2998 this.$blockScrolling--;
2999 this.renderer.scrollCursorIntoView(null, 0.5);
3000 };
3001 this.redo = function() {
3002 this.$blockScrolling++;
3003 this.session.getUndoManager().redo();
3004 this.$blockScrolling--;
3005 this.renderer.scrollCursorIntoView(null, 0.5);
3006 };
3007 this.destroy = function() {
3008 this.renderer.destroy();
3009 this._emit("destroy", this);
3010 };
3011 this.setAutoScrollEditorIntoView = function(enable) {
3012 if (enable === false)
3013 return;
3014 var rect;
3015 var self = this;
3016 var shouldScroll = false;
3017 if (!this.$scrollAnchor)
3018 this.$scrollAnchor = document.createElement("div");
3019 var scrollAnchor = this.$scrollAnchor;
3020 scrollAnchor.style.cssText = "position:absolute";
3021 this.container.insertBefore(scrollAnchor, this.container.firstChild);
3022 var onChangeSelection = this.on("changeSelection", function() {
3023 shouldScroll = true;
3024 });
3025 var onBeforeRender = this.renderer.on("beforeRender", function() {
3026 if (shouldScroll)
3027 rect = self.renderer.container.getBoundingClientRect();
3028 });
3029 var onAfterRender = this.renderer.on("afterRender", function() {
3030 if (shouldScroll && rect && self.isFocused()) {
3031 var renderer = self.renderer;
3032 var pos = renderer.$cursorLayer.$pixelPos;
3033 var config = renderer.layerConfig;
3034 var top = pos.top - config.offset;
3035 if (pos.top >= 0 && top + rect.top < 0) {
3036 shouldScroll = true;
3037 } else if (pos.top < config.height &&
3038 pos.top + rect.top + config.lineHeight > window.innerHeight) {
3039 shouldScroll = false;
3040 } else {
3041 shouldScroll = null;
3042 }
3043 if (shouldScroll != null) {
3044 scrollAnchor.style.top = top + "px";
3045 scrollAnchor.style.left = pos.left + "px";
3046 scrollAnchor.style.height = config.lineHeight + "px";
3047 scrollAnchor.scrollIntoView(shouldScroll);
3048 }
3049 shouldScroll = rect = null;
3050 }
3051 });
3052 this.setAutoScrollEditorIntoView = function(enable) {
3053 if (enable === true)
3054 return;
3055 delete this.setAutoScrollEditorIntoView;
3056 this.removeEventListener("changeSelection", onChangeSelection);
3057 this.renderer.removeEventListener("afterRender", onAfterRender);
3058 this.renderer.removeEventListener("beforeRender", onBeforeRender);
3059 };
3060 };
3061
3062
3063 this.$resetCursorStyle = function() {
3064 var style = this.$cursorStyle || "ace";
3065 var cursorLayer = this.renderer.$cursorLayer;
3066 if (!cursorLayer)
3067 return;
3068 cursorLayer.setSmoothBlinking(style == "smooth");
3069 cursorLayer.isBlinking = !this.$readOnly && style != "wide";
3070 };
3071
3072 }).call(Editor.prototype);
3073
3074
3075
3076 config.defineOptions(Editor.prototype, "editor", {
3077 selectionStyle: {
3078 set: function(style) {
3079 this.onSelectionChange();
3080 this._emit("changeSelectionStyle", {data: style});
3081 },
3082 initialValue: "line"
3083 },
3084 highlightActiveLine: {
3085 set: function() {this.$updateHighlightActiveLine();},
3086 initialValue: true
3087 },
3088 highlightSelectedWord: {
3089 set: function(shouldHighlight) {this.$onSelectionChange();},
3090 initialValue: true
3091 },
3092 readOnly: {
3093 set: function(readOnly) { this.$resetCursorStyle(); },
3094 initialValue: false
3095 },
3096 cursorStyle: {
3097 set: function(val) { this.$resetCursorStyle(); },
3098 values: ["ace", "slim", "smooth", "wide"],
3099 initialValue: "ace"
3100 },
3101 behavioursEnabled: {initialValue: true},
3102 wrapBehavioursEnabled: {initialValue: true},
3103
3104 hScrollBarAlwaysVisible: "renderer",
3105 highlightGutterLine: "renderer",
3106 animatedScroll: "renderer",
3107 showInvisibles: "renderer",
3108 showPrintMargin: "renderer",
3109 printMarginColumn: "renderer",
3110 printMargin: "renderer",
3111 fadeFoldWidgets: "renderer",
3112 showFoldWidgets: "renderer",
3113 showGutter: "renderer",
3114 displayIndentGuides: "renderer",
3115 fontSize: "renderer",
3116 fontFamily: "renderer",
3117
3118 scrollSpeed: "$mouseHandler",
3119 dragDelay: "$mouseHandler",
3120 focusTimout: "$mouseHandler",
3121
3122 firstLineNumber: "session",
3123 overwrite: "session",
3124 newLineMode: "session",
3125 useWorker: "session",
3126 useSoftTabs: "session",
3127 tabSize: "session",
3128 wrap: "session",
3129 foldStyle: "session"
3130 });
3131
3132 exports.Editor = Editor;
3133 });
3134
3135 define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
3136
3137
3138 exports.stringReverse = function(string) {
3139 return string.split("").reverse().join("");
3140 };
3141
3142 exports.stringRepeat = function (string, count) {
3143 var result = '';
3144 while (count > 0) {
3145 if (count & 1)
3146 result += string;
3147
3148 if (count >>= 1)
3149 string += string;
3150 }
3151 return result;
3152 };
3153
3154 var trimBeginRegexp = /^\s\s*/;
3155 var trimEndRegexp = /\s\s*$/;
3156
3157 exports.stringTrimLeft = function (string) {
3158 return string.replace(trimBeginRegexp, '');
3159 };
3160
3161 exports.stringTrimRight = function (string) {
3162 return string.replace(trimEndRegexp, '');
3163 };
3164
3165 exports.copyObject = function(obj) {
3166 var copy = {};
3167 for (var key in obj) {
3168 copy[key] = obj[key];
3169 }
3170 return copy;
3171 };
3172
3173 exports.copyArray = function(array){
3174 var copy = [];
3175 for (var i=0, l=array.length; i<l; i++) {
3176 if (array[i] && typeof array[i] == "object")
3177 copy[i] = this.copyObject( array[i] );
3178 else
3179 copy[i] = array[i];
3180 }
3181 return copy;
3182 };
3183
3184 exports.deepCopy = function (obj) {
3185 if (typeof obj != "object") {
3186 return obj;
3187 }
3188
3189 var copy = obj.constructor();
3190 for (var key in obj) {
3191 if (typeof obj[key] == "object") {
3192 copy[key] = this.deepCopy(obj[key]);
3193 } else {
3194 copy[key] = obj[key];
3195 }
3196 }
3197 return copy;
3198 };
3199
3200 exports.arrayToMap = function(arr) {
3201 var map = {};
3202 for (var i=0; i<arr.length; i++) {
3203 map[arr[i]] = 1;
3204 }
3205 return map;
3206
3207 };
3208
3209 exports.createMap = function(props) {
3210 var map = Object.create(null);
3211 for (var i in props) {
3212 map[i] = props[i];
3213 }
3214 return map;
3215 };
3216 exports.arrayRemove = function(array, value) {
3217 for (var i = 0; i <= array.length; i++) {
3218 if (value === array[i]) {
3219 array.splice(i, 1);
3220 }
3221 }
3222 };
3223
3224 exports.escapeRegExp = function(str) {
3225 return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
3226 };
3227
3228 exports.escapeHTML = function(str) {
3229 return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
3230 };
3231
3232 exports.getMatchOffsets = function(string, regExp) {
3233 var matches = [];
3234
3235 string.replace(regExp, function(str) {
3236 matches.push({
3237 offset: arguments[arguments.length-2],
3238 length: str.length
3239 });
3240 });
3241
3242 return matches;
3243 };
3244 exports.deferredCall = function(fcn) {
3245
3246 var timer = null;
3247 var callback = function() {
3248 timer = null;
3249 fcn();
3250 };
3251
3252 var deferred = function(timeout) {
3253 deferred.cancel();
3254 timer = setTimeout(callback, timeout || 0);
3255 return deferred;
3256 };
3257
3258 deferred.schedule = deferred;
3259
3260 deferred.call = function() {
3261 this.cancel();
3262 fcn();
3263 return deferred;
3264 };
3265
3266 deferred.cancel = function() {
3267 clearTimeout(timer);
3268 timer = null;
3269 return deferred;
3270 };
3271
3272 return deferred;
3273 };
3274
3275
3276 exports.delayedCall = function(fcn, defaultTimeout) {
3277 var timer = null;
3278 var callback = function() {
3279 timer = null;
3280 fcn();
3281 };
3282
3283 var _self = function(timeout) {
3284 timer && clearTimeout(timer);
3285 timer = setTimeout(callback, timeout || defaultTimeout);
3286 };
3287
3288 _self.delay = _self;
3289 _self.schedule = function(timeout) {
3290 if (timer == null)
3291 timer = setTimeout(callback, timeout || 0);
3292 };
3293
3294 _self.call = function() {
3295 this.cancel();
3296 fcn();
3297 };
3298
3299 _self.cancel = function() {
3300 timer && clearTimeout(timer);
3301 timer = null;
3302 };
3303
3304 _self.isPending = function() {
3305 return timer;
3306 };
3307
3308 return _self;
3309 };
3310 });
3311
3312 define('ace/keyboard/textinput', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/useragent', 'ace/lib/dom', 'ace/lib/lang'], function(require, exports, module) {
3313
3314
3315 var event = require("../lib/event");
3316 var useragent = require("../lib/useragent");
3317 var dom = require("../lib/dom");
3318 var lang = require("../lib/lang");
3319 var BROKEN_SETDATA = useragent.isChrome < 18;
3320
3321 var TextInput = function(parentNode, host) {
3322 var text = dom.createElement("textarea");
3323 text.className = "ace_text-input";
3324 if (useragent.isTouchPad)
3325 text.setAttribute("x-palm-disable-auto-cap", true);
3326
3327 text.wrap = "off";
3328 text.autocorrect = "off";
3329 text.autocapitalize = "off";
3330 text.spellcheck = false;
3331
3332 text.style.bottom = "2000em";
3333 parentNode.insertBefore(text, parentNode.firstChild);
3334
3335 var PLACEHOLDER = "\x01\x01";
3336
3337 var cut = false;
3338 var copied = false;
3339 var pasted = false;
3340 var inComposition = false;
3341 var tempStyle = '';
3342 var isSelectionEmpty = true;
3343 try { var isFocused = document.activeElement === text; } catch(e) {}
3344
3345 event.addListener(text, "blur", function() {
3346 host.onBlur();
3347 isFocused = false;
3348 });
3349 event.addListener(text, "focus", function() {
3350 isFocused = true;
3351 host.onFocus();
3352 resetSelection();
3353 });
3354 this.focus = function() { text.focus(); };
3355 this.blur = function() { text.blur(); };
3356 this.isFocused = function() {
3357 return isFocused;
3358 };
3359 var syncSelection = lang.delayedCall(function() {
3360 isFocused && resetSelection(isSelectionEmpty);
3361 });
3362 var syncValue = lang.delayedCall(function() {
3363 if (!inComposition) {
3364 text.value = PLACEHOLDER;
3365 isFocused && resetSelection();
3366 }
3367 });
3368
3369 function resetSelection(isEmpty) {
3370 if (inComposition)
3371 return;
3372 if (inputHandler) {
3373 selectionStart = 0;
3374 selectionEnd = isEmpty ? 0 : text.value.length - 1;
3375 } else {
3376 var selectionStart = isEmpty ? 2 : 1;
3377 var selectionEnd = 2;
3378 }
3379 try {
3380 text.setSelectionRange(selectionStart, selectionEnd);
3381 } catch(e){}
3382 }
3383
3384 function resetValue() {
3385 if (inComposition)
3386 return;
3387 text.value = PLACEHOLDER;
3388 if (useragent.isWebKit)
3389 syncValue.schedule();
3390 }
3391
3392 useragent.isWebKit || host.addEventListener('changeSelection', function() {
3393 if (host.selection.isEmpty() != isSelectionEmpty) {
3394 isSelectionEmpty = !isSelectionEmpty;
3395 syncSelection.schedule();
3396 }
3397 });
3398
3399 resetValue();
3400 if (isFocused)
3401 host.onFocus();
3402
3403
3404 var isAllSelected = function(text) {
3405 return text.selectionStart === 0 && text.selectionEnd === text.value.length;
3406 };
3407 if (!text.setSelectionRange && text.createTextRange) {
3408 text.setSelectionRange = function(selectionStart, selectionEnd) {
3409 var range = this.createTextRange();
3410 range.collapse(true);
3411 range.moveStart('character', selectionStart);
3412 range.moveEnd('character', selectionEnd);
3413 range.select();
3414 };
3415 isAllSelected = function(text) {
3416 try {
3417 var range = text.ownerDocument.selection.createRange();
3418 }catch(e) {}
3419 if (!range || range.parentElement() != text) return false;
3420 return range.text == text.value;
3421 }
3422 }
3423 if (useragent.isOldIE) {
3424 var inPropertyChange = false;
3425 var onPropertyChange = function(e){
3426 if (inPropertyChange)
3427 return;
3428 var data = text.value;
3429 if (inComposition || !data || data == PLACEHOLDER)
3430 return;
3431 if (e && data == PLACEHOLDER[0])
3432 return syncProperty.schedule();
3433
3434 sendText(data);
3435 inPropertyChange = true;
3436 resetValue();
3437 inPropertyChange = false;
3438 };
3439 var syncProperty = lang.delayedCall(onPropertyChange);
3440 event.addListener(text, "propertychange", onPropertyChange);
3441
3442 var keytable = { 13:1, 27:1 };
3443 event.addListener(text, "keyup", function (e) {
3444 if (inComposition && (!text.value || keytable[e.keyCode]))
3445 setTimeout(onCompositionEnd, 0);
3446 if ((text.value.charCodeAt(0)||0) < 129) {
3447 return;
3448 }
3449 inComposition ? onCompositionUpdate() : onCompositionStart();
3450 });
3451 }
3452
3453 var onSelect = function(e) {
3454 if (cut) {
3455 cut = false;
3456 } else if (copied) {
3457 copied = false;
3458 } else if (isAllSelected(text)) {
3459 host.selectAll();
3460 resetSelection();
3461 } else if (inputHandler) {
3462 resetSelection(host.selection.isEmpty());
3463 }
3464 };
3465
3466 var inputHandler = null;
3467 this.setInputHandler = function(cb) {inputHandler = cb};
3468 this.getInputHandler = function() {return inputHandler};
3469 var afterContextMenu = false;
3470
3471 var sendText = function(data) {
3472 if (inputHandler) {
3473 data = inputHandler(data);
3474 inputHandler = null;
3475 }
3476 if (pasted) {
3477 resetSelection();
3478 if (data)
3479 host.onPaste(data);
3480 pasted = false;
3481 } else if (data == PLACEHOLDER[0]) {
3482 if (afterContextMenu)
3483 host.execCommand("del", {source: "ace"});
3484 } else {
3485 if (data.substring(0, 2) == PLACEHOLDER)
3486 data = data.substr(2);
3487 else if (data[0] == PLACEHOLDER[0])
3488 data = data.substr(1);
3489 else if (data[data.length - 1] == PLACEHOLDER[0])
3490 data = data.slice(0, -1);
3491 if (data[data.length - 1] == PLACEHOLDER[0])
3492 data = data.slice(0, -1);
3493
3494 if (data)
3495 host.onTextInput(data);
3496 }
3497 if (afterContextMenu)
3498 afterContextMenu = false;
3499 };
3500 var onInput = function(e) {
3501 if (inComposition)
3502 return;
3503 var data = text.value;
3504 sendText(data);
3505 resetValue();
3506 };
3507
3508 var onCut = function(e) {
3509 var data = host.getCopyText();
3510 if (!data) {
3511 event.preventDefault(e);
3512 return;
3513 }
3514
3515 var clipboardData = e.clipboardData || window.clipboardData;
3516
3517 if (clipboardData && !BROKEN_SETDATA) {
3518 var supported = clipboardData.setData("Text", data);
3519 if (supported) {
3520 host.onCut();
3521 event.preventDefault(e);
3522 }
3523 }
3524
3525 if (!supported) {
3526 cut = true;
3527 text.value = data;
3528 text.select();
3529 setTimeout(function(){
3530 cut = false;
3531 resetValue();
3532 resetSelection();
3533 host.onCut();
3534 });
3535 }
3536 };
3537
3538 var onCopy = function(e) {
3539 var data = host.getCopyText();
3540 if (!data) {
3541 event.preventDefault(e);
3542 return;
3543 }
3544
3545 var clipboardData = e.clipboardData || window.clipboardData;
3546 if (clipboardData && !BROKEN_SETDATA) {
3547 var supported = clipboardData.setData("Text", data);
3548 if (supported) {
3549 host.onCopy();
3550 event.preventDefault(e);
3551 }
3552 }
3553 if (!supported) {
3554 copied = true;
3555 text.value = data;
3556 text.select();
3557 setTimeout(function(){
3558 copied = false;
3559 resetValue();
3560 resetSelection();
3561 host.onCopy();
3562 });
3563 }
3564 };
3565
3566 var onPaste = function(e) {
3567 var clipboardData = e.clipboardData || window.clipboardData;
3568
3569 if (clipboardData) {
3570 var data = clipboardData.getData("Text");
3571 if (data)
3572 host.onPaste(data);
3573 if (useragent.isIE)
3574 setTimeout(resetSelection);
3575 event.preventDefault(e);
3576 }
3577 else {
3578 text.value = "";
3579 pasted = true;
3580 }
3581 };
3582
3583 event.addCommandKeyListener(text, host.onCommandKey.bind(host));
3584
3585 event.addListener(text, "select", onSelect);
3586
3587 event.addListener(text, "input", onInput);
3588
3589 event.addListener(text, "cut", onCut);
3590 event.addListener(text, "copy", onCopy);
3591 event.addListener(text, "paste", onPaste);
3592 if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)){
3593 event.addListener(parentNode, "keydown", function(e) {
3594 if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
3595 return;
3596
3597 switch (e.keyCode) {
3598 case 67:
3599 onCopy(e);
3600 break;
3601 case 86:
3602 onPaste(e);
3603 break;
3604 case 88:
3605 onCut(e);
3606 break;
3607 }
3608 });
3609 }
3610 var onCompositionStart = function(e) {
3611 if (inComposition) return;
3612 inComposition = {};
3613 host.onCompositionStart();
3614 setTimeout(onCompositionUpdate, 0);
3615 host.on("mousedown", onCompositionEnd);
3616 if (!host.selection.isEmpty()) {
3617 host.insert("");
3618 host.session.markUndoGroup();
3619 host.selection.clearSelection();
3620 }
3621 host.session.markUndoGroup();
3622 };
3623
3624 var onCompositionUpdate = function() {
3625 if (!inComposition) return;
3626 host.onCompositionUpdate(text.value);
3627 if (inComposition.lastValue)
3628 host.undo();
3629 inComposition.lastValue = text.value.replace(/\x01/g, "")
3630 if (inComposition.lastValue) {
3631 var r = host.selection.getRange();
3632 host.insert(inComposition.lastValue);
3633 host.session.markUndoGroup();
3634 inComposition.range = host.selection.getRange();
3635 host.selection.setRange(r);
3636 host.selection.clearSelection();
3637 }
3638 };
3639
3640 var onCompositionEnd = function(e) {
3641 var c = inComposition;
3642 inComposition = false;
3643 var timer = setTimeout(function() {
3644 var str = text.value.replace(/\x01/g, "");
3645 if (inComposition)
3646 return
3647 else if (str == c.lastValue)
3648 resetValue();
3649 else if (!c.lastValue && str) {
3650 resetValue();
3651 sendText(str);
3652 }
3653 });
3654 inputHandler = function compositionInputHandler(str) {
3655 clearTimeout(timer);
3656 str = str.replace(/\x01/g, "");
3657 if (str == c.lastValue)
3658 return "";
3659 if (c.lastValue)
3660 host.undo();
3661 return str;
3662 }
3663 host.onCompositionEnd();
3664 host.removeListener("mousedown", onCompositionEnd);
3665 if (e.type == "compositionend" && c.range) {
3666 host.selection.setRange(c.range);
3667 }
3668 };
3669
3670
3671
3672 var syncComposition = lang.delayedCall(onCompositionUpdate, 50);
3673
3674 event.addListener(text, "compositionstart", onCompositionStart);
3675 event.addListener(text, useragent.isGecko ? "text" : "keyup", function(){syncComposition.schedule()});
3676 event.addListener(text, "compositionend", onCompositionEnd);
3677
3678 this.getElement = function() {
3679 return text;
3680 };
3681
3682 this.setReadOnly = function(readOnly) {
3683 text.readOnly = readOnly;
3684 };
3685
3686 this.onContextMenu = function(e) {
3687 afterContextMenu = true;
3688 if (!tempStyle)
3689 tempStyle = text.style.cssText;
3690
3691 text.style.cssText = "z-index:100000;" + (useragent.isIE ? "opacity:0.1;" : "");
3692
3693 resetSelection(host.selection.isEmpty());
3694 host._emit("nativecontextmenu", {target: host});
3695 var rect = host.container.getBoundingClientRect();
3696 var style = dom.computedStyle(host.container);
3697 var top = rect.top + (parseInt(style.borderTopWidth) || 0);
3698 var left = rect.left + (parseInt(rect.borderLeftWidth) || 0);
3699 var maxTop = rect.bottom - top - text.clientHeight;
3700 var move = function(e) {
3701 text.style.left = e.clientX - left - 2 + "px";
3702 text.style.top = Math.min(e.clientY - top - 2, maxTop) + "px";
3703 };
3704 move(e);
3705
3706 if (e.type != "mousedown")
3707 return;
3708
3709 if (host.renderer.$keepTextAreaAtCursor)
3710 host.renderer.$keepTextAreaAtCursor = null;
3711 if (useragent.isWin)
3712 event.capture(host.container, move, onContextMenuClose);
3713 };
3714
3715 this.onContextMenuClose = onContextMenuClose;
3716 function onContextMenuClose() {
3717 setTimeout(function () {
3718 if (tempStyle) {
3719 text.style.cssText = tempStyle;
3720 tempStyle = '';
3721 }
3722 if (host.renderer.$keepTextAreaAtCursor == null) {
3723 host.renderer.$keepTextAreaAtCursor = true;
3724 host.renderer.$moveTextAreaToCursor();
3725 }
3726 }, 0);
3727 }
3728 if (!useragent.isGecko) {
3729 event.addListener(text, "contextmenu", function(e) {
3730 host.textInput.onContextMenu(e);
3731 onContextMenuClose();
3732 });
3733 }
3734 };
3735
3736 exports.TextInput = TextInput;
3737 });
3738
3739 define('ace/mouse/mouse_handler', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/useragent', 'ace/mouse/default_handlers', 'ace/mouse/default_gutter_handler', 'ace/mouse/mouse_event', 'ace/mouse/dragdrop', 'ace/config'], function(require, exports, module) {
3740
3741
3742 var event = require("../lib/event");
3743 var useragent = require("../lib/useragent");
3744 var DefaultHandlers = require("./default_handlers").DefaultHandlers;
3745 var DefaultGutterHandler = require("./default_gutter_handler").GutterHandler;
3746 var MouseEvent = require("./mouse_event").MouseEvent;
3747 var DragdropHandler = require("./dragdrop").DragdropHandler;
3748 var config = require("../config");
3749
3750 var MouseHandler = function(editor) {
3751 this.editor = editor;
3752
3753 new DefaultHandlers(this);
3754 new DefaultGutterHandler(this);
3755 new DragdropHandler(this);
3756
3757 event.addListener(editor.container, "mousedown", function(e) {
3758 editor.focus();
3759 return event.preventDefault(e);
3760 });
3761
3762 var mouseTarget = editor.renderer.getMouseEventTarget();
3763 event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"));
3764 event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"));
3765 event.addMultiMouseDownListener(mouseTarget, [300, 300, 250], this, "onMouseEvent");
3766 event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"));
3767
3768 var gutterEl = editor.renderer.$gutter;
3769 event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"));
3770 event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"));
3771 event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"));
3772 event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"));
3773 };
3774
3775 (function() {
3776 this.onMouseEvent = function(name, e) {
3777 this.editor._emit(name, new MouseEvent(e, this.editor));
3778 };
3779
3780 this.onMouseMove = function(name, e) {
3781 var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove;
3782 if (!listeners || !listeners.length)
3783 return;
3784
3785 this.editor._emit(name, new MouseEvent(e, this.editor));
3786 };
3787
3788 this.onMouseWheel = function(name, e) {
3789 var mouseEvent = new MouseEvent(e, this.editor);
3790 mouseEvent.speed = this.$scrollSpeed * 2;
3791 mouseEvent.wheelX = e.wheelX;
3792 mouseEvent.wheelY = e.wheelY;
3793
3794 this.editor._emit(name, mouseEvent);
3795 };
3796
3797 this.setState = function(state) {
3798 this.state = state;
3799 };
3800
3801 this.captureMouse = function(ev, state) {
3802 if (state)
3803 this.setState(state);
3804
3805 this.x = ev.x;
3806 this.y = ev.y;
3807
3808 this.isMousePressed = true;
3809 var renderer = this.editor.renderer;
3810 if (renderer.$keepTextAreaAtCursor)
3811 renderer.$keepTextAreaAtCursor = null;
3812
3813 var self = this;
3814 var onMouseMove = function(e) {
3815 self.x = e.clientX;
3816 self.y = e.clientY;
3817 };
3818
3819 var onCaptureEnd = function(e) {
3820 clearInterval(timerId);
3821 onCaptureInterval();
3822 self[self.state + "End"] && self[self.state + "End"](e);
3823 self.$clickSelection = null;
3824 if (renderer.$keepTextAreaAtCursor == null) {
3825 renderer.$keepTextAreaAtCursor = true;
3826 renderer.$moveTextAreaToCursor();
3827 }
3828 self.isMousePressed = false;
3829 self.onMouseEvent("mouseup", e)
3830 };
3831
3832 var onCaptureInterval = function() {
3833 self[self.state] && self[self.state]();
3834 };
3835
3836 if (useragent.isOldIE && ev.domEvent.type == "dblclick") {
3837 return setTimeout(function() {onCaptureEnd(ev.domEvent);});
3838 }
3839
3840 event.capture(this.editor.container, onMouseMove, onCaptureEnd);
3841 var timerId = setInterval(onCaptureInterval, 20);
3842 };
3843 }).call(MouseHandler.prototype);
3844
3845 config.defineOptions(MouseHandler.prototype, "mouseHandler", {
3846 scrollSpeed: {initialValue: 2},
3847 dragDelay: {initialValue: 150},
3848 focusTimout: {initialValue: 0}
3849 });
3850
3851
3852 exports.MouseHandler = MouseHandler;
3853 });
3854
3855 define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/useragent'], function(require, exports, module) {
3856
3857
3858 var dom = require("../lib/dom");
3859 var useragent = require("../lib/useragent");
3860
3861 var DRAG_OFFSET = 0; // pixels
3862
3863 function DefaultHandlers(mouseHandler) {
3864 mouseHandler.$clickSelection = null;
3865
3866 var editor = mouseHandler.editor;
3867 editor.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler));
3868 editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(mouseHandler));
3869 editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(mouseHandler));
3870 editor.setDefaultHandler("quadclick", this.onQuadClick.bind(mouseHandler));
3871 editor.setDefaultHandler("mousewheel", this.onMouseWheel.bind(mouseHandler));
3872
3873 var exports = ["select", "startSelect", "drag", "dragEnd", "dragWait",
3874 "dragWaitEnd", "startDrag", "focusWait"];
3875
3876 exports.forEach(function(x) {
3877 mouseHandler[x] = this[x];
3878 }, this);
3879
3880 mouseHandler.selectByLines = this.extendSelectionBy.bind(mouseHandler, "getLineRange");
3881 mouseHandler.selectByWords = this.extendSelectionBy.bind(mouseHandler, "getWordRange");
3882 }
3883
3884 (function() {
3885
3886 this.onMouseDown = function(ev) {
3887 var inSelection = ev.inSelection();
3888 var pos = ev.getDocumentPosition();
3889 this.mousedownEvent = ev;
3890 var editor = this.editor;
3891
3892 var button = ev.getButton();
3893 if (button !== 0) {
3894 var selectionRange = editor.getSelectionRange();
3895 var selectionEmpty = selectionRange.isEmpty();
3896
3897 if (selectionEmpty) {
3898 editor.moveCursorToPosition(pos);
3899 editor.selection.clearSelection();
3900 }
3901 editor.textInput.onContextMenu(ev.domEvent);
3902 return; // stopping event here breaks contextmenu on ff mac
3903 }
3904 if (inSelection && !editor.isFocused()) {
3905 editor.focus();
3906 if (this.$focusTimout && !this.$clickSelection && !editor.inMultiSelectMode) {
3907 this.setState("focusWait");
3908 this.captureMouse(ev);
3909 return ev.preventDefault();
3910 }
3911 }
3912
3913 if (!inSelection || this.$clickSelection || ev.getShiftKey() || editor.inMultiSelectMode) {
3914 this.startSelect(pos);
3915 } else if (inSelection) {
3916 this.mousedownEvent.time = (new Date()).getTime();
3917 this.setState("dragWait");
3918 }
3919
3920 this.captureMouse(ev);
3921 return ev.preventDefault();
3922 };
3923
3924 this.startSelect = function(pos) {
3925 pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);
3926 if (this.mousedownEvent.getShiftKey()) {
3927 this.editor.selection.selectToPosition(pos);
3928 }
3929 else if (!this.$clickSelection) {
3930 this.editor.moveCursorToPosition(pos);
3931 this.editor.selection.clearSelection();
3932 }
3933 this.setState("select");
3934 };
3935
3936 this.select = function() {
3937 var anchor, editor = this.editor;
3938 var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
3939
3940 if (this.$clickSelection) {
3941 var cmp = this.$clickSelection.comparePoint(cursor);
3942
3943 if (cmp == -1) {
3944 anchor = this.$clickSelection.end;
3945 } else if (cmp == 1) {
3946 anchor = this.$clickSelection.start;
3947 } else {
3948 var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
3949 cursor = orientedRange.cursor;
3950 anchor = orientedRange.anchor;
3951 }
3952 editor.selection.setSelectionAnchor(anchor.row, anchor.column);
3953 }
3954 editor.selection.selectToPosition(cursor);
3955
3956 editor.renderer.scrollCursorIntoView();
3957 };
3958
3959 this.extendSelectionBy = function(unitName) {
3960 var anchor, editor = this.editor;
3961 var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
3962 var range = editor.selection[unitName](cursor.row, cursor.column);
3963
3964 if (this.$clickSelection) {
3965 var cmpStart = this.$clickSelection.comparePoint(range.start);
3966 var cmpEnd = this.$clickSelection.comparePoint(range.end);
3967
3968 if (cmpStart == -1 && cmpEnd <= 0) {
3969 anchor = this.$clickSelection.end;
3970 if (range.end.row != cursor.row || range.end.column != cursor.column)
3971 cursor = range.start;
3972 } else if (cmpEnd == 1 && cmpStart >= 0) {
3973 anchor = this.$clickSelection.start;
3974 if (range.start.row != cursor.row || range.start.column != cursor.column)
3975 cursor = range.end;
3976 } else if (cmpStart == -1 && cmpEnd == 1) {
3977 cursor = range.end;
3978 anchor = range.start;
3979 } else {
3980 var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
3981 cursor = orientedRange.cursor;
3982 anchor = orientedRange.anchor;
3983 }
3984 editor.selection.setSelectionAnchor(anchor.row, anchor.column);
3985 }
3986 editor.selection.selectToPosition(cursor);
3987
3988 editor.renderer.scrollCursorIntoView();
3989 };
3990
3991 this.startDrag = function() {
3992 var editor = this.editor;
3993 this.setState("drag");
3994 this.dragRange = editor.getSelectionRange();
3995 var style = editor.getSelectionStyle();
3996 this.dragSelectionMarker = editor.session.addMarker(this.dragRange, "ace_selection", style);
3997 editor.clearSelection();
3998 dom.addCssClass(editor.container, "ace_dragging");
3999 if (!this.$dragKeybinding) {
4000 this.$dragKeybinding = {
4001 handleKeyboard: function(data, hashId, keyString, keyCode) {
4002 if (keyString == "esc")
4003 return {command: this.command};
4004 },
4005 command: {
4006 exec: function(editor) {
4007 var self = editor.$mouseHandler;
4008 self.dragCursor = null;
4009 self.dragEnd();
4010 self.startSelect();
4011 }
4012 }
4013 }
4014 }
4015
4016 editor.keyBinding.addKeyboardHandler(this.$dragKeybinding);
4017 };
4018
4019 this.focusWait = function() {
4020 var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
4021 var time = (new Date()).getTime();
4022
4023 if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimout)
4024 this.startSelect(this.mousedownEvent.getDocumentPosition());
4025 };
4026
4027 this.dragWait = function(e) {
4028 var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
4029 var time = (new Date()).getTime();
4030 var editor = this.editor;
4031
4032 if (distance > DRAG_OFFSET) {
4033 this.startSelect(this.mousedownEvent.getDocumentPosition());
4034 } else if (time - this.mousedownEvent.time > editor.$mouseHandler.$dragDelay) {
4035 this.startDrag();
4036 }
4037 };
4038
4039 this.dragWaitEnd = function(e) {
4040 this.mousedownEvent.domEvent = e;
4041 this.startSelect();
4042 };
4043
4044 this.drag = function() {
4045 var editor = this.editor;
4046 this.dragCursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
4047 editor.moveCursorToPosition(this.dragCursor);
4048 editor.renderer.scrollCursorIntoView();
4049 };
4050
4051 this.dragEnd = function(e) {
4052 var editor = this.editor;
4053 var dragCursor = this.dragCursor;
4054 var dragRange = this.dragRange;
4055 dom.removeCssClass(editor.container, "ace_dragging");
4056 editor.session.removeMarker(this.dragSelectionMarker);
4057 editor.keyBinding.removeKeyboardHandler(this.$dragKeybinding);
4058
4059 if (!dragCursor)
4060 return;
4061
4062 editor.clearSelection();
4063 if (e && (e.ctrlKey || e.altKey)) {
4064 var session = editor.session;
4065 var newRange = dragRange;
4066 newRange.end = session.insert(dragCursor, session.getTextRange(dragRange));
4067 newRange.start = dragCursor;
4068 } else if (dragRange.contains(dragCursor.row, dragCursor.column)) {
4069 return;
4070 } else {
4071 var newRange = editor.moveText(dragRange, dragCursor);
4072 }
4073
4074 if (!newRange)
4075 return;
4076
4077 editor.selection.setSelectionRange(newRange);
4078 };
4079
4080 this.onDoubleClick = function(ev) {
4081 var pos = ev.getDocumentPosition();
4082 var editor = this.editor;
4083 var session = editor.session;
4084
4085 var range = session.getBracketRange(pos);
4086 if (range) {
4087 if (range.isEmpty()) {
4088 range.start.column--;
4089 range.end.column++;
4090 }
4091 this.$clickSelection = range;
4092 this.setState("select");
4093 return;
4094 }
4095
4096 this.$clickSelection = editor.selection.getWordRange(pos.row, pos.column);
4097 this.setState("selectByWords");
4098 };
4099
4100 this.onTripleClick = function(ev) {
4101 var pos = ev.getDocumentPosition();
4102 var editor = this.editor;
4103
4104 this.setState("selectByLines");
4105 this.$clickSelection = editor.selection.getLineRange(pos.row);
4106 };
4107
4108 this.onQuadClick = function(ev) {
4109 var editor = this.editor;
4110
4111 editor.selectAll();
4112 this.$clickSelection = editor.getSelectionRange();
4113 this.setState("null");
4114 };
4115
4116 this.onMouseWheel = function(ev) {
4117 if (ev.getShiftKey() || ev.getAccelKey())
4118 return;
4119 var t = ev.domEvent.timeStamp;
4120 var dt = t - (this.$lastScrollTime||0);
4121
4122 var editor = this.editor;
4123 var isScrolable = editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
4124 if (isScrolable || dt < 200) {
4125 this.$lastScrollTime = t;
4126 editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
4127 return ev.stop();
4128 }
4129 };
4130
4131 }).call(DefaultHandlers.prototype);
4132
4133 exports.DefaultHandlers = DefaultHandlers;
4134
4135 function calcDistance(ax, ay, bx, by) {
4136 return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
4137 }
4138
4139 function calcRangeOrientation(range, cursor) {
4140 if (range.start.row == range.end.row)
4141 var cmp = 2 * cursor.column - range.start.column - range.end.column;
4142 else if (range.start.row == range.end.row - 1 && !range.start.column && !range.end.column)
4143 var cmp = cursor.column - 4;
4144 else
4145 var cmp = 2 * cursor.row - range.start.row - range.end.row;
4146
4147 if (cmp < 0)
4148 return {cursor: range.start, anchor: range.end};
4149 else
4150 return {cursor: range.end, anchor: range.start};
4151 }
4152
4153 });
4154
4155 define('ace/mouse/default_gutter_handler', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/event'], function(require, exports, module) {
4156
4157 var dom = require("../lib/dom");
4158 var event = require("../lib/event");
4159
4160 function GutterHandler(mouseHandler) {
4161 var editor = mouseHandler.editor;
4162 var gutter = editor.renderer.$gutterLayer;
4163
4164 mouseHandler.editor.setDefaultHandler("guttermousedown", function(e) {
4165 if (!editor.isFocused())
4166 return;
4167 var gutterRegion = gutter.getRegion(e);
4168
4169 if (gutterRegion == "foldWidgets")
4170 return;
4171
4172 var row = e.getDocumentPosition().row;
4173 var selection = editor.session.selection;
4174
4175 if (e.getShiftKey())
4176 selection.selectTo(row, 0);
4177 else {
4178 if (e.domEvent.detail == 2) {
4179 editor.selectAll();
4180 return e.preventDefault();
4181 }
4182 mouseHandler.$clickSelection = editor.selection.getLineRange(row);
4183 }
4184 mouseHandler.captureMouse(e, "selectByLines");
4185 return e.preventDefault();
4186 });
4187
4188
4189 var tooltipTimeout, mouseEvent, tooltip, tooltipAnnotation;
4190 function createTooltip() {
4191 tooltip = dom.createElement("div");
4192 tooltip.className = "ace_gutter-tooltip";
4193 tooltip.style.display = "none";
4194 editor.container.appendChild(tooltip);
4195 }
4196
4197 function showTooltip() {
4198 if (!tooltip) {
4199 createTooltip();
4200 }
4201 var row = mouseEvent.getDocumentPosition().row;
4202 var annotation = gutter.$annotations[row];
4203 if (!annotation)
4204 return hideTooltip();
4205
4206 var maxRow = editor.session.getLength();
4207 if (row == maxRow) {
4208 var screenRow = editor.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row;
4209 var pos = mouseEvent.$pos;
4210 if (screenRow > editor.session.documentToScreenRow(pos.row, pos.column))
4211 return hideTooltip();
4212 }
4213
4214 if (tooltipAnnotation == annotation)
4215 return;
4216 tooltipAnnotation = annotation.text.join("<br/>");
4217
4218 tooltip.style.display = "block";
4219 tooltip.innerHTML = tooltipAnnotation;
4220 editor.on("mousewheel", hideTooltip);
4221
4222 moveTooltip(mouseEvent);
4223 }
4224
4225 function hideTooltip() {
4226 if (tooltipTimeout)
4227 tooltipTimeout = clearTimeout(tooltipTimeout);
4228 if (tooltipAnnotation) {
4229 tooltip.style.display = "none";
4230 tooltipAnnotation = null;
4231 editor.removeEventListener("mousewheel", hideTooltip);
4232 }
4233 }
4234
4235 function moveTooltip(e) {
4236 var rect = editor.renderer.$gutter.getBoundingClientRect();
4237 tooltip.style.left = e.x + 15 + "px";
4238 if (e.y + 3 * editor.renderer.lineHeight + 15 < rect.bottom) {
4239 tooltip.style.bottom = "";
4240 tooltip.style.top = e.y + 15 + "px";
4241 } else {
4242 tooltip.style.top = "";
4243 tooltip.style.bottom = rect.bottom - e.y + 5 + "px";
4244 }
4245 }
4246
4247 mouseHandler.editor.setDefaultHandler("guttermousemove", function(e) {
4248 var target = e.domEvent.target || e.domEvent.srcElement;
4249 if (dom.hasCssClass(target, "ace_fold-widget"))
4250 return hideTooltip();
4251
4252 if (tooltipAnnotation)
4253 moveTooltip(e);
4254
4255 mouseEvent = e;
4256 if (tooltipTimeout)
4257 return;
4258 tooltipTimeout = setTimeout(function() {
4259 tooltipTimeout = null;
4260 if (mouseEvent && !mouseHandler.isMousePressed)
4261 showTooltip();
4262 else
4263 hideTooltip();
4264 }, 50);
4265 });
4266
4267 event.addListener(editor.renderer.$gutter, "mouseout", function(e) {
4268 mouseEvent = null;
4269 if (!tooltipAnnotation || tooltipTimeout)
4270 return;
4271
4272 tooltipTimeout = setTimeout(function() {
4273 tooltipTimeout = null;
4274 hideTooltip();
4275 }, 50);
4276 });
4277
4278 }
4279
4280 exports.GutterHandler = GutterHandler;
4281
4282 });
4283
4284 define('ace/mouse/mouse_event', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/useragent'], function(require, exports, module) {
4285
4286
4287 var event = require("../lib/event");
4288 var useragent = require("../lib/useragent");
4289 var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
4290 this.domEvent = domEvent;
4291 this.editor = editor;
4292
4293 this.x = this.clientX = domEvent.clientX;
4294 this.y = this.clientY = domEvent.clientY;
4295
4296 this.$pos = null;
4297 this.$inSelection = null;
4298
4299 this.propagationStopped = false;
4300 this.defaultPrevented = false;
4301 };
4302
4303 (function() {
4304
4305 this.stopPropagation = function() {
4306 event.stopPropagation(this.domEvent);
4307 this.propagationStopped = true;
4308 };
4309
4310 this.preventDefault = function() {
4311 event.preventDefault(this.domEvent);
4312 this.defaultPrevented = true;
4313 };
4314
4315 this.stop = function() {
4316 this.stopPropagation();
4317 this.preventDefault();
4318 };
4319 this.getDocumentPosition = function() {
4320 if (this.$pos)
4321 return this.$pos;
4322
4323 this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY);
4324 return this.$pos;
4325 };
4326 this.inSelection = function() {
4327 if (this.$inSelection !== null)
4328 return this.$inSelection;
4329
4330 var editor = this.editor;
4331
4332 if (editor.getReadOnly()) {
4333 this.$inSelection = false;
4334 }
4335 else {
4336 var selectionRange = editor.getSelectionRange();
4337 if (selectionRange.isEmpty())
4338 this.$inSelection = false;
4339 else {
4340 var pos = this.getDocumentPosition();
4341 this.$inSelection = selectionRange.contains(pos.row, pos.column);
4342 }
4343 }
4344 return this.$inSelection;
4345 };
4346 this.getButton = function() {
4347 return event.getButton(this.domEvent);
4348 };
4349 this.getShiftKey = function() {
4350 return this.domEvent.shiftKey;
4351 };
4352
4353 this.getAccelKey = useragent.isMac
4354 ? function() { return this.domEvent.metaKey; }
4355 : function() { return this.domEvent.ctrlKey; };
4356
4357 }).call(MouseEvent.prototype);
4358
4359 });
4360
4361 define('ace/mouse/dragdrop', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) {
4362
4363
4364 var event = require("../lib/event");
4365
4366 var DragdropHandler = function(mouseHandler) {
4367 var editor = mouseHandler.editor;
4368 var dragSelectionMarker, x, y;
4369 var timerId, range;
4370 var dragCursor, counter = 0;
4371
4372 var mouseTarget = editor.container;
4373 event.addListener(mouseTarget, "dragenter", function(e) {
4374 if (editor.getReadOnly())
4375 return;
4376 var types = e.dataTransfer.types;
4377 if (types && Array.prototype.indexOf.call(types, "text/plain") === -1)
4378 return;
4379 if (!dragSelectionMarker)
4380 addDragMarker();
4381 counter++;
4382 return event.preventDefault(e);
4383 });
4384
4385 event.addListener(mouseTarget, "dragover", function(e) {
4386 if (editor.getReadOnly())
4387 return;
4388 var types = e.dataTransfer.types;
4389 if (types && Array.prototype.indexOf.call(types, "text/plain") === -1)
4390 return;
4391 if (onMouseMoveTimer !== null)
4392 onMouseMoveTimer = null;
4393 x = e.clientX;
4394 y = e.clientY;
4395 return event.preventDefault(e);
4396 });
4397
4398 var onDragInterval = function() {
4399 dragCursor = editor.renderer.screenToTextCoordinates(x, y);
4400 editor.moveCursorToPosition(dragCursor);
4401 editor.renderer.scrollCursorIntoView();
4402 };
4403
4404 event.addListener(mouseTarget, "dragleave", function(e) {
4405 counter--;
4406 if (counter <= 0 && dragSelectionMarker) {
4407 clearDragMarker();
4408 return event.preventDefault(e);
4409 }
4410 });
4411
4412 event.addListener(mouseTarget, "drop", function(e) {
4413 if (!dragSelectionMarker)
4414 return;
4415 range.end = editor.session.insert(dragCursor, e.dataTransfer.getData('Text'));
4416 range.start = dragCursor;
4417 clearDragMarker();
4418 editor.focus();
4419 return event.preventDefault(e);
4420 });
4421
4422 function addDragMarker() {
4423 range = editor.selection.toOrientedRange();
4424 dragSelectionMarker = editor.session.addMarker(range, "ace_selection", editor.getSelectionStyle());
4425 editor.clearSelection();
4426 clearInterval(timerId);
4427 timerId = setInterval(onDragInterval, 20);
4428 counter = 0;
4429 event.addListener(document, "mousemove", onMouseMove);
4430 }
4431 function clearDragMarker() {
4432 clearInterval(timerId);
4433 editor.session.removeMarker(dragSelectionMarker);
4434 dragSelectionMarker = null;
4435 editor.selection.fromOrientedRange(range);
4436 counter = 0;
4437 event.removeListener(document, "mousemove", onMouseMove);
4438 }
4439 var onMouseMoveTimer = null;
4440 function onMouseMove() {
4441 if (onMouseMoveTimer == null) {
4442 onMouseMoveTimer = setTimeout(function() {
4443 if (onMouseMoveTimer != null && dragSelectionMarker)
4444 clearDragMarker();
4445 }, 20);
4446 }
4447 }
4448 };
4449
4450 exports.DragdropHandler = DragdropHandler;
4451 });
4452
4453 define('ace/config', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/lib/oop', 'ace/lib/net', 'ace/lib/event_emitter'], function(require, exports, module) {
4454 "no use strict";
4455
4456 var lang = require("./lib/lang");
4457 var oop = require("./lib/oop");
4458 var net = require("./lib/net");
4459 var EventEmitter = require("./lib/event_emitter").EventEmitter;
4460
4461 var global = (function() {
4462 return this;
4463 })();
4464
4465 var options = {
4466 packaged: false,
4467 workerPath: null,
4468 modePath: null,
4469 themePath: null,
4470 basePath: "",
4471 suffix: ".js",
4472 $moduleUrls: {}
4473 };
4474
4475 exports.get = function(key) {
4476 if (!options.hasOwnProperty(key))
4477 throw new Error("Unknown config key: " + key);
4478
4479 return options[key];
4480 };
4481
4482 exports.set = function(key, value) {
4483 if (!options.hasOwnProperty(key))
4484 throw new Error("Unknown config key: " + key);
4485
4486 options[key] = value;
4487 };
4488
4489 exports.all = function() {
4490 return lang.copyObject(options);
4491 };
4492 oop.implement(exports, EventEmitter);
4493
4494 exports.moduleUrl = function(name, component) {
4495 if (options.$moduleUrls[name])
4496 return options.$moduleUrls[name];
4497
4498 var parts = name.split("/");
4499 component = component || parts[parts.length - 2] || "";
4500 var base = parts[parts.length - 1].replace(component, "").replace(/(^[\-_])|([\-_]$)/, "");
4501
4502 if (!base && parts.length > 1)
4503 base = parts[parts.length - 2];
4504 var path = options[component + "Path"];
4505 if (path == null)
4506 path = options.basePath;
4507 if (path && path.slice(-1) != "/")
4508 path += "/";
4509 return path + component + "-" + base + this.get("suffix");
4510 };
4511
4512 exports.setModuleUrl = function(name, subst) {
4513 return options.$moduleUrls[name] = subst;
4514 };
4515
4516 exports.$loading = {};
4517 exports.loadModule = function(moduleName, onLoad) {
4518 var module, moduleType;
4519 if (Array.isArray(moduleName)) {
4520 moduleType = moduleName[0];
4521 moduleName = moduleName[1];
4522 }
4523
4524 try {
4525 module = require(moduleName);
4526 } catch (e) {};
4527 if (module && !exports.$loading[moduleName])
4528 return onLoad && onLoad(module);
4529
4530 if (!exports.$loading[moduleName])
4531 exports.$loading[moduleName] = [];
4532
4533 exports.$loading[moduleName].push(onLoad);
4534
4535 if (exports.$loading[moduleName].length > 1)
4536 return;
4537
4538 var afterLoad = function() {
4539 require([moduleName], function(module) {
4540 exports._emit("load.module", {name: moduleName, module: module});
4541 var listeners = exports.$loading[moduleName];
4542 exports.$loading[moduleName] = null;
4543 listeners.forEach(function(onLoad) {
4544 onLoad && onLoad(module);
4545 });
4546 });
4547 };
4548
4549 if (!exports.get("packaged"))
4550 return afterLoad();
4551 net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad);
4552 };
4553 exports.init = function() {
4554 options.packaged = require.packaged || module.packaged || (global.define && define.packaged);
4555
4556 if (!global.document)
4557 return "";
4558
4559 var scriptOptions = {};
4560 var scriptUrl = "";
4561
4562 var scripts = document.getElementsByTagName("script");
4563 for (var i=0; i<scripts.length; i++) {
4564 var script = scripts[i];
4565
4566 var src = script.src || script.getAttribute("src");
4567 if (!src)
4568 continue;
4569
4570 var attributes = script.attributes;
4571 for (var j=0, l=attributes.length; j < l; j++) {
4572 var attr = attributes[j];
4573 if (attr.name.indexOf("data-ace-") === 0) {
4574 scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, ""))] = attr.value;
4575 }
4576 }
4577
4578 var m = src.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);
4579 if (m)
4580 scriptUrl = m[1];
4581 }
4582
4583 if (scriptUrl) {
4584 scriptOptions.base = scriptOptions.base || scriptUrl;
4585 scriptOptions.packaged = true;
4586 }
4587
4588 scriptOptions.basePath = scriptOptions.base;
4589 scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;
4590 scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;
4591 scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;
4592 delete scriptOptions.base;
4593
4594 for (var key in scriptOptions)
4595 if (typeof scriptOptions[key] !== "undefined")
4596 exports.set(key, scriptOptions[key]);
4597 };
4598
4599 function deHyphenate(str) {
4600 return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
4601 }
4602
4603 var optionsProvider = {
4604 setOptions: function(optList) {
4605 Object.keys(optList).forEach(function(key) {
4606 this.setOption(key, optList[key]);
4607 }, this);
4608 },
4609 getOptions: function(optionNames) {
4610 var result = {};
4611 if (!optionNames) {
4612 optionNames = Object.keys(this.$options);
4613 } else if (!Array.isArray(optionNames)) {
4614 result = optionNames;
4615 optionNames = Object.keys(result);
4616 }
4617 optionNames.forEach(function(key) {
4618 result[key] = this.getOption(key);
4619 }, this);
4620 return result;
4621 },
4622 setOption: function(name, value) {
4623 if (this["$" + name] === value)
4624 return;
4625 var opt = this.$options[name];
4626 if (!opt)
4627 return undefined;
4628 if (opt.forwardTo)
4629 return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
4630
4631 if (!opt.handlesSet)
4632 this["$" + name] = value;
4633 if (opt && opt.set)
4634 opt.set.call(this, value);
4635 },
4636 getOption: function(name) {
4637 var opt = this.$options[name];
4638 if (!opt)
4639 return undefined;
4640 if (opt.forwardTo)
4641 return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
4642 return opt && opt.get ? opt.get.call(this) : this["$" + name];
4643 }
4644 };
4645
4646 var defaultOptions = {};
4647 exports.defineOptions = function(obj, path, options) {
4648 if (!obj.$options)
4649 defaultOptions[path] = obj.$options = {};
4650
4651 Object.keys(options).forEach(function(key) {
4652 var opt = options[key];
4653 if (typeof opt == "string")
4654 opt = {forwardTo: opt};
4655
4656 opt.name || (opt.name = key);
4657 obj.$options[opt.name] = opt;
4658 if ("initialValue" in opt)
4659 obj["$" + opt.name] = opt.initialValue;
4660 });
4661 oop.implement(obj, optionsProvider);
4662
4663 return this;
4664 };
4665
4666 exports.resetOptions = function(obj) {
4667 Object.keys(obj.$options).forEach(function(key) {
4668 var opt = obj.$options[key];
4669 if ("value" in opt)
4670 obj.setOption(key, opt.value);
4671 });
4672 };
4673
4674 exports.setDefaultValue = function(path, name, value) {
4675 var opts = defaultOptions[path] || (defaultOptions[path] = {});
4676 if (opts[name]) {
4677 if (opts.forwardTo)
4678 exports.setDefaultValue(opts.forwardTo, name, value)
4679 else
4680 opts[name].value = value;
4681 }
4682 };
4683
4684 exports.setDefaultValues = function(path, optionHash) {
4685 Object.keys(optionHash).forEach(function(key) {
4686 exports.setDefaultValue(path, key, optionHash[key]);
4687 });
4688 };
4689
4690 });
4691 define('ace/lib/net', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
4692
4693 var dom = require("./dom");
4694
4695 exports.get = function (url, callback) {
4696 var xhr = new XMLHttpRequest();
4697 xhr.open('GET', url, true);
4698 xhr.onreadystatechange = function () {
4699 if (xhr.readyState === 4) {
4700 callback(xhr.responseText);
4701 }
4702 };
4703 xhr.send(null);
4704 };
4705
4706 exports.loadScript = function(path, callback) {
4707 var head = dom.getDocumentHead();
4708 var s = document.createElement('script');
4709
4710 s.src = path;
4711 head.appendChild(s);
4712
4713 s.onload = s.onreadystatechange = function(_, isAbort) {
4714 if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") {
4715 s = s.onload = s.onreadystatechange = null;
4716 if (!isAbort)
4717 callback();
4718 }
4719 };
4720 };
4721
4722 });
4723
4724 define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
4725
4726
4727 var EventEmitter = {};
4728 var stopPropagation = function() { this.propagationStopped = true; };
4729 var preventDefault = function() { this.defaultPrevented = true; };
4730
4731 EventEmitter._emit =
4732 EventEmitter._dispatchEvent = function(eventName, e) {
4733 this._eventRegistry || (this._eventRegistry = {});
4734 this._defaultHandlers || (this._defaultHandlers = {});
4735
4736 var listeners = this._eventRegistry[eventName] || [];
4737 var defaultHandler = this._defaultHandlers[eventName];
4738 if (!listeners.length && !defaultHandler)
4739 return;
4740
4741 if (typeof e != "object" || !e)
4742 e = {};
4743
4744 if (!e.type)
4745 e.type = eventName;
4746 if (!e.stopPropagation)
4747 e.stopPropagation = stopPropagation;
4748 if (!e.preventDefault)
4749 e.preventDefault = preventDefault;
4750
4751 for (var i=0; i<listeners.length; i++) {
4752 listeners[i](e, this);
4753 if (e.propagationStopped)
4754 break;
4755 }
4756
4757 if (defaultHandler && !e.defaultPrevented)
4758 return defaultHandler(e, this);
4759 };
4760
4761
4762 EventEmitter._signal = function(eventName, e) {
4763 var listeners = (this._eventRegistry || {})[eventName];
4764 if (!listeners)
4765 return;
4766
4767 for (var i=0; i<listeners.length; i++)
4768 listeners[i](e, this);
4769 };
4770
4771 EventEmitter.once = function(eventName, callback) {
4772 var _self = this;
4773 callback && this.addEventListener(eventName, function newCallback() {
4774 _self.removeEventListener(eventName, newCallback);
4775 callback.apply(null, arguments);
4776 });
4777 };
4778
4779
4780 EventEmitter.setDefaultHandler = function(eventName, callback) {
4781 var handlers = this._defaultHandlers
4782 if (!handlers)
4783 handlers = this._defaultHandlers = {_disabled_: {}};
4784
4785 if (handlers[eventName]) {
4786 var old = handlers[eventName];
4787 var disabled = handlers._disabled_[eventName];
4788 if (!disabled)
4789 handlers._disabled_[eventName] = disabled = [];
4790 disabled.push(old);
4791 var i = disabled.indexOf(callback);
4792 if (i != -1)
4793 disabled.splice(i, 1);
4794 }
4795 handlers[eventName] = callback;
4796 };
4797 EventEmitter.removeDefaultHandler = function(eventName, callback) {
4798 var handlers = this._defaultHandlers
4799 if (!handlers)
4800 return;
4801 var disabled = handlers._disabled_[eventName];
4802
4803 if (handlers[eventName] == callback) {
4804 var old = handlers[eventName];
4805 if (disabled)
4806 this.setDefaultHandler(eventName, disabled.pop());
4807 } else if (disabled) {
4808 var i = disabled.indexOf(callback);
4809 if (i != -1)
4810 disabled.splice(i, 1);
4811 }
4812 };
4813
4814 EventEmitter.on =
4815 EventEmitter.addEventListener = function(eventName, callback, capturing) {
4816 this._eventRegistry = this._eventRegistry || {};
4817
4818 var listeners = this._eventRegistry[eventName];
4819 if (!listeners)
4820 listeners = this._eventRegistry[eventName] = [];
4821
4822 if (listeners.indexOf(callback) == -1)
4823 listeners[capturing ? "unshift" : "push"](callback);
4824 return callback;
4825 };
4826
4827 EventEmitter.off =
4828 EventEmitter.removeListener =
4829 EventEmitter.removeEventListener = function(eventName, callback) {
4830 this._eventRegistry = this._eventRegistry || {};
4831
4832 var listeners = this._eventRegistry[eventName];
4833 if (!listeners)
4834 return;
4835
4836 var index = listeners.indexOf(callback);
4837 if (index !== -1)
4838 listeners.splice(index, 1);
4839 };
4840
4841 EventEmitter.removeAllListeners = function(eventName) {
4842 if (this._eventRegistry) this._eventRegistry[eventName] = [];
4843 };
4844
4845 exports.EventEmitter = EventEmitter;
4846
4847 });
4848
4849 define('ace/mouse/fold_handler', ['require', 'exports', 'module' ], function(require, exports, module) {
4850
4851
4852 function FoldHandler(editor) {
4853
4854 editor.on("click", function(e) {
4855 var position = e.getDocumentPosition();
4856 var session = editor.session;
4857 var fold = session.getFoldAt(position.row, position.column, 1);
4858 if (fold) {
4859 if (e.getAccelKey())
4860 session.removeFold(fold);
4861 else
4862 session.expandFold(fold);
4863
4864 e.stop();
4865 }
4866 });
4867
4868 editor.on("gutterclick", function(e) {
4869 var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
4870
4871 if (gutterRegion == "foldWidgets") {
4872 var row = e.getDocumentPosition().row;
4873 var session = editor.session;
4874 if (session.foldWidgets && session.foldWidgets[row])
4875 editor.session.onFoldWidgetClick(row, e);
4876 if (!editor.isFocused())
4877 editor.focus();
4878 e.stop();
4879 }
4880 });
4881
4882 editor.on("gutterdblclick", function(e) {
4883 var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
4884
4885 if (gutterRegion == "foldWidgets") {
4886 var row = e.getDocumentPosition().row;
4887 var session = editor.session;
4888 var data = session.getParentFoldRangeData(row, true);
4889 var range = data.range || data.firstRange;
4890
4891 if (range) {
4892 var row = range.start.row;
4893 var fold = session.getFoldAt(row, session.getLine(row).length, 1);
4894
4895 if (fold) {
4896 session.removeFold(fold);
4897 } else {
4898 session.addFold("...", range);
4899 editor.renderer.scrollCursorIntoView({row: range.start.row, column: 0});
4900 }
4901 }
4902 e.stop();
4903 }
4904 });
4905 }
4906
4907 exports.FoldHandler = FoldHandler;
4908
4909 });
4910
4911 define('ace/keyboard/keybinding', ['require', 'exports', 'module' , 'ace/lib/keys', 'ace/lib/event'], function(require, exports, module) {
4912
4913
4914 var keyUtil = require("../lib/keys");
4915 var event = require("../lib/event");
4916
4917 var KeyBinding = function(editor) {
4918 this.$editor = editor;
4919 this.$data = { };
4920 this.$handlers = [];
4921 this.setDefaultHandler(editor.commands);
4922 };
4923
4924 (function() {
4925 this.setDefaultHandler = function(kb) {
4926 this.removeKeyboardHandler(this.$defaultHandler);
4927 this.$defaultHandler = kb;
4928 this.addKeyboardHandler(kb, 0);
4929 this.$data = {editor: this.$editor};
4930 };
4931
4932 this.setKeyboardHandler = function(kb) {
4933 var h = this.$handlers;
4934 if (h[h.length - 1] == kb)
4935 return;
4936
4937 while (h[h.length - 1] && h[h.length - 1] != this.$defaultHandler)
4938 this.removeKeyboardHandler(h[h.length - 1]);
4939
4940 this.addKeyboardHandler(kb, 1);
4941 };
4942
4943 this.addKeyboardHandler = function(kb, pos) {
4944 if (!kb)
4945 return;
4946 var i = this.$handlers.indexOf(kb);
4947 if (i != -1)
4948 this.$handlers.splice(i, 1);
4949
4950 if (pos == undefined)
4951 this.$handlers.push(kb);
4952 else
4953 this.$handlers.splice(pos, 0, kb);
4954
4955 if (i == -1 && kb.attach)
4956 kb.attach(this.$editor);
4957 };
4958
4959 this.removeKeyboardHandler = function(kb) {
4960 var i = this.$handlers.indexOf(kb);
4961 if (i == -1)
4962 return false;
4963 this.$handlers.splice(i, 1);
4964 kb.detach && kb.detach(this.$editor);
4965 return true;
4966 };
4967
4968 this.getKeyboardHandler = function() {
4969 return this.$handlers[this.$handlers.length - 1];
4970 };
4971
4972 this.$callKeyboardHandlers = function (hashId, keyString, keyCode, e) {
4973 var toExecute;
4974 var success = false;
4975 var commands = this.$editor.commands;
4976
4977 for (var i = this.$handlers.length; i--;) {
4978 toExecute = this.$handlers[i].handleKeyboard(
4979 this.$data, hashId, keyString, keyCode, e
4980 );
4981 if (!toExecute || !toExecute.command)
4982 continue;
4983 if (toExecute.command == "null") {
4984 success = true;
4985 } else {
4986 success = commands.exec(toExecute.command, this.$editor, toExecute.args, e);
4987 }
4988 if (success && e && hashId != -1 && toExecute.passEvent != true)
4989 event.stopEvent(e);
4990 if (success)
4991 break;
4992 }
4993 return success;
4994 };
4995
4996 this.onCommandKey = function(e, hashId, keyCode) {
4997 var keyString = keyUtil.keyCodeToString(keyCode);
4998 this.$callKeyboardHandlers(hashId, keyString, keyCode, e);
4999 };
5000
5001 this.onTextInput = function(text) {
5002 var success = this.$callKeyboardHandlers(-1, text);
5003 if (!success)
5004 this.$editor.commands.exec("insertstring", this.$editor, text);
5005 };
5006
5007 }).call(KeyBinding.prototype);
5008
5009 exports.KeyBinding = KeyBinding;
5010 });
5011
5012 define('ace/edit_session', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/config', 'ace/lib/event_emitter', 'ace/selection', 'ace/mode/text', 'ace/range', 'ace/document', 'ace/background_tokenizer', 'ace/search_highlight', 'ace/edit_session/folding', 'ace/edit_session/bracket_match'], function(require, exports, module) {
5013
5014
5015 var oop = require("./lib/oop");
5016 var lang = require("./lib/lang");
5017 var config = require("./config");
5018 var EventEmitter = require("./lib/event_emitter").EventEmitter;
5019 var Selection = require("./selection").Selection;
5020 var TextMode = require("./mode/text").Mode;
5021 var Range = require("./range").Range;
5022 var Document = require("./document").Document;
5023 var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer;
5024 var SearchHighlight = require("./search_highlight").SearchHighlight;
5025
5026 var EditSession = function(text, mode) {
5027 this.$breakpoints = [];
5028 this.$decorations = [];
5029 this.$frontMarkers = {};
5030 this.$backMarkers = {};
5031 this.$markerId = 1;
5032 this.$undoSelect = true;
5033
5034 this.$foldData = [];
5035 this.$foldData.toString = function() {
5036 return this.join("\n");
5037 }
5038 this.on("changeFold", this.onChangeFold.bind(this));
5039 this.$onChange = this.onChange.bind(this);
5040
5041 if (typeof text != "object" || !text.getLine)
5042 text = new Document(text);
5043
5044 this.setDocument(text);
5045 this.selection = new Selection(this);
5046
5047 config.resetOptions(this);
5048 this.setMode(mode);
5049 config._emit("session", this);
5050 };
5051
5052
5053 (function() {
5054
5055 oop.implement(this, EventEmitter);
5056 this.setDocument = function(doc) {
5057 if (this.doc)
5058 this.doc.removeListener("change", this.$onChange);
5059
5060 this.doc = doc;
5061 doc.on("change", this.$onChange);
5062
5063 if (this.bgTokenizer)
5064 this.bgTokenizer.setDocument(this.getDocument());
5065
5066 this.resetCaches();
5067 };
5068 this.getDocument = function() {
5069 return this.doc;
5070 };
5071 this.$resetRowCache = function(docRow) {
5072 if (!docRow) {
5073 this.$docRowCache = [];
5074 this.$screenRowCache = [];
5075 return;
5076 }
5077 var l = this.$docRowCache.length;
5078 var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;
5079 if (l > i) {
5080 this.$docRowCache.splice(i, l);
5081 this.$screenRowCache.splice(i, l);
5082 }
5083 };
5084
5085 this.$getRowCacheIndex = function(cacheArray, val) {
5086 var low = 0;
5087 var hi = cacheArray.length - 1;
5088
5089 while (low <= hi) {
5090 var mid = (low + hi) >> 1;
5091 var c = cacheArray[mid];
5092
5093 if (val > c)
5094 low = mid + 1;
5095 else if (val < c)
5096 hi = mid - 1;
5097 else
5098 return mid;
5099 }
5100
5101 return low -1;
5102 };
5103
5104 this.resetCaches = function() {
5105 this.$modified = true;
5106 this.$wrapData = [];
5107 this.$rowLengthCache = [];
5108 this.$resetRowCache(0);
5109 if (this.bgTokenizer)
5110 this.bgTokenizer.start(0);
5111 };
5112
5113 this.onChangeFold = function(e) {
5114 var fold = e.data;
5115 this.$resetRowCache(fold.start.row);
5116 };
5117
5118 this.onChange = function(e) {
5119 var delta = e.data;
5120 this.$modified = true;
5121
5122 this.$resetRowCache(delta.range.start.row);
5123
5124 var removedFolds = this.$updateInternalDataOnChange(e);
5125 if (!this.$fromUndo && this.$undoManager && !delta.ignore) {
5126 this.$deltasDoc.push(delta);
5127 if (removedFolds && removedFolds.length != 0) {
5128 this.$deltasFold.push({
5129 action: "removeFolds",
5130 folds: removedFolds
5131 });
5132 }
5133
5134 this.$informUndoManager.schedule();
5135 }
5136
5137 this.bgTokenizer.$updateOnChange(delta);
5138 this._emit("change", e);
5139 };
5140 this.setValue = function(text) {
5141 this.doc.setValue(text);
5142 this.selection.moveCursorTo(0, 0);
5143 this.selection.clearSelection();
5144
5145 this.$resetRowCache(0);
5146 this.$deltas = [];
5147 this.$deltasDoc = [];
5148 this.$deltasFold = [];
5149 this.getUndoManager().reset();
5150 };
5151 this.getValue =
5152 this.toString = function() {
5153 return this.doc.getValue();
5154 };
5155 this.getSelection = function() {
5156 return this.selection;
5157 };
5158 this.getState = function(row) {
5159 return this.bgTokenizer.getState(row);
5160 };
5161 this.getTokens = function(row) {
5162 return this.bgTokenizer.getTokens(row);
5163 };
5164 this.getTokenAt = function(row, column) {
5165 var tokens = this.bgTokenizer.getTokens(row);
5166 var token, c = 0;
5167 if (column == null) {
5168 i = tokens.length - 1;
5169 c = this.getLine(row).length;
5170 } else {
5171 for (var i = 0; i < tokens.length; i++) {
5172 c += tokens[i].value.length;
5173 if (c >= column)
5174 break;
5175 }
5176 }
5177 token = tokens[i];
5178 if (!token)
5179 return null;
5180 token.index = i;
5181 token.start = c - token.value.length;
5182 return token;
5183 };
5184 this.setUndoManager = function(undoManager) {
5185 this.$undoManager = undoManager;
5186 this.$deltas = [];
5187 this.$deltasDoc = [];
5188 this.$deltasFold = [];
5189
5190 if (this.$informUndoManager)
5191 this.$informUndoManager.cancel();
5192
5193 if (undoManager) {
5194 var self = this;
5195
5196 this.$syncInformUndoManager = function() {
5197 self.$informUndoManager.cancel();
5198
5199 if (self.$deltasFold.length) {
5200 self.$deltas.push({
5201 group: "fold",
5202 deltas: self.$deltasFold
5203 });
5204 self.$deltasFold = [];
5205 }
5206
5207 if (self.$deltasDoc.length) {
5208 self.$deltas.push({
5209 group: "doc",
5210 deltas: self.$deltasDoc
5211 });
5212 self.$deltasDoc = [];
5213 }
5214
5215 if (self.$deltas.length > 0) {
5216 undoManager.execute({
5217 action: "aceupdate",
5218 args: [self.$deltas, self]
5219 });
5220 }
5221
5222 self.$deltas = [];
5223 }
5224 this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager);
5225 }
5226 };
5227 this.markUndoGroup = function() {
5228 if (this.$syncInformUndoManager)
5229 this.$syncInformUndoManager();
5230 };
5231
5232 this.$defaultUndoManager = {
5233 undo: function() {},
5234 redo: function() {},
5235 reset: function() {}
5236 };
5237 this.getUndoManager = function() {
5238 return this.$undoManager || this.$defaultUndoManager;
5239 };
5240 this.getTabString = function() {
5241 if (this.getUseSoftTabs()) {
5242 return lang.stringRepeat(" ", this.getTabSize());
5243 } else {
5244 return "\t";
5245 }
5246 };
5247 this.setUseSoftTabs = function(val) {
5248 this.setOption("useSoftTabs", val);
5249 };
5250 this.getUseSoftTabs = function() {
5251 return this.$useSoftTabs;
5252 };
5253 this.setTabSize = function(tabSize) {
5254 this.setOption("tabSize", tabSize)
5255 };
5256 this.getTabSize = function() {
5257 return this.$tabSize;
5258 };
5259 this.isTabStop = function(position) {
5260 return this.$useSoftTabs && (position.column % this.$tabSize == 0);
5261 };
5262
5263 this.$overwrite = false;
5264 this.setOverwrite = function(overwrite) {
5265 this.setOption("overwrite", overwrite)
5266 };
5267 this.getOverwrite = function() {
5268 return this.$overwrite;
5269 };
5270 this.toggleOverwrite = function() {
5271 this.setOverwrite(!this.$overwrite);
5272 };
5273 this.addGutterDecoration = function(row, className) {
5274 if (!this.$decorations[row])
5275 this.$decorations[row] = "";
5276 this.$decorations[row] += " " + className;
5277 this._emit("changeBreakpoint", {});
5278 };
5279 this.removeGutterDecoration = function(row, className) {
5280 this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
5281 this._emit("changeBreakpoint", {});
5282 };
5283 this.getBreakpoints = function() {
5284 return this.$breakpoints;
5285 };
5286 this.setBreakpoints = function(rows) {
5287 this.$breakpoints = [];
5288 for (var i=0; i<rows.length; i++) {
5289 this.$breakpoints[rows[i]] = "ace_breakpoint";
5290 }
5291 this._emit("changeBreakpoint", {});
5292 };
5293 this.clearBreakpoints = function() {
5294 this.$breakpoints = [];
5295 this._emit("changeBreakpoint", {});
5296 };
5297 this.setBreakpoint = function(row, className) {
5298 if (className === undefined)
5299 className = "ace_breakpoint";
5300 if (className)
5301 this.$breakpoints[row] = className;
5302 else
5303 delete this.$breakpoints[row];
5304 this._emit("changeBreakpoint", {});
5305 };
5306 this.clearBreakpoint = function(row) {
5307 delete this.$breakpoints[row];
5308 this._emit("changeBreakpoint", {});
5309 };
5310 this.addMarker = function(range, clazz, type, inFront) {
5311 var id = this.$markerId++;
5312
5313 var marker = {
5314 range : range,
5315 type : type || "line",
5316 renderer: typeof type == "function" ? type : null,
5317 clazz : clazz,
5318 inFront: !!inFront,
5319 id: id
5320 }
5321
5322 if (inFront) {
5323 this.$frontMarkers[id] = marker;
5324 this._emit("changeFrontMarker")
5325 } else {
5326 this.$backMarkers[id] = marker;
5327 this._emit("changeBackMarker")
5328 }
5329
5330 return id;
5331 };
5332 this.addDynamicMarker = function(marker, inFront) {
5333 if (!marker.update)
5334 return;
5335 var id = this.$markerId++;
5336 marker.id = id;
5337 marker.inFront = !!inFront;
5338
5339 if (inFront) {
5340 this.$frontMarkers[id] = marker;
5341 this._emit("changeFrontMarker")
5342 } else {
5343 this.$backMarkers[id] = marker;
5344 this._emit("changeBackMarker")
5345 }
5346
5347 return marker;
5348 };
5349 this.removeMarker = function(markerId) {
5350 var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
5351 if (!marker)
5352 return;
5353
5354 var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
5355 if (marker) {
5356 delete (markers[markerId]);
5357 this._emit(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
5358 }
5359 };
5360 this.getMarkers = function(inFront) {
5361 return inFront ? this.$frontMarkers : this.$backMarkers;
5362 };
5363
5364 this.highlight = function(re) {
5365 if (!this.$searchHighlight) {
5366 var highlight = new SearchHighlight(null, "ace_selected-word", "text");
5367 this.$searchHighlight = this.addDynamicMarker(highlight);
5368 }
5369 this.$searchHighlight.setRegexp(re);
5370 }
5371 this.highlightLines = function(startRow, endRow, clazz, inFront) {
5372 if (typeof endRow != "number") {
5373 clazz = endRow;
5374 endRow = startRow;
5375 }
5376 if (!clazz)
5377 clazz = "ace_step";
5378
5379 var range = new Range(startRow, 0, endRow, Infinity);
5380 range.id = this.addMarker(range, clazz, "fullLine", inFront);
5381 return range;
5382 };
5383 this.setAnnotations = function(annotations) {
5384 this.$annotations = annotations;
5385 this._emit("changeAnnotation", {});
5386 };
5387 this.getAnnotations = function() {
5388 return this.$annotations || [];
5389 };
5390 this.clearAnnotations = function() {
5391 this.setAnnotations([]);
5392 };
5393 this.$detectNewLine = function(text) {
5394 var match = text.match(/^.*?(\r?\n)/m);
5395 if (match) {
5396 this.$autoNewLine = match[1];
5397 } else {
5398 this.$autoNewLine = "\n";
5399 }
5400 };
5401 this.getWordRange = function(row, column) {
5402 var line = this.getLine(row);
5403
5404 var inToken = false;
5405 if (column > 0)
5406 inToken = !!line.charAt(column - 1).match(this.tokenRe);
5407
5408 if (!inToken)
5409 inToken = !!line.charAt(column).match(this.tokenRe);
5410
5411 if (inToken)
5412 var re = this.tokenRe;
5413 else if (/^\s+$/.test(line.slice(column-1, column+1)))
5414 var re = /\s/;
5415 else
5416 var re = this.nonTokenRe;
5417
5418 var start = column;
5419 if (start > 0) {
5420 do {
5421 start--;
5422 }
5423 while (start >= 0 && line.charAt(start).match(re));
5424 start++;
5425 }
5426
5427 var end = column;
5428 while (end < line.length && line.charAt(end).match(re)) {
5429 end++;
5430 }
5431
5432 return new Range(row, start, row, end);
5433 };
5434 this.getAWordRange = function(row, column) {
5435 var wordRange = this.getWordRange(row, column);
5436 var line = this.getLine(wordRange.end.row);
5437
5438 while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
5439 wordRange.end.column += 1;
5440 }
5441 return wordRange;
5442 };
5443 this.setNewLineMode = function(newLineMode) {
5444 this.doc.setNewLineMode(newLineMode);
5445 };
5446 this.getNewLineMode = function() {
5447 return this.doc.getNewLineMode();
5448 };
5449 this.setUseWorker = function(useWorker) { this.setOption("useWorker", useWorker); };
5450 this.getUseWorker = function() { return this.$useWorker; };
5451 this.onReloadTokenizer = function(e) {
5452 var rows = e.data;
5453 this.bgTokenizer.start(rows.first);
5454 this._emit("tokenizerUpdate", e);
5455 };
5456
5457 this.$modes = {};
5458 this.$mode = null;
5459 this.$modeId = null;
5460 this.setMode = function(mode) {
5461 if (mode && typeof mode === "object") {
5462 if (mode.getTokenizer)
5463 return this.$onChangeMode(mode);
5464 var options = mode;
5465 var path = options.path;
5466 } else {
5467 path = mode || "ace/mode/text";
5468 }
5469 if (!this.$modes["ace/mode/text"])
5470 this.$modes["ace/mode/text"] = new TextMode();
5471
5472 if (this.$modes[path] && !options)
5473 return this.$onChangeMode(this.$modes[path]);
5474 this.$modeId = path;
5475 config.loadModule(["mode", path], function(m) {
5476 if (this.$modeId !== path)
5477 return;
5478 if (this.$modes[path] && !options)
5479 return this.$onChangeMode(this.$modes[path]);
5480 if (m && m.Mode) {
5481 m = new m.Mode(options);
5482 if (!options) {
5483 this.$modes[path] = m;
5484 m.$id = path;
5485 }
5486 this.$onChangeMode(m)
5487 }
5488 }.bind(this));
5489 if (!this.$mode)
5490 this.$onChangeMode(this.$modes["ace/mode/text"], true);
5491 };
5492
5493 this.$onChangeMode = function(mode, $isPlaceholder) {
5494 if (this.$mode === mode) return;
5495 this.$mode = mode;
5496
5497 this.$stopWorker();
5498
5499 if (this.$useWorker)
5500 this.$startWorker();
5501
5502 var tokenizer = mode.getTokenizer();
5503
5504 if(tokenizer.addEventListener !== undefined) {
5505 var onReloadTokenizer = this.onReloadTokenizer.bind(this);
5506 tokenizer.addEventListener("update", onReloadTokenizer);
5507 }
5508
5509 if (!this.bgTokenizer) {
5510 this.bgTokenizer = new BackgroundTokenizer(tokenizer);
5511 var _self = this;
5512 this.bgTokenizer.addEventListener("update", function(e) {
5513 _self._emit("tokenizerUpdate", e);
5514 });
5515 } else {
5516 this.bgTokenizer.setTokenizer(tokenizer);
5517 }
5518
5519 this.bgTokenizer.setDocument(this.getDocument());
5520
5521 this.tokenRe = mode.tokenRe;
5522 this.nonTokenRe = mode.nonTokenRe;
5523
5524
5525 if (!$isPlaceholder) {
5526 this.$modeId = mode.$id;
5527 this.$setFolding(mode.foldingRules);
5528 this._emit("changeMode");
5529 this.bgTokenizer.start(0);
5530 }
5531 };
5532
5533
5534 this.$stopWorker = function() {
5535 if (this.$worker)
5536 this.$worker.terminate();
5537
5538 this.$worker = null;
5539 };
5540
5541 this.$startWorker = function() {
5542 if (typeof Worker !== "undefined" && !require.noWorker) {
5543 try {
5544 this.$worker = this.$mode.createWorker(this);
5545 } catch (e) {
5546 console.log("Could not load worker");
5547 console.log(e);
5548 this.$worker = null;
5549 }
5550 }
5551 else
5552 this.$worker = null;
5553 };
5554 this.getMode = function() {
5555 return this.$mode;
5556 };
5557
5558 this.$scrollTop = 0;
5559 this.setScrollTop = function(scrollTop) {
5560 scrollTop = Math.round(Math.max(0, scrollTop));
5561 if (this.$scrollTop === scrollTop || isNaN(scrollTop))
5562 return;
5563
5564 this.$scrollTop = scrollTop;
5565 this._signal("changeScrollTop", scrollTop);
5566 };
5567 this.getScrollTop = function() {
5568 return this.$scrollTop;
5569 };
5570
5571 this.$scrollLeft = 0;
5572 this.setScrollLeft = function(scrollLeft) {
5573 scrollLeft = Math.round(Math.max(0, scrollLeft));
5574 if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))
5575 return;
5576
5577 this.$scrollLeft = scrollLeft;
5578 this._signal("changeScrollLeft", scrollLeft);
5579 };
5580 this.getScrollLeft = function() {
5581 return this.$scrollLeft;
5582 };
5583 this.getScreenWidth = function() {
5584 this.$computeWidth();
5585 return this.screenWidth;
5586 };
5587
5588 this.$computeWidth = function(force) {
5589 if (this.$modified || force) {
5590 this.$modified = false;
5591
5592 if (this.$useWrapMode)
5593 return this.screenWidth = this.$wrapLimit;
5594
5595 var lines = this.doc.getAllLines();
5596 var cache = this.$rowLengthCache;
5597 var longestScreenLine = 0;
5598 var foldIndex = 0;
5599 var foldLine = this.$foldData[foldIndex];
5600 var foldStart = foldLine ? foldLine.start.row : Infinity;
5601 var len = lines.length;
5602
5603 for (var i = 0; i < len; i++) {
5604 if (i > foldStart) {
5605 i = foldLine.end.row + 1;
5606 if (i >= len)
5607 break;
5608 foldLine = this.$foldData[foldIndex++];
5609 foldStart = foldLine ? foldLine.start.row : Infinity;
5610 }
5611
5612 if (cache[i] == null)
5613 cache[i] = this.$getStringScreenWidth(lines[i])[0];
5614
5615 if (cache[i] > longestScreenLine)
5616 longestScreenLine = cache[i];
5617 }
5618 this.screenWidth = longestScreenLine;
5619 }
5620 };
5621 this.getLine = function(row) {
5622 return this.doc.getLine(row);
5623 };
5624 this.getLines = function(firstRow, lastRow) {
5625 return this.doc.getLines(firstRow, lastRow);
5626 };
5627 this.getLength = function() {
5628 return this.doc.getLength();
5629 };
5630 this.getTextRange = function(range) {
5631 return this.doc.getTextRange(range || this.selection.getRange());
5632 };
5633 this.insert = function(position, text) {
5634 return this.doc.insert(position, text);
5635 };
5636 this.remove = function(range) {
5637 return this.doc.remove(range);
5638 };
5639 this.undoChanges = function(deltas, dontSelect) {
5640 if (!deltas.length)
5641 return;
5642
5643 this.$fromUndo = true;
5644 var lastUndoRange = null;
5645 for (var i = deltas.length - 1; i != -1; i--) {
5646 var delta = deltas[i];
5647 if (delta.group == "doc") {
5648 this.doc.revertDeltas(delta.deltas);
5649 lastUndoRange =
5650 this.$getUndoSelection(delta.deltas, true, lastUndoRange);
5651 } else {
5652 delta.deltas.forEach(function(foldDelta) {
5653 this.addFolds(foldDelta.folds);
5654 }, this);
5655 }
5656 }
5657 this.$fromUndo = false;
5658 lastUndoRange &&
5659 this.$undoSelect &&
5660 !dontSelect &&
5661 this.selection.setSelectionRange(lastUndoRange);
5662 return lastUndoRange;
5663 };
5664 this.redoChanges = function(deltas, dontSelect) {
5665 if (!deltas.length)
5666 return;
5667
5668 this.$fromUndo = true;
5669 var lastUndoRange = null;
5670 for (var i = 0; i < deltas.length; i++) {
5671 var delta = deltas[i];
5672 if (delta.group == "doc") {
5673 this.doc.applyDeltas(delta.deltas);
5674 lastUndoRange =
5675 this.$getUndoSelection(delta.deltas, false, lastUndoRange);
5676 }
5677 }
5678 this.$fromUndo = false;
5679 lastUndoRange &&
5680 this.$undoSelect &&
5681 !dontSelect &&
5682 this.selection.setSelectionRange(lastUndoRange);
5683 return lastUndoRange;
5684 };
5685 this.setUndoSelect = function(enable) {
5686 this.$undoSelect = enable;
5687 };
5688
5689 this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
5690 function isInsert(delta) {
5691 var insert =
5692 delta.action === "insertText" || delta.action === "insertLines";
5693 return isUndo ? !insert : insert;
5694 }
5695
5696 var delta = deltas[0];
5697 var range, point;
5698 var lastDeltaIsInsert = false;
5699 if (isInsert(delta)) {
5700 range = delta.range.clone();
5701 lastDeltaIsInsert = true;
5702 } else {
5703 range = Range.fromPoints(delta.range.start, delta.range.start);
5704 lastDeltaIsInsert = false;
5705 }
5706
5707 for (var i = 1; i < deltas.length; i++) {
5708 delta = deltas[i];
5709 if (isInsert(delta)) {
5710 point = delta.range.start;
5711 if (range.compare(point.row, point.column) == -1) {
5712 range.setStart(delta.range.start);
5713 }
5714 point = delta.range.end;
5715 if (range.compare(point.row, point.column) == 1) {
5716 range.setEnd(delta.range.end);
5717 }
5718 lastDeltaIsInsert = true;
5719 } else {
5720 point = delta.range.start;
5721 if (range.compare(point.row, point.column) == -1) {
5722 range =
5723 Range.fromPoints(delta.range.start, delta.range.start);
5724 }
5725 lastDeltaIsInsert = false;
5726 }
5727 }
5728 if (lastUndoRange != null) {
5729 var cmp = lastUndoRange.compareRange(range);
5730 if (cmp == 1) {
5731 range.setStart(lastUndoRange.start);
5732 } else if (cmp == -1) {
5733 range.setEnd(lastUndoRange.end);
5734 }
5735 }
5736
5737 return range;
5738 };
5739 this.replace = function(range, text) {
5740 return this.doc.replace(range, text);
5741 };
5742 this.moveText = function(fromRange, toPosition, copy) {
5743 var text = this.getTextRange(fromRange);
5744 var folds = this.getFoldsInRange(fromRange);
5745
5746 var toRange = Range.fromPoints(toPosition, toPosition);
5747 if (!copy) {
5748 this.remove(fromRange);
5749 var rowDiff = fromRange.start.row - fromRange.end.row;
5750 var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column;
5751 if (collDiff) {
5752 if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column)
5753 toRange.start.column += collDiff;
5754 if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column)
5755 toRange.end.column += collDiff;
5756 }
5757 if (rowDiff && toRange.start.row >= fromRange.end.row) {
5758 toRange.start.row += rowDiff;
5759 toRange.end.row += rowDiff;
5760 }
5761 }
5762
5763 this.insert(toRange.start, text);
5764 if (folds.length) {
5765 var oldStart = fromRange.start;
5766 var newStart = toRange.start;
5767 var rowDiff = newStart.row - oldStart.row;
5768 var collDiff = newStart.column - oldStart.column;
5769 this.addFolds(folds.map(function(x) {
5770 x = x.clone();
5771 if (x.start.row == oldStart.row)
5772 x.start.column += collDiff;
5773 if (x.end.row == oldStart.row)
5774 x.end.column += collDiff;
5775 x.start.row += rowDiff;
5776 x.end.row += rowDiff;
5777 return x;
5778 }));
5779 }
5780
5781 return toRange;
5782 };
5783 this.indentRows = function(startRow, endRow, indentString) {
5784 indentString = indentString.replace(/\t/g, this.getTabString());
5785 for (var row=startRow; row<=endRow; row++)
5786 this.insert({row: row, column:0}, indentString);
5787 };
5788 this.outdentRows = function (range) {
5789 var rowRange = range.collapseRows();
5790 var deleteRange = new Range(0, 0, 0, 0);
5791 var size = this.getTabSize();
5792
5793 for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {
5794 var line = this.getLine(i);
5795
5796 deleteRange.start.row = i;
5797 deleteRange.end.row = i;
5798 for (var j = 0; j < size; ++j)
5799 if (line.charAt(j) != ' ')
5800 break;
5801 if (j < size && line.charAt(j) == '\t') {
5802 deleteRange.start.column = j;
5803 deleteRange.end.column = j + 1;
5804 } else {
5805 deleteRange.start.column = 0;
5806 deleteRange.end.column = j;
5807 }
5808 this.remove(deleteRange);
5809 }
5810 };
5811
5812 this.$moveLines = function(firstRow, lastRow, dir) {
5813 firstRow = this.getRowFoldStart(firstRow);
5814 lastRow = this.getRowFoldEnd(lastRow);
5815 if (dir < 0) {
5816 var row = this.getRowFoldStart(firstRow + dir);
5817 if (row < 0) return 0;
5818 var diff = row-firstRow;
5819 } else if (dir > 0) {
5820 var row = this.getRowFoldEnd(lastRow + dir);
5821 if (row > this.doc.getLength()-1) return 0;
5822 var diff = row-lastRow;
5823 } else {
5824 firstRow = this.$clipRowToDocument(firstRow);
5825 lastRow = this.$clipRowToDocument(lastRow);
5826 var diff = lastRow - firstRow + 1;
5827 }
5828
5829 var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE);
5830 var folds = this.getFoldsInRange(range).map(function(x){
5831 x = x.clone();
5832 x.start.row += diff;
5833 x.end.row += diff;
5834 return x;
5835 });
5836
5837 var lines = dir == 0
5838 ? this.doc.getLines(firstRow, lastRow)
5839 : this.doc.removeLines(firstRow, lastRow);
5840 this.doc.insertLines(firstRow+diff, lines);
5841 folds.length && this.addFolds(folds);
5842 return diff;
5843 };
5844 this.moveLinesUp = function(firstRow, lastRow) {
5845 return this.$moveLines(firstRow, lastRow, -1);
5846 };
5847 this.moveLinesDown = function(firstRow, lastRow) {
5848 return this.$moveLines(firstRow, lastRow, 1);
5849 };
5850 this.duplicateLines = function(firstRow, lastRow) {
5851 return this.$moveLines(firstRow, lastRow, 0);
5852 };
5853
5854
5855 this.$clipRowToDocument = function(row) {
5856 return Math.max(0, Math.min(row, this.doc.getLength()-1));
5857 };
5858
5859 this.$clipColumnToRow = function(row, column) {
5860 if (column < 0)
5861 return 0;
5862 return Math.min(this.doc.getLine(row).length, column);
5863 };
5864
5865
5866 this.$clipPositionToDocument = function(row, column) {
5867 column = Math.max(0, column);
5868
5869 if (row < 0) {
5870 row = 0;
5871 column = 0;
5872 } else {
5873 var len = this.doc.getLength();
5874 if (row >= len) {
5875 row = len - 1;
5876 column = this.doc.getLine(len-1).length;
5877 } else {
5878 column = Math.min(this.doc.getLine(row).length, column);
5879 }
5880 }
5881
5882 return {
5883 row: row,
5884 column: column
5885 };
5886 };
5887
5888 this.$clipRangeToDocument = function(range) {
5889 if (range.start.row < 0) {
5890 range.start.row = 0;
5891 range.start.column = 0;
5892 } else {
5893 range.start.column = this.$clipColumnToRow(
5894 range.start.row,
5895 range.start.column
5896 );
5897 }
5898
5899 var len = this.doc.getLength() - 1;
5900 if (range.end.row > len) {
5901 range.end.row = len;
5902 range.end.column = this.doc.getLine(len).length;
5903 } else {
5904 range.end.column = this.$clipColumnToRow(
5905 range.end.row,
5906 range.end.column
5907 );
5908 }
5909 return range;
5910 };
5911 this.$wrapLimit = 80;
5912 this.$useWrapMode = false;
5913 this.$wrapLimitRange = {
5914 min : null,
5915 max : null
5916 };
5917 this.setUseWrapMode = function(useWrapMode) {
5918 if (useWrapMode != this.$useWrapMode) {
5919 this.$useWrapMode = useWrapMode;
5920 this.$modified = true;
5921 this.$resetRowCache(0);
5922 if (useWrapMode) {
5923 var len = this.getLength();
5924 this.$wrapData = [];
5925 for (var i = 0; i < len; i++) {
5926 this.$wrapData.push([]);
5927 }
5928 this.$updateWrapData(0, len - 1);
5929 }
5930
5931 this._emit("changeWrapMode");
5932 }
5933 };
5934 this.getUseWrapMode = function() {
5935 return this.$useWrapMode;
5936 };
5937 this.setWrapLimitRange = function(min, max) {
5938 if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
5939 this.$wrapLimitRange.min = min;
5940 this.$wrapLimitRange.max = max;
5941 this.$modified = true;
5942 this._emit("changeWrapMode");
5943 }
5944 };
5945 this.adjustWrapLimit = function(desiredLimit, $printMargin) {
5946 var limits = this.$wrapLimitRange
5947 if (limits.max < 0)
5948 limits = {min: $printMargin, max: $printMargin};
5949 var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);
5950 if (wrapLimit != this.$wrapLimit && wrapLimit > 1) {
5951 this.$wrapLimit = wrapLimit;
5952 this.$modified = true;
5953 if (this.$useWrapMode) {
5954 this.$updateWrapData(0, this.getLength() - 1);
5955 this.$resetRowCache(0);
5956 this._emit("changeWrapLimit");
5957 }
5958 return true;
5959 }
5960 return false;
5961 };
5962
5963 this.$constrainWrapLimit = function(wrapLimit, min, max) {
5964 if (min)
5965 wrapLimit = Math.max(min, wrapLimit);
5966
5967 if (max)
5968 wrapLimit = Math.min(max, wrapLimit);
5969
5970 return wrapLimit;
5971 };
5972 this.getWrapLimit = function() {
5973 return this.$wrapLimit;
5974 };
5975 this.setWrapLimit = function (limit) {
5976 this.setWrapLimitRange(limit, limit);
5977 };
5978 this.getWrapLimitRange = function() {
5979 return {
5980 min : this.$wrapLimitRange.min,
5981 max : this.$wrapLimitRange.max
5982 };
5983 };
5984
5985 this.$updateInternalDataOnChange = function(e) {
5986 var useWrapMode = this.$useWrapMode;
5987 var len;
5988 var action = e.data.action;
5989 var firstRow = e.data.range.start.row;
5990 var lastRow = e.data.range.end.row;
5991 var start = e.data.range.start;
5992 var end = e.data.range.end;
5993 var removedFolds = null;
5994
5995 if (action.indexOf("Lines") != -1) {
5996 if (action == "insertLines") {
5997 lastRow = firstRow + (e.data.lines.length);
5998 } else {
5999 lastRow = firstRow;
6000 }
6001 len = e.data.lines ? e.data.lines.length : lastRow - firstRow;
6002 } else {
6003 len = lastRow - firstRow;
6004 }
6005
6006 this.$updating = true;
6007 if (len != 0) {
6008 if (action.indexOf("remove") != -1) {
6009 this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
6010
6011 var foldLines = this.$foldData;
6012 removedFolds = this.getFoldsInRange(e.data.range);
6013 this.removeFolds(removedFolds);
6014
6015 var foldLine = this.getFoldLine(end.row);
6016 var idx = 0;
6017 if (foldLine) {
6018 foldLine.addRemoveChars(end.row, end.column, start.column - end.column);
6019 foldLine.shiftRow(-len);
6020
6021 var foldLineBefore = this.getFoldLine(firstRow);
6022 if (foldLineBefore && foldLineBefore !== foldLine) {
6023 foldLineBefore.merge(foldLine);
6024 foldLine = foldLineBefore;
6025 }
6026 idx = foldLines.indexOf(foldLine) + 1;
6027 }
6028
6029 for (idx; idx < foldLines.length; idx++) {
6030 var foldLine = foldLines[idx];
6031 if (foldLine.start.row >= end.row) {
6032 foldLine.shiftRow(-len);
6033 }
6034 }
6035
6036 lastRow = firstRow;
6037 } else {
6038 var args;
6039 if (useWrapMode) {
6040 args = [firstRow, 0];
6041 for (var i = 0; i < len; i++) args.push([]);
6042 this.$wrapData.splice.apply(this.$wrapData, args);
6043 } else {
6044 args = Array(len);
6045 args.unshift(firstRow, 0);
6046 this.$rowLengthCache.splice.apply(this.$rowLengthCache, args);
6047 }
6048 var foldLines = this.$foldData;
6049 var foldLine = this.getFoldLine(firstRow);
6050 var idx = 0;
6051 if (foldLine) {
6052 var cmp = foldLine.range.compareInside(start.row, start.column)
6053 if (cmp == 0) {
6054 foldLine = foldLine.split(start.row, start.column);
6055 foldLine.shiftRow(len);
6056 foldLine.addRemoveChars(
6057 lastRow, 0, end.column - start.column);
6058 } else
6059 if (cmp == -1) {
6060 foldLine.addRemoveChars(firstRow, 0, end.column - start.column);
6061 foldLine.shiftRow(len);
6062 }
6063 idx = foldLines.indexOf(foldLine) + 1;
6064 }
6065
6066 for (idx; idx < foldLines.length; idx++) {
6067 var foldLine = foldLines[idx];
6068 if (foldLine.start.row >= firstRow) {
6069 foldLine.shiftRow(len);
6070 }
6071 }
6072 }
6073 } else {
6074 len = Math.abs(e.data.range.start.column - e.data.range.end.column);
6075 if (action.indexOf("remove") != -1) {
6076 removedFolds = this.getFoldsInRange(e.data.range);
6077 this.removeFolds(removedFolds);
6078
6079 len = -len;
6080 }
6081 var foldLine = this.getFoldLine(firstRow);
6082 if (foldLine) {
6083 foldLine.addRemoveChars(firstRow, start.column, len);
6084 }
6085 }
6086
6087 if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
6088 console.error("doc.getLength() and $wrapData.length have to be the same!");
6089 }
6090 this.$updating = false;
6091
6092 if (useWrapMode)
6093 this.$updateWrapData(firstRow, lastRow);
6094 else
6095 this.$updateRowLengthCache(firstRow, lastRow);
6096
6097 return removedFolds;
6098 };
6099
6100 this.$updateRowLengthCache = function(firstRow, lastRow, b) {
6101 this.$rowLengthCache[firstRow] = null;
6102 this.$rowLengthCache[lastRow] = null;
6103 };
6104
6105 this.$updateWrapData = function(firstRow, lastRow) {
6106 var lines = this.doc.getAllLines();
6107 var tabSize = this.getTabSize();
6108 var wrapData = this.$wrapData;
6109 var wrapLimit = this.$wrapLimit;
6110 var tokens;
6111 var foldLine;
6112
6113 var row = firstRow;
6114 lastRow = Math.min(lastRow, lines.length - 1);
6115 while (row <= lastRow) {
6116 foldLine = this.getFoldLine(row, foldLine);
6117 if (!foldLine) {
6118 tokens = this.$getDisplayTokens(lang.stringTrimRight(lines[row]));
6119 wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
6120 row ++;
6121 } else {
6122 tokens = [];
6123 foldLine.walk(function(placeholder, row, column, lastColumn) {
6124 var walkTokens;
6125 if (placeholder != null) {
6126 walkTokens = this.$getDisplayTokens(
6127 placeholder, tokens.length);
6128 walkTokens[0] = PLACEHOLDER_START;
6129 for (var i = 1; i < walkTokens.length; i++) {
6130 walkTokens[i] = PLACEHOLDER_BODY;
6131 }
6132 } else {
6133 walkTokens = this.$getDisplayTokens(
6134 lines[row].substring(lastColumn, column),
6135 tokens.length);
6136 }
6137 tokens = tokens.concat(walkTokens);
6138 }.bind(this),
6139 foldLine.end.row,
6140 lines[foldLine.end.row].length + 1
6141 );
6142 while (tokens.length != 0 && tokens[tokens.length - 1] >= SPACE)
6143 tokens.pop();
6144
6145 wrapData[foldLine.start.row]
6146 = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
6147 row = foldLine.end.row + 1;
6148 }
6149 }
6150 };
6151 var CHAR = 1,
6152 CHAR_EXT = 2,
6153 PLACEHOLDER_START = 3,
6154 PLACEHOLDER_BODY = 4,
6155 PUNCTUATION = 9,
6156 SPACE = 10,
6157 TAB = 11,
6158 TAB_SPACE = 12;
6159
6160
6161 this.$computeWrapSplits = function(tokens, wrapLimit) {
6162 if (tokens.length == 0) {
6163 return [];
6164 }
6165
6166 var splits = [];
6167 var displayLength = tokens.length;
6168 var lastSplit = 0, lastDocSplit = 0;
6169
6170 function addSplit(screenPos) {
6171 var displayed = tokens.slice(lastSplit, screenPos);
6172 var len = displayed.length;
6173 displayed.join("").
6174 replace(/12/g, function() {
6175 len -= 1;
6176 }).
6177 replace(/2/g, function() {
6178 len -= 1;
6179 });
6180
6181 lastDocSplit += len;
6182 splits.push(lastDocSplit);
6183 lastSplit = screenPos;
6184 }
6185
6186 while (displayLength - lastSplit > wrapLimit) {
6187 var split = lastSplit + wrapLimit;
6188 if (tokens[split] >= SPACE) {
6189 while (tokens[split] >= SPACE) {
6190 split ++;
6191 }
6192 addSplit(split);
6193 continue;
6194 }
6195 if (tokens[split] == PLACEHOLDER_START
6196 || tokens[split] == PLACEHOLDER_BODY)
6197 {
6198 for (split; split != lastSplit - 1; split--) {
6199 if (tokens[split] == PLACEHOLDER_START) {
6200 break;
6201 }
6202 }
6203 if (split > lastSplit) {
6204 addSplit(split);
6205 continue;
6206 }
6207 split = lastSplit + wrapLimit;
6208 for (split; split < tokens.length; split++) {
6209 if (tokens[split] != PLACEHOLDER_BODY)
6210 {
6211 break;
6212 }
6213 }
6214 if (split == tokens.length) {
6215 break; // Breaks the while-loop.
6216 }
6217 addSplit(split);
6218 continue;
6219 }
6220 var minSplit = Math.max(split - 10, lastSplit - 1);
6221 while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
6222 split --;
6223 }
6224 while (split > minSplit && tokens[split] == PUNCTUATION) {
6225 split --;
6226 }
6227 if (split > minSplit) {
6228 addSplit(++split);
6229 continue;
6230 }
6231 split = lastSplit + wrapLimit;
6232 addSplit(split);
6233 }
6234 return splits;
6235 };
6236 this.$getDisplayTokens = function(str, offset) {
6237 var arr = [];
6238 var tabSize;
6239 offset = offset || 0;
6240
6241 for (var i = 0; i < str.length; i++) {
6242 var c = str.charCodeAt(i);
6243 if (c == 9) {
6244 tabSize = this.getScreenTabSize(arr.length + offset);
6245 arr.push(TAB);
6246 for (var n = 1; n < tabSize; n++) {
6247 arr.push(TAB_SPACE);
6248 }
6249 }
6250 else if (c == 32) {
6251 arr.push(SPACE);
6252 } else if((c > 39 && c < 48) || (c > 57 && c < 64)) {
6253 arr.push(PUNCTUATION);
6254 }
6255 else if (c >= 0x1100 && isFullWidth(c)) {
6256 arr.push(CHAR, CHAR_EXT);
6257 } else {
6258 arr.push(CHAR);
6259 }
6260 }
6261 return arr;
6262 };
6263 this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
6264 if (maxScreenColumn == 0)
6265 return [0, 0];
6266 if (maxScreenColumn == null)
6267 maxScreenColumn = Infinity;
6268 screenColumn = screenColumn || 0;
6269
6270 var c, column;
6271 for (column = 0; column < str.length; column++) {
6272 c = str.charCodeAt(column);
6273 if (c == 9) {
6274 screenColumn += this.getScreenTabSize(screenColumn);
6275 }
6276 else if (c >= 0x1100 && isFullWidth(c)) {
6277 screenColumn += 2;
6278 } else {
6279 screenColumn += 1;
6280 }
6281 if (screenColumn > maxScreenColumn) {
6282 break;
6283 }
6284 }
6285
6286 return [screenColumn, column];
6287 };
6288 this.getRowLength = function(row) {
6289 if (!this.$useWrapMode || !this.$wrapData[row]) {
6290 return 1;
6291 } else {
6292 return this.$wrapData[row].length + 1;
6293 }
6294 };
6295 this.getScreenLastRowColumn = function(screenRow) {
6296 var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
6297 return this.documentToScreenColumn(pos.row, pos.column);
6298 };
6299 this.getDocumentLastRowColumn = function(docRow, docColumn) {
6300 var screenRow = this.documentToScreenRow(docRow, docColumn);
6301 return this.getScreenLastRowColumn(screenRow);
6302 };
6303 this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
6304 var screenRow = this.documentToScreenRow(docRow, docColumn);
6305 return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
6306 };
6307 this.getRowSplitData = function(row) {
6308 if (!this.$useWrapMode) {
6309 return undefined;
6310 } else {
6311 return this.$wrapData[row];
6312 }
6313 };
6314 this.getScreenTabSize = function(screenColumn) {
6315 return this.$tabSize - screenColumn % this.$tabSize;
6316 };
6317
6318
6319 this.screenToDocumentRow = function(screenRow, screenColumn) {
6320 return this.screenToDocumentPosition(screenRow, screenColumn).row;
6321 };
6322
6323
6324 this.screenToDocumentColumn = function(screenRow, screenColumn) {
6325 return this.screenToDocumentPosition(screenRow, screenColumn).column;
6326 };
6327 this.screenToDocumentPosition = function(screenRow, screenColumn) {
6328 if (screenRow < 0)
6329 return {row: 0, column: 0};
6330
6331 var line;
6332 var docRow = 0;
6333 var docColumn = 0;
6334 var column;
6335 var row = 0;
6336 var rowLength = 0;
6337
6338 var rowCache = this.$screenRowCache;
6339 var i = this.$getRowCacheIndex(rowCache, screenRow);
6340 var l = rowCache.length;
6341 if (l && i >= 0) {
6342 var row = rowCache[i];
6343 var docRow = this.$docRowCache[i];
6344 var doCache = screenRow > rowCache[l - 1];
6345 } else {
6346 var doCache = !l;
6347 }
6348
6349 var maxRow = this.getLength() - 1;
6350 var foldLine = this.getNextFoldLine(docRow);
6351 var foldStart = foldLine ? foldLine.start.row : Infinity;
6352
6353 while (row <= screenRow) {
6354 rowLength = this.getRowLength(docRow);
6355 if (row + rowLength - 1 >= screenRow || docRow >= maxRow) {
6356 break;
6357 } else {
6358 row += rowLength;
6359 docRow++;
6360 if (docRow > foldStart) {
6361 docRow = foldLine.end.row+1;
6362 foldLine = this.getNextFoldLine(docRow, foldLine);
6363 foldStart = foldLine ? foldLine.start.row : Infinity;
6364 }
6365 }
6366
6367 if (doCache) {
6368 this.$docRowCache.push(docRow);
6369 this.$screenRowCache.push(row);
6370 }
6371 }
6372
6373 if (foldLine && foldLine.start.row <= docRow) {
6374 line = this.getFoldDisplayLine(foldLine);
6375 docRow = foldLine.start.row;
6376 } else if (row + rowLength <= screenRow || docRow > maxRow) {
6377 return {
6378 row: maxRow,
6379 column: this.getLine(maxRow).length
6380 }
6381 } else {
6382 line = this.getLine(docRow);
6383 foldLine = null;
6384 }
6385
6386 if (this.$useWrapMode) {
6387 var splits = this.$wrapData[docRow];
6388 if (splits) {
6389 column = splits[screenRow - row];
6390 if(screenRow > row && splits.length) {
6391 docColumn = splits[screenRow - row - 1] || splits[splits.length - 1];
6392 line = line.substring(docColumn);
6393 }
6394 }
6395 }
6396
6397 docColumn += this.$getStringScreenWidth(line, screenColumn)[1];
6398 if (this.$useWrapMode && docColumn >= column)
6399 docColumn = column - 1;
6400
6401 if (foldLine)
6402 return foldLine.idxToPosition(docColumn);
6403
6404 return {row: docRow, column: docColumn};
6405 };
6406 this.documentToScreenPosition = function(docRow, docColumn) {
6407 if (typeof docColumn === "undefined")
6408 var pos = this.$clipPositionToDocument(docRow.row, docRow.column);
6409 else
6410 pos = this.$clipPositionToDocument(docRow, docColumn);
6411
6412 docRow = pos.row;
6413 docColumn = pos.column;
6414
6415 var screenRow = 0;
6416 var foldStartRow = null;
6417 var fold = null;
6418 fold = this.getFoldAt(docRow, docColumn, 1);
6419 if (fold) {
6420 docRow = fold.start.row;
6421 docColumn = fold.start.column;
6422 }
6423
6424 var rowEnd, row = 0;
6425
6426
6427 var rowCache = this.$docRowCache;
6428 var i = this.$getRowCacheIndex(rowCache, docRow);
6429 var l = rowCache.length;
6430 if (l && i >= 0) {
6431 var row = rowCache[i];
6432 var screenRow = this.$screenRowCache[i];
6433 var doCache = docRow > rowCache[l - 1];
6434 } else {
6435 var doCache = !l;
6436 }
6437
6438 var foldLine = this.getNextFoldLine(row);
6439 var foldStart = foldLine ?foldLine.start.row :Infinity;
6440
6441 while (row < docRow) {
6442 if (row >= foldStart) {
6443 rowEnd = foldLine.end.row + 1;
6444 if (rowEnd > docRow)
6445 break;
6446 foldLine = this.getNextFoldLine(rowEnd, foldLine);
6447 foldStart = foldLine ?foldLine.start.row :Infinity;
6448 }
6449 else {
6450 rowEnd = row + 1;
6451 }
6452
6453 screenRow += this.getRowLength(row);
6454 row = rowEnd;
6455
6456 if (doCache) {
6457 this.$docRowCache.push(row);
6458 this.$screenRowCache.push(screenRow);
6459 }
6460 }
6461 var textLine = "";
6462 if (foldLine && row >= foldStart) {
6463 textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
6464 foldStartRow = foldLine.start.row;
6465 } else {
6466 textLine = this.getLine(docRow).substring(0, docColumn);
6467 foldStartRow = docRow;
6468 }
6469 if (this.$useWrapMode) {
6470 var wrapRow = this.$wrapData[foldStartRow];
6471 var screenRowOffset = 0;
6472 while (textLine.length >= wrapRow[screenRowOffset]) {
6473 screenRow ++;
6474 screenRowOffset++;
6475 }
6476 textLine = textLine.substring(
6477 wrapRow[screenRowOffset - 1] || 0, textLine.length
6478 );
6479 }
6480
6481 return {
6482 row: screenRow,
6483 column: this.$getStringScreenWidth(textLine)[0]
6484 };
6485 };
6486 this.documentToScreenColumn = function(row, docColumn) {
6487 return this.documentToScreenPosition(row, docColumn).column;
6488 };
6489 this.documentToScreenRow = function(docRow, docColumn) {
6490 return this.documentToScreenPosition(docRow, docColumn).row;
6491 };
6492 this.getScreenLength = function() {
6493 var screenRows = 0;
6494 var fold = null;
6495 if (!this.$useWrapMode) {
6496 screenRows = this.getLength();
6497 var foldData = this.$foldData;
6498 for (var i = 0; i < foldData.length; i++) {
6499 fold = foldData[i];
6500 screenRows -= fold.end.row - fold.start.row;
6501 }
6502 } else {
6503 var lastRow = this.$wrapData.length;
6504 var row = 0, i = 0;
6505 var fold = this.$foldData[i++];
6506 var foldStart = fold ? fold.start.row :Infinity;
6507
6508 while (row < lastRow) {
6509 screenRows += this.$wrapData[row].length + 1;
6510 row ++;
6511 if (row > foldStart) {
6512 row = fold.end.row+1;
6513 fold = this.$foldData[i++];
6514 foldStart = fold ?fold.start.row :Infinity;
6515 }
6516 }
6517 }
6518
6519 return screenRows;
6520 };
6521 function isFullWidth(c) {
6522 if (c < 0x1100)
6523 return false;
6524 return c >= 0x1100 && c <= 0x115F ||
6525 c >= 0x11A3 && c <= 0x11A7 ||
6526 c >= 0x11FA && c <= 0x11FF ||
6527 c >= 0x2329 && c <= 0x232A ||
6528 c >= 0x2E80 && c <= 0x2E99 ||
6529 c >= 0x2E9B && c <= 0x2EF3 ||
6530 c >= 0x2F00 && c <= 0x2FD5 ||
6531 c >= 0x2FF0 && c <= 0x2FFB ||
6532 c >= 0x3000 && c <= 0x303E ||
6533 c >= 0x3041 && c <= 0x3096 ||
6534 c >= 0x3099 && c <= 0x30FF ||
6535 c >= 0x3105 && c <= 0x312D ||
6536 c >= 0x3131 && c <= 0x318E ||
6537 c >= 0x3190 && c <= 0x31BA ||
6538 c >= 0x31C0 && c <= 0x31E3 ||
6539 c >= 0x31F0 && c <= 0x321E ||
6540 c >= 0x3220 && c <= 0x3247 ||
6541 c >= 0x3250 && c <= 0x32FE ||
6542 c >= 0x3300 && c <= 0x4DBF ||
6543 c >= 0x4E00 && c <= 0xA48C ||
6544 c >= 0xA490 && c <= 0xA4C6 ||
6545 c >= 0xA960 && c <= 0xA97C ||
6546 c >= 0xAC00 && c <= 0xD7A3 ||
6547 c >= 0xD7B0 && c <= 0xD7C6 ||
6548 c >= 0xD7CB && c <= 0xD7FB ||
6549 c >= 0xF900 && c <= 0xFAFF ||
6550 c >= 0xFE10 && c <= 0xFE19 ||
6551 c >= 0xFE30 && c <= 0xFE52 ||
6552 c >= 0xFE54 && c <= 0xFE66 ||
6553 c >= 0xFE68 && c <= 0xFE6B ||
6554 c >= 0xFF01 && c <= 0xFF60 ||
6555 c >= 0xFFE0 && c <= 0xFFE6;
6556 };
6557
6558 }).call(EditSession.prototype);
6559
6560 require("./edit_session/folding").Folding.call(EditSession.prototype);
6561 require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype);
6562
6563
6564 config.defineOptions(EditSession.prototype, "session", {
6565 wrap: {
6566 set: function(value) {
6567 if (!value || value == "off")
6568 value = false;
6569 else if (value == "free")
6570 value = true;
6571 else if (value == "printMargin")
6572 value = -1;
6573 else if (typeof value == "string")
6574 value = parseInt(value, 10) || false;
6575
6576 if (this.$wrap == value)
6577 return;
6578 if (!value) {
6579 this.setUseWrapMode(false);
6580 } else {
6581 var col = typeof value == "number" ? value : null;
6582 this.setWrapLimitRange(col, col);
6583 this.setUseWrapMode(true);
6584 }
6585 this.$wrap = value;
6586 },
6587 get: function() {
6588 return this.getUseWrapMode() ? this.getWrapLimitRange().min || "free" : "off";
6589 },
6590 handlesSet: true
6591 },
6592 firstLineNumber: {
6593 set: function() {this._emit("changeBreakpoint");},
6594 initialValue: 1
6595 },
6596 useWorker: {
6597 set: function(useWorker) {
6598 this.$useWorker = useWorker;
6599
6600 this.$stopWorker();
6601 if (useWorker)
6602 this.$startWorker();
6603 },
6604 initialValue: true
6605 },
6606 useSoftTabs: {initialValue: true},
6607 tabSize: {
6608 set: function(tabSize) {
6609 if (isNaN(tabSize) || this.$tabSize === tabSize) return;
6610
6611 this.$modified = true;
6612 this.$rowLengthCache = [];
6613 this.$tabSize = tabSize;
6614 this._emit("changeTabSize");
6615 },
6616 initialValue: 4,
6617 handlesSet: true
6618 },
6619 overwrite: {
6620 set: function(val) {this._emit("changeOverwrite");},
6621 initialValue: false
6622 },
6623 newLineMode: {
6624 set: function(val) {this.doc.setNewLineMode(val)},
6625 get: function() {return this.doc.getNewLineMode()},
6626 handlesSet: true
6627 }
6628 });
6629
6630 exports.EditSession = EditSession;
6631 });
6632
6633 define('ace/selection', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/event_emitter', 'ace/range'], function(require, exports, module) {
6634
6635
6636 var oop = require("./lib/oop");
6637 var lang = require("./lib/lang");
6638 var EventEmitter = require("./lib/event_emitter").EventEmitter;
6639 var Range = require("./range").Range;
6640 var Selection = function(session) {
6641 this.session = session;
6642 this.doc = session.getDocument();
6643
6644 this.clearSelection();
6645 this.lead = this.selectionLead = this.doc.createAnchor(0, 0);
6646 this.anchor = this.selectionAnchor = this.doc.createAnchor(0, 0);
6647
6648 var self = this;
6649 this.lead.on("change", function(e) {
6650 self._emit("changeCursor");
6651 if (!self.$isEmpty)
6652 self._emit("changeSelection");
6653 if (!self.$keepDesiredColumnOnChange && e.old.column != e.value.column)
6654 self.$desiredColumn = null;
6655 });
6656
6657 this.selectionAnchor.on("change", function() {
6658 if (!self.$isEmpty)
6659 self._emit("changeSelection");
6660 });
6661 };
6662
6663 (function() {
6664
6665 oop.implement(this, EventEmitter);
6666 this.isEmpty = function() {
6667 return (this.$isEmpty || (
6668 this.anchor.row == this.lead.row &&
6669 this.anchor.column == this.lead.column
6670 ));
6671 };
6672 this.isMultiLine = function() {
6673 if (this.isEmpty()) {
6674 return false;
6675 }
6676
6677 return this.getRange().isMultiLine();
6678 };
6679 this.getCursor = function() {
6680 return this.lead.getPosition();
6681 };
6682 this.setSelectionAnchor = function(row, column) {
6683 this.anchor.setPosition(row, column);
6684
6685 if (this.$isEmpty) {
6686 this.$isEmpty = false;
6687 this._emit("changeSelection");
6688 }
6689 };
6690 this.getSelectionAnchor = function() {
6691 if (this.$isEmpty)
6692 return this.getSelectionLead()
6693 else
6694 return this.anchor.getPosition();
6695 };
6696 this.getSelectionLead = function() {
6697 return this.lead.getPosition();
6698 };
6699 this.shiftSelection = function(columns) {
6700 if (this.$isEmpty) {
6701 this.moveCursorTo(this.lead.row, this.lead.column + columns);
6702 return;
6703 };
6704
6705 var anchor = this.getSelectionAnchor();
6706 var lead = this.getSelectionLead();
6707
6708 var isBackwards = this.isBackwards();
6709
6710 if (!isBackwards || anchor.column !== 0)
6711 this.setSelectionAnchor(anchor.row, anchor.column + columns);
6712
6713 if (isBackwards || lead.column !== 0) {
6714 this.$moveSelection(function() {
6715 this.moveCursorTo(lead.row, lead.column + columns);
6716 });
6717 }
6718 };
6719 this.isBackwards = function() {
6720 var anchor = this.anchor;
6721 var lead = this.lead;
6722 return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
6723 };
6724 this.getRange = function() {
6725 var anchor = this.anchor;
6726 var lead = this.lead;
6727
6728 if (this.isEmpty())
6729 return Range.fromPoints(lead, lead);
6730
6731 if (this.isBackwards()) {
6732 return Range.fromPoints(lead, anchor);
6733 }
6734 else {
6735 return Range.fromPoints(anchor, lead);
6736 }
6737 };
6738 this.clearSelection = function() {
6739 if (!this.$isEmpty) {
6740 this.$isEmpty = true;
6741 this._emit("changeSelection");
6742 }
6743 };
6744 this.selectAll = function() {
6745 var lastRow = this.doc.getLength() - 1;
6746 this.setSelectionAnchor(0, 0);
6747 this.moveCursorTo(lastRow, this.doc.getLine(lastRow).length);
6748 };
6749 this.setRange =
6750 this.setSelectionRange = function(range, reverse) {
6751 if (reverse) {
6752 this.setSelectionAnchor(range.end.row, range.end.column);
6753 this.selectTo(range.start.row, range.start.column);
6754 } else {
6755 this.setSelectionAnchor(range.start.row, range.start.column);
6756 this.selectTo(range.end.row, range.end.column);
6757 }
6758 this.$desiredColumn = null;
6759 };
6760
6761 this.$moveSelection = function(mover) {
6762 var lead = this.lead;
6763 if (this.$isEmpty)
6764 this.setSelectionAnchor(lead.row, lead.column);
6765
6766 mover.call(this);
6767 };
6768 this.selectTo = function(row, column) {
6769 this.$moveSelection(function() {
6770 this.moveCursorTo(row, column);
6771 });
6772 };
6773 this.selectToPosition = function(pos) {
6774 this.$moveSelection(function() {
6775 this.moveCursorToPosition(pos);
6776 });
6777 };
6778 this.selectUp = function() {
6779 this.$moveSelection(this.moveCursorUp);
6780 };
6781 this.selectDown = function() {
6782 this.$moveSelection(this.moveCursorDown);
6783 };
6784 this.selectRight = function() {
6785 this.$moveSelection(this.moveCursorRight);
6786 };
6787 this.selectLeft = function() {
6788 this.$moveSelection(this.moveCursorLeft);
6789 };
6790 this.selectLineStart = function() {
6791 this.$moveSelection(this.moveCursorLineStart);
6792 };
6793 this.selectLineEnd = function() {
6794 this.$moveSelection(this.moveCursorLineEnd);
6795 };
6796 this.selectFileEnd = function() {
6797 this.$moveSelection(this.moveCursorFileEnd);
6798 };
6799 this.selectFileStart = function() {
6800 this.$moveSelection(this.moveCursorFileStart);
6801 };
6802 this.selectWordRight = function() {
6803 this.$moveSelection(this.moveCursorWordRight);
6804 };
6805 this.selectWordLeft = function() {
6806 this.$moveSelection(this.moveCursorWordLeft);
6807 };
6808 this.getWordRange = function(row, column) {
6809 if (typeof column == "undefined") {
6810 var cursor = row || this.lead;
6811 row = cursor.row;
6812 column = cursor.column;
6813 }
6814 return this.session.getWordRange(row, column);
6815 };
6816 this.selectWord = function() {
6817 this.setSelectionRange(this.getWordRange());
6818 };
6819 this.selectAWord = function() {
6820 var cursor = this.getCursor();
6821 var range = this.session.getAWordRange(cursor.row, cursor.column);
6822 this.setSelectionRange(range);
6823 };
6824
6825 this.getLineRange = function(row, excludeLastChar) {
6826 var rowStart = typeof row == "number" ? row : this.lead.row;
6827 var rowEnd;
6828
6829 var foldLine = this.session.getFoldLine(rowStart);
6830 if (foldLine) {
6831 rowStart = foldLine.start.row;
6832 rowEnd = foldLine.end.row;
6833 } else {
6834 rowEnd = rowStart;
6835 }
6836 if (excludeLastChar)
6837 return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length);
6838 else
6839 return new Range(rowStart, 0, rowEnd + 1, 0);
6840 };
6841 this.selectLine = function() {
6842 this.setSelectionRange(this.getLineRange());
6843 };
6844 this.moveCursorUp = function() {
6845 this.moveCursorBy(-1, 0);
6846 };
6847 this.moveCursorDown = function() {
6848 this.moveCursorBy(1, 0);
6849 };
6850 this.moveCursorLeft = function() {
6851 var cursor = this.lead.getPosition(),
6852 fold;
6853
6854 if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {
6855 this.moveCursorTo(fold.start.row, fold.start.column);
6856 } else if (cursor.column == 0) {
6857 if (cursor.row > 0) {
6858 this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
6859 }
6860 }
6861 else {
6862 var tabSize = this.session.getTabSize();
6863 if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
6864 this.moveCursorBy(0, -tabSize);
6865 else
6866 this.moveCursorBy(0, -1);
6867 }
6868 };
6869 this.moveCursorRight = function() {
6870 var cursor = this.lead.getPosition(),
6871 fold;
6872 if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
6873 this.moveCursorTo(fold.end.row, fold.end.column);
6874 }
6875 else if (this.lead.column == this.doc.getLine(this.lead.row).length) {
6876 if (this.lead.row < this.doc.getLength() - 1) {
6877 this.moveCursorTo(this.lead.row + 1, 0);
6878 }
6879 }
6880 else {
6881 var tabSize = this.session.getTabSize();
6882 var cursor = this.lead;
6883 if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize)
6884 this.moveCursorBy(0, tabSize);
6885 else
6886 this.moveCursorBy(0, 1);
6887 }
6888 };
6889 this.moveCursorLineStart = function() {
6890 var row = this.lead.row;
6891 var column = this.lead.column;
6892 var screenRow = this.session.documentToScreenRow(row, column);
6893 var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);
6894 var beforeCursor = this.session.getDisplayLine(
6895 row, null, firstColumnPosition.row,
6896 firstColumnPosition.column
6897 );
6898
6899 var leadingSpace = beforeCursor.match(/^\s*/);
6900 if (leadingSpace[0].length != column && !this.session.$useEmacsStyleLineStart)
6901 firstColumnPosition.column += leadingSpace[0].length;
6902 this.moveCursorToPosition(firstColumnPosition);
6903 };
6904 this.moveCursorLineEnd = function() {
6905 var lead = this.lead;
6906 var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
6907 if (this.lead.column == lineEnd.column) {
6908 var line = this.session.getLine(lineEnd.row);
6909 if (lineEnd.column == line.length) {
6910 var textEnd = line.search(/\s+$/);
6911 if (textEnd > 0)
6912 lineEnd.column = textEnd;
6913 }
6914 }
6915
6916 this.moveCursorTo(lineEnd.row, lineEnd.column);
6917 };
6918 this.moveCursorFileEnd = function() {
6919 var row = this.doc.getLength() - 1;
6920 var column = this.doc.getLine(row).length;
6921 this.moveCursorTo(row, column);
6922 };
6923 this.moveCursorFileStart = function() {
6924 this.moveCursorTo(0, 0);
6925 };
6926 this.moveCursorLongWordRight = function() {
6927 var row = this.lead.row;
6928 var column = this.lead.column;
6929 var line = this.doc.getLine(row);
6930 var rightOfCursor = line.substring(column);
6931
6932 var match;
6933 this.session.nonTokenRe.lastIndex = 0;
6934 this.session.tokenRe.lastIndex = 0;
6935 var fold = this.session.getFoldAt(row, column, 1);
6936 if (fold) {
6937 this.moveCursorTo(fold.end.row, fold.end.column);
6938 return;
6939 }
6940 if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
6941 column += this.session.nonTokenRe.lastIndex;
6942 this.session.nonTokenRe.lastIndex = 0;
6943 rightOfCursor = line.substring(column);
6944 }
6945 if (column >= line.length) {
6946 this.moveCursorTo(row, line.length);
6947 this.moveCursorRight();
6948 if (row < this.doc.getLength() - 1)
6949 this.moveCursorWordRight();
6950 return;
6951 }
6952 if (match = this.session.tokenRe.exec(rightOfCursor)) {
6953 column += this.session.tokenRe.lastIndex;
6954 this.session.tokenRe.lastIndex = 0;
6955 }
6956
6957 this.moveCursorTo(row, column);
6958 };
6959 this.moveCursorLongWordLeft = function() {
6960 var row = this.lead.row;
6961 var column = this.lead.column;
6962 var fold;
6963 if (fold = this.session.getFoldAt(row, column, -1)) {
6964 this.moveCursorTo(fold.start.row, fold.start.column);
6965 return;
6966 }
6967
6968 var str = this.session.getFoldStringAt(row, column, -1);
6969 if (str == null) {
6970 str = this.doc.getLine(row).substring(0, column)
6971 }
6972
6973 var leftOfCursor = lang.stringReverse(str);
6974 var match;
6975 this.session.nonTokenRe.lastIndex = 0;
6976 this.session.tokenRe.lastIndex = 0;
6977 if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
6978 column -= this.session.nonTokenRe.lastIndex;
6979 leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);
6980 this.session.nonTokenRe.lastIndex = 0;
6981 }
6982 if (column <= 0) {
6983 this.moveCursorTo(row, 0);
6984 this.moveCursorLeft();
6985 if (row > 0)
6986 this.moveCursorWordLeft();
6987 return;
6988 }
6989 if (match = this.session.tokenRe.exec(leftOfCursor)) {
6990 column -= this.session.tokenRe.lastIndex;
6991 this.session.tokenRe.lastIndex = 0;
6992 }
6993
6994 this.moveCursorTo(row, column);
6995 };
6996
6997 this.$shortWordEndIndex = function(rightOfCursor) {
6998 var match, index = 0, ch;
6999 var whitespaceRe = /\s/;
7000 var tokenRe = this.session.tokenRe;
7001
7002 tokenRe.lastIndex = 0;
7003 if (match = this.session.tokenRe.exec(rightOfCursor)) {
7004 index = this.session.tokenRe.lastIndex;
7005 } else {
7006 while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))
7007 index ++;
7008
7009 if (index <= 1) {
7010 tokenRe.lastIndex = 0;
7011 while ((ch = rightOfCursor[index]) && !tokenRe.test(ch)) {
7012 tokenRe.lastIndex = 0;
7013 index ++;
7014 if (whitespaceRe.test(ch)) {
7015 if (index > 2) {
7016 index--
7017 break;
7018 } else {
7019 while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))
7020 index ++;
7021 if (index > 2)
7022 break
7023 }
7024 }
7025 }
7026 }
7027 }
7028 tokenRe.lastIndex = 0;
7029
7030 return index;
7031 };
7032
7033 this.moveCursorShortWordRight = function() {
7034 var row = this.lead.row;
7035 var column = this.lead.column;
7036 var line = this.doc.getLine(row);
7037 var rightOfCursor = line.substring(column);
7038
7039 var fold = this.session.getFoldAt(row, column, 1);
7040 if (fold)
7041 return this.moveCursorTo(fold.end.row, fold.end.column);
7042
7043 if (column == line.length) {
7044 var l = this.doc.getLength();
7045 do {
7046 row++;
7047 rightOfCursor = this.doc.getLine(row)
7048 } while (row < l && /^\s*$/.test(rightOfCursor))
7049
7050 if (!/^\s+/.test(rightOfCursor))
7051 rightOfCursor = ""
7052 column = 0;
7053 }
7054
7055 var index = this.$shortWordEndIndex(rightOfCursor);
7056
7057 this.moveCursorTo(row, column + index);
7058 };
7059
7060 this.moveCursorShortWordLeft = function() {
7061 var row = this.lead.row;
7062 var column = this.lead.column;
7063
7064 var fold;
7065 if (fold = this.session.getFoldAt(row, column, -1))
7066 return this.moveCursorTo(fold.start.row, fold.start.column);
7067
7068 var line = this.session.getLine(row).substring(0, column);
7069 if (column == 0) {
7070 do {
7071 row--;
7072 line = this.doc.getLine(row);
7073 } while (row > 0 && /^\s*$/.test(line))
7074
7075 column = line.length;
7076 if (!/\s+$/.test(line))
7077 line = ""
7078 }
7079
7080 var leftOfCursor = lang.stringReverse(line);
7081 var index = this.$shortWordEndIndex(leftOfCursor);
7082
7083 return this.moveCursorTo(row, column - index);
7084 };
7085
7086 this.moveCursorWordRight = function() {
7087 if (this.session.$selectLongWords)
7088 this.moveCursorLongWordRight();
7089 else
7090 this.moveCursorShortWordRight();
7091 };
7092
7093 this.moveCursorWordLeft = function() {
7094 if (this.session.$selectLongWords)
7095 this.moveCursorLongWordLeft();
7096 else
7097 this.moveCursorShortWordLeft();
7098 };
7099 this.moveCursorBy = function(rows, chars) {
7100 var screenPos = this.session.documentToScreenPosition(
7101 this.lead.row,
7102 this.lead.column
7103 );
7104
7105 if (chars === 0) {
7106 if (this.$desiredColumn)
7107 screenPos.column = this.$desiredColumn;
7108 else
7109 this.$desiredColumn = screenPos.column;
7110 }
7111
7112 var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column);
7113 this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
7114 };
7115 this.moveCursorToPosition = function(position) {
7116 this.moveCursorTo(position.row, position.column);
7117 };
7118 this.moveCursorTo = function(row, column, keepDesiredColumn) {
7119 var fold = this.session.getFoldAt(row, column, 1);
7120 if (fold) {
7121 row = fold.start.row;
7122 column = fold.start.column;
7123 }
7124
7125 this.$keepDesiredColumnOnChange = true;
7126 this.lead.setPosition(row, column);
7127 this.$keepDesiredColumnOnChange = false;
7128
7129 if (!keepDesiredColumn)
7130 this.$desiredColumn = null;
7131 };
7132 this.moveCursorToScreen = function(row, column, keepDesiredColumn) {
7133 var pos = this.session.screenToDocumentPosition(row, column);
7134 this.moveCursorTo(pos.row, pos.column, keepDesiredColumn);
7135 };
7136 this.detach = function() {
7137 this.lead.detach();
7138 this.anchor.detach();
7139 this.session = this.doc = null;
7140 }
7141
7142 this.fromOrientedRange = function(range) {
7143 this.setSelectionRange(range, range.cursor == range.start);
7144 this.$desiredColumn = range.desiredColumn || this.$desiredColumn;
7145 }
7146
7147 this.toOrientedRange = function(range) {
7148 var r = this.getRange();
7149 if (range) {
7150 range.start.column = r.start.column;
7151 range.start.row = r.start.row;
7152 range.end.column = r.end.column;
7153 range.end.row = r.end.row;
7154 } else {
7155 range = r;
7156 }
7157
7158 range.cursor = this.isBackwards() ? range.start : range.end;
7159 range.desiredColumn = this.$desiredColumn;
7160 return range;
7161 }
7162
7163 }).call(Selection.prototype);
7164
7165 exports.Selection = Selection;
7166 });
7167
7168 define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
7169
7170 var comparePoints = function(p1, p2) {
7171 return p1.row - p2.row || p1.column - p2.column;
7172 };
7173 var Range = function(startRow, startColumn, endRow, endColumn) {
7174 this.start = {
7175 row: startRow,
7176 column: startColumn
7177 };
7178
7179 this.end = {
7180 row: endRow,
7181 column: endColumn
7182 };
7183 };
7184
7185 (function() {
7186 this.isEqual = function(range) {
7187 return this.start.row === range.start.row &&
7188 this.end.row === range.end.row &&
7189 this.start.column === range.start.column &&
7190 this.end.column === range.end.column;
7191 };
7192 this.toString = function() {
7193 return ("Range: [" + this.start.row + "/" + this.start.column +
7194 "] -> [" + this.end.row + "/" + this.end.column + "]");
7195 };
7196
7197 this.contains = function(row, column) {
7198 return this.compare(row, column) == 0;
7199 };
7200 this.compareRange = function(range) {
7201 var cmp,
7202 end = range.end,
7203 start = range.start;
7204
7205 cmp = this.compare(end.row, end.column);
7206 if (cmp == 1) {
7207 cmp = this.compare(start.row, start.column);
7208 if (cmp == 1) {
7209 return 2;
7210 } else if (cmp == 0) {
7211 return 1;
7212 } else {
7213 return 0;
7214 }
7215 } else if (cmp == -1) {
7216 return -2;
7217 } else {
7218 cmp = this.compare(start.row, start.column);
7219 if (cmp == -1) {
7220 return -1;
7221 } else if (cmp == 1) {
7222 return 42;
7223 } else {
7224 return 0;
7225 }
7226 }
7227 };
7228 this.comparePoint = function(p) {
7229 return this.compare(p.row, p.column);
7230 };
7231 this.containsRange = function(range) {
7232 return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
7233 };
7234 this.intersects = function(range) {
7235 var cmp = this.compareRange(range);
7236 return (cmp == -1 || cmp == 0 || cmp == 1);
7237 };
7238 this.isEnd = function(row, column) {
7239 return this.end.row == row && this.end.column == column;
7240 };
7241 this.isStart = function(row, column) {
7242 return this.start.row == row && this.start.column == column;
7243 };
7244 this.setStart = function(row, column) {
7245 if (typeof row == "object") {
7246 this.start.column = row.column;
7247 this.start.row = row.row;
7248 } else {
7249 this.start.row = row;
7250 this.start.column = column;
7251 }
7252 };
7253 this.setEnd = function(row, column) {
7254 if (typeof row == "object") {
7255 this.end.column = row.column;
7256 this.end.row = row.row;
7257 } else {
7258 this.end.row = row;
7259 this.end.column = column;
7260 }
7261 };
7262 this.inside = function(row, column) {
7263 if (this.compare(row, column) == 0) {
7264 if (this.isEnd(row, column) || this.isStart(row, column)) {
7265 return false;
7266 } else {
7267 return true;
7268 }
7269 }
7270 return false;
7271 };
7272 this.insideStart = function(row, column) {
7273 if (this.compare(row, column) == 0) {
7274 if (this.isEnd(row, column)) {
7275 return false;
7276 } else {
7277 return true;
7278 }
7279 }
7280 return false;
7281 };
7282 this.insideEnd = function(row, column) {
7283 if (this.compare(row, column) == 0) {
7284 if (this.isStart(row, column)) {
7285 return false;
7286 } else {
7287 return true;
7288 }
7289 }
7290 return false;
7291 };
7292 this.compare = function(row, column) {
7293 if (!this.isMultiLine()) {
7294 if (row === this.start.row) {
7295 return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
7296 };
7297 }
7298
7299 if (row < this.start.row)
7300 return -1;
7301
7302 if (row > this.end.row)
7303 return 1;
7304
7305 if (this.start.row === row)
7306 return column >= this.start.column ? 0 : -1;
7307
7308 if (this.end.row === row)
7309 return column <= this.end.column ? 0 : 1;
7310
7311 return 0;
7312 };
7313 this.compareStart = function(row, column) {
7314 if (this.start.row == row && this.start.column == column) {
7315 return -1;
7316 } else {
7317 return this.compare(row, column);
7318 }
7319 };
7320 this.compareEnd = function(row, column) {
7321 if (this.end.row == row && this.end.column == column) {
7322 return 1;
7323 } else {
7324 return this.compare(row, column);
7325 }
7326 };
7327 this.compareInside = function(row, column) {
7328 if (this.end.row == row && this.end.column == column) {
7329 return 1;
7330 } else if (this.start.row == row && this.start.column == column) {
7331 return -1;
7332 } else {
7333 return this.compare(row, column);
7334 }
7335 };
7336 this.clipRows = function(firstRow, lastRow) {
7337 if (this.end.row > lastRow)
7338 var end = {row: lastRow + 1, column: 0};
7339 else if (this.end.row < firstRow)
7340 var end = {row: firstRow, column: 0};
7341
7342 if (this.start.row > lastRow)
7343 var start = {row: lastRow + 1, column: 0};
7344 else if (this.start.row < firstRow)
7345 var start = {row: firstRow, column: 0};
7346
7347 return Range.fromPoints(start || this.start, end || this.end);
7348 };
7349 this.extend = function(row, column) {
7350 var cmp = this.compare(row, column);
7351
7352 if (cmp == 0)
7353 return this;
7354 else if (cmp == -1)
7355 var start = {row: row, column: column};
7356 else
7357 var end = {row: row, column: column};
7358
7359 return Range.fromPoints(start || this.start, end || this.end);
7360 };
7361
7362 this.isEmpty = function() {
7363 return (this.start.row === this.end.row && this.start.column === this.end.column);
7364 };
7365 this.isMultiLine = function() {
7366 return (this.start.row !== this.end.row);
7367 };
7368 this.clone = function() {
7369 return Range.fromPoints(this.start, this.end);
7370 };
7371 this.collapseRows = function() {
7372 if (this.end.column == 0)
7373 return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
7374 else
7375 return new Range(this.start.row, 0, this.end.row, 0)
7376 };
7377 this.toScreenRange = function(session) {
7378 var screenPosStart = session.documentToScreenPosition(this.start);
7379 var screenPosEnd = session.documentToScreenPosition(this.end);
7380
7381 return new Range(
7382 screenPosStart.row, screenPosStart.column,
7383 screenPosEnd.row, screenPosEnd.column
7384 );
7385 };
7386 this.moveBy = function(row, column) {
7387 this.start.row += row;
7388 this.start.column += column;
7389 this.end.row += row;
7390 this.end.column += column;
7391 };
7392
7393 }).call(Range.prototype);
7394 Range.fromPoints = function(start, end) {
7395 return new Range(start.row, start.column, end.row, end.column);
7396 };
7397 Range.comparePoints = comparePoints;
7398
7399 Range.comparePoints = function(p1, p2) {
7400 return p1.row - p2.row || p1.column - p2.column;
7401 };
7402
7403
7404 exports.Range = Range;
7405 });
7406
7407 define('ace/mode/text', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/behaviour', 'ace/unicode', 'ace/lib/lang', 'ace/token_iterator', 'ace/range'], function(require, exports, module) {
7408
7409
7410 var Tokenizer = require("../tokenizer").Tokenizer;
7411 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
7412 var Behaviour = require("./behaviour").Behaviour;
7413 var unicode = require("../unicode");
7414 var lang = require("../lib/lang");
7415 var TokenIterator = require("../token_iterator").TokenIterator;
7416 var Range = require("../range").Range;
7417
7418 var Mode = function() {
7419 this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules());
7420 this.$behaviour = new Behaviour();
7421 };
7422
7423 (function() {
7424
7425 this.tokenRe = new RegExp("^["
7426 + unicode.packages.L
7427 + unicode.packages.Mn + unicode.packages.Mc
7428 + unicode.packages.Nd
7429 + unicode.packages.Pc + "\\$_]+", "g"
7430 );
7431
7432 this.nonTokenRe = new RegExp("^(?:[^"
7433 + unicode.packages.L
7434 + unicode.packages.Mn + unicode.packages.Mc
7435 + unicode.packages.Nd
7436 + unicode.packages.Pc + "\\$_]|\s])+", "g"
7437 );
7438
7439 this.getTokenizer = function() {
7440 return this.$tokenizer;
7441 };
7442
7443 this.lineCommentStart = "";
7444 this.blockComment = "";
7445
7446 this.toggleCommentLines = function(state, session, startRow, endRow) {
7447 var doc = session.doc;
7448
7449 var ignoreBlankLines = true;
7450 var shouldRemove = true;
7451 var minIndent = Infinity;
7452 var tabSize = session.getTabSize();
7453 var insertAtTabStop = false;
7454
7455 if (!this.lineCommentStart) {
7456 if (!this.blockComment)
7457 return false;
7458 var lineCommentStart = this.blockComment.start;
7459 var lineCommentEnd = this.blockComment.end;
7460 var regexpStart = new RegExp("^(\\s*)(?:" + lang.escapeRegExp(lineCommentStart) + ")");
7461 var regexpEnd = new RegExp("(?:" + lang.escapeRegExp(lineCommentEnd) + ")\\s*$");
7462
7463 var comment = function(line, i) {
7464 if (testRemove(line, i))
7465 return;
7466 if (!ignoreBlankLines || /\S/.test(line)) {
7467 doc.insertInLine({row: i, column: line.length}, lineCommentEnd);
7468 doc.insertInLine({row: i, column: minIndent}, lineCommentStart);
7469 }
7470 };
7471
7472 var uncomment = function(line, i) {
7473 var m;
7474 if (m = line.match(regexpEnd))
7475 doc.removeInLine(i, line.length - m[0].length, line.length);
7476 if (m = line.match(regexpStart))
7477 doc.removeInLine(i, m[1].length, m[0].length);
7478 };
7479
7480 var testRemove = function(line, row) {
7481 if (regexpStart.test(line))
7482 return true;
7483 var tokens = session.getTokens(row);
7484 for (var i = 0; i < tokens.length; i++) {
7485 if (tokens[i].type === 'comment')
7486 return true;
7487 }
7488 };
7489 } else {
7490 if (Array.isArray(this.lineCommentStart)) {
7491 var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join("|");
7492 var lineCommentStart = this.lineCommentStart[0];
7493 } else {
7494 var regexpStart = lang.escapeRegExp(this.lineCommentStart);
7495 var lineCommentStart = this.lineCommentStart;
7496 }
7497 regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?");
7498
7499 insertAtTabStop = session.getUseSoftTabs();
7500
7501 var uncomment = function(line, i) {
7502 var m = line.match(regexpStart);
7503 if (!m) return;
7504 var start = m[1].length, end = m[0].length;
7505 if (!shouldInsertSpace(line, start, end) && m[0][end - 1] == " ")
7506 end--;
7507 doc.removeInLine(i, start, end);
7508 };
7509 var commentWithSpace = lineCommentStart + " ";
7510 var comment = function(line, i) {
7511 if (!ignoreBlankLines || /\S/.test(line)) {
7512 if (shouldInsertSpace(line, minIndent, minIndent))
7513 doc.insertInLine({row: i, column: minIndent}, commentWithSpace);
7514 else
7515 doc.insertInLine({row: i, column: minIndent}, lineCommentStart);
7516 }
7517 };
7518 var testRemove = function(line, i) {
7519 return regexpStart.test(line);
7520 };
7521
7522 var shouldInsertSpace = function(line, before, after) {
7523 var spaces = 0;
7524 while (before-- && line.charAt(before) == " ")
7525 spaces++;
7526 if (spaces % tabSize != 0)
7527 return false;
7528 var spaces = 0;
7529 while (line.charAt(after++) == " ")
7530 spaces++;
7531 if (tabSize > 2)
7532 return spaces % tabSize != tabSize - 1;
7533 else
7534 return spaces % tabSize == 0;
7535 return true;
7536 };
7537 }
7538
7539 function iter(fun) {
7540 for (var i = startRow; i <= endRow; i++)
7541 fun(doc.getLine(i), i);
7542 }
7543
7544
7545 var minEmptyLength = Infinity;
7546 iter(function(line, i) {
7547 var indent = line.search(/\S/);
7548 if (indent !== -1) {
7549 if (indent < minIndent)
7550 minIndent = indent;
7551 if (shouldRemove && !testRemove(line, i))
7552 shouldRemove = false;
7553 } else if (minEmptyLength > line.length) {
7554 minEmptyLength = line.length;
7555 }
7556 });
7557
7558 if (minIndent == Infinity) {
7559 minIndent = minEmptyLength;
7560 ignoreBlankLines = false;
7561 shouldRemove = false;
7562 }
7563
7564 if (insertAtTabStop && minIndent % tabSize != 0)
7565 minIndent = Math.floor(minIndent / tabSize) * tabSize;
7566
7567 iter(shouldRemove ? uncomment : comment);
7568 };
7569
7570 this.toggleBlockComment = function(state, session, range, cursor) {
7571 var comment = this.blockComment;
7572 if (!comment)
7573 return;
7574 if (!comment.start && comment[0])
7575 comment = comment[0];
7576
7577 var iterator = new TokenIterator(session, cursor.row, cursor.column);
7578 var token = iterator.getCurrentToken();
7579
7580 var sel = session.selection;
7581 var initialRange = session.selection.toOrientedRange();
7582 var startRow, colDiff;
7583
7584 if (token && /comment/.test(token.type)) {
7585 var startRange, endRange;
7586 while (token && /comment/.test(token.type)) {
7587 var i = token.value.indexOf(comment.start);
7588 if (i != -1) {
7589 var row = iterator.getCurrentTokenRow();
7590 var column = iterator.getCurrentTokenColumn() + i;
7591 startRange = new Range(row, column, row, column + comment.start.length);
7592 break
7593 }
7594 token = iterator.stepBackward();
7595 };
7596
7597 var iterator = new TokenIterator(session, cursor.row, cursor.column);
7598 var token = iterator.getCurrentToken();
7599 while (token && /comment/.test(token.type)) {
7600 var i = token.value.indexOf(comment.end);
7601 if (i != -1) {
7602 var row = iterator.getCurrentTokenRow();
7603 var column = iterator.getCurrentTokenColumn() + i;
7604 endRange = new Range(row, column, row, column + comment.end.length);
7605 break;
7606 }
7607 token = iterator.stepForward();
7608 }
7609 if (endRange)
7610 session.remove(endRange);
7611 if (startRange) {
7612 session.remove(startRange);
7613 startRow = startRange.start.row;
7614 colDiff = -comment.start.length
7615 }
7616 } else {
7617 colDiff = comment.start.length
7618 startRow = range.start.row;
7619 session.insert(range.end, comment.end);
7620 session.insert(range.start, comment.start);
7621 }
7622 if (initialRange.start.row == startRow)
7623 initialRange.start.column += colDiff;
7624 if (initialRange.end.row == startRow)
7625 initialRange.end.column += colDiff;
7626 session.selection.fromOrientedRange(initialRange);
7627 };
7628
7629 this.getNextLineIndent = function(state, line, tab) {
7630 return this.$getIndent(line);
7631 };
7632
7633 this.checkOutdent = function(state, line, input) {
7634 return false;
7635 };
7636
7637 this.autoOutdent = function(state, doc, row) {
7638 };
7639
7640 this.$getIndent = function(line) {
7641 return line.match(/^\s*/)[0];
7642 };
7643
7644 this.createWorker = function(session) {
7645 return null;
7646 };
7647
7648 this.createModeDelegates = function (mapping) {
7649 if (!this.$embeds) {
7650 return;
7651 }
7652 this.$modes = {};
7653 for (var i = 0; i < this.$embeds.length; i++) {
7654 if (mapping[this.$embeds[i]]) {
7655 this.$modes[this.$embeds[i]] = new mapping[this.$embeds[i]]();
7656 }
7657 }
7658
7659 var delegations = ['toggleCommentLines', 'getNextLineIndent', 'checkOutdent', 'autoOutdent', 'transformAction'];
7660
7661 for (var i = 0; i < delegations.length; i++) {
7662 (function(scope) {
7663 var functionName = delegations[i];
7664 var defaultHandler = scope[functionName];
7665 scope[delegations[i]] = function() {
7666 return this.$delegator(functionName, arguments, defaultHandler);
7667 }
7668 } (this));
7669 }
7670 };
7671
7672 this.$delegator = function(method, args, defaultHandler) {
7673 var state = args[0];
7674 if (typeof state != "string")
7675 state = state[0];
7676 for (var i = 0; i < this.$embeds.length; i++) {
7677 if (!this.$modes[this.$embeds[i]]) continue;
7678
7679 var split = state.split(this.$embeds[i]);
7680 if (!split[0] && split[1]) {
7681 args[0] = split[1];
7682 var mode = this.$modes[this.$embeds[i]];
7683 return mode[method].apply(mode, args);
7684 }
7685 }
7686 var ret = defaultHandler.apply(this, args);
7687 return defaultHandler ? ret : undefined;
7688 };
7689
7690 this.transformAction = function(state, action, editor, session, param) {
7691 if (this.$behaviour) {
7692 var behaviours = this.$behaviour.getBehaviours();
7693 for (var key in behaviours) {
7694 if (behaviours[key][action]) {
7695 var ret = behaviours[key][action].apply(this, arguments);
7696 if (ret) {
7697 return ret;
7698 }
7699 }
7700 }
7701 }
7702 };
7703
7704 }).call(Mode.prototype);
7705
7706 exports.Mode = Mode;
7707 });
7708
7709 define('ace/tokenizer', ['require', 'exports', 'module' ], function(require, exports, module) {
7710 var MAX_TOKEN_COUNT = 1000;
7711 var Tokenizer = function(rules) {
7712 this.states = rules;
7713
7714 this.regExps = {};
7715 this.matchMappings = {};
7716 for (var key in this.states) {
7717 var state = this.states[key];
7718 var ruleRegExps = [];
7719 var matchTotal = 0;
7720 var mapping = this.matchMappings[key] = {defaultToken: "text"};
7721 var flag = "g";
7722
7723 var splitterRurles = [];
7724 for (var i = 0; i < state.length; i++) {
7725 var rule = state[i];
7726 if (rule.defaultToken)
7727 mapping.defaultToken = rule.defaultToken;
7728 if (rule.caseInsensitive)
7729 flag = "gi";
7730 if (rule.regex == null)
7731 continue;
7732
7733 if (rule.regex instanceof RegExp)
7734 rule.regex = rule.regex.toString().slice(1, -1);
7735 var adjustedregex = rule.regex;
7736 var matchcount = new RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2;
7737 if (Array.isArray(rule.token)) {
7738 if (rule.token.length == 1 || matchcount == 1) {
7739 rule.token = rule.token[0];
7740 } else if (matchcount - 1 != rule.token.length) {
7741 throw new Error("number of classes and regexp groups in '" +
7742 rule.token + "'\n'" + rule.regex + "' doesn't match\n"
7743 + (matchcount - 1) + "!=" + rule.token.length);
7744 } else {
7745 rule.tokenArray = rule.token;
7746 rule.token = null;
7747 rule.onMatch = this.$arrayTokens;
7748 }
7749 } else if (typeof rule.token == "function" && !rule.onMatch) {
7750 if (matchcount > 1)
7751 rule.onMatch = this.$applyToken;
7752 else
7753 rule.onMatch = rule.token;
7754 }
7755
7756 if (matchcount > 1) {
7757 if (/\\\d/.test(rule.regex)) {
7758 adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function (match, digit) {
7759 return "\\" + (parseInt(digit, 10) + matchTotal + 1);
7760 });
7761 } else {
7762 matchcount = 1;
7763 adjustedregex = this.removeCapturingGroups(rule.regex);
7764 }
7765 if (!rule.splitRegex && typeof rule.token != "string")
7766 splitterRurles.push(rule); // flag will be known only at the very end
7767 }
7768
7769 mapping[matchTotal] = i;
7770 matchTotal += matchcount;
7771
7772 ruleRegExps.push(adjustedregex);
7773 if (!rule.onMatch)
7774 rule.onMatch = null;
7775 rule.__proto__ = null;
7776 }
7777
7778 splitterRurles.forEach(function(rule) {
7779 rule.splitRegex = this.createSplitterRegexp(rule.regex, flag);
7780 }, this);
7781
7782 this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag);
7783 }
7784 };
7785
7786 (function() {
7787 this.$applyToken = function(str) {
7788 var values = this.splitRegex.exec(str).slice(1);
7789 var types = this.token.apply(this, values);
7790 if (typeof types === "string")
7791 return [{type: types, value: str}];
7792
7793 var tokens = [];
7794 for (var i = 0, l = types.length; i < l; i++) {
7795 if (values[i])
7796 tokens[tokens.length] = {
7797 type: types[i],
7798 value: values[i]
7799 };
7800 }
7801 return tokens;
7802 },
7803
7804 this.$arrayTokens = function(str) {
7805 if (!str)
7806 return [];
7807 var values = this.splitRegex.exec(str);
7808 if (!values)
7809 return "text";
7810 var tokens = [];
7811 var types = this.tokenArray;
7812 for (var i = 0, l = types.length; i < l; i++) {
7813 if (values[i + 1])
7814 tokens[tokens.length] = {
7815 type: types[i],
7816 value: values[i + 1]
7817 };
7818 }
7819 return tokens;
7820 };
7821
7822 this.removeCapturingGroups = function(src) {
7823 var r = src.replace(
7824 /\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g,
7825 function(x, y) {return y ? "(?:" : x;}
7826 );
7827 return r;
7828 };
7829
7830 this.createSplitterRegexp = function(src, flag) {
7831 if (src.indexOf("(?=") != -1) {
7832 var stack = 0;
7833 var inChClass = false;
7834 var lastCapture = {};
7835 src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function(
7836 m, esc, parenOpen, parenClose, square, index
7837 ) {
7838 if (inChClass) {
7839 inChClass = square != "]";
7840 } else if (square) {
7841 inChClass = true;
7842 } else if (parenClose) {
7843 if (stack == lastCapture.stack) {
7844 lastCapture.end = index+1;
7845 lastCapture.stack = -1;
7846 }
7847 stack--;
7848 } else if (parenOpen) {
7849 stack++;
7850 if (parenOpen.length != 1) {
7851 lastCapture.stack = stack
7852 lastCapture.start = index;
7853 }
7854 }
7855 return m;
7856 });
7857
7858 if (lastCapture.end != null && /^\)*$/.test(src.substr(lastCapture.end)))
7859 src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end);
7860 }
7861 return new RegExp(src, (flag||"").replace("g", ""));
7862 };
7863 this.getLineTokens = function(line, startState) {
7864 if (startState && typeof startState != "string") {
7865 var stack = startState.slice(0);
7866 startState = stack[0];
7867 } else
7868 var stack = [];
7869
7870 var currentState = startState || "start";
7871 var state = this.states[currentState];
7872 var mapping = this.matchMappings[currentState];
7873 var re = this.regExps[currentState];
7874 re.lastIndex = 0;
7875
7876 var match, tokens = [];
7877 var lastIndex = 0;
7878
7879 var token = {type: null, value: ""};
7880
7881 while (match = re.exec(line)) {
7882 var type = mapping.defaultToken;
7883 var rule = null;
7884 var value = match[0];
7885 var index = re.lastIndex;
7886
7887 if (index - value.length > lastIndex) {
7888 var skipped = line.substring(lastIndex, index - value.length);
7889 if (token.type == type) {
7890 token.value += skipped;
7891 } else {
7892 if (token.type)
7893 tokens.push(token);
7894 token = {type: type, value: skipped};
7895 }
7896 }
7897
7898 for (var i = 0; i < match.length-2; i++) {
7899 if (match[i + 1] === undefined)
7900 continue;
7901
7902 rule = state[mapping[i]];
7903
7904 if (rule.onMatch)
7905 type = rule.onMatch(value, currentState, stack);
7906 else
7907 type = rule.token;
7908
7909 if (rule.next) {
7910 if (typeof rule.next == "string")
7911 currentState = rule.next;
7912 else
7913 currentState = rule.next(currentState, stack);
7914
7915 state = this.states[currentState];
7916 if (!state) {
7917 window.console && console.error && console.error(currentState, "doesn't exist");
7918 currentState = "start";
7919 state = this.states[currentState];
7920 }
7921 mapping = this.matchMappings[currentState];
7922 lastIndex = index;
7923 re = this.regExps[currentState];
7924 re.lastIndex = index;
7925 }
7926 break;
7927 }
7928
7929 if (value) {
7930 if (typeof type == "string") {
7931 if ((!rule || rule.merge !== false) && token.type === type) {
7932 token.value += value;
7933 } else {
7934 if (token.type)
7935 tokens.push(token);
7936 token = {type: type, value: value};
7937 }
7938 } else if (type) {
7939 if (token.type)
7940 tokens.push(token);
7941 token = {type: null, value: ""};
7942 for (var i = 0; i < type.length; i++)
7943 tokens.push(type[i]);
7944 }
7945 }
7946
7947 if (lastIndex == line.length)
7948 break;
7949
7950 lastIndex = index;
7951
7952 if (tokens.length > MAX_TOKEN_COUNT) {
7953 while (lastIndex < line.length) {
7954 if (token.type)
7955 tokens.push(token);
7956 token = {
7957 value: line.substring(lastIndex, lastIndex += 2000),
7958 type: "overflow"
7959 }
7960 }
7961 currentState = "start";
7962 stack = [];
7963 break;
7964 }
7965 }
7966
7967 if (token.type)
7968 tokens.push(token);
7969
7970 return {
7971 tokens : tokens,
7972 state : stack.length ? stack : currentState
7973 };
7974 };
7975
7976 }).call(Tokenizer.prototype);
7977
7978 exports.Tokenizer = Tokenizer;
7979 });
7980
7981 define('ace/mode/text_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
7982
7983
7984 var lang = require("../lib/lang");
7985
7986 var TextHighlightRules = function() {
7987
7988 this.$rules = {
7989 "start" : [{
7990 token : "empty_line",
7991 regex : '^$'
7992 }, {
7993 defaultToken : "text"
7994 }]
7995 };
7996 };
7997
7998 (function() {
7999
8000 this.addRules = function(rules, prefix) {
8001 for (var key in rules) {
8002 var state = rules[key];
8003 for (var i = 0; i < state.length; i++) {
8004 var rule = state[i];
8005 if (rule.next) {
8006 if (typeof rule.next != "string")
8007 rule.nextState = prefix + rule.nextState;
8008 else
8009 rule.next = prefix + rule.next;
8010
8011 }
8012 }
8013 this.$rules[prefix + key] = state;
8014 }
8015 };
8016
8017 this.getRules = function() {
8018 return this.$rules;
8019 };
8020
8021 this.embedRules = function (HighlightRules, prefix, escapeRules, states, append) {
8022 var embedRules = new HighlightRules().getRules();
8023 if (states) {
8024 for (var i = 0; i < states.length; i++)
8025 states[i] = prefix + states[i];
8026 } else {
8027 states = [];
8028 for (var key in embedRules)
8029 states.push(prefix + key);
8030 }
8031
8032 this.addRules(embedRules, prefix);
8033
8034 if (escapeRules) {
8035 var addRules = Array.prototype[append ? "push" : "unshift"];
8036 for (var i = 0; i < states.length; i++)
8037 addRules.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
8038 }
8039
8040 if (!this.$embeds)
8041 this.$embeds = [];
8042 this.$embeds.push(prefix);
8043 }
8044
8045 this.getEmbeds = function() {
8046 return this.$embeds;
8047 };
8048
8049 var pushState = function(currentState, stack) {
8050 if (currentState != "start")
8051 stack.unshift(this.nextState, currentState);
8052 return this.nextState;
8053 };
8054 var popState = function(currentState, stack) {
8055 if (stack[0] !== currentState)
8056 return "start";
8057 stack.shift();
8058 return stack.shift();
8059 };
8060
8061 this.normalizeRules = function() {
8062 var id = 0;
8063 var rules = this.$rules;
8064 function processState(key) {
8065 var state = rules[key];
8066 state.processed = true;
8067 for (var i = 0; i < state.length; i++) {
8068 var rule = state[i];
8069 if (!rule.regex && rule.start) {
8070 rule.regex = rule.start;
8071 if (!rule.next)
8072 rule.next = [];
8073 rule.next.push({
8074 defaultToken: rule.token
8075 }, {
8076 token: rule.token + ".end",
8077 regex: rule.end || rule.start,
8078 next: "pop"
8079 });
8080 rule.token = rule.token + ".start";
8081 rule.push = true;
8082 }
8083 var next = rule.next || rule.push;
8084 if (next && Array.isArray(next)) {
8085 var stateName = rule.stateName;
8086 if (!stateName) {
8087 stateName = rule.token;
8088 if (typeof stateName != "string")
8089 stateName = stateName[0] || "";
8090 if (rules[stateName])
8091 stateName += id++;
8092 }
8093 rules[stateName] = next;
8094 rule.next = stateName;
8095 processState(stateName);
8096 } else if (next == "pop") {
8097 rule.next = popState;
8098 }
8099
8100 if (rule.push) {
8101 rule.nextState = rule.next || rule.push;
8102 rule.next = pushState;
8103 delete rule.push;
8104 }
8105
8106 if (rule.rules) {
8107 for (var r in rule.rules) {
8108 if (rules[r]) {
8109 if (rules[r].push)
8110 rules[r].push.apply(rules[r], rule.rules[r]);
8111 } else {
8112 rules[r] = rule.rules[r];
8113 }
8114 }
8115 }
8116 if (rule.include || typeof rule == "string") {
8117 var includeName = rule.include || rule;
8118 var toInsert = rules[includeName];
8119 } else if (Array.isArray(rule))
8120 toInsert = rule;
8121
8122 if (toInsert) {
8123 var args = [i, 1].concat(toInsert);
8124 if (rule.noEscape)
8125 args = args.filter(function(x) {return !x.next;});
8126 state.splice.apply(state, args);
8127 i--;
8128 toInsert = null
8129 }
8130
8131 if (rule.keywordMap) {
8132 rule.token = this.createKeywordMapper(
8133 rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive
8134 );
8135 delete rule.defaultToken;
8136 }
8137 }
8138 };
8139 Object.keys(rules).forEach(processState, this);
8140 };
8141
8142 this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {
8143 var keywords = Object.create(null);
8144 Object.keys(map).forEach(function(className) {
8145 var a = map[className];
8146 if (ignoreCase)
8147 a = a.toLowerCase();
8148 var list = a.split(splitChar || "|");
8149 for (var i = list.length; i--; )
8150 keywords[list[i]] = className;
8151 });
8152 map = null;
8153 return ignoreCase
8154 ? function(value) {return keywords[value.toLowerCase()] || defaultToken }
8155 : function(value) {return keywords[value] || defaultToken };
8156 }
8157
8158 this.getKeywords = function() {
8159 return this.$keywords;
8160 };
8161
8162 }).call(TextHighlightRules.prototype);
8163
8164 exports.TextHighlightRules = TextHighlightRules;
8165 });
8166
8167 define('ace/mode/behaviour', ['require', 'exports', 'module' ], function(require, exports, module) {
8168
8169
8170 var Behaviour = function() {
8171 this.$behaviours = {};
8172 };
8173
8174 (function () {
8175
8176 this.add = function (name, action, callback) {
8177 switch (undefined) {
8178 case this.$behaviours:
8179 this.$behaviours = {};
8180 case this.$behaviours[name]:
8181 this.$behaviours[name] = {};
8182 }
8183 this.$behaviours[name][action] = callback;
8184 }
8185
8186 this.addBehaviours = function (behaviours) {
8187 for (var key in behaviours) {
8188 for (var action in behaviours[key]) {
8189 this.add(key, action, behaviours[key][action]);
8190 }
8191 }
8192 }
8193
8194 this.remove = function (name) {
8195 if (this.$behaviours && this.$behaviours[name]) {
8196 delete this.$behaviours[name];
8197 }
8198 }
8199
8200 this.inherit = function (mode, filter) {
8201 if (typeof mode === "function") {
8202 var behaviours = new mode().getBehaviours(filter);
8203 } else {
8204 var behaviours = mode.getBehaviours(filter);
8205 }
8206 this.addBehaviours(behaviours);
8207 }
8208
8209 this.getBehaviours = function (filter) {
8210 if (!filter) {
8211 return this.$behaviours;
8212 } else {
8213 var ret = {}
8214 for (var i = 0; i < filter.length; i++) {
8215 if (this.$behaviours[filter[i]]) {
8216 ret[filter[i]] = this.$behaviours[filter[i]];
8217 }
8218 }
8219 return ret;
8220 }
8221 }
8222
8223 }).call(Behaviour.prototype);
8224
8225 exports.Behaviour = Behaviour;
8226 });
8227 define('ace/unicode', ['require', 'exports', 'module' ], function(require, exports, module) {
8228 exports.packages = {};
8229
8230 addUnicodePackage({
8231 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",
8232 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",
8233 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",
8234 Lt: "01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC",
8235 Lm: "02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F",
8236 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",
8237 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",
8238 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",
8239 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",
8240 Me: "0488048906DE20DD-20E020E2-20E4A670-A672",
8241 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",
8242 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",
8243 Nl: "16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF",
8244 No: "00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835",
8245 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",
8246 Pd: "002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D",
8247 Ps: "0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62",
8248 Pe: "0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63",
8249 Pi: "00AB2018201B201C201F20392E022E042E092E0C2E1C2E20",
8250 Pf: "00BB2019201D203A2E032E052E0A2E0D2E1D2E21",
8251 Pc: "005F203F20402054FE33FE34FE4D-FE4FFF3F",
8252 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",
8253 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",
8254 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",
8255 Sc: "002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6",
8256 Sk: "005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3",
8257 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",
8258 Z: "002000A01680180E2000-200A20282029202F205F3000",
8259 Zs: "002000A01680180E2000-200A202F205F3000",
8260 Zl: "2028",
8261 Zp: "2029",
8262 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",
8263 Cc: "0000-001F007F-009F",
8264 Cf: "00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB",
8265 Co: "E000-F8FF",
8266 Cs: "D800-DFFF",
8267 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"
8268 });
8269
8270 function addUnicodePackage (pack) {
8271 var codePoint = /\w{4}/g;
8272 for (var name in pack)
8273 exports.packages[name] = pack[name].replace(codePoint, "\\u$&");
8274 };
8275
8276 });
8277
8278 define('ace/token_iterator', ['require', 'exports', 'module' ], function(require, exports, module) {
8279 var TokenIterator = function(session, initialRow, initialColumn) {
8280 this.$session = session;
8281 this.$row = initialRow;
8282 this.$rowTokens = session.getTokens(initialRow);
8283
8284 var token = session.getTokenAt(initialRow, initialColumn);
8285 this.$tokenIndex = token ? token.index : -1;
8286 };
8287
8288 (function() {
8289 this.stepBackward = function() {
8290 this.$tokenIndex -= 1;
8291
8292 while (this.$tokenIndex < 0) {
8293 this.$row -= 1;
8294 if (this.$row < 0) {
8295 this.$row = 0;
8296 return null;
8297 }
8298
8299 this.$rowTokens = this.$session.getTokens(this.$row);
8300 this.$tokenIndex = this.$rowTokens.length - 1;
8301 }
8302
8303 return this.$rowTokens[this.$tokenIndex];
8304 };
8305 this.stepForward = function() {
8306 this.$tokenIndex += 1;
8307 var rowCount;
8308 while (this.$tokenIndex >= this.$rowTokens.length) {
8309 this.$row += 1;
8310 if (!rowCount)
8311 rowCount = this.$session.getLength();
8312 if (this.$row >= rowCount) {
8313 this.$row = rowCount - 1;
8314 return null;
8315 }
8316
8317 this.$rowTokens = this.$session.getTokens(this.$row);
8318 this.$tokenIndex = 0;
8319 }
8320
8321 return this.$rowTokens[this.$tokenIndex];
8322 };
8323 this.getCurrentToken = function () {
8324 return this.$rowTokens[this.$tokenIndex];
8325 };
8326 this.getCurrentTokenRow = function () {
8327 return this.$row;
8328 };
8329 this.getCurrentTokenColumn = function() {
8330 var rowTokens = this.$rowTokens;
8331 var tokenIndex = this.$tokenIndex;
8332 var column = rowTokens[tokenIndex].start;
8333 if (column !== undefined)
8334 return column;
8335
8336 column = 0;
8337 while (tokenIndex > 0) {
8338 tokenIndex -= 1;
8339 column += rowTokens[tokenIndex].value.length;
8340 }
8341
8342 return column;
8343 };
8344
8345 }).call(TokenIterator.prototype);
8346
8347 exports.TokenIterator = TokenIterator;
8348 });
8349
8350 define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
8351
8352
8353 var oop = require("./lib/oop");
8354 var EventEmitter = require("./lib/event_emitter").EventEmitter;
8355 var Range = require("./range").Range;
8356 var Anchor = require("./anchor").Anchor;
8357
8358 var Document = function(text) {
8359 this.$lines = [];
8360 if (text.length == 0) {
8361 this.$lines = [""];
8362 } else if (Array.isArray(text)) {
8363 this._insertLines(0, text);
8364 } else {
8365 this.insert({row: 0, column:0}, text);
8366 }
8367 };
8368
8369 (function() {
8370
8371 oop.implement(this, EventEmitter);
8372 this.setValue = function(text) {
8373 var len = this.getLength();
8374 this.remove(new Range(0, 0, len, this.getLine(len-1).length));
8375 this.insert({row: 0, column:0}, text);
8376 };
8377 this.getValue = function() {
8378 return this.getAllLines().join(this.getNewLineCharacter());
8379 };
8380 this.createAnchor = function(row, column) {
8381 return new Anchor(this, row, column);
8382 };
8383 if ("aaa".split(/a/).length == 0)
8384 this.$split = function(text) {
8385 return text.replace(/\r\n|\r/g, "\n").split("\n");
8386 }
8387 else
8388 this.$split = function(text) {
8389 return text.split(/\r\n|\r|\n/);
8390 };
8391
8392
8393 this.$detectNewLine = function(text) {
8394 var match = text.match(/^.*?(\r\n|\r|\n)/m);
8395 this.$autoNewLine = match ? match[1] : "\n";
8396 };
8397 this.getNewLineCharacter = function() {
8398 switch (this.$newLineMode) {
8399 case "windows":
8400 return "\r\n";
8401 case "unix":
8402 return "\n";
8403 default:
8404 return this.$autoNewLine;
8405 }
8406 };
8407
8408 this.$autoNewLine = "\n";
8409 this.$newLineMode = "auto";
8410 this.setNewLineMode = function(newLineMode) {
8411 if (this.$newLineMode === newLineMode)
8412 return;
8413
8414 this.$newLineMode = newLineMode;
8415 };
8416 this.getNewLineMode = function() {
8417 return this.$newLineMode;
8418 };
8419 this.isNewLine = function(text) {
8420 return (text == "\r\n" || text == "\r" || text == "\n");
8421 };
8422 this.getLine = function(row) {
8423 return this.$lines[row] || "";
8424 };
8425 this.getLines = function(firstRow, lastRow) {
8426 return this.$lines.slice(firstRow, lastRow + 1);
8427 };
8428 this.getAllLines = function() {
8429 return this.getLines(0, this.getLength());
8430 };
8431 this.getLength = function() {
8432 return this.$lines.length;
8433 };
8434 this.getTextRange = function(range) {
8435 if (range.start.row == range.end.row) {
8436 return this.$lines[range.start.row]
8437 .substring(range.start.column, range.end.column);
8438 }
8439 var lines = this.getLines(range.start.row, range.end.row);
8440 lines[0] = (lines[0] || "").substring(range.start.column);
8441 var l = lines.length - 1;
8442 if (range.end.row - range.start.row == l)
8443 lines[l] = lines[l].substring(0, range.end.column);
8444 return lines.join(this.getNewLineCharacter());
8445 };
8446
8447 this.$clipPosition = function(position) {
8448 var length = this.getLength();
8449 if (position.row >= length) {
8450 position.row = Math.max(0, length - 1);
8451 position.column = this.getLine(length-1).length;
8452 } else if (position.row < 0)
8453 position.row = 0;
8454 return position;
8455 };
8456 this.insert = function(position, text) {
8457 if (!text || text.length === 0)
8458 return position;
8459
8460 position = this.$clipPosition(position);
8461 if (this.getLength() <= 1)
8462 this.$detectNewLine(text);
8463
8464 var lines = this.$split(text);
8465 var firstLine = lines.splice(0, 1)[0];
8466 var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
8467
8468 position = this.insertInLine(position, firstLine);
8469 if (lastLine !== null) {
8470 position = this.insertNewLine(position); // terminate first line
8471 position = this._insertLines(position.row, lines);
8472 position = this.insertInLine(position, lastLine || "");
8473 }
8474 return position;
8475 };
8476 this.insertLines = function(row, lines) {
8477 if (row >= this.getLength())
8478 return this.insert({row: row, column: 0}, "\n" + lines.join("\n"));
8479 return this._insertLines(Math.max(row, 0), lines);
8480 };
8481 this._insertLines = function(row, lines) {
8482 if (lines.length == 0)
8483 return {row: row, column: 0};
8484 if (lines.length > 0xFFFF) {
8485 var end = this._insertLines(row, lines.slice(0xFFFF));
8486 lines = lines.slice(0, 0xFFFF);
8487 }
8488
8489 var args = [row, 0];
8490 args.push.apply(args, lines);
8491 this.$lines.splice.apply(this.$lines, args);
8492
8493 var range = new Range(row, 0, row + lines.length, 0);
8494 var delta = {
8495 action: "insertLines",
8496 range: range,
8497 lines: lines
8498 };
8499 this._emit("change", { data: delta });
8500 return end || range.end;
8501 };
8502 this.insertNewLine = function(position) {
8503 position = this.$clipPosition(position);
8504 var line = this.$lines[position.row] || "";
8505
8506 this.$lines[position.row] = line.substring(0, position.column);
8507 this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
8508
8509 var end = {
8510 row : position.row + 1,
8511 column : 0
8512 };
8513
8514 var delta = {
8515 action: "insertText",
8516 range: Range.fromPoints(position, end),
8517 text: this.getNewLineCharacter()
8518 };
8519 this._emit("change", { data: delta });
8520
8521 return end;
8522 };
8523 this.insertInLine = function(position, text) {
8524 if (text.length == 0)
8525 return position;
8526
8527 var line = this.$lines[position.row] || "";
8528
8529 this.$lines[position.row] = line.substring(0, position.column) + text
8530 + line.substring(position.column);
8531
8532 var end = {
8533 row : position.row,
8534 column : position.column + text.length
8535 };
8536
8537 var delta = {
8538 action: "insertText",
8539 range: Range.fromPoints(position, end),
8540 text: text
8541 };
8542 this._emit("change", { data: delta });
8543
8544 return end;
8545 };
8546 this.remove = function(range) {
8547 range.start = this.$clipPosition(range.start);
8548 range.end = this.$clipPosition(range.end);
8549
8550 if (range.isEmpty())
8551 return range.start;
8552
8553 var firstRow = range.start.row;
8554 var lastRow = range.end.row;
8555
8556 if (range.isMultiLine()) {
8557 var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
8558 var lastFullRow = lastRow - 1;
8559
8560 if (range.end.column > 0)
8561 this.removeInLine(lastRow, 0, range.end.column);
8562
8563 if (lastFullRow >= firstFullRow)
8564 this._removeLines(firstFullRow, lastFullRow);
8565
8566 if (firstFullRow != firstRow) {
8567 this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
8568 this.removeNewLine(range.start.row);
8569 }
8570 }
8571 else {
8572 this.removeInLine(firstRow, range.start.column, range.end.column);
8573 }
8574 return range.start;
8575 };
8576 this.removeInLine = function(row, startColumn, endColumn) {
8577 if (startColumn == endColumn)
8578 return;
8579
8580 var range = new Range(row, startColumn, row, endColumn);
8581 var line = this.getLine(row);
8582 var removed = line.substring(startColumn, endColumn);
8583 var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
8584 this.$lines.splice(row, 1, newLine);
8585
8586 var delta = {
8587 action: "removeText",
8588 range: range,
8589 text: removed
8590 };
8591 this._emit("change", { data: delta });
8592 return range.start;
8593 };
8594 this.removeLines = function(firstRow, lastRow) {
8595 if (firstRow < 0 || lastRow >= this.getLength())
8596 return this.remove(new Range(firstRow, 0, lastRow + 1, 0));
8597 return this._removeLines(firstRow, lastRow);
8598 };
8599
8600 this._removeLines = function(firstRow, lastRow) {
8601 var range = new Range(firstRow, 0, lastRow + 1, 0);
8602 var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
8603
8604 var delta = {
8605 action: "removeLines",
8606 range: range,
8607 nl: this.getNewLineCharacter(),
8608 lines: removed
8609 };
8610 this._emit("change", { data: delta });
8611 return removed;
8612 };
8613 this.removeNewLine = function(row) {
8614 var firstLine = this.getLine(row);
8615 var secondLine = this.getLine(row+1);
8616
8617 var range = new Range(row, firstLine.length, row+1, 0);
8618 var line = firstLine + secondLine;
8619
8620 this.$lines.splice(row, 2, line);
8621
8622 var delta = {
8623 action: "removeText",
8624 range: range,
8625 text: this.getNewLineCharacter()
8626 };
8627 this._emit("change", { data: delta });
8628 };
8629 this.replace = function(range, text) {
8630 if (text.length == 0 && range.isEmpty())
8631 return range.start;
8632 if (text == this.getTextRange(range))
8633 return range.end;
8634
8635 this.remove(range);
8636 if (text) {
8637 var end = this.insert(range.start, text);
8638 }
8639 else {
8640 end = range.start;
8641 }
8642
8643 return end;
8644 };
8645 this.applyDeltas = function(deltas) {
8646 for (var i=0; i<deltas.length; i++) {
8647 var delta = deltas[i];
8648 var range = Range.fromPoints(delta.range.start, delta.range.end);
8649
8650 if (delta.action == "insertLines")
8651 this.insertLines(range.start.row, delta.lines);
8652 else if (delta.action == "insertText")
8653 this.insert(range.start, delta.text);
8654 else if (delta.action == "removeLines")
8655 this._removeLines(range.start.row, range.end.row - 1);
8656 else if (delta.action == "removeText")
8657 this.remove(range);
8658 }
8659 };
8660 this.revertDeltas = function(deltas) {
8661 for (var i=deltas.length-1; i>=0; i--) {
8662 var delta = deltas[i];
8663
8664 var range = Range.fromPoints(delta.range.start, delta.range.end);
8665
8666 if (delta.action == "insertLines")
8667 this._removeLines(range.start.row, range.end.row - 1);
8668 else if (delta.action == "insertText")
8669 this.remove(range);
8670 else if (delta.action == "removeLines")
8671 this._insertLines(range.start.row, delta.lines);
8672 else if (delta.action == "removeText")
8673 this.insert(range.start, delta.text);
8674 }
8675 };
8676 this.indexToPosition = function(index, startRow) {
8677 var lines = this.$lines || this.getAllLines();
8678 var newlineLength = this.getNewLineCharacter().length;
8679 for (var i = startRow || 0, l = lines.length; i < l; i++) {
8680 index -= lines[i].length + newlineLength;
8681 if (index < 0)
8682 return {row: i, column: index + lines[i].length + newlineLength};
8683 }
8684 return {row: l-1, column: lines[l-1].length};
8685 };
8686 this.positionToIndex = function(pos, startRow) {
8687 var lines = this.$lines || this.getAllLines();
8688 var newlineLength = this.getNewLineCharacter().length;
8689 var index = 0;
8690 var row = Math.min(pos.row, lines.length);
8691 for (var i = startRow || 0; i < row; ++i)
8692 index += lines[i].length + newlineLength;
8693
8694 return index + pos.column;
8695 };
8696
8697 }).call(Document.prototype);
8698
8699 exports.Document = Document;
8700 });
8701
8702 define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
8703
8704
8705 var oop = require("./lib/oop");
8706 var EventEmitter = require("./lib/event_emitter").EventEmitter;
8707
8708 var Anchor = exports.Anchor = function(doc, row, column) {
8709 this.document = doc;
8710
8711 if (typeof column == "undefined")
8712 this.setPosition(row.row, row.column);
8713 else
8714 this.setPosition(row, column);
8715
8716 this.$onChange = this.onChange.bind(this);
8717 doc.on("change", this.$onChange);
8718 };
8719
8720 (function() {
8721
8722 oop.implement(this, EventEmitter);
8723
8724 this.getPosition = function() {
8725 return this.$clipPositionToDocument(this.row, this.column);
8726 };
8727
8728 this.getDocument = function() {
8729 return this.document;
8730 };
8731
8732 this.onChange = function(e) {
8733 var delta = e.data;
8734 var range = delta.range;
8735
8736 if (range.start.row == range.end.row && range.start.row != this.row)
8737 return;
8738
8739 if (range.start.row > this.row)
8740 return;
8741
8742 if (range.start.row == this.row && range.start.column > this.column)
8743 return;
8744
8745 var row = this.row;
8746 var column = this.column;
8747 var start = range.start;
8748 var end = range.end;
8749
8750 if (delta.action === "insertText") {
8751 if (start.row === row && start.column <= column) {
8752 if (start.row === end.row) {
8753 column += end.column - start.column;
8754 } else {
8755 column -= start.column;
8756 row += end.row - start.row;
8757 }
8758 } else if (start.row !== end.row && start.row < row) {
8759 row += end.row - start.row;
8760 }
8761 } else if (delta.action === "insertLines") {
8762 if (start.row <= row) {
8763 row += end.row - start.row;
8764 }
8765 } else if (delta.action === "removeText") {
8766 if (start.row === row && start.column < column) {
8767 if (end.column >= column)
8768 column = start.column;
8769 else
8770 column = Math.max(0, column - (end.column - start.column));
8771
8772 } else if (start.row !== end.row && start.row < row) {
8773 if (end.row === row)
8774 column = Math.max(0, column - end.column) + start.column;
8775 row -= (end.row - start.row);
8776 } else if (end.row === row) {
8777 row -= end.row - start.row;
8778 column = Math.max(0, column - end.column) + start.column;
8779 }
8780 } else if (delta.action == "removeLines") {
8781 if (start.row <= row) {
8782 if (end.row <= row)
8783 row -= end.row - start.row;
8784 else {
8785 row = start.row;
8786 column = 0;
8787 }
8788 }
8789 }
8790
8791 this.setPosition(row, column, true);
8792 };
8793
8794 this.setPosition = function(row, column, noClip) {
8795 var pos;
8796 if (noClip) {
8797 pos = {
8798 row: row,
8799 column: column
8800 };
8801 } else {
8802 pos = this.$clipPositionToDocument(row, column);
8803 }
8804
8805 if (this.row == pos.row && this.column == pos.column)
8806 return;
8807
8808 var old = {
8809 row: this.row,
8810 column: this.column
8811 };
8812
8813 this.row = pos.row;
8814 this.column = pos.column;
8815 this._emit("change", {
8816 old: old,
8817 value: pos
8818 });
8819 };
8820
8821 this.detach = function() {
8822 this.document.removeEventListener("change", this.$onChange);
8823 };
8824 this.$clipPositionToDocument = function(row, column) {
8825 var pos = {};
8826
8827 if (row >= this.document.getLength()) {
8828 pos.row = Math.max(0, this.document.getLength() - 1);
8829 pos.column = this.document.getLine(pos.row).length;
8830 }
8831 else if (row < 0) {
8832 pos.row = 0;
8833 pos.column = 0;
8834 }
8835 else {
8836 pos.row = row;
8837 pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
8838 }
8839
8840 if (column < 0)
8841 pos.column = 0;
8842
8843 return pos;
8844 };
8845
8846 }).call(Anchor.prototype);
8847
8848 });
8849
8850 define('ace/background_tokenizer', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
8851
8852
8853 var oop = require("./lib/oop");
8854 var EventEmitter = require("./lib/event_emitter").EventEmitter;
8855
8856 var BackgroundTokenizer = function(tokenizer, editor) {
8857 this.running = false;
8858 this.lines = [];
8859 this.states = [];
8860 this.currentLine = 0;
8861 this.tokenizer = tokenizer;
8862
8863 var self = this;
8864
8865 this.$worker = function() {
8866 if (!self.running) { return; }
8867
8868 var workerStart = new Date();
8869 var startLine = self.currentLine;
8870 var doc = self.doc;
8871
8872 var processedLines = 0;
8873
8874 var len = doc.getLength();
8875 while (self.currentLine < len) {
8876 self.$tokenizeRow(self.currentLine);
8877 while (self.lines[self.currentLine])
8878 self.currentLine++;
8879 processedLines ++;
8880 if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {
8881 self.fireUpdateEvent(startLine, self.currentLine-1);
8882 self.running = setTimeout(self.$worker, 20);
8883 return;
8884 }
8885 }
8886
8887 self.running = false;
8888
8889 self.fireUpdateEvent(startLine, len - 1);
8890 };
8891 };
8892
8893 (function(){
8894
8895 oop.implement(this, EventEmitter);
8896 this.setTokenizer = function(tokenizer) {
8897 this.tokenizer = tokenizer;
8898 this.lines = [];
8899 this.states = [];
8900
8901 this.start(0);
8902 };
8903 this.setDocument = function(doc) {
8904 this.doc = doc;
8905 this.lines = [];
8906 this.states = [];
8907
8908 this.stop();
8909 };
8910 this.fireUpdateEvent = function(firstRow, lastRow) {
8911 var data = {
8912 first: firstRow,
8913 last: lastRow
8914 };
8915 this._emit("update", {data: data});
8916 };
8917 this.start = function(startRow) {
8918 this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
8919 this.lines.splice(this.currentLine, this.lines.length);
8920 this.states.splice(this.currentLine, this.states.length);
8921
8922 this.stop();
8923 this.running = setTimeout(this.$worker, 700);
8924 };
8925
8926 this.$updateOnChange = function(delta) {
8927 var range = delta.range;
8928 var startRow = range.start.row;
8929 var len = range.end.row - startRow;
8930
8931 if (len === 0) {
8932 this.lines[startRow] = null;
8933 } else if (delta.action == "removeText" || delta.action == "removeLines") {
8934 this.lines.splice(startRow, len + 1, null);
8935 this.states.splice(startRow, len + 1, null);
8936 } else {
8937 var args = Array(len + 1);
8938 args.unshift(startRow, 1);
8939 this.lines.splice.apply(this.lines, args);
8940 this.states.splice.apply(this.states, args);
8941 }
8942
8943 this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
8944
8945 this.stop();
8946 this.running = setTimeout(this.$worker, 700);
8947 };
8948 this.stop = function() {
8949 if (this.running)
8950 clearTimeout(this.running);
8951 this.running = false;
8952 };
8953 this.getTokens = function(row) {
8954 return this.lines[row] || this.$tokenizeRow(row);
8955 };
8956 this.getState = function(row) {
8957 if (this.currentLine == row)
8958 this.$tokenizeRow(row);
8959 return this.states[row] || "start";
8960 };
8961
8962 this.$tokenizeRow = function(row) {
8963 var line = this.doc.getLine(row);
8964 var state = this.states[row - 1];
8965
8966 var data = this.tokenizer.getLineTokens(line, state, row);
8967
8968 if (this.states[row] + "" !== data.state + "") {
8969 this.states[row] = data.state;
8970 this.lines[row + 1] = null;
8971 if (this.currentLine > row + 1)
8972 this.currentLine = row + 1;
8973 } else if (this.currentLine == row) {
8974 this.currentLine = row + 1;
8975 }
8976
8977 return this.lines[row] = data.tokens;
8978 };
8979
8980 }).call(BackgroundTokenizer.prototype);
8981
8982 exports.BackgroundTokenizer = BackgroundTokenizer;
8983 });
8984
8985 define('ace/search_highlight', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/lib/oop', 'ace/range'], function(require, exports, module) {
8986
8987
8988 var lang = require("./lib/lang");
8989 var oop = require("./lib/oop");
8990 var Range = require("./range").Range;
8991
8992 var SearchHighlight = function(regExp, clazz, type) {
8993 this.setRegexp(regExp);
8994 this.clazz = clazz;
8995 this.type = type || "text";
8996 };
8997
8998 (function() {
8999 this.MAX_RANGES = 500;
9000
9001 this.setRegexp = function(regExp) {
9002 if (this.regExp+"" == regExp+"")
9003 return;
9004 this.regExp = regExp;
9005 this.cache = [];
9006 };
9007
9008 this.update = function(html, markerLayer, session, config) {
9009 if (!this.regExp)
9010 return;
9011 var start = config.firstRow, end = config.lastRow;
9012
9013 for (var i = start; i <= end; i++) {
9014 var ranges = this.cache[i];
9015 if (ranges == null) {
9016 ranges = lang.getMatchOffsets(session.getLine(i), this.regExp);
9017 if (ranges.length > this.MAX_RANGES)
9018 ranges = ranges.slice(0, this.MAX_RANGES);
9019 ranges = ranges.map(function(match) {
9020 return new Range(i, match.offset, i, match.offset + match.length);
9021 });
9022 this.cache[i] = ranges.length ? ranges : "";
9023 }
9024
9025 for (var j = ranges.length; j --; ) {
9026 markerLayer.drawSingleLineMarker(
9027 html, ranges[j].toScreenRange(session), this.clazz, config);
9028 }
9029 }
9030 };
9031
9032 }).call(SearchHighlight.prototype);
9033
9034 exports.SearchHighlight = SearchHighlight;
9035 });
9036
9037 define('ace/edit_session/folding', ['require', 'exports', 'module' , 'ace/range', 'ace/edit_session/fold_line', 'ace/edit_session/fold', 'ace/token_iterator'], function(require, exports, module) {
9038
9039
9040 var Range = require("../range").Range;
9041 var FoldLine = require("./fold_line").FoldLine;
9042 var Fold = require("./fold").Fold;
9043 var TokenIterator = require("../token_iterator").TokenIterator;
9044
9045 function Folding() {
9046 this.getFoldAt = function(row, column, side) {
9047 var foldLine = this.getFoldLine(row);
9048 if (!foldLine)
9049 return null;
9050
9051 var folds = foldLine.folds;
9052 for (var i = 0; i < folds.length; i++) {
9053 var fold = folds[i];
9054 if (fold.range.contains(row, column)) {
9055 if (side == 1 && fold.range.isEnd(row, column)) {
9056 continue;
9057 } else if (side == -1 && fold.range.isStart(row, column)) {
9058 continue;
9059 }
9060 return fold;
9061 }
9062 }
9063 };
9064 this.getFoldsInRange = function(range) {
9065 var start = range.start;
9066 var end = range.end;
9067 var foldLines = this.$foldData;
9068 var foundFolds = [];
9069
9070 start.column += 1;
9071 end.column -= 1;
9072
9073 for (var i = 0; i < foldLines.length; i++) {
9074 var cmp = foldLines[i].range.compareRange(range);
9075 if (cmp == 2) {
9076 continue;
9077 }
9078 else if (cmp == -2) {
9079 break;
9080 }
9081
9082 var folds = foldLines[i].folds;
9083 for (var j = 0; j < folds.length; j++) {
9084 var fold = folds[j];
9085 cmp = fold.range.compareRange(range);
9086 if (cmp == -2) {
9087 break;
9088 } else if (cmp == 2) {
9089 continue;
9090 } else
9091 if (cmp == 42) {
9092 break;
9093 }
9094 foundFolds.push(fold);
9095 }
9096 }
9097 start.column -= 1;
9098 end.column += 1;
9099
9100 return foundFolds;
9101 };
9102 this.getAllFolds = function() {
9103 var folds = [];
9104 var foldLines = this.$foldData;
9105
9106 function addFold(fold) {
9107 folds.push(fold);
9108 }
9109
9110 for (var i = 0; i < foldLines.length; i++)
9111 for (var j = 0; j < foldLines[i].folds.length; j++)
9112 addFold(foldLines[i].folds[j]);
9113
9114 return folds;
9115 };
9116 this.getFoldStringAt = function(row, column, trim, foldLine) {
9117 foldLine = foldLine || this.getFoldLine(row);
9118 if (!foldLine)
9119 return null;
9120
9121 var lastFold = {
9122 end: { column: 0 }
9123 };
9124 var str, fold;
9125 for (var i = 0; i < foldLine.folds.length; i++) {
9126 fold = foldLine.folds[i];
9127 var cmp = fold.range.compareEnd(row, column);
9128 if (cmp == -1) {
9129 str = this
9130 .getLine(fold.start.row)
9131 .substring(lastFold.end.column, fold.start.column);
9132 break;
9133 }
9134 else if (cmp === 0) {
9135 return null;
9136 }
9137 lastFold = fold;
9138 }
9139 if (!str)
9140 str = this.getLine(fold.start.row).substring(lastFold.end.column);
9141
9142 if (trim == -1)
9143 return str.substring(0, column - lastFold.end.column);
9144 else if (trim == 1)
9145 return str.substring(column - lastFold.end.column);
9146 else
9147 return str;
9148 };
9149
9150 this.getFoldLine = function(docRow, startFoldLine) {
9151 var foldData = this.$foldData;
9152 var i = 0;
9153 if (startFoldLine)
9154 i = foldData.indexOf(startFoldLine);
9155 if (i == -1)
9156 i = 0;
9157 for (i; i < foldData.length; i++) {
9158 var foldLine = foldData[i];
9159 if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
9160 return foldLine;
9161 } else if (foldLine.end.row > docRow) {
9162 return null;
9163 }
9164 }
9165 return null;
9166 };
9167 this.getNextFoldLine = function(docRow, startFoldLine) {
9168 var foldData = this.$foldData;
9169 var i = 0;
9170 if (startFoldLine)
9171 i = foldData.indexOf(startFoldLine);
9172 if (i == -1)
9173 i = 0;
9174 for (i; i < foldData.length; i++) {
9175 var foldLine = foldData[i];
9176 if (foldLine.end.row >= docRow) {
9177 return foldLine;
9178 }
9179 }
9180 return null;
9181 };
9182
9183 this.getFoldedRowCount = function(first, last) {
9184 var foldData = this.$foldData, rowCount = last-first+1;
9185 for (var i = 0; i < foldData.length; i++) {
9186 var foldLine = foldData[i],
9187 end = foldLine.end.row,
9188 start = foldLine.start.row;
9189 if (end >= last) {
9190 if(start < last) {
9191 if(start >= first)
9192 rowCount -= last-start;
9193 else
9194 rowCount = 0;//in one fold
9195 }
9196 break;
9197 } else if(end >= first){
9198 if (start >= first) //fold inside range
9199 rowCount -= end-start;
9200 else
9201 rowCount -= end-first+1;
9202 }
9203 }
9204 return rowCount;
9205 };
9206
9207 this.$addFoldLine = function(foldLine) {
9208 this.$foldData.push(foldLine);
9209 this.$foldData.sort(function(a, b) {
9210 return a.start.row - b.start.row;
9211 });
9212 return foldLine;
9213 };
9214 this.addFold = function(placeholder, range) {
9215 var foldData = this.$foldData;
9216 var added = false;
9217 var fold;
9218
9219 if (placeholder instanceof Fold)
9220 fold = placeholder;
9221 else {
9222 fold = new Fold(range, placeholder);
9223 fold.collapseChildren = range.collapseChildren;
9224 }
9225 this.$clipRangeToDocument(fold.range);
9226
9227 var startRow = fold.start.row;
9228 var startColumn = fold.start.column;
9229 var endRow = fold.end.row;
9230 var endColumn = fold.end.column;
9231 if (startRow == endRow && endColumn - startColumn < 2)
9232 throw "The range has to be at least 2 characters width";
9233
9234 var startFold = this.getFoldAt(startRow, startColumn, 1);
9235 var endFold = this.getFoldAt(endRow, endColumn, -1);
9236 if (startFold && endFold == startFold)
9237 return startFold.addSubFold(fold);
9238
9239 if (
9240 (startFold && !startFold.range.isStart(startRow, startColumn))
9241 || (endFold && !endFold.range.isEnd(endRow, endColumn))
9242 ) {
9243 throw "A fold can't intersect already existing fold" + fold.range + startFold.range;
9244 }
9245 var folds = this.getFoldsInRange(fold.range);
9246 if (folds.length > 0) {
9247 this.removeFolds(folds);
9248 folds.forEach(function(subFold) {
9249 fold.addSubFold(subFold);
9250 });
9251 }
9252
9253 for (var i = 0; i < foldData.length; i++) {
9254 var foldLine = foldData[i];
9255 if (endRow == foldLine.start.row) {
9256 foldLine.addFold(fold);
9257 added = true;
9258 break;
9259 } else if (startRow == foldLine.end.row) {
9260 foldLine.addFold(fold);
9261 added = true;
9262 if (!fold.sameRow) {
9263 var foldLineNext = foldData[i + 1];
9264 if (foldLineNext && foldLineNext.start.row == endRow) {
9265 foldLine.merge(foldLineNext);
9266 break;
9267 }
9268 }
9269 break;
9270 } else if (endRow <= foldLine.start.row) {
9271 break;
9272 }
9273 }
9274
9275 if (!added)
9276 foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
9277
9278 if (this.$useWrapMode)
9279 this.$updateWrapData(foldLine.start.row, foldLine.start.row);
9280 else
9281 this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
9282 this.$modified = true;
9283 this._emit("changeFold", { data: fold, action: "add" });
9284
9285 return fold;
9286 };
9287
9288 this.addFolds = function(folds) {
9289 folds.forEach(function(fold) {
9290 this.addFold(fold);
9291 }, this);
9292 };
9293
9294 this.removeFold = function(fold) {
9295 var foldLine = fold.foldLine;
9296 var startRow = foldLine.start.row;
9297 var endRow = foldLine.end.row;
9298
9299 var foldLines = this.$foldData;
9300 var folds = foldLine.folds;
9301 if (folds.length == 1) {
9302 foldLines.splice(foldLines.indexOf(foldLine), 1);
9303 } else
9304 if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
9305 folds.pop();
9306 foldLine.end.row = folds[folds.length - 1].end.row;
9307 foldLine.end.column = folds[folds.length - 1].end.column;
9308 } else
9309 if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
9310 folds.shift();
9311 foldLine.start.row = folds[0].start.row;
9312 foldLine.start.column = folds[0].start.column;
9313 } else
9314 if (fold.sameRow) {
9315 folds.splice(folds.indexOf(fold), 1);
9316 } else
9317 {
9318 var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
9319 folds = newFoldLine.folds;
9320 folds.shift();
9321 newFoldLine.start.row = folds[0].start.row;
9322 newFoldLine.start.column = folds[0].start.column;
9323 }
9324
9325 if (!this.$updating) {
9326 if (this.$useWrapMode)
9327 this.$updateWrapData(startRow, endRow);
9328 else
9329 this.$updateRowLengthCache(startRow, endRow);
9330 }
9331 this.$modified = true;
9332 this._emit("changeFold", { data: fold, action: "remove" });
9333 };
9334
9335 this.removeFolds = function(folds) {
9336 var cloneFolds = [];
9337 for (var i = 0; i < folds.length; i++) {
9338 cloneFolds.push(folds[i]);
9339 }
9340
9341 cloneFolds.forEach(function(fold) {
9342 this.removeFold(fold);
9343 }, this);
9344 this.$modified = true;
9345 };
9346
9347 this.expandFold = function(fold) {
9348 this.removeFold(fold);
9349 fold.subFolds.forEach(function(subFold) {
9350 fold.restoreRange(subFold);
9351 this.addFold(subFold);
9352 }, this);
9353 if (fold.collapseChildren > 0) {
9354 this.foldAll(fold.start.row+1, fold.end.row, fold.collapseChildren-1);
9355 }
9356 fold.subFolds = [];
9357 };
9358
9359 this.expandFolds = function(folds) {
9360 folds.forEach(function(fold) {
9361 this.expandFold(fold);
9362 }, this);
9363 };
9364
9365 this.unfold = function(location, expandInner) {
9366 var range, folds;
9367 if (location == null) {
9368 range = new Range(0, 0, this.getLength(), 0);
9369 expandInner = true;
9370 } else if (typeof location == "number")
9371 range = new Range(location, 0, location, this.getLine(location).length);
9372 else if ("row" in location)
9373 range = Range.fromPoints(location, location);
9374 else
9375 range = location;
9376
9377 folds = this.getFoldsInRange(range);
9378 if (expandInner) {
9379 this.removeFolds(folds);
9380 } else {
9381 while (folds.length) {
9382 this.expandFolds(folds);
9383 folds = this.getFoldsInRange(range);
9384 }
9385 }
9386 };
9387 this.isRowFolded = function(docRow, startFoldRow) {
9388 return !!this.getFoldLine(docRow, startFoldRow);
9389 };
9390
9391 this.getRowFoldEnd = function(docRow, startFoldRow) {
9392 var foldLine = this.getFoldLine(docRow, startFoldRow);
9393 return foldLine ? foldLine.end.row : docRow;
9394 };
9395
9396 this.getRowFoldStart = function(docRow, startFoldRow) {
9397 var foldLine = this.getFoldLine(docRow, startFoldRow);
9398 return foldLine ? foldLine.start.row : docRow;
9399 };
9400
9401 this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
9402 if (startRow == null) {
9403 startRow = foldLine.start.row;
9404 startColumn = 0;
9405 }
9406
9407 if (endRow == null) {
9408 endRow = foldLine.end.row;
9409 endColumn = this.getLine(endRow).length;
9410 }
9411 var doc = this.doc;
9412 var textLine = "";
9413
9414 foldLine.walk(function(placeholder, row, column, lastColumn) {
9415 if (row < startRow)
9416 return;
9417 if (row == startRow) {
9418 if (column < startColumn)
9419 return;
9420 lastColumn = Math.max(startColumn, lastColumn);
9421 }
9422
9423 if (placeholder != null) {
9424 textLine += placeholder;
9425 } else {
9426 textLine += doc.getLine(row).substring(lastColumn, column);
9427 }
9428 }, endRow, endColumn);
9429 return textLine;
9430 };
9431
9432 this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
9433 var foldLine = this.getFoldLine(row);
9434
9435 if (!foldLine) {
9436 var line;
9437 line = this.doc.getLine(row);
9438 return line.substring(startColumn || 0, endColumn || line.length);
9439 } else {
9440 return this.getFoldDisplayLine(
9441 foldLine, row, endColumn, startRow, startColumn);
9442 }
9443 };
9444
9445 this.$cloneFoldData = function() {
9446 var fd = [];
9447 fd = this.$foldData.map(function(foldLine) {
9448 var folds = foldLine.folds.map(function(fold) {
9449 return fold.clone();
9450 });
9451 return new FoldLine(fd, folds);
9452 });
9453
9454 return fd;
9455 };
9456
9457 this.toggleFold = function(tryToUnfold) {
9458 var selection = this.selection;
9459 var range = selection.getRange();
9460 var fold;
9461 var bracketPos;
9462
9463 if (range.isEmpty()) {
9464 var cursor = range.start;
9465 fold = this.getFoldAt(cursor.row, cursor.column);
9466
9467 if (fold) {
9468 this.expandFold(fold);
9469 return;
9470 } else if (bracketPos = this.findMatchingBracket(cursor)) {
9471 if (range.comparePoint(bracketPos) == 1) {
9472 range.end = bracketPos;
9473 } else {
9474 range.start = bracketPos;
9475 range.start.column++;
9476 range.end.column--;
9477 }
9478 } else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
9479 if (range.comparePoint(bracketPos) == 1)
9480 range.end = bracketPos;
9481 else
9482 range.start = bracketPos;
9483
9484 range.start.column++;
9485 } else {
9486 range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
9487 }
9488 } else {
9489 var folds = this.getFoldsInRange(range);
9490 if (tryToUnfold && folds.length) {
9491 this.expandFolds(folds);
9492 return;
9493 } else if (folds.length == 1 ) {
9494 fold = folds[0];
9495 }
9496 }
9497
9498 if (!fold)
9499 fold = this.getFoldAt(range.start.row, range.start.column);
9500
9501 if (fold && fold.range.toString() == range.toString()) {
9502 this.expandFold(fold);
9503 return;
9504 }
9505
9506 var placeholder = "...";
9507 if (!range.isMultiLine()) {
9508 placeholder = this.getTextRange(range);
9509 if(placeholder.length < 4)
9510 return;
9511 placeholder = placeholder.trim().substring(0, 2) + "..";
9512 }
9513
9514 this.addFold(placeholder, range);
9515 };
9516
9517 this.getCommentFoldRange = function(row, column, dir) {
9518 var iterator = new TokenIterator(this, row, column);
9519 var token = iterator.getCurrentToken();
9520 if (token && /^comment|string/.test(token.type)) {
9521 var range = new Range();
9522 var re = new RegExp(token.type.replace(/\..*/, "\\."));
9523 if (dir != 1) {
9524 do {
9525 token = iterator.stepBackward();
9526 } while(token && re.test(token.type));
9527 iterator.stepForward();
9528 }
9529
9530 range.start.row = iterator.getCurrentTokenRow();
9531 range.start.column = iterator.getCurrentTokenColumn() + 2;
9532
9533 iterator = new TokenIterator(this, row, column);
9534
9535 if (dir != -1) {
9536 do {
9537 token = iterator.stepForward();
9538 } while(token && re.test(token.type));
9539 token = iterator.stepBackward();
9540 } else
9541 token = iterator.getCurrentToken();
9542
9543 range.end.row = iterator.getCurrentTokenRow();
9544 range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2;
9545 return range;
9546 }
9547 };
9548
9549 this.foldAll = function(startRow, endRow, depth) {
9550 if (depth == undefined)
9551 depth = 100000; // JSON.stringify doesn't hanle Infinity
9552 var foldWidgets = this.foldWidgets;
9553 endRow = endRow || this.getLength();
9554 for (var row = startRow || 0; row < endRow; row++) {
9555 if (foldWidgets[row] == null)
9556 foldWidgets[row] = this.getFoldWidget(row);
9557 if (foldWidgets[row] != "start")
9558 continue;
9559
9560 var range = this.getFoldWidgetRange(row);
9561 if (range && range.end.row <= endRow) try {
9562 var fold = this.addFold("...", range);
9563 fold.collapseChildren = depth;
9564 } catch(e) {}
9565 row = range.end.row;
9566 }
9567 };
9568 this.$foldStyles = {
9569 "manual": 1,
9570 "markbegin": 1,
9571 "markbeginend": 1
9572 };
9573 this.$foldStyle = "markbegin";
9574 this.setFoldStyle = function(style) {
9575 if (!this.$foldStyles[style])
9576 throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]");
9577
9578 if (this.$foldStyle == style)
9579 return;
9580
9581 this.$foldStyle = style;
9582
9583 if (style == "manual")
9584 this.unfold();
9585 var mode = this.$foldMode;
9586 this.$setFolding(null);
9587 this.$setFolding(mode);
9588 };
9589
9590 this.$setFolding = function(foldMode) {
9591 if (this.$foldMode == foldMode)
9592 return;
9593
9594 this.$foldMode = foldMode;
9595
9596 this.removeListener('change', this.$updateFoldWidgets);
9597 this._emit("changeAnnotation");
9598
9599 if (!foldMode || this.$foldStyle == "manual") {
9600 this.foldWidgets = null;
9601 return;
9602 }
9603
9604 this.foldWidgets = [];
9605 this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);
9606 this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
9607
9608 this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
9609 this.on('change', this.$updateFoldWidgets);
9610
9611 };
9612
9613 this.getParentFoldRangeData = function (row, ignoreCurrent) {
9614 var fw = this.foldWidgets;
9615 if (!fw || (ignoreCurrent && fw[row]))
9616 return {};
9617
9618 var i = row - 1, firstRange;
9619 while (i >= 0) {
9620 var c = fw[i];
9621 if (c == null)
9622 c = fw[i] = this.getFoldWidget(i);
9623
9624 if (c == "start") {
9625 var range = this.getFoldWidgetRange(i);
9626 if (!firstRange)
9627 firstRange = range;
9628 if (range && range.end.row >= row)
9629 break;
9630 }
9631 i--;
9632 }
9633
9634 return {
9635 range: i !== -1 && range,
9636 firstRange: firstRange
9637 };
9638 }
9639
9640 this.onFoldWidgetClick = function(row, e) {
9641 var type = this.getFoldWidget(row);
9642 var line = this.getLine(row);
9643 e = e.domEvent;
9644 var children = e.shiftKey;
9645 var all = e.ctrlKey || e.metaKey;
9646 var siblings = e.altKey;
9647
9648 var dir = type === "end" ? -1 : 1;
9649 var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir);
9650
9651 if (fold) {
9652 if (children || all)
9653 this.removeFold(fold);
9654 else
9655 this.expandFold(fold);
9656 return;
9657 }
9658
9659 var range = this.getFoldWidgetRange(row);
9660 if (range && !range.isMultiLine()) {
9661 fold = this.getFoldAt(range.start.row, range.start.column, 1);
9662 if (fold && range.isEqual(fold.range)) {
9663 this.removeFold(fold);
9664 return;
9665 }
9666 }
9667
9668 if (siblings) {
9669 var data = this.getParentFoldRangeData(row);
9670 if (data.range) {
9671 var startRow = data.range.start.row + 1;
9672 var endRow = data.range.end.row;
9673 }
9674 this.foldAll(startRow, endRow, all ? 10000 : 0);
9675 } else if (children) {
9676 var endRow = range ? range.end.row : this.getLength();
9677 this.foldAll(row + 1, range.end.row, all ? 10000 : 0);
9678 } else if (range) {
9679 if (all)
9680 range.collapseChildren = 10000;
9681 this.addFold("...", range);
9682 }
9683
9684 if (!range)
9685 (e.target || e.srcElement).className += " ace_invalid"
9686 };
9687
9688 this.updateFoldWidgets = function(e) {
9689 var delta = e.data;
9690 var range = delta.range;
9691 var firstRow = range.start.row;
9692 var len = range.end.row - firstRow;
9693
9694 if (len === 0) {
9695 this.foldWidgets[firstRow] = null;
9696 } else if (delta.action == "removeText" || delta.action == "removeLines") {
9697 this.foldWidgets.splice(firstRow, len + 1, null);
9698 } else {
9699 var args = Array(len + 1);
9700 args.unshift(firstRow, 1);
9701 this.foldWidgets.splice.apply(this.foldWidgets, args);
9702 }
9703 };
9704
9705 }
9706
9707 exports.Folding = Folding;
9708
9709 });
9710
9711 define('ace/edit_session/fold_line', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
9712
9713
9714 var Range = require("../range").Range;
9715 function FoldLine(foldData, folds) {
9716 this.foldData = foldData;
9717 if (Array.isArray(folds)) {
9718 this.folds = folds;
9719 } else {
9720 folds = this.folds = [ folds ];
9721 }
9722
9723 var last = folds[folds.length - 1]
9724 this.range = new Range(folds[0].start.row, folds[0].start.column,
9725 last.end.row, last.end.column);
9726 this.start = this.range.start;
9727 this.end = this.range.end;
9728
9729 this.folds.forEach(function(fold) {
9730 fold.setFoldLine(this);
9731 }, this);
9732 }
9733
9734 (function() {
9735 this.shiftRow = function(shift) {
9736 this.start.row += shift;
9737 this.end.row += shift;
9738 this.folds.forEach(function(fold) {
9739 fold.start.row += shift;
9740 fold.end.row += shift;
9741 });
9742 }
9743
9744 this.addFold = function(fold) {
9745 if (fold.sameRow) {
9746 if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
9747 throw "Can't add a fold to this FoldLine as it has no connection";
9748 }
9749 this.folds.push(fold);
9750 this.folds.sort(function(a, b) {
9751 return -a.range.compareEnd(b.start.row, b.start.column);
9752 });
9753 if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
9754 this.end.row = fold.end.row;
9755 this.end.column = fold.end.column;
9756 } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
9757 this.start.row = fold.start.row;
9758 this.start.column = fold.start.column;
9759 }
9760 } else if (fold.start.row == this.end.row) {
9761 this.folds.push(fold);
9762 this.end.row = fold.end.row;
9763 this.end.column = fold.end.column;
9764 } else if (fold.end.row == this.start.row) {
9765 this.folds.unshift(fold);
9766 this.start.row = fold.start.row;
9767 this.start.column = fold.start.column;
9768 } else {
9769 throw "Trying to add fold to FoldRow that doesn't have a matching row";
9770 }
9771 fold.foldLine = this;
9772 }
9773
9774 this.containsRow = function(row) {
9775 return row >= this.start.row && row <= this.end.row;
9776 }
9777
9778 this.walk = function(callback, endRow, endColumn) {
9779 var lastEnd = 0,
9780 folds = this.folds,
9781 fold,
9782 comp, stop, isNewRow = true;
9783
9784 if (endRow == null) {
9785 endRow = this.end.row;
9786 endColumn = this.end.column;
9787 }
9788
9789 for (var i = 0; i < folds.length; i++) {
9790 fold = folds[i];
9791
9792 comp = fold.range.compareStart(endRow, endColumn);
9793 if (comp == -1) {
9794 callback(null, endRow, endColumn, lastEnd, isNewRow);
9795 return;
9796 }
9797
9798 stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
9799 stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
9800 if (stop || comp == 0) {
9801 return;
9802 }
9803 isNewRow = !fold.sameRow;
9804 lastEnd = fold.end.column;
9805 }
9806 callback(null, endRow, endColumn, lastEnd, isNewRow);
9807 }
9808
9809 this.getNextFoldTo = function(row, column) {
9810 var fold, cmp;
9811 for (var i = 0; i < this.folds.length; i++) {
9812 fold = this.folds[i];
9813 cmp = fold.range.compareEnd(row, column);
9814 if (cmp == -1) {
9815 return {
9816 fold: fold,
9817 kind: "after"
9818 };
9819 } else if (cmp == 0) {
9820 return {
9821 fold: fold,
9822 kind: "inside"
9823 }
9824 }
9825 }
9826 return null;
9827 }
9828
9829 this.addRemoveChars = function(row, column, len) {
9830 var ret = this.getNextFoldTo(row, column),
9831 fold, folds;
9832 if (ret) {
9833 fold = ret.fold;
9834 if (ret.kind == "inside"
9835 && fold.start.column != column
9836 && fold.start.row != row)
9837 {
9838 window.console && window.console.log(row, column, fold);
9839 } else if (fold.start.row == row) {
9840 folds = this.folds;
9841 var i = folds.indexOf(fold);
9842 if (i == 0) {
9843 this.start.column += len;
9844 }
9845 for (i; i < folds.length; i++) {
9846 fold = folds[i];
9847 fold.start.column += len;
9848 if (!fold.sameRow) {
9849 return;
9850 }
9851 fold.end.column += len;
9852 }
9853 this.end.column += len;
9854 }
9855 }
9856 }
9857
9858 this.split = function(row, column) {
9859 var fold = this.getNextFoldTo(row, column).fold;
9860 var folds = this.folds;
9861 var foldData = this.foldData;
9862
9863 if (!fold)
9864 return null;
9865
9866 var i = folds.indexOf(fold);
9867 var foldBefore = folds[i - 1];
9868 this.end.row = foldBefore.end.row;
9869 this.end.column = foldBefore.end.column;
9870 folds = folds.splice(i, folds.length - i);
9871
9872 var newFoldLine = new FoldLine(foldData, folds);
9873 foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
9874 return newFoldLine;
9875 }
9876
9877 this.merge = function(foldLineNext) {
9878 var folds = foldLineNext.folds;
9879 for (var i = 0; i < folds.length; i++) {
9880 this.addFold(folds[i]);
9881 }
9882 var foldData = this.foldData;
9883 foldData.splice(foldData.indexOf(foldLineNext), 1);
9884 }
9885
9886 this.toString = function() {
9887 var ret = [this.range.toString() + ": [" ];
9888
9889 this.folds.forEach(function(fold) {
9890 ret.push(" " + fold.toString());
9891 });
9892 ret.push("]")
9893 return ret.join("\n");
9894 }
9895
9896 this.idxToPosition = function(idx) {
9897 var lastFoldEndColumn = 0;
9898 var fold;
9899
9900 for (var i = 0; i < this.folds.length; i++) {
9901 var fold = this.folds[i];
9902
9903 idx -= fold.start.column - lastFoldEndColumn;
9904 if (idx < 0) {
9905 return {
9906 row: fold.start.row,
9907 column: fold.start.column + idx
9908 };
9909 }
9910
9911 idx -= fold.placeholder.length;
9912 if (idx < 0) {
9913 return fold.start;
9914 }
9915
9916 lastFoldEndColumn = fold.end.column;
9917 }
9918
9919 return {
9920 row: this.end.row,
9921 column: this.end.column + idx
9922 };
9923 }
9924 }).call(FoldLine.prototype);
9925
9926 exports.FoldLine = FoldLine;
9927 });
9928
9929 define('ace/edit_session/fold', ['require', 'exports', 'module' , 'ace/range', 'ace/range_list', 'ace/lib/oop'], function(require, exports, module) {
9930
9931
9932 var Range = require("../range").Range;
9933 var RangeList = require("../range_list").RangeList;
9934 var oop = require("../lib/oop")
9935 var Fold = exports.Fold = function(range, placeholder) {
9936 this.foldLine = null;
9937 this.placeholder = placeholder;
9938 this.range = range;
9939 this.start = range.start;
9940 this.end = range.end;
9941
9942 this.sameRow = range.start.row == range.end.row;
9943 this.subFolds = this.ranges = [];
9944 };
9945
9946 oop.inherits(Fold, RangeList);
9947
9948 (function() {
9949
9950 this.toString = function() {
9951 return '"' + this.placeholder + '" ' + this.range.toString();
9952 };
9953
9954 this.setFoldLine = function(foldLine) {
9955 this.foldLine = foldLine;
9956 this.subFolds.forEach(function(fold) {
9957 fold.setFoldLine(foldLine);
9958 });
9959 };
9960
9961 this.clone = function() {
9962 var range = this.range.clone();
9963 var fold = new Fold(range, this.placeholder);
9964 this.subFolds.forEach(function(subFold) {
9965 fold.subFolds.push(subFold.clone());
9966 });
9967 fold.collapseChildren = this.collapseChildren;
9968 return fold;
9969 };
9970
9971 this.addSubFold = function(fold) {
9972 if (this.range.isEqual(fold))
9973 return;
9974
9975 if (!this.range.containsRange(fold))
9976 throw "A fold can't intersect already existing fold" + fold.range + this.range;
9977 consumeRange(fold, this.start);
9978
9979 var row = fold.start.row, column = fold.start.column;
9980 for (var i = 0, cmp = -1; i < this.subFolds.length; i++) {
9981 cmp = this.subFolds[i].range.compare(row, column);
9982 if (cmp != 1)
9983 break;
9984 }
9985 var afterStart = this.subFolds[i];
9986
9987 if (cmp == 0)
9988 return afterStart.addSubFold(fold);
9989 var row = fold.range.end.row, column = fold.range.end.column;
9990 for (var j = i, cmp = -1; j < this.subFolds.length; j++) {
9991 cmp = this.subFolds[j].range.compare(row, column);
9992 if (cmp != 1)
9993 break;
9994 }
9995 var afterEnd = this.subFolds[j];
9996
9997 if (cmp == 0)
9998 throw "A fold can't intersect already existing fold" + fold.range + this.range;
9999
10000 var consumedFolds = this.subFolds.splice(i, j - i, fold);
10001 fold.setFoldLine(this.foldLine);
10002
10003 return fold;
10004 };
10005
10006 this.restoreRange = function(range) {
10007 return restoreRange(range, this.start);
10008 };
10009
10010 }).call(Fold.prototype);
10011
10012 function consumePoint(point, anchor) {
10013 point.row -= anchor.row;
10014 if (point.row == 0)
10015 point.column -= anchor.column;
10016 }
10017 function consumeRange(range, anchor) {
10018 consumePoint(range.start, anchor);
10019 consumePoint(range.end, anchor);
10020 }
10021 function restorePoint(point, anchor) {
10022 if (point.row == 0)
10023 point.column += anchor.column;
10024 point.row += anchor.row;
10025 }
10026 function restoreRange(range, anchor) {
10027 restorePoint(range.start, anchor);
10028 restorePoint(range.end, anchor);
10029 }
10030
10031 });
10032
10033 define('ace/range_list', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
10034
10035 var Range = require("./range").Range;
10036 var comparePoints = Range.comparePoints;
10037
10038 var RangeList = function() {
10039 this.ranges = [];
10040 };
10041
10042 (function() {
10043 this.comparePoints = comparePoints;
10044
10045 this.pointIndex = function(pos, excludeEdges, startIndex) {
10046 var list = this.ranges;
10047
10048 for (var i = startIndex || 0; i < list.length; i++) {
10049 var range = list[i];
10050 var cmpEnd = comparePoints(pos, range.end);
10051 if (cmpEnd > 0)
10052 continue;
10053 var cmpStart = comparePoints(pos, range.start);
10054 if (cmpEnd === 0)
10055 return excludeEdges && cmpStart !== 0 ? -i-2 : i;
10056 if (cmpStart > 0 || (cmpStart === 0 && !excludeEdges))
10057 return i;
10058
10059 return -i-1;
10060 }
10061 return -i - 1;
10062 };
10063
10064 this.add = function(range) {
10065 var excludeEdges = !range.isEmpty();
10066 var startIndex = this.pointIndex(range.start, excludeEdges);
10067 if (startIndex < 0)
10068 startIndex = -startIndex - 1;
10069
10070 var endIndex = this.pointIndex(range.end, excludeEdges, startIndex);
10071
10072 if (endIndex < 0)
10073 endIndex = -endIndex - 1;
10074 else
10075 endIndex++;
10076 return this.ranges.splice(startIndex, endIndex - startIndex, range);
10077 };
10078
10079 this.addList = function(list) {
10080 var removed = [];
10081 for (var i = list.length; i--; ) {
10082 removed.push.call(removed, this.add(list[i]));
10083 }
10084 return removed;
10085 };
10086
10087 this.substractPoint = function(pos) {
10088 var i = this.pointIndex(pos);
10089
10090 if (i >= 0)
10091 return this.ranges.splice(i, 1);
10092 };
10093 this.merge = function() {
10094 var removed = [];
10095 var list = this.ranges;
10096
10097 list = list.sort(function(a, b) {
10098 return comparePoints(a.start, b.start);
10099 });
10100
10101 var next = list[0], range;
10102 for (var i = 1; i < list.length; i++) {
10103 range = next;
10104 next = list[i];
10105 var cmp = comparePoints(range.end, next.start);
10106 if (cmp < 0)
10107 continue;
10108
10109 if (cmp == 0 && !range.isEmpty() && !next.isEmpty())
10110 continue;
10111
10112 if (comparePoints(range.end, next.end) < 0) {
10113 range.end.row = next.end.row;
10114 range.end.column = next.end.column;
10115 }
10116
10117 list.splice(i, 1);
10118 removed.push(next);
10119 next = range;
10120 i--;
10121 }
10122
10123 this.ranges = list;
10124
10125 return removed;
10126 };
10127
10128 this.contains = function(row, column) {
10129 return this.pointIndex({row: row, column: column}) >= 0;
10130 };
10131
10132 this.containsPoint = function(pos) {
10133 return this.pointIndex(pos) >= 0;
10134 };
10135
10136 this.rangeAtPoint = function(pos) {
10137 var i = this.pointIndex(pos);
10138 if (i >= 0)
10139 return this.ranges[i];
10140 };
10141
10142
10143 this.clipRows = function(startRow, endRow) {
10144 var list = this.ranges;
10145 if (list[0].start.row > endRow || list[list.length - 1].start.row < startRow)
10146 return [];
10147
10148 var startIndex = this.pointIndex({row: startRow, column: 0});
10149 if (startIndex < 0)
10150 startIndex = -startIndex - 1;
10151 var endIndex = this.pointIndex({row: endRow, column: 0}, startIndex);
10152 if (endIndex < 0)
10153 endIndex = -endIndex - 1;
10154
10155 var clipped = [];
10156 for (var i = startIndex; i < endIndex; i++) {
10157 clipped.push(list[i]);
10158 }
10159 return clipped;
10160 };
10161
10162 this.removeAll = function() {
10163 return this.ranges.splice(0, this.ranges.length);
10164 };
10165
10166 this.attach = function(session) {
10167 if (this.session)
10168 this.detach();
10169
10170 this.session = session;
10171 this.onChange = this.$onChange.bind(this);
10172
10173 this.session.on('change', this.onChange);
10174 };
10175
10176 this.detach = function() {
10177 if (!this.session)
10178 return;
10179 this.session.removeListener('change', this.onChange);
10180 this.session = null;
10181 };
10182
10183 this.$onChange = function(e) {
10184 var changeRange = e.data.range;
10185 if (e.data.action[0] == "i"){
10186 var start = changeRange.start;
10187 var end = changeRange.end;
10188 } else {
10189 var end = changeRange.start;
10190 var start = changeRange.end;
10191 }
10192 var startRow = start.row;
10193 var endRow = end.row;
10194 var lineDif = endRow - startRow;
10195
10196 var colDiff = -start.column + end.column;
10197 var ranges = this.ranges;
10198
10199 for (var i = 0, n = ranges.length; i < n; i++) {
10200 var r = ranges[i];
10201 if (r.end.row < startRow)
10202 continue;
10203 if (r.start.row > startRow)
10204 break;
10205
10206 if (r.start.row == startRow && r.start.column >= start.column ) {
10207
10208 r.start.column += colDiff;
10209 r.start.row += lineDif;
10210 }
10211 if (r.end.row == startRow && r.end.column >= start.column) {
10212 if (r.end.column == start.column && colDiff > 0 && i < n - 1) {
10213 if (r.end.column > r.start.column && r.end.column == ranges[i+1].start.column)
10214 r.end.column -= colDiff;
10215 }
10216 r.end.column += colDiff;
10217 r.end.row += lineDif;
10218 }
10219 }
10220
10221 if (lineDif != 0 && i < n) {
10222 for (; i < n; i++) {
10223 var r = ranges[i];
10224 r.start.row += lineDif;
10225 r.end.row += lineDif;
10226 }
10227 }
10228 };
10229
10230 }).call(RangeList.prototype);
10231
10232 exports.RangeList = RangeList;
10233 });
10234
10235 define('ace/edit_session/bracket_match', ['require', 'exports', 'module' , 'ace/token_iterator', 'ace/range'], function(require, exports, module) {
10236
10237
10238 var TokenIterator = require("../token_iterator").TokenIterator;
10239 var Range = require("../range").Range;
10240
10241
10242 function BracketMatch() {
10243
10244 this.findMatchingBracket = function(position, chr) {
10245 if (position.column == 0) return null;
10246
10247 var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column-1);
10248 if (charBeforeCursor == "") return null;
10249
10250 var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
10251 if (!match)
10252 return null;
10253
10254 if (match[1])
10255 return this.$findClosingBracket(match[1], position);
10256 else
10257 return this.$findOpeningBracket(match[2], position);
10258 };
10259
10260 this.getBracketRange = function(pos) {
10261 var line = this.getLine(pos.row);
10262 var before = true, range;
10263
10264 var chr = line.charAt(pos.column-1);
10265 var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
10266 if (!match) {
10267 chr = line.charAt(pos.column);
10268 pos = {row: pos.row, column: pos.column + 1};
10269 match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
10270 before = false;
10271 }
10272 if (!match)
10273 return null;
10274
10275 if (match[1]) {
10276 var bracketPos = this.$findClosingBracket(match[1], pos);
10277 if (!bracketPos)
10278 return null;
10279 range = Range.fromPoints(pos, bracketPos);
10280 if (!before) {
10281 range.end.column++;
10282 range.start.column--;
10283 }
10284 range.cursor = range.end;
10285 } else {
10286 var bracketPos = this.$findOpeningBracket(match[2], pos);
10287 if (!bracketPos)
10288 return null;
10289 range = Range.fromPoints(bracketPos, pos);
10290 if (!before) {
10291 range.start.column++;
10292 range.end.column--;
10293 }
10294 range.cursor = range.start;
10295 }
10296
10297 return range;
10298 };
10299
10300 this.$brackets = {
10301 ")": "(",
10302 "(": ")",
10303 "]": "[",
10304 "[": "]",
10305 "{": "}",
10306 "}": "{"
10307 };
10308
10309 this.$findOpeningBracket = function(bracket, position, typeRe) {
10310 var openBracket = this.$brackets[bracket];
10311 var depth = 1;
10312
10313 var iterator = new TokenIterator(this, position.row, position.column);
10314 var token = iterator.getCurrentToken();
10315 if (!token)
10316 token = iterator.stepForward();
10317 if (!token)
10318 return;
10319
10320 if (!typeRe){
10321 typeRe = new RegExp(
10322 "(\\.?" +
10323 token.type.replace(".", "\\.").replace("rparen", ".paren")
10324 + ")+"
10325 );
10326 }
10327 var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;
10328 var value = token.value;
10329
10330 while (true) {
10331
10332 while (valueIndex >= 0) {
10333 var chr = value.charAt(valueIndex);
10334 if (chr == openBracket) {
10335 depth -= 1;
10336 if (depth == 0) {
10337 return {row: iterator.getCurrentTokenRow(),
10338 column: valueIndex + iterator.getCurrentTokenColumn()};
10339 }
10340 }
10341 else if (chr == bracket) {
10342 depth += 1;
10343 }
10344 valueIndex -= 1;
10345 }
10346 do {
10347 token = iterator.stepBackward();
10348 } while (token && !typeRe.test(token.type));
10349
10350 if (token == null)
10351 break;
10352
10353 value = token.value;
10354 valueIndex = value.length - 1;
10355 }
10356
10357 return null;
10358 };
10359
10360 this.$findClosingBracket = function(bracket, position, typeRe) {
10361 var closingBracket = this.$brackets[bracket];
10362 var depth = 1;
10363
10364 var iterator = new TokenIterator(this, position.row, position.column);
10365 var token = iterator.getCurrentToken();
10366 if (!token)
10367 token = iterator.stepForward();
10368 if (!token)
10369 return;
10370
10371 if (!typeRe){
10372 typeRe = new RegExp(
10373 "(\\.?" +
10374 token.type.replace(".", "\\.").replace("lparen", ".paren")
10375 + ")+"
10376 );
10377 }
10378 var valueIndex = position.column - iterator.getCurrentTokenColumn();
10379
10380 while (true) {
10381
10382 var value = token.value;
10383 var valueLength = value.length;
10384 while (valueIndex < valueLength) {
10385 var chr = value.charAt(valueIndex);
10386 if (chr == closingBracket) {
10387 depth -= 1;
10388 if (depth == 0) {
10389 return {row: iterator.getCurrentTokenRow(),
10390 column: valueIndex + iterator.getCurrentTokenColumn()};
10391 }
10392 }
10393 else if (chr == bracket) {
10394 depth += 1;
10395 }
10396 valueIndex += 1;
10397 }
10398 do {
10399 token = iterator.stepForward();
10400 } while (token && !typeRe.test(token.type));
10401
10402 if (token == null)
10403 break;
10404
10405 valueIndex = 0;
10406 }
10407
10408 return null;
10409 };
10410 }
10411 exports.BracketMatch = BracketMatch;
10412
10413 });
10414
10415 define('ace/search', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/lib/oop', 'ace/range'], function(require, exports, module) {
10416
10417
10418 var lang = require("./lib/lang");
10419 var oop = require("./lib/oop");
10420 var Range = require("./range").Range;
10421
10422 var Search = function() {
10423 this.$options = {};
10424 };
10425
10426 (function() {
10427 this.set = function(options) {
10428 oop.mixin(this.$options, options);
10429 return this;
10430 };
10431 this.getOptions = function() {
10432 return lang.copyObject(this.$options);
10433 };
10434 this.setOptions = function(options) {
10435 this.$options = options;
10436 };
10437 this.find = function(session) {
10438 var iterator = this.$matchIterator(session, this.$options);
10439
10440 if (!iterator)
10441 return false;
10442
10443 var firstRange = null;
10444 iterator.forEach(function(range, row, offset) {
10445 if (!range.start) {
10446 var column = range.offset + (offset || 0);
10447 firstRange = new Range(row, column, row, column+range.length);
10448 } else
10449 firstRange = range;
10450 return true;
10451 });
10452
10453 return firstRange;
10454 };
10455 this.findAll = function(session) {
10456 var options = this.$options;
10457 if (!options.needle)
10458 return [];
10459 this.$assembleRegExp(options);
10460
10461 var range = options.range;
10462 var lines = range
10463 ? session.getLines(range.start.row, range.end.row)
10464 : session.doc.getAllLines();
10465
10466 var ranges = [];
10467 var re = options.re;
10468 if (options.$isMultiLine) {
10469 var len = re.length;
10470 var maxRow = lines.length - len;
10471 for (var row = re.offset || 0; row <= maxRow; row++) {
10472 for (var j = 0; j < len; j++)
10473 if (lines[row + j].search(re[j]) == -1)
10474 break;
10475
10476 var startLine = lines[row];
10477 var line = lines[row + len - 1];
10478 var startIndex = startLine.match(re[0])[0].length;
10479 var endIndex = line.match(re[len - 1])[0].length;
10480
10481 ranges.push(new Range(
10482 row, startLine.length - startIndex,
10483 row + len - 1, endIndex
10484 ));
10485 }
10486 } else {
10487 for (var i = 0; i < lines.length; i++) {
10488 var matches = lang.getMatchOffsets(lines[i], re);
10489 for (var j = 0; j < matches.length; j++) {
10490 var match = matches[j];
10491 ranges.push(new Range(i, match.offset, i, match.offset + match.length));
10492 }
10493 }
10494 }
10495
10496 if (range) {
10497 var startColumn = range.start.column;
10498 var endColumn = range.start.column;
10499 var i = 0, j = ranges.length - 1;
10500 while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == range.start.row)
10501 i++;
10502
10503 while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == range.end.row)
10504 j--;
10505
10506 ranges = ranges.slice(i, j + 1);
10507 for (i = 0, j = ranges.length; i < j; i++) {
10508 ranges[i].start.row += range.start.row;
10509 ranges[i].end.row += range.start.row;
10510 }
10511 }
10512
10513 return ranges;
10514 };
10515 this.replace = function(input, replacement) {
10516 var options = this.$options;
10517
10518 var re = this.$assembleRegExp(options);
10519 if (options.$isMultiLine)
10520 return replacement;
10521
10522 if (!re)
10523 return;
10524
10525 var match = re.exec(input);
10526 if (!match || match[0].length != input.length)
10527 return null;
10528
10529 replacement = input.replace(re, replacement);
10530 if (options.preserveCase) {
10531 replacement = replacement.split("");
10532 for (var i = Math.min(input.length, input.length); i--; ) {
10533 var ch = input[i];
10534 if (ch && ch.toLowerCase() != ch)
10535 replacement[i] = replacement[i].toUpperCase();
10536 else
10537 replacement[i] = replacement[i].toLowerCase();
10538 }
10539 replacement = replacement.join("");
10540 }
10541
10542 return replacement;
10543 };
10544
10545 this.$matchIterator = function(session, options) {
10546 var re = this.$assembleRegExp(options);
10547 if (!re)
10548 return false;
10549
10550 var self = this, callback, backwards = options.backwards;
10551
10552 if (options.$isMultiLine) {
10553 var len = re.length;
10554 var matchIterator = function(line, row, offset) {
10555 var startIndex = line.search(re[0]);
10556 if (startIndex == -1)
10557 return;
10558 for (var i = 1; i < len; i++) {
10559 line = session.getLine(row + i);
10560 if (line.search(re[i]) == -1)
10561 return;
10562 }
10563
10564 var endIndex = line.match(re[len - 1])[0].length;
10565
10566 var range = new Range(row, startIndex, row + len - 1, endIndex);
10567 if (re.offset == 1) {
10568 range.start.row--;
10569 range.start.column = Number.MAX_VALUE;
10570 } else if (offset)
10571 range.start.column += offset;
10572
10573 if (callback(range))
10574 return true;
10575 };
10576 } else if (backwards) {
10577 var matchIterator = function(line, row, startIndex) {
10578 var matches = lang.getMatchOffsets(line, re);
10579 for (var i = matches.length-1; i >= 0; i--)
10580 if (callback(matches[i], row, startIndex))
10581 return true;
10582 };
10583 } else {
10584 var matchIterator = function(line, row, startIndex) {
10585 var matches = lang.getMatchOffsets(line, re);
10586 for (var i = 0; i < matches.length; i++)
10587 if (callback(matches[i], row, startIndex))
10588 return true;
10589 };
10590 }
10591
10592 return {
10593 forEach: function(_callback) {
10594 callback = _callback;
10595 self.$lineIterator(session, options).forEach(matchIterator);
10596 }
10597 };
10598 };
10599
10600 this.$assembleRegExp = function(options, $disableFakeMultiline) {
10601 if (options.needle instanceof RegExp)
10602 return options.re = options.needle;
10603
10604 var needle = options.needle;
10605
10606 if (!options.needle)
10607 return options.re = false;
10608
10609 if (!options.regExp)
10610 needle = lang.escapeRegExp(needle);
10611
10612 if (options.wholeWord)
10613 needle = "\\b" + needle + "\\b";
10614
10615 var modifier = options.caseSensitive ? "g" : "gi";
10616
10617 options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle);
10618 if (options.$isMultiLine)
10619 return options.re = this.$assembleMultilineRegExp(needle, modifier);
10620
10621 try {
10622 var re = new RegExp(needle, modifier);
10623 } catch(e) {
10624 re = false;
10625 }
10626 return options.re = re;
10627 };
10628
10629 this.$assembleMultilineRegExp = function(needle, modifier) {
10630 var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n");
10631 var re = [];
10632 for (var i = 0; i < parts.length; i++) try {
10633 re.push(new RegExp(parts[i], modifier));
10634 } catch(e) {
10635 return false;
10636 }
10637 if (parts[0] == "") {
10638 re.shift();
10639 re.offset = 1;
10640 } else {
10641 re.offset = 0;
10642 }
10643 return re;
10644 };
10645
10646 this.$lineIterator = function(session, options) {
10647 var backwards = options.backwards == true;
10648 var skipCurrent = options.skipCurrent != false;
10649
10650 var range = options.range;
10651 var start = options.start;
10652 if (!start)
10653 start = range ? range[backwards ? "end" : "start"] : session.selection.getRange();
10654
10655 if (start.start)
10656 start = start[skipCurrent != backwards ? "end" : "start"];
10657
10658 var firstRow = range ? range.start.row : 0;
10659 var lastRow = range ? range.end.row : session.getLength() - 1;
10660
10661 var forEach = backwards ? function(callback) {
10662 var row = start.row;
10663
10664 var line = session.getLine(row).substring(0, start.column);
10665 if (callback(line, row))
10666 return;
10667
10668 for (row--; row >= firstRow; row--)
10669 if (callback(session.getLine(row), row))
10670 return;
10671
10672 if (options.wrap == false)
10673 return;
10674
10675 for (row = lastRow, firstRow = start.row; row >= firstRow; row--)
10676 if (callback(session.getLine(row), row))
10677 return;
10678 } : function(callback) {
10679 var row = start.row;
10680
10681 var line = session.getLine(row).substr(start.column);
10682 if (callback(line, row, start.column))
10683 return;
10684
10685 for (row = row+1; row <= lastRow; row++)
10686 if (callback(session.getLine(row), row))
10687 return;
10688
10689 if (options.wrap == false)
10690 return;
10691
10692 for (row = firstRow, lastRow = start.row; row <= lastRow; row++)
10693 if (callback(session.getLine(row), row))
10694 return;
10695 };
10696
10697 return {forEach: forEach};
10698 };
10699
10700 }).call(Search.prototype);
10701
10702 exports.Search = Search;
10703 });
10704 define('ace/commands/command_manager', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/keyboard/hash_handler', 'ace/lib/event_emitter'], function(require, exports, module) {
10705
10706
10707 var oop = require("../lib/oop");
10708 var HashHandler = require("../keyboard/hash_handler").HashHandler;
10709 var EventEmitter = require("../lib/event_emitter").EventEmitter;
10710
10711 var CommandManager = function(platform, commands) {
10712 this.platform = platform;
10713 this.commands = this.byName = {};
10714 this.commmandKeyBinding = {};
10715
10716 this.addCommands(commands);
10717
10718 this.setDefaultHandler("exec", function(e) {
10719 return e.command.exec(e.editor, e.args || {});
10720 });
10721 };
10722
10723 oop.inherits(CommandManager, HashHandler);
10724
10725 (function() {
10726
10727 oop.implement(this, EventEmitter);
10728
10729 this.exec = function(command, editor, args) {
10730 if (typeof command === 'string')
10731 command = this.commands[command];
10732
10733 if (!command)
10734 return false;
10735
10736 if (editor && editor.$readOnly && !command.readOnly)
10737 return false;
10738
10739 var e = {editor: editor, command: command, args: args};
10740 var retvalue = this._emit("exec", e);
10741 this._signal("afterExec", e);
10742
10743 return retvalue === false ? false : true;
10744 };
10745
10746 this.toggleRecording = function(editor) {
10747 if (this.$inReplay)
10748 return;
10749
10750 editor && editor._emit("changeStatus");
10751 if (this.recording) {
10752 this.macro.pop();
10753 this.removeEventListener("exec", this.$addCommandToMacro);
10754
10755 if (!this.macro.length)
10756 this.macro = this.oldMacro;
10757
10758 return this.recording = false;
10759 }
10760 if (!this.$addCommandToMacro) {
10761 this.$addCommandToMacro = function(e) {
10762 this.macro.push([e.command, e.args]);
10763 }.bind(this);
10764 }
10765
10766 this.oldMacro = this.macro;
10767 this.macro = [];
10768 this.on("exec", this.$addCommandToMacro);
10769 return this.recording = true;
10770 };
10771
10772 this.replay = function(editor) {
10773 if (this.$inReplay || !this.macro)
10774 return;
10775
10776 if (this.recording)
10777 return this.toggleRecording(editor);
10778
10779 try {
10780 this.$inReplay = true;
10781 this.macro.forEach(function(x) {
10782 if (typeof x == "string")
10783 this.exec(x, editor);
10784 else
10785 this.exec(x[0], editor, x[1]);
10786 }, this);
10787 } finally {
10788 this.$inReplay = false;
10789 }
10790 };
10791
10792 this.trimMacro = function(m) {
10793 return m.map(function(x){
10794 if (typeof x[0] != "string")
10795 x[0] = x[0].name;
10796 if (!x[1])
10797 x = x[0];
10798 return x;
10799 });
10800 };
10801
10802 }).call(CommandManager.prototype);
10803
10804 exports.CommandManager = CommandManager;
10805
10806 });
10807
10808 define('ace/keyboard/hash_handler', ['require', 'exports', 'module' , 'ace/lib/keys', 'ace/lib/useragent'], function(require, exports, module) {
10809
10810
10811 var keyUtil = require("../lib/keys");
10812 var useragent = require("../lib/useragent");
10813
10814 function HashHandler(config, platform) {
10815 this.platform = platform || (useragent.isMac ? "mac" : "win");
10816 this.commands = {};
10817 this.commmandKeyBinding = {};
10818
10819 this.addCommands(config);
10820 };
10821
10822 (function() {
10823
10824 this.addCommand = function(command) {
10825 if (this.commands[command.name])
10826 this.removeCommand(command);
10827
10828 this.commands[command.name] = command;
10829
10830 if (command.bindKey)
10831 this._buildKeyHash(command);
10832 };
10833
10834 this.removeCommand = function(command) {
10835 var name = (typeof command === 'string' ? command : command.name);
10836 command = this.commands[name];
10837 delete this.commands[name];
10838 var ckb = this.commmandKeyBinding;
10839 for (var hashId in ckb) {
10840 for (var key in ckb[hashId]) {
10841 if (ckb[hashId][key] == command)
10842 delete ckb[hashId][key];
10843 }
10844 }
10845 };
10846
10847 this.bindKey = function(key, command) {
10848 if(!key)
10849 return;
10850 if (typeof command == "function") {
10851 this.addCommand({exec: command, bindKey: key, name: command.name || key});
10852 return;
10853 }
10854
10855 var ckb = this.commmandKeyBinding;
10856 key.split("|").forEach(function(keyPart) {
10857 var binding = this.parseKeys(keyPart, command);
10858 var hashId = binding.hashId;
10859 (ckb[hashId] || (ckb[hashId] = {}))[binding.key] = command;
10860 }, this);
10861 };
10862
10863 this.addCommands = function(commands) {
10864 commands && Object.keys(commands).forEach(function(name) {
10865 var command = commands[name];
10866 if (typeof command === "string")
10867 return this.bindKey(command, name);
10868
10869 if (typeof command === "function")
10870 command = { exec: command };
10871
10872 if (!command.name)
10873 command.name = name;
10874
10875 this.addCommand(command);
10876 }, this);
10877 };
10878
10879 this.removeCommands = function(commands) {
10880 Object.keys(commands).forEach(function(name) {
10881 this.removeCommand(commands[name]);
10882 }, this);
10883 };
10884
10885 this.bindKeys = function(keyList) {
10886 Object.keys(keyList).forEach(function(key) {
10887 this.bindKey(key, keyList[key]);
10888 }, this);
10889 };
10890
10891 this._buildKeyHash = function(command) {
10892 var binding = command.bindKey;
10893 if (!binding)
10894 return;
10895
10896 var key = typeof binding == "string" ? binding: binding[this.platform];
10897 this.bindKey(key, command);
10898 };
10899 this.parseKeys = function(keys) {
10900 if (keys.indexOf(" ") != -1)
10901 keys = keys.split(/\s+/).pop();
10902
10903 var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x});
10904 var key = parts.pop();
10905
10906 var keyCode = keyUtil[key];
10907 if (keyUtil.FUNCTION_KEYS[keyCode])
10908 key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();
10909 else if (!parts.length)
10910 return {key: key, hashId: -1};
10911 else if (parts.length == 1 && parts[0] == "shift")
10912 return {key: key.toUpperCase(), hashId: -1};
10913
10914 var hashId = 0;
10915 for (var i = parts.length; i--;) {
10916 var modifier = keyUtil.KEY_MODS[parts[i]];
10917 if (modifier == null) {
10918 if (typeof console != "undefined")
10919 console.error("invalid modifier " + parts[i] + " in " + keys);
10920 return false;
10921 }
10922 hashId |= modifier;
10923 }
10924 return {key: key, hashId: hashId};
10925 };
10926
10927 this.findKeyCommand = function findKeyCommand(hashId, keyString) {
10928 var ckbr = this.commmandKeyBinding;
10929 return ckbr[hashId] && ckbr[hashId][keyString];
10930 };
10931
10932 this.handleKeyboard = function(data, hashId, keyString, keyCode) {
10933 return {
10934 command: this.findKeyCommand(hashId, keyString)
10935 };
10936 };
10937
10938 }).call(HashHandler.prototype)
10939
10940 exports.HashHandler = HashHandler;
10941 });
10942
10943 define('ace/commands/default_commands', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/config'], function(require, exports, module) {
10944
10945
10946 var lang = require("../lib/lang");
10947 var config = require("../config");
10948
10949 function bindKey(win, mac) {
10950 return {
10951 win: win,
10952 mac: mac
10953 };
10954 }
10955
10956 exports.commands = [{
10957 name: "showSettingsMenu",
10958 bindKey: bindKey("Ctrl-,", "Command-,"),
10959 exec: function(editor) {
10960 config.loadModule("ace/ext/settings_menu", function(module) {
10961 module.init(editor);
10962 editor.showSettingsMenu();
10963 });
10964 },
10965 readOnly: true
10966 }, {
10967 name: "selectall",
10968 bindKey: bindKey("Ctrl-A", "Command-A"),
10969 exec: function(editor) { editor.selectAll(); },
10970 readOnly: true
10971 }, {
10972 name: "centerselection",
10973 bindKey: bindKey(null, "Ctrl-L"),
10974 exec: function(editor) { editor.centerSelection(); },
10975 readOnly: true
10976 }, {
10977 name: "gotoline",
10978 bindKey: bindKey("Ctrl-L", "Command-L"),
10979 exec: function(editor) {
10980 var line = parseInt(prompt("Enter line number:"), 10);
10981 if (!isNaN(line)) {
10982 editor.gotoLine(line);
10983 }
10984 },
10985 readOnly: true
10986 }, {
10987 name: "fold",
10988 bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
10989 exec: function(editor) { editor.session.toggleFold(false); },
10990 readOnly: true
10991 }, {
10992 name: "unfold",
10993 bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
10994 exec: function(editor) { editor.session.toggleFold(true); },
10995 readOnly: true
10996 }, {
10997 name: "foldall",
10998 bindKey: bindKey("Alt-0", "Command-Option-0"),
10999 exec: function(editor) { editor.session.foldAll(); },
11000 readOnly: true
11001 }, {
11002 name: "unfoldall",
11003 bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
11004 exec: function(editor) { editor.session.unfold(); },
11005 readOnly: true
11006 }, {
11007 name: "findnext",
11008 bindKey: bindKey("Ctrl-K", "Command-G"),
11009 exec: function(editor) { editor.findNext(); },
11010 readOnly: true
11011 }, {
11012 name: "findprevious",
11013 bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
11014 exec: function(editor) { editor.findPrevious(); },
11015 readOnly: true
11016 }, {
11017 name: "find",
11018 bindKey: bindKey("Ctrl-F", "Command-F"),
11019 exec: function(editor) {
11020 config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor)});
11021 },
11022 readOnly: true
11023 }, {
11024 name: "overwrite",
11025 bindKey: "Insert",
11026 exec: function(editor) { editor.toggleOverwrite(); },
11027 readOnly: true
11028 }, {
11029 name: "selecttostart",
11030 bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
11031 exec: function(editor) { editor.getSelection().selectFileStart(); },
11032 multiSelectAction: "forEach",
11033 readOnly: true
11034 }, {
11035 name: "gotostart",
11036 bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
11037 exec: function(editor) { editor.navigateFileStart(); },
11038 multiSelectAction: "forEach",
11039 readOnly: true
11040 }, {
11041 name: "selectup",
11042 bindKey: bindKey("Shift-Up", "Shift-Up"),
11043 exec: function(editor) { editor.getSelection().selectUp(); },
11044 multiSelectAction: "forEach",
11045 readOnly: true
11046 }, {
11047 name: "golineup",
11048 bindKey: bindKey("Up", "Up|Ctrl-P"),
11049 exec: function(editor, args) { editor.navigateUp(args.times); },
11050 multiSelectAction: "forEach",
11051 readOnly: true
11052 }, {
11053 name: "selecttoend",
11054 bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
11055 exec: function(editor) { editor.getSelection().selectFileEnd(); },
11056 multiSelectAction: "forEach",
11057 readOnly: true
11058 }, {
11059 name: "gotoend",
11060 bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
11061 exec: function(editor) { editor.navigateFileEnd(); },
11062 multiSelectAction: "forEach",
11063 readOnly: true
11064 }, {
11065 name: "selectdown",
11066 bindKey: bindKey("Shift-Down", "Shift-Down"),
11067 exec: function(editor) { editor.getSelection().selectDown(); },
11068 multiSelectAction: "forEach",
11069 readOnly: true
11070 }, {
11071 name: "golinedown",
11072 bindKey: bindKey("Down", "Down|Ctrl-N"),
11073 exec: function(editor, args) { editor.navigateDown(args.times); },
11074 multiSelectAction: "forEach",
11075 readOnly: true
11076 }, {
11077 name: "selectwordleft",
11078 bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
11079 exec: function(editor) { editor.getSelection().selectWordLeft(); },
11080 multiSelectAction: "forEach",
11081 readOnly: true
11082 }, {
11083 name: "gotowordleft",
11084 bindKey: bindKey("Ctrl-Left", "Option-Left"),
11085 exec: function(editor) { editor.navigateWordLeft(); },
11086 multiSelectAction: "forEach",
11087 readOnly: true
11088 }, {
11089 name: "selecttolinestart",
11090 bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
11091 exec: function(editor) { editor.getSelection().selectLineStart(); },
11092 multiSelectAction: "forEach",
11093 readOnly: true
11094 }, {
11095 name: "gotolinestart",
11096 bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
11097 exec: function(editor) { editor.navigateLineStart(); },
11098 multiSelectAction: "forEach",
11099 readOnly: true
11100 }, {
11101 name: "selectleft",
11102 bindKey: bindKey("Shift-Left", "Shift-Left"),
11103 exec: function(editor) { editor.getSelection().selectLeft(); },
11104 multiSelectAction: "forEach",
11105 readOnly: true
11106 }, {
11107 name: "gotoleft",
11108 bindKey: bindKey("Left", "Left|Ctrl-B"),
11109 exec: function(editor, args) { editor.navigateLeft(args.times); },
11110 multiSelectAction: "forEach",
11111 readOnly: true
11112 }, {
11113 name: "selectwordright",
11114 bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
11115 exec: function(editor) { editor.getSelection().selectWordRight(); },
11116 multiSelectAction: "forEach",
11117 readOnly: true
11118 }, {
11119 name: "gotowordright",
11120 bindKey: bindKey("Ctrl-Right", "Option-Right"),
11121 exec: function(editor) { editor.navigateWordRight(); },
11122 multiSelectAction: "forEach",
11123 readOnly: true
11124 }, {
11125 name: "selecttolineend",
11126 bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
11127 exec: function(editor) { editor.getSelection().selectLineEnd(); },
11128 multiSelectAction: "forEach",
11129 readOnly: true
11130 }, {
11131 name: "gotolineend",
11132 bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
11133 exec: function(editor) { editor.navigateLineEnd(); },
11134 multiSelectAction: "forEach",
11135 readOnly: true
11136 }, {
11137 name: "selectright",
11138 bindKey: bindKey("Shift-Right", "Shift-Right"),
11139 exec: function(editor) { editor.getSelection().selectRight(); },
11140 multiSelectAction: "forEach",
11141 readOnly: true
11142 }, {
11143 name: "gotoright",
11144 bindKey: bindKey("Right", "Right|Ctrl-F"),
11145 exec: function(editor, args) { editor.navigateRight(args.times); },
11146 multiSelectAction: "forEach",
11147 readOnly: true
11148 }, {
11149 name: "selectpagedown",
11150 bindKey: "Shift-PageDown",
11151 exec: function(editor) { editor.selectPageDown(); },
11152 readOnly: true
11153 }, {
11154 name: "pagedown",
11155 bindKey: bindKey(null, "Option-PageDown"),
11156 exec: function(editor) { editor.scrollPageDown(); },
11157 readOnly: true
11158 }, {
11159 name: "gotopagedown",
11160 bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
11161 exec: function(editor) { editor.gotoPageDown(); },
11162 readOnly: true
11163 }, {
11164 name: "selectpageup",
11165 bindKey: "Shift-PageUp",
11166 exec: function(editor) { editor.selectPageUp(); },
11167 readOnly: true
11168 }, {
11169 name: "pageup",
11170 bindKey: bindKey(null, "Option-PageUp"),
11171 exec: function(editor) { editor.scrollPageUp(); },
11172 readOnly: true
11173 }, {
11174 name: "gotopageup",
11175 bindKey: "PageUp",
11176 exec: function(editor) { editor.gotoPageUp(); },
11177 readOnly: true
11178 }, {
11179 name: "scrollup",
11180 bindKey: bindKey("Ctrl-Up", null),
11181 exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },
11182 readOnly: true
11183 }, {
11184 name: "scrolldown",
11185 bindKey: bindKey("Ctrl-Down", null),
11186 exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },
11187 readOnly: true
11188 }, {
11189 name: "selectlinestart",
11190 bindKey: "Shift-Home",
11191 exec: function(editor) { editor.getSelection().selectLineStart(); },
11192 multiSelectAction: "forEach",
11193 readOnly: true
11194 }, {
11195 name: "selectlineend",
11196 bindKey: "Shift-End",
11197 exec: function(editor) { editor.getSelection().selectLineEnd(); },
11198 multiSelectAction: "forEach",
11199 readOnly: true
11200 }, {
11201 name: "togglerecording",
11202 bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
11203 exec: function(editor) { editor.commands.toggleRecording(editor); },
11204 readOnly: true
11205 }, {
11206 name: "replaymacro",
11207 bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
11208 exec: function(editor) { editor.commands.replay(editor); },
11209 readOnly: true
11210 }, {
11211 name: "jumptomatching",
11212 bindKey: bindKey("Ctrl-P", "Ctrl-Shift-P"),
11213 exec: function(editor) { editor.jumpToMatching(); },
11214 multiSelectAction: "forEach",
11215 readOnly: true
11216 }, {
11217 name: "selecttomatching",
11218 bindKey: bindKey("Ctrl-Shift-P", null),
11219 exec: function(editor) { editor.jumpToMatching(true); },
11220 multiSelectAction: "forEach",
11221 readOnly: true
11222 },
11223 {
11224 name: "cut",
11225 exec: function(editor) {
11226 var range = editor.getSelectionRange();
11227 editor._emit("cut", range);
11228
11229 if (!editor.selection.isEmpty()) {
11230 editor.session.remove(range);
11231 editor.clearSelection();
11232 }
11233 },
11234 multiSelectAction: "forEach"
11235 }, {
11236 name: "removeline",
11237 bindKey: bindKey("Ctrl-D", "Command-D"),
11238 exec: function(editor) { editor.removeLines(); },
11239 multiSelectAction: "forEachLine"
11240 }, {
11241 name: "duplicateSelection",
11242 bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
11243 exec: function(editor) { editor.duplicateSelection(); },
11244 multiSelectAction: "forEach"
11245 }, {
11246 name: "sortlines",
11247 bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
11248 exec: function(editor) { editor.sortLines(); },
11249 multiSelectAction: "forEachLine"
11250 }, {
11251 name: "togglecomment",
11252 bindKey: bindKey("Ctrl-/", "Command-/"),
11253 exec: function(editor) { editor.toggleCommentLines(); },
11254 multiSelectAction: "forEachLine"
11255 }, {
11256 name: "toggleBlockComment",
11257 bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
11258 exec: function(editor) { editor.toggleBlockComment(); },
11259 multiSelectAction: "forEach"
11260 }, {
11261 name: "modifyNumberUp",
11262 bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
11263 exec: function(editor) { editor.modifyNumber(1); },
11264 multiSelectAction: "forEach"
11265 }, {
11266 name: "modifyNumberDown",
11267 bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
11268 exec: function(editor) { editor.modifyNumber(-1); },
11269 multiSelectAction: "forEach"
11270 }, {
11271 name: "replace",
11272 bindKey: bindKey("Ctrl-H", "Command-Option-F"),
11273 exec: function(editor) {
11274 config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true)});
11275 }
11276 }, {
11277 name: "undo",
11278 bindKey: bindKey("Ctrl-Z", "Command-Z"),
11279 exec: function(editor) { editor.undo(); }
11280 }, {
11281 name: "redo",
11282 bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
11283 exec: function(editor) { editor.redo(); }
11284 }, {
11285 name: "copylinesup",
11286 bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
11287 exec: function(editor) { editor.copyLinesUp(); }
11288 }, {
11289 name: "movelinesup",
11290 bindKey: bindKey("Alt-Up", "Option-Up"),
11291 exec: function(editor) { editor.moveLinesUp(); }
11292 }, {
11293 name: "copylinesdown",
11294 bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
11295 exec: function(editor) { editor.copyLinesDown(); }
11296 }, {
11297 name: "movelinesdown",
11298 bindKey: bindKey("Alt-Down", "Option-Down"),
11299 exec: function(editor) { editor.moveLinesDown(); }
11300 }, {
11301 name: "del",
11302 bindKey: bindKey("Delete", "Delete|Ctrl-D"),
11303 exec: function(editor) { editor.remove("right"); },
11304 multiSelectAction: "forEach"
11305 }, {
11306 name: "backspace",
11307 bindKey: bindKey(
11308 "Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
11309 "Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
11310 ),
11311 exec: function(editor) { editor.remove("left"); },
11312 multiSelectAction: "forEach"
11313 }, {
11314 name: "removetolinestart",
11315 bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
11316 exec: function(editor) { editor.removeToLineStart(); },
11317 multiSelectAction: "forEach"
11318 }, {
11319 name: "removetolineend",
11320 bindKey: bindKey("Alt-Delete", "Ctrl-K"),
11321 exec: function(editor) { editor.removeToLineEnd(); },
11322 multiSelectAction: "forEach"
11323 }, {
11324 name: "removewordleft",
11325 bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
11326 exec: function(editor) { editor.removeWordLeft(); },
11327 multiSelectAction: "forEach"
11328 }, {
11329 name: "removewordright",
11330 bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
11331 exec: function(editor) { editor.removeWordRight(); },
11332 multiSelectAction: "forEach"
11333 }, {
11334 name: "outdent",
11335 bindKey: bindKey("Shift-Tab", "Shift-Tab"),
11336 exec: function(editor) { editor.blockOutdent(); },
11337 multiSelectAction: "forEach"
11338 }, {
11339 name: "indent",
11340 bindKey: bindKey("Tab", "Tab"),
11341 exec: function(editor) { editor.indent(); },
11342 multiSelectAction: "forEach"
11343 },{
11344 name: "blockoutdent",
11345 bindKey: bindKey("Ctrl-[", "Ctrl-["),
11346 exec: function(editor) { editor.blockOutdent(); },
11347 multiSelectAction: "forEachLine"
11348 },{
11349 name: "blockindent",
11350 bindKey: bindKey("Ctrl-]", "Ctrl-]"),
11351 exec: function(editor) { editor.blockIndent(); },
11352 multiSelectAction: "forEachLine"
11353 }, {
11354 name: "insertstring",
11355 exec: function(editor, str) { editor.insert(str); },
11356 multiSelectAction: "forEach"
11357 }, {
11358 name: "inserttext",
11359 exec: function(editor, args) {
11360 editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
11361 },
11362 multiSelectAction: "forEach"
11363 }, {
11364 name: "splitline",
11365 bindKey: bindKey(null, "Ctrl-O"),
11366 exec: function(editor) { editor.splitLine(); },
11367 multiSelectAction: "forEach"
11368 }, {
11369 name: "transposeletters",
11370 bindKey: bindKey("Ctrl-T", "Ctrl-T"),
11371 exec: function(editor) { editor.transposeLetters(); },
11372 multiSelectAction: function(editor) {editor.transposeSelections(1); }
11373 }, {
11374 name: "touppercase",
11375 bindKey: bindKey("Ctrl-U", "Ctrl-U"),
11376 exec: function(editor) { editor.toUpperCase(); },
11377 multiSelectAction: "forEach"
11378 }, {
11379 name: "tolowercase",
11380 bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
11381 exec: function(editor) { editor.toLowerCase(); },
11382 multiSelectAction: "forEach"
11383 }];
11384
11385 });
11386
11387 define('ace/undomanager', ['require', 'exports', 'module' ], function(require, exports, module) {
11388 var UndoManager = function() {
11389 this.reset();
11390 };
11391
11392 (function() {
11393 this.execute = function(options) {
11394 var deltas = options.args[0];
11395 this.$doc = options.args[1];
11396 this.$undoStack.push(deltas);
11397 this.$redoStack = [];
11398
11399 if (this.dirtyCounter < 0) {
11400 this.dirtyCounter = NaN;
11401 }
11402 this.dirtyCounter++;
11403 };
11404 this.undo = function(dontSelect) {
11405 var deltas = this.$undoStack.pop();
11406 var undoSelectionRange = null;
11407 if (deltas) {
11408 undoSelectionRange =
11409 this.$doc.undoChanges(deltas, dontSelect);
11410 this.$redoStack.push(deltas);
11411 this.dirtyCounter--;
11412 }
11413
11414 return undoSelectionRange;
11415 };
11416 this.redo = function(dontSelect) {
11417 var deltas = this.$redoStack.pop();
11418 var redoSelectionRange = null;
11419 if (deltas) {
11420 redoSelectionRange =
11421 this.$doc.redoChanges(deltas, dontSelect);
11422 this.$undoStack.push(deltas);
11423 this.dirtyCounter++;
11424 }
11425
11426 return redoSelectionRange;
11427 };
11428 this.reset = function() {
11429 this.$undoStack = [];
11430 this.$redoStack = [];
11431 this.dirtyCounter = 0;
11432 };
11433 this.hasUndo = function() {
11434 return this.$undoStack.length > 0;
11435 };
11436 this.hasRedo = function() {
11437 return this.$redoStack.length > 0;
11438 };
11439 this.markClean = function() {
11440 this.dirtyCounter = 0;
11441 };
11442 this.isClean = function() {
11443 return this.dirtyCounter === 0;
11444 };
11445
11446 }).call(UndoManager.prototype);
11447
11448 exports.UndoManager = UndoManager;
11449 });
11450
11451 define('ace/virtual_renderer', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/event', 'ace/lib/useragent', 'ace/config', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'ace/lib/event_emitter'], function(require, exports, module) {
11452
11453
11454 var oop = require("./lib/oop");
11455 var dom = require("./lib/dom");
11456 var event = require("./lib/event");
11457 var useragent = require("./lib/useragent");
11458 var config = require("./config");
11459 var GutterLayer = require("./layer/gutter").Gutter;
11460 var MarkerLayer = require("./layer/marker").Marker;
11461 var TextLayer = require("./layer/text").Text;
11462 var CursorLayer = require("./layer/cursor").Cursor;
11463 var ScrollBar = require("./scrollbar").ScrollBar;
11464 var RenderLoop = require("./renderloop").RenderLoop;
11465 var EventEmitter = require("./lib/event_emitter").EventEmitter;
11466 var editorCss = ".ace_editor {\
11467 position: relative;\
11468 overflow: hidden;\
11469 font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\
11470 font-size: 12px;\
11471 line-height: normal;\
11472 color: black;\
11473 }\
11474 .ace_scroller {\
11475 position: absolute;\
11476 overflow: hidden;\
11477 top: 0;\
11478 bottom: 0;\
11479 background-color: inherit;\
11480 }\
11481 .ace_content {\
11482 position: absolute;\
11483 -moz-box-sizing: border-box;\
11484 -webkit-box-sizing: border-box;\
11485 box-sizing: border-box;\
11486 cursor: text;\
11487 }\
11488 .ace_gutter {\
11489 position: absolute;\
11490 overflow : hidden;\
11491 width: auto;\
11492 top: 0;\
11493 bottom: 0;\
11494 left: 0;\
11495 cursor: default;\
11496 z-index: 4;\
11497 }\
11498 .ace_gutter-active-line {\
11499 position: absolute;\
11500 left: 0;\
11501 right: 0;\
11502 }\
11503 .ace_scroller.ace_scroll-left {\
11504 box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\
11505 }\
11506 .ace_gutter-cell {\
11507 padding-left: 19px;\
11508 padding-right: 6px;\
11509 background-repeat: no-repeat;\
11510 }\
11511 .ace_gutter-cell.ace_error {\
11512 background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTQ4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTU4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBMjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBMzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkgXxbAAAAJbSURBVHjapFNNaBNBFH4zs5vdZLP5sQmNpT82QY209heh1ioWisaDRcSKF0WKJ0GQnrzrxasHsR6EnlrwD0TagxJabaVEpFYxLWlLSS822tr87m66ccfd2GKyVhA6MMybgfe97/vmPUQphd0sZjto9XIn9OOsvlu2nkqRzVU+6vvlzPf8W6bk8dxQ0NPbxAALgCgg2JkaQuhzQau/El0zbmUA7U0Es8v2CiYmKQJHGO1QICCLoqilMhkmurDAyapKgqItezi/USRdJqEYY4D5jCy03ht2yMkkvL91jTTX10qzyyu2hruPRN7jgbH+EOsXcMLgYiThEgAMhABW85oqy1DXdRIdvP1AHJ2acQXvDIrVHcdQNrEKNYSVMSZGMjEzIIAwDXIo+6G/FxcGnzkC3T2oMhLjre49sBB+RRcHLqdafK6sYdE/GGBwU1VpFNj0aN8pJbe+BkZyevUrvLl6Xmm0W9IuTc0DxrDNAJd5oEvI/KRsNC3bQyNjPO9yQ1YHcfj2QvfQc/5TUhJTBc2iM0U7AWDQtc1nJHvD/cfO2s7jaGkiTEfa/Ep8coLu7zmNmh8+dc5lZDuUeFAGUNA/OY6JVaypQ0vjr7XYjUvJM37vt+j1vuTK5DgVfVUoTjVe+y3/LxMxY2GgU+CSLy4cpfsYorRXuXIOi0Vt40h67uZFTdIo6nLaZcwUJWAzwNS0tBnqqKzQDnjdG/iPyZxo46HaKUpbvYkj8qYRTZsBhge+JHhZyh0x9b95JqjVJkT084kZIPwu/mPWqPgfQ5jXh2+92Ay7HedfAgwA6KDWafb4w3cAAAAASUVORK5CYII=\");\
11513 background-repeat: no-repeat;\
11514 background-position: 2px center;\
11515 }\
11516 .ace_gutter-cell.ace_warning {\
11517 background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg==\");\
11518 background-position: 2px center;\
11519 }\
11520 .ace_gutter-cell.ace_info {\
11521 background-image: url(\"data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7\");\
11522 background-position: 2px center;\
11523 }\
11524 .ace_dark .ace_gutter-cell.ace_info {\
11525 background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=\");\
11526 }\
11527 .ace_scrollbar {\
11528 position: absolute;\
11529 overflow-x: hidden;\
11530 overflow-y: scroll;\
11531 right: 0;\
11532 top: 0;\
11533 bottom: 0;\
11534 }\
11535 .ace_scrollbar-inner {\
11536 position: absolute;\
11537 width: 1px;\
11538 left: 0;\
11539 }\
11540 .ace_print-margin {\
11541 position: absolute;\
11542 height: 100%;\
11543 }\
11544 .ace_text-input {\
11545 position: absolute;\
11546 z-index: 0;\
11547 width: 0.5em;\
11548 height: 1em;\
11549 opacity: 0;\
11550 background: transparent;\
11551 -moz-appearance: none;\
11552 appearance: none;\
11553 border: none;\
11554 resize: none;\
11555 outline: none;\
11556 overflow: hidden;\
11557 font: inherit;\
11558 padding: 0 1px;\
11559 margin: 0 -1px;\
11560 }\
11561 .ace_text-input.ace_composition {\
11562 background: #f8f8f8;\
11563 color: #111;\
11564 z-index: 1000;\
11565 opacity: 1;\
11566 }\
11567 .ace_layer {\
11568 z-index: 1;\
11569 position: absolute;\
11570 overflow: hidden;\
11571 white-space: nowrap;\
11572 height: 100%;\
11573 width: 100%;\
11574 -moz-box-sizing: border-box;\
11575 -webkit-box-sizing: border-box;\
11576 box-sizing: border-box;\
11577 /* setting pointer-events: auto; on node under the mouse, which changes\
11578 during scroll, will break mouse wheel scrolling in Safari */\
11579 pointer-events: none;\
11580 }\
11581 .ace_gutter-layer {\
11582 position: relative;\
11583 width: auto;\
11584 text-align: right;\
11585 pointer-events: auto;\
11586 }\
11587 .ace_text-layer {\
11588 font: inherit !important;\
11589 }\
11590 .ace_cjk {\
11591 display: inline-block;\
11592 text-align: center;\
11593 }\
11594 .ace_cursor-layer {\
11595 z-index: 4;\
11596 }\
11597 .ace_cursor {\
11598 z-index: 4;\
11599 position: absolute;\
11600 -moz-box-sizing: border-box;\
11601 -webkit-box-sizing: border-box;\
11602 box-sizing: border-box;\
11603 }\
11604 .ace_hidden-cursors .ace_cursor {\
11605 opacity: 0.2;\
11606 }\
11607 .ace_smooth-blinking .ace_cursor {\
11608 -moz-transition: opacity 0.18s;\
11609 -webkit-transition: opacity 0.18s;\
11610 -o-transition: opacity 0.18s;\
11611 -ms-transition: opacity 0.18s;\
11612 transition: opacity 0.18s;\
11613 }\
11614 .ace_cursor[style*=\"opacity: 0\"]{\
11615 -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\
11616 }\
11617 .ace_editor.ace_multiselect .ace_cursor {\
11618 border-left-width: 1px;\
11619 }\
11620 .ace_line {\
11621 white-space: nowrap;\
11622 }\
11623 .ace_marker-layer .ace_step {\
11624 position: absolute;\
11625 z-index: 3;\
11626 }\
11627 .ace_marker-layer .ace_selection {\
11628 position: absolute;\
11629 z-index: 5;\
11630 }\
11631 .ace_marker-layer .ace_bracket {\
11632 position: absolute;\
11633 z-index: 6;\
11634 }\
11635 .ace_marker-layer .ace_active-line {\
11636 position: absolute;\
11637 z-index: 2;\
11638 }\
11639 .ace_marker-layer .ace_selected-word {\
11640 position: absolute;\
11641 z-index: 4;\
11642 -moz-box-sizing: border-box;\
11643 -webkit-box-sizing: border-box;\
11644 box-sizing: border-box;\
11645 }\
11646 .ace_line .ace_fold {\
11647 -moz-box-sizing: border-box;\
11648 -webkit-box-sizing: border-box;\
11649 box-sizing: border-box;\
11650 display: inline-block;\
11651 height: 11px;\
11652 margin-top: -2px;\
11653 vertical-align: middle;\
11654 background-image:\
11655 url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82\"),\
11656 url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%3AIDAT8%11c%FC%FF%FF%7F%18%03%1A%60%01%F2%3F%A0%891%80%04%FF%11-%F8%17%9BJ%E2%05%B1ZD%81v%26t%E7%80%F8%A3%82h%A12%1A%20%A3%01%02%0F%01%BA%25%06%00%19%C0%0D%AEF%D5%3ES%00%00%00%00IEND%AEB%60%82\");\
11657 background-repeat: no-repeat, repeat-x;\
11658 background-position: center center, top left;\
11659 color: transparent;\
11660 border: 1px solid black;\
11661 -moz-border-radius: 2px;\
11662 -webkit-border-radius: 2px;\
11663 border-radius: 2px;\
11664 cursor: pointer;\
11665 pointer-events: auto;\
11666 }\
11667 .ace_dark .ace_fold {\
11668 }\
11669 .ace_fold:hover{\
11670 background-image:\
11671 url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82\"),\
11672 url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%003IDAT8%11c%FC%FF%FF%7F%3E%03%1A%60%01%F2%3F%A3%891%80%04%FFQ%26%F8w%C0%B43%A1%DB%0C%E2%8F%0A%A2%85%CAh%80%8C%06%08%3C%04%E8%96%18%00%A3S%0D%CD%CF%D8%C1%9D%00%00%00%00IEND%AEB%60%82\");\
11673 background-repeat: no-repeat, repeat-x;\
11674 background-position: center center, top left;\
11675 }\
11676 .ace_editor.ace_dragging .ace_content {\
11677 cursor: move;\
11678 }\
11679 .ace_gutter-tooltip {\
11680 background-color: #FFF;\
11681 background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));\
11682 background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\
11683 border: 1px solid gray;\
11684 border-radius: 1px;\
11685 box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\
11686 color: black;\
11687 display: inline-block;\
11688 max-width: 500px;\
11689 padding: 4px;\
11690 position: fixed;\
11691 z-index: 300;\
11692 -moz-box-sizing: border-box;\
11693 -webkit-box-sizing: border-box;\
11694 box-sizing: border-box;\
11695 cursor: default;\
11696 white-space: pre-line;\
11697 word-wrap: break-word;\
11698 line-height: normal;\
11699 font-style: normal;\
11700 font-weight: normal;\
11701 letter-spacing: normal;\
11702 }\
11703 .ace_folding-enabled > .ace_gutter-cell {\
11704 padding-right: 13px;\
11705 }\
11706 .ace_fold-widget {\
11707 -moz-box-sizing: border-box;\
11708 -webkit-box-sizing: border-box;\
11709 box-sizing: border-box;\
11710 margin: 0 -12px 0 1px;\
11711 display: none;\
11712 width: 11px;\
11713 vertical-align: top;\
11714 background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82\");\
11715 background-repeat: no-repeat;\
11716 background-position: center;\
11717 border-radius: 3px;\
11718 border: 1px solid transparent;\
11719 cursor: pointer;\
11720 }\
11721 .ace_folding-enabled .ace_fold-widget {\
11722 display: inline-block; \
11723 }\
11724 .ace_fold-widget.ace_end {\
11725 background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82\");\
11726 }\
11727 .ace_fold-widget.ace_closed {\
11728 background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82\");\
11729 }\
11730 .ace_fold-widget:hover {\
11731 border: 1px solid rgba(0, 0, 0, 0.3);\
11732 background-color: rgba(255, 255, 255, 0.2);\
11733 -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\
11734 -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\
11735 box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\
11736 }\
11737 .ace_fold-widget:active {\
11738 border: 1px solid rgba(0, 0, 0, 0.4);\
11739 background-color: rgba(0, 0, 0, 0.05);\
11740 -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\
11741 -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\
11742 box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\
11743 }\
11744 /**\
11745 * Dark version for fold widgets\
11746 */\
11747 .ace_dark .ace_fold-widget {\
11748 background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\");\
11749 }\
11750 .ace_dark .ace_fold-widget.ace_end {\
11751 background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\");\
11752 }\
11753 .ace_dark .ace_fold-widget.ace_closed {\
11754 background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\");\
11755 }\
11756 .ace_dark .ace_fold-widget:hover {\
11757 box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
11758 background-color: rgba(255, 255, 255, 0.1);\
11759 }\
11760 .ace_dark .ace_fold-widget:active {\
11761 -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
11762 -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
11763 box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
11764 }\
11765 .ace_fold-widget.ace_invalid {\
11766 background-color: #FFB4B4;\
11767 border-color: #DE5555;\
11768 }\
11769 .ace_fade-fold-widgets .ace_fold-widget {\
11770 -moz-transition: opacity 0.4s ease 0.05s;\
11771 -webkit-transition: opacity 0.4s ease 0.05s;\
11772 -o-transition: opacity 0.4s ease 0.05s;\
11773 -ms-transition: opacity 0.4s ease 0.05s;\
11774 transition: opacity 0.4s ease 0.05s;\
11775 opacity: 0;\
11776 }\
11777 .ace_fade-fold-widgets:hover .ace_fold-widget {\
11778 -moz-transition: opacity 0.05s ease 0.05s;\
11779 -webkit-transition: opacity 0.05s ease 0.05s;\
11780 -o-transition: opacity 0.05s ease 0.05s;\
11781 -ms-transition: opacity 0.05s ease 0.05s;\
11782 transition: opacity 0.05s ease 0.05s;\
11783 opacity:1;\
11784 }\
11785 .ace_underline {\
11786 text-decoration: underline;\
11787 }\
11788 .ace_bold {\
11789 font-weight: bold;\
11790 }\
11791 .ace_nobold .ace_bold {\
11792 font-weight: normal;\
11793 }\
11794 .ace_italic {\
11795 font-style: italic;\
11796 }\
11797 ";
11798
11799 dom.importCssString(editorCss, "ace_editor");
11800
11801 var VirtualRenderer = function(container, theme) {
11802 var _self = this;
11803
11804 this.container = container || dom.createElement("div");
11805 this.$keepTextAreaAtCursor = !useragent.isIE;
11806
11807 dom.addCssClass(this.container, "ace_editor");
11808
11809 this.setTheme(theme);
11810
11811 this.$gutter = dom.createElement("div");
11812 this.$gutter.className = "ace_gutter";
11813 this.container.appendChild(this.$gutter);
11814
11815 this.scroller = dom.createElement("div");
11816 this.scroller.className = "ace_scroller";
11817 this.container.appendChild(this.scroller);
11818
11819 this.content = dom.createElement("div");
11820 this.content.className = "ace_content";
11821 this.scroller.appendChild(this.content);
11822
11823 this.$gutterLayer = new GutterLayer(this.$gutter);
11824 this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this));
11825
11826 this.$markerBack = new MarkerLayer(this.content);
11827
11828 var textLayer = this.$textLayer = new TextLayer(this.content);
11829 this.canvas = textLayer.element;
11830
11831 this.$markerFront = new MarkerLayer(this.content);
11832
11833 this.$cursorLayer = new CursorLayer(this.content);
11834 this.$horizScroll = false;
11835
11836 this.scrollBar = new ScrollBar(this.container);
11837 this.scrollBar.addEventListener("scroll", function(e) {
11838 if (!_self.$scrollAnimation)
11839 _self.session.setScrollTop(e.data);
11840 });
11841
11842 this.scrollTop = 0;
11843 this.scrollLeft = 0;
11844
11845 event.addListener(this.scroller, "scroll", function() {
11846 var scrollLeft = _self.scroller.scrollLeft;
11847 _self.scrollLeft = scrollLeft;
11848 _self.session.setScrollLeft(scrollLeft);
11849 });
11850
11851 this.cursorPos = {
11852 row : 0,
11853 column : 0
11854 };
11855
11856 this.$textLayer.addEventListener("changeCharacterSize", function() {
11857 _self.updateCharacterSize();
11858 _self.onResize(true);
11859 });
11860
11861 this.$size = {
11862 width: 0,
11863 height: 0,
11864 scrollerHeight: 0,
11865 scrollerWidth: 0
11866 };
11867
11868 this.layerConfig = {
11869 width : 1,
11870 padding : 0,
11871 firstRow : 0,
11872 firstRowScreen: 0,
11873 lastRow : 0,
11874 lineHeight : 1,
11875 characterWidth : 1,
11876 minHeight : 1,
11877 maxHeight : 1,
11878 offset : 0,
11879 height : 1
11880 };
11881
11882 this.$loop = new RenderLoop(
11883 this.$renderChanges.bind(this),
11884 this.container.ownerDocument.defaultView
11885 );
11886 this.$loop.schedule(this.CHANGE_FULL);
11887
11888 this.updateCharacterSize();
11889 this.setPadding(4);
11890 config.resetOptions(this);
11891 config._emit("renderer", this);
11892 };
11893
11894 (function() {
11895
11896 this.CHANGE_CURSOR = 1;
11897 this.CHANGE_MARKER = 2;
11898 this.CHANGE_GUTTER = 4;
11899 this.CHANGE_SCROLL = 8;
11900 this.CHANGE_LINES = 16;
11901 this.CHANGE_TEXT = 32;
11902 this.CHANGE_SIZE = 64;
11903 this.CHANGE_MARKER_BACK = 128;
11904 this.CHANGE_MARKER_FRONT = 256;
11905 this.CHANGE_FULL = 512;
11906 this.CHANGE_H_SCROLL = 1024;
11907
11908 oop.implement(this, EventEmitter);
11909
11910 this.updateCharacterSize = function() {
11911 if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {
11912 this.$allowBoldFonts = this.$textLayer.allowBoldFonts;
11913 this.setStyle("ace_nobold", !this.$allowBoldFonts);
11914 }
11915
11916 this.characterWidth = this.$textLayer.getCharacterWidth();
11917 this.lineHeight = this.$textLayer.getLineHeight();
11918 this.$updatePrintMargin();
11919 };
11920 this.setSession = function(session) {
11921 this.session = session;
11922
11923 this.scroller.className = "ace_scroller";
11924
11925 this.$cursorLayer.setSession(session);
11926 this.$markerBack.setSession(session);
11927 this.$markerFront.setSession(session);
11928 this.$gutterLayer.setSession(session);
11929 this.$textLayer.setSession(session);
11930 this.$loop.schedule(this.CHANGE_FULL);
11931
11932 };
11933 this.updateLines = function(firstRow, lastRow) {
11934 if (lastRow === undefined)
11935 lastRow = Infinity;
11936
11937 if (!this.$changedLines) {
11938 this.$changedLines = {
11939 firstRow: firstRow,
11940 lastRow: lastRow
11941 };
11942 }
11943 else {
11944 if (this.$changedLines.firstRow > firstRow)
11945 this.$changedLines.firstRow = firstRow;
11946
11947 if (this.$changedLines.lastRow < lastRow)
11948 this.$changedLines.lastRow = lastRow;
11949 }
11950
11951 if (this.$changedLines.firstRow > this.layerConfig.lastRow ||
11952 this.$changedLines.lastRow < this.layerConfig.firstRow)
11953 return;
11954 this.$loop.schedule(this.CHANGE_LINES);
11955 };
11956
11957 this.onChangeTabSize = function() {
11958 this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);
11959 this.$textLayer.onChangeTabSize();
11960 };
11961 this.updateText = function() {
11962 this.$loop.schedule(this.CHANGE_TEXT);
11963 };
11964 this.updateFull = function(force) {
11965 if (force)
11966 this.$renderChanges(this.CHANGE_FULL, true);
11967 else
11968 this.$loop.schedule(this.CHANGE_FULL);
11969 };
11970 this.updateFontSize = function() {
11971 this.$textLayer.checkForSizeChanges();
11972 };
11973 this.onResize = function(force, gutterWidth, width, height) {
11974 var changes = 0;
11975 var size = this.$size;
11976
11977 if (this.resizing > 2)
11978 return;
11979 else if (this.resizing > 1)
11980 this.resizing++;
11981 else
11982 this.resizing = force ? 1 : 0;
11983 if (!height)
11984 height = dom.getInnerHeight(this.container);
11985
11986 if (height && (force || size.height != height)) {
11987 size.height = height;
11988 changes = this.CHANGE_SIZE;
11989
11990 size.scrollerHeight = this.scroller.clientHeight;
11991 if (force || !size.scrollerHeight) {
11992 size.scrollerHeight = size.height;
11993 if (this.$horizScroll)
11994 size.scrollerHeight -= this.scrollBar.getWidth();
11995 }
11996 this.scrollBar.setHeight(size.scrollerHeight);
11997
11998 if (this.session) {
11999 this.session.setScrollTop(this.getScrollTop());
12000 changes = changes | this.CHANGE_FULL;
12001 }
12002 }
12003
12004 if (!width)
12005 width = dom.getInnerWidth(this.container);
12006
12007 if (width && (force || this.resizing > 1 || size.width != width)) {
12008 changes = this.CHANGE_SIZE;
12009 size.width = width;
12010
12011 var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
12012 this.scroller.style.left = gutterWidth + "px";
12013 size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth());
12014 this.scroller.style.right = this.scrollBar.getWidth() + "px";
12015
12016 if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
12017 changes = changes | this.CHANGE_FULL;
12018 }
12019
12020 if (!this.$size.scrollerHeight)
12021 return;
12022
12023 if (force)
12024 this.$renderChanges(changes, true);
12025 else
12026 this.$loop.schedule(changes);
12027
12028 if (force)
12029 this.$gutterLayer.$padding = null;
12030
12031 if (force)
12032 delete this.resizing;
12033 };
12034
12035 this.onGutterResize = function() {
12036 var width = this.$size.width;
12037 var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
12038 this.scroller.style.left = gutterWidth + "px";
12039 this.$size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth());
12040
12041 if (this.session.getUseWrapMode() && this.adjustWrapLimit())
12042 this.$loop.schedule(this.CHANGE_FULL);
12043 else
12044 this.$loop.schedule(this.CHANGE_MARKER);
12045 };
12046 this.adjustWrapLimit = function() {
12047 var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
12048 var limit = Math.floor(availableWidth / this.characterWidth);
12049 return this.session.adjustWrapLimit(limit, this.$showPrintMargin && this.$printMarginColumn);
12050 };
12051 this.setAnimatedScroll = function(shouldAnimate){
12052 this.setOption("animatedScroll", shouldAnimate);
12053 };
12054 this.getAnimatedScroll = function() {
12055 return this.$animatedScroll;
12056 };
12057 this.setShowInvisibles = function(showInvisibles) {
12058 this.setOption("showInvisibles", showInvisibles);
12059 };
12060 this.getShowInvisibles = function() {
12061 return this.getOption("showInvisibles");
12062 };
12063 this.getDisplayIndentGuides = function() {
12064 return this.getOption("displayIndentGuides");
12065 };
12066
12067 this.setDisplayIndentGuides = function(display) {
12068 this.setOption("displayIndentGuides", display);
12069 };
12070 this.setShowPrintMargin = function(showPrintMargin) {
12071 this.setOption("showPrintMargin", showPrintMargin);
12072 };
12073 this.getShowPrintMargin = function() {
12074 return this.getOption("showPrintMargin");
12075 };
12076 this.setPrintMarginColumn = function(showPrintMargin) {
12077 this.setOption("printMarginColumn", showPrintMargin);
12078 };
12079 this.getPrintMarginColumn = function() {
12080 return this.getOption("printMarginColumn");
12081 };
12082 this.getShowGutter = function(){
12083 return this.getOption("showGutter");
12084 };
12085 this.setShowGutter = function(show){
12086 return this.setOption("showGutter", show);
12087 };
12088
12089 this.getFadeFoldWidgets = function(){
12090 return this.getOption("fadeFoldWidgets")
12091 };
12092
12093 this.setFadeFoldWidgets = function(show) {
12094 this.setOption("fadeFoldWidgets", show);
12095 };
12096
12097 this.setHighlightGutterLine = function(shouldHighlight) {
12098 this.setOption("highlightGutterLine", shouldHighlight);
12099 };
12100
12101 this.getHighlightGutterLine = function() {
12102 return this.getOption("highlightGutterLine");
12103 };
12104
12105 this.$updateGutterLineHighlight = function() {
12106 var pos = this.$cursorLayer.$pixelPos;
12107 var height = this.layerConfig.lineHeight;
12108 if (this.session.getUseWrapMode()) {
12109 var cursor = this.session.selection.getCursor();
12110 cursor.column = 0;
12111 pos = this.$cursorLayer.getPixelPosition(cursor, true);
12112 height *= this.session.getRowLength(cursor.row);
12113 }
12114 this.$gutterLineHighlight.style.top = pos.top - this.layerConfig.offset + "px";
12115 this.$gutterLineHighlight.style.height = height + "px";
12116 };
12117
12118 this.$updatePrintMargin = function() {
12119 if (!this.$showPrintMargin && !this.$printMarginEl)
12120 return;
12121
12122 if (!this.$printMarginEl) {
12123 var containerEl = dom.createElement("div");
12124 containerEl.className = "ace_layer ace_print-margin-layer";
12125 this.$printMarginEl = dom.createElement("div");
12126 this.$printMarginEl.className = "ace_print-margin";
12127 containerEl.appendChild(this.$printMarginEl);
12128 this.content.insertBefore(containerEl, this.content.firstChild);
12129 }
12130
12131 var style = this.$printMarginEl.style;
12132 style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding) + "px";
12133 style.visibility = this.$showPrintMargin ? "visible" : "hidden";
12134
12135 if (this.session && this.session.$wrap == -1)
12136 this.adjustWrapLimit();
12137 };
12138 this.getContainerElement = function() {
12139 return this.container;
12140 };
12141 this.getMouseEventTarget = function() {
12142 return this.content;
12143 };
12144 this.getTextAreaContainer = function() {
12145 return this.container;
12146 };
12147 this.$moveTextAreaToCursor = function() {
12148 if (!this.$keepTextAreaAtCursor)
12149 return;
12150 var config = this.layerConfig;
12151 var posTop = this.$cursorLayer.$pixelPos.top;
12152 var posLeft = this.$cursorLayer.$pixelPos.left;
12153 posTop -= config.offset;
12154
12155 var h = this.lineHeight;
12156 if (posTop < 0 || posTop > config.height - h)
12157 return;
12158
12159 var w = this.characterWidth;
12160 if (this.$composition) {
12161 var val = this.textarea.value.replace(/^\x01+/, "");
12162 w *= (this.session.$getStringScreenWidth(val)[0]+2);
12163 h += 2;
12164 posTop -= 1;
12165 }
12166 posLeft -= this.scrollLeft;
12167 if (posLeft > this.$size.scrollerWidth - w)
12168 posLeft = this.$size.scrollerWidth - w;
12169
12170 posLeft -= this.scrollBar.width;
12171
12172 this.textarea.style.height = h + "px";
12173 this.textarea.style.width = w + "px";
12174 this.textarea.style.right = Math.max(0, this.$size.scrollerWidth - posLeft - w) + "px";
12175 this.textarea.style.bottom = Math.max(0, this.$size.height - posTop - h) + "px";
12176 };
12177 this.getFirstVisibleRow = function() {
12178 return this.layerConfig.firstRow;
12179 };
12180 this.getFirstFullyVisibleRow = function() {
12181 return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
12182 };
12183 this.getLastFullyVisibleRow = function() {
12184 var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
12185 return this.layerConfig.firstRow - 1 + flint;
12186 };
12187 this.getLastVisibleRow = function() {
12188 return this.layerConfig.lastRow;
12189 };
12190
12191 this.$padding = null;
12192 this.setPadding = function(padding) {
12193 this.$padding = padding;
12194 this.$textLayer.setPadding(padding);
12195 this.$cursorLayer.setPadding(padding);
12196 this.$markerFront.setPadding(padding);
12197 this.$markerBack.setPadding(padding);
12198 this.$loop.schedule(this.CHANGE_FULL);
12199 this.$updatePrintMargin();
12200 };
12201 this.getHScrollBarAlwaysVisible = function() {
12202 return this.$hScrollBarAlwaysVisible;
12203 };
12204 this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
12205 this.setOption("hScrollBarAlwaysVisible", alwaysVisible);
12206 };
12207
12208 this.$updateScrollBar = function() {
12209 this.scrollBar.setInnerHeight(this.layerConfig.maxHeight);
12210 this.scrollBar.setScrollTop(this.scrollTop);
12211 };
12212
12213 this.$renderChanges = function(changes, force) {
12214 if (!force && (!changes || !this.session || !this.container.offsetWidth))
12215 return;
12216
12217 this._signal("beforeRender");
12218 if (changes & this.CHANGE_FULL ||
12219 changes & this.CHANGE_SIZE ||
12220 changes & this.CHANGE_TEXT ||
12221 changes & this.CHANGE_LINES ||
12222 changes & this.CHANGE_SCROLL
12223 )
12224 this.$computeLayerConfig();
12225 if (changes & this.CHANGE_H_SCROLL) {
12226 this.scroller.scrollLeft = this.scrollLeft;
12227 var scrollLeft = this.scroller.scrollLeft;
12228 this.scrollLeft = scrollLeft;
12229 this.session.setScrollLeft(scrollLeft);
12230
12231 this.scroller.className = this.scrollLeft == 0 ? "ace_scroller" : "ace_scroller ace_scroll-left";
12232 }
12233 if (changes & this.CHANGE_FULL) {
12234 this.$textLayer.checkForSizeChanges();
12235 this.$updateScrollBar();
12236 this.$textLayer.update(this.layerConfig);
12237 if (this.$showGutter)
12238 this.$gutterLayer.update(this.layerConfig);
12239 this.$markerBack.update(this.layerConfig);
12240 this.$markerFront.update(this.layerConfig);
12241 this.$cursorLayer.update(this.layerConfig);
12242 this.$moveTextAreaToCursor();
12243 this.$highlightGutterLine && this.$updateGutterLineHighlight();
12244 this._signal("afterRender");
12245 return;
12246 }
12247 if (changes & this.CHANGE_SCROLL) {
12248 if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
12249 this.$textLayer.update(this.layerConfig);
12250 else
12251 this.$textLayer.scrollLines(this.layerConfig);
12252
12253 if (this.$showGutter)
12254 this.$gutterLayer.update(this.layerConfig);
12255 this.$markerBack.update(this.layerConfig);
12256 this.$markerFront.update(this.layerConfig);
12257 this.$cursorLayer.update(this.layerConfig);
12258 this.$highlightGutterLine && this.$updateGutterLineHighlight();
12259 this.$moveTextAreaToCursor();
12260 this.$updateScrollBar();
12261 this._signal("afterRender");
12262 return;
12263 }
12264
12265 if (changes & this.CHANGE_TEXT) {
12266 this.$textLayer.update(this.layerConfig);
12267 if (this.$showGutter)
12268 this.$gutterLayer.update(this.layerConfig);
12269 }
12270 else if (changes & this.CHANGE_LINES) {
12271 if (this.$updateLines() || (changes & this.CHANGE_GUTTER) && this.$showGutter)
12272 this.$gutterLayer.update(this.layerConfig);
12273 }
12274 else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {
12275 if (this.$showGutter)
12276 this.$gutterLayer.update(this.layerConfig);
12277 }
12278
12279 if (changes & this.CHANGE_CURSOR) {
12280 this.$cursorLayer.update(this.layerConfig);
12281 this.$moveTextAreaToCursor();
12282 this.$highlightGutterLine && this.$updateGutterLineHighlight();
12283 }
12284
12285 if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
12286 this.$markerFront.update(this.layerConfig);
12287 }
12288
12289 if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
12290 this.$markerBack.update(this.layerConfig);
12291 }
12292
12293 if (changes & this.CHANGE_SIZE)
12294 this.$updateScrollBar();
12295
12296 this._signal("afterRender");
12297 };
12298
12299 this.$computeLayerConfig = function() {
12300 if (!this.$size.scrollerHeight)
12301 return this.onResize(true);
12302
12303 var session = this.session;
12304
12305 var offset = this.scrollTop % this.lineHeight;
12306 var minHeight = this.$size.scrollerHeight + this.lineHeight;
12307
12308 var longestLine = this.$getLongestLine();
12309
12310 var horizScroll = this.$hScrollBarAlwaysVisible || this.$size.scrollerWidth - longestLine < 0;
12311 var horizScrollChanged = this.$horizScroll !== horizScroll;
12312 this.$horizScroll = horizScroll;
12313 if (horizScrollChanged) {
12314 this.scroller.style.overflowX = horizScroll ? "scroll" : "hidden";
12315 if (!horizScroll)
12316 this.session.setScrollLeft(0);
12317 }
12318 var maxHeight = this.session.getScreenLength() * this.lineHeight;
12319 this.session.setScrollTop(Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight)));
12320
12321 var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
12322 var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
12323 var lastRow = firstRow + lineCount;
12324 var firstRowScreen, firstRowHeight;
12325 var lineHeight = this.lineHeight;
12326 firstRow = session.screenToDocumentRow(firstRow, 0);
12327 var foldLine = session.getFoldLine(firstRow);
12328 if (foldLine) {
12329 firstRow = foldLine.start.row;
12330 }
12331
12332 firstRowScreen = session.documentToScreenRow(firstRow, 0);
12333 firstRowHeight = session.getRowLength(firstRow) * lineHeight;
12334
12335 lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
12336 minHeight = this.$size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +
12337 firstRowHeight;
12338
12339 offset = this.scrollTop - firstRowScreen * lineHeight;
12340
12341 this.layerConfig = {
12342 width : longestLine,
12343 padding : this.$padding,
12344 firstRow : firstRow,
12345 firstRowScreen: firstRowScreen,
12346 lastRow : lastRow,
12347 lineHeight : lineHeight,
12348 characterWidth : this.characterWidth,
12349 minHeight : minHeight,
12350 maxHeight : maxHeight,
12351 offset : offset,
12352 height : this.$size.scrollerHeight
12353 };
12354
12355 this.$gutterLayer.element.style.marginTop = (-offset) + "px";
12356 this.content.style.marginTop = (-offset) + "px";
12357 this.content.style.width = longestLine + 2 * this.$padding + "px";
12358 this.content.style.height = minHeight + "px";
12359 if (horizScrollChanged)
12360 this.onResize(true);
12361 };
12362
12363 this.$updateLines = function() {
12364 var firstRow = this.$changedLines.firstRow;
12365 var lastRow = this.$changedLines.lastRow;
12366 this.$changedLines = null;
12367
12368 var layerConfig = this.layerConfig;
12369
12370 if (firstRow > layerConfig.lastRow + 1) { return; }
12371 if (lastRow < layerConfig.firstRow) { return; }
12372 if (lastRow === Infinity) {
12373 if (this.$showGutter)
12374 this.$gutterLayer.update(layerConfig);
12375 this.$textLayer.update(layerConfig);
12376 return;
12377 }
12378 this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
12379 return true;
12380 };
12381
12382 this.$getLongestLine = function() {
12383 var charCount = this.session.getScreenWidth();
12384 if (this.$textLayer.showInvisibles)
12385 charCount += 1;
12386
12387 return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
12388 };
12389 this.updateFrontMarkers = function() {
12390 this.$markerFront.setMarkers(this.session.getMarkers(true));
12391 this.$loop.schedule(this.CHANGE_MARKER_FRONT);
12392 };
12393 this.updateBackMarkers = function() {
12394 this.$markerBack.setMarkers(this.session.getMarkers());
12395 this.$loop.schedule(this.CHANGE_MARKER_BACK);
12396 };
12397 this.addGutterDecoration = function(row, className){
12398 this.$gutterLayer.addGutterDecoration(row, className);
12399 };
12400 this.removeGutterDecoration = function(row, className){
12401 this.$gutterLayer.removeGutterDecoration(row, className);
12402 };
12403 this.updateBreakpoints = function(rows) {
12404 this.$loop.schedule(this.CHANGE_GUTTER);
12405 };
12406 this.setAnnotations = function(annotations) {
12407 this.$gutterLayer.setAnnotations(annotations);
12408 this.$loop.schedule(this.CHANGE_GUTTER);
12409 };
12410 this.updateCursor = function() {
12411 this.$loop.schedule(this.CHANGE_CURSOR);
12412 };
12413 this.hideCursor = function() {
12414 this.$cursorLayer.hideCursor();
12415 };
12416 this.showCursor = function() {
12417 this.$cursorLayer.showCursor();
12418 };
12419
12420 this.scrollSelectionIntoView = function(anchor, lead, offset) {
12421 this.scrollCursorIntoView(anchor, offset);
12422 this.scrollCursorIntoView(lead, offset);
12423 };
12424 this.scrollCursorIntoView = function(cursor, offset) {
12425 if (this.$size.scrollerHeight === 0)
12426 return;
12427
12428 var pos = this.$cursorLayer.getPixelPosition(cursor);
12429
12430 var left = pos.left;
12431 var top = pos.top;
12432
12433 if (this.scrollTop > top) {
12434 if (offset)
12435 top -= offset * this.$size.scrollerHeight;
12436 this.session.setScrollTop(top);
12437 } else if (this.scrollTop + this.$size.scrollerHeight < top + this.lineHeight) {
12438 if (offset)
12439 top += offset * this.$size.scrollerHeight;
12440 this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight);
12441 }
12442
12443 var scrollLeft = this.scrollLeft;
12444
12445 if (scrollLeft > left) {
12446 if (left < this.$padding + 2 * this.layerConfig.characterWidth)
12447 left = 0;
12448 this.session.setScrollLeft(left);
12449 } else if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
12450 this.session.setScrollLeft(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
12451 }
12452 };
12453 this.getScrollTop = function() {
12454 return this.session.getScrollTop();
12455 };
12456 this.getScrollLeft = function() {
12457 return this.session.getScrollLeft();
12458 };
12459 this.getScrollTopRow = function() {
12460 return this.scrollTop / this.lineHeight;
12461 };
12462 this.getScrollBottomRow = function() {
12463 return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
12464 };
12465 this.scrollToRow = function(row) {
12466 this.session.setScrollTop(row * this.lineHeight);
12467 };
12468
12469 this.alignCursor = function(cursor, alignment) {
12470 if (typeof cursor == "number")
12471 cursor = {row: cursor, column: 0};
12472
12473 var pos = this.$cursorLayer.getPixelPosition(cursor);
12474 var h = this.$size.scrollerHeight - this.lineHeight;
12475 var offset = pos.top - h * (alignment || 0);
12476
12477 this.session.setScrollTop(offset);
12478 return offset;
12479 };
12480
12481 this.STEPS = 8;
12482 this.$calcSteps = function(fromValue, toValue){
12483 var i = 0;
12484 var l = this.STEPS;
12485 var steps = [];
12486
12487 var func = function(t, x_min, dx) {
12488 return dx * (Math.pow(t - 1, 3) + 1) + x_min;
12489 };
12490
12491 for (i = 0; i < l; ++i)
12492 steps.push(func(i / this.STEPS, fromValue, toValue - fromValue));
12493
12494 return steps;
12495 };
12496 this.scrollToLine = function(line, center, animate, callback) {
12497 var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
12498 var offset = pos.top;
12499 if (center)
12500 offset -= this.$size.scrollerHeight / 2;
12501
12502 var initialScroll = this.scrollTop;
12503 this.session.setScrollTop(offset);
12504 if (animate !== false)
12505 this.animateScrolling(initialScroll, callback);
12506 };
12507
12508 this.animateScrolling = function(fromValue, callback) {
12509 var toValue = this.scrollTop;
12510 if (this.$animatedScroll) {
12511 var _self = this;
12512 var steps = _self.$calcSteps(fromValue, toValue);
12513 this.$scrollAnimation = {from: fromValue, to: toValue};
12514
12515 clearInterval(this.$timer);
12516
12517 _self.session.setScrollTop(steps.shift());
12518 this.$timer = setInterval(function() {
12519 if (steps.length) {
12520 _self.session.setScrollTop(steps.shift());
12521 _self.session.$scrollTop = toValue;
12522 } else if (toValue != null) {
12523 _self.session.$scrollTop = -1;
12524 _self.session.setScrollTop(toValue);
12525 toValue = null;
12526 } else {
12527 _self.$timer = clearInterval(_self.$timer);
12528 _self.$scrollAnimation = null;
12529 callback && callback();
12530 }
12531 }, 10);
12532 }
12533 };
12534 this.scrollToY = function(scrollTop) {
12535 if (this.scrollTop !== scrollTop) {
12536 this.$loop.schedule(this.CHANGE_SCROLL);
12537 this.scrollTop = scrollTop;
12538 }
12539 };
12540 this.scrollToX = function(scrollLeft) {
12541 if (scrollLeft < 0)
12542 scrollLeft = 0;
12543
12544 if (this.scrollLeft !== scrollLeft)
12545 this.scrollLeft = scrollLeft;
12546 this.$loop.schedule(this.CHANGE_H_SCROLL);
12547 };
12548 this.scrollBy = function(deltaX, deltaY) {
12549 deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
12550 deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
12551 };
12552 this.isScrollableBy = function(deltaX, deltaY) {
12553 if (deltaY < 0 && this.session.getScrollTop() >= 1)
12554 return true;
12555 if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight - this.layerConfig.maxHeight < -1)
12556 return true;
12557 };
12558
12559 this.pixelToScreenCoordinates = function(x, y) {
12560 var canvasPos = this.scroller.getBoundingClientRect();
12561
12562 var offset = (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth;
12563 var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);
12564 var col = Math.round(offset);
12565
12566 return {row: row, column: col, side: offset - col > 0 ? 1 : -1};
12567 };
12568
12569 this.screenToTextCoordinates = function(x, y) {
12570 var canvasPos = this.scroller.getBoundingClientRect();
12571
12572 var col = Math.round(
12573 (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth
12574 );
12575 var row = Math.floor(
12576 (y + this.scrollTop - canvasPos.top) / this.lineHeight
12577 );
12578
12579 return this.session.screenToDocumentPosition(row, Math.max(col, 0));
12580 };
12581 this.textToScreenCoordinates = function(row, column) {
12582 var canvasPos = this.scroller.getBoundingClientRect();
12583 var pos = this.session.documentToScreenPosition(row, column);
12584
12585 var x = this.$padding + Math.round(pos.column * this.characterWidth);
12586 var y = pos.row * this.lineHeight;
12587
12588 return {
12589 pageX: canvasPos.left + x - this.scrollLeft,
12590 pageY: canvasPos.top + y - this.scrollTop
12591 };
12592 };
12593 this.visualizeFocus = function() {
12594 dom.addCssClass(this.container, "ace_focus");
12595 };
12596 this.visualizeBlur = function() {
12597 dom.removeCssClass(this.container, "ace_focus");
12598 };
12599 this.showComposition = function(position) {
12600 if (!this.$composition)
12601 this.$composition = {
12602 keepTextAreaAtCursor: this.$keepTextAreaAtCursor,
12603 cssText: this.textarea.style.cssText
12604 };
12605
12606 this.$keepTextAreaAtCursor = true;
12607 dom.addCssClass(this.textarea, "ace_composition");
12608 this.textarea.style.cssText = "";
12609 this.$moveTextAreaToCursor();
12610 };
12611 this.setCompositionText = function(text) {
12612 this.$moveTextAreaToCursor();
12613 };
12614 this.hideComposition = function() {
12615 if (!this.$composition)
12616 return;
12617
12618 dom.removeCssClass(this.textarea, "ace_composition");
12619 this.$keepTextAreaAtCursor = this.$composition.keepTextAreaAtCursor;
12620 this.textarea.style.cssText = this.$composition.cssText;
12621 this.$composition = null;
12622 };
12623 this.setTheme = function(theme) {
12624 var _self = this;
12625 this.$themeValue = theme;
12626 _self._dispatchEvent('themeChange',{theme:theme});
12627
12628 if (!theme || typeof theme == "string") {
12629 var moduleName = theme || "ace/theme/textmate";
12630 config.loadModule(["theme", moduleName], afterLoad);
12631 } else {
12632 afterLoad(theme);
12633 }
12634
12635 function afterLoad(module) {
12636 if (_self.$themeValue != theme)
12637 return;
12638 if (!module.cssClass)
12639 return;
12640 dom.importCssString(
12641 module.cssText,
12642 module.cssClass,
12643 _self.container.ownerDocument
12644 );
12645
12646 if (_self.theme)
12647 dom.removeCssClass(_self.container, _self.theme.cssClass);
12648 _self.$theme = module.cssClass;
12649
12650 _self.theme = module;
12651 dom.addCssClass(_self.container, module.cssClass);
12652 dom.setCssClass(_self.container, "ace_dark", module.isDark);
12653
12654 var padding = module.padding || 4;
12655 if (_self.$padding && padding != _self.$padding)
12656 _self.setPadding(padding);
12657 if (_self.$size) {
12658 _self.$size.width = 0;
12659 _self.onResize();
12660 }
12661
12662 _self._dispatchEvent('themeLoaded',{theme:module});
12663 }
12664 };
12665 this.getTheme = function() {
12666 return this.$themeValue;
12667 };
12668 this.setStyle = function setStyle(style, include) {
12669 dom.setCssClass(this.container, style, include != false);
12670 };
12671 this.unsetStyle = function unsetStyle(style) {
12672 dom.removeCssClass(this.container, style);
12673 };
12674 this.destroy = function() {
12675 this.$textLayer.destroy();
12676 this.$cursorLayer.destroy();
12677 };
12678
12679 }).call(VirtualRenderer.prototype);
12680
12681
12682 config.defineOptions(VirtualRenderer.prototype, "renderer", {
12683 animatedScroll: {initialValue: false},
12684 showInvisibles: {
12685 set: function(value) {
12686 if (this.$textLayer.setShowInvisibles(value))
12687 this.$loop.schedule(this.CHANGE_TEXT);
12688 },
12689 initialValue: false
12690 },
12691 showPrintMargin: {
12692 set: function() { this.$updatePrintMargin(); },
12693 initialValue: true
12694 },
12695 printMarginColumn: {
12696 set: function() { this.$updatePrintMargin(); },
12697 initialValue: 80
12698 },
12699 printMargin: {
12700 set: function(val) {
12701 if (typeof val == "number")
12702 this.$printMarginColumn = val;
12703 this.$showPrintMargin = !!val;
12704 this.$updatePrintMargin();
12705 },
12706 get: function() {
12707 return this.$showPrintMargin && this.$printMarginColumn;
12708 }
12709 },
12710 showGutter: {
12711 set: function(show){
12712 this.$gutter.style.display = show ? "block" : "none";
12713 this.onGutterResize();
12714 },
12715 initialValue: true
12716 },
12717 fadeFoldWidgets: {
12718 set: function(show) {
12719 dom.setCssClass(this.$gutter, "ace_fade-fold-widgets", show);
12720 },
12721 initialValue: false
12722 },
12723 showFoldWidgets: {
12724 set: function(show) {this.$gutterLayer.setShowFoldWidgets(show)},
12725 initialValue: true
12726 },
12727 displayIndentGuides: {
12728 set: function(show) {
12729 if (this.$textLayer.setDisplayIndentGuides(show))
12730 this.$loop.schedule(this.CHANGE_TEXT);
12731 },
12732 initialValue: true
12733 },
12734 highlightGutterLine: {
12735 set: function(shouldHighlight) {
12736 if (!this.$gutterLineHighlight) {
12737 this.$gutterLineHighlight = dom.createElement("div");
12738 this.$gutterLineHighlight.className = "ace_gutter-active-line";
12739 this.$gutter.appendChild(this.$gutterLineHighlight);
12740 return;
12741 }
12742
12743 this.$gutterLineHighlight.style.display = shouldHighlight ? "" : "none";
12744 if (this.$cursorLayer.$pixelPos)
12745 this.$updateGutterLineHighlight();
12746 },
12747 initialValue: false,
12748 value: true
12749 },
12750 hScrollBarAlwaysVisible: {
12751 set: function(alwaysVisible) {
12752 this.$hScrollBarAlwaysVisible = alwaysVisible;
12753 if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll)
12754 this.$loop.schedule(this.CHANGE_SCROLL);
12755 },
12756 initialValue: false
12757 },
12758 fontSize: {
12759 set: function(size) {
12760 if (typeof size == "number")
12761 size = size + "px";
12762 this.container.style.fontSize = size;
12763 this.updateFontSize();
12764 },
12765 initialValue: 12
12766 },
12767 fontFamily: {
12768 set: function(name) {
12769 this.container.style.fontFamily = name;
12770 this.updateFontSize();
12771 }
12772 }
12773 });
12774
12775 exports.VirtualRenderer = VirtualRenderer;
12776 });
12777
12778 define('ace/layer/gutter', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/event_emitter'], function(require, exports, module) {
12779
12780
12781 var dom = require("../lib/dom");
12782 var oop = require("../lib/oop");
12783 var lang = require("../lib/lang");
12784 var EventEmitter = require("../lib/event_emitter").EventEmitter;
12785
12786 var Gutter = function(parentEl) {
12787 this.element = dom.createElement("div");
12788 this.element.className = "ace_layer ace_gutter-layer";
12789 parentEl.appendChild(this.element);
12790 this.setShowFoldWidgets(this.$showFoldWidgets);
12791
12792 this.gutterWidth = 0;
12793
12794 this.$annotations = [];
12795 this.$updateAnnotations = this.$updateAnnotations.bind(this);
12796 };
12797
12798 (function() {
12799
12800 oop.implement(this, EventEmitter);
12801
12802 this.setSession = function(session) {
12803 if (this.session)
12804 this.session.removeEventListener("change", this.$updateAnnotations);
12805 this.session = session;
12806 session.on("change", this.$updateAnnotations);
12807 };
12808
12809 this.addGutterDecoration = function(row, className){
12810 if (window.console)
12811 console.warn && console.warn("deprecated use session.addGutterDecoration");
12812 this.session.addGutterDecoration(row, className);
12813 };
12814
12815 this.removeGutterDecoration = function(row, className){
12816 if (window.console)
12817 console.warn && console.warn("deprecated use session.removeGutterDecoration");
12818 this.session.removeGutterDecoration(row, className);
12819 };
12820
12821 this.setAnnotations = function(annotations) {
12822 this.$annotations = []
12823 var rowInfo, row;
12824 for (var i = 0; i < annotations.length; i++) {
12825 var annotation = annotations[i];
12826 var row = annotation.row;
12827 var rowInfo = this.$annotations[row];
12828 if (!rowInfo)
12829 rowInfo = this.$annotations[row] = {text: []};
12830
12831 var annoText = annotation.text;
12832 annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";
12833
12834 if (rowInfo.text.indexOf(annoText) === -1)
12835 rowInfo.text.push(annoText);
12836
12837 var type = annotation.type;
12838 if (type == "error")
12839 rowInfo.className = " ace_error";
12840 else if (type == "warning" && rowInfo.className != " ace_error")
12841 rowInfo.className = " ace_warning";
12842 else if (type == "info" && (!rowInfo.className))
12843 rowInfo.className = " ace_info";
12844 }
12845 };
12846
12847 this.$updateAnnotations = function (e) {
12848 if (!this.$annotations.length)
12849 return;
12850 var delta = e.data;
12851 var range = delta.range;
12852 var firstRow = range.start.row;
12853 var len = range.end.row - firstRow;
12854 if (len === 0) {
12855 } else if (delta.action == "removeText" || delta.action == "removeLines") {
12856 this.$annotations.splice(firstRow, len + 1, null);
12857 } else {
12858 var args = Array(len + 1);
12859 args.unshift(firstRow, 1);
12860 this.$annotations.splice.apply(this.$annotations, args);
12861 }
12862 };
12863
12864 this.update = function(config) {
12865 var emptyAnno = {className: ""};
12866 var html = [];
12867 var i = config.firstRow;
12868 var lastRow = config.lastRow;
12869 var fold = this.session.getNextFoldLine(i);
12870 var foldStart = fold ? fold.start.row : Infinity;
12871 var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
12872 var breakpoints = this.session.$breakpoints;
12873 var decorations = this.session.$decorations;
12874 var firstLineNumber = this.session.$firstLineNumber;
12875 var lastLineNumber = 0;
12876
12877 while (true) {
12878 if(i > foldStart) {
12879 i = fold.end.row + 1;
12880 fold = this.session.getNextFoldLine(i, fold);
12881 foldStart = fold ?fold.start.row :Infinity;
12882 }
12883 if(i > lastRow)
12884 break;
12885
12886 var annotation = this.$annotations[i] || emptyAnno;
12887 html.push(
12888 "<div class='ace_gutter-cell ",
12889 breakpoints[i] || "", decorations[i] || "", annotation.className,
12890 "' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>",
12891 lastLineNumber = i + firstLineNumber
12892 );
12893
12894 if (foldWidgets) {
12895 var c = foldWidgets[i];
12896 if (c == null)
12897 c = foldWidgets[i] = this.session.getFoldWidget(i);
12898 if (c)
12899 html.push(
12900 "<span class='ace_fold-widget ace_", c,
12901 c == "start" && i == foldStart && i < fold.end.row ? " ace_closed" : " ace_open",
12902 "' style='height:", config.lineHeight, "px",
12903 "'></span>"
12904 );
12905 }
12906
12907 html.push("</div>");
12908
12909 i++;
12910 }
12911
12912 this.element = dom.setInnerHtml(this.element, html.join(""));
12913 this.element.style.height = config.minHeight + "px";
12914
12915 if (this.session.$useWrapMode)
12916 lastLineNumber = this.session.getLength();
12917
12918 var gutterWidth = ("" + lastLineNumber).length * config.characterWidth;
12919 var padding = this.$padding || this.$computePadding();
12920 gutterWidth += padding.left + padding.right;
12921 if (gutterWidth !== this.gutterWidth) {
12922 this.gutterWidth = gutterWidth;
12923 this.element.style.width = Math.ceil(this.gutterWidth) + "px";
12924 this._emit("changeGutterWidth", gutterWidth);
12925 }
12926 };
12927
12928 this.$showFoldWidgets = true;
12929 this.setShowFoldWidgets = function(show) {
12930 if (show)
12931 dom.addCssClass(this.element, "ace_folding-enabled");
12932 else
12933 dom.removeCssClass(this.element, "ace_folding-enabled");
12934
12935 this.$showFoldWidgets = show;
12936 this.$padding = null;
12937 };
12938
12939 this.getShowFoldWidgets = function() {
12940 return this.$showFoldWidgets;
12941 };
12942
12943 this.$computePadding = function() {
12944 if (!this.element.firstChild)
12945 return {left: 0, right: 0};
12946 var style = dom.computedStyle(this.element.firstChild);
12947 this.$padding = {}
12948 this.$padding.left = parseInt(style.paddingLeft) + 1;
12949 this.$padding.right = parseInt(style.paddingRight);
12950 return this.$padding;
12951 };
12952
12953 this.getRegion = function(point) {
12954 var padding = this.$padding || this.$computePadding();
12955 var rect = this.element.getBoundingClientRect();
12956 if (point.x < padding.left + rect.left)
12957 return "markers";
12958 if (this.$showFoldWidgets && point.x > rect.right - padding.right)
12959 return "foldWidgets";
12960 };
12961
12962 }).call(Gutter.prototype);
12963
12964 exports.Gutter = Gutter;
12965
12966 });
12967
12968 define('ace/layer/marker', ['require', 'exports', 'module' , 'ace/range', 'ace/lib/dom'], function(require, exports, module) {
12969
12970
12971 var Range = require("../range").Range;
12972 var dom = require("../lib/dom");
12973
12974 var Marker = function(parentEl) {
12975 this.element = dom.createElement("div");
12976 this.element.className = "ace_layer ace_marker-layer";
12977 parentEl.appendChild(this.element);
12978 };
12979
12980 (function() {
12981
12982 this.$padding = 0;
12983
12984 this.setPadding = function(padding) {
12985 this.$padding = padding;
12986 };
12987 this.setSession = function(session) {
12988 this.session = session;
12989 };
12990
12991 this.setMarkers = function(markers) {
12992 this.markers = markers;
12993 };
12994
12995 this.update = function(config) {
12996 var config = config || this.config;
12997 if (!config)
12998 return;
12999
13000 this.config = config;
13001
13002
13003 var html = [];
13004 for (var key in this.markers) {
13005 var marker = this.markers[key];
13006
13007 if (!marker.range) {
13008 marker.update(html, this, this.session, config);
13009 continue;
13010 }
13011
13012 var range = marker.range.clipRows(config.firstRow, config.lastRow);
13013 if (range.isEmpty()) continue;
13014
13015 range = range.toScreenRange(this.session);
13016 if (marker.renderer) {
13017 var top = this.$getTop(range.start.row, config);
13018 var left = this.$padding + range.start.column * config.characterWidth;
13019 marker.renderer(html, range, left, top, config);
13020 } else if (marker.type == "fullLine") {
13021 this.drawFullLineMarker(html, range, marker.clazz, config);
13022 } else if (marker.type == "screenLine") {
13023 this.drawScreenLineMarker(html, range, marker.clazz, config);
13024 } else if (range.isMultiLine()) {
13025 if (marker.type == "text")
13026 this.drawTextMarker(html, range, marker.clazz, config);
13027 else
13028 this.drawMultiLineMarker(html, range, marker.clazz, config);
13029 } else {
13030 this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config);
13031 }
13032 }
13033 this.element = dom.setInnerHtml(this.element, html.join(""));
13034 };
13035
13036 this.$getTop = function(row, layerConfig) {
13037 return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
13038 };
13039 this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) {
13040 var row = range.start.row;
13041
13042 var lineRange = new Range(
13043 row, range.start.column,
13044 row, this.session.getScreenLastRowColumn(row)
13045 );
13046 this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " ace_start", layerConfig, 1, extraStyle);
13047 row = range.end.row;
13048 lineRange = new Range(row, 0, row, range.end.column);
13049 this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, extraStyle);
13050
13051 for (row = range.start.row + 1; row < range.end.row; row++) {
13052 lineRange.start.row = row;
13053 lineRange.end.row = row;
13054 lineRange.end.column = this.session.getScreenLastRowColumn(row);
13055 this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, extraStyle);
13056 }
13057 };
13058 this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
13059 var padding = this.$padding;
13060 var height = config.lineHeight;
13061 var top = this.$getTop(range.start.row, config);
13062 var left = padding + range.start.column * config.characterWidth;
13063 extraStyle = extraStyle || "";
13064
13065 stringBuilder.push(
13066 "<div class='", clazz, " ace_start' style='",
13067 "height:", height, "px;",
13068 "right:0;",
13069 "top:", top, "px;",
13070 "left:", left, "px;", extraStyle, "'></div>"
13071 );
13072 top = this.$getTop(range.end.row, config);
13073 var width = range.end.column * config.characterWidth;
13074
13075 stringBuilder.push(
13076 "<div class='", clazz, "' style='",
13077 "height:", height, "px;",
13078 "width:", width, "px;",
13079 "top:", top, "px;",
13080 "left:", padding, "px;", extraStyle, "'></div>"
13081 );
13082 height = (range.end.row - range.start.row - 1) * config.lineHeight;
13083 if (height < 0)
13084 return;
13085 top = this.$getTop(range.start.row + 1, config);
13086
13087 stringBuilder.push(
13088 "<div class='", clazz, "' style='",
13089 "height:", height, "px;",
13090 "right:0;",
13091 "top:", top, "px;",
13092 "left:", padding, "px;", extraStyle, "'></div>"
13093 );
13094 };
13095 this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {
13096 var height = config.lineHeight;
13097 var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth;
13098
13099 var top = this.$getTop(range.start.row, config);
13100 var left = this.$padding + range.start.column * config.characterWidth;
13101
13102 stringBuilder.push(
13103 "<div class='", clazz, "' style='",
13104 "height:", height, "px;",
13105 "width:", width, "px;",
13106 "top:", top, "px;",
13107 "left:", left, "px;", extraStyle || "", "'></div>"
13108 );
13109 };
13110
13111 this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
13112 var top = this.$getTop(range.start.row, config);
13113 var height = config.lineHeight;
13114 if (range.start.row != range.end.row)
13115 height += this.$getTop(range.end.row, config) - top;
13116
13117 stringBuilder.push(
13118 "<div class='", clazz, "' style='",
13119 "height:", height, "px;",
13120 "top:", top, "px;",
13121 "left:0;right:0;", extraStyle || "", "'></div>"
13122 );
13123 };
13124
13125 this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
13126 var top = this.$getTop(range.start.row, config);
13127 var height = config.lineHeight;
13128
13129 stringBuilder.push(
13130 "<div class='", clazz, "' style='",
13131 "height:", height, "px;",
13132 "top:", top, "px;",
13133 "left:0;right:0;", extraStyle || "", "'></div>"
13134 );
13135 };
13136
13137 }).call(Marker.prototype);
13138
13139 exports.Marker = Marker;
13140
13141 });
13142
13143 define('ace/layer/text', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/useragent', 'ace/lib/event_emitter'], function(require, exports, module) {
13144
13145
13146 var oop = require("../lib/oop");
13147 var dom = require("../lib/dom");
13148 var lang = require("../lib/lang");
13149 var useragent = require("../lib/useragent");
13150 var EventEmitter = require("../lib/event_emitter").EventEmitter;
13151
13152 var Text = function(parentEl) {
13153 this.element = dom.createElement("div");
13154 this.element.className = "ace_layer ace_text-layer";
13155 parentEl.appendChild(this.element);
13156
13157 this.$characterSize = {width: 0, height: 0};
13158 this.checkForSizeChanges();
13159 this.$pollSizeChanges();
13160 };
13161
13162 (function() {
13163
13164 oop.implement(this, EventEmitter);
13165
13166 this.EOF_CHAR = "\xB6"; //"&para;";
13167 this.EOL_CHAR = "\xAC"; //"&not;";
13168 this.TAB_CHAR = "\u2192"; //"&rarr;" "\u21E5";
13169 this.SPACE_CHAR = "\xB7"; //"&middot;";
13170 this.$padding = 0;
13171
13172 this.setPadding = function(padding) {
13173 this.$padding = padding;
13174 this.element.style.padding = "0 " + padding + "px";
13175 };
13176
13177 this.getLineHeight = function() {
13178 return this.$characterSize.height || 1;
13179 };
13180
13181 this.getCharacterWidth = function() {
13182 return this.$characterSize.width || 1;
13183 };
13184
13185 this.checkForSizeChanges = function() {
13186 var size = this.$measureSizes();
13187 if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
13188 this.$measureNode.style.fontWeight = "bold";
13189 var boldSize = this.$measureSizes();
13190 this.$measureNode.style.fontWeight = "";
13191 this.$characterSize = size;
13192 this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;
13193 this._emit("changeCharacterSize", {data: size});
13194 }
13195 };
13196
13197 this.$pollSizeChanges = function() {
13198 var self = this;
13199 this.$pollSizeChangesTimer = setInterval(function() {
13200 self.checkForSizeChanges();
13201 }, 500);
13202 };
13203
13204 this.$fontStyles = {
13205 fontFamily : 1,
13206 fontSize : 1,
13207 fontWeight : 1,
13208 fontStyle : 1,
13209 lineHeight : 1
13210 };
13211
13212 this.$measureSizes = useragent.isIE || useragent.isOldGecko ? function() {
13213 var n = 1000;
13214 if (!this.$measureNode) {
13215 var measureNode = this.$measureNode = dom.createElement("div");
13216 var style = measureNode.style;
13217
13218 style.width = style.height = "auto";
13219 style.left = style.top = (-n * 40) + "px";
13220
13221 style.visibility = "hidden";
13222 style.position = "fixed";
13223 style.overflow = "visible";
13224 style.whiteSpace = "nowrap";
13225 measureNode.innerHTML = lang.stringRepeat("Xy", n);
13226
13227 if (this.element.ownerDocument.body) {
13228 this.element.ownerDocument.body.appendChild(measureNode);
13229 } else {
13230 var container = this.element.parentNode;
13231 while (!dom.hasCssClass(container, "ace_editor"))
13232 container = container.parentNode;
13233 container.appendChild(measureNode);
13234 }
13235 }
13236 if (!this.element.offsetWidth)
13237 return null;
13238
13239 var style = this.$measureNode.style;
13240 var computedStyle = dom.computedStyle(this.element);
13241 for (var prop in this.$fontStyles)
13242 style[prop] = computedStyle[prop];
13243
13244 var size = {
13245 height: this.$measureNode.offsetHeight,
13246 width: this.$measureNode.offsetWidth / (n * 2)
13247 };
13248 if (size.width == 0 || size.height == 0)
13249 return null;
13250
13251 return size;
13252 }
13253 : function() {
13254 if (!this.$measureNode) {
13255 var measureNode = this.$measureNode = dom.createElement("div");
13256 var style = measureNode.style;
13257
13258 style.width = style.height = "auto";
13259 style.left = style.top = -100 + "px";
13260
13261 style.visibility = "hidden";
13262 style.position = "fixed";
13263 style.overflow = "visible";
13264 style.whiteSpace = "nowrap";
13265
13266 measureNode.innerHTML = "X";
13267
13268 var container = this.element.parentNode;
13269 while (container && !dom.hasCssClass(container, "ace_editor"))
13270 container = container.parentNode;
13271
13272 if (!container)
13273 return this.$measureNode = null;
13274
13275 container.appendChild(measureNode);
13276 }
13277
13278 var rect = this.$measureNode.getBoundingClientRect();
13279
13280 var size = {
13281 height: rect.height,
13282 width: rect.width
13283 };
13284 if (size.width == 0 || size.height == 0)
13285 return null;
13286
13287 return size;
13288 };
13289
13290 this.setSession = function(session) {
13291 this.session = session;
13292 this.$computeTabString();
13293 };
13294
13295 this.showInvisibles = false;
13296 this.setShowInvisibles = function(showInvisibles) {
13297 if (this.showInvisibles == showInvisibles)
13298 return false;
13299
13300 this.showInvisibles = showInvisibles;
13301 this.$computeTabString();
13302 return true;
13303 };
13304
13305 this.displayIndentGuides = true;
13306 this.setDisplayIndentGuides = function(display) {
13307 if (this.displayIndentGuides == display)
13308 return false;
13309
13310 this.displayIndentGuides = display;
13311 this.$computeTabString();
13312 return true;
13313 };
13314
13315 this.$tabStrings = [];
13316 this.onChangeTabSize =
13317 this.$computeTabString = function() {
13318 var tabSize = this.session.getTabSize();
13319 this.tabSize = tabSize;
13320 var tabStr = this.$tabStrings = [0];
13321 for (var i = 1; i < tabSize + 1; i++) {
13322 if (this.showInvisibles) {
13323 tabStr.push("<span class='ace_invisible'>"
13324 + this.TAB_CHAR
13325 + lang.stringRepeat("\xa0", i - 1)
13326 + "</span>");
13327 } else {
13328 tabStr.push(lang.stringRepeat("\xa0", i));
13329 }
13330 }
13331 if (this.displayIndentGuides) {
13332 this.$indentGuideRe = /\s\S| \t|\t |\s$/;
13333 var className = "ace_indent-guide";
13334 if (this.showInvisibles) {
13335 className += " ace_invisible";
13336 var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize);
13337 var tabContent = this.TAB_CHAR + lang.stringRepeat("\xa0", this.tabSize - 1);
13338 } else{
13339 var spaceContent = lang.stringRepeat("\xa0", this.tabSize);
13340 var tabContent = spaceContent;
13341 }
13342
13343 this.$tabStrings[" "] = "<span class='" + className + "'>" + spaceContent + "</span>";
13344 this.$tabStrings["\t"] = "<span class='" + className + "'>" + tabContent + "</span>";
13345 }
13346 };
13347
13348 this.updateLines = function(config, firstRow, lastRow) {
13349 if (this.config.lastRow != config.lastRow ||
13350 this.config.firstRow != config.firstRow) {
13351 this.scrollLines(config);
13352 }
13353 this.config = config;
13354
13355 var first = Math.max(firstRow, config.firstRow);
13356 var last = Math.min(lastRow, config.lastRow);
13357
13358 var lineElements = this.element.childNodes;
13359 var lineElementsIdx = 0;
13360
13361 for (var row = config.firstRow; row < first; row++) {
13362 var foldLine = this.session.getFoldLine(row);
13363 if (foldLine) {
13364 if (foldLine.containsRow(first)) {
13365 first = foldLine.start.row;
13366 break;
13367 } else {
13368 row = foldLine.end.row;
13369 }
13370 }
13371 lineElementsIdx ++;
13372 }
13373
13374 var row = first;
13375 var foldLine = this.session.getNextFoldLine(row);
13376 var foldStart = foldLine ? foldLine.start.row : Infinity;
13377
13378 while (true) {
13379 if (row > foldStart) {
13380 row = foldLine.end.row+1;
13381 foldLine = this.session.getNextFoldLine(row, foldLine);
13382 foldStart = foldLine ? foldLine.start.row :Infinity;
13383 }
13384 if (row > last)
13385 break;
13386
13387 var lineElement = lineElements[lineElementsIdx++];
13388 if (lineElement) {
13389 var html = [];
13390 this.$renderLine(
13391 html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false
13392 );
13393 dom.setInnerHtml(lineElement, html.join(""));
13394 }
13395 row++;
13396 }
13397 };
13398
13399 this.scrollLines = function(config) {
13400 var oldConfig = this.config;
13401 this.config = config;
13402
13403 if (!oldConfig || oldConfig.lastRow < config.firstRow)
13404 return this.update(config);
13405
13406 if (config.lastRow < oldConfig.firstRow)
13407 return this.update(config);
13408
13409 var el = this.element;
13410 if (oldConfig.firstRow < config.firstRow)
13411 for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--)
13412 el.removeChild(el.firstChild);
13413
13414 if (oldConfig.lastRow > config.lastRow)
13415 for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--)
13416 el.removeChild(el.lastChild);
13417
13418 if (config.firstRow < oldConfig.firstRow) {
13419 var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1);
13420 if (el.firstChild)
13421 el.insertBefore(fragment, el.firstChild);
13422 else
13423 el.appendChild(fragment);
13424 }
13425
13426 if (config.lastRow > oldConfig.lastRow) {
13427 var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow);
13428 el.appendChild(fragment);
13429 }
13430 };
13431
13432 this.$renderLinesFragment = function(config, firstRow, lastRow) {
13433 var fragment = this.element.ownerDocument.createDocumentFragment();
13434 var row = firstRow;
13435 var foldLine = this.session.getNextFoldLine(row);
13436 var foldStart = foldLine ? foldLine.start.row : Infinity;
13437
13438 while (true) {
13439 if (row > foldStart) {
13440 row = foldLine.end.row+1;
13441 foldLine = this.session.getNextFoldLine(row, foldLine);
13442 foldStart = foldLine ? foldLine.start.row : Infinity;
13443 }
13444 if (row > lastRow)
13445 break;
13446
13447 var container = dom.createElement("div");
13448
13449 var html = [];
13450 this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
13451 container.innerHTML = html.join("");
13452 if (this.$useLineGroups()) {
13453 container.className = 'ace_line_group';
13454 fragment.appendChild(container);
13455 } else {
13456 var lines = container.childNodes
13457 while(lines.length)
13458 fragment.appendChild(lines[0]);
13459 }
13460
13461 row++;
13462 }
13463 return fragment;
13464 };
13465
13466 this.update = function(config) {
13467 this.config = config;
13468
13469 var html = [];
13470 var firstRow = config.firstRow, lastRow = config.lastRow;
13471
13472 var row = firstRow;
13473 var foldLine = this.session.getNextFoldLine(row);
13474 var foldStart = foldLine ? foldLine.start.row : Infinity;
13475
13476 while (true) {
13477 if (row > foldStart) {
13478 row = foldLine.end.row+1;
13479 foldLine = this.session.getNextFoldLine(row, foldLine);
13480 foldStart = foldLine ? foldLine.start.row :Infinity;
13481 }
13482 if (row > lastRow)
13483 break;
13484
13485 if (this.$useLineGroups())
13486 html.push("<div class='ace_line_group'>")
13487
13488 this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
13489
13490 if (this.$useLineGroups())
13491 html.push("</div>"); // end the line group
13492
13493 row++;
13494 }
13495 this.element = dom.setInnerHtml(this.element, html.join(""));
13496 };
13497
13498 this.$textToken = {
13499 "text": true,
13500 "rparen": true,
13501 "lparen": true
13502 };
13503
13504 this.$renderToken = function(stringBuilder, screenColumn, token, value) {
13505 var self = this;
13506 var replaceReg = /\t|&|<|( +)|([\x00-\x1f\x80-\xa0\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\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;
13507 var replaceFunc = function(c, a, b, tabIdx, idx4) {
13508 if (a) {
13509 return self.showInvisibles ?
13510 "<span class='ace_invisible'>" + lang.stringRepeat(self.SPACE_CHAR, c.length) + "</span>" :
13511 lang.stringRepeat("\xa0", c.length);
13512 } else if (c == "&") {
13513 return "&#38;";
13514 } else if (c == "<") {
13515 return "&#60;";
13516 } else if (c == "\t") {
13517 var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx);
13518 screenColumn += tabSize - 1;
13519 return self.$tabStrings[tabSize];
13520 } else if (c == "\u3000") {
13521 var classToUse = self.showInvisibles ? "ace_cjk ace_invisible" : "ace_cjk";
13522 var space = self.showInvisibles ? self.SPACE_CHAR : "";
13523 screenColumn += 1;
13524 return "<span class='" + classToUse + "' style='width:" +
13525 (self.config.characterWidth * 2) +
13526 "px'>" + space + "</span>";
13527 } else if (b) {
13528 return "<span class='ace_invisible ace_invalid'>" + self.SPACE_CHAR + "</span>";
13529 } else {
13530 screenColumn += 1;
13531 return "<span class='ace_cjk' style='width:" +
13532 (self.config.characterWidth * 2) +
13533 "px'>" + c + "</span>";
13534 }
13535 };
13536
13537 var output = value.replace(replaceReg, replaceFunc);
13538
13539 if (!this.$textToken[token.type]) {
13540 var classes = "ace_" + token.type.replace(/\./g, " ace_");
13541 var style = "";
13542 if (token.type == "fold")
13543 style = " style='width:" + (token.value.length * this.config.characterWidth) + "px;' ";
13544 stringBuilder.push("<span class='", classes, "'", style, ">", output, "</span>");
13545 }
13546 else {
13547 stringBuilder.push(output);
13548 }
13549 return screenColumn + value.length;
13550 };
13551
13552 this.renderIndentGuide = function(stringBuilder, value) {
13553 var cols = value.search(this.$indentGuideRe);
13554 if (cols <= 0)
13555 return value;
13556 if (value[0] == " ") {
13557 cols -= cols % this.tabSize;
13558 stringBuilder.push(lang.stringRepeat(this.$tabStrings[" "], cols/this.tabSize));
13559 return value.substr(cols);
13560 } else if (value[0] == "\t") {
13561 stringBuilder.push(lang.stringRepeat(this.$tabStrings["\t"], cols));
13562 return value.substr(cols);
13563 }
13564 return value;
13565 };
13566
13567 this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) {
13568 var chars = 0;
13569 var split = 0;
13570 var splitChars = splits[0];
13571 var screenColumn = 0;
13572
13573 for (var i = 0; i < tokens.length; i++) {
13574 var token = tokens[i];
13575 var value = token.value;
13576 if (i == 0 && this.displayIndentGuides) {
13577 chars = value.length;
13578 value = this.renderIndentGuide(stringBuilder, value);
13579 if (!value)
13580 continue;
13581 chars -= value.length;
13582 }
13583
13584 if (chars + value.length < splitChars) {
13585 screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
13586 chars += value.length;
13587 } else {
13588 while (chars + value.length >= splitChars) {
13589 screenColumn = this.$renderToken(
13590 stringBuilder, screenColumn,
13591 token, value.substring(0, splitChars - chars)
13592 );
13593 value = value.substring(splitChars - chars);
13594 chars = splitChars;
13595
13596 if (!onlyContents) {
13597 stringBuilder.push("</div>",
13598 "<div class='ace_line' style='height:",
13599 this.config.lineHeight, "px'>"
13600 );
13601 }
13602
13603 split ++;
13604 screenColumn = 0;
13605 splitChars = splits[split] || Number.MAX_VALUE;
13606 }
13607 if (value.length != 0) {
13608 chars += value.length;
13609 screenColumn = this.$renderToken(
13610 stringBuilder, screenColumn, token, value
13611 );
13612 }
13613 }
13614 }
13615 };
13616
13617 this.$renderSimpleLine = function(stringBuilder, tokens) {
13618 var screenColumn = 0;
13619 var token = tokens[0];
13620 var value = token.value;
13621 if (this.displayIndentGuides)
13622 value = this.renderIndentGuide(stringBuilder, value);
13623 if (value)
13624 screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
13625 for (var i = 1; i < tokens.length; i++) {
13626 token = tokens[i];
13627 value = token.value;
13628 screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
13629 }
13630 };
13631 this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) {
13632 if (!foldLine && foldLine != false)
13633 foldLine = this.session.getFoldLine(row);
13634
13635 if (foldLine)
13636 var tokens = this.$getFoldLineTokens(row, foldLine);
13637 else
13638 var tokens = this.session.getTokens(row);
13639
13640
13641 if (!onlyContents) {
13642 stringBuilder.push(
13643 "<div class='ace_line' style='height:", this.config.lineHeight, "px'>"
13644 );
13645 }
13646
13647 if (tokens.length) {
13648 var splits = this.session.getRowSplitData(row);
13649 if (splits && splits.length)
13650 this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents);
13651 else
13652 this.$renderSimpleLine(stringBuilder, tokens);
13653 }
13654
13655 if (this.showInvisibles) {
13656 if (foldLine)
13657 row = foldLine.end.row
13658
13659 stringBuilder.push(
13660 "<span class='ace_invisible'>",
13661 row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR,
13662 "</span>"
13663 );
13664 }
13665 if (!onlyContents)
13666 stringBuilder.push("</div>");
13667 };
13668
13669 this.$getFoldLineTokens = function(row, foldLine) {
13670 var session = this.session;
13671 var renderTokens = [];
13672
13673 function addTokens(tokens, from, to) {
13674 var idx = 0, col = 0;
13675 while ((col + tokens[idx].value.length) < from) {
13676 col += tokens[idx].value.length;
13677 idx++;
13678
13679 if (idx == tokens.length)
13680 return;
13681 }
13682 if (col != from) {
13683 var value = tokens[idx].value.substring(from - col);
13684 if (value.length > (to - from))
13685 value = value.substring(0, to - from);
13686
13687 renderTokens.push({
13688 type: tokens[idx].type,
13689 value: value
13690 });
13691
13692 col = from + value.length;
13693 idx += 1;
13694 }
13695
13696 while (col < to && idx < tokens.length) {
13697 var value = tokens[idx].value;
13698 if (value.length + col > to) {
13699 renderTokens.push({
13700 type: tokens[idx].type,
13701 value: value.substring(0, to - col)
13702 });
13703 } else
13704 renderTokens.push(tokens[idx]);
13705 col += value.length;
13706 idx += 1;
13707 }
13708 }
13709
13710 var tokens = session.getTokens(row);
13711 foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
13712 if (placeholder != null) {
13713 renderTokens.push({
13714 type: "fold",
13715 value: placeholder
13716 });
13717 } else {
13718 if (isNewRow)
13719 tokens = session.getTokens(row);
13720
13721 if (tokens.length)
13722 addTokens(tokens, lastColumn, column);
13723 }
13724 }, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
13725
13726 return renderTokens;
13727 };
13728
13729 this.$useLineGroups = function() {
13730 return this.session.getUseWrapMode();
13731 };
13732
13733 this.destroy = function() {
13734 clearInterval(this.$pollSizeChangesTimer);
13735 if (this.$measureNode)
13736 this.$measureNode.parentNode.removeChild(this.$measureNode);
13737 delete this.$measureNode;
13738 };
13739
13740 }).call(Text.prototype);
13741
13742 exports.Text = Text;
13743
13744 });
13745
13746 define('ace/layer/cursor', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
13747
13748
13749 var dom = require("../lib/dom");
13750
13751 var Cursor = function(parentEl) {
13752 this.element = dom.createElement("div");
13753 this.element.className = "ace_layer ace_cursor-layer";
13754 parentEl.appendChild(this.element);
13755
13756 this.isVisible = false;
13757 this.isBlinking = true;
13758 this.blinkInterval = 1000;
13759 this.smoothBlinking = false;
13760
13761 this.cursors = [];
13762 this.cursor = this.addCursor();
13763 dom.addCssClass(this.element, "ace_hidden-cursors");
13764 };
13765
13766 (function() {
13767
13768 this.$padding = 0;
13769 this.setPadding = function(padding) {
13770 this.$padding = padding;
13771 };
13772
13773 this.setSession = function(session) {
13774 this.session = session;
13775 };
13776
13777 this.setBlinking = function(blinking) {
13778 if (blinking != this.isBlinking){
13779 this.isBlinking = blinking;
13780 this.restartTimer();
13781 }
13782 };
13783
13784 this.setBlinkInterval = function(blinkInterval) {
13785 if (blinkInterval != this.blinkInterval){
13786 this.blinkInterval = blinkInterval;
13787 this.restartTimer();
13788 }
13789 };
13790
13791 this.setSmoothBlinking = function(smoothBlinking) {
13792 if (smoothBlinking != this.smoothBlinking) {
13793 this.smoothBlinking = smoothBlinking;
13794 if (smoothBlinking)
13795 dom.addCssClass(this.element, "ace_smooth-blinking");
13796 else
13797 dom.removeCssClass(this.element, "ace_smooth-blinking");
13798 this.restartTimer();
13799 }
13800 };
13801
13802 this.addCursor = function() {
13803 var el = dom.createElement("div");
13804 el.className = "ace_cursor";
13805 this.element.appendChild(el);
13806 this.cursors.push(el);
13807 return el;
13808 };
13809
13810 this.removeCursor = function() {
13811 if (this.cursors.length > 1) {
13812 var el = this.cursors.pop();
13813 el.parentNode.removeChild(el);
13814 return el;
13815 }
13816 };
13817
13818 this.hideCursor = function() {
13819 this.isVisible = false;
13820 dom.addCssClass(this.element, "ace_hidden-cursors");
13821 this.restartTimer();
13822 };
13823
13824 this.showCursor = function() {
13825 this.isVisible = true;
13826 dom.removeCssClass(this.element, "ace_hidden-cursors");
13827 this.restartTimer();
13828 };
13829
13830 this.restartTimer = function() {
13831 clearInterval(this.intervalId);
13832 clearTimeout(this.timeoutId);
13833 if (this.smoothBlinking)
13834 dom.removeCssClass(this.element, "ace_smooth-blinking");
13835 for (var i = this.cursors.length; i--; )
13836 this.cursors[i].style.opacity = "";
13837
13838 if (!this.isBlinking || !this.blinkInterval || !this.isVisible)
13839 return;
13840
13841 if (this.smoothBlinking)
13842 setTimeout(function(){
13843 dom.addCssClass(this.element, "ace_smooth-blinking");
13844 }.bind(this));
13845
13846 var blink = function(){
13847 this.timeoutId = setTimeout(function() {
13848 for (var i = this.cursors.length; i--; ) {
13849 this.cursors[i].style.opacity = 0;
13850 }
13851 }.bind(this), 0.6 * this.blinkInterval);
13852 }.bind(this);
13853
13854 this.intervalId = setInterval(function() {
13855 for (var i = this.cursors.length; i--; ) {
13856 this.cursors[i].style.opacity = "";
13857 }
13858 blink();
13859 }.bind(this), this.blinkInterval);
13860
13861 blink();
13862 };
13863
13864 this.getPixelPosition = function(position, onScreen) {
13865 if (!this.config || !this.session)
13866 return {left : 0, top : 0};
13867
13868 if (!position)
13869 position = this.session.selection.getCursor();
13870 var pos = this.session.documentToScreenPosition(position);
13871 var cursorLeft = this.$padding + pos.column * this.config.characterWidth;
13872 var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
13873 this.config.lineHeight;
13874
13875 return {left : cursorLeft, top : cursorTop};
13876 };
13877
13878 this.update = function(config) {
13879 this.config = config;
13880
13881 var selections = this.session.$selectionMarkers;
13882 var i = 0, cursorIndex = 0;
13883
13884 if (selections === undefined || selections.length === 0){
13885 selections = [{cursor: null}];
13886 }
13887
13888 for (var i = 0, n = selections.length; i < n; i++) {
13889 var pixelPos = this.getPixelPosition(selections[i].cursor, true);
13890 if ((pixelPos.top > config.height + config.offset ||
13891 pixelPos.top < -config.offset) && i > 1) {
13892 continue;
13893 }
13894
13895 var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
13896
13897 style.left = pixelPos.left + "px";
13898 style.top = pixelPos.top + "px";
13899 style.width = config.characterWidth + "px";
13900 style.height = config.lineHeight + "px";
13901 }
13902 while (this.cursors.length > cursorIndex)
13903 this.removeCursor();
13904
13905 var overwrite = this.session.getOverwrite();
13906 this.$setOverwrite(overwrite);
13907 this.$pixelPos = pixelPos;
13908 this.restartTimer();
13909 };
13910
13911 this.$setOverwrite = function(overwrite) {
13912 if (overwrite != this.overwrite) {
13913 this.overwrite = overwrite;
13914 if (overwrite)
13915 dom.addCssClass(this.element, "ace_overwrite-cursors");
13916 else
13917 dom.removeCssClass(this.element, "ace_overwrite-cursors");
13918 }
13919 };
13920
13921 this.destroy = function() {
13922 clearInterval(this.intervalId);
13923 clearTimeout(this.timeoutId);
13924 };
13925
13926 }).call(Cursor.prototype);
13927
13928 exports.Cursor = Cursor;
13929
13930 });
13931
13932 define('ace/scrollbar', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/event', 'ace/lib/event_emitter'], function(require, exports, module) {
13933
13934
13935 var oop = require("./lib/oop");
13936 var dom = require("./lib/dom");
13937 var event = require("./lib/event");
13938 var EventEmitter = require("./lib/event_emitter").EventEmitter;
13939 var ScrollBar = function(parent) {
13940 this.element = dom.createElement("div");
13941 this.element.className = "ace_scrollbar";
13942
13943 this.inner = dom.createElement("div");
13944 this.inner.className = "ace_scrollbar-inner";
13945 this.element.appendChild(this.inner);
13946
13947 parent.appendChild(this.element);
13948 this.width = dom.scrollbarWidth(parent.ownerDocument);
13949 this.element.style.width = (this.width || 15) + 5 + "px";
13950
13951 event.addListener(this.element, "scroll", this.onScroll.bind(this));
13952 };
13953
13954 (function() {
13955 oop.implement(this, EventEmitter);
13956 this.onScroll = function() {
13957 if (!this.skipEvent) {
13958 this.scrollTop = this.element.scrollTop;
13959 this._emit("scroll", {data: this.scrollTop});
13960 }
13961 this.skipEvent = false;
13962 };
13963 this.getWidth = function() {
13964 return this.width;
13965 };
13966 this.setHeight = function(height) {
13967 this.element.style.height = height + "px";
13968 };
13969 this.setInnerHeight = function(height) {
13970 this.inner.style.height = height + "px";
13971 };
13972 this.setScrollTop = function(scrollTop) {
13973 if (this.scrollTop != scrollTop) {
13974 this.skipEvent = true;
13975 this.scrollTop = this.element.scrollTop = scrollTop;
13976 }
13977 };
13978
13979 }).call(ScrollBar.prototype);
13980
13981 exports.ScrollBar = ScrollBar;
13982 });
13983
13984 define('ace/renderloop', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) {
13985
13986
13987 var event = require("./lib/event");
13988
13989
13990 var RenderLoop = function(onRender, win) {
13991 this.onRender = onRender;
13992 this.pending = false;
13993 this.changes = 0;
13994 this.window = win || window;
13995 };
13996
13997 (function() {
13998
13999
14000 this.schedule = function(change) {
14001 this.changes = this.changes | change;
14002 if (!this.pending) {
14003 this.pending = true;
14004 var _self = this;
14005 event.nextFrame(function() {
14006 _self.pending = false;
14007 var changes;
14008 while (changes = _self.changes) {
14009 _self.changes = 0;
14010 _self.onRender(changes);
14011 }
14012 }, this.window);
14013 }
14014 };
14015
14016 }).call(RenderLoop.prototype);
14017
14018 exports.RenderLoop = RenderLoop;
14019 });
14020
14021 define('ace/multi_select', ['require', 'exports', 'module' , 'ace/range_list', 'ace/range', 'ace/selection', 'ace/mouse/multi_select_handler', 'ace/lib/event', 'ace/lib/lang', 'ace/commands/multi_select_commands', 'ace/search', 'ace/edit_session', 'ace/editor'], function(require, exports, module) {
14022
14023 var RangeList = require("./range_list").RangeList;
14024 var Range = require("./range").Range;
14025 var Selection = require("./selection").Selection;
14026 var onMouseDown = require("./mouse/multi_select_handler").onMouseDown;
14027 var event = require("./lib/event");
14028 var lang = require("./lib/lang");
14029 var commands = require("./commands/multi_select_commands");
14030 exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
14031 var Search = require("./search").Search;
14032 var search = new Search();
14033
14034 function find(session, needle, dir) {
14035 search.$options.wrap = true;
14036 search.$options.needle = needle;
14037 search.$options.backwards = dir == -1;
14038 return search.find(session);
14039 }
14040 var EditSession = require("./edit_session").EditSession;
14041 (function() {
14042 this.getSelectionMarkers = function() {
14043 return this.$selectionMarkers;
14044 };
14045 }).call(EditSession.prototype);
14046 (function() {
14047 this.ranges = null;
14048 this.rangeList = null;
14049 this.addRange = function(range, $blockChangeEvents) {
14050 if (!range)
14051 return;
14052
14053 if (!this.inMultiSelectMode && this.rangeCount == 0) {
14054 var oldRange = this.toOrientedRange();
14055 this.rangeList.add(oldRange);
14056 this.rangeList.add(range);
14057 if (this.rangeList.ranges.length != 2) {
14058 this.rangeList.removeAll();
14059 return $blockChangeEvents || this.fromOrientedRange(range);
14060 }
14061 this.rangeList.removeAll();
14062 this.rangeList.add(oldRange);
14063 this.$onAddRange(oldRange);
14064 }
14065
14066 if (!range.cursor)
14067 range.cursor = range.end;
14068
14069 var removed = this.rangeList.add(range);
14070
14071 this.$onAddRange(range);
14072
14073 if (removed.length)
14074 this.$onRemoveRange(removed);
14075
14076 if (this.rangeCount > 1 && !this.inMultiSelectMode) {
14077 this._emit("multiSelect");
14078 this.inMultiSelectMode = true;
14079 this.session.$undoSelect = false;
14080 this.rangeList.attach(this.session);
14081 }
14082
14083 return $blockChangeEvents || this.fromOrientedRange(range);
14084 };
14085
14086 this.toSingleRange = function(range) {
14087 range = range || this.ranges[0];
14088 var removed = this.rangeList.removeAll();
14089 if (removed.length)
14090 this.$onRemoveRange(removed);
14091
14092 range && this.fromOrientedRange(range);
14093 };
14094 this.substractPoint = function(pos) {
14095 var removed = this.rangeList.substractPoint(pos);
14096 if (removed) {
14097 this.$onRemoveRange(removed);
14098 return removed[0];
14099 }
14100 };
14101 this.mergeOverlappingRanges = function() {
14102 var removed = this.rangeList.merge();
14103 if (removed.length)
14104 this.$onRemoveRange(removed);
14105 else if(this.ranges[0])
14106 this.fromOrientedRange(this.ranges[0]);
14107 };
14108
14109 this.$onAddRange = function(range) {
14110 this.rangeCount = this.rangeList.ranges.length;
14111 this.ranges.unshift(range);
14112 this._emit("addRange", {range: range});
14113 };
14114
14115 this.$onRemoveRange = function(removed) {
14116 this.rangeCount = this.rangeList.ranges.length;
14117 if (this.rangeCount == 1 && this.inMultiSelectMode) {
14118 var lastRange = this.rangeList.ranges.pop();
14119 removed.push(lastRange);
14120 this.rangeCount = 0;
14121 }
14122
14123 for (var i = removed.length; i--; ) {
14124 var index = this.ranges.indexOf(removed[i]);
14125 this.ranges.splice(index, 1);
14126 }
14127
14128 this._emit("removeRange", {ranges: removed});
14129
14130 if (this.rangeCount == 0 && this.inMultiSelectMode) {
14131 this.inMultiSelectMode = false;
14132 this._emit("singleSelect");
14133 this.session.$undoSelect = true;
14134 this.rangeList.detach(this.session);
14135 }
14136
14137 lastRange = lastRange || this.ranges[0];
14138 if (lastRange && !lastRange.isEqual(this.getRange()))
14139 this.fromOrientedRange(lastRange);
14140 };
14141 this.$initRangeList = function() {
14142 if (this.rangeList)
14143 return;
14144
14145 this.rangeList = new RangeList();
14146 this.ranges = [];
14147 this.rangeCount = 0;
14148 };
14149 this.getAllRanges = function() {
14150 return this.rangeList.ranges.concat();
14151 };
14152
14153 this.splitIntoLines = function () {
14154 if (this.rangeCount > 1) {
14155 var ranges = this.rangeList.ranges;
14156 var lastRange = ranges[ranges.length - 1];
14157 var range = Range.fromPoints(ranges[0].start, lastRange.end);
14158
14159 this.toSingleRange();
14160 this.setSelectionRange(range, lastRange.cursor == lastRange.start);
14161 } else {
14162 var range = this.getRange();
14163 var isBackwards = this.isBackwards();
14164 var startRow = range.start.row;
14165 var endRow = range.end.row;
14166 if (startRow == endRow) {
14167 if (isBackwards)
14168 var start = range.end, end = range.start;
14169 else
14170 var start = range.start, end = range.end;
14171
14172 this.addRange(Range.fromPoints(end, end));
14173 this.addRange(Range.fromPoints(start, start));
14174 return;
14175 }
14176
14177 var rectSel = [];
14178 var r = this.getLineRange(startRow, true);
14179 r.start.column = range.start.column;
14180 rectSel.push(r);
14181
14182 for (var i = startRow + 1; i < endRow; i++)
14183 rectSel.push(this.getLineRange(i, true));
14184
14185 r = this.getLineRange(endRow, true);
14186 r.end.column = range.end.column;
14187 rectSel.push(r);
14188
14189 rectSel.forEach(this.addRange, this);
14190 }
14191 };
14192 this.toggleBlockSelection = function () {
14193 if (this.rangeCount > 1) {
14194 var ranges = this.rangeList.ranges;
14195 var lastRange = ranges[ranges.length - 1];
14196 var range = Range.fromPoints(ranges[0].start, lastRange.end);
14197
14198 this.toSingleRange();
14199 this.setSelectionRange(range, lastRange.cursor == lastRange.start);
14200 } else {
14201 var cursor = this.session.documentToScreenPosition(this.selectionLead);
14202 var anchor = this.session.documentToScreenPosition(this.selectionAnchor);
14203
14204 var rectSel = this.rectangularRangeBlock(cursor, anchor);
14205 rectSel.forEach(this.addRange, this);
14206 }
14207 };
14208 this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {
14209 var rectSel = [];
14210
14211 var xBackwards = screenCursor.column < screenAnchor.column;
14212 if (xBackwards) {
14213 var startColumn = screenCursor.column;
14214 var endColumn = screenAnchor.column;
14215 } else {
14216 var startColumn = screenAnchor.column;
14217 var endColumn = screenCursor.column;
14218 }
14219
14220 var yBackwards = screenCursor.row < screenAnchor.row;
14221 if (yBackwards) {
14222 var startRow = screenCursor.row;
14223 var endRow = screenAnchor.row;
14224 } else {
14225 var startRow = screenAnchor.row;
14226 var endRow = screenCursor.row;
14227 }
14228
14229 if (startColumn < 0)
14230 startColumn = 0;
14231 if (startRow < 0)
14232 startRow = 0;
14233
14234 if (startRow == endRow)
14235 includeEmptyLines = true;
14236
14237 for (var row = startRow; row <= endRow; row++) {
14238 var range = Range.fromPoints(
14239 this.session.screenToDocumentPosition(row, startColumn),
14240 this.session.screenToDocumentPosition(row, endColumn)
14241 );
14242 if (range.isEmpty()) {
14243 if (docEnd && isSamePoint(range.end, docEnd))
14244 break;
14245 var docEnd = range.end;
14246 }
14247 range.cursor = xBackwards ? range.start : range.end;
14248 rectSel.push(range);
14249 }
14250
14251 if (yBackwards)
14252 rectSel.reverse();
14253
14254 if (!includeEmptyLines) {
14255 var end = rectSel.length - 1;
14256 while (rectSel[end].isEmpty() && end > 0)
14257 end--;
14258 if (end > 0) {
14259 var start = 0;
14260 while (rectSel[start].isEmpty())
14261 start++;
14262 }
14263 for (var i = end; i >= start; i--) {
14264 if (rectSel[i].isEmpty())
14265 rectSel.splice(i, 1);
14266 }
14267 }
14268
14269 return rectSel;
14270 };
14271 }).call(Selection.prototype);
14272 var Editor = require("./editor").Editor;
14273 (function() {
14274 this.updateSelectionMarkers = function() {
14275 this.renderer.updateCursor();
14276 this.renderer.updateBackMarkers();
14277 };
14278 this.addSelectionMarker = function(orientedRange) {
14279 if (!orientedRange.cursor)
14280 orientedRange.cursor = orientedRange.end;
14281
14282 var style = this.getSelectionStyle();
14283 orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style);
14284
14285 this.session.$selectionMarkers.push(orientedRange);
14286 this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
14287 return orientedRange;
14288 };
14289 this.removeSelectionMarker = function(range) {
14290 if (!range.marker)
14291 return;
14292 this.session.removeMarker(range.marker);
14293 var index = this.session.$selectionMarkers.indexOf(range);
14294 if (index != -1)
14295 this.session.$selectionMarkers.splice(index, 1);
14296 this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
14297 };
14298
14299 this.removeSelectionMarkers = function(ranges) {
14300 var markerList = this.session.$selectionMarkers;
14301 for (var i = ranges.length; i--; ) {
14302 var range = ranges[i];
14303 if (!range.marker)
14304 continue;
14305 this.session.removeMarker(range.marker);
14306 var index = markerList.indexOf(range);
14307 if (index != -1)
14308 markerList.splice(index, 1);
14309 }
14310 this.session.selectionMarkerCount = markerList.length;
14311 };
14312
14313 this.$onAddRange = function(e) {
14314 this.addSelectionMarker(e.range);
14315 this.renderer.updateCursor();
14316 this.renderer.updateBackMarkers();
14317 };
14318
14319 this.$onRemoveRange = function(e) {
14320 this.removeSelectionMarkers(e.ranges);
14321 this.renderer.updateCursor();
14322 this.renderer.updateBackMarkers();
14323 };
14324
14325 this.$onMultiSelect = function(e) {
14326 if (this.inMultiSelectMode)
14327 return;
14328 this.inMultiSelectMode = true;
14329
14330 this.setStyle("ace_multiselect");
14331 this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
14332 this.commands.setDefaultHandler("exec", this.$onMultiSelectExec);
14333
14334 this.renderer.updateCursor();
14335 this.renderer.updateBackMarkers();
14336 };
14337
14338 this.$onSingleSelect = function(e) {
14339 if (this.session.multiSelect.inVirtualMode)
14340 return;
14341 this.inMultiSelectMode = false;
14342
14343 this.unsetStyle("ace_multiselect");
14344 this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
14345
14346 this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec);
14347 this.renderer.updateCursor();
14348 this.renderer.updateBackMarkers();
14349 };
14350
14351 this.$onMultiSelectExec = function(e) {
14352 var command = e.command;
14353 var editor = e.editor;
14354 if (!editor.multiSelect)
14355 return;
14356 if (!command.multiSelectAction) {
14357 var result = command.exec(editor, e.args || {});
14358 editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());
14359 editor.multiSelect.mergeOverlappingRanges();
14360 } else if (command.multiSelectAction == "forEach") {
14361 result = editor.forEachSelection(command, e.args);
14362 } else if (command.multiSelectAction == "forEachLine") {
14363 result = editor.forEachSelection(command, e.args, true);
14364 } else if (command.multiSelectAction == "single") {
14365 editor.exitMultiSelectMode();
14366 result = command.exec(editor, e.args || {});
14367 } else {
14368 result = command.multiSelectAction(editor, e.args || {});
14369 }
14370 return result;
14371 };
14372 this.forEachSelection = function(cmd, args, $byLines) {
14373 if (this.inVirtualSelectionMode)
14374 return;
14375
14376 var session = this.session;
14377 var selection = this.selection;
14378 var rangeList = selection.rangeList;
14379 var result;
14380
14381 var reg = selection._eventRegistry;
14382 selection._eventRegistry = {};
14383
14384 var tmpSel = new Selection(session);
14385 this.inVirtualSelectionMode = true;
14386 for (var i = rangeList.ranges.length; i--;) {
14387 if ($byLines) {
14388 while (i > 0 && rangeList.ranges[i].start.row == rangeList.ranges[i - 1].end.row)
14389 i--;
14390 }
14391 tmpSel.fromOrientedRange(rangeList.ranges[i]);
14392 this.selection = session.selection = tmpSel;
14393 var cmdResult = cmd.exec(this, args || {});
14394 if (!result == undefined)
14395 result = cmdResult;
14396 tmpSel.toOrientedRange(rangeList.ranges[i]);
14397 }
14398 tmpSel.detach();
14399
14400 this.selection = session.selection = selection;
14401 this.inVirtualSelectionMode = false;
14402 selection._eventRegistry = reg;
14403 selection.mergeOverlappingRanges();
14404
14405 var anim = this.renderer.$scrollAnimation;
14406 this.onCursorChange();
14407 this.onSelectionChange();
14408 if (anim && anim.from == anim.to)
14409 this.renderer.animateScrolling(anim.from);
14410
14411 return result;
14412 };
14413 this.exitMultiSelectMode = function() {
14414 if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
14415 return;
14416 this.multiSelect.toSingleRange();
14417 };
14418
14419 this.getCopyText = function() {
14420 var text = "";
14421 if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
14422 var ranges = this.multiSelect.rangeList.ranges;
14423 var buf = [];
14424 for (var i = 0; i < ranges.length; i++) {
14425 buf.push(this.session.getTextRange(ranges[i]));
14426 }
14427 var nl = this.session.getDocument().getNewLineCharacter();
14428 text = buf.join(nl);
14429 if (text.length == (buf.length - 1) * nl.length)
14430 text = "";
14431 } else if (!this.selection.isEmpty()) {
14432 text = this.session.getTextRange(this.getSelectionRange());
14433 }
14434 this._signal("copy", text);
14435 return text;
14436 };
14437 this.onPaste = function(text) {
14438 if (this.$readOnly)
14439 return;
14440
14441 this._signal("paste", text);
14442 if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
14443 return this.insert(text);
14444
14445 var lines = text.split(/\r\n|\r|\n/);
14446 var ranges = this.selection.rangeList.ranges;
14447
14448 if (lines.length > ranges.length || lines.length < 2 || !lines[1])
14449 return this.commands.exec("insertstring", this, text);
14450
14451 for (var i = ranges.length; i--;) {
14452 var range = ranges[i];
14453 if (!range.isEmpty())
14454 this.session.remove(range);
14455
14456 this.session.insert(range.start, lines[i]);
14457 }
14458 };
14459 this.findAll = function(needle, options, additive) {
14460 options = options || {};
14461 options.needle = needle || options.needle;
14462 this.$search.set(options);
14463
14464 var ranges = this.$search.findAll(this.session);
14465 if (!ranges.length)
14466 return 0;
14467
14468 this.$blockScrolling += 1;
14469 var selection = this.multiSelect;
14470
14471 if (!additive)
14472 selection.toSingleRange(ranges[0]);
14473
14474 for (var i = ranges.length; i--; )
14475 selection.addRange(ranges[i], true);
14476
14477 this.$blockScrolling -= 1;
14478
14479 return ranges.length;
14480 };
14481 this.selectMoreLines = function(dir, skip) {
14482 var range = this.selection.toOrientedRange();
14483 var isBackwards = range.cursor == range.end;
14484
14485 var screenLead = this.session.documentToScreenPosition(range.cursor);
14486 if (this.selection.$desiredColumn)
14487 screenLead.column = this.selection.$desiredColumn;
14488
14489 var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column);
14490
14491 if (!range.isEmpty()) {
14492 var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start);
14493 var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column);
14494 } else {
14495 var anchor = lead;
14496 }
14497
14498 if (isBackwards) {
14499 var newRange = Range.fromPoints(lead, anchor);
14500 newRange.cursor = newRange.start;
14501 } else {
14502 var newRange = Range.fromPoints(anchor, lead);
14503 newRange.cursor = newRange.end;
14504 }
14505
14506 newRange.desiredColumn = screenLead.column;
14507 if (!this.selection.inMultiSelectMode) {
14508 this.selection.addRange(range);
14509 } else {
14510 if (skip)
14511 var toRemove = range.cursor;
14512 }
14513
14514 this.selection.addRange(newRange);
14515 if (toRemove)
14516 this.selection.substractPoint(toRemove);
14517 };
14518 this.transposeSelections = function(dir) {
14519 var session = this.session;
14520 var sel = session.multiSelect;
14521 var all = sel.ranges;
14522
14523 for (var i = all.length; i--; ) {
14524 var range = all[i];
14525 if (range.isEmpty()) {
14526 var tmp = session.getWordRange(range.start.row, range.start.column);
14527 range.start.row = tmp.start.row;
14528 range.start.column = tmp.start.column;
14529 range.end.row = tmp.end.row;
14530 range.end.column = tmp.end.column;
14531 }
14532 }
14533 sel.mergeOverlappingRanges();
14534
14535 var words = [];
14536 for (var i = all.length; i--; ) {
14537 var range = all[i];
14538 words.unshift(session.getTextRange(range));
14539 }
14540
14541 if (dir < 0)
14542 words.unshift(words.pop());
14543 else
14544 words.push(words.shift());
14545
14546 for (var i = all.length; i--; ) {
14547 var range = all[i];
14548 var tmp = range.clone();
14549 session.replace(range, words[i]);
14550 range.start.row = tmp.start.row;
14551 range.start.column = tmp.start.column;
14552 }
14553 };
14554 this.selectMore = function(dir, skip) {
14555 var session = this.session;
14556 var sel = session.multiSelect;
14557
14558 var range = sel.toOrientedRange();
14559 if (range.isEmpty()) {
14560 var range = session.getWordRange(range.start.row, range.start.column);
14561 range.cursor = range.end;
14562 this.multiSelect.addRange(range);
14563 }
14564 var needle = session.getTextRange(range);
14565
14566 var newRange = find(session, needle, dir);
14567 if (newRange) {
14568 newRange.cursor = dir == -1 ? newRange.start : newRange.end;
14569 this.multiSelect.addRange(newRange);
14570 }
14571 if (skip)
14572 this.multiSelect.substractPoint(range.cursor);
14573 };
14574 this.alignCursors = function() {
14575 var session = this.session;
14576 var sel = session.multiSelect;
14577 var ranges = sel.ranges;
14578
14579 if (!ranges.length) {
14580 var range = this.selection.getRange();
14581 var fr = range.start.row, lr = range.end.row;
14582 var lines = this.session.doc.removeLines(fr, lr);
14583 lines = this.$reAlignText(lines);
14584 this.session.doc.insertLines(fr, lines);
14585 range.start.column = 0;
14586 range.end.column = lines[lines.length - 1].length;
14587 this.selection.setRange(range);
14588 } else {
14589 var row = -1;
14590 var sameRowRanges = ranges.filter(function(r) {
14591 if (r.cursor.row == row)
14592 return true;
14593 row = r.cursor.row;
14594 });
14595 sel.$onRemoveRange(sameRowRanges);
14596
14597 var maxCol = 0;
14598 var minSpace = Infinity;
14599 var spaceOffsets = ranges.map(function(r) {
14600 var p = r.cursor;
14601 var line = session.getLine(p.row);
14602 var spaceOffset = line.substr(p.column).search(/\S/g);
14603 if (spaceOffset == -1)
14604 spaceOffset = 0;
14605
14606 if (p.column > maxCol)
14607 maxCol = p.column;
14608 if (spaceOffset < minSpace)
14609 minSpace = spaceOffset;
14610 return spaceOffset;
14611 });
14612 ranges.forEach(function(r, i) {
14613 var p = r.cursor;
14614 var l = maxCol - p.column;
14615 var d = spaceOffsets[i] - minSpace;
14616 if (l > d)
14617 session.insert(p, lang.stringRepeat(" ", l - d));
14618 else
14619 session.remove(new Range(p.row, p.column, p.row, p.column - l + d));
14620
14621 r.start.column = r.end.column = maxCol;
14622 r.start.row = r.end.row = p.row;
14623 r.cursor = r.end;
14624 });
14625 sel.fromOrientedRange(ranges[0]);
14626 this.renderer.updateCursor();
14627 this.renderer.updateBackMarkers();
14628 }
14629 };
14630
14631 this.$reAlignText = function(lines) {
14632 var isLeftAligned = true, isRightAligned = true;
14633 var startW, textW, endW;
14634
14635 return lines.map(function(line) {
14636 var m = line.match(/(\s*)(.*?)(\s*)([=:].*)/);
14637 if (!m)
14638 return [line];
14639
14640 if (startW == null) {
14641 startW = m[1].length;
14642 textW = m[2].length;
14643 endW = m[3].length;
14644 return m;
14645 }
14646
14647 if (startW + textW + endW != m[1].length + m[2].length + m[3].length)
14648 isRightAligned = false;
14649 if (startW != m[1].length)
14650 isLeftAligned = false;
14651
14652 if (startW > m[1].length)
14653 startW = m[1].length;
14654 if (textW < m[2].length)
14655 textW = m[2].length;
14656 if (endW > m[3].length)
14657 endW = m[3].length;
14658
14659 return m;
14660 }).map(isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign);
14661
14662 function spaces(n) {
14663 return lang.stringRepeat(" ", n);
14664 }
14665
14666 function alignLeft(m) {
14667 return !m[2] ? m[0] : spaces(startW) + m[2]
14668 + spaces(textW - m[2].length + endW)
14669 + m[4].replace(/^([=:])\s+/, "$1 ")
14670 }
14671 function alignRight(m) {
14672 return !m[2] ? m[0] : spaces(startW + textW - m[2].length) + m[2]
14673 + spaces(endW, " ")
14674 + m[4].replace(/^([=:])\s+/, "$1 ")
14675 }
14676 function unAlign(m) {
14677 return !m[2] ? m[0] : spaces(startW) + m[2]
14678 + spaces(endW)
14679 + m[4].replace(/^([=:])\s+/, "$1 ")
14680 }
14681 }
14682 }).call(Editor.prototype);
14683
14684
14685 function isSamePoint(p1, p2) {
14686 return p1.row == p2.row && p1.column == p2.column;
14687 }
14688 exports.onSessionChange = function(e) {
14689 var session = e.session;
14690 if (!session.multiSelect) {
14691 session.$selectionMarkers = [];
14692 session.selection.$initRangeList();
14693 session.multiSelect = session.selection;
14694 }
14695 this.multiSelect = session.multiSelect;
14696
14697 var oldSession = e.oldSession;
14698 if (oldSession) {
14699 oldSession.multiSelect.removeEventListener("addRange", this.$onAddRange);
14700 oldSession.multiSelect.removeEventListener("removeRange", this.$onRemoveRange);
14701 oldSession.multiSelect.removeEventListener("multiSelect", this.$onMultiSelect);
14702 oldSession.multiSelect.removeEventListener("singleSelect", this.$onSingleSelect);
14703 }
14704
14705 session.multiSelect.on("addRange", this.$onAddRange);
14706 session.multiSelect.on("removeRange", this.$onRemoveRange);
14707 session.multiSelect.on("multiSelect", this.$onMultiSelect);
14708 session.multiSelect.on("singleSelect", this.$onSingleSelect);
14709
14710 if (this.inMultiSelectMode != session.selection.inMultiSelectMode) {
14711 if (session.selection.inMultiSelectMode)
14712 this.$onMultiSelect();
14713 else
14714 this.$onSingleSelect();
14715 }
14716 };
14717 function MultiSelect(editor) {
14718 editor.$onAddRange = editor.$onAddRange.bind(editor);
14719 editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);
14720 editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);
14721 editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);
14722
14723 exports.onSessionChange.call(editor, editor);
14724 editor.on("changeSession", exports.onSessionChange.bind(editor));
14725
14726 editor.on("mousedown", onMouseDown);
14727 editor.commands.addCommands(commands.defaultCommands);
14728
14729 addAltCursorListeners(editor);
14730 }
14731
14732 function addAltCursorListeners(editor){
14733 var el = editor.textInput.getElement();
14734 var altCursor = false;
14735 var contentEl = editor.renderer.content;
14736 event.addListener(el, "keydown", function(e) {
14737 if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
14738 if (!altCursor) {
14739 contentEl.style.cursor = "crosshair";
14740 altCursor = true;
14741 }
14742 } else if (altCursor) {
14743 contentEl.style.cursor = "";
14744 }
14745 });
14746
14747 event.addListener(el, "keyup", reset);
14748 event.addListener(el, "blur", reset);
14749 function reset() {
14750 if (altCursor) {
14751 contentEl.style.cursor = "";
14752 altCursor = false;
14753 }
14754 }
14755 }
14756
14757 exports.MultiSelect = MultiSelect;
14758
14759 });
14760
14761 define('ace/mouse/multi_select_handler', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) {
14762
14763 var event = require("../lib/event");
14764 function isSamePoint(p1, p2) {
14765 return p1.row == p2.row && p1.column == p2.column;
14766 }
14767
14768 function onMouseDown(e) {
14769 var ev = e.domEvent;
14770 var alt = ev.altKey;
14771 var shift = ev.shiftKey;
14772 var ctrl = e.getAccelKey();
14773 var button = e.getButton();
14774
14775 if (e.editor.inMultiSelectMode && button == 2) {
14776 e.editor.textInput.onContextMenu(e.domEvent);
14777 return;
14778 }
14779
14780 if (!ctrl && !alt) {
14781 if (button == 0 && e.editor.inMultiSelectMode)
14782 e.editor.exitMultiSelectMode();
14783 return;
14784 }
14785
14786 var editor = e.editor;
14787 var selection = editor.selection;
14788 var isMultiSelect = editor.inMultiSelectMode;
14789 var pos = e.getDocumentPosition();
14790 var cursor = selection.getCursor();
14791 var inSelection = e.inSelection() || (selection.isEmpty() && isSamePoint(pos, cursor));
14792
14793
14794 var mouseX = e.x, mouseY = e.y;
14795 var onMouseSelection = function(e) {
14796 mouseX = e.clientX;
14797 mouseY = e.clientY;
14798 };
14799
14800 var blockSelect = function() {
14801 var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
14802 var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column);
14803
14804 if (isSamePoint(screenCursor, newCursor)
14805 && isSamePoint(cursor, selection.selectionLead))
14806 return;
14807 screenCursor = newCursor;
14808
14809 editor.selection.moveCursorToPosition(cursor);
14810 editor.selection.clearSelection();
14811 editor.renderer.scrollCursorIntoView();
14812
14813 editor.removeSelectionMarkers(rectSel);
14814 rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor);
14815 rectSel.forEach(editor.addSelectionMarker, editor);
14816 editor.updateSelectionMarkers();
14817 };
14818
14819 var session = editor.session;
14820 var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
14821 var screenCursor = screenAnchor;
14822
14823
14824
14825 if (ctrl && !shift && !alt && button == 0) {
14826 if (!isMultiSelect && inSelection)
14827 return; // dragging
14828
14829 if (!isMultiSelect) {
14830 var range = selection.toOrientedRange();
14831 editor.addSelectionMarker(range);
14832 }
14833
14834 var oldRange = selection.rangeList.rangeAtPoint(pos);
14835
14836 editor.once("mouseup", function() {
14837 var tmpSel = selection.toOrientedRange();
14838
14839 if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
14840 selection.substractPoint(tmpSel.cursor);
14841 else {
14842 if (range) {
14843 editor.removeSelectionMarker(range);
14844 selection.addRange(range);
14845 }
14846 selection.addRange(tmpSel);
14847 }
14848 });
14849
14850 } else if (alt && button == 0) {
14851 e.stop();
14852
14853 if (isMultiSelect && !ctrl)
14854 selection.toSingleRange();
14855 else if (!isMultiSelect && ctrl)
14856 selection.addRange();
14857
14858 var rectSel = [];
14859 if (shift) {
14860 screenAnchor = session.documentToScreenPosition(selection.lead);
14861 blockSelect();
14862 } else {
14863 selection.moveCursorToPosition(pos);
14864 selection.clearSelection();
14865 }
14866
14867
14868 var onMouseSelectionEnd = function(e) {
14869 clearInterval(timerId);
14870 editor.removeSelectionMarkers(rectSel);
14871 for (var i = 0; i < rectSel.length; i++)
14872 selection.addRange(rectSel[i]);
14873 };
14874
14875 var onSelectionInterval = blockSelect;
14876
14877 event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
14878 var timerId = setInterval(function() {onSelectionInterval();}, 20);
14879
14880 return e.preventDefault();
14881 }
14882 }
14883
14884
14885 exports.onMouseDown = onMouseDown;
14886
14887 });
14888
14889 define('ace/commands/multi_select_commands', ['require', 'exports', 'module' , 'ace/keyboard/hash_handler'], function(require, exports, module) {
14890 exports.defaultCommands = [{
14891 name: "addCursorAbove",
14892 exec: function(editor) { editor.selectMoreLines(-1); },
14893 bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"},
14894 readonly: true
14895 }, {
14896 name: "addCursorBelow",
14897 exec: function(editor) { editor.selectMoreLines(1); },
14898 bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"},
14899 readonly: true
14900 }, {
14901 name: "addCursorAboveSkipCurrent",
14902 exec: function(editor) { editor.selectMoreLines(-1, true); },
14903 bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"},
14904 readonly: true
14905 }, {
14906 name: "addCursorBelowSkipCurrent",
14907 exec: function(editor) { editor.selectMoreLines(1, true); },
14908 bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"},
14909 readonly: true
14910 }, {
14911 name: "selectMoreBefore",
14912 exec: function(editor) { editor.selectMore(-1); },
14913 bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"},
14914 readonly: true
14915 }, {
14916 name: "selectMoreAfter",
14917 exec: function(editor) { editor.selectMore(1); },
14918 bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"},
14919 readonly: true
14920 }, {
14921 name: "selectNextBefore",
14922 exec: function(editor) { editor.selectMore(-1, true); },
14923 bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"},
14924 readonly: true
14925 }, {
14926 name: "selectNextAfter",
14927 exec: function(editor) { editor.selectMore(1, true); },
14928 bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
14929 readonly: true
14930 }, {
14931 name: "splitIntoLines",
14932 exec: function(editor) { editor.multiSelect.splitIntoLines(); },
14933 bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
14934 readonly: true
14935 }, {
14936 name: "alignCursors",
14937 exec: function(editor) { editor.alignCursors(); },
14938 bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
14939 }];
14940 exports.multiSelectCommands = [{
14941 name: "singleSelection",
14942 bindKey: "esc",
14943 exec: function(editor) { editor.exitMultiSelectMode(); },
14944 readonly: true,
14945 isAvailable: function(editor) {return editor && editor.inMultiSelectMode}
14946 }];
14947
14948 var HashHandler = require("../keyboard/hash_handler").HashHandler;
14949 exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
14950
14951 });
14952
14953 define('ace/worker/worker_client', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/config'], function(require, exports, module) {
14954
14955
14956 var oop = require("../lib/oop");
14957 var EventEmitter = require("../lib/event_emitter").EventEmitter;
14958 var config = require("../config");
14959
14960 var WorkerClient = function(topLevelNamespaces, mod, classname) {
14961 this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
14962 this.changeListener = this.changeListener.bind(this);
14963 this.onMessage = this.onMessage.bind(this);
14964 this.onError = this.onError.bind(this);
14965 if (require.nameToUrl && !require.toUrl)
14966 require.toUrl = require.nameToUrl;
14967
14968 var workerUrl;
14969 if (config.get("packaged") || !require.toUrl) {
14970 workerUrl = config.moduleUrl(mod, "worker");
14971 } else {
14972 var normalizePath = this.$normalizePath;
14973 workerUrl = normalizePath(require.toUrl("ace/worker/worker.js", null, "_"));
14974
14975 var tlns = {};
14976 topLevelNamespaces.forEach(function(ns) {
14977 tlns[ns] = normalizePath(require.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, ""));
14978 });
14979 }
14980
14981 this.$worker = new Worker(workerUrl);
14982 this.$worker.postMessage({
14983 init : true,
14984 tlns: tlns,
14985 module: mod,
14986 classname: classname
14987 });
14988
14989 this.callbackId = 1;
14990 this.callbacks = {};
14991
14992 this.$worker.onerror = this.onError;
14993 this.$worker.onmessage = this.onMessage;
14994 };
14995
14996 (function(){
14997
14998 oop.implement(this, EventEmitter);
14999
15000 this.onError = function(e) {
15001 window.console && console.log && console.log(e);
15002 throw e;
15003 };
15004
15005 this.onMessage = function(e) {
15006 var msg = e.data;
15007 switch(msg.type) {
15008 case "log":
15009 window.console && console.log && console.log.apply(console, msg.data);
15010 break;
15011
15012 case "event":
15013 this._emit(msg.name, {data: msg.data});
15014 break;
15015
15016 case "call":
15017 var callback = this.callbacks[msg.id];
15018 if (callback) {
15019 callback(msg.data);
15020 delete this.callbacks[msg.id];
15021 }
15022 break;
15023 }
15024 };
15025
15026 this.$normalizePath = function(path) {
15027 if (!location.host) // needed for file:// protocol
15028 return path;
15029 path = path.replace(/^[a-z]+:\/\/[^\/]+/, ""); // Remove domain name and rebuild it
15030 path = location.protocol + "//" + location.host
15031 + (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
15032 + "/" + path.replace(/^[\/]+/, "");
15033 return path;
15034 };
15035
15036 this.terminate = function() {
15037 this._emit("terminate", {});
15038 this.$worker.terminate();
15039 this.$worker = null;
15040 this.$doc.removeEventListener("change", this.changeListener);
15041 this.$doc = null;
15042 };
15043
15044 this.send = function(cmd, args) {
15045 this.$worker.postMessage({command: cmd, args: args});
15046 };
15047
15048 this.call = function(cmd, args, callback) {
15049 if (callback) {
15050 var id = this.callbackId++;
15051 this.callbacks[id] = callback;
15052 args.push(id);
15053 }
15054 this.send(cmd, args);
15055 };
15056
15057 this.emit = function(event, data) {
15058 try {
15059 this.$worker.postMessage({event: event, data: {data: data.data}});
15060 }
15061 catch(ex) {}
15062 };
15063
15064 this.attachToDocument = function(doc) {
15065 if(this.$doc)
15066 this.terminate();
15067
15068 this.$doc = doc;
15069 this.call("setValue", [doc.getValue()]);
15070 doc.on("change", this.changeListener);
15071 };
15072
15073 this.changeListener = function(e) {
15074 if (!this.deltaQueue) {
15075 this.deltaQueue = [e.data];
15076 setTimeout(this.$sendDeltaQueue, 1);
15077 } else
15078 this.deltaQueue.push(e.data);
15079 };
15080
15081 this.$sendDeltaQueue = function() {
15082 var q = this.deltaQueue;
15083 if (!q) return;
15084 this.deltaQueue = null;
15085 if (q.length > 20 && q.length > this.$doc.getLength() >> 1) {
15086 this.call("setValue", [this.$doc.getValue()]);
15087 } else
15088 this.emit("change", {data: q});
15089 }
15090
15091 }).call(WorkerClient.prototype);
15092
15093
15094 var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
15095 this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
15096 this.changeListener = this.changeListener.bind(this);
15097 this.callbackId = 1;
15098 this.callbacks = {};
15099 this.messageBuffer = [];
15100
15101 var main = null;
15102 var sender = Object.create(EventEmitter);
15103 var _self = this;
15104
15105 this.$worker = {};
15106 this.$worker.terminate = function() {};
15107 this.$worker.postMessage = function(e) {
15108 _self.messageBuffer.push(e);
15109 main && setTimeout(processNext);
15110 };
15111
15112 var processNext = function() {
15113 var msg = _self.messageBuffer.shift();
15114 if (msg.command)
15115 main[msg.command].apply(main, msg.args);
15116 else if (msg.event)
15117 sender._emit(msg.event, msg.data);
15118 };
15119
15120 sender.postMessage = function(msg) {
15121 _self.onMessage({data: msg});
15122 };
15123 sender.callback = function(data, callbackId) {
15124 this.postMessage({type: "call", id: callbackId, data: data});
15125 };
15126 sender.emit = function(name, data) {
15127 this.postMessage({type: "event", name: name, data: data});
15128 };
15129
15130 config.loadModule(["worker", mod], function(Main) {
15131 main = new Main[classname](sender);
15132 while (_self.messageBuffer.length)
15133 processNext();
15134 });
15135 };
15136
15137 UIWorkerClient.prototype = WorkerClient.prototype;
15138
15139 exports.UIWorkerClient = UIWorkerClient;
15140 exports.WorkerClient = WorkerClient;
15141
15142 });
15143 define('ace/placeholder', ['require', 'exports', 'module' , 'ace/range', 'ace/lib/event_emitter', 'ace/lib/oop'], function(require, exports, module) {
15144
15145
15146 var Range = require("./range").Range;
15147 var EventEmitter = require("./lib/event_emitter").EventEmitter;
15148 var oop = require("./lib/oop");
15149
15150 var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
15151 var _self = this;
15152 this.length = length;
15153 this.session = session;
15154 this.doc = session.getDocument();
15155 this.mainClass = mainClass;
15156 this.othersClass = othersClass;
15157 this.$onUpdate = this.onUpdate.bind(this);
15158 this.doc.on("change", this.$onUpdate);
15159 this.$others = others;
15160
15161 this.$onCursorChange = function() {
15162 setTimeout(function() {
15163 _self.onCursorChange();
15164 });
15165 };
15166
15167 this.$pos = pos;
15168 var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1};
15169 this.$undoStackDepth = undoStack.length;
15170 this.setup();
15171
15172 session.selection.on("changeCursor", this.$onCursorChange);
15173 };
15174
15175 (function() {
15176
15177 oop.implement(this, EventEmitter);
15178 this.setup = function() {
15179 var _self = this;
15180 var doc = this.doc;
15181 var session = this.session;
15182 var pos = this.$pos;
15183
15184 this.pos = doc.createAnchor(pos.row, pos.column);
15185 this.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);
15186 this.pos.on("change", function(event) {
15187 session.removeMarker(_self.markerId);
15188 _self.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.mainClass, null, false);
15189 });
15190 this.others = [];
15191 this.$others.forEach(function(other) {
15192 var anchor = doc.createAnchor(other.row, other.column);
15193 _self.others.push(anchor);
15194 });
15195 session.setUndoSelect(false);
15196 };
15197 this.showOtherMarkers = function() {
15198 if(this.othersActive) return;
15199 var session = this.session;
15200 var _self = this;
15201 this.othersActive = true;
15202 this.others.forEach(function(anchor) {
15203 anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false);
15204 anchor.on("change", function(event) {
15205 session.removeMarker(anchor.markerId);
15206 anchor.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.othersClass, null, false);
15207 });
15208 });
15209 };
15210 this.hideOtherMarkers = function() {
15211 if(!this.othersActive) return;
15212 this.othersActive = false;
15213 for (var i = 0; i < this.others.length; i++) {
15214 this.session.removeMarker(this.others[i].markerId);
15215 }
15216 };
15217 this.onUpdate = function(event) {
15218 var delta = event.data;
15219 var range = delta.range;
15220 if(range.start.row !== range.end.row) return;
15221 if(range.start.row !== this.pos.row) return;
15222 if (this.$updating) return;
15223 this.$updating = true;
15224 var lengthDiff = delta.action === "insertText" ? range.end.column - range.start.column : range.start.column - range.end.column;
15225
15226 if(range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1) {
15227 var distanceFromStart = range.start.column - this.pos.column;
15228 this.length += lengthDiff;
15229 if(!this.session.$fromUndo) {
15230 if(delta.action === "insertText") {
15231 for (var i = this.others.length - 1; i >= 0; i--) {
15232 var otherPos = this.others[i];
15233 var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
15234 if(otherPos.row === range.start.row && range.start.column < otherPos.column)
15235 newPos.column += lengthDiff;
15236 this.doc.insert(newPos, delta.text);
15237 }
15238 } else if(delta.action === "removeText") {
15239 for (var i = this.others.length - 1; i >= 0; i--) {
15240 var otherPos = this.others[i];
15241 var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
15242 if(otherPos.row === range.start.row && range.start.column < otherPos.column)
15243 newPos.column += lengthDiff;
15244 this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
15245 }
15246 }
15247 if(range.start.column === this.pos.column && delta.action === "insertText") {
15248 setTimeout(function() {
15249 this.pos.setPosition(this.pos.row, this.pos.column - lengthDiff);
15250 for (var i = 0; i < this.others.length; i++) {
15251 var other = this.others[i];
15252 var newPos = {row: other.row, column: other.column - lengthDiff};
15253 if(other.row === range.start.row && range.start.column < other.column)
15254 newPos.column += lengthDiff;
15255 other.setPosition(newPos.row, newPos.column);
15256 }
15257 }.bind(this), 0);
15258 }
15259 else if(range.start.column === this.pos.column && delta.action === "removeText") {
15260 setTimeout(function() {
15261 for (var i = 0; i < this.others.length; i++) {
15262 var other = this.others[i];
15263 if(other.row === range.start.row && range.start.column < other.column) {
15264 other.setPosition(other.row, other.column - lengthDiff);
15265 }
15266 }
15267 }.bind(this), 0);
15268 }
15269 }
15270 this.pos._emit("change", {value: this.pos});
15271 for (var i = 0; i < this.others.length; i++) {
15272 this.others[i]._emit("change", {value: this.others[i]});
15273 }
15274 }
15275 this.$updating = false;
15276 };
15277
15278 this.onCursorChange = function(event) {
15279 if (this.$updating) return;
15280 var pos = this.session.selection.getCursor();
15281 if(pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {
15282 this.showOtherMarkers();
15283 this._emit("cursorEnter", event);
15284 } else {
15285 this.hideOtherMarkers();
15286 this._emit("cursorLeave", event);
15287 }
15288 };
15289 this.detach = function() {
15290 this.session.removeMarker(this.markerId);
15291 this.hideOtherMarkers();
15292 this.doc.removeEventListener("change", this.$onUpdate);
15293 this.session.selection.removeEventListener("changeCursor", this.$onCursorChange);
15294 this.pos.detach();
15295 for (var i = 0; i < this.others.length; i++) {
15296 this.others[i].detach();
15297 }
15298 this.session.setUndoSelect(true);
15299 };
15300 this.cancel = function() {
15301 if(this.$undoStackDepth === -1)
15302 throw Error("Canceling placeholders only supported with undo manager attached to session.");
15303 var undoManager = this.session.getUndoManager();
15304 var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;
15305 for (var i = 0; i < undosRequired; i++) {
15306 undoManager.undo(true);
15307 }
15308 };
15309 }).call(PlaceHolder.prototype);
15310
15311
15312 exports.PlaceHolder = PlaceHolder;
15313 });
15314
15315 define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
15316
15317
15318 var Range = require("../../range").Range;
15319
15320 var FoldMode = exports.FoldMode = function() {};
15321
15322 (function() {
15323
15324 this.foldingStartMarker = null;
15325 this.foldingStopMarker = null;
15326 this.getFoldWidget = function(session, foldStyle, row) {
15327 var line = session.getLine(row);
15328 if (this.foldingStartMarker.test(line))
15329 return "start";
15330 if (foldStyle == "markbeginend"
15331 && this.foldingStopMarker
15332 && this.foldingStopMarker.test(line))
15333 return "end";
15334 return "";
15335 };
15336
15337 this.getFoldWidgetRange = function(session, foldStyle, row) {
15338 return null;
15339 };
15340
15341 this.indentationBlock = function(session, row, column) {
15342 var re = /\S/;
15343 var line = session.getLine(row);
15344 var startLevel = line.search(re);
15345 if (startLevel == -1)
15346 return;
15347
15348 var startColumn = column || line.length;
15349 var maxRow = session.getLength();
15350 var startRow = row;
15351 var endRow = row;
15352
15353 while (++row < maxRow) {
15354 var level = session.getLine(row).search(re);
15355
15356 if (level == -1)
15357 continue;
15358
15359 if (level <= startLevel)
15360 break;
15361
15362 endRow = row;
15363 }
15364
15365 if (endRow > startRow) {
15366 var endColumn = session.getLine(endRow).length;
15367 return new Range(startRow, startColumn, endRow, endColumn);
15368 }
15369 };
15370
15371 this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
15372 var start = {row: row, column: column + 1};
15373 var end = session.$findClosingBracket(bracket, start, typeRe);
15374 if (!end)
15375 return;
15376
15377 var fw = session.foldWidgets[end.row];
15378 if (fw == null)
15379 fw = this.getFoldWidget(session, end.row);
15380
15381 if (fw == "start" && end.row > start.row) {
15382 end.row --;
15383 end.column = session.getLine(end.row).length;
15384 }
15385 return Range.fromPoints(start, end);
15386 };
15387
15388 this.closingBracketBlock = function(session, bracket, row, column, typeRe) {
15389 var end = {row: row, column: column};
15390 var start = session.$findOpeningBracket(bracket, end);
15391
15392 if (!start)
15393 return;
15394
15395 start.column++;
15396 end.column--;
15397
15398 return Range.fromPoints(start, end);
15399 };
15400 }).call(FoldMode.prototype);
15401
15402 });
15403
15404 define('ace/theme/textmate', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
15405
15406
15407 exports.isDark = false;
15408 exports.cssClass = "ace-tm";
15409 exports.cssText = ".ace-tm .ace_gutter {\
15410 background: #f0f0f0;\
15411 color: #333;\
15412 }\
15413 .ace-tm .ace_print-margin {\
15414 width: 1px;\
15415 background: #e8e8e8;\
15416 }\
15417 .ace-tm .ace_fold {\
15418 background-color: #6B72E6;\
15419 }\
15420 .ace-tm {\
15421 background-color: #FFFFFF;\
15422 }\
15423 .ace-tm .ace_cursor {\
15424 border-left: 2px solid black;\
15425 }\
15426 .ace-tm .ace_overwrite-cursors .ace_cursor {\
15427 border-left: 0px;\
15428 border-bottom: 1px solid black;\
15429 }\
15430 .ace-tm .ace_invisible {\
15431 color: rgb(191, 191, 191);\
15432 }\
15433 .ace-tm .ace_storage,\
15434 .ace-tm .ace_keyword {\
15435 color: blue;\
15436 }\
15437 .ace-tm .ace_constant {\
15438 color: rgb(197, 6, 11);\
15439 }\
15440 .ace-tm .ace_constant.ace_buildin {\
15441 color: rgb(88, 72, 246);\
15442 }\
15443 .ace-tm .ace_constant.ace_language {\
15444 color: rgb(88, 92, 246);\
15445 }\
15446 .ace-tm .ace_constant.ace_library {\
15447 color: rgb(6, 150, 14);\
15448 }\
15449 .ace-tm .ace_invalid {\
15450 background-color: rgba(255, 0, 0, 0.1);\
15451 color: red;\
15452 }\
15453 .ace-tm .ace_support.ace_function {\
15454 color: rgb(60, 76, 114);\
15455 }\
15456 .ace-tm .ace_support.ace_constant {\
15457 color: rgb(6, 150, 14);\
15458 }\
15459 .ace-tm .ace_support.ace_type,\
15460 .ace-tm .ace_support.ace_class {\
15461 color: rgb(109, 121, 222);\
15462 }\
15463 .ace-tm .ace_keyword.ace_operator {\
15464 color: rgb(104, 118, 135);\
15465 }\
15466 .ace-tm .ace_string {\
15467 color: rgb(3, 106, 7);\
15468 }\
15469 .ace-tm .ace_comment {\
15470 color: rgb(76, 136, 107);\
15471 }\
15472 .ace-tm .ace_comment.ace_doc {\
15473 color: rgb(0, 102, 255);\
15474 }\
15475 .ace-tm .ace_comment.ace_doc.ace_tag {\
15476 color: rgb(128, 159, 191);\
15477 }\
15478 .ace-tm .ace_constant.ace_numeric {\
15479 color: rgb(0, 0, 205);\
15480 }\
15481 .ace-tm .ace_variable {\
15482 color: rgb(49, 132, 149);\
15483 }\
15484 .ace-tm .ace_xml-pe {\
15485 color: rgb(104, 104, 91);\
15486 }\
15487 .ace-tm .ace_entity.ace_name.ace_function {\
15488 color: #0000A2;\
15489 }\
15490 .ace-tm .ace_markup.ace_heading {\
15491 color: rgb(12, 7, 255);\
15492 }\
15493 .ace-tm .ace_markup.ace_list {\
15494 color:rgb(185, 6, 144);\
15495 }\
15496 .ace-tm .ace_meta.ace_tag {\
15497 color:rgb(0, 22, 142);\
15498 }\
15499 .ace-tm .ace_string.ace_regex {\
15500 color: rgb(255, 0, 0)\
15501 }\
15502 .ace-tm .ace_marker-layer .ace_selection {\
15503 background: rgb(181, 213, 255);\
15504 }\
15505 .ace-tm.ace_multiselect .ace_selection.ace_start {\
15506 box-shadow: 0 0 3px 0px white;\
15507 border-radius: 2px;\
15508 }\
15509 .ace-tm .ace_marker-layer .ace_step {\
15510 background: rgb(252, 255, 0);\
15511 }\
15512 .ace-tm .ace_marker-layer .ace_stack {\
15513 background: rgb(164, 229, 101);\
15514 }\
15515 .ace-tm .ace_marker-layer .ace_bracket {\
15516 margin: -1px 0 0 -1px;\
15517 border: 1px solid rgb(192, 192, 192);\
15518 }\
15519 .ace-tm .ace_marker-layer .ace_active-line {\
15520 background: rgba(0, 0, 0, 0.07);\
15521 }\
15522 .ace-tm .ace_gutter-active-line {\
15523 background-color : #dcdcdc;\
15524 }\
15525 .ace-tm .ace_marker-layer .ace_selected-word {\
15526 background: rgb(250, 250, 255);\
15527 border: 1px solid rgb(200, 200, 250);\
15528 }\
15529 .ace-tm .ace_indent-guide {\
15530 background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
15531 }\
15532 ";
15533
15534 var dom = require("../lib/dom");
15535 dom.importCssString(exports.cssText, exports.cssClass);
15536 });
15537 ;
15538 (function() {
15539 window.require(["ace/ace"], function(a) {
15540 a && a.config.init();
15541 if (!window.ace)
15542 window.ace = {};
15543 for (var key in a) if (a.hasOwnProperty(key))
15544 ace[key] = a[key];
15545 });
15546 })();
15547
+0
-270
try/ace/ext-emmet.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/ext/emmet', ['require', 'exports', 'module' , 'ace/keyboard/hash_handler', 'ace/editor', 'ace/config'], function(require, exports, module) {
31
32 var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
33 var Editor = require("ace/editor").Editor;
34 var emmet;
35
36 Editor.prototype.indexToPosition = function(index) {
37 return this.session.doc.indexToPosition(index);
38 };
39
40 Editor.prototype.positionToIndex = function(pos) {
41 return this.session.doc.positionToIndex(pos);
42 };
43 function AceEmmetEditor() {}
44
45 AceEmmetEditor.prototype = {
46 setupContext: function(editor) {
47 this.ace = editor;
48 this.indentation = editor.session.getTabString();
49 if (!emmet)
50 emmet = window.emmet;
51 emmet.require("resources").setVariable("indentation", this.indentation);
52 this.$syntax = null;
53 this.$syntax = this.getSyntax();
54 },
55 getSelectionRange: function() {
56 var range = this.ace.getSelectionRange();
57 return {
58 start: this.ace.positionToIndex(range.start),
59 end: this.ace.positionToIndex(range.end)
60 };
61 },
62 createSelection: function(start, end) {
63 this.ace.selection.setRange({
64 start: this.ace.indexToPosition(start),
65 end: this.ace.indexToPosition(end)
66 });
67 },
68 getCurrentLineRange: function() {
69 var row = this.ace.getCursorPosition().row;
70 var lineLength = this.ace.session.getLine(row).length;
71 var index = this.ace.positionToIndex({row: row, column: 0});
72 return {
73 start: index,
74 end: index + lineLength
75 };
76 },
77 getCaretPos: function(){
78 var pos = this.ace.getCursorPosition();
79 return this.ace.positionToIndex(pos);
80 },
81 setCaretPos: function(index){
82 var pos = this.ace.indexToPosition(index);
83 this.ace.clearSelection();
84 this.ace.selection.moveCursorToPosition(pos);
85 },
86 getCurrentLine: function() {
87 var row = this.ace.getCursorPosition().row;
88 return this.ace.session.getLine(row);
89 },
90 replaceContent: function(value, start, end, noIndent) {
91 if (end == null)
92 end = start == null ? this.getContent().length : start;
93 if (start == null)
94 start = 0;
95 var utils = emmet.require("utils");
96 if (!noIndent) {
97 value = utils.padString(value, utils.getLinePaddingFromPosition(this.getContent(), start));
98 }
99 var tabstopData = emmet.require("tabStops").extract(value, {
100 escape: function(ch) {
101 return ch;
102 }
103 });
104
105 value = tabstopData.text;
106 var firstTabStop = tabstopData.tabstops[0];
107
108 if (firstTabStop) {
109 firstTabStop.start += start;
110 firstTabStop.end += start;
111 } else {
112 firstTabStop = {
113 start: value.length + start,
114 end: value.length + start
115 };
116 }
117
118 var range = this.ace.getSelectionRange();
119 range.start = this.ace.indexToPosition(start);
120 range.end = this.ace.indexToPosition(end);
121
122 this.ace.session.replace(range, value);
123
124 range.start = this.ace.indexToPosition(firstTabStop.start);
125 range.end = this.ace.indexToPosition(firstTabStop.end);
126 this.ace.selection.setRange(range);
127 },
128 getContent: function(){
129 return this.ace.getValue();
130 },
131 getSyntax: function() {
132 if (this.$syntax)
133 return this.$syntax;
134 var syntax = this.ace.session.$modeId.split("/").pop();
135 if (syntax == "html" || syntax == "php") {
136 var cursor = this.ace.getCursorPosition();
137 var state = this.ace.session.getState(cursor.row);
138 if (typeof state != "string")
139 state = state[0];
140 if (state) {
141 state = state.split("-");
142 if (state.length > 1)
143 syntax = state[0];
144 else if (syntax == "php")
145 syntax = "html";
146 }
147 }
148 return syntax;
149 },
150 getProfileName: function() {
151 switch(this.getSyntax()) {
152 case "css": return "css";
153 case "xml":
154 case "xsl":
155 return "xml";
156 case "html":
157 var profile = emmet.require("resources").getVariable("profile");
158 if (!profile)
159 profile = this.ace.session.getLines(0,2).join("").search(/<!DOCTYPE[^>]+XHTML/i) != -1 ? "xhtml": "html";
160 return profile;
161 }
162 return "xhtml";
163 },
164 prompt: function(title) {
165 return prompt(title);
166 },
167 getSelection: function() {
168 return this.ace.session.getTextRange();
169 },
170 getFilePath: function() {
171 return "";
172 }
173 };
174
175
176 var keymap = {
177 expand_abbreviation: {"mac": "ctrl+alt+e", "win": "alt+e"},
178 match_pair_outward: {"mac": "ctrl+d", "win": "ctrl+,"},
179 match_pair_inward: {"mac": "ctrl+j", "win": "ctrl+shift+0"},
180 matching_pair: {"mac": "ctrl+alt+j", "win": "alt+j"},
181 next_edit_point: "alt+right",
182 prev_edit_point: "alt+left",
183 toggle_comment: {"mac": "command+/", "win": "ctrl+/"},
184 split_join_tag: {"mac": "shift+command+'", "win": "shift+ctrl+`"},
185 remove_tag: {"mac": "command+'", "win": "shift+ctrl+;"},
186 evaluate_math_expression: {"mac": "shift+command+y", "win": "shift+ctrl+y"},
187 increment_number_by_1: "ctrl+up",
188 decrement_number_by_1: "ctrl+down",
189 increment_number_by_01: "alt+up",
190 decrement_number_by_01: "alt+down",
191 increment_number_by_10: {"mac": "alt+command+up", "win": "shift+alt+up"},
192 decrement_number_by_10: {"mac": "alt+command+down", "win": "shift+alt+down"},
193 select_next_item: {"mac": "shift+command+.", "win": "shift+ctrl+."},
194 select_previous_item: {"mac": "shift+command+,", "win": "shift+ctrl+,"},
195 reflect_css_value: {"mac": "shift+command+r", "win": "shift+ctrl+r"},
196
197 encode_decode_data_url: {"mac": "shift+ctrl+d", "win": "ctrl+'"},
198 expand_abbreviation_with_tab: "Tab",
199 wrap_with_abbreviation: {"mac": "shift+ctrl+a", "win": "shift+ctrl+a"}
200 };
201
202 var editorProxy = new AceEmmetEditor();
203 exports.commands = new HashHandler();
204 exports.runEmmetCommand = function(editor) {
205 editorProxy.setupContext(editor);
206 if (editorProxy.getSyntax() == "php")
207 return false;
208 var actions = emmet.require("actions");
209
210 if (this.action == "expand_abbreviation_with_tab") {
211 if (!editor.selection.isEmpty())
212 return false;
213 }
214
215 if (this.action == "wrap_with_abbreviation") {
216 return setTimeout(function() {
217 actions.run("wrap_with_abbreviation", editorProxy);
218 }, 0);
219 }
220
221 try {
222 var result = actions.run(this.action, editorProxy);
223 } catch(e) {
224 editor._signal("changeStatus", typeof e == "string" ? e : e.message);
225 console.log(e);
226 }
227 return result;
228 };
229
230 for (var command in keymap) {
231 exports.commands.addCommand({
232 name: "emmet:" + command,
233 action: command,
234 bindKey: keymap[command],
235 exec: exports.runEmmetCommand,
236 multiSelectAction: "forEach"
237 });
238 }
239
240 var onChangeMode = function(e, target) {
241 var editor = target;
242 if (!editor)
243 return;
244 var modeId = editor.session.$modeId;
245 var enabled = modeId && /css|less|sass|html|php/.test(modeId);
246 if (e.enableEmmet === false)
247 enabled = false;
248 if (enabled)
249 editor.keyBinding.addKeyboardHandler(exports.commands);
250 else
251 editor.keyBinding.removeKeyboardHandler(exports.commands);
252 };
253
254
255 exports.AceEmmetEditor = AceEmmetEditor;
256 require("ace/config").defineOptions(Editor.prototype, "editor", {
257 enableEmmet: {
258 set: function(val) {
259 this[val ? "on" : "removeListener"]("changeMode", onChangeMode);
260 onChangeMode({enableEmmet: !!val}, this);
261 },
262 value: true
263 }
264 });
265
266
267 exports.setCore = function(e) {emmet = e;};
268 });
269
+0
-207
try/ace/ext-keybinding_menu.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
4 * All rights reserved.
5 *
6 * Contributed to Ajax.org under the BSD license.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of Ajax.org B.V. nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * ***** END LICENSE BLOCK ***** */
31
32 define('ace/ext/keybinding_menu', ['require', 'exports', 'module' , 'ace/editor', 'ace/ext/menu_tools/overlay_page', 'ace/ext/menu_tools/get_editor_keyboard_shortcuts'], function(require, exports, module) {
33
34 var Editor = require("ace/editor").Editor;
35 function showKeyboardShortcuts (editor) {
36 if(!document.getElementById('kbshortcutmenu')) {
37 var overlayPage = require('./menu_tools/overlay_page').overlayPage;
38 var getEditorKeybordShortcuts = require('./menu_tools/get_editor_keyboard_shortcuts').getEditorKeybordShortcuts;
39 var kb = getEditorKeybordShortcuts(editor);
40 var el = document.createElement('div');
41 var commands = kb.reduce(function(previous, current) {
42 return previous + '<div class="ace_optionsMenuEntry"><span class="ace_optionsMenuCommand">'
43 + current.command + '</span> : '
44 + '<span class="ace_optionsMenuKey">' + current.key + '</span></div>';
45 }, '');
46
47 el.id = 'kbshortcutmenu';
48 el.innerHTML = '<h1>Keyboard Shortcuts</h1>' + commands + '</div>';
49 overlayPage(editor, el, '0', '0', '0', null);
50 }
51 };
52 module.exports.init = function(editor) {
53 Editor.prototype.showKeyboardShortcuts = function() {
54 showKeyboardShortcuts(this);
55 };
56 editor.commands.addCommands([{
57 name: "showKeyboardShortcuts",
58 bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
59 exec: function(editor, line) {
60 editor.showKeyboardShortcuts();
61 }
62 }]);
63 };
64
65 });
66
67 define('ace/ext/menu_tools/overlay_page', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
68
69 var dom = require("../../lib/dom");
70 var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
71 background-color: #F7F7F7;\
72 color: black;\
73 box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
74 padding: 1em 0.5em 2em 1em;\
75 overflow: auto;\
76 position: absolute;\
77 margin: 0;\
78 bottom: 0;\
79 right: 0;\
80 top: 0;\
81 z-index: 9991;\
82 cursor: default;\
83 }\
84 .ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
85 box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
86 background-color: rgba(255, 255, 255, 0.6);\
87 color: black;\
88 }\
89 .ace_optionsMenuEntry:hover {\
90 background-color: rgba(100, 100, 100, 0.1);\
91 -webkit-transition: all 0.5s;\
92 transition: all 0.3s\
93 }\
94 .ace_closeButton {\
95 background: rgba(245, 146, 146, 0.5);\
96 border: 1px solid #F48A8A;\
97 border-radius: 50%;\
98 padding: 7px;\
99 position: absolute;\
100 right: -8px;\
101 top: -8px;\
102 z-index: 1000;\
103 }\
104 .ace_closeButton{\
105 background: rgba(245, 146, 146, 0.9);\
106 }\
107 .ace_optionsMenuKey {\
108 color: darkslateblue;\
109 font-weight: bold;\
110 }\
111 .ace_optionsMenuCommand {\
112 color: darkcyan;\
113 font-weight: normal;\
114 }";
115 dom.importCssString(cssText);
116 module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
117 top = top ? 'top: ' + top + ';' : '';
118 bottom = bottom ? 'bottom: ' + bottom + ';' : '';
119 right = right ? 'right: ' + right + ';' : '';
120 left = left ? 'left: ' + left + ';' : '';
121
122 var closer = document.createElement('div');
123 var contentContainer = document.createElement('div');
124
125 function documentEscListener(e) {
126 if (e.keyCode === 27) {
127 closer.click();
128 }
129 }
130
131 closer.style.cssText = 'margin: 0; padding: 0; ' +
132 'position: fixed; top:0; bottom:0; left:0; right:0;' +
133 'z-index: 9990; ' +
134 'background-color: rgba(0, 0, 0, 0.3);';
135 closer.addEventListener('click', function() {
136 document.removeEventListener('keydown', documentEscListener);
137 closer.parentNode.removeChild(closer);
138 editor.focus();
139 closer = null;
140 });
141 document.addEventListener('keydown', documentEscListener);
142
143 contentContainer.style.cssText = top + right + bottom + left;
144 contentContainer.addEventListener('click', function(e) {
145 e.stopPropagation();
146 });
147
148 var wrapper = dom.createElement("div");
149 wrapper.style.position = "relative";
150
151 var closeButton = dom.createElement("div");
152 closeButton.className = "ace_closeButton";
153 closeButton.addEventListener('click', function() {
154 closer.click();
155 });
156
157 wrapper.appendChild(closeButton);
158 contentContainer.appendChild(wrapper);
159
160 contentContainer.appendChild(contentElement);
161 closer.appendChild(contentContainer);
162 document.body.appendChild(closer);
163 editor.blur();
164 };
165
166 });
167
168 define('ace/ext/menu_tools/get_editor_keyboard_shortcuts', ['require', 'exports', 'module' , 'ace/lib/keys'], function(require, exports, module) {
169
170 var keys = require("../../lib/keys");
171 module.exports.getEditorKeybordShortcuts = function(editor) {
172 var KEY_MODS = keys.KEY_MODS;
173 var keybindings = [];
174 var commandMap = {};
175 editor.keyBinding.$handlers.forEach(function(handler) {
176 var ckb = handler.commmandKeyBinding;
177 for (var i in ckb) {
178 var modifier = parseInt(i);
179 if (modifier == -1) {
180 modifier = "";
181 } else if(isNaN(modifier)) {
182 modifier = i;
183 } else {
184 modifier = "" +
185 (modifier & KEY_MODS.command ? "Cmd-" : "") +
186 (modifier & KEY_MODS.ctrl ? "Ctrl-" : "") +
187 (modifier & KEY_MODS.alt ? "Alt-" : "") +
188 (modifier & KEY_MODS.shift ? "Shift-" : "");
189 }
190 for (var key in ckb[i]) {
191 var command = ckb[i][key]
192 if (typeof command != "string")
193 command = command.name
194 if (commandMap[command]) {
195 commandMap[command].key += "|" + modifier + key;
196 } else {
197 commandMap[command] = {key: modifier+key, command: command};
198 keybindings.push(commandMap[command]);
199 }
200 }
201 }
202 });
203 return keybindings;
204 };
205
206 });
+0
-157
try/ace/ext-modelist.js less more
0 define('ace/ext/modelist', ['require', 'exports', 'module' ], function(require, exports, module) {
1
2
3 var modes = [];
4 function getModeForPath(path) {
5 var mode = modesByName.text;
6 var fileName = path.split(/[\/\\]/).pop();
7 for (var i = 0; i < modes.length; i++) {
8 if (modes[i].supportsFile(fileName)) {
9 mode = modes[i];
10 break;
11 }
12 }
13 return mode;
14 }
15
16 var Mode = function(name, caption, extensions) {
17 this.name = name;
18 this.caption = caption;
19 this.mode = "ace/mode/" + name;
20 this.extensions = extensions;
21 if (/\^/.test(extensions)) {
22 var re = extensions.replace(/\|(\^)?/g, function(a, b){
23 return "$|" + (b ? "^" : "^.*\\.");
24 }) + "$";
25 } else {
26 var re = "^.*\\.(" + extensions + ")$";
27 }
28
29 this.extRe = new RegExp(re, "gi");
30 };
31
32 Mode.prototype.supportsFile = function(filename) {
33 return filename.match(this.extRe);
34 };
35 var supportedModes = {
36 ABAP: ["abap"],
37 ADA: ["ada|adb"],
38 ActionScript:["as"],
39 AsciiDoc: ["asciidoc"],
40 Assembly_x86:["asm"],
41 AutoHotKey: ["ahk"],
42 BatchFile: ["bat|cmd"],
43 C9Search: ["c9search_results"],
44 C_Cpp: ["c|cc|cpp|cxx|h|hh|hpp"],
45 Clojure: ["clj"],
46 Cobol: ["^CBL|COB"],
47 coffee: ["^Cakefile|coffee|cf|cson"],
48 ColdFusion: ["cfm"],
49 CSharp: ["cs"],
50 CSS: ["css"],
51 Curly: ["curly"],
52 D: ["d|di"],
53 Dart: ["dart"],
54 Diff: ["diff|patch"],
55 Dot: ["dot"],
56 Erlang: ["erl|hrl"],
57 EJS: ["ejs"],
58 Forth: ["frt|fs|ldr"],
59 FreeMarker: ["ftl"],
60 Glsl: ["glsl|frag|vert"],
61 golang: ["go"],
62 Groovy: ["groovy"],
63 HAML: ["haml"],
64 Haskell: ["hs"],
65 haXe: ["hx"],
66 HTML: ["htm|html|xhtml"],
67 HTML_Ruby: ["erb|rhtml|html.erb"],
68 Ini: ["Ini|conf"],
69 Jade: ["jade"],
70 Java: ["java"],
71 JavaScript: ["js"],
72 JSON: ["json"],
73 JSONiq: ["jq"],
74 JSP: ["jsp"],
75 JSX: ["jsx"],
76 Julia: ["jl"],
77 LaTeX: ["latex|tex|ltx|bib"],
78 LESS: ["less"],
79 Liquid: ["liquid"],
80 Lisp: ["lisp"],
81 LiveScript: ["ls"],
82 LogiQL: ["logic|lql"],
83 LSL: ["lsl"],
84 Lua: ["lua"],
85 LuaPage: ["lp"],
86 Lucene: ["lucene"],
87 Makefile: ["^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"],
88 MATLAB: ["matlab"],
89 Markdown: ["md|markdown"],
90 MySQL: ["mysql"],
91 MUSHCode: ["mc|mush"],
92 ObjectiveC: ["m|mm"],
93 OCaml: ["ml|mli"],
94 Pascal: ["pas|p"],
95 Perl: ["pl|pm"],
96 pgSQL: ["pgsql"],
97 PHP: ["php|phtml"],
98 Powershell: ["ps1"],
99 Prolog: ["plg|prolog"],
100 Properties: ["properties"],
101 Python: ["py"],
102 R: ["r"],
103 RDoc: ["Rd"],
104 RHTML: ["Rhtml"],
105 Ruby: ["ru|gemspec|rake|rb"],
106 Rust: ["rs"],
107 SASS: ["sass"],
108 SCAD: ["scad"],
109 Scala: ["scala"],
110 Scheme: ["scm|rkt"],
111 SCSS: ["scss"],
112 SH: ["sh|bash"],
113 snippets: ["snippets"],
114 SQL: ["sql"],
115 Stylus: ["styl|stylus"],
116 SVG: ["svg"],
117 Tcl: ["tcl"],
118 Tex: ["tex"],
119 Text: ["txt"],
120 Textile: ["textile"],
121 Toml: ["toml"],
122 Twig: ["twig"],
123 Typescript: ["typescript|ts|str"],
124 VBScript: ["vbs"],
125 Velocity: ["vm"],
126 XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
127 XQuery: ["xq"],
128 YAML: ["yaml"]
129 };
130
131 var nameOverrides = {
132 ObjectiveC: "Objective-C",
133 CSharp: "C#",
134 golang: "Go",
135 C_Cpp: "C/C++",
136 coffee: "CoffeeScript",
137 HTML_Ruby: "HTML (Ruby)"
138 };
139 var modesByName = {};
140 for (var name in supportedModes) {
141 var data = supportedModes[name];
142 var displayName = nameOverrides[name] || name;
143 var filename = name.toLowerCase();
144 var mode = new Mode(filename, displayName, data[0]);
145 modesByName[filename] = mode;
146 modes.push(mode);
147 }
148
149 module.exports = {
150 getModeForPath: getModeForPath,
151 modes: modes,
152 modesByName: modesByName
153 };
154
155 });
156
+0
-252
try/ace/ext-options.js less more
0 define('ace/ext/options', ['require', 'exports', 'module' ], function(require, exports, module) {
1
2
3 var modesByName = modelist.modesByName;
4
5 var options = [
6 ["Document", function(name) {
7 doclist.loadDoc(name, function(session) {
8 if (!session)
9 return;
10 session = env.split.setSession(session);
11 updateUIEditorOptions();
12 env.editor.focus();
13 });
14 }, doclist.all],
15 ["Mode", function(value) {
16 env.editor.session.setMode(modesByName[value].mode || modesByName.text.mode);
17 env.editor.session.modeName = value;
18 }, function(value) {
19 return env.editor.session.modeName || "text"
20 }, modelist.modes],
21 ["Split", function(value) {
22 var sp = env.split;
23 if (value == "none") {
24 if (sp.getSplits() == 2) {
25 env.secondSession = sp.getEditor(1).session;
26 }
27 sp.setSplits(1);
28 } else {
29 var newEditor = (sp.getSplits() == 1);
30 if (value == "below") {
31 sp.setOrientation(sp.BELOW);
32 } else {
33 sp.setOrientation(sp.BESIDE);
34 }
35 sp.setSplits(2);
36
37 if (newEditor) {
38 var session = env.secondSession || sp.getEditor(0).session;
39 var newSession = sp.setSession(session, 1);
40 newSession.name = session.name;
41 }
42 }
43 }, ["None", "Beside", "Below"]],
44 ["Theme", function(value) {
45 if (!value)
46 return;
47 env.editor.setTheme("ace/theme/" + value);
48 themeEl.selectedValue = value;
49 }, function() {
50 return env.editor.getTheme();
51 }, {
52 "Bright": {
53 chrome: "Chrome",
54 clouds: "Clouds",
55 crimson_editor: "Crimson Editor",
56 dawn: "Dawn",
57 dreamweaver: "Dreamweaver",
58 eclipse: "Eclipse",
59 github: "GitHub",
60 solarized_light: "Solarized Light",
61 textmate: "TextMate",
62 tomorrow: "Tomorrow",
63 xcode: "XCode"
64 },
65 "Dark": {
66 ambiance: "Ambiance",
67 chaos: "Chaos",
68 clouds_midnight: "Clouds Midnight",
69 cobalt: "Cobalt",
70 idle_fingers: "idleFingers",
71 kr_theme: "krTheme",
72 merbivore: "Merbivore",
73 merbivore_soft: "Merbivore Soft",
74 mono_industrial: "Mono Industrial",
75 monokai: "Monokai",
76 pastel_on_dark: "Pastel on dark",
77 solarized_dark: "Solarized Dark",
78 twilight: "Twilight",
79 tomorrow_night: "Tomorrow Night",
80 tomorrow_night_blue: "Tomorrow Night Blue",
81 tomorrow_night_bright: "Tomorrow Night Bright",
82 tomorrow_night_eighties: "Tomorrow Night 80s",
83 vibrant_ink: "Vibrant Ink",
84 }
85 }],
86 ["Code Folding", function(value) {
87 env.editor.getSession().setFoldStyle(value);
88 env.editor.setShowFoldWidgets(value !== "manual");
89 }, ["manual", "mark begin", "mark begin and end"]],
90 ["Soft Wrap", function(value) {
91 value = value.toLowerCase()
92 var session = env.editor.getSession();
93 var renderer = env.editor.renderer;
94 session.setUseWrapMode(value == "off");
95 var col = parseInt(value) || null;
96 renderer.setPrintMarginColumn(col || 80);
97 session.setWrapLimitRange(col, col);
98 }, ["Off", "40 Chars", "80 Chars", "Free"]],
99 ["Key Binding", function(value) {
100 env.editor.setKeyboardHandler(keybindings[value]);
101 }, ["Ace", "Vim", "Emacs", "Custom"]],
102 ["Font Size", function(value) {
103 env.split.setFontSize(value + "px");
104 }, [10, 11, 12, 14, 16, 20, 24]],
105 ["Full Line Selection", function(checked) {
106 env.editor.setSelectionStyle(checked ? "line" : "text");
107 }],
108 ["Highlight Active Line", function(checked) {
109 env.editor.setHighlightActiveLine(checked);
110 }],
111 ["Show Invisibles", function(checked) {
112 env.editor.setShowInvisibles(checked);
113 }],
114 ["Show Gutter", function(checked) {
115 env.editor.renderer.setShowGutter(checked);
116 }],
117 ["Show Indent Guides", function(checked) {
118 env.editor.renderer.setDisplayIndentGuides(checked);
119 }],
120 ["Show Print Margin", function(checked) {
121 env.editor.renderer.setShowPrintMargin(checked);
122 }],
123 ["Persistent HScroll", function(checked) {
124 env.editor.renderer.setHScrollBarAlwaysVisible(checked);
125 }],
126 ["Animate Scrolling", function(checked) {
127 env.editor.setAnimatedScroll(checked);
128 }],
129 ["Use Soft Tab", function(checked) {
130 env.editor.getSession().setUseSoftTabs(checked);
131 }],
132 ["Highlight Selected Word", function(checked) {
133 env.editor.setHighlightSelectedWord(checked);
134 }],
135 ["Enable Behaviours", function(checked) {
136 env.editor.setBehavioursEnabled(checked);
137 }],
138 ["Fade Fold Widgets", function(checked) {
139 env.editor.setFadeFoldWidgets(checked);
140 }],
141 ["Show Token info", function(checked) {
142 env.editor.setFadeFoldWidgets(checked);
143 }]
144 ]
145
146 var createOptionsPanel = function(options) {
147 var html = []
148 var container = document.createElement("div");
149 container.style.cssText = "position: absolute; overflow: hidden";
150 var inner = document.createElement("div");
151 inner.style.cssText = "width: 120%;height:100%;overflow: scroll";
152 container.appendChild(inner);
153 html.push("<table><tbody>");
154
155 options.forEach(function(o) {
156
157 });
158
159 html.push(
160 '<tr>',
161 '<td>',
162 '<label for="', s,'"></label>',
163 '</td><td>',
164 '<input type="', s,'" name="', s,'" id="',s ,'">',
165 '</td>',
166 '</tr>'
167 )
168 html.push("</tbody></table>");
169 return container;
170 }
171
172 function bindCheckbox(id, callback) {
173 var el = document.getElementById(id);
174 if (localStorage && localStorage.getItem(id))
175 el.checked = localStorage.getItem(id) == "1";
176
177 var onCheck = function() {
178 callback(!!el.checked);
179 saveOption(el);
180 };
181 el.onclick = onCheck;
182 onCheck();
183 }
184
185 function bindDropdown(id, callback) {
186 var el = document.getElementById(id);
187 if (localStorage && localStorage.getItem(id))
188 el.value = localStorage.getItem(id);
189
190 var onChange = function() {
191 callback(el.value);
192 saveOption(el);
193 };
194
195 el.onchange = onChange;
196 onChange();
197 }
198
199 function fillOptgroup(list, el) {
200 list.forEach(function(item) {
201 var option = document.createElement("option");
202 option.setAttribute("value", item.name);
203 option.innerHTML = item.desc;
204 el.appendChild(option);
205 });
206 }
207
208 function fillDropdown(list, el) {
209 if (Array.isArray(list)) {
210 fillOptgroup(list, el);
211 return;
212 }
213 for(var i in list) {
214 var group = document.createElement("optgroup");
215 group.setAttribute("label", i);
216 fillOptgroup(list[i], group);
217 el.appendChild(group);
218 }
219 }
220
221 function createOptionControl(opt) {
222 if (opt.values) {
223 var el = dom.createElement("select");
224 el.setAttribute("size", opt.visibleSize || 1);
225 fillDropdown(opt.values, el)
226 } else {
227 var el = dom.createElement("checkbox");
228 }
229 el.setAttribute("name", "opt_" + opt.name)
230 return el;
231 }
232
233 function createOptionCell(opt) {
234 if (opt.values) {
235 var el = dom.createElement("select");
236 el.setAttribute("size", opt.visibleSize || 1);
237 fillDropdown(opt.values, el)
238 } else {
239 var el = dom.createElement("checkbox");
240 }
241 el.setAttribute("name", "opt_" + opt.name)
242 return el;
243 }
244
245
246 createOptionsPanel(options)
247
248
249
250 });
251
+0
-625
try/ace/ext-settings_menu.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
4 * All rights reserved.
5 *
6 * Contributed to Ajax.org under the BSD license.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of Ajax.org B.V. nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * ***** END LICENSE BLOCK ***** */
31
32 define('ace/ext/settings_menu', ['require', 'exports', 'module' , 'ace/ext/menu_tools/generate_settings_menu', 'ace/ext/menu_tools/overlay_page', 'ace/editor'], function(require, exports, module) {
33
34 var generateSettingsMenu = require('./menu_tools/generate_settings_menu').generateSettingsMenu;
35 var overlayPage = require('./menu_tools/overlay_page').overlayPage;
36 function showSettingsMenu(editor) {
37 var sm = document.getElementById('ace_settingsmenu');
38 if (!sm)
39 overlayPage(editor, generateSettingsMenu(editor), '0', '0', '0');
40 }
41 module.exports.init = function(editor) {
42 var Editor = require("ace/editor").Editor;
43 Editor.prototype.showSettingsMenu = function() {
44 showSettingsMenu(this);
45 };
46 };
47 });
48
49 define('ace/ext/menu_tools/generate_settings_menu', ['require', 'exports', 'module' , 'ace/ext/menu_tools/element_generator', 'ace/ext/menu_tools/add_editor_menu_options', 'ace/ext/menu_tools/get_set_functions'], function(require, exports, module) {
50
51 var egen = require('./element_generator');
52 var addEditorMenuOptions = require('./add_editor_menu_options').addEditorMenuOptions;
53 var getSetFunctions = require('./get_set_functions').getSetFunctions;
54 module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
55 var elements = [];
56 function cleanupElementsList() {
57 elements.sort(function(a, b) {
58 var x = a.getAttribute('contains');
59 var y = b.getAttribute('contains');
60 return x.localeCompare(y);
61 });
62 }
63 function wrapElements() {
64 var topmenu = document.createElement('div');
65 topmenu.setAttribute('id', 'ace_settingsmenu');
66 elements.forEach(function(element) {
67 topmenu.appendChild(element);
68 });
69 return topmenu;
70 }
71 function createNewEntry(obj, clss, item, val) {
72 var el;
73 var div = document.createElement('div');
74 div.setAttribute('contains', item);
75 div.setAttribute('class', 'ace_optionsMenuEntry');
76 div.setAttribute('style', 'clear: both;');
77
78 div.appendChild(egen.createLabel(
79 item.replace(/^set/, '').replace(/([A-Z])/g, ' $1').trim(),
80 item
81 ));
82
83 if (Array.isArray(val)) {
84 el = egen.createSelection(item, val, clss);
85 el.addEventListener('change', function(e) {
86 try{
87 editor.menuOptions[e.target.id].forEach(function(x) {
88 if(x.textContent !== e.target.textContent) {
89 delete x.selected;
90 }
91 });
92 obj[e.target.id](e.target.value);
93 } catch (err) {
94 throw new Error(err);
95 }
96 });
97 } else if(typeof val === 'boolean') {
98 el = egen.createCheckbox(item, val, clss);
99 el.addEventListener('change', function(e) {
100 try{
101 obj[e.target.id](!!e.target.checked);
102 } catch (err) {
103 throw new Error(err);
104 }
105 });
106 } else {
107 el = egen.createInput(item, val, clss);
108 el.addEventListener('change', function(e) {
109 try{
110 if(e.target.value === 'true') {
111 obj[e.target.id](true);
112 } else if(e.target.value === 'false') {
113 obj[e.target.id](false);
114 } else {
115 obj[e.target.id](e.target.value);
116 }
117 } catch (err) {
118 throw new Error(err);
119 }
120 });
121 }
122 el.style.cssText = 'float:right;';
123 div.appendChild(el);
124 return div;
125 }
126 function makeDropdown(item, esr, clss, fn) {
127 var val = editor.menuOptions[item];
128 var currentVal = esr[fn]();
129 if (typeof currentVal == 'object')
130 currentVal = currentVal.$id;
131 val.forEach(function(valuex) {
132 if (valuex.value === currentVal)
133 valuex.selected = 'selected';
134 });
135 return createNewEntry(esr, clss, item, val);
136 }
137 function handleSet(setObj) {
138 var item = setObj.functionName;
139 var esr = setObj.parentObj;
140 var clss = setObj.parentName;
141 var val;
142 var fn = item.replace(/^set/, 'get');
143 if(editor.menuOptions[item] !== undefined) {
144 elements.push(makeDropdown(item, esr, clss, fn));
145 } else if(typeof esr[fn] === 'function') {
146 try {
147 val = esr[fn]();
148 if(typeof val === 'object') {
149 val = val.$id;
150 }
151 elements.push(
152 createNewEntry(esr, clss, item, val)
153 );
154 } catch (e) {
155 }
156 }
157 }
158 addEditorMenuOptions(editor);
159 getSetFunctions(editor).forEach(function(setObj) {
160 handleSet(setObj);
161 });
162 cleanupElementsList();
163 return wrapElements();
164 };
165
166 });
167
168 define('ace/ext/menu_tools/element_generator', ['require', 'exports', 'module' ], function(require, exports, module) {
169 module.exports.createOption = function createOption (obj) {
170 var attribute;
171 var el = document.createElement('option');
172 for(attribute in obj) {
173 if(obj.hasOwnProperty(attribute)) {
174 if(attribute === 'selected') {
175 el.setAttribute(attribute, obj[attribute]);
176 } else {
177 el[attribute] = obj[attribute];
178 }
179 }
180 }
181 return el;
182 };
183 module.exports.createCheckbox = function createCheckbox (id, checked, clss) {
184 var el = document.createElement('input');
185 el.setAttribute('type', 'checkbox');
186 el.setAttribute('id', id);
187 el.setAttribute('name', id);
188 el.setAttribute('value', checked);
189 el.setAttribute('class', clss);
190 if(checked) {
191 el.setAttribute('checked', 'checked');
192 }
193 return el;
194 };
195 module.exports.createInput = function createInput (id, value, clss) {
196 var el = document.createElement('input');
197 el.setAttribute('type', 'text');
198 el.setAttribute('id', id);
199 el.setAttribute('name', id);
200 el.setAttribute('value', value);
201 el.setAttribute('class', clss);
202 return el;
203 };
204 module.exports.createLabel = function createLabel (text, labelFor) {
205 var el = document.createElement('label');
206 el.setAttribute('for', labelFor);
207 el.textContent = text;
208 return el;
209 };
210 module.exports.createSelection = function createSelection (id, values, clss) {
211 var el = document.createElement('select');
212 el.setAttribute('id', id);
213 el.setAttribute('name', id);
214 el.setAttribute('class', clss);
215 values.forEach(function(item) {
216 el.appendChild(module.exports.createOption(item));
217 });
218 return el;
219 };
220
221 });
222
223 define('ace/ext/menu_tools/add_editor_menu_options', ['require', 'exports', 'module' , 'ace/ext/modelist', 'ace/ext/themelist'], function(require, exports, module) {
224 module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) {
225 var modelist = require('../modelist');
226 var themelist = require('../themelist');
227 editor.menuOptions = {
228 "setNewLineMode" : [{
229 "textContent" : "unix",
230 "value" : "unix"
231 }, {
232 "textContent" : "windows",
233 "value" : "windows"
234 }, {
235 "textContent" : "auto",
236 "value" : "auto"
237 }],
238 "setTheme" : [],
239 "setMode" : [],
240 "setKeyboardHandler": [{
241 "textContent" : "ace",
242 "value" : ""
243 }, {
244 "textContent" : "vim",
245 "value" : "ace/keyboard/vim"
246 }, {
247 "textContent" : "emacs",
248 "value" : "ace/keyboard/emacs"
249 }]
250 };
251
252 editor.menuOptions.setTheme = themelist.themes.map(function(theme) {
253 return {
254 'textContent' : theme.desc,
255 'value' : theme.theme
256 };
257 });
258
259 editor.menuOptions.setMode = modelist.modes.map(function(mode) {
260 return {
261 'textContent' : mode.name,
262 'value' : mode.mode
263 };
264 });
265 };
266
267
268 });define('ace/ext/modelist', ['require', 'exports', 'module' ], function(require, exports, module) {
269
270
271 var modes = [];
272 function getModeForPath(path) {
273 var mode = modesByName.text;
274 var fileName = path.split(/[\/\\]/).pop();
275 for (var i = 0; i < modes.length; i++) {
276 if (modes[i].supportsFile(fileName)) {
277 mode = modes[i];
278 break;
279 }
280 }
281 return mode;
282 }
283
284 var Mode = function(name, caption, extensions) {
285 this.name = name;
286 this.caption = caption;
287 this.mode = "ace/mode/" + name;
288 this.extensions = extensions;
289 if (/\^/.test(extensions)) {
290 var re = extensions.replace(/\|(\^)?/g, function(a, b){
291 return "$|" + (b ? "^" : "^.*\\.");
292 }) + "$";
293 } else {
294 var re = "^.*\\.(" + extensions + ")$";
295 }
296
297 this.extRe = new RegExp(re, "gi");
298 };
299
300 Mode.prototype.supportsFile = function(filename) {
301 return filename.match(this.extRe);
302 };
303 var supportedModes = {
304 ABAP: ["abap"],
305 ADA: ["ada|adb"],
306 ActionScript:["as"],
307 AsciiDoc: ["asciidoc"],
308 Assembly_x86:["asm"],
309 AutoHotKey: ["ahk"],
310 BatchFile: ["bat|cmd"],
311 C9Search: ["c9search_results"],
312 C_Cpp: ["c|cc|cpp|cxx|h|hh|hpp"],
313 Clojure: ["clj"],
314 Cobol: ["^CBL|COB"],
315 coffee: ["^Cakefile|coffee|cf|cson"],
316 ColdFusion: ["cfm"],
317 CSharp: ["cs"],
318 CSS: ["css"],
319 Curly: ["curly"],
320 D: ["d|di"],
321 Dart: ["dart"],
322 Diff: ["diff|patch"],
323 Dot: ["dot"],
324 Erlang: ["erl|hrl"],
325 EJS: ["ejs"],
326 Forth: ["frt|fs|ldr"],
327 FreeMarker: ["ftl"],
328 Glsl: ["glsl|frag|vert"],
329 golang: ["go"],
330 Groovy: ["groovy"],
331 HAML: ["haml"],
332 Haskell: ["hs"],
333 haXe: ["hx"],
334 HTML: ["htm|html|xhtml"],
335 HTML_Ruby: ["erb|rhtml|html.erb"],
336 Ini: ["Ini|conf"],
337 Jade: ["jade"],
338 Java: ["java"],
339 JavaScript: ["js"],
340 JSON: ["json"],
341 JSONiq: ["jq"],
342 JSP: ["jsp"],
343 JSX: ["jsx"],
344 Julia: ["jl"],
345 LaTeX: ["latex|tex|ltx|bib"],
346 LESS: ["less"],
347 Liquid: ["liquid"],
348 Lisp: ["lisp"],
349 LiveScript: ["ls"],
350 LogiQL: ["logic|lql"],
351 LSL: ["lsl"],
352 Lua: ["lua"],
353 LuaPage: ["lp"],
354 Lucene: ["lucene"],
355 Makefile: ["^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"],
356 MATLAB: ["matlab"],
357 Markdown: ["md|markdown"],
358 MySQL: ["mysql"],
359 MUSHCode: ["mc|mush"],
360 ObjectiveC: ["m|mm"],
361 OCaml: ["ml|mli"],
362 Pascal: ["pas|p"],
363 Perl: ["pl|pm"],
364 pgSQL: ["pgsql"],
365 PHP: ["php|phtml"],
366 Powershell: ["ps1"],
367 Prolog: ["plg|prolog"],
368 Properties: ["properties"],
369 Python: ["py"],
370 R: ["r"],
371 RDoc: ["Rd"],
372 RHTML: ["Rhtml"],
373 Ruby: ["ru|gemspec|rake|rb"],
374 Rust: ["rs"],
375 SASS: ["sass"],
376 SCAD: ["scad"],
377 Scala: ["scala"],
378 Scheme: ["scm|rkt"],
379 SCSS: ["scss"],
380 SH: ["sh|bash"],
381 snippets: ["snippets"],
382 SQL: ["sql"],
383 Stylus: ["styl|stylus"],
384 SVG: ["svg"],
385 Tcl: ["tcl"],
386 Tex: ["tex"],
387 Text: ["txt"],
388 Textile: ["textile"],
389 Toml: ["toml"],
390 Twig: ["twig"],
391 Typescript: ["typescript|ts|str"],
392 VBScript: ["vbs"],
393 Velocity: ["vm"],
394 XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
395 XQuery: ["xq"],
396 YAML: ["yaml"]
397 };
398
399 var nameOverrides = {
400 ObjectiveC: "Objective-C",
401 CSharp: "C#",
402 golang: "Go",
403 C_Cpp: "C/C++",
404 coffee: "CoffeeScript",
405 HTML_Ruby: "HTML (Ruby)"
406 };
407 var modesByName = {};
408 for (var name in supportedModes) {
409 var data = supportedModes[name];
410 var displayName = nameOverrides[name] || name;
411 var filename = name.toLowerCase();
412 var mode = new Mode(filename, displayName, data[0]);
413 modesByName[filename] = mode;
414 modes.push(mode);
415 }
416
417 module.exports = {
418 getModeForPath: getModeForPath,
419 modes: modes,
420 modesByName: modesByName
421 };
422
423 });
424
425 define('ace/ext/themelist', ['require', 'exports', 'module' , 'ace/ext/themelist_utils/themes'], function(require, exports, module) {
426 module.exports.themes = require('ace/ext/themelist_utils/themes').themes;
427 module.exports.ThemeDescription = function(name) {
428 this.name = name;
429 this.desc = name.split('_'
430 ).map(
431 function(namePart) {
432 return namePart[0].toUpperCase() + namePart.slice(1);
433 }
434 ).join(' ');
435 this.theme = "ace/theme/" + name;
436 };
437
438 module.exports.themesByName = {};
439
440 module.exports.themes = module.exports.themes.map(function(name) {
441 module.exports.themesByName[name] = new module.exports.ThemeDescription(name);
442 return module.exports.themesByName[name];
443 });
444
445 });
446
447 define('ace/ext/themelist_utils/themes', ['require', 'exports', 'module' ], function(require, exports, module) {
448
449 module.exports.themes = [
450 "ambiance",
451 "chaos",
452 "chrome",
453 "clouds",
454 "clouds_midnight",
455 "cobalt",
456 "crimson_editor",
457 "dawn",
458 "dreamweaver",
459 "eclipse",
460 "github",
461 "idle_fingers",
462 "kr_theme",
463 "merbivore",
464 "merbivore_soft",
465 "monokai",
466 "mono_industrial",
467 "pastel_on_dark",
468 "solarized_dark",
469 "solarized_light",
470 "terminal",
471 "textmate",
472 "tomorrow",
473 "tomorrow_night",
474 "tomorrow_night_blue",
475 "tomorrow_night_bright",
476 "tomorrow_night_eighties",
477 "twilight",
478 "vibrant_ink",
479 "xcode"
480 ];
481
482 });
483
484 define('ace/ext/menu_tools/get_set_functions', ['require', 'exports', 'module' ], function(require, exports, module) {
485 module.exports.getSetFunctions = function getSetFunctions (editor) {
486 var out = [];
487 var my = {
488 'editor' : editor,
489 'session' : editor.session,
490 'renderer' : editor.renderer
491 };
492 var opts = [];
493 var skip = [
494 'setOption',
495 'setUndoManager',
496 'setDocument',
497 'setValue',
498 'setBreakpoints',
499 'setScrollTop',
500 'setScrollLeft',
501 'setSelectionStyle',
502 'setWrapLimitRange'
503 ];
504 ['renderer', 'session', 'editor'].forEach(function(esra) {
505 var esr = my[esra];
506 var clss = esra;
507 for(var fn in esr) {
508 if(skip.indexOf(fn) === -1) {
509 if(/^set/.test(fn) && opts.indexOf(fn) === -1) {
510 opts.push(fn);
511 out.push({
512 'functionName' : fn,
513 'parentObj' : esr,
514 'parentName' : clss
515 });
516 }
517 }
518 }
519 });
520 return out;
521 };
522
523 });
524
525 define('ace/ext/menu_tools/overlay_page', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
526
527 var dom = require("../../lib/dom");
528 var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
529 background-color: #F7F7F7;\
530 color: black;\
531 box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
532 padding: 1em 0.5em 2em 1em;\
533 overflow: auto;\
534 position: absolute;\
535 margin: 0;\
536 bottom: 0;\
537 right: 0;\
538 top: 0;\
539 z-index: 9991;\
540 cursor: default;\
541 }\
542 .ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
543 box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
544 background-color: rgba(255, 255, 255, 0.6);\
545 color: black;\
546 }\
547 .ace_optionsMenuEntry:hover {\
548 background-color: rgba(100, 100, 100, 0.1);\
549 -webkit-transition: all 0.5s;\
550 transition: all 0.3s\
551 }\
552 .ace_closeButton {\
553 background: rgba(245, 146, 146, 0.5);\
554 border: 1px solid #F48A8A;\
555 border-radius: 50%;\
556 padding: 7px;\
557 position: absolute;\
558 right: -8px;\
559 top: -8px;\
560 z-index: 1000;\
561 }\
562 .ace_closeButton{\
563 background: rgba(245, 146, 146, 0.9);\
564 }\
565 .ace_optionsMenuKey {\
566 color: darkslateblue;\
567 font-weight: bold;\
568 }\
569 .ace_optionsMenuCommand {\
570 color: darkcyan;\
571 font-weight: normal;\
572 }";
573 dom.importCssString(cssText);
574 module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
575 top = top ? 'top: ' + top + ';' : '';
576 bottom = bottom ? 'bottom: ' + bottom + ';' : '';
577 right = right ? 'right: ' + right + ';' : '';
578 left = left ? 'left: ' + left + ';' : '';
579
580 var closer = document.createElement('div');
581 var contentContainer = document.createElement('div');
582
583 function documentEscListener(e) {
584 if (e.keyCode === 27) {
585 closer.click();
586 }
587 }
588
589 closer.style.cssText = 'margin: 0; padding: 0; ' +
590 'position: fixed; top:0; bottom:0; left:0; right:0;' +
591 'z-index: 9990; ' +
592 'background-color: rgba(0, 0, 0, 0.3);';
593 closer.addEventListener('click', function() {
594 document.removeEventListener('keydown', documentEscListener);
595 closer.parentNode.removeChild(closer);
596 editor.focus();
597 closer = null;
598 });
599 document.addEventListener('keydown', documentEscListener);
600
601 contentContainer.style.cssText = top + right + bottom + left;
602 contentContainer.addEventListener('click', function(e) {
603 e.stopPropagation();
604 });
605
606 var wrapper = dom.createElement("div");
607 wrapper.style.position = "relative";
608
609 var closeButton = dom.createElement("div");
610 closeButton.className = "ace_closeButton";
611 closeButton.addEventListener('click', function() {
612 closer.click();
613 });
614
615 wrapper.appendChild(closeButton);
616 contentContainer.appendChild(wrapper);
617
618 contentContainer.appendChild(contentElement);
619 closer.appendChild(contentContainer);
620 document.body.appendChild(closer);
621 editor.blur();
622 };
623
624 });
+0
-67
try/ace/ext-spellcheck.js less more
0 define('ace/ext/spellcheck', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/editor', 'ace/config'], function(require, exports, module) {
1
2 var event = require("../lib/event");
3
4 exports.contextMenuHandler = function(e){
5 var host = e.target;
6 var text = host.textInput.getElement();
7 if (!host.selection.isEmpty())
8 return;
9 var c = host.getCursorPosition();
10 var r = host.session.getWordRange(c.row, c.column);
11 var w = host.session.getTextRange(r);
12
13 host.session.tokenRe.lastIndex = 0;
14 if (!host.session.tokenRe.test(w))
15 return;
16 var PLACEHOLDER = "\x01\x01";
17 var value = w + " " + PLACEHOLDER;
18 text.value = value;
19 text.setSelectionRange(w.length + 1, w.length + 1);
20 text.setSelectionRange(0, 0);
21
22 var afterKeydown = false;
23 event.addListener(text, "keydown", function onKeydown() {
24 event.removeListener(text, "keydown", onKeydown);
25 afterKeydown = true;
26 });
27
28 host.textInput.setInputHandler(function(newVal) {
29 console.log(newVal , value, text.selectionStart, text.selectionEnd)
30 if (newVal == value)
31 return '';
32 if (newVal.lastIndexOf(value, 0) === 0)
33 return newVal.slice(value.length);
34 if (newVal.substr(text.selectionEnd) == value)
35 return newVal.slice(0, -value.length);
36 if (newVal.slice(-2) == PLACEHOLDER) {
37 var val = newVal.slice(0, -2);
38 if (val.slice(-1) == " ") {
39 if (afterKeydown)
40 return val.substring(0, text.selectionEnd);
41 val = val.slice(0, -1);
42 host.session.replace(r, val);
43 return "";
44 }
45 }
46
47 return newVal;
48 });
49 };
50 var Editor = require("../editor").Editor;
51 require("../config").defineOptions(Editor.prototype, "editor", {
52 spellcheck: {
53 set: function(val) {
54 var text = this.textInput.getElement();
55 text.spellcheck = !!val;
56 if (!val)
57 this.removeListener("nativecontextmenu", exports.contextMenuHandler);
58 else
59 this.on("nativecontextmenu", exports.contextMenuHandler);
60 },
61 value: true
62 }
63 });
64
65 });
66
+0
-121
try/ace/ext-static_highlight.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/ext/static_highlight', ['require', 'exports', 'module' , 'ace/edit_session', 'ace/layer/text', 'ace/config'], function(require, exports, module) {
31
32
33 var EditSession = require("../edit_session").EditSession;
34 var TextLayer = require("../layer/text").Text;
35 var baseStyles = ".ace_editor {\
36 font-family: 'Monaco', 'Menlo', 'Droid Sans Mono', 'Courier New', monospace;\
37 font-size: 12px;\
38 }\
39 .ace_editor .ace_gutter {\
40 width: 25px !important;\
41 display: block;\
42 float: left;\
43 text-align: right;\
44 padding: 0 3px 0 0;\
45 margin-right: 3px;\
46 }\
47 .ace_line { clear: both; }\
48 *.ace_gutter-cell {\
49 -moz-user-select: -moz-none;\
50 -khtml-user-select: none;\
51 -webkit-user-select: none;\
52 user-select: none;\
53 }";
54 var config = require("../config");
55
56 exports.render = function(input, mode, theme, lineStart, disableGutter, callback) {
57 var waiting = 0
58 if (typeof theme == "string") {
59 waiting++;
60 config.loadModule(['theme', theme], function(m) {
61 theme = m;
62 --waiting || done();
63 });
64 }
65
66 if (typeof mode == "string") {
67 waiting++;
68 config.loadModule(['mode', mode], function(m) {
69 mode = new m.Mode()
70 --waiting || done();
71 });
72 }
73 function done() {
74 var result = exports.renderSync(input, mode, theme, lineStart, disableGutter);
75 return callback ? callback(result) : result;
76 }
77 return waiting || done();
78 };
79
80 exports.renderSync = function(input, mode, theme, lineStart, disableGutter) {
81 lineStart = parseInt(lineStart || 1, 10);
82
83 var session = new EditSession("");
84 session.setUseWorker(false);
85 session.setMode(mode);
86
87 var textLayer = new TextLayer(document.createElement("div"));
88 textLayer.setSession(session);
89 textLayer.config = {
90 characterWidth: 10,
91 lineHeight: 20
92 };
93
94 session.setValue(input);
95
96 var stringBuilder = [];
97 var length = session.getLength();
98
99 for(var ix = 0; ix < length; ix++) {
100 stringBuilder.push("<div class='ace_line'>");
101 if (!disableGutter)
102 stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
103 textLayer.$renderLine(stringBuilder, ix, true, false);
104 stringBuilder.push("</div>");
105 }
106 var html = "<div class=':cssClass'>\
107 <div class='ace_editor ace_scroller ace_text-layer'>\
108 :code\
109 </div>\
110 </div>".replace(/:cssClass/, theme.cssClass).replace(/:code/, stringBuilder.join(""));
111
112 textLayer.destroy();
113
114 return {
115 css: baseStyles + theme.cssText,
116 html: html
117 };
118 };
119
120 });
+0
-47
try/ace/ext-statusbar.js less more
0 define('ace/ext/statusbar', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/lang'], function(require, exports, module) {
1 var dom = require("ace/lib/dom");
2 var lang = require("ace/lib/lang");
3
4 var StatusBar = function(editor, parentNode) {
5 this.element = dom.createElement("div");
6 this.element.className = "ace_status-indicator";
7 this.element.style.cssText = "display: inline-block;";
8 parentNode.appendChild(this.element);
9
10 var statusUpdate = lang.delayedCall(function(){
11 this.updateStatus(editor)
12 }.bind(this));
13 editor.on("changeStatus", function() {
14 statusUpdate.schedule(100);
15 });
16 editor.on("changeSelection", function() {
17 statusUpdate.schedule(100);
18 });
19 };
20
21 (function(){
22 this.updateStatus = function(editor) {
23 var status = [];
24 function add(str, separator) {
25 str && status.push(str, separator || "|");
26 }
27
28 if (editor.$vimModeHandler)
29 add(editor.$vimModeHandler.getStatusText());
30 else if (editor.commands.recording)
31 add("REC");
32
33 var c = editor.selection.lead;
34 add(c.row + ":" + c.column, " ");
35 if (!editor.selection.isEmpty()) {
36 var r = editor.getSelectionRange();
37 add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")");
38 }
39 status.pop();
40 this.element.textContent = status.join("");
41 };
42 }).call(StatusBar.prototype);
43
44 exports.StatusBar = StatusBar;
45
46 });
+0
-492
try/ace/ext-textarea.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/ext/textarea', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/useragent', 'ace/lib/net', 'ace/ace', 'ace/theme/textmate', 'ace/mode/text'], function(require, exports, module) {
31
32
33 var event = require("../lib/event");
34 var UA = require("../lib/useragent");
35 var net = require("../lib/net");
36 var ace = require("../ace");
37
38 require("../theme/textmate");
39
40 module.exports = exports = ace;
41 var getCSSProperty = function(element, container, property) {
42 var ret = element.style[property];
43
44 if (!ret) {
45 if (window.getComputedStyle) {
46 ret = window.getComputedStyle(element, '').getPropertyValue(property);
47 } else {
48 ret = element.currentStyle[property];
49 }
50 }
51
52 if (!ret || ret == 'auto' || ret == 'intrinsic') {
53 ret = container.style[property];
54 }
55 return ret;
56 };
57
58 function applyStyles(elm, styles) {
59 for (var style in styles) {
60 elm.style[style] = styles[style];
61 }
62 }
63
64 function setupContainer(element, getValue) {
65 if (element.type != 'textarea') {
66 throw "Textarea required!";
67 }
68
69 var parentNode = element.parentNode;
70 var container = document.createElement('div');
71 var resizeEvent = function() {
72 var style = 'position:relative;';
73 [
74 'margin-top', 'margin-left', 'margin-right', 'margin-bottom'
75 ].forEach(function(item) {
76 style += item + ':' +
77 getCSSProperty(element, container, item) + ';';
78 });
79 var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px");
80 var height = getCSSProperty(element, container, 'height') || (element.clientHeight + "px");
81 style += 'height:' + height + ';width:' + width + ';';
82 style += 'display:inline-block;';
83 container.setAttribute('style', style);
84 };
85 event.addListener(window, 'resize', resizeEvent);
86 resizeEvent();
87 parentNode.insertBefore(container, element.nextSibling);
88 while (parentNode !== document) {
89 if (parentNode.tagName.toUpperCase() === 'FORM') {
90 var oldSumit = parentNode.onsubmit;
91 parentNode.onsubmit = function(evt) {
92 element.value = getValue();
93 if (oldSumit) {
94 oldSumit.call(this, evt);
95 }
96 };
97 break;
98 }
99 parentNode = parentNode.parentNode;
100 }
101 return container;
102 }
103
104 exports.transformTextarea = function(element, loader) {
105 var session;
106 var container = setupContainer(element, function() {
107 return session.getValue();
108 });
109 element.style.display = 'none';
110 container.style.background = 'white';
111 var editorDiv = document.createElement("div");
112 applyStyles(editorDiv, {
113 top: "0px",
114 left: "0px",
115 right: "0px",
116 bottom: "0px",
117 border: "1px solid gray",
118 position: "absolute"
119 });
120 container.appendChild(editorDiv);
121
122 var settingOpener = document.createElement("div");
123 applyStyles(settingOpener, {
124 position: "absolute",
125 right: "0px",
126 bottom: "0px",
127 background: "red",
128 cursor: "nw-resize",
129 borderStyle: "solid",
130 borderWidth: "9px 8px 10px 9px",
131 width: "2px",
132 borderColor: "lightblue gray gray lightblue",
133 zIndex: 101
134 });
135
136 var settingDiv = document.createElement("div");
137 var settingDivStyles = {
138 top: "0px",
139 left: "20%",
140 right: "0px",
141 bottom: "0px",
142 position: "absolute",
143 padding: "5px",
144 zIndex: 100,
145 color: "white",
146 display: "none",
147 overflow: "auto",
148 fontSize: "14px",
149 boxShadow: "-5px 2px 3px gray"
150 };
151 if (!UA.isOldIE) {
152 settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
153 } else {
154 settingDivStyles.backgroundColor = "#333";
155 }
156
157 applyStyles(settingDiv, settingDivStyles);
158 container.appendChild(settingDiv);
159 var options = {};
160
161 var editor = ace.edit(editorDiv);
162 session = editor.getSession();
163
164 session.setValue(element.value || element.innerHTML);
165 editor.focus();
166 container.appendChild(settingOpener);
167 setupApi(editor, editorDiv, settingDiv, ace, options, loader);
168 setupSettingPanel(settingDiv, settingOpener, editor, options);
169
170 var state = "";
171 event.addListener(settingOpener, "mousemove", function(e) {
172 var rect = this.getBoundingClientRect();
173 var x = e.clientX - rect.left, y = e.clientY - rect.top;
174 if (x + y < (rect.width + rect.height)/2) {
175 this.style.cursor = "pointer";
176 state = "toggle";
177 } else {
178 state = "resize";
179 this.style.cursor = "nw-resize";
180 }
181 });
182
183 event.addListener(settingOpener, "mousedown", function(e) {
184 if (state == "toggle") {
185 editor.setDisplaySettings();
186 return;
187 }
188 container.style.zIndex = 100000;
189 var rect = container.getBoundingClientRect();
190 var startX = rect.width + rect.left - e.clientX;
191 var startY = rect.height + rect.top - e.clientY;
192 event.capture(settingOpener, function(e) {
193 container.style.width = e.clientX - rect.left + startX + "px";
194 container.style.height = e.clientY - rect.top + startY + "px";
195 editor.resize();
196 }, function() {});
197 });
198
199 return editor;
200 };
201
202 function load(url, module, callback) {
203 net.loadScript(url, function() {
204 require([module], callback);
205 });
206 }
207
208 function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
209 var session = editor.getSession();
210 var renderer = editor.renderer;
211 loader = loader || load;
212
213 function toBool(value) {
214 return value === "true" || value == true;
215 }
216
217 editor.setDisplaySettings = function(display) {
218 if (display == null)
219 display = settingDiv.style.display == "none";
220 if (display) {
221 settingDiv.style.display = "block";
222 settingDiv.hideButton.focus();
223 editor.on("focus", function onFocus() {
224 editor.removeListener("focus", onFocus);
225 settingDiv.style.display = "none"
226 });
227 } else {
228 editor.focus();
229 };
230 };
231
232 editor.setOption = function(key, value) {
233 if (options[key] == value) return;
234
235 switch (key) {
236 case "gutter":
237 renderer.setShowGutter(toBool(value));
238 break;
239
240 case "mode":
241 if (value != "text") {
242 loader("mode-" + value + ".js", "ace/mode/" + value, function() {
243 var aceMode = require("../mode/" + value).Mode;
244 session.setMode(new aceMode());
245 });
246 } else {
247 session.setMode(new (require("../mode/text").Mode));
248 }
249 break;
250
251 case "theme":
252 if (value != "textmate") {
253 loader("theme-" + value + ".js", "ace/theme/" + value, function() {
254 editor.setTheme("ace/theme/" + value);
255 });
256 } else {
257 editor.setTheme("ace/theme/textmate");
258 }
259 break;
260
261 case "fontSize":
262 editorDiv.style.fontSize = value;
263 break;
264
265 case "keybindings":
266 switch (value) {
267 case "vim":
268 editor.setKeyboardHandler("ace/keyboard/vim");
269 break;
270 case "emacs":
271 editor.setKeyboardHandler("ace/keyboard/emacs");
272 break;
273 default:
274 editor.setKeyboardHandler(null);
275 }
276 break;
277
278 case "softWrap":
279 switch (value) {
280 case "off":
281 session.setUseWrapMode(false);
282 renderer.setPrintMarginColumn(80);
283 break;
284 case "40":
285 session.setUseWrapMode(true);
286 session.setWrapLimitRange(40, 40);
287 renderer.setPrintMarginColumn(40);
288 break;
289 case "80":
290 session.setUseWrapMode(true);
291 session.setWrapLimitRange(80, 80);
292 renderer.setPrintMarginColumn(80);
293 break;
294 case "free":
295 session.setUseWrapMode(true);
296 session.setWrapLimitRange(null, null);
297 renderer.setPrintMarginColumn(80);
298 break;
299 }
300 break;
301
302 case "useSoftTabs":
303 session.setUseSoftTabs(toBool(value));
304 break;
305
306 case "showPrintMargin":
307 renderer.setShowPrintMargin(toBool(value));
308 break;
309
310 case "showInvisibles":
311 editor.setShowInvisibles(toBool(value));
312 break;
313 }
314
315 options[key] = value;
316 };
317
318 editor.getOption = function(key) {
319 return options[key];
320 };
321
322 editor.getOptions = function() {
323 return options;
324 };
325
326 for (var option in exports.options) {
327 editor.setOption(option, exports.options[option]);
328 }
329
330 return editor;
331 }
332
333 function setupSettingPanel(settingDiv, settingOpener, editor, options) {
334 var BOOL = null;
335
336 var desc = {
337 mode: "Mode:",
338 gutter: "Display Gutter:",
339 theme: "Theme:",
340 fontSize: "Font Size:",
341 softWrap: "Soft Wrap:",
342 keybindings: "Keyboard",
343 showPrintMargin: "Show Print Margin:",
344 useSoftTabs: "Use Soft Tabs:",
345 showInvisibles: "Show Invisibles"
346 };
347
348 var optionValues = {
349 mode: {
350 text: "Plain",
351 javascript: "JavaScript",
352 xml: "XML",
353 html: "HTML",
354 css: "CSS",
355 scss: "SCSS",
356 python: "Python",
357 php: "PHP",
358 java: "Java",
359 ruby: "Ruby",
360 c_cpp: "C/C++",
361 coffee: "CoffeeScript",
362 json: "json",
363 perl: "Perl",
364 clojure: "Clojure",
365 ocaml: "OCaml",
366 csharp: "C#",
367 haxe: "haXe",
368 svg: "SVG",
369 textile: "Textile",
370 groovy: "Groovy",
371 liquid: "Liquid",
372 Scala: "Scala"
373 },
374 theme: {
375 clouds: "Clouds",
376 clouds_midnight: "Clouds Midnight",
377 cobalt: "Cobalt",
378 crimson_editor: "Crimson Editor",
379 dawn: "Dawn",
380 eclipse: "Eclipse",
381 idle_fingers: "Idle Fingers",
382 kr_theme: "Kr Theme",
383 merbivore: "Merbivore",
384 merbivore_soft: "Merbivore Soft",
385 mono_industrial: "Mono Industrial",
386 monokai: "Monokai",
387 pastel_on_dark: "Pastel On Dark",
388 solarized_dark: "Solarized Dark",
389 solarized_light: "Solarized Light",
390 textmate: "Textmate",
391 twilight: "Twilight",
392 vibrant_ink: "Vibrant Ink"
393 },
394 gutter: BOOL,
395 fontSize: {
396 "10px": "10px",
397 "11px": "11px",
398 "12px": "12px",
399 "14px": "14px",
400 "16px": "16px"
401 },
402 softWrap: {
403 off: "Off",
404 40: "40",
405 80: "80",
406 free: "Free"
407 },
408 keybindings: {
409 ace: "ace",
410 vim: "vim",
411 emacs: "emacs"
412 },
413 showPrintMargin: BOOL,
414 useSoftTabs: BOOL,
415 showInvisibles: BOOL
416 };
417
418 var table = [];
419 table.push("<table><tr><th>Setting</th><th>Value</th></tr>");
420
421 function renderOption(builder, option, obj, cValue) {
422 if (!obj) {
423 builder.push(
424 "<input type='checkbox' title='", option, "' ",
425 cValue == "true" ? "checked='true'" : "",
426 "'></input>"
427 );
428 return
429 }
430 builder.push("<select title='" + option + "'>");
431 for (var value in obj) {
432 builder.push("<option value='" + value + "' ");
433
434 if (cValue == value) {
435 builder.push(" selected ");
436 }
437
438 builder.push(">",
439 obj[value],
440 "</option>");
441 }
442 builder.push("</select>");
443 }
444
445 for (var option in options) {
446 table.push("<tr><td>", desc[option], "</td>");
447 table.push("<td>");
448 renderOption(table, option, optionValues[option], options[option]);
449 table.push("</td></tr>");
450 }
451 table.push("</table>");
452 settingDiv.innerHTML = table.join("");
453
454 var onChange = function(e) {
455 var select = e.currentTarget;
456 editor.setOption(select.title, select.value);
457 };
458 var onClick = function(e) {
459 var cb = e.currentTarget;
460 editor.setOption(cb.title, cb.checked);
461 };
462 var selects = settingDiv.getElementsByTagName("select");
463 for (var i = 0; i < selects.length; i++)
464 selects[i].onchange = onChange;
465 var cbs = settingDiv.getElementsByTagName("input");
466 for (var i = 0; i < cbs.length; i++)
467 cbs[i].onclick = onClick;
468
469
470 var button = document.createElement("input");
471 button.type = "button";
472 button.value = "Hide";
473 event.addListener(button, "click", function() {
474 editor.setDisplaySettings(false);
475 });
476 settingDiv.appendChild(button);
477 settingDiv.hideButton = button;
478 }
479 exports.options = {
480 mode: "text",
481 theme: "textmate",
482 gutter: "false",
483 fontSize: "12px",
484 softWrap: "off",
485 keybindings: "ace",
486 showPrintMargin: "false",
487 useSoftTabs: "true",
488 showInvisibles: "false"
489 };
490
491 });
+0
-90
try/ace/ext-themelist.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
4 * All rights reserved.
5 *
6 * Contributed to Ajax.org under the BSD license.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of Ajax.org B.V. nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * ***** END LICENSE BLOCK ***** */
31
32 define('ace/ext/themelist', ['require', 'exports', 'module' , 'ace/ext/themelist_utils/themes'], function(require, exports, module) {
33 module.exports.themes = require('ace/ext/themelist_utils/themes').themes;
34 module.exports.ThemeDescription = function(name) {
35 this.name = name;
36 this.desc = name.split('_'
37 ).map(
38 function(namePart) {
39 return namePart[0].toUpperCase() + namePart.slice(1);
40 }
41 ).join(' ');
42 this.theme = "ace/theme/" + name;
43 };
44
45 module.exports.themesByName = {};
46
47 module.exports.themes = module.exports.themes.map(function(name) {
48 module.exports.themesByName[name] = new module.exports.ThemeDescription(name);
49 return module.exports.themesByName[name];
50 });
51
52 });
53
54 define('ace/ext/themelist_utils/themes', ['require', 'exports', 'module' ], function(require, exports, module) {
55
56 module.exports.themes = [
57 "ambiance",
58 "chaos",
59 "chrome",
60 "clouds",
61 "clouds_midnight",
62 "cobalt",
63 "crimson_editor",
64 "dawn",
65 "dreamweaver",
66 "eclipse",
67 "github",
68 "idle_fingers",
69 "kr_theme",
70 "merbivore",
71 "merbivore_soft",
72 "monokai",
73 "mono_industrial",
74 "pastel_on_dark",
75 "solarized_dark",
76 "solarized_light",
77 "terminal",
78 "textmate",
79 "tomorrow",
80 "tomorrow_night",
81 "tomorrow_night_blue",
82 "tomorrow_night_bright",
83 "tomorrow_night_eighties",
84 "twilight",
85 "vibrant_ink",
86 "xcode"
87 ];
88
89 });
+0
-204
try/ace/ext-whitespace.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/ext/whitespace', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
31
32
33 var lang = require("../lib/lang");
34 exports.$detectIndentation = function(lines, fallback) {
35 var stats = [];
36 var changes = [];
37 var tabIndents = 0;
38 var prevSpaces = 0;
39 var max = Math.min(lines.length, 1000);
40 for (var i = 0; i < max; i++) {
41 var line = lines[i];
42 if (!/^\s*[^*+\-\s]/.test(line))
43 continue;
44
45 var tabs = line.match(/^\t*/)[0].length;
46 if (line[0] == "\t")
47 tabIndents++;
48
49 var spaces = line.match(/^ */)[0].length;
50 if (spaces && line[spaces] != "\t") {
51 var diff = spaces - prevSpaces;
52 if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
53 changes[diff] = (changes[diff] || 0) + 1;
54
55 stats[spaces] = (stats[spaces] || 0) + 1;
56 }
57 prevSpaces = spaces;
58 while (line[line.length - 1] == "\\")
59 line = lines[i++];
60 };
61
62 function getScore(indent) {
63 var score = 0;
64 for (var i = indent; i < stats.length; i += indent)
65 score += stats[i] || 0;
66 return score;
67 }
68
69 var changesTotal = changes.reduce(function(a,b){return a+b}, 0);
70
71 var first = {score: 0, length: 0};
72 var spaceIndents = 0;
73 for (var i = 1; i < 12; i++) {
74 if (i == 1) {
75 spaceIndents = getScore(i);
76 var score = 1;
77 } else
78 var score = getScore(i) / spaceIndents;
79
80 if (changes[i]) {
81 score += changes[i] / changesTotal;
82 }
83
84 if (score > first.score)
85 first = {score: score, length: i};
86 }
87
88 if (first.score && first.score > 1.4)
89 var tabLength = first.length;
90
91 if (tabIndents > spaceIndents + 1)
92 return {ch: "\t", length: tabLength};
93
94 if (spaceIndents + 1 > tabIndents)
95 return {ch: " ", length: tabLength};
96 };
97
98 exports.detectIndentation = function(session) {
99 var lines = session.getLines(0, 1000);
100 var indent = exports.$detectIndentation(lines) || {};
101
102 if (indent.ch)
103 session.setUseSoftTabs(indent.ch == " ");
104
105 if (indent.length)
106 session.setTabSize(indent.length);
107 return indent;
108 };
109
110 exports.trimTrailingSpace = function(session) {
111 var doc = session.getDocument();
112 var lines = doc.getAllLines();
113
114 for (var i = 0, l=lines.length; i < l; i++) {
115 var line = lines[i];
116 var index = line.search(/\s+$/);
117
118 if (index !== -1)
119 doc.removeInLine(i, index, line.length);
120 }
121 };
122
123 exports.convertIndentation = function(session, ch, len) {
124 var oldCh = session.getTabString()[0];
125 var oldLen = session.getTabSize();
126 if (!len) len = oldLen;
127 if (!ch) ch = oldCh;
128
129 var tab = ch == "\t" ? ch: lang.stringRepeat(ch, len);
130
131 var doc = session.doc;
132 var lines = doc.getAllLines();
133
134 var cache = {};
135 var spaceCache = {};
136 for (var i = 0, l=lines.length; i < l; i++) {
137 var line = lines[i];
138 var match = line.match(/^\s*/)[0];
139 if (match) {
140 var w = session.$getStringScreenWidth(match)[0];
141 var tabCount = Math.floor(w/oldLen);
142 var reminder = w%oldLen;
143 var toInsert = cache[tabCount] || (cache[tabCount] = lang.stringRepeat(tab, tabCount));
144 toInsert += spaceCache[reminder] || (spaceCache[reminder] = lang.stringRepeat(" ", reminder));
145
146 if (toInsert != match) {
147 doc.removeInLine(i, 0, match.length);
148 doc.insertInLine({row: i, column: 0}, toInsert);
149 }
150 }
151 }
152 session.setTabSize(len);
153 session.setUseSoftTabs(ch == " ");
154 };
155
156 exports.$parseStringArg = function(text) {
157 var indent = {}
158 if (/t/.test(text))
159 indent.ch = "\t";
160 else if (/s/.test(text))
161 indent.ch = " ";
162 var m = text.match(/\d+/);
163 if (m)
164 indent.length = parseInt(m[0]);
165 return indent;
166 };
167
168 exports.$parseArg = function(arg) {
169 if (!arg)
170 return {};
171 if (typeof arg == "string")
172 return exports.$parseStringArg(arg);
173 if (typeof arg.text == "string")
174 return exports.$parseStringArg(arg.text);
175 return arg;
176 }
177
178 exports.commands = [{
179 name: "detectIndentation",
180 exec: function(editor) {
181 exports.detectIndentation(editor.session);
182 }
183 }, {
184 name: "trimTrailingSpace",
185 exec: function(editor) {
186 exports.trimTrailingSpace(editor.session);
187 }
188 }, {
189 name: "convertIndentation",
190 exec: function(editor, arg) {
191 var indent = exports.$parseArg(arg);
192 exports.convertIndentation(editor.session, arg.ch, arg.length);
193 }
194 }, {
195 name: "setIndentation",
196 exec: function(editor, arg) {
197 var indent = exports.$parseArg(arg);
198 indent.length && editor.session.setTabSize(indent.length);
199 indent.ch && editor.session.setUseSoftTabs(indent.ch == " ");
200 }
201 }]
202
203 });
+0
-1058
try/ace/keybinding-emacs.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/keyboard/emacs', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/incremental_search', 'ace/commands/incremental_search_commands', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) {
31
32
33 var dom = require("../lib/dom");
34 require("../incremental_search");
35 var iSearchCommandModule = require("../commands/incremental_search_commands");
36
37
38 var screenToTextBlockCoordinates = function(x, y) {
39 var canvasPos = this.scroller.getBoundingClientRect();
40
41 var col = Math.floor(
42 (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth
43 );
44 var row = Math.floor(
45 (y + this.scrollTop - canvasPos.top) / this.lineHeight
46 );
47
48 return this.session.screenToDocumentPosition(row, col);
49 };
50
51 var HashHandler = require("./hash_handler").HashHandler;
52 exports.handler = new HashHandler();
53
54 exports.handler.isEmacs = true;
55 exports.handler.$id = "ace/keyboard/emacs";
56
57 var initialized = false;
58 var $formerLongWords;
59 var $formerLineStart;
60
61 exports.handler.attach = function(editor) {
62 if (!initialized) {
63 initialized = true;
64 dom.importCssString('\
65 .emacs-mode .ace_cursor{\
66 border: 2px rgba(50,250,50,0.8) solid!important;\
67 -moz-box-sizing: border-box!important;\
68 -webkit-box-sizing: border-box!important;\
69 box-sizing: border-box!important;\
70 background-color: rgba(0,250,0,0.9);\
71 opacity: 0.5;\
72 }\
73 .emacs-mode .ace_cursor.ace_hidden{\
74 opacity: 1;\
75 background-color: transparent;\
76 }\
77 .emacs-mode .ace_overwrite-cursors .ace_cursor {\
78 opacity: 1;\
79 background-color: transparent;\
80 border-width: 0 0 2px 2px !important;\
81 }\
82 .emacs-mode .ace_text-layer {\
83 z-index: 4\
84 }\
85 .emacs-mode .ace_cursor-layer {\
86 z-index: 2\
87 }', 'emacsMode'
88 );
89 }
90 $formerLongWords = editor.session.$selectLongWords;
91 editor.session.$selectLongWords = true;
92 $formerLineStart = editor.session.$useEmacsStyleLineStart;
93 editor.session.$useEmacsStyleLineStart = true;
94
95 editor.session.$emacsMark = null; // the active mark
96 editor.session.$emacsMarkRing = editor.session.$emacsMarkRing || [];
97
98 editor.emacsMark = function() {
99 return this.session.$emacsMark;
100 }
101
102 editor.setEmacsMark = function(p) {
103 this.session.$emacsMark = p;
104 }
105
106 editor.pushEmacsMark = function(p, activate) {
107 var prevMark = this.session.$emacsMark;
108 if (prevMark)
109 this.session.$emacsMarkRing.push(prevMark);
110 if (!p || activate) this.setEmacsMark(p)
111 else this.session.$emacsMarkRing.push(p);
112 }
113
114 editor.popEmacsMark = function() {
115 var mark = this.emacsMark();
116 if (mark) { this.setEmacsMark(null); return mark; }
117 return this.session.$emacsMarkRing.pop();
118 }
119
120 editor.getLastEmacsMark = function(p) {
121 return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0];
122 }
123
124 editor.on("click", $resetMarkMode);
125 editor.on("changeSession", $kbSessionChange);
126 editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
127 editor.setStyle("emacs-mode");
128 editor.commands.addCommands(commands);
129 exports.handler.platform = editor.commands.platform;
130 editor.$emacsModeHandler = this;
131 editor.addEventListener('copy', this.onCopy);
132 editor.addEventListener('paste', this.onPaste);
133 };
134
135 exports.handler.detach = function(editor) {
136 delete editor.renderer.screenToTextCoordinates;
137 editor.session.$selectLongWords = $formerLongWords;
138 editor.session.$useEmacsStyleLineStart = $formerLineStart;
139 editor.removeEventListener("click", $resetMarkMode);
140 editor.removeEventListener("changeSession", $kbSessionChange);
141 editor.unsetStyle("emacs-mode");
142 editor.commands.removeCommands(commands);
143 editor.removeEventListener('copy', this.onCopy);
144 editor.removeEventListener('paste', this.onPaste);
145 };
146
147 var $kbSessionChange = function(e) {
148 if (e.oldSession) {
149 e.oldSession.$selectLongWords = $formerLongWords;
150 e.oldSession.$useEmacsStyleLineStart = $formerLineStart;
151 }
152
153 $formerLongWords = e.session.$selectLongWords;
154 e.session.$selectLongWords = true;
155 $formerLineStart = e.session.$useEmacsStyleLineStart;
156 e.session.$useEmacsStyleLineStart = true;
157
158 if (!e.session.hasOwnProperty('$emacsMark'))
159 e.session.$emacsMark = null;
160 if (!e.session.hasOwnProperty('$emacsMarkRing'))
161 e.session.$emacsMarkRing = [];
162 }
163
164 var $resetMarkMode = function(e) {
165 e.editor.session.$emacsMark = null;
166 }
167
168 var keys = require("../lib/keys").KEY_MODS,
169 eMods = {C: "ctrl", S: "shift", M: "alt", CMD: "command"},
170 combinations = ["C-S-M-CMD",
171 "S-M-CMD", "C-M-CMD", "C-S-CMD", "C-S-M",
172 "M-CMD", "S-CMD", "S-M", "C-CMD", "C-M", "C-S",
173 "CMD", "M", "S", "C"];
174 combinations.forEach(function(c) {
175 var hashId = 0;
176 c.split("-").forEach(function(c) {
177 hashId = hashId | keys[eMods[c]];
178 });
179 eMods[hashId] = c.toLowerCase() + "-";
180 });
181
182 exports.handler.onCopy = function(e, editor) {
183 if (editor.$handlesEmacsOnCopy) return;
184 editor.$handlesEmacsOnCopy = true;
185 exports.handler.commands.killRingSave.exec(editor);
186 delete editor.$handlesEmacsOnCopy;
187 }
188
189 exports.handler.onPaste = function(e, editor) {
190 editor.pushEmacsMark(editor.getCursorPosition());
191 }
192
193 exports.handler.bindKey = function(key, command) {
194 if (!key)
195 return;
196
197 var ckb = this.commmandKeyBinding;
198 key.split("|").forEach(function(keyPart) {
199 keyPart = keyPart.toLowerCase();
200 ckb[keyPart] = command;
201 var keyParts = keyPart.split(" ").slice(0,-1);
202 keyParts.reduce(function(keyMapKeys, keyPart, i) {
203 var prefix = keyMapKeys[i-1] ? keyMapKeys[i-1] + ' ' : '';
204 return keyMapKeys.concat([prefix + keyPart]);
205 }, []).forEach(function(keyPart) {
206 if (!ckb[keyPart]) ckb[keyPart] = "null";
207 });
208 }, this);
209 }
210
211 exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
212 var editor = data.editor;
213 if (hashId == -1) {
214 editor.pushEmacsMark();
215 if (data.count) {
216 var str = Array(data.count + 1).join(key);
217 data.count = null;
218 return {command: "insertstring", args: str};
219 }
220 }
221
222 if (key == "\x00") return undefined;
223
224 var modifier = eMods[hashId];
225 if (modifier == "c-" || data.universalArgument) {
226 var prevCount = String(data.count || 0);
227 var count = parseInt(key[key.length - 1]);
228 if (typeof count === 'number' && !isNaN(count)) {
229 data.count = parseInt(prevCount + count);
230 return {command: "null"};
231 } else if (data.universalArgument) {
232 data.count = 4;
233 }
234 }
235 data.universalArgument = false;
236 if (modifier) key = modifier + key;
237 if (data.keyChain) key = data.keyChain += " " + key;
238 var command = this.commmandKeyBinding[key];
239 data.keyChain = command == "null" ? key : "";
240 if (!command) return undefined;
241 if (command === "null") return {command: "null"};
242
243 if (command === "universalArgument") {
244 data.universalArgument = true;
245 return {command: "null"};
246 }
247 var args;
248 if (typeof command !== "string") {
249 args = command.args;
250 if (command.command) command = command.command;
251 if (command === "goorselect") {
252 command = editor.emacsMark() ? args[1] : args[0];
253 args = null;
254 }
255 }
256
257 if (typeof command === "string") {
258 if (command === "insertstring" ||
259 command === "splitline" ||
260 command === "togglecomment") {
261 editor.pushEmacsMark();
262 }
263 command = this.commands[command] || editor.commands.commands[command];
264 if (!command) return undefined;
265 }
266
267 if (!command.readonly && !command.isYank)
268 data.lastCommand = null;
269
270 if (data.count) {
271 var count = data.count;
272 data.count = 0;
273 if (!command || !command.handlesCount) {
274 return {
275 args: args,
276 command: {
277 exec: function(editor, args) {
278 for (var i = 0; i < count; i++)
279 command.exec(editor, args);
280 }
281 }
282 };
283 } else {
284 if (!args) args = {}
285 if (typeof args === 'object') args.count = count;
286 }
287 }
288
289 return {command: command, args: args};
290 };
291
292 exports.emacsKeys = {
293 "Up|C-p" : {command: "goorselect", args: ["golineup","selectup"]},
294 "Down|C-n" : {command: "goorselect", args: ["golinedown","selectdown"]},
295 "Left|C-b" : {command: "goorselect", args: ["gotoleft","selectleft"]},
296 "Right|C-f" : {command: "goorselect", args: ["gotoright","selectright"]},
297 "C-Left|M-b" : {command: "goorselect", args: ["gotowordleft","selectwordleft"]},
298 "C-Right|M-f" : {command: "goorselect", args: ["gotowordright","selectwordright"]},
299 "Home|C-a" : {command: "goorselect", args: ["gotolinestart","selecttolinestart"]},
300 "End|C-e" : {command: "goorselect", args: ["gotolineend","selecttolineend"]},
301 "C-Home|S-M-,": {command: "goorselect", args: ["gotostart","selecttostart"]},
302 "C-End|S-M-." : {command: "goorselect", args: ["gotoend","selecttoend"]},
303 "S-Up|S-C-p" : "selectup",
304 "S-Down|S-C-n" : "selectdown",
305 "S-Left|S-C-b" : "selectleft",
306 "S-Right|S-C-f" : "selectright",
307 "S-C-Left|S-M-b" : "selectwordleft",
308 "S-C-Right|S-M-f" : "selectwordright",
309 "S-Home|S-C-a" : "selecttolinestart",
310 "S-End|S-C-e" : "selecttolineend",
311 "S-C-Home" : "selecttostart",
312 "S-C-End" : "selecttoend",
313
314 "C-l" : "recenterTopBottom",
315 "M-s" : "centerselection",
316 "M-g": "gotoline",
317 "C-x C-p": "selectall",
318 "C-Down": {command: "goorselect", args: ["gotopagedown","selectpagedown"]},
319 "C-Up": {command: "goorselect", args: ["gotopageup","selectpageup"]},
320 "PageDown|C-v": {command: "goorselect", args: ["gotopagedown","selectpagedown"]},
321 "PageUp|M-v": {command: "goorselect", args: ["gotopageup","selectpageup"]},
322 "S-C-Down": "selectpagedown",
323 "S-C-Up": "selectpageup",
324
325 "C-s": "iSearch",
326 "C-r": "iSearchBackwards",
327
328 "M-C-s": "findnext",
329 "M-C-r": "findprevious",
330 "S-M-5": "replace",
331 "Backspace": "backspace",
332 "Delete|C-d": "del",
333 "Return|C-m": {command: "insertstring", args: "\n"}, // "newline"
334 "C-o": "splitline",
335
336 "M-d|C-Delete": {command: "killWord", args: "right"},
337 "C-Backspace|M-Backspace|M-Delete": {command: "killWord", args: "left"},
338 "C-k": "killLine",
339
340 "C-y|S-Delete": "yank",
341 "M-y": "yankRotate",
342 "C-g": "keyboardQuit",
343
344 "C-w": "killRegion",
345 "M-w": "killRingSave",
346 "C-Space": "setMark",
347 "C-x C-x": "exchangePointAndMark",
348
349 "C-t": "transposeletters",
350 "M-u": "touppercase", // Doesn't work
351 "M-l": "tolowercase",
352 "M-/": "autocomplete", // Doesn't work
353 "C-u": "universalArgument",
354
355 "M-;": "togglecomment",
356
357 "C-/|C-x u|S-C--|C-z": "undo",
358 "S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo?
359 "C-x r": "selectRectangularRegion",
360 "M-x": {command: "focusCommandLine", args: "M-x "}
361 };
362
363
364 exports.handler.bindKeys(exports.emacsKeys);
365
366 exports.handler.addCommands({
367 recenterTopBottom: function(editor) {
368 var renderer = editor.renderer;
369 var pos = renderer.$cursorLayer.getPixelPosition();
370 var h = renderer.$size.scrollerHeight - renderer.lineHeight;
371 var scrollTop = renderer.scrollTop;
372 if (Math.abs(pos.top - scrollTop) < 2) {
373 scrollTop = pos.top - h;
374 } else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) {
375 scrollTop = pos.top;
376 } else {
377 scrollTop = pos.top - h * 0.5;
378 }
379 editor.session.setScrollTop(scrollTop);
380 },
381 selectRectangularRegion: function(editor) {
382 editor.multiSelect.toggleBlockSelection();
383 },
384 setMark: {
385 exec: function(editor, args) {
386 if (args && args.count) {
387 var mark = editor.popEmacsMark();
388 mark && editor.selection.moveCursorToPosition(mark);
389 return;
390 }
391
392 var mark = editor.emacsMark(),
393 transientMarkModeActive = true;
394 if (transientMarkModeActive && (mark || !editor.selection.isEmpty())) {
395 editor.pushEmacsMark();
396 editor.clearSelection();
397 return;
398 }
399
400 if (mark) {
401 var cp = editor.getCursorPosition();
402 if (editor.selection.isEmpty() &&
403 mark.row == cp.row && mark.column == cp.column) {
404 editor.pushEmacsMark();
405 return;
406 }
407 }
408 mark = editor.getCursorPosition();
409 editor.setEmacsMark(mark);
410 editor.selection.setSelectionAnchor(mark.row, mark.column);
411 },
412 readonly: true,
413 handlesCount: true,
414 multiSelectAction: "forEach"
415 },
416 exchangePointAndMark: {
417 exec: function(editor, args) {
418 var sel = editor.selection;
419 if (args.count) {
420 var pos = editor.getCursorPosition();
421 sel.clearSelection();
422 sel.moveCursorToPosition(editor.popEmacsMark());
423 editor.pushEmacsMark(pos);
424 return;
425 }
426 var lastMark = editor.getLastEmacsMark();
427 var range = sel.getRange();
428 if (range.isEmpty()) {
429 sel.selectToPosition(lastMark);
430 return;
431 }
432 sel.setSelectionRange(range, !sel.isBackwards());
433 },
434 readonly: true,
435 handlesCount: true,
436 multiSelectAction: "forEach"
437 },
438 killWord: {
439 exec: function(editor, dir) {
440 editor.clearSelection();
441 if (dir == "left")
442 editor.selection.selectWordLeft();
443 else
444 editor.selection.selectWordRight();
445
446 var range = editor.getSelectionRange();
447 var text = editor.session.getTextRange(range);
448 exports.killRing.add(text);
449
450 editor.session.remove(range);
451 editor.clearSelection();
452 },
453 multiSelectAction: "forEach"
454 },
455 killLine: function(editor) {
456 editor.pushEmacsMark(null);
457 var pos = editor.getCursorPosition();
458 if (pos.column == 0 &&
459 editor.session.doc.getLine(pos.row).length == 0) {
460 editor.selection.selectLine();
461 } else {
462 editor.clearSelection();
463 editor.selection.selectLineEnd();
464 }
465 var range = editor.getSelectionRange();
466 var text = editor.session.getTextRange(range);
467 exports.killRing.add(text);
468
469 editor.session.remove(range);
470 editor.clearSelection();
471 },
472 yank: function(editor) {
473 editor.onPaste(exports.killRing.get() || '');
474 editor.keyBinding.$data.lastCommand = "yank";
475 },
476 yankRotate: function(editor) {
477 if (editor.keyBinding.$data.lastCommand != "yank")
478 return;
479 editor.undo();
480 editor.onPaste(exports.killRing.rotate());
481 editor.keyBinding.$data.lastCommand = "yank";
482 },
483 killRegion: {
484 exec: function(editor) {
485 exports.killRing.add(editor.getCopyText());
486 editor.commands.byName.cut.exec(editor);
487 },
488 readonly: true,
489 multiSelectAction: "forEach"
490 },
491 killRingSave: {
492 exec: function(editor) {
493 exports.killRing.add(editor.getCopyText());
494 setTimeout(function() {
495 var sel = editor.selection,
496 range = sel.getRange();
497 editor.pushEmacsMark(sel.isBackwards() ? range.end : range.start);
498 sel.clearSelection();
499 }, 0);
500 },
501 readonly: true
502 },
503 keyboardQuit: function(editor) {
504 editor.selection.clearSelection();
505 editor.setEmacsMark(null);
506 },
507 focusCommandLine: function(editor, arg) {
508 if (editor.showCommandLine)
509 editor.showCommandLine(arg);
510 }
511 });
512
513 exports.handler.addCommands(iSearchCommandModule.iSearchStartCommands);
514
515 var commands = exports.handler.commands;
516 commands.yank.isYank = true;
517 commands.yankRotate.isYank = true;
518
519 exports.killRing = {
520 $data: [],
521 add: function(str) {
522 str && this.$data.push(str);
523 if (this.$data.length > 30)
524 this.$data.shift();
525 },
526 get: function(n) {
527 n = n || 1;
528 return this.$data.slice(this.$data.length-n, this.$data.length).reverse().join('\n');
529 },
530 pop: function() {
531 if (this.$data.length > 1)
532 this.$data.pop();
533 return this.get();
534 },
535 rotate: function() {
536 this.$data.unshift(this.$data.pop());
537 return this.get();
538 }
539 };
540
541 });
542
543 define('ace/incremental_search', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/search', 'ace/search_highlight', 'ace/commands/incremental_search_commands', 'ace/lib/dom', 'ace/commands/command_manager', 'ace/editor', 'ace/config'], function(require, exports, module) {
544
545
546 var oop = require("./lib/oop");
547 var Range = require("./range").Range;
548 var Search = require("./search").Search;
549 var SearchHighlight = require("./search_highlight").SearchHighlight;
550 var iSearchCommandModule = require("./commands/incremental_search_commands");
551 var ISearchKbd = iSearchCommandModule.IncrementalSearchKeyboardHandler;
552 function IncrementalSearch() {
553 this.$options = {wrap: false, skipCurrent: false};
554 this.$keyboardHandler = new ISearchKbd(this);
555 }
556
557 oop.inherits(IncrementalSearch, Search);
558
559 ;(function() {
560
561 this.activate = function(ed, backwards) {
562 this.$editor = ed;
563 this.$startPos = this.$currentPos = ed.getCursorPosition();
564 this.$options.needle = '';
565 this.$options.backwards = backwards;
566 ed.keyBinding.addKeyboardHandler(this.$keyboardHandler);
567 this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this));
568 this.selectionFix(ed);
569 this.statusMessage(true);
570 }
571
572 this.deactivate = function(reset) {
573 this.cancelSearch(reset);
574 this.$editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler);
575 if (this.$mousedownHandler) {
576 this.$editor.removeEventListener('mousedown', this.$mousedownHandler);
577 delete this.$mousedownHandler;
578 }
579 this.message('');
580 }
581
582 this.selectionFix = function(editor) {
583 if (editor.selection.isEmpty() && !editor.session.$emacsMark) {
584 editor.clearSelection();
585 }
586 }
587
588 this.highlight = function(regexp) {
589 var sess = this.$editor.session,
590 hl = sess.$isearchHighlight = sess.$isearchHighlight || sess.addDynamicMarker(
591 new SearchHighlight(null, "ace_isearch-result", "text"));
592 hl.setRegexp(regexp);
593 sess._emit("changeBackMarker"); // force highlight layer redraw
594 }
595
596 this.cancelSearch = function(reset) {
597 var e = this.$editor;
598 this.$prevNeedle = this.$options.needle;
599 this.$options.needle = '';
600 if (reset) {
601 e.moveCursorToPosition(this.$startPos);
602 this.$currentPos = this.$startPos;
603 } else {
604 e.pushEmacsMark && e.pushEmacsMark(this.$startPos, false);
605 }
606 this.highlight(null);
607 return Range.fromPoints(this.$currentPos, this.$currentPos);
608 }
609
610 this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) {
611 if (!this.$editor) return null;
612 var options = this.$options;
613 if (needleUpdateFunc) {
614 options.needle = needleUpdateFunc.call(this, options.needle || '') || '';
615 }
616 if (options.needle.length === 0) {
617 this.statusMessage(true);
618 return this.cancelSearch(true);
619 };
620 options.start = this.$currentPos;
621 var session = this.$editor.session,
622 found = this.find(session);
623 if (found) {
624 if (options.backwards) found = Range.fromPoints(found.end, found.start);
625 this.$editor.moveCursorToPosition(found.end);
626 if (moveToNext) this.$currentPos = found.end;
627 this.highlight(options.re)
628 }
629
630 this.statusMessage(found);
631
632 return found;
633 }
634
635 this.addChar = function(c) {
636 return this.highlightAndFindWithNeedle(false, function(needle) {
637 return needle + c;
638 });
639 }
640
641 this.removeChar = function(c) {
642 return this.highlightAndFindWithNeedle(false, function(needle) {
643 return needle.length > 0 ? needle.substring(0, needle.length-1) : needle;
644 });
645 }
646
647 this.next = function(options) {
648 options = options || {};
649 this.$options.backwards = !!options.backwards;
650 this.$currentPos = this.$editor.getCursorPosition();
651 return this.highlightAndFindWithNeedle(true, function(needle) {
652 return options.useCurrentOrPrevSearch && needle.length === 0 ?
653 this.$prevNeedle || '' : needle;
654 });
655 }
656
657 this.onMouseDown = function(evt) {
658 this.deactivate();
659 return true;
660 }
661
662 this.statusMessage = function(found) {
663 var options = this.$options, msg = '';
664 msg += options.backwards ? 'reverse-' : '';
665 msg += 'isearch: ' + options.needle;
666 msg += found ? '' : ' (not found)';
667 this.message(msg);
668 }
669
670 this.message = function(msg) {
671 if (this.$editor.showCommandLine) {
672 this.$editor.showCommandLine(msg);
673 this.$editor.focus();
674 } else {
675 console.log(msg);
676 }
677 }
678
679 }).call(IncrementalSearch.prototype);
680
681
682 exports.IncrementalSearch = IncrementalSearch;
683
684 var dom = require('./lib/dom');
685 dom.importCssString && dom.importCssString("\
686 .ace_marker-layer .ace_isearch-result {\
687 position: absolute;\
688 z-index: 6;\
689 -moz-box-sizing: border-box;\
690 -webkit-box-sizing: border-box;\
691 box-sizing: border-box;\
692 }\
693 div.ace_isearch-result {\
694 border-radius: 4px;\
695 background-color: rgba(255, 200, 0, 0.5);\
696 box-shadow: 0 0 4px rgb(255, 200, 0);\
697 }\
698 .ace_dark div.ace_isearch-result {\
699 background-color: rgb(100, 110, 160);\
700 box-shadow: 0 0 4px rgb(80, 90, 140);\
701 }", "incremental-search-highlighting");
702 var commands = require("./commands/command_manager");
703 (function() {
704 this.setupIncrementalSearch = function(editor, val) {
705 if (this.usesIncrementalSearch == val) return;
706 this.usesIncrementalSearch = val;
707 var iSearchCommands = iSearchCommandModule.iSearchStartCommands;
708 var method = val ? 'addCommands' : 'removeCommands';
709 this[method](iSearchCommands);
710 };
711 }).call(commands.CommandManager.prototype);
712 var Editor = require("./editor").Editor;
713 require("./config").defineOptions(Editor.prototype, "editor", {
714 useIncrementalSearch: {
715 set: function(val) {
716 this.keyBinding.$handlers.forEach(function(handler) {
717 if (handler.setupIncrementalSearch) {
718 handler.setupIncrementalSearch(this, val);
719 }
720 });
721 this._emit('incrementalSearchSettingChanged', {isEnabled: val});
722 }
723 }
724 });
725
726 });
727
728 define('ace/commands/incremental_search_commands', ['require', 'exports', 'module' , 'ace/config', 'ace/lib/oop', 'ace/keyboard/hash_handler', 'ace/commands/occur_commands'], function(require, exports, module) {
729
730 var config = require("../config");
731 var oop = require("../lib/oop");
732 var HashHandler = require("../keyboard/hash_handler").HashHandler;
733 var occurStartCommand = require("./occur_commands").occurStartCommand;
734 exports.iSearchStartCommands = [{
735 name: "iSearch",
736 bindKey: {win: "Ctrl-F", mac: "Command-F"},
737 exec: function(editor, options) {
738 config.loadModule(["core", "ace/incremental_search"], function(e) {
739 var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch();
740 iSearch.activate(editor, options.backwards);
741 if (options.jumpToFirstMatch) iSearch.next(options);
742 });
743 },
744 readOnly: true
745 }, {
746 name: "iSearchBackwards",
747 exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); },
748 readOnly: true
749 }, {
750 name: "iSearchAndGo",
751 bindKey: {win: "Ctrl-K", mac: "Command-G"},
752 exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); },
753 readOnly: true
754 }, {
755 name: "iSearchBackwardsAndGo",
756 bindKey: {win: "Ctrl-Shift-K", mac: "Command-Shift-G"},
757 exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); },
758 readOnly: true
759 }];
760 exports.iSearchCommands = [{
761 name: "restartSearch",
762 bindKey: {win: "Ctrl-F", mac: "Command-F"},
763 exec: function(iSearch) {
764 iSearch.cancelSearch(true);
765 },
766 readOnly: true,
767 isIncrementalSearchCommand: true
768 }, {
769 name: "searchForward",
770 bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"},
771 exec: function(iSearch, options) {
772 options.useCurrentOrPrevSearch = true;
773 iSearch.next(options);
774 },
775 readOnly: true,
776 isIncrementalSearchCommand: true
777 }, {
778 name: "searchBackward",
779 bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"},
780 exec: function(iSearch, options) {
781 options.useCurrentOrPrevSearch = true;
782 options.backwards = true;
783 iSearch.next(options);
784 },
785 readOnly: true,
786 isIncrementalSearchCommand: true
787 }, {
788 name: "extendSearchTerm",
789 exec: function(iSearch, string) {
790 iSearch.addChar(string);
791 },
792 readOnly: true,
793 isIncrementalSearchCommand: true
794 }, {
795 name: "extendSearchTermSpace",
796 bindKey: "space",
797 exec: function(iSearch) { iSearch.addChar(' '); },
798 readOnly: true,
799 isIncrementalSearchCommand: true
800 }, {
801 name: "shrinkSearchTerm",
802 bindKey: "backspace",
803 exec: function(iSearch) {
804 iSearch.removeChar();
805 },
806 readOnly: true,
807 isIncrementalSearchCommand: true
808 }, {
809 name: 'confirmSearch',
810 bindKey: 'return',
811 exec: function(iSearch) { iSearch.deactivate(); },
812 readOnly: true,
813 isIncrementalSearchCommand: true
814 }, {
815 name: 'cancelSearch',
816 bindKey: 'esc|Ctrl-G',
817 exec: function(iSearch) { iSearch.deactivate(true); },
818 readOnly: true,
819 isIncrementalSearchCommand: true
820 }, {
821 name: 'occurisearch',
822 bindKey: 'Ctrl-O',
823 exec: function(iSearch) {
824 var options = oop.mixin({}, iSearch.$options);
825 iSearch.deactivate();
826 occurStartCommand.exec(iSearch.$editor, options);
827 },
828 readOnly: true,
829 isIncrementalSearchCommand: true
830 }];
831
832 function IncrementalSearchKeyboardHandler(iSearch) {
833 this.$iSearch = iSearch;
834 }
835
836 oop.inherits(IncrementalSearchKeyboardHandler, HashHandler);
837
838 ;(function() {
839
840 this.attach = function(editor) {
841 var iSearch = this.$iSearch;
842 HashHandler.call(this, exports.iSearchCommands, editor.commands.platform);
843 this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) {
844 if (!e.command.isIncrementalSearchCommand) return undefined;
845 e.stopPropagation();
846 e.preventDefault();
847 return e.command.exec(iSearch, e.args || {});
848 });
849 }
850
851 this.detach = function(editor) {
852 if (!this.$commandExecHandler) return;
853 editor.commands.removeEventListener('exec', this.$commandExecHandler);
854 delete this.$commandExecHandler;
855 }
856
857 var handleKeyboard$super = this.handleKeyboard;
858 this.handleKeyboard = function(data, hashId, key, keyCode) {
859 var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
860 if (cmd.command) { return cmd; }
861 if (hashId == -1) {
862 var extendCmd = this.commands.extendSearchTerm;
863 if (extendCmd) { return {command: extendCmd, args: key}; }
864 }
865 return {command: "null", passEvent: hashId == 0 || hashId == 4};
866 }
867
868 }).call(IncrementalSearchKeyboardHandler.prototype);
869
870
871 exports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler;
872
873 });
874
875 define('ace/commands/occur_commands', ['require', 'exports', 'module' , 'ace/config', 'ace/occur', 'ace/keyboard/hash_handler', 'ace/lib/oop'], function(require, exports, module) {
876
877 var config = require("../config"),
878 Occur = require("../occur").Occur;
879 var occurStartCommand = {
880 name: "occur",
881 exec: function(editor, options) {
882 var alreadyInOccur = !!editor.session.$occur;
883 var occurSessionActive = new Occur().enter(editor, options);
884 if (occurSessionActive && !alreadyInOccur)
885 OccurKeyboardHandler.installIn(editor);
886 },
887 readOnly: true
888 };
889
890 var occurCommands = [{
891 name: "occurexit",
892 bindKey: 'esc|Ctrl-G',
893 exec: function(editor) {
894 var occur = editor.session.$occur;
895 if (!occur) return;
896 occur.exit(editor, {});
897 if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
898 },
899 readOnly: true
900 }, {
901 name: "occuraccept",
902 bindKey: 'enter',
903 exec: function(editor) {
904 var occur = editor.session.$occur;
905 if (!occur) return;
906 occur.exit(editor, {translatePosition: true});
907 if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
908 },
909 readOnly: true
910 }];
911
912 var HashHandler = require("../keyboard/hash_handler").HashHandler;
913 var oop = require("../lib/oop");
914
915
916 function OccurKeyboardHandler() {}
917
918 oop.inherits(OccurKeyboardHandler, HashHandler);
919
920 ;(function() {
921
922 this.isOccurHandler = true;
923
924 this.attach = function(editor) {
925 HashHandler.call(this, occurCommands, editor.commands.platform);
926 this.$editor = editor;
927 }
928
929 var handleKeyboard$super = this.handleKeyboard;
930 this.handleKeyboard = function(data, hashId, key, keyCode) {
931 var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
932 return (cmd && cmd.command) ? cmd : undefined;
933 }
934
935 }).call(OccurKeyboardHandler.prototype);
936
937 OccurKeyboardHandler.installIn = function(editor) {
938 var handler = new this();
939 editor.keyBinding.addKeyboardHandler(handler);
940 editor.commands.addCommands(occurCommands);
941 }
942
943 OccurKeyboardHandler.uninstallFrom = function(editor) {
944 editor.commands.removeCommands(occurCommands);
945 var handler = editor.getKeyboardHandler();
946 if (handler.isOccurHandler)
947 editor.keyBinding.removeKeyboardHandler(handler);
948 }
949
950 exports.occurStartCommand = occurStartCommand;
951
952 });
953
954 define('ace/occur', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/search', 'ace/edit_session', 'ace/search_highlight', 'ace/lib/dom'], function(require, exports, module) {
955
956
957 var oop = require("./lib/oop");
958 var Range = require("./range").Range;
959 var Search = require("./search").Search;
960 var EditSession = require("./edit_session").EditSession;
961 var SearchHighlight = require("./search_highlight").SearchHighlight;
962 function Occur() {}
963
964 oop.inherits(Occur, Search);
965
966 (function() {
967 this.enter = function(editor, options) {
968 if (!options.needle) return false;
969 var pos = editor.getCursorPosition();
970 this.displayOccurContent(editor, options);
971 var translatedPos = this.originalToOccurPosition(editor.session, pos);
972 editor.moveCursorToPosition(translatedPos);
973 return true;
974 }
975 this.exit = function(editor, options) {
976 var pos = options.translatePosition && editor.getCursorPosition();
977 var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);
978 this.displayOriginalContent(editor);
979 if (translatedPos)
980 editor.moveCursorToPosition(translatedPos);
981 return true;
982 }
983
984 this.highlight = function(sess, regexp) {
985 var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker(
986 new SearchHighlight(null, "ace_occur-highlight", "text"));
987 hl.setRegexp(regexp);
988 sess._emit("changeBackMarker"); // force highlight layer redraw
989 }
990
991 this.displayOccurContent = function(editor, options) {
992 this.$originalSession = editor.session;
993 var found = this.matchingLines(editor.session, options);
994 var lines = found.map(function(foundLine) { return foundLine.content; });
995 var occurSession = new EditSession(lines.join('\n'));
996 occurSession.$occur = this;
997 occurSession.$occurMatchingLines = found;
998 editor.setSession(occurSession);
999 this.highlight(occurSession, options.re);
1000 occurSession._emit('changeBackMarker');
1001 }
1002
1003 this.displayOriginalContent = function(editor) {
1004 editor.setSession(this.$originalSession);
1005 }
1006 this.originalToOccurPosition = function(session, pos) {
1007 var lines = session.$occurMatchingLines;
1008 var nullPos = {row: 0, column: 0};
1009 if (!lines) return nullPos;
1010 for (var i = 0; i < lines.length; i++) {
1011 if (lines[i].row === pos.row)
1012 return {row: i, column: pos.column};
1013 }
1014 return nullPos;
1015 }
1016 this.occurToOriginalPosition = function(session, pos) {
1017 var lines = session.$occurMatchingLines;
1018 if (!lines || !lines[pos.row])
1019 return pos;
1020 return {row: lines[pos.row].row, column: pos.column};
1021 }
1022
1023 this.matchingLines = function(session, options) {
1024 options = oop.mixin({}, options);
1025 if (!session || !options.needle) return [];
1026 var search = new Search();
1027 search.set(options);
1028 return search.findAll(session).reduce(function(lines, range) {
1029 var row = range.start.row;
1030 var last = lines[lines.length-1];
1031 return last && last.row === row ?
1032 lines :
1033 lines.concat({row: row, content: session.getLine(row)});
1034 }, []);
1035 }
1036
1037 }).call(Occur.prototype);
1038
1039 var dom = require('./lib/dom');
1040 dom.importCssString(".ace_occur-highlight {\n\
1041 border-radius: 4px;\n\
1042 background-color: rgba(87, 255, 8, 0.25);\n\
1043 position: absolute;\n\
1044 z-index: 4;\n\
1045 -moz-box-sizing: border-box;\n\
1046 -webkit-box-sizing: border-box;\n\
1047 box-sizing: border-box;\n\
1048 box-shadow: 0 0 4px rgb(91, 255, 50);\n\
1049 }\n\
1050 .ace_dark .ace_occur-highlight {\n\
1051 background-color: rgb(80, 140, 85);\n\
1052 box-shadow: 0 0 4px rgb(60, 120, 70);\n\
1053 }\n", "incremental-occur-highlighting");
1054
1055 exports.Occur = Occur;
1056
1057 });
+0
-1712
try/ace/keybinding-vim.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/keyboard/vim', ['require', 'exports', 'module' , 'ace/keyboard/vim/commands', 'ace/keyboard/vim/maps/util', 'ace/lib/useragent'], function(require, exports, module) {
31
32
33 var cmds = require("./vim/commands");
34 var coreCommands = cmds.coreCommands;
35 var util = require("./vim/maps/util");
36 var useragent = require("../lib/useragent");
37
38 var startCommands = {
39 "i": {
40 command: coreCommands.start
41 },
42 "I": {
43 command: coreCommands.startBeginning
44 },
45 "a": {
46 command: coreCommands.append
47 },
48 "A": {
49 command: coreCommands.appendEnd
50 },
51 "ctrl-f": {
52 command: "gotopagedown"
53 },
54 "ctrl-b": {
55 command: "gotopageup"
56 }
57 };
58
59 exports.handler = {
60 $id: "ace/keyboard/vim",
61 handleMacRepeat: function(data, hashId, key) {
62 if (hashId == -1) {
63 data.inputChar = key;
64 data.lastEvent = "input";
65 } else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {
66 if (data.lastEvent == "input") {
67 data.lastEvent = "input1";
68 } else if (data.lastEvent == "input1") {
69 return true;
70 }
71 } else {
72 data.$lastHash = hashId;
73 data.$lastKey = key;
74 data.lastEvent = "keypress";
75 }
76 },
77
78 handleKeyboard: function(data, hashId, key, keyCode, e) {
79 if (hashId != 0 && (key == "" || key == "\x00"))
80 return null;
81
82 var editor = data.editor;
83
84 if (hashId == 1)
85 key = "ctrl-" + key;
86 if (key == "ctrl-c") {
87 if (!useragent.isMac && editor.getCopyText()) {
88 editor.once("copy", function() {
89 if (data.state == "start")
90 coreCommands.stop.exec(editor);
91 else
92 editor.selection.clearSelection();
93 });
94 return {command: "null", passEvent: true};
95 }
96 return {command: coreCommands.stop};
97 } else if ((key == "esc" && hashId == 0) || key == "ctrl-[") {
98 return {command: coreCommands.stop};
99 } else if (data.state == "start") {
100 if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
101 hashId = -1;
102 key = data.inputChar;
103 }
104
105 if (hashId == -1 || hashId == 1 || hashId == 0 && key.length > 1) {
106 if (cmds.inputBuffer.idle && startCommands[key])
107 return startCommands[key];
108 cmds.inputBuffer.push(editor, key);
109 return {command: "null", passEvent: false};
110 } // if no modifier || shift: wait for input.
111 else if (key.length == 1 && (hashId == 0 || hashId == 4)) {
112 return {command: "null", passEvent: true};
113 } else if (key == "esc" && hashId == 0) {
114 return {command: coreCommands.stop};
115 }
116 } else {
117 if (key == "ctrl-w") {
118 return {command: "removewordleft"};
119 }
120 }
121 },
122
123 attach: function(editor) {
124 editor.on("click", exports.onCursorMove);
125 if (util.currentMode !== "insert")
126 cmds.coreCommands.stop.exec(editor);
127 editor.$vimModeHandler = this;
128 },
129
130 detach: function(editor) {
131 editor.removeListener("click", exports.onCursorMove);
132 util.noMode(editor);
133 util.currentMode = "normal";
134 },
135
136 actions: cmds.actions,
137 getStatusText: function() {
138 if (util.currentMode == "insert")
139 return "INSERT";
140 if (util.onVisualMode)
141 return (util.onVisualLineMode ? "VISUAL LINE " : "VISUAL ") + cmds.inputBuffer.status;
142 return cmds.inputBuffer.status;
143 }
144 };
145
146
147 exports.onCursorMove = function(e) {
148 cmds.onCursorMove(e.editor, e);
149 exports.onCursorMove.scheduled = false;
150 };
151
152 });
153
154 define('ace/keyboard/vim/commands', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/maps/motions', 'ace/keyboard/vim/maps/operators', 'ace/keyboard/vim/maps/aliases', 'ace/keyboard/vim/registers'], function(require, exports, module) {
155
156 "never use strict";
157
158 var lang = require("../../lib/lang");
159 var util = require("./maps/util");
160 var motions = require("./maps/motions");
161 var operators = require("./maps/operators");
162 var alias = require("./maps/aliases");
163 var registers = require("./registers");
164
165 var NUMBER = 1;
166 var OPERATOR = 2;
167 var MOTION = 3;
168 var ACTION = 4;
169 var HMARGIN = 8; // Minimum amount of line separation between margins;
170
171 var repeat = function repeat(fn, count, args) {
172 while (0 < count--)
173 fn.apply(this, args);
174 };
175
176 var ensureScrollMargin = function(editor) {
177 var renderer = editor.renderer;
178 var pos = renderer.$cursorLayer.getPixelPosition();
179
180 var top = pos.top;
181
182 var margin = HMARGIN * renderer.layerConfig.lineHeight;
183 if (2 * margin > renderer.$size.scrollerHeight)
184 margin = renderer.$size.scrollerHeight / 2;
185
186 if (renderer.scrollTop > top - margin) {
187 renderer.session.setScrollTop(top - margin);
188 }
189
190 if (renderer.scrollTop + renderer.$size.scrollerHeight < top + margin + renderer.lineHeight) {
191 renderer.session.setScrollTop(top + margin + renderer.lineHeight - renderer.$size.scrollerHeight);
192 }
193 };
194
195 var actions = exports.actions = {
196 "z": {
197 param: true,
198 fn: function(editor, range, count, param) {
199 switch (param) {
200 case "z":
201 editor.renderer.alignCursor(null, 0.5);
202 break;
203 case "t":
204 editor.renderer.alignCursor(null, 0);
205 break;
206 case "b":
207 editor.renderer.alignCursor(null, 1);
208 break;
209 }
210 }
211 },
212 "r": {
213 param: true,
214 fn: function(editor, range, count, param) {
215 if (param && param.length) {
216 if (param.length > 1)
217 param = param == "return" ? "\n" : param == "tab" ? "\t" : param;
218 repeat(function() { editor.insert(param); }, count || 1);
219 editor.navigateLeft();
220 }
221 }
222 },
223 "R": {
224 fn: function(editor, range, count, param) {
225 util.insertMode(editor);
226 editor.setOverwrite(true);
227 }
228 },
229 "~": {
230 fn: function(editor, range, count) {
231 repeat(function() {
232 var range = editor.selection.getRange();
233 if (range.isEmpty())
234 range.end.column++;
235 var text = editor.session.getTextRange(range);
236 var toggled = text.toUpperCase();
237 if (toggled == text)
238 editor.navigateRight();
239 else
240 editor.session.replace(range, toggled);
241 }, count || 1);
242 }
243 },
244 "*": {
245 fn: function(editor, range, count, param) {
246 editor.selection.selectWord();
247 editor.findNext();
248 ensureScrollMargin(editor);
249 var r = editor.selection.getRange();
250 editor.selection.setSelectionRange(r, true);
251 }
252 },
253 "#": {
254 fn: function(editor, range, count, param) {
255 editor.selection.selectWord();
256 editor.findPrevious();
257 ensureScrollMargin(editor);
258 var r = editor.selection.getRange();
259 editor.selection.setSelectionRange(r, true);
260 }
261 },
262 "m": {
263 param: true,
264 fn: function(editor, range, count, param) {
265 var s = editor.session;
266 var markers = s.vimMarkers || (s.vimMarkers = {});
267 var c = editor.getCursorPosition();
268 if (!markers[param]) {
269 markers[param] = editor.session.doc.createAnchor(c);
270 }
271 markers[param].setPosition(c.row, c.column, true);
272 }
273 },
274 "n": {
275 fn: function(editor, range, count, param) {
276 var options = editor.getLastSearchOptions();
277 options.backwards = false;
278
279 editor.selection.moveCursorRight();
280 editor.selection.clearSelection();
281 editor.findNext(options);
282
283 ensureScrollMargin(editor);
284 var r = editor.selection.getRange();
285 r.end.row = r.start.row;
286 r.end.column = r.start.column;
287 editor.selection.setSelectionRange(r, true);
288 }
289 },
290 "N": {
291 fn: function(editor, range, count, param) {
292 var options = editor.getLastSearchOptions();
293 options.backwards = true;
294
295 editor.findPrevious(options);
296 ensureScrollMargin(editor);
297 var r = editor.selection.getRange();
298 r.end.row = r.start.row;
299 r.end.column = r.start.column;
300 editor.selection.setSelectionRange(r, true);
301 }
302 },
303 "v": {
304 fn: function(editor, range, count, param) {
305 editor.selection.selectRight();
306 util.visualMode(editor, false);
307 },
308 acceptsMotion: true
309 },
310 "V": {
311 fn: function(editor, range, count, param) {
312 var row = editor.getCursorPosition().row;
313 editor.selection.clearSelection();
314 editor.selection.moveCursorTo(row, 0);
315 editor.selection.selectLineEnd();
316 editor.selection.visualLineStart = row;
317
318 util.visualMode(editor, true);
319 },
320 acceptsMotion: true
321 },
322 "Y": {
323 fn: function(editor, range, count, param) {
324 util.copyLine(editor);
325 }
326 },
327 "p": {
328 fn: function(editor, range, count, param) {
329 var defaultReg = registers._default;
330
331 editor.setOverwrite(false);
332 if (defaultReg.isLine) {
333 var pos = editor.getCursorPosition();
334 pos.column = editor.session.getLine(pos.row).length;
335 var text = lang.stringRepeat("\n" + defaultReg.text, count || 1);
336 editor.session.insert(pos, text);
337 editor.moveCursorTo(pos.row + 1, 0);
338 }
339 else {
340 editor.navigateRight();
341 editor.insert(lang.stringRepeat(defaultReg.text, count || 1));
342 editor.navigateLeft();
343 }
344 editor.setOverwrite(true);
345 editor.selection.clearSelection();
346 }
347 },
348 "P": {
349 fn: function(editor, range, count, param) {
350 var defaultReg = registers._default;
351 editor.setOverwrite(false);
352
353 if (defaultReg.isLine) {
354 var pos = editor.getCursorPosition();
355 pos.column = 0;
356 var text = lang.stringRepeat(defaultReg.text + "\n", count || 1);
357 editor.session.insert(pos, text);
358 editor.moveCursorToPosition(pos);
359 }
360 else {
361 editor.insert(lang.stringRepeat(defaultReg.text, count || 1));
362 }
363 editor.setOverwrite(true);
364 editor.selection.clearSelection();
365 }
366 },
367 "J": {
368 fn: function(editor, range, count, param) {
369 var session = editor.session;
370 range = editor.getSelectionRange();
371 var pos = {row: range.start.row, column: range.start.column};
372 count = count || range.end.row - range.start.row;
373 var maxRow = Math.min(pos.row + (count || 1), session.getLength() - 1);
374
375 range.start.column = session.getLine(pos.row).length;
376 range.end.column = session.getLine(maxRow).length;
377 range.end.row = maxRow;
378
379 var text = "";
380 for (var i = pos.row; i < maxRow; i++) {
381 var nextLine = session.getLine(i + 1);
382 text += " " + /^\s*(.*)$/.exec(nextLine)[1] || "";
383 }
384
385 session.replace(range, text);
386 editor.moveCursorTo(pos.row, pos.column);
387 }
388 },
389 "u": {
390 fn: function(editor, range, count, param) {
391 count = parseInt(count || 1, 10);
392 for (var i = 0; i < count; i++) {
393 editor.undo();
394 }
395 editor.selection.clearSelection();
396 }
397 },
398 "ctrl-r": {
399 fn: function(editor, range, count, param) {
400 count = parseInt(count || 1, 10);
401 for (var i = 0; i < count; i++) {
402 editor.redo();
403 }
404 editor.selection.clearSelection();
405 }
406 },
407 ":": {
408 fn: function(editor, range, count, param) {
409 var val = ":";
410 if (count > 1)
411 val = ".,.+" + count + val;
412 if (editor.showCommandLine)
413 editor.showCommandLine(val);
414 }
415 },
416 "/": {
417 fn: function(editor, range, count, param) {
418 if (editor.showCommandLine)
419 editor.showCommandLine("/");
420 }
421 },
422 "?": {
423 fn: function(editor, range, count, param) {
424 if (editor.showCommandLine)
425 editor.showCommandLine("?");
426 }
427 },
428 ".": {
429 fn: function(editor, range, count, param) {
430 util.onInsertReplaySequence = inputBuffer.lastInsertCommands;
431 var previous = inputBuffer.previous;
432 if (previous) // If there is a previous action
433 inputBuffer.exec(editor, previous.action, previous.param);
434 }
435 },
436 "ctrl-x": {
437 fn: function(editor, range, count, param) {
438 editor.modifyNumber(-(count || 1));
439 }
440 },
441 "ctrl-a": {
442 fn: function(editor, range, count, param) {
443 editor.modifyNumber(count || 1);
444 }
445 }
446 };
447
448 var inputBuffer = exports.inputBuffer = {
449 accepting: [NUMBER, OPERATOR, MOTION, ACTION],
450 currentCmd: null,
451 currentCount: "",
452 status: "",
453 operator: null,
454 motion: null,
455
456 lastInsertCommands: [],
457
458 push: function(editor, ch, keyId) {
459 var status = this.status;
460 var isKeyHandled = true;
461 this.idle = false;
462 var wObj = this.waitingForParam;
463 if (/^numpad\d+$/i.test(ch))
464 ch = ch.substr(6);
465
466 if (wObj) {
467 this.exec(editor, wObj, ch);
468 }
469 else if (!(ch === "0" && !this.currentCount.length) &&
470 (/^\d+$/.test(ch) && this.isAccepting(NUMBER))) {
471 this.currentCount += ch;
472 this.currentCmd = NUMBER;
473 this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
474 }
475 else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) {
476 this.operator = {
477 ch: ch,
478 count: this.getCount()
479 };
480 this.currentCmd = OPERATOR;
481 this.accepting = [NUMBER, MOTION, ACTION];
482 this.exec(editor, { operator: this.operator });
483 }
484 else if (motions[ch] && this.isAccepting(MOTION)) {
485 this.currentCmd = MOTION;
486
487 var ctx = {
488 operator: this.operator,
489 motion: {
490 ch: ch,
491 count: this.getCount()
492 }
493 };
494
495 if (motions[ch].param)
496 this.waitForParam(ctx);
497 else
498 this.exec(editor, ctx);
499 }
500 else if (alias[ch] && this.isAccepting(MOTION)) {
501 alias[ch].operator.count = this.getCount();
502 this.exec(editor, alias[ch]);
503 }
504 else if (actions[ch] && this.isAccepting(ACTION)) {
505 var actionObj = {
506 action: {
507 fn: actions[ch].fn,
508 count: this.getCount()
509 }
510 };
511
512 if (actions[ch].param) {
513 this.waitForParam(actionObj);
514 }
515 else {
516 this.exec(editor, actionObj);
517 }
518
519 if (actions[ch].acceptsMotion)
520 this.idle = false;
521 }
522 else if (this.operator) {
523 this.operator.count = this.getCount();
524 this.exec(editor, { operator: this.operator }, ch);
525 }
526 else {
527 isKeyHandled = ch.length == 1;
528 this.reset();
529 }
530
531 if (this.waitingForParam || this.motion || this.operator) {
532 this.status += ch;
533 } else if (this.currentCount) {
534 this.status = this.currentCount;
535 } else if (this.status) {
536 this.status = "";
537 }
538 if (this.status != status)
539 editor._emit("changeStatus");
540 return isKeyHandled;
541 },
542
543 waitForParam: function(cmd) {
544 this.waitingForParam = cmd;
545 },
546
547 getCount: function() {
548 var count = this.currentCount;
549 this.currentCount = "";
550 return count && parseInt(count, 10);
551 },
552
553 exec: function(editor, action, param) {
554 var m = action.motion;
555 var o = action.operator;
556 var a = action.action;
557
558 if (!param)
559 param = action.param;
560
561 if (o) {
562 this.previous = {
563 action: action,
564 param: param
565 };
566 }
567
568 if (o && !editor.selection.isEmpty()) {
569 if (operators[o.ch].selFn) {
570 operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param);
571 this.reset();
572 }
573 return;
574 }
575 else if (!m && !a && o && param) {
576 operators[o.ch].fn(editor, null, o.count, param);
577 this.reset();
578 }
579 else if (m) {
580 var run = function(fn) {
581 if (fn && typeof fn === "function") { // There should always be a motion
582 if (m.count && !motionObj.handlesCount)
583 repeat(fn, m.count, [editor, null, m.count, param]);
584 else
585 fn(editor, null, m.count, param);
586 }
587 };
588
589 var motionObj = motions[m.ch];
590 var selectable = motionObj.sel;
591
592 if (!o) {
593 if ((util.onVisualMode || util.onVisualLineMode) && selectable)
594 run(motionObj.sel);
595 else
596 run(motionObj.nav);
597 }
598 else if (selectable) {
599 repeat(function() {
600 run(motionObj.sel);
601 operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
602 }, o.count || 1);
603 }
604 this.reset();
605 }
606 else if (a) {
607 a.fn(editor, editor.getSelectionRange(), a.count, param);
608 this.reset();
609 }
610 handleCursorMove(editor);
611 },
612
613 isAccepting: function(type) {
614 return this.accepting.indexOf(type) !== -1;
615 },
616
617 reset: function() {
618 this.operator = null;
619 this.motion = null;
620 this.currentCount = "";
621 this.status = "";
622 this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
623 this.idle = true;
624 this.waitingForParam = null;
625 }
626 };
627
628 function setPreviousCommand(fn) {
629 inputBuffer.previous = { action: { action: { fn: fn } } };
630 }
631
632 exports.coreCommands = {
633 start: {
634 exec: function start(editor) {
635 util.insertMode(editor);
636 setPreviousCommand(start);
637 }
638 },
639 startBeginning: {
640 exec: function startBeginning(editor) {
641 editor.navigateLineStart();
642 util.insertMode(editor);
643 setPreviousCommand(startBeginning);
644 }
645 },
646 stop: {
647 exec: function stop(editor) {
648 inputBuffer.reset();
649 util.onVisualMode = false;
650 util.onVisualLineMode = false;
651 inputBuffer.lastInsertCommands = util.normalMode(editor);
652 }
653 },
654 append: {
655 exec: function append(editor) {
656 var pos = editor.getCursorPosition();
657 var lineLen = editor.session.getLine(pos.row).length;
658 if (lineLen)
659 editor.navigateRight();
660 util.insertMode(editor);
661 setPreviousCommand(append);
662 }
663 },
664 appendEnd: {
665 exec: function appendEnd(editor) {
666 editor.navigateLineEnd();
667 util.insertMode(editor);
668 setPreviousCommand(appendEnd);
669 }
670 }
671 };
672
673 var handleCursorMove = exports.onCursorMove = function(editor, e) {
674 if (util.currentMode === 'insert' || handleCursorMove.running)
675 return;
676 else if(!editor.selection.isEmpty()) {
677 handleCursorMove.running = true;
678 if (util.onVisualLineMode) {
679 var originRow = editor.selection.visualLineStart;
680 var cursorRow = editor.getCursorPosition().row;
681 if(originRow <= cursorRow) {
682 var endLine = editor.session.getLine(cursorRow);
683 editor.selection.clearSelection();
684 editor.selection.moveCursorTo(originRow, 0);
685 editor.selection.selectTo(cursorRow, endLine.length);
686 } else {
687 var endLine = editor.session.getLine(originRow);
688 editor.selection.clearSelection();
689 editor.selection.moveCursorTo(originRow, endLine.length);
690 editor.selection.selectTo(cursorRow, 0);
691 }
692 }
693 handleCursorMove.running = false;
694 return;
695 }
696 else {
697 if (e && (util.onVisualLineMode || util.onVisualMode)) {
698 editor.selection.clearSelection();
699 util.normalMode(editor);
700 }
701
702 handleCursorMove.running = true;
703 var pos = editor.getCursorPosition();
704 var lineLen = editor.session.getLine(pos.row).length;
705
706 if (lineLen && pos.column === lineLen)
707 editor.navigateLeft();
708 handleCursorMove.running = false;
709 }
710 };
711 });
712 define('ace/keyboard/vim/maps/util', ['require', 'exports', 'module' , 'ace/keyboard/vim/registers', 'ace/lib/dom'], function(require, exports, module) {
713 var registers = require("../registers");
714
715 var dom = require("../../../lib/dom");
716 dom.importCssString('.insert-mode .ace_cursor{\
717 border-left: 2px solid #333333;\
718 }\
719 .ace_dark.insert-mode .ace_cursor{\
720 border-left: 2px solid #eeeeee;\
721 }\
722 .normal-mode .ace_cursor{\
723 border: 0!important;\
724 background-color: red;\
725 opacity: 0.5;\
726 }', 'vimMode');
727
728 module.exports = {
729 onVisualMode: false,
730 onVisualLineMode: false,
731 currentMode: 'normal',
732 noMode: function(editor) {
733 editor.unsetStyle('insert-mode');
734 editor.unsetStyle('normal-mode');
735 if (editor.commands.recording)
736 editor.commands.toggleRecording(editor);
737 editor.setOverwrite(false);
738 },
739 insertMode: function(editor) {
740 this.currentMode = 'insert';
741 editor.setStyle('insert-mode');
742 editor.unsetStyle('normal-mode');
743
744 editor.setOverwrite(false);
745 editor.keyBinding.$data.buffer = "";
746 editor.keyBinding.$data.state = "insertMode";
747 this.onVisualMode = false;
748 this.onVisualLineMode = false;
749 if(this.onInsertReplaySequence) {
750 editor.commands.macro = this.onInsertReplaySequence;
751 editor.commands.replay(editor);
752 this.onInsertReplaySequence = null;
753 this.normalMode(editor);
754 } else {
755 editor._emit("changeStatus");
756 if(!editor.commands.recording)
757 editor.commands.toggleRecording(editor);
758 }
759 },
760 normalMode: function(editor) {
761 this.currentMode = 'normal';
762
763 editor.unsetStyle('insert-mode');
764 editor.setStyle('normal-mode');
765 editor.clearSelection();
766
767 var pos;
768 if (!editor.getOverwrite()) {
769 pos = editor.getCursorPosition();
770 if (pos.column > 0)
771 editor.navigateLeft();
772 }
773
774 editor.setOverwrite(true);
775 editor.keyBinding.$data.buffer = "";
776 editor.keyBinding.$data.state = "start";
777 this.onVisualMode = false;
778 this.onVisualLineMode = false;
779 editor._emit("changeStatus");
780 if (editor.commands.recording) {
781 editor.commands.toggleRecording(editor);
782 return editor.commands.macro;
783 }
784 else {
785 return [];
786 }
787 },
788 visualMode: function(editor, lineMode) {
789 if (
790 (this.onVisualLineMode && lineMode)
791 || (this.onVisualMode && !lineMode)
792 ) {
793 this.normalMode(editor);
794 return;
795 }
796
797 editor.setStyle('insert-mode');
798 editor.unsetStyle('normal-mode');
799
800 editor._emit("changeStatus");
801 if (lineMode) {
802 this.onVisualLineMode = true;
803 } else {
804 this.onVisualMode = true;
805 this.onVisualLineMode = false;
806 }
807 },
808 getRightNthChar: function(editor, cursor, ch, n) {
809 var line = editor.getSession().getLine(cursor.row);
810 var matches = line.substr(cursor.column + 1).split(ch);
811
812 return n < matches.length ? matches.slice(0, n).join(ch).length : null;
813 },
814 getLeftNthChar: function(editor, cursor, ch, n) {
815 var line = editor.getSession().getLine(cursor.row);
816 var matches = line.substr(0, cursor.column).split(ch);
817
818 return n < matches.length ? matches.slice(-1 * n).join(ch).length : null;
819 },
820 toRealChar: function(ch) {
821 if (ch.length === 1)
822 return ch;
823
824 if (/^shift-./.test(ch))
825 return ch[ch.length - 1].toUpperCase();
826 else
827 return "";
828 },
829 copyLine: function(editor) {
830 var pos = editor.getCursorPosition();
831 editor.selection.clearSelection();
832 editor.moveCursorTo(pos.row, pos.column);
833 editor.selection.selectLine();
834 registers._default.isLine = true;
835 registers._default.text = editor.getCopyText().replace(/\n$/, "");
836 editor.selection.clearSelection();
837 editor.moveCursorTo(pos.row, pos.column);
838 }
839 };
840 });
841
842 define('ace/keyboard/vim/registers', ['require', 'exports', 'module' ], function(require, exports, module) {
843
844 "never use strict";
845
846 module.exports = {
847 _default: {
848 text: "",
849 isLine: false
850 }
851 };
852
853 });
854
855
856 define('ace/keyboard/vim/maps/motions', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/search', 'ace/range'], function(require, exports, module) {
857
858
859 var util = require("./util");
860
861 var keepScrollPosition = function(editor, fn) {
862 var scrollTopRow = editor.renderer.getScrollTopRow();
863 var initialRow = editor.getCursorPosition().row;
864 var diff = initialRow - scrollTopRow;
865 fn && fn.call(editor);
866 editor.renderer.scrollToRow(editor.getCursorPosition().row - diff);
867 };
868
869 function Motion(m) {
870 if (typeof m == "function") {
871 var getPos = m;
872 m = this;
873 } else {
874 var getPos = m.getPos;
875 }
876 m.nav = function(editor, range, count, param) {
877 var a = getPos(editor, range, count, param, false);
878 if (!a)
879 return;
880 editor.clearSelection();
881 editor.moveCursorTo(a.row, a.column);
882 };
883 m.sel = function(editor, range, count, param) {
884 var a = getPos(editor, range, count, param, true);
885 if (!a)
886 return;
887 editor.selection.selectTo(a.row, a.column);
888 };
889 return m;
890 }
891
892 var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
893 var wordSeparatorRe = /[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
894 var whiteRe = /\s/;
895 var StringStream = function(editor, cursor) {
896 var sel = editor.selection;
897 this.range = sel.getRange();
898 cursor = cursor || sel.selectionLead;
899 this.row = cursor.row;
900 this.col = cursor.column;
901 var line = editor.session.getLine(this.row);
902 var maxRow = editor.session.getLength();
903 this.ch = line[this.col] || '\n';
904 this.skippedLines = 0;
905
906 this.next = function() {
907 this.ch = line[++this.col] || this.handleNewLine(1);
908 return this.ch;
909 };
910 this.prev = function() {
911 this.ch = line[--this.col] || this.handleNewLine(-1);
912 return this.ch;
913 };
914 this.peek = function(dir) {
915 var ch = line[this.col + dir];
916 if (ch)
917 return ch;
918 if (dir == -1)
919 return '\n';
920 if (this.col == line.length - 1)
921 return '\n';
922 return editor.session.getLine(this.row + 1)[0] || '\n';
923 };
924
925 this.handleNewLine = function(dir) {
926 if (dir == 1){
927 if (this.col == line.length)
928 return '\n';
929 if (this.row == maxRow - 1)
930 return '';
931 this.col = 0;
932 this.row ++;
933 line = editor.session.getLine(this.row);
934 this.skippedLines++;
935 return line[0] || '\n';
936 }
937 if (dir == -1) {
938 if (this.row === 0)
939 return '';
940 this.row --;
941 line = editor.session.getLine(this.row);
942 this.col = line.length;
943 this.skippedLines--;
944 return '\n';
945 }
946 };
947 this.debug = function() {
948 console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
949 };
950 };
951
952 var Search = require("../../../search").Search;
953 var search = new Search();
954
955 function find(editor, needle, dir) {
956 search.$options.needle = needle;
957 search.$options.backwards = dir == -1;
958 return search.find(editor.session);
959 }
960
961 var Range = require("../../../range").Range;
962
963 var LAST_SEARCH_MOTION = {};
964
965 module.exports = {
966 "w": new Motion(function(editor) {
967 var str = new StringStream(editor);
968
969 if (str.ch && wordSeparatorRe.test(str.ch)) {
970 while (str.ch && wordSeparatorRe.test(str.ch))
971 str.next();
972 } else {
973 while (str.ch && !nonWordRe.test(str.ch))
974 str.next();
975 }
976 while (str.ch && whiteRe.test(str.ch) && str.skippedLines < 2)
977 str.next();
978
979 str.skippedLines == 2 && str.prev();
980 return {column: str.col, row: str.row};
981 }),
982 "W": new Motion(function(editor) {
983 var str = new StringStream(editor);
984 while(str.ch && !(whiteRe.test(str.ch) && !whiteRe.test(str.peek(1))) && str.skippedLines < 2)
985 str.next();
986 if (str.skippedLines == 2)
987 str.prev();
988 else
989 str.next();
990
991 return {column: str.col, row: str.row};
992 }),
993 "b": new Motion(function(editor) {
994 var str = new StringStream(editor);
995
996 str.prev();
997 while (str.ch && whiteRe.test(str.ch) && str.skippedLines > -2)
998 str.prev();
999
1000 if (str.ch && wordSeparatorRe.test(str.ch)) {
1001 while (str.ch && wordSeparatorRe.test(str.ch))
1002 str.prev();
1003 } else {
1004 while (str.ch && !nonWordRe.test(str.ch))
1005 str.prev();
1006 }
1007 str.ch && str.next();
1008 return {column: str.col, row: str.row};
1009 }),
1010 "B": new Motion(function(editor) {
1011 var str = new StringStream(editor);
1012 str.prev();
1013 while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
1014 str.prev();
1015
1016 if (str.skippedLines == -2)
1017 str.next();
1018
1019 return {column: str.col, row: str.row};
1020 }),
1021 "e": new Motion(function(editor) {
1022 var str = new StringStream(editor);
1023
1024 str.next();
1025 while (str.ch && whiteRe.test(str.ch))
1026 str.next();
1027
1028 if (str.ch && wordSeparatorRe.test(str.ch)) {
1029 while (str.ch && wordSeparatorRe.test(str.ch))
1030 str.next();
1031 } else {
1032 while (str.ch && !nonWordRe.test(str.ch))
1033 str.next();
1034 }
1035 str.ch && str.prev();
1036 return {column: str.col, row: str.row};
1037 }),
1038 "E": new Motion(function(editor) {
1039 var str = new StringStream(editor);
1040 str.next();
1041 while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(1))))
1042 str.next();
1043
1044 return {column: str.col, row: str.row};
1045 }),
1046
1047 "l": {
1048 nav: function(editor) {
1049 var pos = editor.getCursorPosition();
1050 var col = pos.column;
1051 var lineLen = editor.session.getLine(pos.row).length;
1052 if (lineLen && col !== lineLen)
1053 editor.navigateRight();
1054 },
1055 sel: function(editor) {
1056 var pos = editor.getCursorPosition();
1057 var col = pos.column;
1058 var lineLen = editor.session.getLine(pos.row).length;
1059 if (lineLen && col !== lineLen) //In selection mode you can select the newline
1060 editor.selection.selectRight();
1061 }
1062 },
1063 "h": {
1064 nav: function(editor) {
1065 var pos = editor.getCursorPosition();
1066 if (pos.column > 0)
1067 editor.navigateLeft();
1068 },
1069 sel: function(editor) {
1070 var pos = editor.getCursorPosition();
1071 if (pos.column > 0)
1072 editor.selection.selectLeft();
1073 }
1074 },
1075 "H": {
1076 nav: function(editor) {
1077 var row = editor.renderer.getScrollTopRow();
1078 editor.moveCursorTo(row);
1079 },
1080 sel: function(editor) {
1081 var row = editor.renderer.getScrollTopRow();
1082 editor.selection.selectTo(row);
1083 }
1084 },
1085 "M": {
1086 nav: function(editor) {
1087 var topRow = editor.renderer.getScrollTopRow();
1088 var bottomRow = editor.renderer.getScrollBottomRow();
1089 var row = topRow + ((bottomRow - topRow) / 2);
1090 editor.moveCursorTo(row);
1091 },
1092 sel: function(editor) {
1093 var topRow = editor.renderer.getScrollTopRow();
1094 var bottomRow = editor.renderer.getScrollBottomRow();
1095 var row = topRow + ((bottomRow - topRow) / 2);
1096 editor.selection.selectTo(row);
1097 }
1098 },
1099 "L": {
1100 nav: function(editor) {
1101 var row = editor.renderer.getScrollBottomRow();
1102 editor.moveCursorTo(row);
1103 },
1104 sel: function(editor) {
1105 var row = editor.renderer.getScrollBottomRow();
1106 editor.selection.selectTo(row);
1107 }
1108 },
1109 "k": {
1110 nav: function(editor) {
1111 editor.navigateUp();
1112 },
1113 sel: function(editor) {
1114 editor.selection.selectUp();
1115 }
1116 },
1117 "j": {
1118 nav: function(editor) {
1119 editor.navigateDown();
1120 },
1121 sel: function(editor) {
1122 editor.selection.selectDown();
1123 }
1124 },
1125
1126 "i": {
1127 param: true,
1128 sel: function(editor, range, count, param) {
1129 switch (param) {
1130 case "w":
1131 editor.selection.selectWord();
1132 break;
1133 case "W":
1134 editor.selection.selectAWord();
1135 break;
1136 case "(":
1137 case "{":
1138 case "[":
1139 var cursor = editor.getCursorPosition();
1140 var end = editor.session.$findClosingBracket(param, cursor, /paren/);
1141 if (!end)
1142 return;
1143 var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
1144 if (!start)
1145 return;
1146 start.column ++;
1147 editor.selection.setSelectionRange(Range.fromPoints(start, end));
1148 break;
1149 case "'":
1150 case '"':
1151 case "/":
1152 var end = find(editor, param, 1);
1153 if (!end)
1154 return;
1155 var start = find(editor, param, -1);
1156 if (!start)
1157 return;
1158 editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start));
1159 break;
1160 }
1161 }
1162 },
1163 "a": {
1164 param: true,
1165 sel: function(editor, range, count, param) {
1166 switch (param) {
1167 case "w":
1168 editor.selection.selectAWord();
1169 break;
1170 case "W":
1171 editor.selection.selectAWord();
1172 break;
1173 case "(":
1174 case "{":
1175 case "[":
1176 var cursor = editor.getCursorPosition();
1177 var end = editor.session.$findClosingBracket(param, cursor, /paren/);
1178 if (!end)
1179 return;
1180 var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
1181 if (!start)
1182 return;
1183 end.column ++;
1184 editor.selection.setSelectionRange(Range.fromPoints(start, end));
1185 break;
1186 case "'":
1187 case "\"":
1188 case "/":
1189 var end = find(editor, param, 1);
1190 if (!end)
1191 return;
1192 var start = find(editor, param, -1);
1193 if (!start)
1194 return;
1195 end.column ++;
1196 editor.selection.setSelectionRange(Range.fromPoints(start.start, end.end));
1197 break;
1198 }
1199 }
1200 },
1201
1202 "f": new Motion({
1203 param: true,
1204 handlesCount: true,
1205 getPos: function(editor, range, count, param, isSel, isRepeat) {
1206 if (!isRepeat)
1207 LAST_SEARCH_MOTION = {ch: "f", param: param};
1208 var cursor = editor.getCursorPosition();
1209 var column = util.getRightNthChar(editor, cursor, param, count || 1);
1210
1211 if (typeof column === "number") {
1212 cursor.column += column + (isSel ? 2 : 1);
1213 return cursor;
1214 }
1215 }
1216 }),
1217 "F": new Motion({
1218 param: true,
1219 handlesCount: true,
1220 getPos: function(editor, range, count, param, isSel, isRepeat) {
1221 if (!isRepeat)
1222 LAST_SEARCH_MOTION = {ch: "F", param: param};
1223 var cursor = editor.getCursorPosition();
1224 var column = util.getLeftNthChar(editor, cursor, param, count || 1);
1225
1226 if (typeof column === "number") {
1227 cursor.column -= column + 1;
1228 return cursor;
1229 }
1230 }
1231 }),
1232 "t": new Motion({
1233 param: true,
1234 handlesCount: true,
1235 getPos: function(editor, range, count, param, isSel, isRepeat) {
1236 if (!isRepeat)
1237 LAST_SEARCH_MOTION = {ch: "t", param: param};
1238 var cursor = editor.getCursorPosition();
1239 var column = util.getRightNthChar(editor, cursor, param, count || 1);
1240
1241 if (isRepeat && column == 0 && !(count > 1))
1242 var column = util.getRightNthChar(editor, cursor, param, 2);
1243
1244 if (typeof column === "number") {
1245 cursor.column += column + (isSel ? 1 : 0);
1246 return cursor;
1247 }
1248 }
1249 }),
1250 "T": new Motion({
1251 param: true,
1252 handlesCount: true,
1253 getPos: function(editor, range, count, param, isSel, isRepeat) {
1254 if (!isRepeat)
1255 LAST_SEARCH_MOTION = {ch: "T", param: param};
1256 var cursor = editor.getCursorPosition();
1257 var column = util.getLeftNthChar(editor, cursor, param, count || 1);
1258
1259 if (isRepeat && column == 0 && !(count > 1))
1260 var column = util.getLeftNthChar(editor, cursor, param, 2);
1261
1262 if (typeof column === "number") {
1263 cursor.column -= column;
1264 return cursor;
1265 }
1266 }
1267 }),
1268 ";": new Motion({
1269 handlesCount: true,
1270 getPos: function(editor, range, count, param, isSel) {
1271 var ch = LAST_SEARCH_MOTION.ch;
1272 if (!ch)
1273 return;
1274 return module.exports[ch].getPos(
1275 editor, range, count, LAST_SEARCH_MOTION.param, isSel, true
1276 );
1277 }
1278 }),
1279 ",": new Motion({
1280 handlesCount: true,
1281 getPos: function(editor, range, count, param, isSel) {
1282 var ch = LAST_SEARCH_MOTION.ch;
1283 if (!ch)
1284 return;
1285 var up = ch.toUpperCase();
1286 ch = ch === up ? ch.toLowerCase() : up;
1287
1288 return module.exports[ch].getPos(
1289 editor, range, count, LAST_SEARCH_MOTION.param, isSel, true
1290 );
1291 }
1292 }),
1293
1294 "^": {
1295 nav: function(editor) {
1296 editor.navigateLineStart();
1297 },
1298 sel: function(editor) {
1299 editor.selection.selectLineStart();
1300 }
1301 },
1302 "$": {
1303 nav: function(editor) {
1304 editor.navigateLineEnd();
1305 },
1306 sel: function(editor) {
1307 editor.selection.selectLineEnd();
1308 }
1309 },
1310 "0": new Motion(function(ed) {
1311 return {row: ed.selection.lead.row, column: 0};
1312 }),
1313 "G": {
1314 nav: function(editor, range, count, param) {
1315 if (!count && count !== 0) { // Stupid JS
1316 count = editor.session.getLength();
1317 }
1318 editor.gotoLine(count);
1319 },
1320 sel: function(editor, range, count, param) {
1321 if (!count && count !== 0) { // Stupid JS
1322 count = editor.session.getLength();
1323 }
1324 editor.selection.selectTo(count, 0);
1325 }
1326 },
1327 "g": {
1328 param: true,
1329 nav: function(editor, range, count, param) {
1330 switch(param) {
1331 case "m":
1332 console.log("Middle line");
1333 break;
1334 case "e":
1335 console.log("End of prev word");
1336 break;
1337 case "g":
1338 editor.gotoLine(count || 0);
1339 case "u":
1340 editor.gotoLine(count || 0);
1341 case "U":
1342 editor.gotoLine(count || 0);
1343 }
1344 },
1345 sel: function(editor, range, count, param) {
1346 switch(param) {
1347 case "m":
1348 console.log("Middle line");
1349 break;
1350 case "e":
1351 console.log("End of prev word");
1352 break;
1353 case "g":
1354 editor.selection.selectTo(count || 0, 0);
1355 }
1356 }
1357 },
1358 "o": {
1359 nav: function(editor, range, count, param) {
1360 count = count || 1;
1361 var content = "";
1362 while (0 < count--)
1363 content += "\n";
1364
1365 if (content.length) {
1366 editor.navigateLineEnd()
1367 editor.insert(content);
1368 util.insertMode(editor);
1369 }
1370 }
1371 },
1372 "O": {
1373 nav: function(editor, range, count, param) {
1374 var row = editor.getCursorPosition().row;
1375 count = count || 1;
1376 var content = "";
1377 while (0 < count--)
1378 content += "\n";
1379
1380 if (content.length) {
1381 if(row > 0) {
1382 editor.navigateUp();
1383 editor.navigateLineEnd()
1384 editor.insert(content);
1385 } else {
1386 editor.session.insert({row: 0, column: 0}, content);
1387 editor.navigateUp();
1388 }
1389 util.insertMode(editor);
1390 }
1391 }
1392 },
1393 "%": new Motion(function(editor){
1394 var brRe = /[\[\]{}()]/g;
1395 var cursor = editor.getCursorPosition();
1396 var ch = editor.session.getLine(cursor.row)[cursor.column];
1397 if (!brRe.test(ch)) {
1398 var range = find(editor, brRe);
1399 if (!range)
1400 return;
1401 cursor = range.start;
1402 }
1403 var match = editor.session.findMatchingBracket({
1404 row: cursor.row,
1405 column: cursor.column + 1
1406 });
1407
1408 return match;
1409 }),
1410 "{": new Motion(function(ed) {
1411 var session = ed.session;
1412 var row = session.selection.lead.row;
1413 while(row > 0 && !/\S/.test(session.getLine(row)))
1414 row--;
1415 while(/\S/.test(session.getLine(row)))
1416 row--;
1417 return {column: 0, row: row};
1418 }),
1419 "}": new Motion(function(ed) {
1420 var session = ed.session;
1421 var l = session.getLength();
1422 var row = session.selection.lead.row;
1423 while(row < l && !/\S/.test(session.getLine(row)))
1424 row++;
1425 while(/\S/.test(session.getLine(row)))
1426 row++;
1427 return {column: 0, row: row};
1428 }),
1429 "ctrl-d": {
1430 nav: function(editor, range, count, param) {
1431 editor.selection.clearSelection();
1432 keepScrollPosition(editor, editor.gotoPageDown);
1433 },
1434 sel: function(editor, range, count, param) {
1435 keepScrollPosition(editor, editor.selectPageDown);
1436 }
1437 },
1438 "ctrl-u": {
1439 nav: function(editor, range, count, param) {
1440 editor.selection.clearSelection();
1441 keepScrollPosition(editor, editor.gotoPageUp);
1442 },
1443 sel: function(editor, range, count, param) {
1444 keepScrollPosition(editor, editor.selectPageUp);
1445 }
1446 },
1447 "`": new Motion({
1448 param: true,
1449 handlesCount: true,
1450 getPos: function(editor, range, count, param, isSel) {
1451 var s = editor.session;
1452 var marker = s.vimMarkers && s.vimMarkers[param];
1453 if (marker) {
1454 return marker.getPosition();
1455 }
1456 }
1457 }),
1458 "'": new Motion({
1459 param: true,
1460 handlesCount: true,
1461 getPos: function(editor, range, count, param, isSel) {
1462 var s = editor.session;
1463 var marker = s.vimMarkers && s.vimMarkers[param];
1464 if (marker) {
1465 var pos = marker.getPosition();
1466 var line = editor.session.getLine(pos.row);
1467 pos.column = line.search(/\S/);
1468 if (pos.column == -1)
1469 pos.column = line.length;
1470 return pos;
1471 }
1472 }
1473 })
1474 };
1475
1476 module.exports.backspace = module.exports.left = module.exports.h;
1477 module.exports.space = module.exports['return'] = module.exports.right = module.exports.l;
1478 module.exports.up = module.exports.k;
1479 module.exports.down = module.exports.j;
1480 module.exports.pagedown = module.exports["ctrl-d"];
1481 module.exports.pageup = module.exports["ctrl-u"];
1482
1483 });
1484
1485 define('ace/keyboard/vim/maps/operators', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/registers'], function(require, exports, module) {
1486
1487
1488
1489 var util = require("./util");
1490 var registers = require("../registers");
1491
1492 module.exports = {
1493 "d": {
1494 selFn: function(editor, range, count, param) {
1495 registers._default.text = editor.getCopyText();
1496 registers._default.isLine = util.onVisualLineMode;
1497 if(util.onVisualLineMode)
1498 editor.removeLines();
1499 else
1500 editor.session.remove(range);
1501 util.normalMode(editor);
1502 },
1503 fn: function(editor, range, count, param) {
1504 count = count || 1;
1505 switch (param) {
1506 case "d":
1507 registers._default.text = "";
1508 registers._default.isLine = true;
1509 for (var i = 0; i < count; i++) {
1510 editor.selection.selectLine();
1511 registers._default.text += editor.getCopyText();
1512 var selRange = editor.getSelectionRange();
1513 if (!selRange.isMultiLine()) {
1514 var row = selRange.start.row - 1;
1515 var col = editor.session.getLine(row).length
1516 selRange.setStart(row, col);
1517 editor.session.remove(selRange);
1518 editor.selection.clearSelection();
1519 break;
1520 }
1521 editor.session.remove(selRange);
1522 editor.selection.clearSelection();
1523 }
1524 registers._default.text = registers._default.text.replace(/\n$/, "");
1525 break;
1526 default:
1527 if (range) {
1528 editor.selection.setSelectionRange(range);
1529 registers._default.text = editor.getCopyText();
1530 registers._default.isLine = false;
1531 editor.session.remove(range);
1532 editor.selection.clearSelection();
1533 }
1534 }
1535 }
1536 },
1537 "c": {
1538 selFn: function(editor, range, count, param) {
1539 editor.session.remove(range);
1540 util.insertMode(editor);
1541 },
1542 fn: function(editor, range, count, param) {
1543 count = count || 1;
1544 switch (param) {
1545 case "c":
1546 for (var i = 0; i < count; i++) {
1547 editor.removeLines();
1548 util.insertMode(editor);
1549 }
1550
1551 break;
1552 default:
1553 if (range) {
1554 editor.session.remove(range);
1555 util.insertMode(editor);
1556 }
1557 }
1558 }
1559 },
1560 "y": {
1561 selFn: function(editor, range, count, param) {
1562 registers._default.text = editor.getCopyText();
1563 registers._default.isLine = util.onVisualLineMode;
1564 editor.selection.clearSelection();
1565 util.normalMode(editor);
1566 },
1567 fn: function(editor, range, count, param) {
1568 count = count || 1;
1569 switch (param) {
1570 case "y":
1571 var pos = editor.getCursorPosition();
1572 editor.selection.selectLine();
1573 for (var i = 0; i < count - 1; i++) {
1574 editor.selection.moveCursorDown();
1575 }
1576 registers._default.text = editor.getCopyText().replace(/\n$/, "");
1577 editor.selection.clearSelection();
1578 registers._default.isLine = true;
1579 editor.moveCursorToPosition(pos);
1580 break;
1581 default:
1582 if (range) {
1583 var pos = editor.getCursorPosition();
1584 editor.selection.setSelectionRange(range);
1585 registers._default.text = editor.getCopyText();
1586 registers._default.isLine = false;
1587 editor.selection.clearSelection();
1588 editor.moveCursorTo(pos.row, pos.column);
1589 }
1590 }
1591 }
1592 },
1593 ">": {
1594 selFn: function(editor, range, count, param) {
1595 count = count || 1;
1596 for (var i = 0; i < count; i++) {
1597 editor.indent();
1598 }
1599 util.normalMode(editor);
1600 },
1601 fn: function(editor, range, count, param) {
1602 count = parseInt(count || 1, 10);
1603 switch (param) {
1604 case ">":
1605 var pos = editor.getCursorPosition();
1606 editor.selection.selectLine();
1607 for (var i = 0; i < count - 1; i++) {
1608 editor.selection.moveCursorDown();
1609 }
1610 editor.indent();
1611 editor.selection.clearSelection();
1612 editor.moveCursorToPosition(pos);
1613 editor.navigateLineEnd();
1614 editor.navigateLineStart();
1615 break;
1616 }
1617 }
1618 },
1619 "<": {
1620 selFn: function(editor, range, count, param) {
1621 count = count || 1;
1622 for (var i = 0; i < count; i++) {
1623 editor.blockOutdent();
1624 }
1625 util.normalMode(editor);
1626 },
1627 fn: function(editor, range, count, param) {
1628 count = count || 1;
1629 switch (param) {
1630 case "<":
1631 var pos = editor.getCursorPosition();
1632 editor.selection.selectLine();
1633 for (var i = 0; i < count - 1; i++) {
1634 editor.selection.moveCursorDown();
1635 }
1636 editor.blockOutdent();
1637 editor.selection.clearSelection();
1638 editor.moveCursorToPosition(pos);
1639 editor.navigateLineEnd();
1640 editor.navigateLineStart();
1641 break;
1642 }
1643 }
1644 }
1645 };
1646 });
1647
1648 "use strict"
1649
1650 define('ace/keyboard/vim/maps/aliases', ['require', 'exports', 'module' ], function(require, exports, module) {
1651 module.exports = {
1652 "x": {
1653 operator: {
1654 ch: "d",
1655 count: 1
1656 },
1657 motion: {
1658 ch: "l",
1659 count: 1
1660 }
1661 },
1662 "X": {
1663 operator: {
1664 ch: "d",
1665 count: 1
1666 },
1667 motion: {
1668 ch: "h",
1669 count: 1
1670 }
1671 },
1672 "D": {
1673 operator: {
1674 ch: "d",
1675 count: 1
1676 },
1677 motion: {
1678 ch: "$",
1679 count: 1
1680 }
1681 },
1682 "C": {
1683 operator: {
1684 ch: "c",
1685 count: 1
1686 },
1687 motion: {
1688 ch: "$",
1689 count: 1
1690 }
1691 },
1692 "s": {
1693 operator: {
1694 ch: "c",
1695 count: 1
1696 },
1697 motion: {
1698 ch: "l",
1699 count: 1
1700 }
1701 },
1702 "S": {
1703 operator: {
1704 ch: "c",
1705 count: 1
1706 },
1707 param: "c"
1708 }
1709 };
1710 });
1711
+0
-260
try/ace/mode-abap.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/abap', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/abap_highlight_rules', 'ace/mode/folding/coffee', 'ace/range', 'ace/mode/text', 'ace/lib/oop'], function(require, exports, module) {
31
32
33 var Tokenizer = require("../tokenizer").Tokenizer;
34 var Rules = require("./abap_highlight_rules").AbapHighlightRules;
35 var FoldMode = require("./folding/coffee").FoldMode;
36 var Range = require("../range").Range;
37 var TextMode = require("./text").Mode;
38 var oop = require("../lib/oop");
39
40 function Mode() {
41 this.$tokenizer = new Tokenizer(new Rules().getRules());
42 this.foldingRules = new FoldMode();
43 }
44
45 oop.inherits(Mode, TextMode);
46
47 (function() {
48
49 this.getNextLineIndent = function(state, line, tab) {
50 var indent = this.$getIndent(line);
51 return indent;
52 };
53
54 this.toggleCommentLines = function(state, doc, startRow, endRow){
55 var range = new Range(0, 0, 0, 0);
56 for (var i = startRow; i <= endRow; ++i) {
57 var line = doc.getLine(i);
58 if (hereComment.test(line))
59 continue;
60
61 if (commentLine.test(line))
62 line = line.replace(commentLine, '$1');
63 else
64 line = line.replace(indentation, '$&#');
65
66 range.end.row = range.start.row = i;
67 range.end.column = line.length + 1;
68 doc.replace(range, line);
69 }
70 };
71
72 }).call(Mode.prototype);
73
74 exports.Mode = Mode;
75
76 });
77
78 define('ace/mode/abap_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
79
80
81 var oop = require("../lib/oop");
82 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
83
84 var AbapHighlightRules = function() {
85
86 var keywordMapper = this.createKeywordMapper({
87 "variable.language": "this",
88 "keyword":
89 "ADD ALIAS ALIASES ASSERT ASSIGN ASSIGNING AT BACK" +
90 " CALL CASE CATCH CHECK CLASS CLEAR CLOSE CNT COLLECT COMMIT COMMUNICATION COMPUTE CONCATENATE CONDENSE CONSTANTS CONTINUE CONTROLS CONVERT CREATE CURRENCY" +
91 " DATA DEFINE DEFINITION DEFERRED DELETE DESCRIBE DETAIL DIVIDE DO" +
92 " ELSE ELSEIF ENDAT ENDCASE ENDCLASS ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY ENDWHILE EVENT EVENTS EXEC EXIT EXPORT EXPORTING EXTRACT" +
93 " FETCH FIELDS FORM FORMAT FREE FROM FUNCTION" +
94 " GENERATE GET" +
95 " HIDE" +
96 " IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION" +
97 " LEAVE LIKE LINE LOAD LOCAL LOOP" +
98 " MESSAGE METHOD METHODS MODIFY MODULE MOVE MULTIPLY" +
99 " ON OVERLAY OPTIONAL OTHERS" +
100 " PACK PARAMETERS PERFORM POSITION PROGRAM PROVIDE PUT" +
101 " RAISE RANGES READ RECEIVE RECEIVING REDEFINITION REFERENCE REFRESH REJECT REPLACE REPORT RESERVE RESTORE RETURNING ROLLBACK" +
102 " SCAN SCROLL SEARCH SELECT SET SHIFT SKIP SORT SORTED SPLIT STANDARD STATICS STEP STOP SUBMIT SUBTRACT SUM SUMMARY SUPPRESS" +
103 " TABLES TIMES TRANSFER TRANSLATE TRY TYPE TYPES" +
104 " UNASSIGN ULINE UNPACK UPDATE" +
105 " WHEN WHILE WINDOW WRITE" +
106 " OCCURS STRUCTURE OBJECT PROPERTY" +
107 " CASTING APPEND RAISING VALUE COLOR" +
108 " CHANGING EXCEPTION EXCEPTIONS DEFAULT CHECKBOX COMMENT" +
109 " ID NUMBER FOR TITLE OUTPUT" +
110 " WITH EXIT USING" +
111 " INTO WHERE GROUP BY HAVING ORDER BY SINGLE" +
112 " APPENDING CORRESPONDING FIELDS OF TABLE" +
113 " LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER UP TO ROWS CONNECTING" +
114 " EQ NE LT LE GT GE NOT AND OR XOR IN LIKE BETWEEN",
115 "constant.language":
116 "TRUE FALSE NULL SPACE",
117 "support.type":
118 "c n i p f d t x string xstring decfloat16 decfloat34",
119 "keyword.operator":
120 "abs sign ceil floor trunc frac acos asin atan cos sin tan" +
121 " abapOperator cosh sinh tanh exp log log10 sqrt" +
122 " strlen xstrlen charlen numofchar dbmaxlen lines"
123 }, "text", true, " ");
124
125 var compoundKeywords = "WITH\\W+(?:HEADER\\W+LINE|FRAME|KEY)|NO\\W+STANDARD\\W+PAGE\\W+HEADING|"+
126 "EXIT\\W+FROM\\W+STEP\\W+LOOP|BEGIN\\W+OF\\W+(?:BLOCK|LINE)|BEGIN\\W+OF|"+
127 "END\\W+OF\\W+(?:BLOCK|LINE)|END\\W+OF|NO\\W+INTERVALS|"+
128 "RESPECTING\\W+BLANKS|SEPARATED\\W+BY|USING\\W+(?:EDIT\\W+MASK)|"+
129 "WHERE\\W+(?:LINE)|RADIOBUTTON\\W+GROUP|REF\\W+TO|"+
130 "(?:PUBLIC|PRIVATE|PROTECTED)(?:\\W+SECTION)?|DELETING\\W+(?:TRAILING|LEADING)"+
131 "(?:ALL\\W+OCCURRENCES)|(?:FIRST|LAST)\\W+OCCURRENCE|INHERITING\\W+FROM|"+
132 "LINE-COUNT|ADD-CORRESPONDING|AUTHORITY-CHECK|BREAK-POINT|CLASS-DATA|CLASS-METHODS|"+
133 "CLASS-METHOD|DIVIDE-CORRESPONDING|EDITOR-CALL|END-OF-DEFINITION|END-OF-PAGE|END-OF-SELECTION|"+
134 "FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|NEW-LINE|"+
135 "NEW-PAGE|NEW-SECTION|PRINT-CONTROL|RP-PROVIDE-FROM-LAST|SELECT-OPTIONS|SELECTION-SCREEN|"+
136 "START-OF-SELECTION|SUBTRACT-CORRESPONDING|SYNTAX-CHECK|SYNTAX-TRACE|TOP-OF-PAGE|TYPE-POOL|"+
137 "TYPE-POOLS|LINE-SIZE|LINE-COUNT|MESSAGE-ID|DISPLAY-MODE|READ(?:-ONLY)?|"+
138 "IS\\W+(?:NOT\\W+)?(?:ASSIGNED|BOUND|INITIAL|SUPPLIED)";
139
140 this.$rules = {
141 "start" : [
142 {token : "string", regex : "`", next : "string"},
143 {token : "string", regex : "'", next : "qstring"},
144 {token : "doc.comment", regex : /^\*.+/},
145 {token : "comment", regex : /".+$/},
146 {token : "invalid", regex: "\\.{2,}"},
147 {token : "keyword.operator", regex: /\W[\-+\%=<>*]\W|\*\*|[~:,\.&$]|->*?|=>/},
148 {token : "paren.lparen", regex : "[\\[({]"},
149 {token : "paren.rparen", regex : "[\\])}]"},
150 {token : "constant.numeric", regex: "[+-]?\\d+\\b"},
151 {token : "variable.parameter", regex : /sy|pa?\d\d\d\d\|t\d\d\d\.|innnn/},
152 {token : "keyword", regex : compoundKeywords},
153 {token : "variable.parameter", regex : /\w+-\w+(?:-\w+)*/},
154 {token : keywordMapper, regex : "\\b\\w+\\b"},
155 {caseInsensitive: true}
156 ],
157 "qstring" : [
158 {token : "constant.language.escape", regex : "''"},
159 {token : "string", regex : "'", next : "start"},
160 {defaultToken : "string"}
161 ],
162 "string" : [
163 {token : "constant.language.escape", regex : "``"},
164 {token : "string", regex : "`", next : "start"},
165 {defaultToken : "string"}
166 ]
167 }
168 };
169 oop.inherits(AbapHighlightRules, TextHighlightRules);
170
171 exports.AbapHighlightRules = AbapHighlightRules;
172 });
173
174 define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
175
176
177 var oop = require("../../lib/oop");
178 var BaseFoldMode = require("./fold_mode").FoldMode;
179 var Range = require("../../range").Range;
180
181 var FoldMode = exports.FoldMode = function() {};
182 oop.inherits(FoldMode, BaseFoldMode);
183
184 (function() {
185
186 this.getFoldWidgetRange = function(session, foldStyle, row) {
187 var range = this.indentationBlock(session, row);
188 if (range)
189 return range;
190
191 var re = /\S/;
192 var line = session.getLine(row);
193 var startLevel = line.search(re);
194 if (startLevel == -1 || line[startLevel] != "#")
195 return;
196
197 var startColumn = line.length;
198 var maxRow = session.getLength();
199 var startRow = row;
200 var endRow = row;
201
202 while (++row < maxRow) {
203 line = session.getLine(row);
204 var level = line.search(re);
205
206 if (level == -1)
207 continue;
208
209 if (line[level] != "#")
210 break;
211
212 endRow = row;
213 }
214
215 if (endRow > startRow) {
216 var endColumn = session.getLine(endRow).length;
217 return new Range(startRow, startColumn, endRow, endColumn);
218 }
219 };
220 this.getFoldWidget = function(session, foldStyle, row) {
221 var line = session.getLine(row);
222 var indent = line.search(/\S/);
223 var next = session.getLine(row + 1);
224 var prev = session.getLine(row - 1);
225 var prevIndent = prev.search(/\S/);
226 var nextIndent = next.search(/\S/);
227
228 if (indent == -1) {
229 session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
230 return "";
231 }
232 if (prevIndent == -1) {
233 if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
234 session.foldWidgets[row - 1] = "";
235 session.foldWidgets[row + 1] = "";
236 return "start";
237 }
238 } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
239 if (session.getLine(row - 2).search(/\S/) == -1) {
240 session.foldWidgets[row - 1] = "start";
241 session.foldWidgets[row + 1] = "";
242 return "";
243 }
244 }
245
246 if (prevIndent!= -1 && prevIndent < indent)
247 session.foldWidgets[row - 1] = "start";
248 else
249 session.foldWidgets[row - 1] = "";
250
251 if (indent < nextIndent)
252 return "start";
253 else
254 return "";
255 };
256
257 }).call(FoldMode.prototype);
258
259 });
+0
-117
try/ace/mode-ada.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/ada', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ada_highlight_rules', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules;
37 var Range = require("../range").Range;
38
39 var Mode = function() {
40 this.$tokenizer = new Tokenizer(new AdaHighlightRules().getRules());
41 };
42 oop.inherits(Mode, TextMode);
43
44 (function() {
45
46 this.lineCommentStart = "--";
47
48 }).call(Mode.prototype);
49
50 exports.Mode = Mode;
51
52 });
53
54 define('ace/mode/ada_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
55
56
57 var oop = require("../lib/oop");
58 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
59
60 var AdaHighlightRules = function() {
61 var keywords = "abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|" +
62 "access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|" +
63 "array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|" +
64 "body|private|then|if|procedure|type|case|in|protected|constant|interface|until|" +
65 "|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor";
66
67 var builtinConstants = (
68 "true|false|null"
69 );
70
71 var builtinFunctions = (
72 "count|min|max|avg|sum|rank|now|coalesce|main"
73 );
74
75 var keywordMapper = this.createKeywordMapper({
76 "support.function": builtinFunctions,
77 "keyword": keywords,
78 "constant.language": builtinConstants
79 }, "identifier", true);
80
81 this.$rules = {
82 "start" : [ {
83 token : "comment",
84 regex : "--.*$"
85 }, {
86 token : "string", // " string
87 regex : '".*?"'
88 }, {
89 token : "string", // ' string
90 regex : "'.*?'"
91 }, {
92 token : "constant.numeric", // float
93 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
94 }, {
95 token : keywordMapper,
96 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
97 }, {
98 token : "keyword.operator",
99 regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
100 }, {
101 token : "paren.lparen",
102 regex : "[\\(]"
103 }, {
104 token : "paren.rparen",
105 regex : "[\\)]"
106 }, {
107 token : "text",
108 regex : "\\s+"
109 } ]
110 };
111 };
112
113 oop.inherits(AdaHighlightRules, TextHighlightRules);
114
115 exports.AdaHighlightRules = AdaHighlightRules;
116 });
+0
-372
try/ace/mode-asciidoc.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/asciidoc', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/asciidoc_highlight_rules', 'ace/mode/folding/asciidoc'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules;
37 var AsciidocFoldMode = require("./folding/asciidoc").FoldMode;
38
39 var Mode = function() {
40 var highlighter = new AsciidocHighlightRules();
41
42 this.$tokenizer = new Tokenizer(highlighter.getRules());
43 this.foldingRules = new AsciidocFoldMode();
44 };
45 oop.inherits(Mode, TextMode);
46
47 (function() {
48 this.getNextLineIndent = function(state, line, tab) {
49 if (state == "listblock") {
50 var match = /^((?:.+)?)([-+*][ ]+)/.exec(line);
51 if (match) {
52 return new Array(match[1].length + 1).join(" ") + match[2];
53 } else {
54 return "";
55 }
56 } else {
57 return this.$getIndent(line);
58 }
59 };
60 }).call(Mode.prototype);
61
62 exports.Mode = Mode;
63 });
64
65 define('ace/mode/asciidoc_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
66
67
68 var oop = require("../lib/oop");
69 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
70
71 var AsciidocHighlightRules = function() {
72 var identifierRe = "[a-zA-Z\u00a1-\uffff]+\\b";
73
74 this.$rules = {
75 "start": [
76 {token: "empty", regex: /$/},
77 {token: "literal", regex: /^\.{4,}\s*$/, next: "listingBlock"},
78 {token: "literal", regex: /^-{4,}\s*$/, next: "literalBlock"},
79 {token: "string", regex: /^\+{4,}\s*$/, next: "passthroughBlock"},
80 {token: "keyword", regex: /^={4,}\s*$/},
81 {token: "text", regex: /^\s*$/},
82 {token: "empty", regex: "", next: "dissallowDelimitedBlock"}
83 ],
84
85 "dissallowDelimitedBlock": [
86 {include: "paragraphEnd"},
87 {token: "comment", regex: '^//.+$'},
88 {token: "keyword", regex: "^(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION):"},
89
90 {include: "listStart"},
91 {token: "literal", regex: /^\s+.+$/, next: "indentedBlock"},
92 {token: "empty", regex: "", next: "text"}
93 ],
94
95 "paragraphEnd": [
96 {token: "doc.comment", regex: /^\/{4,}\s*$/, next: "commentBlock"},
97 {token: "tableBlock", regex: /^\s*[|!]=+\s*$/, next: "tableBlock"},
98 {token: "keyword", regex: /^(?:--|''')\s*$/, next: "start"},
99 {token: "option", regex: /^\[.*\]\s*$/, next: "start"},
100 {token: "pageBreak", regex: /^>{3,}$/, next: "start"},
101 {token: "literal", regex: /^\.{4,}\s*$/, next: "listingBlock"},
102 {token: "titleUnderline", regex: /^(?:={2,}|-{2,}|~{2,}|\^{2,}|\+{2,})\s*$/, next: "start"},
103 {token: "singleLineTitle", regex: /^={1,5}\s+\S.*$/, next: "start"},
104
105 {token: "otherBlock", regex: /^(?:\*{2,}|_{2,})\s*$/, next: "start"},
106 {token: "optionalTitle", regex: /^\.[^.\s].+$/, next: "start"}
107 ],
108
109 "listStart": [
110 {token: "keyword", regex: /^\s*(?:\d+\.|[a-zA-Z]\.|[ixvmIXVM]+\)|\*{1,5}|-|\.{1,5})\s/, next: "listText"},
111 {token: "meta.tag", regex: /^.+(?::{2,4}|;;)(?: |$)/, next: "listText"},
112 {token: "support.function.list.callout", regex: /^(?:<\d+>|\d+>|>) /, next: "text"},
113 {token: "keyword", regex: /^\+\s*$/, next: "start"}
114 ],
115
116 "text": [
117 {token: ["link", "variable.language"], regex: /((?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+)(\[.*?\])/},
118 {token: "link", regex: /(?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+/},
119 {token: "link", regex: /\b[\w\.\/\-]+@[\w\.\/\-]+\b/},
120 {include: "macros"},
121 {include: "paragraphEnd"},
122 {token: "literal", regex:/\+{3,}/, next:"smallPassthrough"},
123 {token: "escape", regex: /\((?:C|TM|R)\)|\.{3}|->|<-|=>|<=|&#(?:\d+|x[a-fA-F\d]+);|(?: |^)--(?=\s+\S)/},
124 {token: "escape", regex: /\\[_*'`+#]|\\{2}[_*'`+#]{2}/},
125 {token: "keyword", regex: /\s\+$/},
126 {token: "text", regex: identifierRe},
127 {token: ["keyword", "string", "keyword"],
128 regex: /(<<[\w\d\-$]+,)(.*?)(>>|$)/},
129 {token: "keyword", regex: /<<[\w\d\-$]+,?|>>/},
130 {token: "constant.character", regex: /\({2,3}.*?\){2,3}/},
131 {token: "keyword", regex: /\[\[.+?\]\]/},
132 {token: "support", regex: /^\[{3}[\w\d =\-]+\]{3}/},
133
134 {include: "quotes"},
135 {token: "empty", regex: /^\s*$/, next: "start"}
136 ],
137
138 "listText": [
139 {include: "listStart"},
140 {include: "text"}
141 ],
142
143 "indentedBlock": [
144 {token: "literal", regex: /^[\s\w].+$/, next: "indentedBlock"},
145 {token: "literal", regex: "", next: "start"}
146 ],
147
148 "listingBlock": [
149 {token: "literal", regex: /^\.{4,}\s*$/, next: "dissallowDelimitedBlock"},
150 {token: "constant.numeric", regex: '<\\d+>'},
151 {token: "literal", regex: '[^<]+'},
152 {token: "literal", regex: '<'}
153 ],
154 "literalBlock": [
155 {token: "literal", regex: /^-{4,}\s*$/, next: "dissallowDelimitedBlock"},
156 {token: "constant.numeric", regex: '<\\d+>'},
157 {token: "literal", regex: '[^<]+'},
158 {token: "literal", regex: '<'}
159 ],
160 "passthroughBlock": [
161 {token: "literal", regex: /^\+{4,}\s*$/, next: "dissallowDelimitedBlock"},
162 {token: "literal", regex: identifierRe + "|\\d+"},
163 {include: "macros"},
164 {token: "literal", regex: "."}
165 ],
166
167 "smallPassthrough": [
168 {token: "literal", regex: /[+]{3,}/, next: "dissallowDelimitedBlock"},
169 {token: "literal", regex: /^\s*$/, next: "dissallowDelimitedBlock"},
170 {token: "literal", regex: identifierRe + "|\\d+"},
171 {include: "macros"}
172 ],
173
174 "commentBlock": [
175 {token: "doc.comment", regex: /^\/{4,}\s*$/, next: "dissallowDelimitedBlock"},
176 {token: "doc.comment", regex: '^.*$'}
177 ],
178 "tableBlock": [
179 {token: "tableBlock", regex: /^\s*\|={3,}\s*$/, next: "dissallowDelimitedBlock"},
180 {token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "innerTableBlock"},
181 {token: "tableBlock", regex: /\|/},
182 {include: "text", noEscape: true}
183 ],
184 "innerTableBlock": [
185 {token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "tableBlock"},
186 {token: "tableBlock", regex: /^\s*|={3,}\s*$/, next: "dissallowDelimitedBlock"},
187 {token: "tableBlock", regex: /\!/}
188 ],
189 "macros": [
190 {token: "macro", regex: /{[\w\-$]+}/},
191 {token: ["text", "string", "text", "constant.character", "text"], regex: /({)([\w\-$]+)(:)?(.+)?(})/},
192 {token: ["text", "markup.list.macro", "keyword", "string"], regex: /(\w+)(footnote(?:ref)?::?)([^\s\[]+)?(\[.*?\])?/},
193 {token: ["markup.list.macro", "keyword", "string"], regex: /([a-zA-Z\-][\w\.\/\-]*::?)([^\s\[]+)(\[.*?\])?/},
194 {token: ["markup.list.macro", "keyword"], regex: /([a-zA-Z\-][\w\.\/\-]+::?)(\[.*?\])/},
195 {token: "keyword", regex: /^:.+?:(?= |$)/}
196 ],
197
198 "quotes": [
199 {token: "string.italic", regex: /__[^_\s].*?__/},
200 {token: "string.italic", regex: quoteRule("_")},
201
202 {token: "keyword.bold", regex: /\*\*[^*\s].*?\*\*/},
203 {token: "keyword.bold", regex: quoteRule("\\*")},
204
205 {token: "literal", regex: quoteRule("\\+")},
206 {token: "literal", regex: /\+\+[^+\s].*?\+\+/},
207 {token: "literal", regex: /\$\$.+?\$\$/},
208 {token: "literal", regex: quoteRule("`")},
209
210 {token: "keyword", regex: quoteRule("^")},
211 {token: "keyword", regex: quoteRule("~")},
212 {token: "keyword", regex: /##?/},
213 {token: "keyword", regex: /(?:\B|^)``|\b''/}
214 ]
215
216 };
217
218 function quoteRule(ch) {
219 var prefix = /\w/.test(ch) ? "\\b" : "(?:\\B|^)";
220 return prefix + ch + "[^" + ch + "].*?" + ch + "(?![\\w*])";
221 }
222
223 var tokenMap = {
224 macro: "constant.character",
225 tableBlock: "doc.comment",
226 titleUnderline: "markup.heading",
227 singleLineTitle: "markup.heading",
228 pageBreak: "string",
229 option: "string.regexp",
230 otherBlock: "markup.list",
231 literal: "support.function",
232 optionalTitle: "constant.numeric",
233 escape: "constant.language.escape",
234 link: "markup.underline.list"
235 };
236
237 for (var state in this.$rules) {
238 var stateRules = this.$rules[state];
239 for (var i = stateRules.length; i--; ) {
240 var rule = stateRules[i];
241 if (rule.include || typeof rule == "string") {
242 var args = [i, 1].concat(this.$rules[rule.include || rule]);
243 if (rule.noEscape) {
244 args = args.filter(function(x) {
245 return !x.next;
246 });
247 }
248 stateRules.splice.apply(stateRules, args);
249 } else if (rule.token in tokenMap) {
250 rule.token = tokenMap[rule.token];
251 }
252 }
253 }
254 };
255 oop.inherits(AsciidocHighlightRules, TextHighlightRules);
256
257 exports.AsciidocHighlightRules = AsciidocHighlightRules;
258 });
259
260 define('ace/mode/folding/asciidoc', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
261
262
263 var oop = require("../../lib/oop");
264 var BaseFoldMode = require("./fold_mode").FoldMode;
265 var Range = require("../../range").Range;
266
267 var FoldMode = exports.FoldMode = function() {};
268 oop.inherits(FoldMode, BaseFoldMode);
269
270 (function() {
271 this.foldingStartMarker = /^(?:\|={10,}|[\.\/=\-~^+]{4,}\s*$|={1,5} )/;
272 this.singleLineHeadingRe = /^={1,5}(?=\s+\S)/;
273
274 this.getFoldWidget = function(session, foldStyle, row) {
275 var line = session.getLine(row);
276 if (!this.foldingStartMarker.test(line))
277 return ""
278
279 if (line[0] == "=") {
280 if (this.singleLineHeadingRe.test(line))
281 return "start";
282 if (session.getLine(row - 1).length != session.getLine(row).length)
283 return "";
284 return "start";
285 }
286 if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock")
287 return "end";
288 return "start";
289 };
290
291 this.getFoldWidgetRange = function(session, foldStyle, row) {
292 var line = session.getLine(row);
293 var startColumn = line.length;
294 var maxRow = session.getLength();
295 var startRow = row;
296 var endRow = row;
297 if (!line.match(this.foldingStartMarker))
298 return;
299
300 var token;
301 function getTokenType(row) {
302 token = session.getTokens(row)[0];
303 return token && token.type;
304 }
305
306 var levels = ["=","-","~","^","+"];
307 var heading = "markup.heading";
308 var singleLineHeadingRe = this.singleLineHeadingRe;
309 function getLevel() {
310 var match = token.value.match(singleLineHeadingRe);
311 if (match)
312 return match[0].length;
313 var level = levels.indexOf(token.value[0]) + 1;
314 if (level == 1) {
315 if (session.getLine(row - 1).length != session.getLine(row).length)
316 return Infinity;
317 }
318 return level;
319 }
320
321 if (getTokenType(row) == heading) {
322 var startHeadingLevel = getLevel();
323 while (++row < maxRow) {
324 if (getTokenType(row) != heading)
325 continue;
326 var level = getLevel();
327 if (level <= startHeadingLevel)
328 break;
329 }
330
331 var isSingleLineHeading = token && token.value.match(this.singleLineHeadingRe);
332 endRow = isSingleLineHeading ? row - 1 : row - 2;
333
334 if (endRow > startRow) {
335 while (endRow > startRow && (!getTokenType(endRow) || token.value[0] == "["))
336 endRow--;
337 }
338
339 if (endRow > startRow) {
340 var endColumn = session.getLine(endRow).length;
341 return new Range(startRow, startColumn, endRow, endColumn);
342 }
343 } else {
344 var state = session.bgTokenizer.getState(row);
345 if (state == "dissallowDelimitedBlock") {
346 while (row -- > 0) {
347 if (session.bgTokenizer.getState(row).lastIndexOf("Block") == -1)
348 break;
349 }
350 endRow = row + 1;
351 if (endRow < startRow) {
352 var endColumn = session.getLine(row).length;
353 return new Range(endRow, 5, startRow, startColumn - 5);
354 }
355 } else {
356 while (++row < maxRow) {
357 if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock")
358 break;
359 }
360 endRow = row;
361 if (endRow > startRow) {
362 var endColumn = session.getLine(row).length;
363 return new Range(startRow, 5, endRow, endColumn - 5);
364 }
365 }
366 }
367 };
368
369 }).call(FoldMode.prototype);
370
371 });
+0
-171
try/ace/mode-batchfile.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * Contributor(s):
30 *
31 *
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35 define('ace/mode/batchfile', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/batchfile_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
36
37
38 var oop = require("../lib/oop");
39 var TextMode = require("./text").Mode;
40 var Tokenizer = require("../tokenizer").Tokenizer;
41 var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules;
42 var FoldMode = require("./folding/cstyle").FoldMode;
43
44 var Mode = function() {
45 var highlighter = new BatchFileHighlightRules();
46 this.foldingRules = new FoldMode();
47 this.$tokenizer = new Tokenizer(highlighter.getRules());
48 };
49 oop.inherits(Mode, TextMode);
50
51 (function() {
52 this.lineCommentStart = "::";
53 this.blockComment = "";
54 }).call(Mode.prototype);
55
56 exports.Mode = Mode;
57 });
58
59 define('ace/mode/batchfile_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
60
61
62 var oop = require("../lib/oop");
63 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
64
65 var BatchFileHighlightRules = function() {
66
67 this.$rules = { start:
68 [ { token: 'keyword.command.dosbatch',
69 regex: '\\b(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\\b',
70 caseInsensitive: true },
71 { token: 'keyword.control.statement.dosbatch',
72 regex: '\\b(?:goto|call|exit)\\b',
73 caseInsensitive: true },
74 { token: 'keyword.control.conditional.if.dosbatch',
75 regex: '\\bif\\s+not\\s+(?:exist|defined|errorlevel|cmdextversion)\\b',
76 caseInsensitive: true },
77 { token: 'keyword.control.conditional.dosbatch',
78 regex: '\\b(?:if|else)\\b',
79 caseInsensitive: true },
80 { token: 'keyword.control.repeat.dosbatch',
81 regex: '\\bfor\\b',
82 caseInsensitive: true },
83 { token: 'keyword.operator.dosbatch',
84 regex: '\\b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\\b' },
85 { token: ['doc.comment', 'comment'],
86 regex: '(?:^|\\b)(rem)($|\\s.*$)',
87 caseInsensitive: true },
88 { token: 'comment.line.colons.dosbatch',
89 regex: '::.*$' },
90 { include: 'variable' },
91 { token: 'punctuation.definition.string.begin.shell',
92 regex: '"',
93 push: [
94 { token: 'punctuation.definition.string.end.shell', regex: '"', next: 'pop' },
95 { include: 'variable' },
96 { defaultToken: 'string.quoted.double.dosbatch' } ] },
97 { token: 'keyword.operator.pipe.dosbatch', regex: '[|]' },
98 { token: 'keyword.operator.redirect.shell',
99 regex: '&>|\\d*>&\\d*|\\d*(?:>>|>|<)|\\d*<&|\\d*<>' } ],
100 variable: [
101 { token: 'constant.numeric', regex: '%%\\w+'},
102 { token: ['markup.list', 'constant.other', 'markup.list'],
103 regex: '(%)(\\w+)(%?)' }]}
104
105 this.normalizeRules();
106 };
107
108 BatchFileHighlightRules.metaData = { name: 'Batch File',
109 scopeName: 'source.dosbatch',
110 fileTypes: [ 'bat' ] }
111
112
113 oop.inherits(BatchFileHighlightRules, TextHighlightRules);
114
115 exports.BatchFileHighlightRules = BatchFileHighlightRules;
116 });
117
118 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
119
120
121 var oop = require("../../lib/oop");
122 var Range = require("../../range").Range;
123 var BaseFoldMode = require("./fold_mode").FoldMode;
124
125 var FoldMode = exports.FoldMode = function(commentRegex) {
126 if (commentRegex) {
127 this.foldingStartMarker = new RegExp(
128 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
129 );
130 this.foldingStopMarker = new RegExp(
131 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
132 );
133 }
134 };
135 oop.inherits(FoldMode, BaseFoldMode);
136
137 (function() {
138
139 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
140 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
141
142 this.getFoldWidgetRange = function(session, foldStyle, row) {
143 var line = session.getLine(row);
144 var match = line.match(this.foldingStartMarker);
145 if (match) {
146 var i = match.index;
147
148 if (match[1])
149 return this.openingBracketBlock(session, match[1], row, i);
150
151 return session.getCommentFoldRange(row, i + match[0].length, 1);
152 }
153
154 if (foldStyle !== "markbeginend")
155 return;
156
157 var match = line.match(this.foldingStopMarker);
158 if (match) {
159 var i = match.index + match[0].length;
160
161 if (match[1])
162 return this.closingBracketBlock(session, match[1], row, i);
163
164 return session.getCommentFoldRange(row, i, -1);
165 }
166 };
167
168 }).call(FoldMode.prototype);
169
170 });
+0
-182
try/ace/mode-c9search.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/c9search', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/c9search_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/c9search'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules;
37 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38 var C9StyleFoldMode = require("./folding/c9search").FoldMode;
39
40 var Mode = function() {
41 this.$tokenizer = new Tokenizer(new C9SearchHighlightRules().getRules());
42 this.$outdent = new MatchingBraceOutdent();
43 this.foldingRules = new C9StyleFoldMode();
44 };
45 oop.inherits(Mode, TextMode);
46
47 (function() {
48
49 this.getNextLineIndent = function(state, line, tab) {
50 var indent = this.$getIndent(line);
51 return indent;
52 };
53
54 this.checkOutdent = function(state, line, input) {
55 return this.$outdent.checkOutdent(line, input);
56 };
57
58 this.autoOutdent = function(state, doc, row) {
59 this.$outdent.autoOutdent(doc, row);
60 };
61
62 }).call(Mode.prototype);
63
64 exports.Mode = Mode;
65
66 });
67
68 define('ace/mode/c9search_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
69
70
71 var oop = require("../lib/oop");
72 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
73
74 var C9SearchHighlightRules = function() {
75 this.$rules = {
76 "start" : [
77 {
78 token : ["c9searchresults.constant.numeric", "c9searchresults.text", "c9searchresults.text"],
79 regex : "(^\\s+[0-9]+)(:\\s*)(.+)"
80 },
81 {
82 token : ["string", "text"], // single line
83 regex : "(.+)(:$)"
84 }
85 ]
86 };
87 };
88
89 oop.inherits(C9SearchHighlightRules, TextHighlightRules);
90
91 exports.C9SearchHighlightRules = C9SearchHighlightRules;
92
93 });
94
95 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
96
97
98 var Range = require("../range").Range;
99
100 var MatchingBraceOutdent = function() {};
101
102 (function() {
103
104 this.checkOutdent = function(line, input) {
105 if (! /^\s+$/.test(line))
106 return false;
107
108 return /^\s*\}/.test(input);
109 };
110
111 this.autoOutdent = function(doc, row) {
112 var line = doc.getLine(row);
113 var match = line.match(/^(\s*\})/);
114
115 if (!match) return 0;
116
117 var column = match[1].length;
118 var openBracePos = doc.findMatchingBracket({row: row, column: column});
119
120 if (!openBracePos || openBracePos.row == row) return 0;
121
122 var indent = this.$getIndent(doc.getLine(openBracePos.row));
123 doc.replace(new Range(row, 0, row, column-1), indent);
124 };
125
126 this.$getIndent = function(line) {
127 return line.match(/^\s*/)[0];
128 };
129
130 }).call(MatchingBraceOutdent.prototype);
131
132 exports.MatchingBraceOutdent = MatchingBraceOutdent;
133 });
134
135
136 define('ace/mode/folding/c9search', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
137
138
139 var oop = require("../../lib/oop");
140 var Range = require("../../range").Range;
141 var BaseFoldMode = require("./fold_mode").FoldMode;
142
143 var FoldMode = exports.FoldMode = function() {};
144 oop.inherits(FoldMode, BaseFoldMode);
145
146 (function() {
147
148 this.foldingStartMarker = /^(\S.*\:|Searching for.*)$/;
149 this.foldingStopMarker = /^(\s+|Found.*)$/;
150
151 this.getFoldWidgetRange = function(session, foldStyle, row) {
152 var lines = session.doc.getAllLines(row);
153 var line = lines[row];
154 var level1 = /^(Found.*|Searching for.*)$/;
155 var level2 = /^(\S.*\:|\s*)$/;
156 var re = level1.test(line) ? level1 : level2;
157
158 if (this.foldingStartMarker.test(line)) {
159 for (var i = row + 1, l = session.getLength(); i < l; i++) {
160 if (re.test(lines[i]))
161 break;
162 }
163
164 return new Range(row, line.length, i, 0);
165 }
166
167 if (this.foldingStopMarker.test(line)) {
168 for (var i = row - 1; i >= 0; i--) {
169 line = lines[i];
170 if (re.test(line))
171 break;
172 }
173
174 return new Range(i, line.length, row, 0);
175 }
176 };
177
178 }).call(FoldMode.prototype);
179
180 });
181
+0
-299
try/ace/mode-clojure.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/clojure', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/clojure_highlight_rules', 'ace/mode/matching_parens_outdent', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules;
37 var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
38 var Range = require("../range").Range;
39
40 var Mode = function() {
41 this.$tokenizer = new Tokenizer(new ClojureHighlightRules().getRules());
42 this.$outdent = new MatchingParensOutdent();
43 };
44 oop.inherits(Mode, TextMode);
45
46 (function() {
47
48 this.lineCommentStart = ";";
49
50 this.getNextLineIndent = function(state, line, tab) {
51 var indent = this.$getIndent(line);
52
53 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
54 var tokens = tokenizedLine.tokens;
55
56 if (tokens.length && tokens[tokens.length-1].type == "comment") {
57 return indent;
58 }
59
60 if (state == "start") {
61 var match = line.match(/[\(\[]/);
62 if (match) {
63 indent += " ";
64 }
65 match = line.match(/[\)]/);
66 if (match) {
67 indent = "";
68 }
69 }
70
71 return indent;
72 };
73
74 this.checkOutdent = function(state, line, input) {
75 return this.$outdent.checkOutdent(line, input);
76 };
77
78 this.autoOutdent = function(state, doc, row) {
79 this.$outdent.autoOutdent(doc, row);
80 };
81
82 }).call(Mode.prototype);
83
84 exports.Mode = Mode;
85 });
86
87 define('ace/mode/clojure_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
88
89
90 var oop = require("../lib/oop");
91 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
92
93
94
95 var ClojureHighlightRules = function() {
96
97 var builtinFunctions = (
98 '* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
99 '*command-line-args* *compile-files* *compile-path* *e *err* *file* ' +
100 '*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' +
101 '*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' +
102 '*read-eval* *source-path* *use-context-classloader* ' +
103 '*warn-on-reflection* + - -> ->> .. / < <= = ' +
104 '== > &gt; >= &gt;= accessor aclone ' +
105 'add-classpath add-watch agent agent-errors aget alength alias all-ns ' +
106 'alter alter-meta! alter-var-root amap ancestors and apply areduce ' +
107 'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' +
108 'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' +
109 'atom await await-for await1 bases bean bigdec bigint binding bit-and ' +
110 'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' +
111 'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' +
112 'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' +
113 'char-escape-string char-name-string char? chars chunk chunk-append ' +
114 'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' +
115 'class class? clear-agent-errors clojure-version coll? comment commute ' +
116 'comp comparator compare compare-and-set! compile complement concat cond ' +
117 'condp conj conj! cons constantly construct-proxy contains? count ' +
118 'counted? create-ns create-struct cycle dec decimal? declare definline ' +
119 'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' +
120 'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' +
121 'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' +
122 'double-array doubles drop drop-last drop-while empty empty? ensure ' +
123 'enumeration-seq eval even? every? false? ffirst file-seq filter find ' +
124 'find-doc find-ns find-var first float float-array float? floats flush ' +
125 'fn fn? fnext for force format future future-call future-cancel ' +
126 'future-cancelled? future-done? future? gen-class gen-interface gensym ' +
127 'get get-in get-method get-proxy-class get-thread-bindings get-validator ' +
128 'hash hash-map hash-set identical? identity if-let if-not ifn? import ' +
129 'in-ns inc init-proxy instance? int int-array integer? interleave intern ' +
130 'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' +
131 'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' +
132 'list* list? load load-file load-reader load-string loaded-libs locking ' +
133 'long long-array longs loop macroexpand macroexpand-1 make-array ' +
134 'make-hierarchy map map? mapcat max max-key memfn memoize merge ' +
135 'merge-with meta method-sig methods min min-key mod name namespace neg? ' +
136 'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' +
137 'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' +
138 'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' +
139 'or parents partial partition pcalls peek persistent! pmap pop pop! ' +
140 'pop-thread-bindings pos? pr pr-str prefer-method prefers ' +
141 'primitives-classnames print print-ctor print-doc print-dup print-method ' +
142 'print-namespace-doc print-simple print-special-doc print-str printf ' +
143 'println println-str prn prn-str promise proxy proxy-call-with-super ' +
144 'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' +
145 'rand rand-int range ratio? rational? rationalize re-find re-groups ' +
146 're-matcher re-matches re-pattern re-seq read read-line read-string ' +
147 'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' +
148 'refer refer-clojure release-pending-sends rem remove remove-method ' +
149 'remove-ns remove-watch repeat repeatedly replace replicate require ' +
150 'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' +
151 'rsubseq second select-keys send send-off seq seq? seque sequence ' +
152 'sequential? set set-validator! set? short short-array shorts ' +
153 'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' +
154 'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' +
155 'split-at split-with str stream? string? struct struct-map subs subseq ' +
156 'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' +
157 'take-last take-nth take-while test the-ns time to-array to-array-2d ' +
158 'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' +
159 'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' +
160 'unchecked-remainder unchecked-subtract underive unquote ' +
161 'unquote-splicing update-in update-proxy use val vals var-get var-set ' +
162 'var? vary-meta vec vector vector? when when-first when-let when-not ' +
163 'while with-bindings with-bindings* with-in-str with-loading-context ' +
164 'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' +
165 'zero? zipmap'
166 );
167
168 var keywords = ('throw try var ' +
169 'def do fn if let loop monitor-enter monitor-exit new quote recur set!'
170 );
171
172 var buildinConstants = ("true false nil");
173
174 var keywordMapper = this.createKeywordMapper({
175 "keyword": keywords,
176 "constant.language": buildinConstants,
177 "support.function": builtinFunctions
178 }, "identifier", false, " ");
179
180 this.$rules = {
181 "start" : [
182 {
183 token : "comment",
184 regex : ";.*$"
185 }, {
186 token : "keyword", //parens
187 regex : "[\\(|\\)]"
188 }, {
189 token : "keyword", //lists
190 regex : "[\\'\\(]"
191 }, {
192 token : "keyword", //vectors
193 regex : "[\\[|\\]]"
194 }, {
195 token : "keyword", //sets and maps
196 regex : "[\\{|\\}|\\#\\{|\\#\\}]"
197 }, {
198 token : "keyword", // ampersands
199 regex : '[\\&]'
200 }, {
201 token : "keyword", // metadata
202 regex : '[\\#\\^\\{]'
203 }, {
204 token : "keyword", // anonymous fn syntactic sugar
205 regex : '[\\%]'
206 }, {
207 token : "keyword", // deref reader macro
208 regex : '[@]'
209 }, {
210 token : "constant.numeric", // hex
211 regex : "0[xX][0-9a-fA-F]+\\b"
212 }, {
213 token : "constant.numeric", // float
214 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
215 }, {
216 token : "constant.language",
217 regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]'
218 }, {
219 token : keywordMapper,
220 regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"
221 }, {
222 token : "string", // single line
223 regex : '"',
224 next: "string"
225 }, {
226 token : "constant", // symbol
227 regex : /:[^()\[\]{}'"\^%`,;\s]+/
228 }, {
229 token : "string.regexp", //Regular Expressions
230 regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
231 }
232
233 ],
234 "string" : [
235 {
236 token : "constant.language.escape",
237 regex : "\\\\.|\\\\$"
238 }, {
239 token : "string",
240 regex : '[^"\\\\]+'
241 }, {
242 token : "string",
243 regex : '"',
244 next : "start"
245 }
246 ]
247 };
248 };
249
250 oop.inherits(ClojureHighlightRules, TextHighlightRules);
251
252 exports.ClojureHighlightRules = ClojureHighlightRules;
253 });
254
255 define('ace/mode/matching_parens_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
256
257
258 var Range = require("../range").Range;
259
260 var MatchingParensOutdent = function() {};
261
262 (function() {
263
264 this.checkOutdent = function(line, input) {
265 if (! /^\s+$/.test(line))
266 return false;
267
268 return /^\s*\)/.test(input);
269 };
270
271 this.autoOutdent = function(doc, row) {
272 var line = doc.getLine(row);
273 var match = line.match(/^(\s*\))/);
274
275 if (!match) return 0;
276
277 var column = match[1].length;
278 var openBracePos = doc.findMatchingBracket({row: row, column: column});
279
280 if (!openBracePos || openBracePos.row == row) return 0;
281
282 var indent = this.$getIndent(doc.getLine(openBracePos.row));
283 doc.replace(new Range(row, 0, row, column-1), indent);
284 };
285
286 this.$getIndent = function(line) {
287 var match = line.match(/^(\s+)/);
288 if (match) {
289 return match[1];
290 }
291
292 return "";
293 };
294
295 }).call(MatchingParensOutdent.prototype);
296
297 exports.MatchingParensOutdent = MatchingParensOutdent;
298 });
+0
-124
try/ace/mode-cobol.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/cobol', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/cobol_highlight_rules', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules;
37 var Range = require("../range").Range;
38
39 var Mode = function() {
40 this.$tokenizer = new Tokenizer(new CobolHighlightRules().getRules());
41 };
42 oop.inherits(Mode, TextMode);
43
44 (function() {
45
46 this.lineCommentStart = "*";
47
48 }).call(Mode.prototype);
49
50 exports.Mode = Mode;
51
52 });
53
54 define('ace/mode/cobol_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
55
56
57 var oop = require("../lib/oop");
58 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
59
60 var CobolHighlightRules = function() {
61 var keywords = "ACCEPT|MERGE|SUM|ADD||MESSAGE|TABLE|ADVANCING|MODE|TAPE|" +
62 "AFTER|MULTIPLY|TEST|ALL|NEGATIVE|TEXT|ALPHABET|NEXT|THAN|" +
63 "ALSO|NO|THEN|ALTERNATE|NOT|THROUGH|AND|NUMBER|THRU|ANY|OCCURS|" +
64 "TIME|ARE|OF|TO|AREA|OFF|TOP||ASCENDING|OMITTED|TRUE|ASSIGN|ON|TYPE|AT|OPEN|" +
65 "UNIT|AUTHOR|OR|UNTIL|BEFORE|OTHER|UP|BLANK|OUTPUT|USE|BLOCK|PAGE|USING|BOTTOM|" +
66 "PERFORM|VALUE|BY|PIC|VALUES|CALL|PICTURE|WHEN|CANCEL|PLUS|WITH|CD|POINTER|WRITE|" +
67 "CHARACTER|POSITION||ZERO|CLOSE|POSITIVE|ZEROS|COLUMN|PROCEDURE|ZEROES|COMMA|PROGRAM|" +
68 "COMMON|PROGRAM-ID|COMMUNICATION|QUOTE|COMP|RANDOM|COMPUTE|READ|CONTAINS|RECEIVE|CONFIGURATION|" +
69 "RECORD|CONTINUE|REDEFINES|CONTROL|REFERENCE|COPY|REMAINDER|COUNT|REPLACE|DATA|REPORT|DATE|RESERVE|" +
70 "DAY|RESET|DELETE|RETURN|DESTINATION|REWIND|DISABLE|REWRITE|DISPLAY|RIGHT|DIVIDE|RUN|DOWN|SAME|" +
71 "ELSE|SEARCH|ENABLE|SECTION|END|SELECT|ENVIRONMENT|SENTENCE|EQUAL|SET|ERROR|SIGN|EXIT|SEQUENTIAL|" +
72 "EXTERNAL|SIZE|FLASE|SORT|FILE|SOURCE|LENGTH|SPACE|LESS|STANDARD|LIMIT|START|LINE|STOP|LOCK|STRING|LOW-VALUE|SUBTRACT";
73
74 var builtinConstants = (
75 "true|false|null"
76 );
77
78 var builtinFunctions = (
79 "count|min|max|avg|sum|rank|now|coalesce|main"
80 );
81
82 var keywordMapper = this.createKeywordMapper({
83 "support.function": builtinFunctions,
84 "keyword": keywords,
85 "constant.language": builtinConstants
86 }, "identifier", true);
87
88 this.$rules = {
89 "start" : [ {
90 token : "comment",
91 regex : "\\*.*$"
92 }, {
93 token : "string", // " string
94 regex : '".*?"'
95 }, {
96 token : "string", // ' string
97 regex : "'.*?'"
98 }, {
99 token : "constant.numeric", // float
100 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
101 }, {
102 token : keywordMapper,
103 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
104 }, {
105 token : "keyword.operator",
106 regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
107 }, {
108 token : "paren.lparen",
109 regex : "[\\(]"
110 }, {
111 token : "paren.rparen",
112 regex : "[\\)]"
113 }, {
114 token : "text",
115 regex : "\\s+"
116 } ]
117 };
118 };
119
120 oop.inherits(CobolHighlightRules, TextHighlightRules);
121
122 exports.CobolHighlightRules = CobolHighlightRules;
123 });
+0
-443
try/ace/mode-coffee.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/coffee', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/coffee_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/coffee', 'ace/range', 'ace/mode/text', 'ace/worker/worker_client', 'ace/lib/oop'], function(require, exports, module) {
31
32
33 var Tokenizer = require("../tokenizer").Tokenizer;
34 var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
35 var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
36 var FoldMode = require("./folding/coffee").FoldMode;
37 var Range = require("../range").Range;
38 var TextMode = require("./text").Mode;
39 var WorkerClient = require("../worker/worker_client").WorkerClient;
40 var oop = require("../lib/oop");
41
42 function Mode() {
43 this.$tokenizer = new Tokenizer(new Rules().getRules());
44 this.$outdent = new Outdent();
45 this.foldingRules = new FoldMode();
46 }
47
48 oop.inherits(Mode, TextMode);
49
50 (function() {
51
52 var indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/;
53 var commentLine = /^(\s*)#/;
54 var hereComment = /^\s*###(?!#)/;
55 var indentation = /^\s*/;
56
57 this.getNextLineIndent = function(state, line, tab) {
58 var indent = this.$getIndent(line);
59 var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
60
61 if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
62 state === 'start' && indenter.test(line))
63 indent += tab;
64 return indent;
65 };
66
67 this.toggleCommentLines = function(state, doc, startRow, endRow){
68 console.log("toggle");
69 var range = new Range(0, 0, 0, 0);
70 for (var i = startRow; i <= endRow; ++i) {
71 var line = doc.getLine(i);
72 if (hereComment.test(line))
73 continue;
74
75 if (commentLine.test(line))
76 line = line.replace(commentLine, '$1');
77 else
78 line = line.replace(indentation, '$&#');
79
80 range.end.row = range.start.row = i;
81 range.end.column = line.length + 1;
82 doc.replace(range, line);
83 }
84 };
85
86 this.checkOutdent = function(state, line, input) {
87 return this.$outdent.checkOutdent(line, input);
88 };
89
90 this.autoOutdent = function(state, doc, row) {
91 this.$outdent.autoOutdent(doc, row);
92 };
93
94 this.createWorker = function(session) {
95 var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
96 worker.attachToDocument(session.getDocument());
97
98 worker.on("error", function(e) {
99 session.setAnnotations([e.data]);
100 });
101
102 worker.on("ok", function(e) {
103 session.clearAnnotations();
104 });
105
106 return worker;
107 };
108
109 }).call(Mode.prototype);
110
111 exports.Mode = Mode;
112
113 });
114
115 define('ace/mode/coffee_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
116
117
118 var oop = require("../lib/oop");
119 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
120
121 oop.inherits(CoffeeHighlightRules, TextHighlightRules);
122
123 function CoffeeHighlightRules() {
124 var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
125
126 var keywords = (
127 "this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
128 "catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" +
129 "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
130 "or|on|unless|until|and|yes"
131 );
132
133 var langConstant = (
134 "true|false|null|undefined|NaN|Infinity"
135 );
136
137 var illegal = (
138 "case|const|default|function|var|void|with|enum|export|implements|" +
139 "interface|let|package|private|protected|public|static|yield|" +
140 "__hasProp|slice|bind|indexOf"
141 );
142
143 var supportClass = (
144 "Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" +
145 "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
146 "SyntaxError|TypeError|URIError|" +
147 "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
148 "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"
149 );
150
151 var supportFunction = (
152 "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
153 "encodeURIComponent|decodeURI|decodeURIComponent|String|"
154 );
155
156 var variableLanguage = (
157 "window|arguments|prototype|document"
158 );
159
160 var keywordMapper = this.createKeywordMapper({
161 "keyword": keywords,
162 "constant.language": langConstant,
163 "invalid.illegal": illegal,
164 "language.support.class": supportClass,
165 "language.support.function": supportFunction,
166 "variable.language": variableLanguage
167 }, "identifier");
168
169 var functionRule = {
170 token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"],
171 regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()\"'\/])*?)(\))(\s*))?([\-=]>)/.source
172 };
173
174 var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/;
175
176 this.$rules = {
177 start : [
178 {
179 token : "constant.numeric",
180 regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
181 }, {
182 stateName: "qdoc",
183 token : "string", regex : "'''", next : [
184 {token : "string", regex : "'''", next : "start"},
185 {token : "constant.language.escape", regex : stringEscape},
186 {defaultToken: "string"}
187 ]
188 }, {
189 stateName: "qqdoc",
190 token : "string",
191 regex : '"""',
192 next : [
193 {token : "string", regex : '"""', next : "start"},
194 {token : "paren.string", regex : '#{', push : "start"},
195 {token : "constant.language.escape", regex : stringEscape},
196 {defaultToken: "string"}
197 ]
198 }, {
199 stateName: "qstring",
200 token : "string", regex : "'", next : [
201 {token : "string", regex : "'", next : "start"},
202 {token : "constant.language.escape", regex : stringEscape},
203 {defaultToken: "string"}
204 ]
205 }, {
206 stateName: "qqstring",
207 token : "string.start", regex : '"', next : [
208 {token : "string.end", regex : '"', next : "start"},
209 {token : "paren.string", regex : '#{', push : "start"},
210 {token : "constant.language.escape", regex : stringEscape},
211 {defaultToken: "string"}
212 ]
213 }, {
214 stateName: "js",
215 token : "string", regex : "`", next : [
216 {token : "string", regex : "`", next : "start"},
217 {token : "constant.language.escape", regex : stringEscape},
218 {defaultToken: "string"}
219 ]
220 }, {
221 regex: "[{}]", onMatch: function(val, state, stack) {
222 this.next = "";
223 if (val == "{" && stack.length) {
224 stack.unshift("start", state);
225 return "paren";
226 }
227 if (val == "}" && stack.length) {
228 stack.shift();
229 this.next = stack.shift();
230 if (this.next.indexOf("string") != -1)
231 return "paren.string";
232 }
233 return "paren";
234 }
235 }, {
236 token : "string.regex",
237 regex : "///",
238 next : "heregex"
239 }, {
240 token : "string.regex",
241 regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/
242 }, {
243 token : "comment",
244 regex : "###(?!#)",
245 next : "comment"
246 }, {
247 token : "comment",
248 regex : "#.*"
249 }, {
250 token : ["punctuation.operator", "text", "identifier"],
251 regex : "(\\.)(\\s*)(" + illegal + ")"
252 }, {
253 token : "punctuation.operator",
254 regex : "\\."
255 }, {
256 token : ["keyword", "text", "language.support.class",
257 "text", "keyword", "text", "language.support.class"],
258 regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?"
259 }, {
260 token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token),
261 regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex
262 },
263 functionRule,
264 {
265 token : "variable",
266 regex : "@(?:" + identifier + ")?"
267 }, {
268 token: keywordMapper,
269 regex : identifier
270 }, {
271 token : "punctuation.operator",
272 regex : "\\,|\\."
273 }, {
274 token : "storage.type",
275 regex : "[\\-=]>"
276 }, {
277 token : "keyword.operator",
278 regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
279 }, {
280 token : "paren.lparen",
281 regex : "[({[]"
282 }, {
283 token : "paren.rparen",
284 regex : "[\\]})]"
285 }, {
286 token : "text",
287 regex : "\\s+"
288 }],
289
290
291 heregex : [{
292 token : "string.regex",
293 regex : '.*?///[imgy]{0,4}',
294 next : "start"
295 }, {
296 token : "comment.regex",
297 regex : "\\s+(?:#.*)?"
298 }, {
299 token : "string.regex",
300 regex : "\\S+"
301 }],
302
303 comment : [{
304 token : "comment",
305 regex : '###',
306 next : "start"
307 }, {
308 defaultToken : "comment"
309 }]
310 };
311 this.normalizeRules();
312 }
313
314 exports.CoffeeHighlightRules = CoffeeHighlightRules;
315 });
316
317 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
318
319
320 var Range = require("../range").Range;
321
322 var MatchingBraceOutdent = function() {};
323
324 (function() {
325
326 this.checkOutdent = function(line, input) {
327 if (! /^\s+$/.test(line))
328 return false;
329
330 return /^\s*\}/.test(input);
331 };
332
333 this.autoOutdent = function(doc, row) {
334 var line = doc.getLine(row);
335 var match = line.match(/^(\s*\})/);
336
337 if (!match) return 0;
338
339 var column = match[1].length;
340 var openBracePos = doc.findMatchingBracket({row: row, column: column});
341
342 if (!openBracePos || openBracePos.row == row) return 0;
343
344 var indent = this.$getIndent(doc.getLine(openBracePos.row));
345 doc.replace(new Range(row, 0, row, column-1), indent);
346 };
347
348 this.$getIndent = function(line) {
349 return line.match(/^\s*/)[0];
350 };
351
352 }).call(MatchingBraceOutdent.prototype);
353
354 exports.MatchingBraceOutdent = MatchingBraceOutdent;
355 });
356
357 define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
358
359
360 var oop = require("../../lib/oop");
361 var BaseFoldMode = require("./fold_mode").FoldMode;
362 var Range = require("../../range").Range;
363
364 var FoldMode = exports.FoldMode = function() {};
365 oop.inherits(FoldMode, BaseFoldMode);
366
367 (function() {
368
369 this.getFoldWidgetRange = function(session, foldStyle, row) {
370 var range = this.indentationBlock(session, row);
371 if (range)
372 return range;
373
374 var re = /\S/;
375 var line = session.getLine(row);
376 var startLevel = line.search(re);
377 if (startLevel == -1 || line[startLevel] != "#")
378 return;
379
380 var startColumn = line.length;
381 var maxRow = session.getLength();
382 var startRow = row;
383 var endRow = row;
384
385 while (++row < maxRow) {
386 line = session.getLine(row);
387 var level = line.search(re);
388
389 if (level == -1)
390 continue;
391
392 if (line[level] != "#")
393 break;
394
395 endRow = row;
396 }
397
398 if (endRow > startRow) {
399 var endColumn = session.getLine(endRow).length;
400 return new Range(startRow, startColumn, endRow, endColumn);
401 }
402 };
403 this.getFoldWidget = function(session, foldStyle, row) {
404 var line = session.getLine(row);
405 var indent = line.search(/\S/);
406 var next = session.getLine(row + 1);
407 var prev = session.getLine(row - 1);
408 var prevIndent = prev.search(/\S/);
409 var nextIndent = next.search(/\S/);
410
411 if (indent == -1) {
412 session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
413 return "";
414 }
415 if (prevIndent == -1) {
416 if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
417 session.foldWidgets[row - 1] = "";
418 session.foldWidgets[row + 1] = "";
419 return "start";
420 }
421 } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
422 if (session.getLine(row - 2).search(/\S/) == -1) {
423 session.foldWidgets[row - 1] = "start";
424 session.foldWidgets[row + 1] = "";
425 return "";
426 }
427 }
428
429 if (prevIndent!= -1 && prevIndent < indent)
430 session.foldWidgets[row - 1] = "start";
431 else
432 session.foldWidgets[row - 1] = "";
433
434 if (indent < nextIndent)
435 return "start";
436 else
437 return "";
438 };
439
440 }).call(FoldMode.prototype);
441
442 });
+0
-1765
try/ace/mode-coldfusion.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/coldfusion', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/coldfusion_highlight_rules'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var XmlMode = require("./xml").Mode;
35 var JavaScriptMode = require("./javascript").Mode;
36 var CssMode = require("./css").Mode;
37 var Tokenizer = require("../tokenizer").Tokenizer;
38 var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
39
40 var Mode = function() {
41 XmlMode.call(this);
42
43 var highlighter = new ColdfusionHighlightRules();
44 this.$tokenizer = new Tokenizer(highlighter.getRules());
45
46 this.$embeds = highlighter.getEmbeds();
47 this.createModeDelegates({
48 "js-": JavaScriptMode,
49 "css-": CssMode
50 });
51 };
52 oop.inherits(Mode, XmlMode);
53
54 (function() {
55
56 this.getNextLineIndent = function(state, line, tab) {
57 return this.$getIndent(line);
58 };
59
60 }).call(Mode.prototype);
61
62 exports.Mode = Mode;
63 });
64
65 define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) {
66
67
68 var oop = require("../lib/oop");
69 var TextMode = require("./text").Mode;
70 var Tokenizer = require("../tokenizer").Tokenizer;
71 var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
72 var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
73 var XmlFoldMode = require("./folding/xml").FoldMode;
74
75 var Mode = function() {
76 this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
77 this.$behaviour = new XmlBehaviour();
78 this.foldingRules = new XmlFoldMode();
79 };
80
81 oop.inherits(Mode, TextMode);
82
83 (function() {
84
85 this.blockComment = {start: "<!--", end: "-->"};
86
87 }).call(Mode.prototype);
88
89 exports.Mode = Mode;
90 });
91
92 define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
93
94
95 var oop = require("../lib/oop");
96 var xmlUtil = require("./xml_util");
97 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
98
99 var XmlHighlightRules = function() {
100 this.$rules = {
101 start : [
102 {token : "text", regex : "<\\!\\[CDATA\\[", next : "cdata"},
103 {token : "xml-pe", regex : "<\\?.*?\\?>"},
104 {token : "comment", regex : "<\\!--", next : "comment"},
105 {token : "xml-pe", regex : "<\\!.*?>"},
106 {token : "meta.tag", regex : "<\\/?", next : "tag"},
107 {token : "text", regex : "\\s+"},
108 {
109 token : "constant.character.entity",
110 regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
111 }
112 ],
113
114 cdata : [
115 {token : "text", regex : "\\]\\]>", next : "start"},
116 {token : "text", regex : "\\s+"},
117 {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"}
118 ],
119
120 comment : [
121 {token : "comment", regex : ".*?-->", next : "start"},
122 {token : "comment", regex : ".+"}
123 ]
124 };
125
126 xmlUtil.tag(this.$rules, "tag", "start");
127 };
128
129 oop.inherits(XmlHighlightRules, TextHighlightRules);
130
131 exports.XmlHighlightRules = XmlHighlightRules;
132 });
133
134 define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
135
136
137 function string(state) {
138 return [{
139 token : "string",
140 regex : '"',
141 next : state + "_qqstring"
142 }, {
143 token : "string",
144 regex : "'",
145 next : state + "_qstring"
146 }];
147 }
148
149 function multiLineString(quote, state) {
150 return [
151 {token : "string", regex : quote, next : state},
152 {
153 token : "constant.language.escape",
154 regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
155 },
156 {defaultToken : "string"}
157 ];
158 }
159
160 exports.tag = function(states, name, nextState, tagMap) {
161 states[name] = [{
162 token : "text",
163 regex : "\\s+"
164 }, {
165
166 token : !tagMap ? "meta.tag.tag-name" : function(value) {
167 if (tagMap[value])
168 return "meta.tag.tag-name." + tagMap[value];
169 else
170 return "meta.tag.tag-name";
171 },
172 regex : "[-_a-zA-Z0-9:]+",
173 next : name + "_embed_attribute_list"
174 }, {
175 token: "empty",
176 regex: "",
177 next : name + "_embed_attribute_list"
178 }];
179
180 states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
181 states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
182
183 states[name + "_embed_attribute_list"] = [{
184 token : "meta.tag.r",
185 regex : "/?>",
186 next : nextState
187 }, {
188 token : "keyword.operator",
189 regex : "="
190 }, {
191 token : "entity.other.attribute-name",
192 regex : "[-_a-zA-Z0-9:]+"
193 }, {
194 token : "constant.numeric", // float
195 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
196 }, {
197 token : "text",
198 regex : "\\s+"
199 }].concat(string(name));
200 };
201
202 });
203
204 define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
205
206
207 var oop = require("../../lib/oop");
208 var Behaviour = require("../behaviour").Behaviour;
209 var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
210 var TokenIterator = require("../../token_iterator").TokenIterator;
211
212 function hasType(token, type) {
213 var hasType = true;
214 var typeList = token.type.split('.');
215 var needleList = type.split('.');
216 needleList.forEach(function(needle){
217 if (typeList.indexOf(needle) == -1) {
218 hasType = false;
219 return false;
220 }
221 });
222 return hasType;
223 }
224
225 var XmlBehaviour = function () {
226
227 this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
228
229 this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
230 if (text == '>') {
231 var position = editor.getCursorPosition();
232 var iterator = new TokenIterator(session, position.row, position.column);
233 var token = iterator.getCurrentToken();
234 var atCursor = false;
235 if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
236 do {
237 token = iterator.stepBackward();
238 } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
239 } else {
240 atCursor = true;
241 }
242 if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
243 return
244 }
245 var tag = token.value;
246 if (atCursor){
247 var tag = tag.substring(0, position.column - token.start);
248 }
249
250 return {
251 text: '>' + '</' + tag + '>',
252 selection: [1, 1]
253 }
254 }
255 });
256
257 this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
258 if (text == "\n") {
259 var cursor = editor.getCursorPosition();
260 var line = session.doc.getLine(cursor.row);
261 var rightChars = line.substring(cursor.column, cursor.column + 2);
262 if (rightChars == '</') {
263 var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
264 var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
265
266 return {
267 text: '\n' + indent + '\n' + next_indent,
268 selection: [1, indent.length, 1, indent.length]
269 }
270 }
271 }
272 });
273
274 }
275 oop.inherits(XmlBehaviour, Behaviour);
276
277 exports.XmlBehaviour = XmlBehaviour;
278 });
279
280 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
281
282
283 var oop = require("../../lib/oop");
284 var Behaviour = require("../behaviour").Behaviour;
285 var TokenIterator = require("../../token_iterator").TokenIterator;
286 var lang = require("../../lib/lang");
287
288 var SAFE_INSERT_IN_TOKENS =
289 ["text", "paren.rparen", "punctuation.operator"];
290 var SAFE_INSERT_BEFORE_TOKENS =
291 ["text", "paren.rparen", "punctuation.operator", "comment"];
292
293
294 var autoInsertedBrackets = 0;
295 var autoInsertedRow = -1;
296 var autoInsertedLineEnd = "";
297 var maybeInsertedBrackets = 0;
298 var maybeInsertedRow = -1;
299 var maybeInsertedLineStart = "";
300 var maybeInsertedLineEnd = "";
301
302 var CstyleBehaviour = function () {
303
304 CstyleBehaviour.isSaneInsertion = function(editor, session) {
305 var cursor = editor.getCursorPosition();
306 var iterator = new TokenIterator(session, cursor.row, cursor.column);
307 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
308 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
309 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
310 return false;
311 }
312 iterator.stepForward();
313 return iterator.getCurrentTokenRow() !== cursor.row ||
314 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
315 };
316
317 CstyleBehaviour.$matchTokenType = function(token, types) {
318 return types.indexOf(token.type || token) > -1;
319 };
320
321 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
322 var cursor = editor.getCursorPosition();
323 var line = session.doc.getLine(cursor.row);
324 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
325 autoInsertedBrackets = 0;
326 autoInsertedRow = cursor.row;
327 autoInsertedLineEnd = bracket + line.substr(cursor.column);
328 autoInsertedBrackets++;
329 };
330
331 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
332 var cursor = editor.getCursorPosition();
333 var line = session.doc.getLine(cursor.row);
334 if (!this.isMaybeInsertedClosing(cursor, line))
335 maybeInsertedBrackets = 0;
336 maybeInsertedRow = cursor.row;
337 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
338 maybeInsertedLineEnd = line.substr(cursor.column);
339 maybeInsertedBrackets++;
340 };
341
342 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
343 return autoInsertedBrackets > 0 &&
344 cursor.row === autoInsertedRow &&
345 bracket === autoInsertedLineEnd[0] &&
346 line.substr(cursor.column) === autoInsertedLineEnd;
347 };
348
349 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
350 return maybeInsertedBrackets > 0 &&
351 cursor.row === maybeInsertedRow &&
352 line.substr(cursor.column) === maybeInsertedLineEnd &&
353 line.substr(0, cursor.column) == maybeInsertedLineStart;
354 };
355
356 CstyleBehaviour.popAutoInsertedClosing = function() {
357 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
358 autoInsertedBrackets--;
359 };
360
361 CstyleBehaviour.clearMaybeInsertedClosing = function() {
362 maybeInsertedBrackets = 0;
363 maybeInsertedRow = -1;
364 };
365
366 this.add("braces", "insertion", function (state, action, editor, session, text) {
367 var cursor = editor.getCursorPosition();
368 var line = session.doc.getLine(cursor.row);
369 if (text == '{') {
370 var selection = editor.getSelectionRange();
371 var selected = session.doc.getTextRange(selection);
372 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
373 return {
374 text: '{' + selected + '}',
375 selection: false
376 };
377 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
378 if (/[\]\}\)]/.test(line[cursor.column])) {
379 CstyleBehaviour.recordAutoInsert(editor, session, "}");
380 return {
381 text: '{}',
382 selection: [1, 1]
383 };
384 } else {
385 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
386 return {
387 text: '{',
388 selection: [1, 1]
389 };
390 }
391 }
392 } else if (text == '}') {
393 var rightChar = line.substring(cursor.column, cursor.column + 1);
394 if (rightChar == '}') {
395 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
396 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
397 CstyleBehaviour.popAutoInsertedClosing();
398 return {
399 text: '',
400 selection: [1, 1]
401 };
402 }
403 }
404 } else if (text == "\n" || text == "\r\n") {
405 var closing = "";
406 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
407 closing = lang.stringRepeat("}", maybeInsertedBrackets);
408 CstyleBehaviour.clearMaybeInsertedClosing();
409 }
410 var rightChar = line.substring(cursor.column, cursor.column + 1);
411 if (rightChar == '}' || closing !== "") {
412 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
413 if (!openBracePos)
414 return null;
415
416 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
417 var next_indent = this.$getIndent(line);
418
419 return {
420 text: '\n' + indent + '\n' + next_indent + closing,
421 selection: [1, indent.length, 1, indent.length]
422 };
423 }
424 }
425 });
426
427 this.add("braces", "deletion", function (state, action, editor, session, range) {
428 var selected = session.doc.getTextRange(range);
429 if (!range.isMultiLine() && selected == '{') {
430 var line = session.doc.getLine(range.start.row);
431 var rightChar = line.substring(range.end.column, range.end.column + 1);
432 if (rightChar == '}') {
433 range.end.column++;
434 return range;
435 } else {
436 maybeInsertedBrackets--;
437 }
438 }
439 });
440
441 this.add("parens", "insertion", function (state, action, editor, session, text) {
442 if (text == '(') {
443 var selection = editor.getSelectionRange();
444 var selected = session.doc.getTextRange(selection);
445 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
446 return {
447 text: '(' + selected + ')',
448 selection: false
449 };
450 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
451 CstyleBehaviour.recordAutoInsert(editor, session, ")");
452 return {
453 text: '()',
454 selection: [1, 1]
455 };
456 }
457 } else if (text == ')') {
458 var cursor = editor.getCursorPosition();
459 var line = session.doc.getLine(cursor.row);
460 var rightChar = line.substring(cursor.column, cursor.column + 1);
461 if (rightChar == ')') {
462 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
463 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
464 CstyleBehaviour.popAutoInsertedClosing();
465 return {
466 text: '',
467 selection: [1, 1]
468 };
469 }
470 }
471 }
472 });
473
474 this.add("parens", "deletion", function (state, action, editor, session, range) {
475 var selected = session.doc.getTextRange(range);
476 if (!range.isMultiLine() && selected == '(') {
477 var line = session.doc.getLine(range.start.row);
478 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
479 if (rightChar == ')') {
480 range.end.column++;
481 return range;
482 }
483 }
484 });
485
486 this.add("brackets", "insertion", function (state, action, editor, session, text) {
487 if (text == '[') {
488 var selection = editor.getSelectionRange();
489 var selected = session.doc.getTextRange(selection);
490 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
491 return {
492 text: '[' + selected + ']',
493 selection: false
494 };
495 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
496 CstyleBehaviour.recordAutoInsert(editor, session, "]");
497 return {
498 text: '[]',
499 selection: [1, 1]
500 };
501 }
502 } else if (text == ']') {
503 var cursor = editor.getCursorPosition();
504 var line = session.doc.getLine(cursor.row);
505 var rightChar = line.substring(cursor.column, cursor.column + 1);
506 if (rightChar == ']') {
507 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
508 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
509 CstyleBehaviour.popAutoInsertedClosing();
510 return {
511 text: '',
512 selection: [1, 1]
513 };
514 }
515 }
516 }
517 });
518
519 this.add("brackets", "deletion", function (state, action, editor, session, range) {
520 var selected = session.doc.getTextRange(range);
521 if (!range.isMultiLine() && selected == '[') {
522 var line = session.doc.getLine(range.start.row);
523 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
524 if (rightChar == ']') {
525 range.end.column++;
526 return range;
527 }
528 }
529 });
530
531 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
532 if (text == '"' || text == "'") {
533 var quote = text;
534 var selection = editor.getSelectionRange();
535 var selected = session.doc.getTextRange(selection);
536 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
537 return {
538 text: quote + selected + quote,
539 selection: false
540 };
541 } else {
542 var cursor = editor.getCursorPosition();
543 var line = session.doc.getLine(cursor.row);
544 var leftChar = line.substring(cursor.column-1, cursor.column);
545 if (leftChar == '\\') {
546 return null;
547 }
548 var tokens = session.getTokens(selection.start.row);
549 var col = 0, token;
550 var quotepos = -1; // Track whether we're inside an open quote.
551
552 for (var x = 0; x < tokens.length; x++) {
553 token = tokens[x];
554 if (token.type == "string") {
555 quotepos = -1;
556 } else if (quotepos < 0) {
557 quotepos = token.value.indexOf(quote);
558 }
559 if ((token.value.length + col) > selection.start.column) {
560 break;
561 }
562 col += tokens[x].value.length;
563 }
564 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
565 if (!CstyleBehaviour.isSaneInsertion(editor, session))
566 return;
567 return {
568 text: quote + quote,
569 selection: [1,1]
570 };
571 } else if (token && token.type === "string") {
572 var rightChar = line.substring(cursor.column, cursor.column + 1);
573 if (rightChar == quote) {
574 return {
575 text: '',
576 selection: [1, 1]
577 };
578 }
579 }
580 }
581 }
582 });
583
584 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
585 var selected = session.doc.getTextRange(range);
586 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
587 var line = session.doc.getLine(range.start.row);
588 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
589 if (rightChar == selected) {
590 range.end.column++;
591 return range;
592 }
593 }
594 });
595
596 };
597
598 oop.inherits(CstyleBehaviour, Behaviour);
599
600 exports.CstyleBehaviour = CstyleBehaviour;
601 });
602
603 define('ace/mode/folding/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/range', 'ace/mode/folding/fold_mode', 'ace/token_iterator'], function(require, exports, module) {
604
605
606 var oop = require("../../lib/oop");
607 var lang = require("../../lib/lang");
608 var Range = require("../../range").Range;
609 var BaseFoldMode = require("./fold_mode").FoldMode;
610 var TokenIterator = require("../../token_iterator").TokenIterator;
611
612 var FoldMode = exports.FoldMode = function(voidElements) {
613 BaseFoldMode.call(this);
614 this.voidElements = voidElements || {};
615 };
616 oop.inherits(FoldMode, BaseFoldMode);
617
618 (function() {
619
620 this.getFoldWidget = function(session, foldStyle, row) {
621 var tag = this._getFirstTagInLine(session, row);
622
623 if (tag.closing)
624 return foldStyle == "markbeginend" ? "end" : "";
625
626 if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
627 return "";
628
629 if (tag.selfClosing)
630 return "";
631
632 if (tag.value.indexOf("/" + tag.tagName) !== -1)
633 return "";
634
635 return "start";
636 };
637
638 this._getFirstTagInLine = function(session, row) {
639 var tokens = session.getTokens(row);
640 var value = "";
641 for (var i = 0; i < tokens.length; i++) {
642 var token = tokens[i];
643 if (token.type.indexOf("meta.tag") === 0)
644 value += token.value;
645 else
646 value += lang.stringRepeat(" ", token.value.length);
647 }
648
649 return this._parseTag(value);
650 };
651
652 this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
653 this._parseTag = function(tag) {
654
655 var match = tag.match(this.tagRe);
656 var column = 0;
657
658 return {
659 value: tag,
660 match: match ? match[2] : "",
661 closing: match ? !!match[3] : false,
662 selfClosing: match ? !!match[5] || match[2] == "/>" : false,
663 tagName: match ? match[4] : "",
664 column: match[1] ? column + match[1].length : column
665 };
666 };
667 this._readTagForward = function(iterator) {
668 var token = iterator.getCurrentToken();
669 if (!token)
670 return null;
671
672 var value = "";
673 var start;
674
675 do {
676 if (token.type.indexOf("meta.tag") === 0) {
677 if (!start) {
678 var start = {
679 row: iterator.getCurrentTokenRow(),
680 column: iterator.getCurrentTokenColumn()
681 };
682 }
683 value += token.value;
684 if (value.indexOf(">") !== -1) {
685 var tag = this._parseTag(value);
686 tag.start = start;
687 tag.end = {
688 row: iterator.getCurrentTokenRow(),
689 column: iterator.getCurrentTokenColumn() + token.value.length
690 };
691 iterator.stepForward();
692 return tag;
693 }
694 }
695 } while(token = iterator.stepForward());
696
697 return null;
698 };
699
700 this._readTagBackward = function(iterator) {
701 var token = iterator.getCurrentToken();
702 if (!token)
703 return null;
704
705 var value = "";
706 var end;
707
708 do {
709 if (token.type.indexOf("meta.tag") === 0) {
710 if (!end) {
711 end = {
712 row: iterator.getCurrentTokenRow(),
713 column: iterator.getCurrentTokenColumn() + token.value.length
714 };
715 }
716 value = token.value + value;
717 if (value.indexOf("<") !== -1) {
718 var tag = this._parseTag(value);
719 tag.end = end;
720 tag.start = {
721 row: iterator.getCurrentTokenRow(),
722 column: iterator.getCurrentTokenColumn()
723 };
724 iterator.stepBackward();
725 return tag;
726 }
727 }
728 } while(token = iterator.stepBackward());
729
730 return null;
731 };
732
733 this._pop = function(stack, tag) {
734 while (stack.length) {
735
736 var top = stack[stack.length-1];
737 if (!tag || top.tagName == tag.tagName) {
738 return stack.pop();
739 }
740 else if (this.voidElements[tag.tagName]) {
741 return;
742 }
743 else if (this.voidElements[top.tagName]) {
744 stack.pop();
745 continue;
746 } else {
747 return null;
748 }
749 }
750 };
751
752 this.getFoldWidgetRange = function(session, foldStyle, row) {
753 var firstTag = this._getFirstTagInLine(session, row);
754
755 if (!firstTag.match)
756 return null;
757
758 var isBackward = firstTag.closing || firstTag.selfClosing;
759 var stack = [];
760 var tag;
761
762 if (!isBackward) {
763 var iterator = new TokenIterator(session, row, firstTag.column);
764 var start = {
765 row: row,
766 column: firstTag.column + firstTag.tagName.length + 2
767 };
768 while (tag = this._readTagForward(iterator)) {
769 if (tag.selfClosing) {
770 if (!stack.length) {
771 tag.start.column += tag.tagName.length + 2;
772 tag.end.column -= 2;
773 return Range.fromPoints(tag.start, tag.end);
774 } else
775 continue;
776 }
777
778 if (tag.closing) {
779 this._pop(stack, tag);
780 if (stack.length == 0)
781 return Range.fromPoints(start, tag.start);
782 }
783 else {
784 stack.push(tag)
785 }
786 }
787 }
788 else {
789 var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
790 var end = {
791 row: row,
792 column: firstTag.column
793 };
794
795 while (tag = this._readTagBackward(iterator)) {
796 if (tag.selfClosing) {
797 if (!stack.length) {
798 tag.start.column += tag.tagName.length + 2;
799 tag.end.column -= 2;
800 return Range.fromPoints(tag.start, tag.end);
801 } else
802 continue;
803 }
804
805 if (!tag.closing) {
806 this._pop(stack, tag);
807 if (stack.length == 0) {
808 tag.start.column += tag.tagName.length + 2;
809 return Range.fromPoints(tag.start, end);
810 }
811 }
812 else {
813 stack.push(tag)
814 }
815 }
816 }
817
818 };
819
820 }).call(FoldMode.prototype);
821
822 });
823
824 define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/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', 'ace/mode/folding/cstyle'], function(require, exports, module) {
825
826
827 var oop = require("../lib/oop");
828 var TextMode = require("./text").Mode;
829 var Tokenizer = require("../tokenizer").Tokenizer;
830 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
831 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
832 var Range = require("../range").Range;
833 var WorkerClient = require("../worker/worker_client").WorkerClient;
834 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
835 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
836
837 var Mode = function() {
838 this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
839 this.$outdent = new MatchingBraceOutdent();
840 this.$behaviour = new CstyleBehaviour();
841 this.foldingRules = new CStyleFoldMode();
842 };
843 oop.inherits(Mode, TextMode);
844
845 (function() {
846
847 this.lineCommentStart = "//";
848 this.blockComment = {start: "/*", end: "*/"};
849
850 this.getNextLineIndent = function(state, line, tab) {
851 var indent = this.$getIndent(line);
852
853 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
854 var tokens = tokenizedLine.tokens;
855 var endState = tokenizedLine.state;
856
857 if (tokens.length && tokens[tokens.length-1].type == "comment") {
858 return indent;
859 }
860
861 if (state == "start" || state == "no_regex") {
862 var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
863 if (match) {
864 indent += tab;
865 }
866 } else if (state == "doc-start") {
867 if (endState == "start" || endState == "no_regex") {
868 return "";
869 }
870 var match = line.match(/^\s*(\/?)\*/);
871 if (match) {
872 if (match[1]) {
873 indent += " ";
874 }
875 indent += "* ";
876 }
877 }
878
879 return indent;
880 };
881
882 this.checkOutdent = function(state, line, input) {
883 return this.$outdent.checkOutdent(line, input);
884 };
885
886 this.autoOutdent = function(state, doc, row) {
887 this.$outdent.autoOutdent(doc, row);
888 };
889
890 this.createWorker = function(session) {
891 var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
892 worker.attachToDocument(session.getDocument());
893
894 worker.on("jslint", function(results) {
895 session.setAnnotations(results.data);
896 });
897
898 worker.on("terminate", function() {
899 session.clearAnnotations();
900 });
901
902 return worker;
903 };
904
905 }).call(Mode.prototype);
906
907 exports.Mode = Mode;
908 });
909
910 define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
911
912
913 var oop = require("../lib/oop");
914 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
915 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
916
917 var JavaScriptHighlightRules = function() {
918 var keywordMapper = this.createKeywordMapper({
919 "variable.language":
920 "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
921 "Namespace|QName|XML|XMLList|" + // E4X
922 "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
923 "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
924 "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
925 "SyntaxError|TypeError|URIError|" +
926 "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
927 "isNaN|parseFloat|parseInt|" +
928 "JSON|Math|" + // Other
929 "this|arguments|prototype|window|document" , // Pseudo
930 "keyword":
931 "const|yield|import|get|set|" +
932 "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
933 "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
934 "__parent__|__count__|escape|unescape|with|__proto__|" +
935 "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
936 "storage.type":
937 "const|let|var|function",
938 "constant.language":
939 "null|Infinity|NaN|undefined",
940 "support.function":
941 "alert",
942 "constant.language.boolean": "true|false"
943 }, "identifier");
944 var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
945 var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
946
947 var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
948 "u[0-9a-fA-F]{4}|" + // unicode
949 "[0-2][0-7]{0,2}|" + // oct
950 "3[0-6][0-7]?|" + // oct
951 "37[0-7]?|" + // oct
952 "[4-7][0-7]?|" + //oct
953 ".)";
954
955 this.$rules = {
956 "no_regex" : [
957 {
958 token : "comment",
959 regex : /\/\/.*$/
960 },
961 DocCommentHighlightRules.getStartRule("doc-start"),
962 {
963 token : "comment", // multi line comment
964 regex : /\/\*/,
965 next : "comment"
966 }, {
967 token : "string",
968 regex : "'(?=.)",
969 next : "qstring"
970 }, {
971 token : "string",
972 regex : '"(?=.)',
973 next : "qqstring"
974 }, {
975 token : "constant.numeric", // hex
976 regex : /0[xX][0-9a-fA-F]+\b/
977 }, {
978 token : "constant.numeric", // float
979 regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
980 }, {
981 token : [
982 "storage.type", "punctuation.operator", "support.function",
983 "punctuation.operator", "entity.name.function", "text","keyword.operator"
984 ],
985 regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
986 next: "function_arguments"
987 }, {
988 token : [
989 "storage.type", "punctuation.operator", "entity.name.function", "text",
990 "keyword.operator", "text", "storage.type", "text", "paren.lparen"
991 ],
992 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
993 next: "function_arguments"
994 }, {
995 token : [
996 "entity.name.function", "text", "keyword.operator", "text", "storage.type",
997 "text", "paren.lparen"
998 ],
999 regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1000 next: "function_arguments"
1001 }, {
1002 token : [
1003 "storage.type", "punctuation.operator", "entity.name.function", "text",
1004 "keyword.operator", "text",
1005 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
1006 ],
1007 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
1008 next: "function_arguments"
1009 }, {
1010 token : [
1011 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
1012 ],
1013 regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
1014 next: "function_arguments"
1015 }, {
1016 token : [
1017 "entity.name.function", "text", "punctuation.operator",
1018 "text", "storage.type", "text", "paren.lparen"
1019 ],
1020 regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
1021 next: "function_arguments"
1022 }, {
1023 token : [
1024 "text", "text", "storage.type", "text", "paren.lparen"
1025 ],
1026 regex : "(:)(\\s*)(function)(\\s*)(\\()",
1027 next: "function_arguments"
1028 }, {
1029 token : "keyword",
1030 regex : "(?:" + kwBeforeRe + ")\\b",
1031 next : "start"
1032 }, {
1033 token : ["punctuation.operator", "support.function"],
1034 regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
1035 }, {
1036 token : ["punctuation.operator", "support.function.dom"],
1037 regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
1038 }, {
1039 token : ["punctuation.operator", "support.constant"],
1040 regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
1041 }, {
1042 token : ["storage.type", "punctuation.operator", "support.function.firebug"],
1043 regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
1044 }, {
1045 token : keywordMapper,
1046 regex : identifierRe
1047 }, {
1048 token : "keyword.operator",
1049 regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
1050 next : "start"
1051 }, {
1052 token : "punctuation.operator",
1053 regex : /\?|\:|\,|\;|\./,
1054 next : "start"
1055 }, {
1056 token : "paren.lparen",
1057 regex : /[\[({]/,
1058 next : "start"
1059 }, {
1060 token : "paren.rparen",
1061 regex : /[\])}]/
1062 }, {
1063 token : "keyword.operator",
1064 regex : /\/=?/,
1065 next : "start"
1066 }, {
1067 token: "comment",
1068 regex: /^#!.*$/
1069 }
1070 ],
1071 "start": [
1072 DocCommentHighlightRules.getStartRule("doc-start"),
1073 {
1074 token : "comment", // multi line comment
1075 regex : "\\/\\*",
1076 next : "comment_regex_allowed"
1077 }, {
1078 token : "comment",
1079 regex : "\\/\\/.*$",
1080 next : "start"
1081 }, {
1082 token: "string.regexp",
1083 regex: "\\/",
1084 next: "regex"
1085 }, {
1086 token : "text",
1087 regex : "\\s+|^$",
1088 next : "start"
1089 }, {
1090 token: "empty",
1091 regex: "",
1092 next: "no_regex"
1093 }
1094 ],
1095 "regex": [
1096 {
1097 token: "regexp.keyword.operator",
1098 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1099 }, {
1100 token: "string.regexp",
1101 regex: "/\\w*",
1102 next: "no_regex"
1103 }, {
1104 token : "invalid",
1105 regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
1106 }, {
1107 token : "constant.language.escape",
1108 regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
1109 }, {
1110 token : "constant.language.delimiter",
1111 regex: /\|/
1112 }, {
1113 token: "constant.language.escape",
1114 regex: /\[\^?/,
1115 next: "regex_character_class"
1116 }, {
1117 token: "empty",
1118 regex: "$",
1119 next: "no_regex"
1120 }, {
1121 defaultToken: "string.regexp"
1122 }
1123 ],
1124 "regex_character_class": [
1125 {
1126 token: "regexp.keyword.operator",
1127 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1128 }, {
1129 token: "constant.language.escape",
1130 regex: "]",
1131 next: "regex"
1132 }, {
1133 token: "constant.language.escape",
1134 regex: "-"
1135 }, {
1136 token: "empty",
1137 regex: "$",
1138 next: "no_regex"
1139 }, {
1140 defaultToken: "string.regexp.charachterclass"
1141 }
1142 ],
1143 "function_arguments": [
1144 {
1145 token: "variable.parameter",
1146 regex: identifierRe
1147 }, {
1148 token: "punctuation.operator",
1149 regex: "[, ]+"
1150 }, {
1151 token: "punctuation.operator",
1152 regex: "$"
1153 }, {
1154 token: "empty",
1155 regex: "",
1156 next: "no_regex"
1157 }
1158 ],
1159 "comment_regex_allowed" : [
1160 {token : "comment", regex : "\\*\\/", next : "start"},
1161 {defaultToken : "comment"}
1162 ],
1163 "comment" : [
1164 {token : "comment", regex : "\\*\\/", next : "no_regex"},
1165 {defaultToken : "comment"}
1166 ],
1167 "qqstring" : [
1168 {
1169 token : "constant.language.escape",
1170 regex : escapedRe
1171 }, {
1172 token : "string",
1173 regex : "\\\\$",
1174 next : "qqstring"
1175 }, {
1176 token : "string",
1177 regex : '"|$',
1178 next : "no_regex"
1179 }, {
1180 defaultToken: "string"
1181 }
1182 ],
1183 "qstring" : [
1184 {
1185 token : "constant.language.escape",
1186 regex : escapedRe
1187 }, {
1188 token : "string",
1189 regex : "\\\\$",
1190 next : "qstring"
1191 }, {
1192 token : "string",
1193 regex : "'|$",
1194 next : "no_regex"
1195 }, {
1196 defaultToken: "string"
1197 }
1198 ]
1199 };
1200
1201 this.embedRules(DocCommentHighlightRules, "doc-",
1202 [ DocCommentHighlightRules.getEndRule("no_regex") ]);
1203 };
1204
1205 oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
1206
1207 exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
1208 });
1209
1210 define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1211
1212
1213 var oop = require("../lib/oop");
1214 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1215
1216 var DocCommentHighlightRules = function() {
1217
1218 this.$rules = {
1219 "start" : [ {
1220 token : "comment.doc.tag",
1221 regex : "@[\\w\\d_]+" // TODO: fix email addresses
1222 }, {
1223 token : "comment.doc.tag",
1224 regex : "\\bTODO\\b"
1225 }, {
1226 defaultToken : "comment.doc"
1227 }]
1228 };
1229 };
1230
1231 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
1232
1233 DocCommentHighlightRules.getStartRule = function(start) {
1234 return {
1235 token : "comment.doc", // doc comment
1236 regex : "\\/\\*(?=\\*)",
1237 next : start
1238 };
1239 };
1240
1241 DocCommentHighlightRules.getEndRule = function (start) {
1242 return {
1243 token : "comment.doc", // closing comment
1244 regex : "\\*\\/",
1245 next : start
1246 };
1247 };
1248
1249
1250 exports.DocCommentHighlightRules = DocCommentHighlightRules;
1251
1252 });
1253
1254 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1255
1256
1257 var Range = require("../range").Range;
1258
1259 var MatchingBraceOutdent = function() {};
1260
1261 (function() {
1262
1263 this.checkOutdent = function(line, input) {
1264 if (! /^\s+$/.test(line))
1265 return false;
1266
1267 return /^\s*\}/.test(input);
1268 };
1269
1270 this.autoOutdent = function(doc, row) {
1271 var line = doc.getLine(row);
1272 var match = line.match(/^(\s*\})/);
1273
1274 if (!match) return 0;
1275
1276 var column = match[1].length;
1277 var openBracePos = doc.findMatchingBracket({row: row, column: column});
1278
1279 if (!openBracePos || openBracePos.row == row) return 0;
1280
1281 var indent = this.$getIndent(doc.getLine(openBracePos.row));
1282 doc.replace(new Range(row, 0, row, column-1), indent);
1283 };
1284
1285 this.$getIndent = function(line) {
1286 return line.match(/^\s*/)[0];
1287 };
1288
1289 }).call(MatchingBraceOutdent.prototype);
1290
1291 exports.MatchingBraceOutdent = MatchingBraceOutdent;
1292 });
1293
1294 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1295
1296
1297 var oop = require("../../lib/oop");
1298 var Range = require("../../range").Range;
1299 var BaseFoldMode = require("./fold_mode").FoldMode;
1300
1301 var FoldMode = exports.FoldMode = function(commentRegex) {
1302 if (commentRegex) {
1303 this.foldingStartMarker = new RegExp(
1304 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
1305 );
1306 this.foldingStopMarker = new RegExp(
1307 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
1308 );
1309 }
1310 };
1311 oop.inherits(FoldMode, BaseFoldMode);
1312
1313 (function() {
1314
1315 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1316 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1317
1318 this.getFoldWidgetRange = function(session, foldStyle, row) {
1319 var line = session.getLine(row);
1320 var match = line.match(this.foldingStartMarker);
1321 if (match) {
1322 var i = match.index;
1323
1324 if (match[1])
1325 return this.openingBracketBlock(session, match[1], row, i);
1326
1327 return session.getCommentFoldRange(row, i + match[0].length, 1);
1328 }
1329
1330 if (foldStyle !== "markbeginend")
1331 return;
1332
1333 var match = line.match(this.foldingStopMarker);
1334 if (match) {
1335 var i = match.index + match[0].length;
1336
1337 if (match[1])
1338 return this.closingBracketBlock(session, match[1], row, i);
1339
1340 return session.getCommentFoldRange(row, i, -1);
1341 }
1342 };
1343
1344 }).call(FoldMode.prototype);
1345
1346 });
1347
1348 define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) {
1349
1350
1351 var oop = require("../lib/oop");
1352 var TextMode = require("./text").Mode;
1353 var Tokenizer = require("../tokenizer").Tokenizer;
1354 var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1355 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1356 var WorkerClient = require("../worker/worker_client").WorkerClient;
1357 var CssBehaviour = require("./behaviour/css").CssBehaviour;
1358 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1359
1360 var Mode = function() {
1361 this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules());
1362 this.$outdent = new MatchingBraceOutdent();
1363 this.$behaviour = new CssBehaviour();
1364 this.foldingRules = new CStyleFoldMode();
1365 };
1366 oop.inherits(Mode, TextMode);
1367
1368 (function() {
1369
1370 this.foldingRules = "cStyle";
1371 this.blockComment = {start: "/*", end: "*/"};
1372
1373 this.getNextLineIndent = function(state, line, tab) {
1374 var indent = this.$getIndent(line);
1375 var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
1376 if (tokens.length && tokens[tokens.length-1].type == "comment") {
1377 return indent;
1378 }
1379
1380 var match = line.match(/^.*\{\s*$/);
1381 if (match) {
1382 indent += tab;
1383 }
1384
1385 return indent;
1386 };
1387
1388 this.checkOutdent = function(state, line, input) {
1389 return this.$outdent.checkOutdent(line, input);
1390 };
1391
1392 this.autoOutdent = function(state, doc, row) {
1393 this.$outdent.autoOutdent(doc, row);
1394 };
1395
1396 this.createWorker = function(session) {
1397 var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1398 worker.attachToDocument(session.getDocument());
1399
1400 worker.on("csslint", function(e) {
1401 session.setAnnotations(e.data);
1402 });
1403
1404 worker.on("terminate", function() {
1405 session.clearAnnotations();
1406 });
1407
1408 return worker;
1409 };
1410
1411 }).call(Mode.prototype);
1412
1413 exports.Mode = Mode;
1414
1415 });
1416
1417 define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1418
1419
1420 var oop = require("../lib/oop");
1421 var lang = require("../lib/lang");
1422 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1423 var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
1424 var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1425 var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
1426 var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1427 var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
1428
1429 var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1430 var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1431 var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
1432
1433 var CssHighlightRules = function() {
1434
1435 var keywordMapper = this.createKeywordMapper({
1436 "support.function": supportFunction,
1437 "support.constant": supportConstant,
1438 "support.type": supportType,
1439 "support.constant.color": supportConstantColor,
1440 "support.constant.fonts": supportConstantFonts
1441 }, "text", true);
1442
1443 var base_ruleset = [
1444 {
1445 token : "comment", // multi line comment
1446 regex : "\\/\\*",
1447 next : "ruleset_comment"
1448 }, {
1449 token : "string", // single line
1450 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1451 }, {
1452 token : "string", // single line
1453 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1454 }, {
1455 token : ["constant.numeric", "keyword"],
1456 regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
1457 }, {
1458 token : "constant.numeric",
1459 regex : numRe
1460 }, {
1461 token : "constant.numeric", // hex6 color
1462 regex : "#[a-f0-9]{6}"
1463 }, {
1464 token : "constant.numeric", // hex3 color
1465 regex : "#[a-f0-9]{3}"
1466 }, {
1467 token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1468 regex : pseudoElements
1469 }, {
1470 token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1471 regex : pseudoClasses
1472 }, {
1473 token : ["support.function", "string", "support.function"],
1474 regex : "(url\\()(.*)(\\))"
1475 }, {
1476 token : keywordMapper,
1477 regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1478 }, {
1479 caseInsensitive: true
1480 }
1481 ];
1482
1483 var ruleset = lang.copyArray(base_ruleset);
1484 ruleset.unshift({
1485 token : "paren.rparen",
1486 regex : "\\}",
1487 next: "start"
1488 });
1489
1490 var media_ruleset = lang.copyArray( base_ruleset );
1491 media_ruleset.unshift({
1492 token : "paren.rparen",
1493 regex : "\\}",
1494 next: "media"
1495 });
1496
1497 var base_comment = [{
1498 token : "comment", // comment spanning whole line
1499 regex : ".+"
1500 }];
1501
1502 var comment = lang.copyArray(base_comment);
1503 comment.unshift({
1504 token : "comment", // closing comment
1505 regex : ".*?\\*\\/",
1506 next : "start"
1507 });
1508
1509 var media_comment = lang.copyArray(base_comment);
1510 media_comment.unshift({
1511 token : "comment", // closing comment
1512 regex : ".*?\\*\\/",
1513 next : "media"
1514 });
1515
1516 var ruleset_comment = lang.copyArray(base_comment);
1517 ruleset_comment.unshift({
1518 token : "comment", // closing comment
1519 regex : ".*?\\*\\/",
1520 next : "ruleset"
1521 });
1522
1523 this.$rules = {
1524 "start" : [{
1525 token : "comment", // multi line comment
1526 regex : "\\/\\*",
1527 next : "comment"
1528 }, {
1529 token: "paren.lparen",
1530 regex: "\\{",
1531 next: "ruleset"
1532 }, {
1533 token: "string",
1534 regex: "@.*?{",
1535 next: "media"
1536 },{
1537 token: "keyword",
1538 regex: "#[a-z0-9-_]+"
1539 },{
1540 token: "variable",
1541 regex: "\\.[a-z0-9-_]+"
1542 },{
1543 token: "string",
1544 regex: ":[a-z0-9-_]+"
1545 },{
1546 token: "constant",
1547 regex: "[a-z0-9-_]+"
1548 },{
1549 caseInsensitive: true
1550 }],
1551
1552 "media" : [ {
1553 token : "comment", // multi line comment
1554 regex : "\\/\\*",
1555 next : "media_comment"
1556 }, {
1557 token: "paren.lparen",
1558 regex: "\\{",
1559 next: "media_ruleset"
1560 },{
1561 token: "string",
1562 regex: "\\}",
1563 next: "start"
1564 },{
1565 token: "keyword",
1566 regex: "#[a-z0-9-_]+"
1567 },{
1568 token: "variable",
1569 regex: "\\.[a-z0-9-_]+"
1570 },{
1571 token: "string",
1572 regex: ":[a-z0-9-_]+"
1573 },{
1574 token: "constant",
1575 regex: "[a-z0-9-_]+"
1576 },{
1577 caseInsensitive: true
1578 }],
1579
1580 "comment" : comment,
1581
1582 "ruleset" : ruleset,
1583 "ruleset_comment" : ruleset_comment,
1584
1585 "media_ruleset" : media_ruleset,
1586 "media_comment" : media_comment
1587 };
1588 };
1589
1590 oop.inherits(CssHighlightRules, TextHighlightRules);
1591
1592 exports.CssHighlightRules = CssHighlightRules;
1593
1594 });
1595
1596 define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
1597
1598
1599 var oop = require("../../lib/oop");
1600 var Behaviour = require("../behaviour").Behaviour;
1601 var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1602 var TokenIterator = require("../../token_iterator").TokenIterator;
1603
1604 var CssBehaviour = function () {
1605
1606 this.inherit(CstyleBehaviour);
1607
1608 this.add("colon", "insertion", function (state, action, editor, session, text) {
1609 if (text === ':') {
1610 var cursor = editor.getCursorPosition();
1611 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1612 var token = iterator.getCurrentToken();
1613 if (token && token.value.match(/\s+/)) {
1614 token = iterator.stepBackward();
1615 }
1616 if (token && token.type === 'support.type') {
1617 var line = session.doc.getLine(cursor.row);
1618 var rightChar = line.substring(cursor.column, cursor.column + 1);
1619 if (rightChar === ':') {
1620 return {
1621 text: '',
1622 selection: [1, 1]
1623 }
1624 }
1625 if (!line.substring(cursor.column).match(/^\s*;/)) {
1626 return {
1627 text: ':;',
1628 selection: [1, 1]
1629 }
1630 }
1631 }
1632 }
1633 });
1634
1635 this.add("colon", "deletion", function (state, action, editor, session, range) {
1636 var selected = session.doc.getTextRange(range);
1637 if (!range.isMultiLine() && selected === ':') {
1638 var cursor = editor.getCursorPosition();
1639 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1640 var token = iterator.getCurrentToken();
1641 if (token && token.value.match(/\s+/)) {
1642 token = iterator.stepBackward();
1643 }
1644 if (token && token.type === 'support.type') {
1645 var line = session.doc.getLine(range.start.row);
1646 var rightChar = line.substring(range.end.column, range.end.column + 1);
1647 if (rightChar === ';') {
1648 range.end.column ++;
1649 return range;
1650 }
1651 }
1652 }
1653 });
1654
1655 this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1656 if (text === ';') {
1657 var cursor = editor.getCursorPosition();
1658 var line = session.doc.getLine(cursor.row);
1659 var rightChar = line.substring(cursor.column, cursor.column + 1);
1660 if (rightChar === ';') {
1661 return {
1662 text: '',
1663 selection: [1, 1]
1664 }
1665 }
1666 }
1667 });
1668
1669 }
1670 oop.inherits(CssBehaviour, CstyleBehaviour);
1671
1672 exports.CssBehaviour = CssBehaviour;
1673 });
1674
1675 define('ace/mode/coldfusion_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/text_highlight_rules', 'ace/mode/xml_util'], function(require, exports, module) {
1676
1677
1678 var oop = require("../lib/oop");
1679 var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1680 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1681 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1682 var xml_util = require("./xml_util");
1683
1684 var ColdfusionHighlightRules = function() {
1685
1686 this.$rules = {
1687 start : [ {
1688 token : "text",
1689 regex : "<\\!\\[CDATA\\[",
1690 next : "cdata"
1691 }, {
1692 token : "xml-pe",
1693 regex : "<\\?.*?\\?>"
1694 }, {
1695 token : "comment",
1696 regex : "<\\!--",
1697 next : "comment"
1698 }, {
1699 token : "meta.tag",
1700 regex : "<(?=script)",
1701 next : "script"
1702 }, {
1703 token : "meta.tag",
1704 regex : "<(?=cfscript)",
1705 next : "cfscript"
1706 }, {
1707 token : "meta.tag",
1708 regex : "<(?=style)",
1709 next : "style"
1710 }, {
1711 token : "meta.tag", // opening tag
1712 regex : "<\\/?",
1713 next : "tag"
1714 } ],
1715
1716 cdata : [ {
1717 token : "text",
1718 regex : "\\]\\]>",
1719 next : "start"
1720 } ],
1721
1722 comment : [ {
1723 token : "comment",
1724 regex : ".*?-->",
1725 next : "start"
1726 }, {
1727 defaultToken : "comment"
1728 } ]
1729 };
1730
1731 xml_util.tag(this.$rules, "tag", "start");
1732 xml_util.tag(this.$rules, "style", "css-start");
1733 xml_util.tag(this.$rules, "script", "js-start");
1734 xml_util.tag(this.$rules, "cfscript", "js-start");
1735
1736 this.embedRules(JavaScriptHighlightRules, "js-", [{
1737 token: "comment",
1738 regex: "\\/\\/.*(?=<\\/script>)",
1739 next: "tag"
1740 }, {
1741 token: "meta.tag",
1742 regex: "<\\/(?=script)",
1743 next: "tag"
1744 }, {
1745 token: "comment",
1746 regex: "\\/\\/.*(?=<\\/cfscript>)",
1747 next: "tag"
1748 }, {
1749 token: "meta.tag",
1750 regex: "<\\/(?=cfscript)",
1751 next: "tag"
1752 }]);
1753
1754 this.embedRules(CssHighlightRules, "css-", [{
1755 token: "meta.tag",
1756 regex: "<\\/(?=style)",
1757 next: "tag"
1758 }]);
1759 };
1760
1761 oop.inherits(ColdfusionHighlightRules, TextHighlightRules);
1762
1763 exports.ColdfusionHighlightRules = ColdfusionHighlightRules;
1764 });
+0
-168
try/ace/mode-diff.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/diff', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/diff_highlight_rules', 'ace/mode/folding/diff'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var HighlightRules = require("./diff_highlight_rules").DiffHighlightRules;
37 var FoldMode = require("./folding/diff").FoldMode;
38
39 var Mode = function() {
40 this.$tokenizer = new Tokenizer(new HighlightRules().getRules());
41 this.foldingRules = new FoldMode(["diff", "index", "\\+{3}", "@@|\\*{5}"], "i");
42 };
43 oop.inherits(Mode, TextMode);
44
45 (function() {
46
47 }).call(Mode.prototype);
48
49 exports.Mode = Mode;
50
51 });
52
53 define('ace/mode/diff_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
54
55
56 var oop = require("../lib/oop");
57 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
58
59 var DiffHighlightRules = function() {
60
61
62
63 this.$rules = {
64 "start" : [{
65 regex: "^(?:\\*{15}|={67}|-{3}|\\+{3})$",
66 token: "punctuation.definition.separator.diff",
67 "name": "keyword"
68 }, { //diff.range.unified
69 regex: "^(@@)(\\s*.+?\\s*)(@@)(.*)$",
70 token: [
71 "constant",
72 "constant.numeric",
73 "constant",
74 "comment.doc.tag"
75 ]
76 }, { //diff.range.normal
77 regex: "^(\\d+)([,\\d]+)(a|d|c)(\\d+)([,\\d]+)(.*)$",
78 token: [
79 "constant.numeric",
80 "punctuation.definition.range.diff",
81 "constant.function",
82 "constant.numeric",
83 "punctuation.definition.range.diff",
84 "invalid"
85 ],
86 "name": "meta."
87 }, {
88 regex: "^(\\-{3}|\\+{3}|\\*{3})( .+)$",
89 token: [
90 "constant.numeric",
91 "meta.tag"
92 ]
93 }, { // added
94 regex: "^([!+>])(.*?)(\\s*)$",
95 token: [
96 "support.constant",
97 "text",
98 "invalid"
99 ]
100 }, { // removed
101 regex: "^([<\\-])(.*?)(\\s*)$",
102 token: [
103 "support.function",
104 "string",
105 "invalid"
106 ]
107 }, {
108 regex: "^(diff)(\\s+--\\w+)?(.+?)( .+)?$",
109 token: ["variable", "variable", "keyword", "variable"]
110 }, {
111 regex: "^Index.+$",
112 token: "variable"
113 }, {
114 regex: "\\s*$",
115 token: "invalid"
116 }, {
117 defaultToken: "invisible",
118 caseInsensitive: true
119 }
120 ]
121 };
122 };
123
124 oop.inherits(DiffHighlightRules, TextHighlightRules);
125
126 exports.DiffHighlightRules = DiffHighlightRules;
127 });
128
129 define('ace/mode/folding/diff', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
130
131
132 var oop = require("../../lib/oop");
133 var BaseFoldMode = require("./fold_mode").FoldMode;
134 var Range = require("../../range").Range;
135
136 var FoldMode = exports.FoldMode = function(levels, flag) {
137 this.regExpList = levels;
138 this.flag = flag;
139 this.foldingStartMarker = RegExp("^(" + levels.join("|") + ")", this.flag);
140 };
141 oop.inherits(FoldMode, BaseFoldMode);
142
143 (function() {
144 this.getFoldWidgetRange = function(session, foldStyle, row) {
145 var line = session.getLine(row);
146 var start = {row: row, column: line.length};
147
148 var regList = this.regExpList;
149 for (var i = 1; i <= regList.length; i++) {
150 var re = RegExp("^(" + regList.slice(0, i).join("|") + ")", this.flag);
151 if (re.test(line))
152 break;
153 }
154
155 for (var l = session.getLength(); ++row < l; ) {
156 line = session.getLine(row);
157 if (re.test(line))
158 break;
159 }
160 if (row == start.row + 1)
161 return;
162 return Range.fromPoints(start, {row: row - 1, column: line.length});
163 };
164
165 }).call(FoldMode.prototype);
166
167 });
+0
-951
try/ace/mode-erlang.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * Contributor(s):
30 *
31 *
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35 define('ace/mode/erlang', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/erlang_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
36
37
38 var oop = require("../lib/oop");
39 var TextMode = require("./text").Mode;
40 var Tokenizer = require("../tokenizer").Tokenizer;
41 var ErlangHighlightRules = require("./erlang_highlight_rules").ErlangHighlightRules;
42 var FoldMode = require("./folding/cstyle").FoldMode;
43
44 var Mode = function() {
45 var highlighter = new ErlangHighlightRules();
46 this.foldingRules = new FoldMode();
47 this.$tokenizer = new Tokenizer(highlighter.getRules());
48 };
49 oop.inherits(Mode, TextMode);
50
51 (function() {
52 this.lineCommentStart = "%";
53 this.blockComment = {start: "/*", end: "*/"};
54 }).call(Mode.prototype);
55
56 exports.Mode = Mode;
57 });
58
59 define('ace/mode/erlang_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
60
61
62 var oop = require("../lib/oop");
63 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
64
65 var ErlangHighlightRules = function() {
66
67 this.$rules = { start:
68 [ { include: '#module-directive' },
69 { include: '#import-export-directive' },
70 { include: '#behaviour-directive' },
71 { include: '#record-directive' },
72 { include: '#define-directive' },
73 { include: '#macro-directive' },
74 { include: '#directive' },
75 { include: '#function' },
76 { include: '#everything-else' } ],
77 '#atom':
78 [ { token: 'punctuation.definition.symbol.begin.erlang',
79 regex: '\'',
80 push:
81 [ { token: 'punctuation.definition.symbol.end.erlang',
82 regex: '\'',
83 next: 'pop' },
84 { token:
85 [ 'punctuation.definition.escape.erlang',
86 'constant.other.symbol.escape.erlang',
87 'punctuation.definition.escape.erlang',
88 'constant.other.symbol.escape.erlang',
89 'constant.other.symbol.escape.erlang' ],
90 regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
91 { token: 'invalid.illegal.atom.erlang', regex: '\\\\\\^?.?' },
92 { defaultToken: 'constant.other.symbol.quoted.single.erlang' } ] },
93 { token: 'constant.other.symbol.unquoted.erlang',
94 regex: '[a-z][a-zA-Z\\d@_]*' } ],
95 '#behaviour-directive':
96 [ { token:
97 [ 'meta.directive.behaviour.erlang',
98 'punctuation.section.directive.begin.erlang',
99 'meta.directive.behaviour.erlang',
100 'keyword.control.directive.behaviour.erlang',
101 'meta.directive.behaviour.erlang',
102 'punctuation.definition.parameters.begin.erlang',
103 'meta.directive.behaviour.erlang',
104 'entity.name.type.class.behaviour.definition.erlang',
105 'meta.directive.behaviour.erlang',
106 'punctuation.definition.parameters.end.erlang',
107 'meta.directive.behaviour.erlang',
108 'punctuation.section.directive.end.erlang' ],
109 regex: '^(\\s*)(-)(\\s*)(behaviour)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
110 '#binary':
111 [ { token: 'punctuation.definition.binary.begin.erlang',
112 regex: '<<',
113 push:
114 [ { token: 'punctuation.definition.binary.end.erlang',
115 regex: '>>',
116 next: 'pop' },
117 { token:
118 [ 'punctuation.separator.binary.erlang',
119 'punctuation.separator.value-size.erlang' ],
120 regex: '(,)|(:)' },
121 { include: '#internal-type-specifiers' },
122 { include: '#everything-else' },
123 { defaultToken: 'meta.structure.binary.erlang' } ] } ],
124 '#character':
125 [ { token:
126 [ 'punctuation.definition.character.erlang',
127 'punctuation.definition.escape.erlang',
128 'constant.character.escape.erlang',
129 'punctuation.definition.escape.erlang',
130 'constant.character.escape.erlang',
131 'constant.character.escape.erlang' ],
132 regex: '(\\$)(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
133 { token: 'invalid.illegal.character.erlang',
134 regex: '\\$\\\\\\^?.?' },
135 { token:
136 [ 'punctuation.definition.character.erlang',
137 'constant.character.erlang' ],
138 regex: '(\\$)(\\S)' },
139 { token: 'invalid.illegal.character.erlang', regex: '\\$.?' } ],
140 '#comment':
141 [ { token: 'punctuation.definition.comment.erlang',
142 regex: '%.*$',
143 push_:
144 [ { token: 'comment.line.percentage.erlang',
145 regex: '$',
146 next: 'pop' },
147 { defaultToken: 'comment.line.percentage.erlang' } ] } ],
148 '#define-directive':
149 [ { token:
150 [ 'meta.directive.define.erlang',
151 'punctuation.section.directive.begin.erlang',
152 'meta.directive.define.erlang',
153 'keyword.control.directive.define.erlang',
154 'meta.directive.define.erlang',
155 'punctuation.definition.parameters.begin.erlang',
156 'meta.directive.define.erlang',
157 'entity.name.function.macro.definition.erlang',
158 'meta.directive.define.erlang',
159 'punctuation.separator.parameters.erlang' ],
160 regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(,)',
161 push:
162 [ { token:
163 [ 'punctuation.definition.parameters.end.erlang',
164 'meta.directive.define.erlang',
165 'punctuation.section.directive.end.erlang' ],
166 regex: '(\\))(\\s*)(\\.)',
167 next: 'pop' },
168 { include: '#everything-else' },
169 { defaultToken: 'meta.directive.define.erlang' } ] },
170 { token: 'meta.directive.define.erlang',
171 regex: '(?=^\\s*-\\s*define\\s*\\(\\s*[a-zA-Z\\d@_]+\\s*\\()',
172 push:
173 [ { token:
174 [ 'punctuation.definition.parameters.end.erlang',
175 'meta.directive.define.erlang',
176 'punctuation.section.directive.end.erlang' ],
177 regex: '(\\))(\\s*)(\\.)',
178 next: 'pop' },
179 { token:
180 [ 'text',
181 'punctuation.section.directive.begin.erlang',
182 'text',
183 'keyword.control.directive.define.erlang',
184 'text',
185 'punctuation.definition.parameters.begin.erlang',
186 'text',
187 'entity.name.function.macro.definition.erlang',
188 'text',
189 'punctuation.definition.parameters.begin.erlang' ],
190 regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\()',
191 push:
192 [ { token:
193 [ 'punctuation.definition.parameters.end.erlang',
194 'text',
195 'punctuation.separator.parameters.erlang' ],
196 regex: '(\\))(\\s*)(,)',
197 next: 'pop' },
198 { token: 'punctuation.separator.parameters.erlang', regex: ',' },
199 { include: '#everything-else' } ] },
200 { token: 'punctuation.separator.define.erlang',
201 regex: '\\|\\||\\||:|;|,|\\.|->' },
202 { include: '#everything-else' },
203 { defaultToken: 'meta.directive.define.erlang' } ] } ],
204 '#directive':
205 [ { token:
206 [ 'meta.directive.erlang',
207 'punctuation.section.directive.begin.erlang',
208 'meta.directive.erlang',
209 'keyword.control.directive.erlang',
210 'meta.directive.erlang',
211 'punctuation.definition.parameters.begin.erlang' ],
212 regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\(?)',
213 push:
214 [ { token:
215 [ 'punctuation.definition.parameters.end.erlang',
216 'meta.directive.erlang',
217 'punctuation.section.directive.end.erlang' ],
218 regex: '(\\)?)(\\s*)(\\.)',
219 next: 'pop' },
220 { include: '#everything-else' },
221 { defaultToken: 'meta.directive.erlang' } ] },
222 { token:
223 [ 'meta.directive.erlang',
224 'punctuation.section.directive.begin.erlang',
225 'meta.directive.erlang',
226 'keyword.control.directive.erlang',
227 'meta.directive.erlang',
228 'punctuation.section.directive.end.erlang' ],
229 regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\.)' } ],
230 '#everything-else':
231 [ { include: '#comment' },
232 { include: '#record-usage' },
233 { include: '#macro-usage' },
234 { include: '#expression' },
235 { include: '#keyword' },
236 { include: '#textual-operator' },
237 { include: '#function-call' },
238 { include: '#tuple' },
239 { include: '#list' },
240 { include: '#binary' },
241 { include: '#parenthesized-expression' },
242 { include: '#character' },
243 { include: '#number' },
244 { include: '#atom' },
245 { include: '#string' },
246 { include: '#symbolic-operator' },
247 { include: '#variable' } ],
248 '#expression':
249 [ { token: 'keyword.control.if.erlang',
250 regex: '\\bif\\b',
251 push:
252 [ { token: 'keyword.control.end.erlang',
253 regex: '\\bend\\b',
254 next: 'pop' },
255 { include: '#internal-expression-punctuation' },
256 { include: '#everything-else' },
257 { defaultToken: 'meta.expression.if.erlang' } ] },
258 { token: 'keyword.control.case.erlang',
259 regex: '\\bcase\\b',
260 push:
261 [ { token: 'keyword.control.end.erlang',
262 regex: '\\bend\\b',
263 next: 'pop' },
264 { include: '#internal-expression-punctuation' },
265 { include: '#everything-else' },
266 { defaultToken: 'meta.expression.case.erlang' } ] },
267 { token: 'keyword.control.receive.erlang',
268 regex: '\\breceive\\b',
269 push:
270 [ { token: 'keyword.control.end.erlang',
271 regex: '\\bend\\b',
272 next: 'pop' },
273 { include: '#internal-expression-punctuation' },
274 { include: '#everything-else' },
275 { defaultToken: 'meta.expression.receive.erlang' } ] },
276 { token:
277 [ 'keyword.control.fun.erlang',
278 'text',
279 'entity.name.type.class.module.erlang',
280 'text',
281 'punctuation.separator.module-function.erlang',
282 'text',
283 'entity.name.function.erlang',
284 'text',
285 'punctuation.separator.function-arity.erlang' ],
286 regex: '\\b(fun)(\\s*)(?:([a-z][a-zA-Z\\d@_]*)(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*)(\\s*)(/)' },
287 { token: 'keyword.control.fun.erlang',
288 regex: '\\bfun\\b',
289 push:
290 [ { token: 'keyword.control.end.erlang',
291 regex: '\\bend\\b',
292 next: 'pop' },
293 { token: 'text',
294 regex: '(?=\\()',
295 push:
296 [ { token: 'punctuation.separator.clauses.erlang',
297 regex: ';|(?=\\bend\\b)',
298 next: 'pop' },
299 { include: '#internal-function-parts' } ] },
300 { include: '#everything-else' },
301 { defaultToken: 'meta.expression.fun.erlang' } ] },
302 { token: 'keyword.control.try.erlang',
303 regex: '\\btry\\b',
304 push:
305 [ { token: 'keyword.control.end.erlang',
306 regex: '\\bend\\b',
307 next: 'pop' },
308 { include: '#internal-expression-punctuation' },
309 { include: '#everything-else' },
310 { defaultToken: 'meta.expression.try.erlang' } ] },
311 { token: 'keyword.control.begin.erlang',
312 regex: '\\bbegin\\b',
313 push:
314 [ { token: 'keyword.control.end.erlang',
315 regex: '\\bend\\b',
316 next: 'pop' },
317 { include: '#internal-expression-punctuation' },
318 { include: '#everything-else' },
319 { defaultToken: 'meta.expression.begin.erlang' } ] },
320 { token: 'keyword.control.query.erlang',
321 regex: '\\bquery\\b',
322 push:
323 [ { token: 'keyword.control.end.erlang',
324 regex: '\\bend\\b',
325 next: 'pop' },
326 { include: '#everything-else' },
327 { defaultToken: 'meta.expression.query.erlang' } ] } ],
328 '#function':
329 [ { token:
330 [ 'meta.function.erlang',
331 'entity.name.function.definition.erlang',
332 'meta.function.erlang' ],
333 regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()',
334 push:
335 [ { token: 'punctuation.terminator.function.erlang',
336 regex: '\\.',
337 next: 'pop' },
338 { token: [ 'text', 'entity.name.function.erlang', 'text' ],
339 regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()' },
340 { token: 'text',
341 regex: '(?=\\()',
342 push:
343 [ { token: 'punctuation.separator.clauses.erlang',
344 regex: ';|(?=\\.)',
345 next: 'pop' },
346 { include: '#parenthesized-expression' },
347 { include: '#internal-function-parts' } ] },
348 { include: '#everything-else' },
349 { defaultToken: 'meta.function.erlang' } ] } ],
350 '#function-call':
351 [ { token: 'meta.function-call.erlang',
352 regex: '(?=(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*(?:\\(|:\\s*(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*\\())',
353 push:
354 [ { token: 'punctuation.definition.parameters.end.erlang',
355 regex: '\\)',
356 next: 'pop' },
357 { token:
358 [ 'entity.name.type.class.module.erlang',
359 'text',
360 'punctuation.separator.module-function.erlang',
361 'text',
362 'entity.name.function.guard.erlang',
363 'text',
364 'punctuation.definition.parameters.begin.erlang' ],
365 regex: '(?:(erlang)(\\s*)(:)(\\s*))?(is_atom|is_binary|is_constant|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_reference|is_tuple|is_record|abs|element|hd|length|node|round|self|size|tl|trunc)(\\s*)(\\()',
366 push:
367 [ { token: 'text', regex: '(?=\\))', next: 'pop' },
368 { token: 'punctuation.separator.parameters.erlang', regex: ',' },
369 { include: '#everything-else' } ] },
370 { token:
371 [ 'entity.name.type.class.module.erlang',
372 'text',
373 'punctuation.separator.module-function.erlang',
374 'text',
375 'entity.name.function.erlang',
376 'text',
377 'punctuation.definition.parameters.begin.erlang' ],
378 regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\()',
379 push:
380 [ { token: 'text', regex: '(?=\\))', next: 'pop' },
381 { token: 'punctuation.separator.parameters.erlang', regex: ',' },
382 { include: '#everything-else' } ] },
383 { defaultToken: 'meta.function-call.erlang' } ] } ],
384 '#import-export-directive':
385 [ { token:
386 [ 'meta.directive.import.erlang',
387 'punctuation.section.directive.begin.erlang',
388 'meta.directive.import.erlang',
389 'keyword.control.directive.import.erlang',
390 'meta.directive.import.erlang',
391 'punctuation.definition.parameters.begin.erlang',
392 'meta.directive.import.erlang',
393 'entity.name.type.class.module.erlang',
394 'meta.directive.import.erlang',
395 'punctuation.separator.parameters.erlang' ],
396 regex: '^(\\s*)(-)(\\s*)(import)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
397 push:
398 [ { token:
399 [ 'punctuation.definition.parameters.end.erlang',
400 'meta.directive.import.erlang',
401 'punctuation.section.directive.end.erlang' ],
402 regex: '(\\))(\\s*)(\\.)',
403 next: 'pop' },
404 { include: '#internal-function-list' },
405 { defaultToken: 'meta.directive.import.erlang' } ] },
406 { token:
407 [ 'meta.directive.export.erlang',
408 'punctuation.section.directive.begin.erlang',
409 'meta.directive.export.erlang',
410 'keyword.control.directive.export.erlang',
411 'meta.directive.export.erlang',
412 'punctuation.definition.parameters.begin.erlang' ],
413 regex: '^(\\s*)(-)(\\s*)(export)(\\s*)(\\()',
414 push:
415 [ { token:
416 [ 'punctuation.definition.parameters.end.erlang',
417 'meta.directive.export.erlang',
418 'punctuation.section.directive.end.erlang' ],
419 regex: '(\\))(\\s*)(\\.)',
420 next: 'pop' },
421 { include: '#internal-function-list' },
422 { defaultToken: 'meta.directive.export.erlang' } ] } ],
423 '#internal-expression-punctuation':
424 [ { token:
425 [ 'punctuation.separator.clause-head-body.erlang',
426 'punctuation.separator.clauses.erlang',
427 'punctuation.separator.expressions.erlang' ],
428 regex: '(->)|(;)|(,)' } ],
429 '#internal-function-list':
430 [ { token: 'punctuation.definition.list.begin.erlang',
431 regex: '\\[',
432 push:
433 [ { token: 'punctuation.definition.list.end.erlang',
434 regex: '\\]',
435 next: 'pop' },
436 { token:
437 [ 'entity.name.function.erlang',
438 'text',
439 'punctuation.separator.function-arity.erlang' ],
440 regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(/)',
441 push:
442 [ { token: 'punctuation.separator.list.erlang',
443 regex: ',|(?=\\])',
444 next: 'pop' },
445 { include: '#everything-else' } ] },
446 { include: '#everything-else' },
447 { defaultToken: 'meta.structure.list.function.erlang' } ] } ],
448 '#internal-function-parts':
449 [ { token: 'text',
450 regex: '(?=\\()',
451 push:
452 [ { token: 'punctuation.separator.clause-head-body.erlang',
453 regex: '->',
454 next: 'pop' },
455 { token: 'punctuation.definition.parameters.begin.erlang',
456 regex: '\\(',
457 push:
458 [ { token: 'punctuation.definition.parameters.end.erlang',
459 regex: '\\)',
460 next: 'pop' },
461 { token: 'punctuation.separator.parameters.erlang', regex: ',' },
462 { include: '#everything-else' } ] },
463 { token: 'punctuation.separator.guards.erlang', regex: ',|;' },
464 { include: '#everything-else' } ] },
465 { token: 'punctuation.separator.expressions.erlang',
466 regex: ',' },
467 { include: '#everything-else' } ],
468 '#internal-record-body':
469 [ { token: 'punctuation.definition.class.record.begin.erlang',
470 regex: '\\{',
471 push:
472 [ { token: 'meta.structure.record.erlang',
473 regex: '(?=\\})',
474 next: 'pop' },
475 { token:
476 [ 'variable.other.field.erlang',
477 'variable.language.omitted.field.erlang',
478 'text',
479 'keyword.operator.assignment.erlang' ],
480 regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')|(_))(\\s*)(=|::)',
481 push:
482 [ { token: 'punctuation.separator.class.record.erlang',
483 regex: ',|(?=\\})',
484 next: 'pop' },
485 { include: '#everything-else' } ] },
486 { token:
487 [ 'variable.other.field.erlang',
488 'text',
489 'punctuation.separator.class.record.erlang' ],
490 regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)((?:,)?)' },
491 { include: '#everything-else' },
492 { defaultToken: 'meta.structure.record.erlang' } ] } ],
493 '#internal-type-specifiers':
494 [ { token: 'punctuation.separator.value-type.erlang',
495 regex: '/',
496 push:
497 [ { token: 'text', regex: '(?=,|:|>>)', next: 'pop' },
498 { token:
499 [ 'storage.type.erlang',
500 'storage.modifier.signedness.erlang',
501 'storage.modifier.endianness.erlang',
502 'storage.modifier.unit.erlang',
503 'punctuation.separator.type-specifiers.erlang' ],
504 regex: '(integer|float|binary|bytes|bitstring|bits)|(signed|unsigned)|(big|little|native)|(unit)|(-)' } ] } ],
505 '#keyword':
506 [ { token: 'keyword.control.erlang',
507 regex: '\\b(?:after|begin|case|catch|cond|end|fun|if|let|of|query|try|receive|when)\\b' } ],
508 '#list':
509 [ { token: 'punctuation.definition.list.begin.erlang',
510 regex: '\\[',
511 push:
512 [ { token: 'punctuation.definition.list.end.erlang',
513 regex: '\\]',
514 next: 'pop' },
515 { token: 'punctuation.separator.list.erlang',
516 regex: '\\||\\|\\||,' },
517 { include: '#everything-else' },
518 { defaultToken: 'meta.structure.list.erlang' } ] } ],
519 '#macro-directive':
520 [ { token:
521 [ 'meta.directive.ifdef.erlang',
522 'punctuation.section.directive.begin.erlang',
523 'meta.directive.ifdef.erlang',
524 'keyword.control.directive.ifdef.erlang',
525 'meta.directive.ifdef.erlang',
526 'punctuation.definition.parameters.begin.erlang',
527 'meta.directive.ifdef.erlang',
528 'entity.name.function.macro.erlang',
529 'meta.directive.ifdef.erlang',
530 'punctuation.definition.parameters.end.erlang',
531 'meta.directive.ifdef.erlang',
532 'punctuation.section.directive.end.erlang' ],
533 regex: '^(\\s*)(-)(\\s*)(ifdef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
534 { token:
535 [ 'meta.directive.ifndef.erlang',
536 'punctuation.section.directive.begin.erlang',
537 'meta.directive.ifndef.erlang',
538 'keyword.control.directive.ifndef.erlang',
539 'meta.directive.ifndef.erlang',
540 'punctuation.definition.parameters.begin.erlang',
541 'meta.directive.ifndef.erlang',
542 'entity.name.function.macro.erlang',
543 'meta.directive.ifndef.erlang',
544 'punctuation.definition.parameters.end.erlang',
545 'meta.directive.ifndef.erlang',
546 'punctuation.section.directive.end.erlang' ],
547 regex: '^(\\s*)(-)(\\s*)(ifndef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
548 { token:
549 [ 'meta.directive.undef.erlang',
550 'punctuation.section.directive.begin.erlang',
551 'meta.directive.undef.erlang',
552 'keyword.control.directive.undef.erlang',
553 'meta.directive.undef.erlang',
554 'punctuation.definition.parameters.begin.erlang',
555 'meta.directive.undef.erlang',
556 'entity.name.function.macro.erlang',
557 'meta.directive.undef.erlang',
558 'punctuation.definition.parameters.end.erlang',
559 'meta.directive.undef.erlang',
560 'punctuation.section.directive.end.erlang' ],
561 regex: '^(\\s*)(-)(\\s*)(undef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' } ],
562 '#macro-usage':
563 [ { token:
564 [ 'keyword.operator.macro.erlang',
565 'meta.macro-usage.erlang',
566 'entity.name.function.macro.erlang' ],
567 regex: '(\\?\\??)(\\s*)([a-zA-Z\\d@_]+)' } ],
568 '#module-directive':
569 [ { token:
570 [ 'meta.directive.module.erlang',
571 'punctuation.section.directive.begin.erlang',
572 'meta.directive.module.erlang',
573 'keyword.control.directive.module.erlang',
574 'meta.directive.module.erlang',
575 'punctuation.definition.parameters.begin.erlang',
576 'meta.directive.module.erlang',
577 'entity.name.type.class.module.definition.erlang',
578 'meta.directive.module.erlang',
579 'punctuation.definition.parameters.end.erlang',
580 'meta.directive.module.erlang',
581 'punctuation.section.directive.end.erlang' ],
582 regex: '^(\\s*)(-)(\\s*)(module)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
583 '#number':
584 [ { token: 'text',
585 regex: '(?=\\d)',
586 push:
587 [ { token: 'text', regex: '(?!\\d)', next: 'pop' },
588 { token:
589 [ 'constant.numeric.float.erlang',
590 'punctuation.separator.integer-float.erlang',
591 'constant.numeric.float.erlang',
592 'punctuation.separator.float-exponent.erlang' ],
593 regex: '(\\d+)(\\.)(\\d+)((?:[eE][\\+\\-]?\\d+)?)' },
594 { token:
595 [ 'constant.numeric.integer.binary.erlang',
596 'punctuation.separator.base-integer.erlang',
597 'constant.numeric.integer.binary.erlang' ],
598 regex: '(2)(#)([0-1]+)' },
599 { token:
600 [ 'constant.numeric.integer.base-3.erlang',
601 'punctuation.separator.base-integer.erlang',
602 'constant.numeric.integer.base-3.erlang' ],
603 regex: '(3)(#)([0-2]+)' },
604 { token:
605 [ 'constant.numeric.integer.base-4.erlang',
606 'punctuation.separator.base-integer.erlang',
607 'constant.numeric.integer.base-4.erlang' ],
608 regex: '(4)(#)([0-3]+)' },
609 { token:
610 [ 'constant.numeric.integer.base-5.erlang',
611 'punctuation.separator.base-integer.erlang',
612 'constant.numeric.integer.base-5.erlang' ],
613 regex: '(5)(#)([0-4]+)' },
614 { token:
615 [ 'constant.numeric.integer.base-6.erlang',
616 'punctuation.separator.base-integer.erlang',
617 'constant.numeric.integer.base-6.erlang' ],
618 regex: '(6)(#)([0-5]+)' },
619 { token:
620 [ 'constant.numeric.integer.base-7.erlang',
621 'punctuation.separator.base-integer.erlang',
622 'constant.numeric.integer.base-7.erlang' ],
623 regex: '(7)(#)([0-6]+)' },
624 { token:
625 [ 'constant.numeric.integer.octal.erlang',
626 'punctuation.separator.base-integer.erlang',
627 'constant.numeric.integer.octal.erlang' ],
628 regex: '(8)(#)([0-7]+)' },
629 { token:
630 [ 'constant.numeric.integer.base-9.erlang',
631 'punctuation.separator.base-integer.erlang',
632 'constant.numeric.integer.base-9.erlang' ],
633 regex: '(9)(#)([0-8]+)' },
634 { token:
635 [ 'constant.numeric.integer.decimal.erlang',
636 'punctuation.separator.base-integer.erlang',
637 'constant.numeric.integer.decimal.erlang' ],
638 regex: '(10)(#)(\\d+)' },
639 { token:
640 [ 'constant.numeric.integer.base-11.erlang',
641 'punctuation.separator.base-integer.erlang',
642 'constant.numeric.integer.base-11.erlang' ],
643 regex: '(11)(#)([\\daA]+)' },
644 { token:
645 [ 'constant.numeric.integer.base-12.erlang',
646 'punctuation.separator.base-integer.erlang',
647 'constant.numeric.integer.base-12.erlang' ],
648 regex: '(12)(#)([\\da-bA-B]+)' },
649 { token:
650 [ 'constant.numeric.integer.base-13.erlang',
651 'punctuation.separator.base-integer.erlang',
652 'constant.numeric.integer.base-13.erlang' ],
653 regex: '(13)(#)([\\da-cA-C]+)' },
654 { token:
655 [ 'constant.numeric.integer.base-14.erlang',
656 'punctuation.separator.base-integer.erlang',
657 'constant.numeric.integer.base-14.erlang' ],
658 regex: '(14)(#)([\\da-dA-D]+)' },
659 { token:
660 [ 'constant.numeric.integer.base-15.erlang',
661 'punctuation.separator.base-integer.erlang',
662 'constant.numeric.integer.base-15.erlang' ],
663 regex: '(15)(#)([\\da-eA-E]+)' },
664 { token:
665 [ 'constant.numeric.integer.hexadecimal.erlang',
666 'punctuation.separator.base-integer.erlang',
667 'constant.numeric.integer.hexadecimal.erlang' ],
668 regex: '(16)(#)([\\da-fA-F]+)' },
669 { token:
670 [ 'constant.numeric.integer.base-17.erlang',
671 'punctuation.separator.base-integer.erlang',
672 'constant.numeric.integer.base-17.erlang' ],
673 regex: '(17)(#)([\\da-gA-G]+)' },
674 { token:
675 [ 'constant.numeric.integer.base-18.erlang',
676 'punctuation.separator.base-integer.erlang',
677 'constant.numeric.integer.base-18.erlang' ],
678 regex: '(18)(#)([\\da-hA-H]+)' },
679 { token:
680 [ 'constant.numeric.integer.base-19.erlang',
681 'punctuation.separator.base-integer.erlang',
682 'constant.numeric.integer.base-19.erlang' ],
683 regex: '(19)(#)([\\da-iA-I]+)' },
684 { token:
685 [ 'constant.numeric.integer.base-20.erlang',
686 'punctuation.separator.base-integer.erlang',
687 'constant.numeric.integer.base-20.erlang' ],
688 regex: '(20)(#)([\\da-jA-J]+)' },
689 { token:
690 [ 'constant.numeric.integer.base-21.erlang',
691 'punctuation.separator.base-integer.erlang',
692 'constant.numeric.integer.base-21.erlang' ],
693 regex: '(21)(#)([\\da-kA-K]+)' },
694 { token:
695 [ 'constant.numeric.integer.base-22.erlang',
696 'punctuation.separator.base-integer.erlang',
697 'constant.numeric.integer.base-22.erlang' ],
698 regex: '(22)(#)([\\da-lA-L]+)' },
699 { token:
700 [ 'constant.numeric.integer.base-23.erlang',
701 'punctuation.separator.base-integer.erlang',
702 'constant.numeric.integer.base-23.erlang' ],
703 regex: '(23)(#)([\\da-mA-M]+)' },
704 { token:
705 [ 'constant.numeric.integer.base-24.erlang',
706 'punctuation.separator.base-integer.erlang',
707 'constant.numeric.integer.base-24.erlang' ],
708 regex: '(24)(#)([\\da-nA-N]+)' },
709 { token:
710 [ 'constant.numeric.integer.base-25.erlang',
711 'punctuation.separator.base-integer.erlang',
712 'constant.numeric.integer.base-25.erlang' ],
713 regex: '(25)(#)([\\da-oA-O]+)' },
714 { token:
715 [ 'constant.numeric.integer.base-26.erlang',
716 'punctuation.separator.base-integer.erlang',
717 'constant.numeric.integer.base-26.erlang' ],
718 regex: '(26)(#)([\\da-pA-P]+)' },
719 { token:
720 [ 'constant.numeric.integer.base-27.erlang',
721 'punctuation.separator.base-integer.erlang',
722 'constant.numeric.integer.base-27.erlang' ],
723 regex: '(27)(#)([\\da-qA-Q]+)' },
724 { token:
725 [ 'constant.numeric.integer.base-28.erlang',
726 'punctuation.separator.base-integer.erlang',
727 'constant.numeric.integer.base-28.erlang' ],
728 regex: '(28)(#)([\\da-rA-R]+)' },
729 { token:
730 [ 'constant.numeric.integer.base-29.erlang',
731 'punctuation.separator.base-integer.erlang',
732 'constant.numeric.integer.base-29.erlang' ],
733 regex: '(29)(#)([\\da-sA-S]+)' },
734 { token:
735 [ 'constant.numeric.integer.base-30.erlang',
736 'punctuation.separator.base-integer.erlang',
737 'constant.numeric.integer.base-30.erlang' ],
738 regex: '(30)(#)([\\da-tA-T]+)' },
739 { token:
740 [ 'constant.numeric.integer.base-31.erlang',
741 'punctuation.separator.base-integer.erlang',
742 'constant.numeric.integer.base-31.erlang' ],
743 regex: '(31)(#)([\\da-uA-U]+)' },
744 { token:
745 [ 'constant.numeric.integer.base-32.erlang',
746 'punctuation.separator.base-integer.erlang',
747 'constant.numeric.integer.base-32.erlang' ],
748 regex: '(32)(#)([\\da-vA-V]+)' },
749 { token:
750 [ 'constant.numeric.integer.base-33.erlang',
751 'punctuation.separator.base-integer.erlang',
752 'constant.numeric.integer.base-33.erlang' ],
753 regex: '(33)(#)([\\da-wA-W]+)' },
754 { token:
755 [ 'constant.numeric.integer.base-34.erlang',
756 'punctuation.separator.base-integer.erlang',
757 'constant.numeric.integer.base-34.erlang' ],
758 regex: '(34)(#)([\\da-xA-X]+)' },
759 { token:
760 [ 'constant.numeric.integer.base-35.erlang',
761 'punctuation.separator.base-integer.erlang',
762 'constant.numeric.integer.base-35.erlang' ],
763 regex: '(35)(#)([\\da-yA-Y]+)' },
764 { token:
765 [ 'constant.numeric.integer.base-36.erlang',
766 'punctuation.separator.base-integer.erlang',
767 'constant.numeric.integer.base-36.erlang' ],
768 regex: '(36)(#)([\\da-zA-Z]+)' },
769 { token: 'invalid.illegal.integer.erlang',
770 regex: '\\d+#[\\da-zA-Z]+' },
771 { token: 'constant.numeric.integer.decimal.erlang',
772 regex: '\\d+' } ] } ],
773 '#parenthesized-expression':
774 [ { token: 'punctuation.section.expression.begin.erlang',
775 regex: '\\(',
776 push:
777 [ { token: 'punctuation.section.expression.end.erlang',
778 regex: '\\)',
779 next: 'pop' },
780 { include: '#everything-else' },
781 { defaultToken: 'meta.expression.parenthesized' } ] } ],
782 '#record-directive':
783 [ { token:
784 [ 'meta.directive.record.erlang',
785 'punctuation.section.directive.begin.erlang',
786 'meta.directive.record.erlang',
787 'keyword.control.directive.import.erlang',
788 'meta.directive.record.erlang',
789 'punctuation.definition.parameters.begin.erlang',
790 'meta.directive.record.erlang',
791 'entity.name.type.class.record.definition.erlang',
792 'meta.directive.record.erlang',
793 'punctuation.separator.parameters.erlang' ],
794 regex: '^(\\s*)(-)(\\s*)(record)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
795 push:
796 [ { token:
797 [ 'punctuation.definition.class.record.end.erlang',
798 'meta.directive.record.erlang',
799 'punctuation.definition.parameters.end.erlang',
800 'meta.directive.record.erlang',
801 'punctuation.section.directive.end.erlang' ],
802 regex: '(\\})(\\s*)(\\))(\\s*)(\\.)',
803 next: 'pop' },
804 { include: '#internal-record-body' },
805 { defaultToken: 'meta.directive.record.erlang' } ] } ],
806 '#record-usage':
807 [ { token:
808 [ 'keyword.operator.record.erlang',
809 'meta.record-usage.erlang',
810 'entity.name.type.class.record.erlang',
811 'meta.record-usage.erlang',
812 'punctuation.separator.record-field.erlang',
813 'meta.record-usage.erlang',
814 'variable.other.field.erlang' ],
815 regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\.)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')' },
816 { token:
817 [ 'keyword.operator.record.erlang',
818 'meta.record-usage.erlang',
819 'entity.name.type.class.record.erlang' ],
820 regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')',
821 push:
822 [ { token: 'punctuation.definition.class.record.end.erlang',
823 regex: '\\}',
824 next: 'pop' },
825 { include: '#internal-record-body' },
826 { defaultToken: 'meta.record-usage.erlang' } ] } ],
827 '#string':
828 [ { token: 'punctuation.definition.string.begin.erlang',
829 regex: '"',
830 push:
831 [ { token: 'punctuation.definition.string.end.erlang',
832 regex: '"',
833 next: 'pop' },
834 { token:
835 [ 'punctuation.definition.escape.erlang',
836 'constant.character.escape.erlang',
837 'punctuation.definition.escape.erlang',
838 'constant.character.escape.erlang',
839 'constant.character.escape.erlang' ],
840 regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
841 { token: 'invalid.illegal.string.erlang', regex: '\\\\\\^?.?' },
842 { token:
843 [ 'punctuation.definition.placeholder.erlang',
844 'punctuation.separator.placeholder-parts.erlang',
845 'constant.other.placeholder.erlang',
846 'punctuation.separator.placeholder-parts.erlang',
847 'punctuation.separator.placeholder-parts.erlang',
848 'constant.other.placeholder.erlang',
849 'punctuation.separator.placeholder-parts.erlang',
850 'punctuation.separator.placeholder-parts.erlang',
851 'punctuation.separator.placeholder-parts.erlang',
852 'constant.other.placeholder.erlang',
853 'constant.other.placeholder.erlang' ],
854 regex: '(~)(?:((?:\\-)?)(\\d+)|(\\*))?(?:(\\.)(?:(\\d+)|(\\*)))?(?:(\\.)(?:(\\*)|(.)))?([~cfegswpWPBX#bx\\+ni])' },
855 { token:
856 [ 'punctuation.definition.placeholder.erlang',
857 'punctuation.separator.placeholder-parts.erlang',
858 'constant.other.placeholder.erlang',
859 'constant.other.placeholder.erlang' ],
860 regex: '(~)((?:\\*)?)((?:\\d+)?)([~du\\-#fsacl])' },
861 { token: 'invalid.illegal.string.erlang', regex: '~.?' },
862 { defaultToken: 'string.quoted.double.erlang' } ] } ],
863 '#symbolic-operator':
864 [ { token: 'keyword.operator.symbolic.erlang',
865 regex: '\\+\\+|\\+|--|-|\\*|/=|/|=/=|=:=|==|=<|=|<-|<|>=|>|!|::' } ],
866 '#textual-operator':
867 [ { token: 'keyword.operator.textual.erlang',
868 regex: '\\b(?:andalso|band|and|bxor|xor|bor|orelse|or|bnot|not|bsl|bsr|div|rem)\\b' } ],
869 '#tuple':
870 [ { token: 'punctuation.definition.tuple.begin.erlang',
871 regex: '\\{',
872 push:
873 [ { token: 'punctuation.definition.tuple.end.erlang',
874 regex: '\\}',
875 next: 'pop' },
876 { token: 'punctuation.separator.tuple.erlang', regex: ',' },
877 { include: '#everything-else' },
878 { defaultToken: 'meta.structure.tuple.erlang' } ] } ],
879 '#variable':
880 [ { token: [ 'variable.other.erlang', 'variable.language.omitted.erlang' ],
881 regex: '(_[a-zA-Z\\d@_]+|[A-Z][a-zA-Z\\d@_]*)|(_)' } ] }
882
883 this.normalizeRules();
884 };
885
886 ErlangHighlightRules.metaData = { comment: 'The recognition of function definitions and compiler directives (such as module, record and macro definitions) requires that each of the aforementioned constructs must be the first string inside a line (except for whitespace). Also, the function/module/record/macro names must be given unquoted. -- desp',
887 fileTypes: [ 'erl', 'hrl' ],
888 keyEquivalent: '^~E',
889 name: 'Erlang',
890 scopeName: 'source.erlang' }
891
892
893 oop.inherits(ErlangHighlightRules, TextHighlightRules);
894
895 exports.ErlangHighlightRules = ErlangHighlightRules;
896 });
897
898 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
899
900
901 var oop = require("../../lib/oop");
902 var Range = require("../../range").Range;
903 var BaseFoldMode = require("./fold_mode").FoldMode;
904
905 var FoldMode = exports.FoldMode = function(commentRegex) {
906 if (commentRegex) {
907 this.foldingStartMarker = new RegExp(
908 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
909 );
910 this.foldingStopMarker = new RegExp(
911 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
912 );
913 }
914 };
915 oop.inherits(FoldMode, BaseFoldMode);
916
917 (function() {
918
919 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
920 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
921
922 this.getFoldWidgetRange = function(session, foldStyle, row) {
923 var line = session.getLine(row);
924 var match = line.match(this.foldingStartMarker);
925 if (match) {
926 var i = match.index;
927
928 if (match[1])
929 return this.openingBracketBlock(session, match[1], row, i);
930
931 return session.getCommentFoldRange(row, i + match[0].length, 1);
932 }
933
934 if (foldStyle !== "markbeginend")
935 return;
936
937 var match = line.match(this.foldingStopMarker);
938 if (match) {
939 var i = match.index + match[0].length;
940
941 if (match[1])
942 return this.closingBracketBlock(session, match[1], row, i);
943
944 return session.getCommentFoldRange(row, i, -1);
945 }
946 };
947
948 }).call(FoldMode.prototype);
949
950 });
+0
-239
try/ace/mode-forth.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * Contributor(s):
30 *
31 *
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35 define('ace/mode/forth', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/forth_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
36
37
38 var oop = require("../lib/oop");
39 var TextMode = require("./text").Mode;
40 var Tokenizer = require("../tokenizer").Tokenizer;
41 var ForthHighlightRules = require("./forth_highlight_rules").ForthHighlightRules;
42 var FoldMode = require("./folding/cstyle").FoldMode;
43
44 var Mode = function() {
45 var highlighter = new ForthHighlightRules();
46 this.foldingRules = new FoldMode();
47 this.$tokenizer = new Tokenizer(highlighter.getRules());
48 };
49 oop.inherits(Mode, TextMode);
50
51 (function() {
52 this.lineCommentStart = "(?<=^|\\s)\\.?\\( [^)]*\\)";
53 this.blockComment = {start: "/*", end: "*/"};
54 }).call(Mode.prototype);
55
56 exports.Mode = Mode;
57 });
58
59 define('ace/mode/forth_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
60
61
62 var oop = require("../lib/oop");
63 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
64
65 var ForthHighlightRules = function() {
66
67 this.$rules = { start: [ { include: '#forth' } ],
68 '#comment':
69 [ { token: 'comment.line.double-dash.forth',
70 regex: '(?:^|\\s)--\\s.*$',
71 comment: 'line comments for iForth' },
72 { token: 'comment.line.backslash.forth',
73 regex: '(?:^|\\s)\\\\[\\s\\S]*$',
74 comment: 'ANSI line comment' },
75 { token: 'comment.line.backslash-g.forth',
76 regex: '(?:^|\\s)\\\\[Gg] .*$',
77 comment: 'gForth line comment' },
78 { token: 'comment.block.forth',
79 regex: '(?:^|\\s)\\(\\*(?=\\s|$)',
80 push:
81 [ { token: 'comment.block.forth',
82 regex: '(?:^|\\s)\\*\\)(?=\\s|$)',
83 next: 'pop' },
84 { defaultToken: 'comment.block.forth' } ],
85 comment: 'multiline comments for iForth' },
86 { token: 'comment.block.documentation.forth',
87 regex: '\\bDOC\\b',
88 caseInsensitive: true,
89 push:
90 [ { token: 'comment.block.documentation.forth',
91 regex: '\\bENDDOC\\b',
92 caseInsensitive: true,
93 next: 'pop' },
94 { defaultToken: 'comment.block.documentation.forth' } ],
95 comment: 'documentation comments for iForth' },
96 { token: 'comment.line.parentheses.forth',
97 regex: '(?:^|\\s)\\.?\\( [^)]*\\)',
98 comment: 'ANSI line comment' } ],
99 '#constant':
100 [ { token: 'constant.language.forth',
101 regex: '(?:^|\\s)(?:TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s|$)',
102 caseInsensitive: true},
103 { token: 'constant.numeric.forth',
104 regex: '(?:^|\\s)[$#%]?[-+]?[0-9]+(?:\\.[0-9]*e-?[0-9]+|\\.?[0-9a-fA-F]*)(?=\\s|$)'},
105 { token: 'constant.character.forth',
106 regex: '(?:^|\\s)(?:[&^]\\S|(?:"|\')\\S(?:"|\'))(?=\\s|$)'}],
107 '#forth':
108 [ { include: '#constant' },
109 { include: '#comment' },
110 { include: '#string' },
111 { include: '#word' },
112 { include: '#variable' },
113 { include: '#storage' },
114 { include: '#word-def' } ],
115 '#storage':
116 [ { token: 'storage.type.forth',
117 regex: '(?:^|\\s)(?:2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY)(?=\\s|$)',
118 caseInsensitive: true}],
119 '#string':
120 [ { token: 'string.quoted.double.forth',
121 regex: '(ABORT" |BREAK" |\\." |C" |0"|S\\\\?" )([^"]+")',
122 caseInsensitive: true},
123 { token: 'string.unquoted.forth',
124 regex: '(?:INCLUDE|NEEDS|REQUIRE|USE)[ ]\\S+(?=\\s|$)',
125 caseInsensitive: true}],
126 '#variable':
127 [ { token: 'variable.language.forth',
128 regex: '\\b(?:I|J)\\b',
129 caseInsensitive: true } ],
130 '#word':
131 [ { token: 'keyword.control.immediate.forth',
132 regex: '(?:^|\\s)\\[(?:\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE)\\](?=\\s|$)',
133 caseInsensitive: true},
134 { token: 'keyword.other.immediate.forth',
135 regex: '(?:^|\\s)(?:COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|])(?=\\s|$)',
136 caseInsensitive: true},
137 { token: 'keyword.control.compile-only.forth',
138 regex: '(?:^|\\s)(?:-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE)(?=\\s|$)',
139 caseInsensitive: true},
140 { token: 'keyword.other.compile-only.forth',
141 regex: '(?:^|\\s)(?:\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE)(?=\\s|$)',
142 caseInsensitive: true},
143 { token: 'keyword.other.non-immediate.forth',
144 regex: '(?:^|\\s)(?:\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE)(?=\\s|$)',
145 caseInsensitive: true},
146 { token: 'keyword.other.warning.forth',
147 regex: '(?:^|\\s)(?:~~|BREAK:|BREAK"|DBG)(?=\\s|$)',
148 caseInsensitive: true}],
149 '#word-def':
150 [ { token:
151 [ 'keyword.other.compile-only.forth',
152 'keyword.other.compile-only.forth',
153 'meta.block.forth',
154 'entity.name.function.forth' ],
155 regex: '(:NONAME)|(^:|\\s:)(\\s)(\\S+)(?=\\s|$)',
156 caseInsensitive: true,
157 push:
158 [ { token: 'keyword.other.compile-only.forth',
159 regex: ';(?:CODE)?',
160 caseInsensitive: true,
161 next: 'pop' },
162 { include: '#constant' },
163 { include: '#comment' },
164 { include: '#string' },
165 { include: '#word' },
166 { include: '#variable' },
167 { include: '#storage' },
168 { defaultToken: 'meta.block.forth' } ] } ] }
169
170 this.normalizeRules();
171 };
172
173 ForthHighlightRules.metaData = { fileTypes: [ 'frt', 'fs', 'ldr' ],
174 foldingStartMarker: '/\\*\\*|\\{\\s*$',
175 foldingStopMarker: '\\*\\*/|^\\s*\\}',
176 keyEquivalent: '^~F',
177 name: 'Forth',
178 scopeName: 'source.forth' }
179
180
181 oop.inherits(ForthHighlightRules, TextHighlightRules);
182
183 exports.ForthHighlightRules = ForthHighlightRules;
184 });
185
186 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
187
188
189 var oop = require("../../lib/oop");
190 var Range = require("../../range").Range;
191 var BaseFoldMode = require("./fold_mode").FoldMode;
192
193 var FoldMode = exports.FoldMode = function(commentRegex) {
194 if (commentRegex) {
195 this.foldingStartMarker = new RegExp(
196 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
197 );
198 this.foldingStopMarker = new RegExp(
199 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
200 );
201 }
202 };
203 oop.inherits(FoldMode, BaseFoldMode);
204
205 (function() {
206
207 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
208 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
209
210 this.getFoldWidgetRange = function(session, foldStyle, row) {
211 var line = session.getLine(row);
212 var match = line.match(this.foldingStartMarker);
213 if (match) {
214 var i = match.index;
215
216 if (match[1])
217 return this.openingBracketBlock(session, match[1], row, i);
218
219 return session.getCommentFoldRange(row, i + match[0].length, 1);
220 }
221
222 if (foldStyle !== "markbeginend")
223 return;
224
225 var match = line.match(this.foldingStopMarker);
226 if (match) {
227 var i = match.index + match[0].length;
228
229 if (match[1])
230 return this.closingBracketBlock(session, match[1], row, i);
231
232 return session.getCommentFoldRange(row, i, -1);
233 }
234 };
235
236 }).call(FoldMode.prototype);
237
238 });
+0
-632
try/ace/mode-golang.js less more
0 define('ace/mode/golang', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/golang_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
1
2 var oop = require("../lib/oop");
3 var TextMode = require("./text").Mode;
4 var Tokenizer = require("../tokenizer").Tokenizer;
5 var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
6 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
7 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
8 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
9
10 var Mode = function() {
11 this.$tokenizer = new Tokenizer(new GolangHighlightRules().getRules());
12 this.$outdent = new MatchingBraceOutdent();
13 this.foldingRules = new CStyleFoldMode();
14 };
15 oop.inherits(Mode, TextMode);
16
17 (function() {
18
19 this.lineCommentStart = "//";
20 this.blockComment = {start: "/*", end: "*/"};
21
22 this.getNextLineIndent = function(state, line, tab) {
23 var indent = this.$getIndent(line);
24
25 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
26 var tokens = tokenizedLine.tokens;
27 var endState = tokenizedLine.state;
28
29 if (tokens.length && tokens[tokens.length-1].type == "comment") {
30 return indent;
31 }
32
33 if (state == "start") {
34 var match = line.match(/^.*[\{\(\[]\s*$/);
35 if (match) {
36 indent += tab;
37 }
38 }
39
40 return indent;
41 };//end getNextLineIndent
42
43 this.checkOutdent = function(state, line, input) {
44 return this.$outdent.checkOutdent(line, input);
45 };
46
47 this.autoOutdent = function(state, doc, row) {
48 this.$outdent.autoOutdent(doc, row);
49 };
50
51 }).call(Mode.prototype);
52
53 exports.Mode = Mode;
54 });
55 define('ace/mode/golang_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
56 var oop = require("../lib/oop");
57 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
58 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
59
60 var GolangHighlightRules = function() {
61 var keywords = (
62 "true|else|false|break|case|return|goto|if|const|" +
63 "continue|struct|default|switch|for|" +
64 "func|import|package|chan|defer|fallthrough|go|interface|map|range" +
65 "select|type|var"
66 );
67 var buildinConstants = ("nil|true|false|iota");
68
69 var keywordMapper = this.createKeywordMapper({
70 "variable.language": "this",
71 "keyword": keywords,
72 "constant.language": buildinConstants
73 }, "identifier");
74
75 this.$rules = {
76 "start" : [
77 {
78 token : "comment",
79 regex : "\\/\\/.*$"
80 },
81 DocCommentHighlightRules.getStartRule("doc-start"),
82 {
83 token : "comment", // multi line comment
84 regex : "\\/\\*",
85 next : "comment"
86 }, {
87 token : "string", // single line
88 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
89 }, {
90 token : "string", // multi line string start
91 regex : '["].*\\\\$',
92 next : "qqstring"
93 }, {
94 token : "string", // single line
95 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
96 }, {
97 token : "string", // multi line string start
98 regex : "['].*\\\\$",
99 next : "qstring"
100 }, {
101 token : "constant.numeric", // hex
102 regex : "0[xX][0-9a-fA-F]+\\b"
103 }, {
104 token : "constant.numeric", // float
105 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
106 }, {
107 token : "constant", // <CONSTANT>
108 regex : "<[a-zA-Z0-9.]+>"
109 }, {
110 token : "keyword", // pre-compiler directivs
111 regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"
112 }, {
113 token : keywordMapper,
114 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
115 }, {
116 token : "keyword.operator",
117 regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
118 }, {
119 token : "punctuation.operator",
120 regex : "\\?|\\:|\\,|\\;|\\."
121 }, {
122 token : "paren.lparen",
123 regex : "[[({]"
124 }, {
125 token : "paren.rparen",
126 regex : "[\\])}]"
127 }, {
128 token : "text",
129 regex : "\\s+"
130 }
131 ],
132 "comment" : [
133 {
134 token : "comment", // closing comment
135 regex : ".*?\\*\\/",
136 next : "start"
137 }, {
138 token : "comment", // comment spanning whole line
139 regex : ".+"
140 }
141 ],
142 "qqstring" : [
143 {
144 token : "string",
145 regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
146 next : "start"
147 }, {
148 token : "string",
149 regex : '.+'
150 }
151 ],
152 "qstring" : [
153 {
154 token : "string",
155 regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
156 next : "start"
157 }, {
158 token : "string",
159 regex : '.+'
160 }
161 ]
162 };
163
164 this.embedRules(DocCommentHighlightRules, "doc-",
165 [ DocCommentHighlightRules.getEndRule("start") ]);
166 }
167 oop.inherits(GolangHighlightRules, TextHighlightRules);
168
169 exports.GolangHighlightRules = GolangHighlightRules;
170 });
171
172 define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
173
174
175 var oop = require("../lib/oop");
176 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
177
178 var DocCommentHighlightRules = function() {
179
180 this.$rules = {
181 "start" : [ {
182 token : "comment.doc.tag",
183 regex : "@[\\w\\d_]+" // TODO: fix email addresses
184 }, {
185 token : "comment.doc.tag",
186 regex : "\\bTODO\\b"
187 }, {
188 defaultToken : "comment.doc"
189 }]
190 };
191 };
192
193 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
194
195 DocCommentHighlightRules.getStartRule = function(start) {
196 return {
197 token : "comment.doc", // doc comment
198 regex : "\\/\\*(?=\\*)",
199 next : start
200 };
201 };
202
203 DocCommentHighlightRules.getEndRule = function (start) {
204 return {
205 token : "comment.doc", // closing comment
206 regex : "\\*\\/",
207 next : start
208 };
209 };
210
211
212 exports.DocCommentHighlightRules = DocCommentHighlightRules;
213
214 });
215
216 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
217
218
219 var Range = require("../range").Range;
220
221 var MatchingBraceOutdent = function() {};
222
223 (function() {
224
225 this.checkOutdent = function(line, input) {
226 if (! /^\s+$/.test(line))
227 return false;
228
229 return /^\s*\}/.test(input);
230 };
231
232 this.autoOutdent = function(doc, row) {
233 var line = doc.getLine(row);
234 var match = line.match(/^(\s*\})/);
235
236 if (!match) return 0;
237
238 var column = match[1].length;
239 var openBracePos = doc.findMatchingBracket({row: row, column: column});
240
241 if (!openBracePos || openBracePos.row == row) return 0;
242
243 var indent = this.$getIndent(doc.getLine(openBracePos.row));
244 doc.replace(new Range(row, 0, row, column-1), indent);
245 };
246
247 this.$getIndent = function(line) {
248 return line.match(/^\s*/)[0];
249 };
250
251 }).call(MatchingBraceOutdent.prototype);
252
253 exports.MatchingBraceOutdent = MatchingBraceOutdent;
254 });
255
256 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
257
258
259 var oop = require("../../lib/oop");
260 var Behaviour = require("../behaviour").Behaviour;
261 var TokenIterator = require("../../token_iterator").TokenIterator;
262 var lang = require("../../lib/lang");
263
264 var SAFE_INSERT_IN_TOKENS =
265 ["text", "paren.rparen", "punctuation.operator"];
266 var SAFE_INSERT_BEFORE_TOKENS =
267 ["text", "paren.rparen", "punctuation.operator", "comment"];
268
269
270 var autoInsertedBrackets = 0;
271 var autoInsertedRow = -1;
272 var autoInsertedLineEnd = "";
273 var maybeInsertedBrackets = 0;
274 var maybeInsertedRow = -1;
275 var maybeInsertedLineStart = "";
276 var maybeInsertedLineEnd = "";
277
278 var CstyleBehaviour = function () {
279
280 CstyleBehaviour.isSaneInsertion = function(editor, session) {
281 var cursor = editor.getCursorPosition();
282 var iterator = new TokenIterator(session, cursor.row, cursor.column);
283 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
284 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
285 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
286 return false;
287 }
288 iterator.stepForward();
289 return iterator.getCurrentTokenRow() !== cursor.row ||
290 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
291 };
292
293 CstyleBehaviour.$matchTokenType = function(token, types) {
294 return types.indexOf(token.type || token) > -1;
295 };
296
297 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
298 var cursor = editor.getCursorPosition();
299 var line = session.doc.getLine(cursor.row);
300 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
301 autoInsertedBrackets = 0;
302 autoInsertedRow = cursor.row;
303 autoInsertedLineEnd = bracket + line.substr(cursor.column);
304 autoInsertedBrackets++;
305 };
306
307 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
308 var cursor = editor.getCursorPosition();
309 var line = session.doc.getLine(cursor.row);
310 if (!this.isMaybeInsertedClosing(cursor, line))
311 maybeInsertedBrackets = 0;
312 maybeInsertedRow = cursor.row;
313 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
314 maybeInsertedLineEnd = line.substr(cursor.column);
315 maybeInsertedBrackets++;
316 };
317
318 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
319 return autoInsertedBrackets > 0 &&
320 cursor.row === autoInsertedRow &&
321 bracket === autoInsertedLineEnd[0] &&
322 line.substr(cursor.column) === autoInsertedLineEnd;
323 };
324
325 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
326 return maybeInsertedBrackets > 0 &&
327 cursor.row === maybeInsertedRow &&
328 line.substr(cursor.column) === maybeInsertedLineEnd &&
329 line.substr(0, cursor.column) == maybeInsertedLineStart;
330 };
331
332 CstyleBehaviour.popAutoInsertedClosing = function() {
333 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
334 autoInsertedBrackets--;
335 };
336
337 CstyleBehaviour.clearMaybeInsertedClosing = function() {
338 maybeInsertedBrackets = 0;
339 maybeInsertedRow = -1;
340 };
341
342 this.add("braces", "insertion", function (state, action, editor, session, text) {
343 var cursor = editor.getCursorPosition();
344 var line = session.doc.getLine(cursor.row);
345 if (text == '{') {
346 var selection = editor.getSelectionRange();
347 var selected = session.doc.getTextRange(selection);
348 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
349 return {
350 text: '{' + selected + '}',
351 selection: false
352 };
353 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
354 if (/[\]\}\)]/.test(line[cursor.column])) {
355 CstyleBehaviour.recordAutoInsert(editor, session, "}");
356 return {
357 text: '{}',
358 selection: [1, 1]
359 };
360 } else {
361 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
362 return {
363 text: '{',
364 selection: [1, 1]
365 };
366 }
367 }
368 } else if (text == '}') {
369 var rightChar = line.substring(cursor.column, cursor.column + 1);
370 if (rightChar == '}') {
371 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
372 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
373 CstyleBehaviour.popAutoInsertedClosing();
374 return {
375 text: '',
376 selection: [1, 1]
377 };
378 }
379 }
380 } else if (text == "\n" || text == "\r\n") {
381 var closing = "";
382 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
383 closing = lang.stringRepeat("}", maybeInsertedBrackets);
384 CstyleBehaviour.clearMaybeInsertedClosing();
385 }
386 var rightChar = line.substring(cursor.column, cursor.column + 1);
387 if (rightChar == '}' || closing !== "") {
388 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
389 if (!openBracePos)
390 return null;
391
392 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
393 var next_indent = this.$getIndent(line);
394
395 return {
396 text: '\n' + indent + '\n' + next_indent + closing,
397 selection: [1, indent.length, 1, indent.length]
398 };
399 }
400 }
401 });
402
403 this.add("braces", "deletion", function (state, action, editor, session, range) {
404 var selected = session.doc.getTextRange(range);
405 if (!range.isMultiLine() && selected == '{') {
406 var line = session.doc.getLine(range.start.row);
407 var rightChar = line.substring(range.end.column, range.end.column + 1);
408 if (rightChar == '}') {
409 range.end.column++;
410 return range;
411 } else {
412 maybeInsertedBrackets--;
413 }
414 }
415 });
416
417 this.add("parens", "insertion", function (state, action, editor, session, text) {
418 if (text == '(') {
419 var selection = editor.getSelectionRange();
420 var selected = session.doc.getTextRange(selection);
421 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
422 return {
423 text: '(' + selected + ')',
424 selection: false
425 };
426 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
427 CstyleBehaviour.recordAutoInsert(editor, session, ")");
428 return {
429 text: '()',
430 selection: [1, 1]
431 };
432 }
433 } else if (text == ')') {
434 var cursor = editor.getCursorPosition();
435 var line = session.doc.getLine(cursor.row);
436 var rightChar = line.substring(cursor.column, cursor.column + 1);
437 if (rightChar == ')') {
438 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
439 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
440 CstyleBehaviour.popAutoInsertedClosing();
441 return {
442 text: '',
443 selection: [1, 1]
444 };
445 }
446 }
447 }
448 });
449
450 this.add("parens", "deletion", function (state, action, editor, session, range) {
451 var selected = session.doc.getTextRange(range);
452 if (!range.isMultiLine() && selected == '(') {
453 var line = session.doc.getLine(range.start.row);
454 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
455 if (rightChar == ')') {
456 range.end.column++;
457 return range;
458 }
459 }
460 });
461
462 this.add("brackets", "insertion", function (state, action, editor, session, text) {
463 if (text == '[') {
464 var selection = editor.getSelectionRange();
465 var selected = session.doc.getTextRange(selection);
466 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
467 return {
468 text: '[' + selected + ']',
469 selection: false
470 };
471 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
472 CstyleBehaviour.recordAutoInsert(editor, session, "]");
473 return {
474 text: '[]',
475 selection: [1, 1]
476 };
477 }
478 } else if (text == ']') {
479 var cursor = editor.getCursorPosition();
480 var line = session.doc.getLine(cursor.row);
481 var rightChar = line.substring(cursor.column, cursor.column + 1);
482 if (rightChar == ']') {
483 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
484 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
485 CstyleBehaviour.popAutoInsertedClosing();
486 return {
487 text: '',
488 selection: [1, 1]
489 };
490 }
491 }
492 }
493 });
494
495 this.add("brackets", "deletion", function (state, action, editor, session, range) {
496 var selected = session.doc.getTextRange(range);
497 if (!range.isMultiLine() && selected == '[') {
498 var line = session.doc.getLine(range.start.row);
499 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
500 if (rightChar == ']') {
501 range.end.column++;
502 return range;
503 }
504 }
505 });
506
507 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
508 if (text == '"' || text == "'") {
509 var quote = text;
510 var selection = editor.getSelectionRange();
511 var selected = session.doc.getTextRange(selection);
512 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
513 return {
514 text: quote + selected + quote,
515 selection: false
516 };
517 } else {
518 var cursor = editor.getCursorPosition();
519 var line = session.doc.getLine(cursor.row);
520 var leftChar = line.substring(cursor.column-1, cursor.column);
521 if (leftChar == '\\') {
522 return null;
523 }
524 var tokens = session.getTokens(selection.start.row);
525 var col = 0, token;
526 var quotepos = -1; // Track whether we're inside an open quote.
527
528 for (var x = 0; x < tokens.length; x++) {
529 token = tokens[x];
530 if (token.type == "string") {
531 quotepos = -1;
532 } else if (quotepos < 0) {
533 quotepos = token.value.indexOf(quote);
534 }
535 if ((token.value.length + col) > selection.start.column) {
536 break;
537 }
538 col += tokens[x].value.length;
539 }
540 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
541 if (!CstyleBehaviour.isSaneInsertion(editor, session))
542 return;
543 return {
544 text: quote + quote,
545 selection: [1,1]
546 };
547 } else if (token && token.type === "string") {
548 var rightChar = line.substring(cursor.column, cursor.column + 1);
549 if (rightChar == quote) {
550 return {
551 text: '',
552 selection: [1, 1]
553 };
554 }
555 }
556 }
557 }
558 });
559
560 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
561 var selected = session.doc.getTextRange(range);
562 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
563 var line = session.doc.getLine(range.start.row);
564 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
565 if (rightChar == selected) {
566 range.end.column++;
567 return range;
568 }
569 }
570 });
571
572 };
573
574 oop.inherits(CstyleBehaviour, Behaviour);
575
576 exports.CstyleBehaviour = CstyleBehaviour;
577 });
578
579 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
580
581
582 var oop = require("../../lib/oop");
583 var Range = require("../../range").Range;
584 var BaseFoldMode = require("./fold_mode").FoldMode;
585
586 var FoldMode = exports.FoldMode = function(commentRegex) {
587 if (commentRegex) {
588 this.foldingStartMarker = new RegExp(
589 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
590 );
591 this.foldingStopMarker = new RegExp(
592 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
593 );
594 }
595 };
596 oop.inherits(FoldMode, BaseFoldMode);
597
598 (function() {
599
600 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
601 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
602
603 this.getFoldWidgetRange = function(session, foldStyle, row) {
604 var line = session.getLine(row);
605 var match = line.match(this.foldingStartMarker);
606 if (match) {
607 var i = match.index;
608
609 if (match[1])
610 return this.openingBracketBlock(session, match[1], row, i);
611
612 return session.getCommentFoldRange(row, i + match[0].length, 1);
613 }
614
615 if (foldStyle !== "markbeginend")
616 return;
617
618 var match = line.match(this.foldingStopMarker);
619 if (match) {
620 var i = match.index + match[0].length;
621
622 if (match[1])
623 return this.closingBracketBlock(session, match[1], row, i);
624
625 return session.getCommentFoldRange(row, i, -1);
626 }
627 };
628
629 }).call(FoldMode.prototype);
630
631 });
+0
-487
try/ace/mode-haml.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * Contributor(s):
30 *
31 * Garen J. Torikian < gjtorikian AT gmail DOT com >
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35 define('ace/mode/haml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/haml_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
36
37
38 var oop = require("../lib/oop");
39 var TextMode = require("./text").Mode;
40 var Tokenizer = require("../tokenizer").Tokenizer;
41 var HamlHighlightRules = require("./haml_highlight_rules").HamlHighlightRules;
42 var FoldMode = require("./folding/coffee").FoldMode;
43
44 var Mode = function() {
45 var highlighter = new HamlHighlightRules();
46 this.foldingRules = new FoldMode();
47
48 this.$tokenizer = new Tokenizer(highlighter.getRules());
49 };
50 oop.inherits(Mode, TextMode);
51
52 (function() {
53 this.lineCommentStart = ["//", "#"];
54
55 }).call(Mode.prototype);
56
57 exports.Mode = Mode;
58 });define('ace/mode/haml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/ruby_highlight_rules'], function(require, exports, module) {
59
60
61 var oop = require("../lib/oop");
62 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
63 var RubyExports = require("./ruby_highlight_rules");
64 var RubyHighlightRules = RubyExports.RubyHighlightRules;
65
66 var HamlHighlightRules = function() {
67
68 this.$rules =
69 {
70 "start": [
71 {
72 token : "punctuation.section.comment",
73 regex : /^\s*\/.*/
74 },
75 {
76 token : "punctuation.section.comment",
77 regex : /^\s*#.*/
78 },
79 {
80 token: "string.quoted.double",
81 regex: "==.+?=="
82 },
83 {
84 token: "keyword.other.doctype",
85 regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
86 },
87 RubyExports.qString,
88 RubyExports.qqString,
89 RubyExports.tString,
90 {
91 token: ["entity.name.tag.haml"],
92 regex: /^\s*%[\w:]+/,
93 next: "tag_single"
94 },
95 {
96 token: [ "meta.escape.haml" ],
97 regex: "^\\s*\\\\."
98 },
99 RubyExports.constantNumericHex,
100 RubyExports.constantNumericFloat,
101
102 RubyExports.constantOtherSymbol,
103 {
104 token: "text",
105 regex: "=|-|~",
106 next: "embedded_ruby"
107 }
108 ],
109 "tag_single": [
110 {
111 token: "entity.other.attribute-name.class.haml",
112 regex: "\\.[\\w-]+"
113 },
114 {
115 token: "entity.other.attribute-name.id.haml",
116 regex: "#[\\w-]+"
117 },
118 {
119 token: "punctuation.section",
120 regex: "\\{",
121 next: "section"
122 },
123
124 RubyExports.constantOtherSymbol,
125
126 {
127 token: "text",
128 regex: /\s/,
129 next: "start"
130 },
131 {
132 token: "empty",
133 regex: "$|(?!\\.|#|\\{|\\[|=|-|~|\\/)",
134 next: "start"
135 }
136 ],
137 "section": [
138 RubyExports.constantOtherSymbol,
139
140 RubyExports.qString,
141 RubyExports.qqString,
142 RubyExports.tString,
143
144 RubyExports.constantNumericHex,
145 RubyExports.constantNumericFloat,
146 {
147 token: "punctuation.section",
148 regex: "\\}",
149 next: "start"
150 }
151 ],
152 "embedded_ruby": [
153 RubyExports.constantNumericHex,
154 RubyExports.constantNumericFloat,
155 {
156 token : "support.class", // class name
157 regex : "[A-Z][a-zA-Z_\\d]+"
158 },
159 {
160 token : new RubyHighlightRules().getKeywords(),
161 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
162 },
163 {
164 token : ["keyword", "text", "text"],
165 regex : "(?:do|\\{)(?: \\|[^|]+\\|)?$",
166 next : "start"
167 },
168 {
169 token : ["text"],
170 regex : "^$",
171 next : "start"
172 },
173 {
174 token : ["text"],
175 regex : "^(?!.*\\|\\s*$)",
176 next : "start"
177 }
178 ]
179 }
180
181 };
182
183 oop.inherits(HamlHighlightRules, TextHighlightRules);
184
185 exports.HamlHighlightRules = HamlHighlightRules;
186 });
187
188 define('ace/mode/ruby_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
189
190
191 var oop = require("../lib/oop");
192 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
193 var constantOtherSymbol = exports.constantOtherSymbol = {
194 token : "constant.other.symbol.ruby", // symbol
195 regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
196 };
197
198 var qString = exports.qString = {
199 token : "string", // single line
200 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
201 };
202
203 var qqString = exports.qqString = {
204 token : "string", // single line
205 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
206 };
207
208 var tString = exports.tString = {
209 token : "string", // backtick string
210 regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
211 };
212
213 var constantNumericHex = exports.constantNumericHex = {
214 token : "constant.numeric", // hex
215 regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
216 };
217
218 var constantNumericFloat = exports.constantNumericFloat = {
219 token : "constant.numeric", // float
220 regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
221 };
222
223 var RubyHighlightRules = function() {
224
225 var builtinFunctions = (
226 "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
227 "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
228 "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
229 "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
230 "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
231 "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
232 "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
233 "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
234 "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
235 "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
236 "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
237 "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
238 "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
239 "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
240 "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
241 "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
242 "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
243 "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
244 "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
245 "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
246 "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
247 "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
248 "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
249 "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
250 "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
251 "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
252 "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
253 "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
254 "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
255 "has_many|has_one|belongs_to|has_and_belongs_to_many"
256 );
257
258 var keywords = (
259 "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
260 "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
261 "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
262 );
263
264 var buildinConstants = (
265 "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
266 "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
267 );
268
269 var builtinVariables = (
270 "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
271 "$!|root_url|flash|session|cookies|params|request|response|logger|self"
272 );
273
274 var keywordMapper = this.$keywords = this.createKeywordMapper({
275 "keyword": keywords,
276 "constant.language": buildinConstants,
277 "variable.language": builtinVariables,
278 "support.function": builtinFunctions,
279 "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
280 }, "identifier");
281
282 this.$rules = {
283 "start" : [
284 {
285 token : "comment",
286 regex : "#.*$"
287 }, {
288 token : "comment", // multi line comment
289 regex : "^=begin(?:$|\\s.*$)",
290 next : "comment"
291 }, {
292 token : "string.regexp",
293 regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
294 },
295
296 qString,
297 qqString,
298 tString,
299
300 {
301 token : "text", // namespaces aren't symbols
302 regex : "::"
303 }, {
304 token : "variable.instance", // instance variable
305 regex : "@{1,2}[a-zA-Z_\\d]+"
306 }, {
307 token : "support.class", // class name
308 regex : "[A-Z][a-zA-Z_\\d]+"
309 },
310
311 constantOtherSymbol,
312 constantNumericHex,
313 constantNumericFloat,
314
315 {
316 token : "constant.language.boolean",
317 regex : "(?:true|false)\\b"
318 }, {
319 token : keywordMapper,
320 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
321 }, {
322 token : "punctuation.separator.key-value",
323 regex : "=>"
324 }, {
325 stateName: "heredoc",
326 onMatch : function(value, currentState, stack) {
327 var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
328 var tokens = value.split(this.splitRegex);
329 stack.push(next, tokens[3]);
330 return [
331 {type:"constant", value: tokens[1]},
332 {type:"string", value: tokens[2]},
333 {type:"support.class", value: tokens[3]},
334 {type:"string", value: tokens[4]}
335 ];
336 },
337 regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
338 rules: {
339 heredoc: [{
340 onMatch: function(value, currentState, stack) {
341 if (value == stack[1]) {
342 stack.shift();
343 stack.shift();
344 return "support.class";
345 }
346 return "string";
347 },
348 regex: ".*$",
349 next: "start"
350 }],
351 indentedHeredoc: [{
352 token: "string",
353 regex: "^ +"
354 }, {
355 onMatch: function(value, currentState, stack) {
356 if (value == stack[1]) {
357 stack.shift();
358 stack.shift();
359 return "support.class";
360 }
361 return "string";
362 },
363 regex: ".*$",
364 next: "start"
365 }]
366 }
367 }, {
368 token : "keyword.operator",
369 regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
370 }, {
371 token : "paren.lparen",
372 regex : "[[({]"
373 }, {
374 token : "paren.rparen",
375 regex : "[\\])}]"
376 }, {
377 token : "text",
378 regex : "\\s+"
379 }
380 ],
381 "comment" : [
382 {
383 token : "comment", // closing comment
384 regex : "^=end(?:$|\\s.*$)",
385 next : "start"
386 }, {
387 token : "comment", // comment spanning whole line
388 regex : ".+"
389 }
390 ]
391 };
392
393 this.normalizeRules();
394 };
395
396 oop.inherits(RubyHighlightRules, TextHighlightRules);
397
398 exports.RubyHighlightRules = RubyHighlightRules;
399 });
400
401 define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
402
403
404 var oop = require("../../lib/oop");
405 var BaseFoldMode = require("./fold_mode").FoldMode;
406 var Range = require("../../range").Range;
407
408 var FoldMode = exports.FoldMode = function() {};
409 oop.inherits(FoldMode, BaseFoldMode);
410
411 (function() {
412
413 this.getFoldWidgetRange = function(session, foldStyle, row) {
414 var range = this.indentationBlock(session, row);
415 if (range)
416 return range;
417
418 var re = /\S/;
419 var line = session.getLine(row);
420 var startLevel = line.search(re);
421 if (startLevel == -1 || line[startLevel] != "#")
422 return;
423
424 var startColumn = line.length;
425 var maxRow = session.getLength();
426 var startRow = row;
427 var endRow = row;
428
429 while (++row < maxRow) {
430 line = session.getLine(row);
431 var level = line.search(re);
432
433 if (level == -1)
434 continue;
435
436 if (line[level] != "#")
437 break;
438
439 endRow = row;
440 }
441
442 if (endRow > startRow) {
443 var endColumn = session.getLine(endRow).length;
444 return new Range(startRow, startColumn, endRow, endColumn);
445 }
446 };
447 this.getFoldWidget = function(session, foldStyle, row) {
448 var line = session.getLine(row);
449 var indent = line.search(/\S/);
450 var next = session.getLine(row + 1);
451 var prev = session.getLine(row - 1);
452 var prevIndent = prev.search(/\S/);
453 var nextIndent = next.search(/\S/);
454
455 if (indent == -1) {
456 session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
457 return "";
458 }
459 if (prevIndent == -1) {
460 if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
461 session.foldWidgets[row - 1] = "";
462 session.foldWidgets[row + 1] = "";
463 return "start";
464 }
465 } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
466 if (session.getLine(row - 2).search(/\S/) == -1) {
467 session.foldWidgets[row - 1] = "start";
468 session.foldWidgets[row + 1] = "";
469 return "";
470 }
471 }
472
473 if (prevIndent!= -1 && prevIndent < indent)
474 session.foldWidgets[row - 1] = "start";
475 else
476 session.foldWidgets[row - 1] = "";
477
478 if (indent < nextIndent)
479 return "start";
480 else
481 return "";
482 };
483
484 }).call(FoldMode.prototype);
485
486 });
+0
-609
try/ace/mode-haxe.js less more
0 define('ace/mode/haxe', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/haxe_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
1
2
3 var oop = require("../lib/oop");
4 var TextMode = require("./text").Mode;
5 var Tokenizer = require("../tokenizer").Tokenizer;
6 var HaxeHighlightRules = require("./haxe_highlight_rules").HaxeHighlightRules;
7 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
8 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
9 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
10
11 var Mode = function() {
12 this.$tokenizer = new Tokenizer(new HaxeHighlightRules().getRules());
13 this.$outdent = new MatchingBraceOutdent();
14 this.$behaviour = new CstyleBehaviour();
15 this.foldingRules = new CStyleFoldMode();
16 };
17 oop.inherits(Mode, TextMode);
18
19 (function() {
20 this.lineCommentStart = "//";
21 this.blockComment = {start: "/*", end: "*/"};
22
23 this.getNextLineIndent = function(state, line, tab) {
24 var indent = this.$getIndent(line);
25
26 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
27 var tokens = tokenizedLine.tokens;
28
29 if (tokens.length && tokens[tokens.length-1].type == "comment") {
30 return indent;
31 }
32
33 if (state == "start") {
34 var match = line.match(/^.*[\{\(\[]\s*$/);
35 if (match) {
36 indent += tab;
37 }
38 }
39
40 return indent;
41 };
42
43 this.checkOutdent = function(state, line, input) {
44 return this.$outdent.checkOutdent(line, input);
45 };
46
47 this.autoOutdent = function(state, doc, row) {
48 this.$outdent.autoOutdent(doc, row);
49 };
50
51 }).call(Mode.prototype);
52
53 exports.Mode = Mode;
54 });
55 define('ace/mode/haxe_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
56
57
58 var oop = require("../lib/oop");
59
60 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
61 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
62
63 var HaxeHighlightRules = function() {
64
65 var keywords = (
66 "break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std"
67 );
68
69 var buildinConstants = (
70 "null|true|false"
71 );
72
73 var keywordMapper = this.createKeywordMapper({
74 "variable.language": "this",
75 "keyword": keywords,
76 "constant.language": buildinConstants
77 }, "identifier");
78
79 this.$rules = {
80 "start" : [
81 {
82 token : "comment",
83 regex : "\\/\\/.*$"
84 },
85 DocCommentHighlightRules.getStartRule("doc-start"),
86 {
87 token : "comment", // multi line comment
88 regex : "\\/\\*",
89 next : "comment"
90 }, {
91 token : "string.regexp",
92 regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
93 }, {
94 token : "string", // single line
95 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
96 }, {
97 token : "string", // single line
98 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
99 }, {
100 token : "constant.numeric", // hex
101 regex : "0[xX][0-9a-fA-F]+\\b"
102 }, {
103 token : "constant.numeric", // float
104 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
105 }, {
106 token : "constant.language.boolean",
107 regex : "(?:true|false)\\b"
108 }, {
109 token : keywordMapper,
110 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
111 }, {
112 token : "keyword.operator",
113 regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
114 }, {
115 token : "punctuation.operator",
116 regex : "\\?|\\:|\\,|\\;|\\."
117 }, {
118 token : "paren.lparen",
119 regex : "[[({<]"
120 }, {
121 token : "paren.rparen",
122 regex : "[\\])}>]"
123 }, {
124 token : "text",
125 regex : "\\s+"
126 }
127 ],
128 "comment" : [
129 {
130 token : "comment", // closing comment
131 regex : ".*?\\*\\/",
132 next : "start"
133 }, {
134 token : "comment", // comment spanning whole line
135 regex : ".+"
136 }
137 ]
138 };
139
140 this.embedRules(DocCommentHighlightRules, "doc-",
141 [ DocCommentHighlightRules.getEndRule("start") ]);
142 };
143
144 oop.inherits(HaxeHighlightRules, TextHighlightRules);
145
146 exports.HaxeHighlightRules = HaxeHighlightRules;
147 });
148
149 define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
150
151
152 var oop = require("../lib/oop");
153 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
154
155 var DocCommentHighlightRules = function() {
156
157 this.$rules = {
158 "start" : [ {
159 token : "comment.doc.tag",
160 regex : "@[\\w\\d_]+" // TODO: fix email addresses
161 }, {
162 token : "comment.doc.tag",
163 regex : "\\bTODO\\b"
164 }, {
165 defaultToken : "comment.doc"
166 }]
167 };
168 };
169
170 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
171
172 DocCommentHighlightRules.getStartRule = function(start) {
173 return {
174 token : "comment.doc", // doc comment
175 regex : "\\/\\*(?=\\*)",
176 next : start
177 };
178 };
179
180 DocCommentHighlightRules.getEndRule = function (start) {
181 return {
182 token : "comment.doc", // closing comment
183 regex : "\\*\\/",
184 next : start
185 };
186 };
187
188
189 exports.DocCommentHighlightRules = DocCommentHighlightRules;
190
191 });
192
193 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
194
195
196 var Range = require("../range").Range;
197
198 var MatchingBraceOutdent = function() {};
199
200 (function() {
201
202 this.checkOutdent = function(line, input) {
203 if (! /^\s+$/.test(line))
204 return false;
205
206 return /^\s*\}/.test(input);
207 };
208
209 this.autoOutdent = function(doc, row) {
210 var line = doc.getLine(row);
211 var match = line.match(/^(\s*\})/);
212
213 if (!match) return 0;
214
215 var column = match[1].length;
216 var openBracePos = doc.findMatchingBracket({row: row, column: column});
217
218 if (!openBracePos || openBracePos.row == row) return 0;
219
220 var indent = this.$getIndent(doc.getLine(openBracePos.row));
221 doc.replace(new Range(row, 0, row, column-1), indent);
222 };
223
224 this.$getIndent = function(line) {
225 return line.match(/^\s*/)[0];
226 };
227
228 }).call(MatchingBraceOutdent.prototype);
229
230 exports.MatchingBraceOutdent = MatchingBraceOutdent;
231 });
232
233 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
234
235
236 var oop = require("../../lib/oop");
237 var Behaviour = require("../behaviour").Behaviour;
238 var TokenIterator = require("../../token_iterator").TokenIterator;
239 var lang = require("../../lib/lang");
240
241 var SAFE_INSERT_IN_TOKENS =
242 ["text", "paren.rparen", "punctuation.operator"];
243 var SAFE_INSERT_BEFORE_TOKENS =
244 ["text", "paren.rparen", "punctuation.operator", "comment"];
245
246
247 var autoInsertedBrackets = 0;
248 var autoInsertedRow = -1;
249 var autoInsertedLineEnd = "";
250 var maybeInsertedBrackets = 0;
251 var maybeInsertedRow = -1;
252 var maybeInsertedLineStart = "";
253 var maybeInsertedLineEnd = "";
254
255 var CstyleBehaviour = function () {
256
257 CstyleBehaviour.isSaneInsertion = function(editor, session) {
258 var cursor = editor.getCursorPosition();
259 var iterator = new TokenIterator(session, cursor.row, cursor.column);
260 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
261 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
262 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
263 return false;
264 }
265 iterator.stepForward();
266 return iterator.getCurrentTokenRow() !== cursor.row ||
267 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
268 };
269
270 CstyleBehaviour.$matchTokenType = function(token, types) {
271 return types.indexOf(token.type || token) > -1;
272 };
273
274 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
275 var cursor = editor.getCursorPosition();
276 var line = session.doc.getLine(cursor.row);
277 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
278 autoInsertedBrackets = 0;
279 autoInsertedRow = cursor.row;
280 autoInsertedLineEnd = bracket + line.substr(cursor.column);
281 autoInsertedBrackets++;
282 };
283
284 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
285 var cursor = editor.getCursorPosition();
286 var line = session.doc.getLine(cursor.row);
287 if (!this.isMaybeInsertedClosing(cursor, line))
288 maybeInsertedBrackets = 0;
289 maybeInsertedRow = cursor.row;
290 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
291 maybeInsertedLineEnd = line.substr(cursor.column);
292 maybeInsertedBrackets++;
293 };
294
295 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
296 return autoInsertedBrackets > 0 &&
297 cursor.row === autoInsertedRow &&
298 bracket === autoInsertedLineEnd[0] &&
299 line.substr(cursor.column) === autoInsertedLineEnd;
300 };
301
302 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
303 return maybeInsertedBrackets > 0 &&
304 cursor.row === maybeInsertedRow &&
305 line.substr(cursor.column) === maybeInsertedLineEnd &&
306 line.substr(0, cursor.column) == maybeInsertedLineStart;
307 };
308
309 CstyleBehaviour.popAutoInsertedClosing = function() {
310 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
311 autoInsertedBrackets--;
312 };
313
314 CstyleBehaviour.clearMaybeInsertedClosing = function() {
315 maybeInsertedBrackets = 0;
316 maybeInsertedRow = -1;
317 };
318
319 this.add("braces", "insertion", function (state, action, editor, session, text) {
320 var cursor = editor.getCursorPosition();
321 var line = session.doc.getLine(cursor.row);
322 if (text == '{') {
323 var selection = editor.getSelectionRange();
324 var selected = session.doc.getTextRange(selection);
325 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
326 return {
327 text: '{' + selected + '}',
328 selection: false
329 };
330 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
331 if (/[\]\}\)]/.test(line[cursor.column])) {
332 CstyleBehaviour.recordAutoInsert(editor, session, "}");
333 return {
334 text: '{}',
335 selection: [1, 1]
336 };
337 } else {
338 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
339 return {
340 text: '{',
341 selection: [1, 1]
342 };
343 }
344 }
345 } else if (text == '}') {
346 var rightChar = line.substring(cursor.column, cursor.column + 1);
347 if (rightChar == '}') {
348 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
349 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
350 CstyleBehaviour.popAutoInsertedClosing();
351 return {
352 text: '',
353 selection: [1, 1]
354 };
355 }
356 }
357 } else if (text == "\n" || text == "\r\n") {
358 var closing = "";
359 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
360 closing = lang.stringRepeat("}", maybeInsertedBrackets);
361 CstyleBehaviour.clearMaybeInsertedClosing();
362 }
363 var rightChar = line.substring(cursor.column, cursor.column + 1);
364 if (rightChar == '}' || closing !== "") {
365 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
366 if (!openBracePos)
367 return null;
368
369 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
370 var next_indent = this.$getIndent(line);
371
372 return {
373 text: '\n' + indent + '\n' + next_indent + closing,
374 selection: [1, indent.length, 1, indent.length]
375 };
376 }
377 }
378 });
379
380 this.add("braces", "deletion", function (state, action, editor, session, range) {
381 var selected = session.doc.getTextRange(range);
382 if (!range.isMultiLine() && selected == '{') {
383 var line = session.doc.getLine(range.start.row);
384 var rightChar = line.substring(range.end.column, range.end.column + 1);
385 if (rightChar == '}') {
386 range.end.column++;
387 return range;
388 } else {
389 maybeInsertedBrackets--;
390 }
391 }
392 });
393
394 this.add("parens", "insertion", function (state, action, editor, session, text) {
395 if (text == '(') {
396 var selection = editor.getSelectionRange();
397 var selected = session.doc.getTextRange(selection);
398 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
399 return {
400 text: '(' + selected + ')',
401 selection: false
402 };
403 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
404 CstyleBehaviour.recordAutoInsert(editor, session, ")");
405 return {
406 text: '()',
407 selection: [1, 1]
408 };
409 }
410 } else if (text == ')') {
411 var cursor = editor.getCursorPosition();
412 var line = session.doc.getLine(cursor.row);
413 var rightChar = line.substring(cursor.column, cursor.column + 1);
414 if (rightChar == ')') {
415 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
416 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
417 CstyleBehaviour.popAutoInsertedClosing();
418 return {
419 text: '',
420 selection: [1, 1]
421 };
422 }
423 }
424 }
425 });
426
427 this.add("parens", "deletion", function (state, action, editor, session, range) {
428 var selected = session.doc.getTextRange(range);
429 if (!range.isMultiLine() && selected == '(') {
430 var line = session.doc.getLine(range.start.row);
431 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
432 if (rightChar == ')') {
433 range.end.column++;
434 return range;
435 }
436 }
437 });
438
439 this.add("brackets", "insertion", function (state, action, editor, session, text) {
440 if (text == '[') {
441 var selection = editor.getSelectionRange();
442 var selected = session.doc.getTextRange(selection);
443 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
444 return {
445 text: '[' + selected + ']',
446 selection: false
447 };
448 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
449 CstyleBehaviour.recordAutoInsert(editor, session, "]");
450 return {
451 text: '[]',
452 selection: [1, 1]
453 };
454 }
455 } else if (text == ']') {
456 var cursor = editor.getCursorPosition();
457 var line = session.doc.getLine(cursor.row);
458 var rightChar = line.substring(cursor.column, cursor.column + 1);
459 if (rightChar == ']') {
460 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
461 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
462 CstyleBehaviour.popAutoInsertedClosing();
463 return {
464 text: '',
465 selection: [1, 1]
466 };
467 }
468 }
469 }
470 });
471
472 this.add("brackets", "deletion", function (state, action, editor, session, range) {
473 var selected = session.doc.getTextRange(range);
474 if (!range.isMultiLine() && selected == '[') {
475 var line = session.doc.getLine(range.start.row);
476 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
477 if (rightChar == ']') {
478 range.end.column++;
479 return range;
480 }
481 }
482 });
483
484 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
485 if (text == '"' || text == "'") {
486 var quote = text;
487 var selection = editor.getSelectionRange();
488 var selected = session.doc.getTextRange(selection);
489 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
490 return {
491 text: quote + selected + quote,
492 selection: false
493 };
494 } else {
495 var cursor = editor.getCursorPosition();
496 var line = session.doc.getLine(cursor.row);
497 var leftChar = line.substring(cursor.column-1, cursor.column);
498 if (leftChar == '\\') {
499 return null;
500 }
501 var tokens = session.getTokens(selection.start.row);
502 var col = 0, token;
503 var quotepos = -1; // Track whether we're inside an open quote.
504
505 for (var x = 0; x < tokens.length; x++) {
506 token = tokens[x];
507 if (token.type == "string") {
508 quotepos = -1;
509 } else if (quotepos < 0) {
510 quotepos = token.value.indexOf(quote);
511 }
512 if ((token.value.length + col) > selection.start.column) {
513 break;
514 }
515 col += tokens[x].value.length;
516 }
517 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
518 if (!CstyleBehaviour.isSaneInsertion(editor, session))
519 return;
520 return {
521 text: quote + quote,
522 selection: [1,1]
523 };
524 } else if (token && token.type === "string") {
525 var rightChar = line.substring(cursor.column, cursor.column + 1);
526 if (rightChar == quote) {
527 return {
528 text: '',
529 selection: [1, 1]
530 };
531 }
532 }
533 }
534 }
535 });
536
537 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
538 var selected = session.doc.getTextRange(range);
539 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
540 var line = session.doc.getLine(range.start.row);
541 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
542 if (rightChar == selected) {
543 range.end.column++;
544 return range;
545 }
546 }
547 });
548
549 };
550
551 oop.inherits(CstyleBehaviour, Behaviour);
552
553 exports.CstyleBehaviour = CstyleBehaviour;
554 });
555
556 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
557
558
559 var oop = require("../../lib/oop");
560 var Range = require("../../range").Range;
561 var BaseFoldMode = require("./fold_mode").FoldMode;
562
563 var FoldMode = exports.FoldMode = function(commentRegex) {
564 if (commentRegex) {
565 this.foldingStartMarker = new RegExp(
566 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
567 );
568 this.foldingStopMarker = new RegExp(
569 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
570 );
571 }
572 };
573 oop.inherits(FoldMode, BaseFoldMode);
574
575 (function() {
576
577 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
578 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
579
580 this.getFoldWidgetRange = function(session, foldStyle, row) {
581 var line = session.getLine(row);
582 var match = line.match(this.foldingStartMarker);
583 if (match) {
584 var i = match.index;
585
586 if (match[1])
587 return this.openingBracketBlock(session, match[1], row, i);
588
589 return session.getCommentFoldRange(row, i + match[0].length, 1);
590 }
591
592 if (foldStyle !== "markbeginend")
593 return;
594
595 var match = line.match(this.foldingStopMarker);
596 if (match) {
597 var i = match.index + match[0].length;
598
599 if (match[1])
600 return this.closingBracketBlock(session, match[1], row, i);
601
602 return session.getCommentFoldRange(row, i, -1);
603 }
604 };
605
606 }).call(FoldMode.prototype);
607
608 });
+0
-173
try/ace/mode-ini.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * Contributor(s):
30 *
31 *
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35 define('ace/mode/ini', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ini_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
36
37
38 var oop = require("../lib/oop");
39 var TextMode = require("./text").Mode;
40 var Tokenizer = require("../tokenizer").Tokenizer;
41 var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules;
42 var FoldMode = require("./folding/cstyle").FoldMode;
43
44 var Mode = function() {
45 var highlighter = new IniHighlightRules();
46 this.foldingRules = new FoldMode();
47 this.$tokenizer = new Tokenizer(highlighter.getRules());
48 };
49 oop.inherits(Mode, TextMode);
50
51 (function() {
52 this.lineCommentStart = ";";
53 this.blockComment = {start: "/*", end: "*/"};
54 }).call(Mode.prototype);
55
56 exports.Mode = Mode;
57 });
58
59 define('ace/mode/ini_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
60
61
62 var oop = require("../lib/oop");
63 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
64
65 var IniHighlightRules = function() {
66
67 this.$rules = { start:
68 [ { token: 'punctuation.definition.comment.ini',
69 regex: '#.*',
70 push_:
71 [ { token: 'comment.line.number-sign.ini',
72 regex: '$',
73 next: 'pop' },
74 { defaultToken: 'comment.line.number-sign.ini' } ] },
75 { token: 'punctuation.definition.comment.ini',
76 regex: ';.*',
77 push_:
78 [ { token: 'comment.line.semicolon.ini', regex: '$', next: 'pop' },
79 { defaultToken: 'comment.line.semicolon.ini' } ] },
80 { token:
81 [ 'keyword.other.definition.ini',
82 'text',
83 'punctuation.separator.key-value.ini' ],
84 regex: '\\b([a-zA-Z0-9_.-]+)\\b(\\s*)(=)' },
85 { token:
86 [ 'punctuation.definition.entity.ini',
87 'constant.section.group-title.ini',
88 'punctuation.definition.entity.ini' ],
89 regex: '^(\\[)(.*?)(\\])' },
90 { token: 'punctuation.definition.string.begin.ini',
91 regex: '\'',
92 push:
93 [ { token: 'punctuation.definition.string.end.ini',
94 regex: '\'',
95 next: 'pop' },
96 { token: 'constant.character.escape.ini', regex: '\\\\.' },
97 { defaultToken: 'string.quoted.single.ini' } ] },
98 { token: 'punctuation.definition.string.begin.ini',
99 regex: '"',
100 push:
101 [ { token: 'punctuation.definition.string.end.ini',
102 regex: '"',
103 next: 'pop' },
104 { defaultToken: 'string.quoted.double.ini' } ] } ] }
105
106 this.normalizeRules();
107 };
108
109 IniHighlightRules.metaData = { fileTypes: [ 'ini', 'conf' ],
110 keyEquivalent: '^~I',
111 name: 'Ini',
112 scopeName: 'source.ini' }
113
114
115 oop.inherits(IniHighlightRules, TextHighlightRules);
116
117 exports.IniHighlightRules = IniHighlightRules;
118 });
119
120 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
121
122
123 var oop = require("../../lib/oop");
124 var Range = require("../../range").Range;
125 var BaseFoldMode = require("./fold_mode").FoldMode;
126
127 var FoldMode = exports.FoldMode = function(commentRegex) {
128 if (commentRegex) {
129 this.foldingStartMarker = new RegExp(
130 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
131 );
132 this.foldingStopMarker = new RegExp(
133 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
134 );
135 }
136 };
137 oop.inherits(FoldMode, BaseFoldMode);
138
139 (function() {
140
141 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
142 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
143
144 this.getFoldWidgetRange = function(session, foldStyle, row) {
145 var line = session.getLine(row);
146 var match = line.match(this.foldingStartMarker);
147 if (match) {
148 var i = match.index;
149
150 if (match[1])
151 return this.openingBracketBlock(session, match[1], row, i);
152
153 return session.getCommentFoldRange(row, i + match[0].length, 1);
154 }
155
156 if (foldStyle !== "markbeginend")
157 return;
158
159 var match = line.match(this.foldingStopMarker);
160 if (match) {
161 var i = match.index + match[0].length;
162
163 if (match[1])
164 return this.closingBracketBlock(session, match[1], row, i);
165
166 return session.getCommentFoldRange(row, i, -1);
167 }
168 };
169
170 }).call(FoldMode.prototype);
171
172 });
+0
-578
try/ace/mode-json.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/json', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/json_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle', 'ace/worker/worker_client'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var HighlightRules = require("./json_highlight_rules").JsonHighlightRules;
37 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
39 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
40 var WorkerClient = require("../worker/worker_client").WorkerClient;
41
42 var Mode = function() {
43 this.$tokenizer = new Tokenizer(new HighlightRules().getRules());
44 this.$outdent = new MatchingBraceOutdent();
45 this.$behaviour = new CstyleBehaviour();
46 this.foldingRules = new CStyleFoldMode();
47 };
48 oop.inherits(Mode, TextMode);
49
50 (function() {
51
52 this.getNextLineIndent = function(state, line, tab) {
53 var indent = this.$getIndent(line);
54
55 if (state == "start") {
56 var match = line.match(/^.*[\{\(\[]\s*$/);
57 if (match) {
58 indent += tab;
59 }
60 }
61
62 return indent;
63 };
64
65 this.checkOutdent = function(state, line, input) {
66 return this.$outdent.checkOutdent(line, input);
67 };
68
69 this.autoOutdent = function(state, doc, row) {
70 this.$outdent.autoOutdent(doc, row);
71 };
72
73 this.createWorker = function(session) {
74 var worker = new WorkerClient(["ace"], "ace/mode/json_worker", "JsonWorker");
75 worker.attachToDocument(session.getDocument());
76
77 worker.on("error", function(e) {
78 session.setAnnotations([e.data]);
79 });
80
81 worker.on("ok", function() {
82 session.clearAnnotations();
83 });
84
85 return worker;
86 };
87
88
89 }).call(Mode.prototype);
90
91 exports.Mode = Mode;
92 });
93
94 define('ace/mode/json_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
95
96
97 var oop = require("../lib/oop");
98 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
99
100 var JsonHighlightRules = function() {
101 this.$rules = {
102 "start" : [
103 {
104 token : "variable", // single line
105 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'
106 }, {
107 token : "string", // single line
108 regex : '"',
109 next : "string"
110 }, {
111 token : "constant.numeric", // hex
112 regex : "0[xX][0-9a-fA-F]+\\b"
113 }, {
114 token : "constant.numeric", // float
115 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
116 }, {
117 token : "constant.language.boolean",
118 regex : "(?:true|false)\\b"
119 }, {
120 token : "invalid.illegal", // single quoted strings are not allowed
121 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
122 }, {
123 token : "invalid.illegal", // comments are not allowed
124 regex : "\\/\\/.*$"
125 }, {
126 token : "paren.lparen",
127 regex : "[[({]"
128 }, {
129 token : "paren.rparen",
130 regex : "[\\])}]"
131 }, {
132 token : "text",
133 regex : "\\s+"
134 }
135 ],
136 "string" : [
137 {
138 token : "constant.language.escape",
139 regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
140 }, {
141 token : "string",
142 regex : '[^"\\\\]+'
143 }, {
144 token : "string",
145 regex : '"',
146 next : "start"
147 }, {
148 token : "string",
149 regex : "",
150 next : "start"
151 }
152 ]
153 };
154
155 };
156
157 oop.inherits(JsonHighlightRules, TextHighlightRules);
158
159 exports.JsonHighlightRules = JsonHighlightRules;
160 });
161
162 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
163
164
165 var Range = require("../range").Range;
166
167 var MatchingBraceOutdent = function() {};
168
169 (function() {
170
171 this.checkOutdent = function(line, input) {
172 if (! /^\s+$/.test(line))
173 return false;
174
175 return /^\s*\}/.test(input);
176 };
177
178 this.autoOutdent = function(doc, row) {
179 var line = doc.getLine(row);
180 var match = line.match(/^(\s*\})/);
181
182 if (!match) return 0;
183
184 var column = match[1].length;
185 var openBracePos = doc.findMatchingBracket({row: row, column: column});
186
187 if (!openBracePos || openBracePos.row == row) return 0;
188
189 var indent = this.$getIndent(doc.getLine(openBracePos.row));
190 doc.replace(new Range(row, 0, row, column-1), indent);
191 };
192
193 this.$getIndent = function(line) {
194 return line.match(/^\s*/)[0];
195 };
196
197 }).call(MatchingBraceOutdent.prototype);
198
199 exports.MatchingBraceOutdent = MatchingBraceOutdent;
200 });
201
202 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
203
204
205 var oop = require("../../lib/oop");
206 var Behaviour = require("../behaviour").Behaviour;
207 var TokenIterator = require("../../token_iterator").TokenIterator;
208 var lang = require("../../lib/lang");
209
210 var SAFE_INSERT_IN_TOKENS =
211 ["text", "paren.rparen", "punctuation.operator"];
212 var SAFE_INSERT_BEFORE_TOKENS =
213 ["text", "paren.rparen", "punctuation.operator", "comment"];
214
215
216 var autoInsertedBrackets = 0;
217 var autoInsertedRow = -1;
218 var autoInsertedLineEnd = "";
219 var maybeInsertedBrackets = 0;
220 var maybeInsertedRow = -1;
221 var maybeInsertedLineStart = "";
222 var maybeInsertedLineEnd = "";
223
224 var CstyleBehaviour = function () {
225
226 CstyleBehaviour.isSaneInsertion = function(editor, session) {
227 var cursor = editor.getCursorPosition();
228 var iterator = new TokenIterator(session, cursor.row, cursor.column);
229 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
230 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
231 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
232 return false;
233 }
234 iterator.stepForward();
235 return iterator.getCurrentTokenRow() !== cursor.row ||
236 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
237 };
238
239 CstyleBehaviour.$matchTokenType = function(token, types) {
240 return types.indexOf(token.type || token) > -1;
241 };
242
243 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
244 var cursor = editor.getCursorPosition();
245 var line = session.doc.getLine(cursor.row);
246 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
247 autoInsertedBrackets = 0;
248 autoInsertedRow = cursor.row;
249 autoInsertedLineEnd = bracket + line.substr(cursor.column);
250 autoInsertedBrackets++;
251 };
252
253 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
254 var cursor = editor.getCursorPosition();
255 var line = session.doc.getLine(cursor.row);
256 if (!this.isMaybeInsertedClosing(cursor, line))
257 maybeInsertedBrackets = 0;
258 maybeInsertedRow = cursor.row;
259 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
260 maybeInsertedLineEnd = line.substr(cursor.column);
261 maybeInsertedBrackets++;
262 };
263
264 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
265 return autoInsertedBrackets > 0 &&
266 cursor.row === autoInsertedRow &&
267 bracket === autoInsertedLineEnd[0] &&
268 line.substr(cursor.column) === autoInsertedLineEnd;
269 };
270
271 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
272 return maybeInsertedBrackets > 0 &&
273 cursor.row === maybeInsertedRow &&
274 line.substr(cursor.column) === maybeInsertedLineEnd &&
275 line.substr(0, cursor.column) == maybeInsertedLineStart;
276 };
277
278 CstyleBehaviour.popAutoInsertedClosing = function() {
279 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
280 autoInsertedBrackets--;
281 };
282
283 CstyleBehaviour.clearMaybeInsertedClosing = function() {
284 maybeInsertedBrackets = 0;
285 maybeInsertedRow = -1;
286 };
287
288 this.add("braces", "insertion", function (state, action, editor, session, text) {
289 var cursor = editor.getCursorPosition();
290 var line = session.doc.getLine(cursor.row);
291 if (text == '{') {
292 var selection = editor.getSelectionRange();
293 var selected = session.doc.getTextRange(selection);
294 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
295 return {
296 text: '{' + selected + '}',
297 selection: false
298 };
299 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
300 if (/[\]\}\)]/.test(line[cursor.column])) {
301 CstyleBehaviour.recordAutoInsert(editor, session, "}");
302 return {
303 text: '{}',
304 selection: [1, 1]
305 };
306 } else {
307 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
308 return {
309 text: '{',
310 selection: [1, 1]
311 };
312 }
313 }
314 } else if (text == '}') {
315 var rightChar = line.substring(cursor.column, cursor.column + 1);
316 if (rightChar == '}') {
317 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
318 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
319 CstyleBehaviour.popAutoInsertedClosing();
320 return {
321 text: '',
322 selection: [1, 1]
323 };
324 }
325 }
326 } else if (text == "\n" || text == "\r\n") {
327 var closing = "";
328 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
329 closing = lang.stringRepeat("}", maybeInsertedBrackets);
330 CstyleBehaviour.clearMaybeInsertedClosing();
331 }
332 var rightChar = line.substring(cursor.column, cursor.column + 1);
333 if (rightChar == '}' || closing !== "") {
334 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
335 if (!openBracePos)
336 return null;
337
338 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
339 var next_indent = this.$getIndent(line);
340
341 return {
342 text: '\n' + indent + '\n' + next_indent + closing,
343 selection: [1, indent.length, 1, indent.length]
344 };
345 }
346 }
347 });
348
349 this.add("braces", "deletion", function (state, action, editor, session, range) {
350 var selected = session.doc.getTextRange(range);
351 if (!range.isMultiLine() && selected == '{') {
352 var line = session.doc.getLine(range.start.row);
353 var rightChar = line.substring(range.end.column, range.end.column + 1);
354 if (rightChar == '}') {
355 range.end.column++;
356 return range;
357 } else {
358 maybeInsertedBrackets--;
359 }
360 }
361 });
362
363 this.add("parens", "insertion", function (state, action, editor, session, text) {
364 if (text == '(') {
365 var selection = editor.getSelectionRange();
366 var selected = session.doc.getTextRange(selection);
367 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
368 return {
369 text: '(' + selected + ')',
370 selection: false
371 };
372 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
373 CstyleBehaviour.recordAutoInsert(editor, session, ")");
374 return {
375 text: '()',
376 selection: [1, 1]
377 };
378 }
379 } else if (text == ')') {
380 var cursor = editor.getCursorPosition();
381 var line = session.doc.getLine(cursor.row);
382 var rightChar = line.substring(cursor.column, cursor.column + 1);
383 if (rightChar == ')') {
384 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
385 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
386 CstyleBehaviour.popAutoInsertedClosing();
387 return {
388 text: '',
389 selection: [1, 1]
390 };
391 }
392 }
393 }
394 });
395
396 this.add("parens", "deletion", function (state, action, editor, session, range) {
397 var selected = session.doc.getTextRange(range);
398 if (!range.isMultiLine() && selected == '(') {
399 var line = session.doc.getLine(range.start.row);
400 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
401 if (rightChar == ')') {
402 range.end.column++;
403 return range;
404 }
405 }
406 });
407
408 this.add("brackets", "insertion", function (state, action, editor, session, text) {
409 if (text == '[') {
410 var selection = editor.getSelectionRange();
411 var selected = session.doc.getTextRange(selection);
412 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
413 return {
414 text: '[' + selected + ']',
415 selection: false
416 };
417 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
418 CstyleBehaviour.recordAutoInsert(editor, session, "]");
419 return {
420 text: '[]',
421 selection: [1, 1]
422 };
423 }
424 } else if (text == ']') {
425 var cursor = editor.getCursorPosition();
426 var line = session.doc.getLine(cursor.row);
427 var rightChar = line.substring(cursor.column, cursor.column + 1);
428 if (rightChar == ']') {
429 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
430 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
431 CstyleBehaviour.popAutoInsertedClosing();
432 return {
433 text: '',
434 selection: [1, 1]
435 };
436 }
437 }
438 }
439 });
440
441 this.add("brackets", "deletion", function (state, action, editor, session, range) {
442 var selected = session.doc.getTextRange(range);
443 if (!range.isMultiLine() && selected == '[') {
444 var line = session.doc.getLine(range.start.row);
445 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
446 if (rightChar == ']') {
447 range.end.column++;
448 return range;
449 }
450 }
451 });
452
453 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
454 if (text == '"' || text == "'") {
455 var quote = text;
456 var selection = editor.getSelectionRange();
457 var selected = session.doc.getTextRange(selection);
458 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
459 return {
460 text: quote + selected + quote,
461 selection: false
462 };
463 } else {
464 var cursor = editor.getCursorPosition();
465 var line = session.doc.getLine(cursor.row);
466 var leftChar = line.substring(cursor.column-1, cursor.column);
467 if (leftChar == '\\') {
468 return null;
469 }
470 var tokens = session.getTokens(selection.start.row);
471 var col = 0, token;
472 var quotepos = -1; // Track whether we're inside an open quote.
473
474 for (var x = 0; x < tokens.length; x++) {
475 token = tokens[x];
476 if (token.type == "string") {
477 quotepos = -1;
478 } else if (quotepos < 0) {
479 quotepos = token.value.indexOf(quote);
480 }
481 if ((token.value.length + col) > selection.start.column) {
482 break;
483 }
484 col += tokens[x].value.length;
485 }
486 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
487 if (!CstyleBehaviour.isSaneInsertion(editor, session))
488 return;
489 return {
490 text: quote + quote,
491 selection: [1,1]
492 };
493 } else if (token && token.type === "string") {
494 var rightChar = line.substring(cursor.column, cursor.column + 1);
495 if (rightChar == quote) {
496 return {
497 text: '',
498 selection: [1, 1]
499 };
500 }
501 }
502 }
503 }
504 });
505
506 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
507 var selected = session.doc.getTextRange(range);
508 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
509 var line = session.doc.getLine(range.start.row);
510 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
511 if (rightChar == selected) {
512 range.end.column++;
513 return range;
514 }
515 }
516 });
517
518 };
519
520 oop.inherits(CstyleBehaviour, Behaviour);
521
522 exports.CstyleBehaviour = CstyleBehaviour;
523 });
524
525 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
526
527
528 var oop = require("../../lib/oop");
529 var Range = require("../../range").Range;
530 var BaseFoldMode = require("./fold_mode").FoldMode;
531
532 var FoldMode = exports.FoldMode = function(commentRegex) {
533 if (commentRegex) {
534 this.foldingStartMarker = new RegExp(
535 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
536 );
537 this.foldingStopMarker = new RegExp(
538 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
539 );
540 }
541 };
542 oop.inherits(FoldMode, BaseFoldMode);
543
544 (function() {
545
546 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
547 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
548
549 this.getFoldWidgetRange = function(session, foldStyle, row) {
550 var line = session.getLine(row);
551 var match = line.match(this.foldingStartMarker);
552 if (match) {
553 var i = match.index;
554
555 if (match[1])
556 return this.openingBracketBlock(session, match[1], row, i);
557
558 return session.getCommentFoldRange(row, i + match[0].length, 1);
559 }
560
561 if (foldStyle !== "markbeginend")
562 return;
563
564 var match = line.match(this.foldingStopMarker);
565 if (match) {
566 var i = match.index + match[0].length;
567
568 if (match[1])
569 return this.closingBracketBlock(session, match[1], row, i);
570
571 return session.getCommentFoldRange(row, i, -1);
572 }
573 };
574
575 }).call(FoldMode.prototype);
576
577 });
+0
-635
try/ace/mode-jsx.js less more
0 define('ace/mode/jsx', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/jsx_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
1
2
3 var oop = require("../lib/oop");
4 var TextMode = require("./text").Mode;
5 var Tokenizer = require("../tokenizer").Tokenizer;
6 var JsxHighlightRules = require("./jsx_highlight_rules").JsxHighlightRules;
7 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
8 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
9 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
10
11 function Mode() {
12 this.$tokenizer = new Tokenizer(new JsxHighlightRules().getRules());
13 this.$outdent = new MatchingBraceOutdent();
14 this.$behaviour = new CstyleBehaviour();
15 this.foldingRules = new CStyleFoldMode();
16 }
17 oop.inherits(Mode, TextMode);
18
19 (function() {
20
21 this.lineCommentStart = "//";
22 this.blockComment = {start: "/*", end: "*/"};
23
24 this.getNextLineIndent = function(state, line, tab) {
25 var indent = this.$getIndent(line);
26
27 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
28 var tokens = tokenizedLine.tokens;
29
30 if (tokens.length && tokens[tokens.length-1].type == "comment") {
31 return indent;
32 }
33
34 if (state == "start") {
35 var match = line.match(/^.*[\{\(\[]\s*$/);
36 if (match) {
37 indent += tab;
38 }
39 }
40
41 return indent;
42 };
43
44 this.checkOutdent = function(state, line, input) {
45 return this.$outdent.checkOutdent(line, input);
46 };
47
48 this.autoOutdent = function(state, doc, row) {
49 this.$outdent.autoOutdent(doc, row);
50 };
51
52 }).call(Mode.prototype);
53
54 exports.Mode = Mode;
55 });
56 define('ace/mode/jsx_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
57 var oop = require("../lib/oop");
58 var lang = require("../lib/lang");
59 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
60 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
61
62 var JsxHighlightRules = function() {
63 var keywords = lang.arrayToMap(
64 ("break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|" +
65 "if|throw|" +
66 "delete|in|try|" +
67 "class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|" +
68 "number|int|string|boolean|variant|" +
69 "log|assert").split("|")
70 );
71
72 var buildinConstants = lang.arrayToMap(
73 ("null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined").split("|")
74 );
75
76 var reserved = lang.arrayToMap(
77 ("debugger|with|" +
78 "const|export|" +
79 "let|private|public|yield|protected|" +
80 "extern|native|as|operator|__fake__|__readonly__").split("|")
81 );
82
83 var identifierRe = "[a-zA-Z_][a-zA-Z0-9_]*\\b";
84
85 this.$rules = {
86 "start" : [
87 {
88 token : "comment",
89 regex : "\\/\\/.*$"
90 },
91 DocCommentHighlightRules.getStartRule("doc-start"),
92 {
93 token : "comment", // multi line comment
94 regex : "\\/\\*",
95 next : "comment"
96 }, {
97 token : "string.regexp",
98 regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
99 }, {
100 token : "string", // single line
101 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
102 }, {
103 token : "string", // single line
104 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
105 }, {
106 token : "constant.numeric", // hex
107 regex : "0[xX][0-9a-fA-F]+\\b"
108 }, {
109 token : "constant.numeric", // float
110 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
111 }, {
112 token : "constant.language.boolean",
113 regex : "(?:true|false)\\b"
114 }, {
115 token : [
116 "storage.type",
117 "text",
118 "entity.name.function"
119 ],
120 regex : "(function)(\\s+)(" + identifierRe + ")"
121 }, {
122 token : function(value) {
123 if (value == "this")
124 return "variable.language";
125 else if (value == "function")
126 return "storage.type";
127 else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value))
128 return "keyword";
129 else if (buildinConstants.hasOwnProperty(value))
130 return "constant.language";
131 else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value))
132 return "language.support.class";
133 else
134 return "identifier";
135 },
136 regex : identifierRe
137 }, {
138 token : "keyword.operator",
139 regex : "!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
140 }, {
141 token : "punctuation.operator",
142 regex : "\\?|\\:|\\,|\\;|\\."
143 }, {
144 token : "paren.lparen",
145 regex : "[[({<]"
146 }, {
147 token : "paren.rparen",
148 regex : "[\\])}>]"
149 }, {
150 token : "text",
151 regex : "\\s+"
152 }
153 ],
154 "comment" : [
155 {
156 token : "comment", // closing comment
157 regex : ".*?\\*\\/",
158 next : "start"
159 }, {
160 token : "comment", // comment spanning whole line
161 regex : ".+"
162 }
163 ]
164 };
165
166 this.embedRules(DocCommentHighlightRules, "doc-",
167 [ DocCommentHighlightRules.getEndRule("start") ]);
168 };
169
170 oop.inherits(JsxHighlightRules, TextHighlightRules);
171
172 exports.JsxHighlightRules = JsxHighlightRules;
173 });
174
175 define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
176
177
178 var oop = require("../lib/oop");
179 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
180
181 var DocCommentHighlightRules = function() {
182
183 this.$rules = {
184 "start" : [ {
185 token : "comment.doc.tag",
186 regex : "@[\\w\\d_]+" // TODO: fix email addresses
187 }, {
188 token : "comment.doc.tag",
189 regex : "\\bTODO\\b"
190 }, {
191 defaultToken : "comment.doc"
192 }]
193 };
194 };
195
196 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
197
198 DocCommentHighlightRules.getStartRule = function(start) {
199 return {
200 token : "comment.doc", // doc comment
201 regex : "\\/\\*(?=\\*)",
202 next : start
203 };
204 };
205
206 DocCommentHighlightRules.getEndRule = function (start) {
207 return {
208 token : "comment.doc", // closing comment
209 regex : "\\*\\/",
210 next : start
211 };
212 };
213
214
215 exports.DocCommentHighlightRules = DocCommentHighlightRules;
216
217 });
218
219 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
220
221
222 var Range = require("../range").Range;
223
224 var MatchingBraceOutdent = function() {};
225
226 (function() {
227
228 this.checkOutdent = function(line, input) {
229 if (! /^\s+$/.test(line))
230 return false;
231
232 return /^\s*\}/.test(input);
233 };
234
235 this.autoOutdent = function(doc, row) {
236 var line = doc.getLine(row);
237 var match = line.match(/^(\s*\})/);
238
239 if (!match) return 0;
240
241 var column = match[1].length;
242 var openBracePos = doc.findMatchingBracket({row: row, column: column});
243
244 if (!openBracePos || openBracePos.row == row) return 0;
245
246 var indent = this.$getIndent(doc.getLine(openBracePos.row));
247 doc.replace(new Range(row, 0, row, column-1), indent);
248 };
249
250 this.$getIndent = function(line) {
251 return line.match(/^\s*/)[0];
252 };
253
254 }).call(MatchingBraceOutdent.prototype);
255
256 exports.MatchingBraceOutdent = MatchingBraceOutdent;
257 });
258
259 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
260
261
262 var oop = require("../../lib/oop");
263 var Behaviour = require("../behaviour").Behaviour;
264 var TokenIterator = require("../../token_iterator").TokenIterator;
265 var lang = require("../../lib/lang");
266
267 var SAFE_INSERT_IN_TOKENS =
268 ["text", "paren.rparen", "punctuation.operator"];
269 var SAFE_INSERT_BEFORE_TOKENS =
270 ["text", "paren.rparen", "punctuation.operator", "comment"];
271
272
273 var autoInsertedBrackets = 0;
274 var autoInsertedRow = -1;
275 var autoInsertedLineEnd = "";
276 var maybeInsertedBrackets = 0;
277 var maybeInsertedRow = -1;
278 var maybeInsertedLineStart = "";
279 var maybeInsertedLineEnd = "";
280
281 var CstyleBehaviour = function () {
282
283 CstyleBehaviour.isSaneInsertion = function(editor, session) {
284 var cursor = editor.getCursorPosition();
285 var iterator = new TokenIterator(session, cursor.row, cursor.column);
286 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
287 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
288 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
289 return false;
290 }
291 iterator.stepForward();
292 return iterator.getCurrentTokenRow() !== cursor.row ||
293 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
294 };
295
296 CstyleBehaviour.$matchTokenType = function(token, types) {
297 return types.indexOf(token.type || token) > -1;
298 };
299
300 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
301 var cursor = editor.getCursorPosition();
302 var line = session.doc.getLine(cursor.row);
303 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
304 autoInsertedBrackets = 0;
305 autoInsertedRow = cursor.row;
306 autoInsertedLineEnd = bracket + line.substr(cursor.column);
307 autoInsertedBrackets++;
308 };
309
310 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
311 var cursor = editor.getCursorPosition();
312 var line = session.doc.getLine(cursor.row);
313 if (!this.isMaybeInsertedClosing(cursor, line))
314 maybeInsertedBrackets = 0;
315 maybeInsertedRow = cursor.row;
316 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
317 maybeInsertedLineEnd = line.substr(cursor.column);
318 maybeInsertedBrackets++;
319 };
320
321 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
322 return autoInsertedBrackets > 0 &&
323 cursor.row === autoInsertedRow &&
324 bracket === autoInsertedLineEnd[0] &&
325 line.substr(cursor.column) === autoInsertedLineEnd;
326 };
327
328 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
329 return maybeInsertedBrackets > 0 &&
330 cursor.row === maybeInsertedRow &&
331 line.substr(cursor.column) === maybeInsertedLineEnd &&
332 line.substr(0, cursor.column) == maybeInsertedLineStart;
333 };
334
335 CstyleBehaviour.popAutoInsertedClosing = function() {
336 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
337 autoInsertedBrackets--;
338 };
339
340 CstyleBehaviour.clearMaybeInsertedClosing = function() {
341 maybeInsertedBrackets = 0;
342 maybeInsertedRow = -1;
343 };
344
345 this.add("braces", "insertion", function (state, action, editor, session, text) {
346 var cursor = editor.getCursorPosition();
347 var line = session.doc.getLine(cursor.row);
348 if (text == '{') {
349 var selection = editor.getSelectionRange();
350 var selected = session.doc.getTextRange(selection);
351 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
352 return {
353 text: '{' + selected + '}',
354 selection: false
355 };
356 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
357 if (/[\]\}\)]/.test(line[cursor.column])) {
358 CstyleBehaviour.recordAutoInsert(editor, session, "}");
359 return {
360 text: '{}',
361 selection: [1, 1]
362 };
363 } else {
364 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
365 return {
366 text: '{',
367 selection: [1, 1]
368 };
369 }
370 }
371 } else if (text == '}') {
372 var rightChar = line.substring(cursor.column, cursor.column + 1);
373 if (rightChar == '}') {
374 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
375 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
376 CstyleBehaviour.popAutoInsertedClosing();
377 return {
378 text: '',
379 selection: [1, 1]
380 };
381 }
382 }
383 } else if (text == "\n" || text == "\r\n") {
384 var closing = "";
385 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
386 closing = lang.stringRepeat("}", maybeInsertedBrackets);
387 CstyleBehaviour.clearMaybeInsertedClosing();
388 }
389 var rightChar = line.substring(cursor.column, cursor.column + 1);
390 if (rightChar == '}' || closing !== "") {
391 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
392 if (!openBracePos)
393 return null;
394
395 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
396 var next_indent = this.$getIndent(line);
397
398 return {
399 text: '\n' + indent + '\n' + next_indent + closing,
400 selection: [1, indent.length, 1, indent.length]
401 };
402 }
403 }
404 });
405
406 this.add("braces", "deletion", function (state, action, editor, session, range) {
407 var selected = session.doc.getTextRange(range);
408 if (!range.isMultiLine() && selected == '{') {
409 var line = session.doc.getLine(range.start.row);
410 var rightChar = line.substring(range.end.column, range.end.column + 1);
411 if (rightChar == '}') {
412 range.end.column++;
413 return range;
414 } else {
415 maybeInsertedBrackets--;
416 }
417 }
418 });
419
420 this.add("parens", "insertion", function (state, action, editor, session, text) {
421 if (text == '(') {
422 var selection = editor.getSelectionRange();
423 var selected = session.doc.getTextRange(selection);
424 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
425 return {
426 text: '(' + selected + ')',
427 selection: false
428 };
429 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
430 CstyleBehaviour.recordAutoInsert(editor, session, ")");
431 return {
432 text: '()',
433 selection: [1, 1]
434 };
435 }
436 } else if (text == ')') {
437 var cursor = editor.getCursorPosition();
438 var line = session.doc.getLine(cursor.row);
439 var rightChar = line.substring(cursor.column, cursor.column + 1);
440 if (rightChar == ')') {
441 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
442 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
443 CstyleBehaviour.popAutoInsertedClosing();
444 return {
445 text: '',
446 selection: [1, 1]
447 };
448 }
449 }
450 }
451 });
452
453 this.add("parens", "deletion", function (state, action, editor, session, range) {
454 var selected = session.doc.getTextRange(range);
455 if (!range.isMultiLine() && selected == '(') {
456 var line = session.doc.getLine(range.start.row);
457 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
458 if (rightChar == ')') {
459 range.end.column++;
460 return range;
461 }
462 }
463 });
464
465 this.add("brackets", "insertion", function (state, action, editor, session, text) {
466 if (text == '[') {
467 var selection = editor.getSelectionRange();
468 var selected = session.doc.getTextRange(selection);
469 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
470 return {
471 text: '[' + selected + ']',
472 selection: false
473 };
474 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
475 CstyleBehaviour.recordAutoInsert(editor, session, "]");
476 return {
477 text: '[]',
478 selection: [1, 1]
479 };
480 }
481 } else if (text == ']') {
482 var cursor = editor.getCursorPosition();
483 var line = session.doc.getLine(cursor.row);
484 var rightChar = line.substring(cursor.column, cursor.column + 1);
485 if (rightChar == ']') {
486 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
487 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
488 CstyleBehaviour.popAutoInsertedClosing();
489 return {
490 text: '',
491 selection: [1, 1]
492 };
493 }
494 }
495 }
496 });
497
498 this.add("brackets", "deletion", function (state, action, editor, session, range) {
499 var selected = session.doc.getTextRange(range);
500 if (!range.isMultiLine() && selected == '[') {
501 var line = session.doc.getLine(range.start.row);
502 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
503 if (rightChar == ']') {
504 range.end.column++;
505 return range;
506 }
507 }
508 });
509
510 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
511 if (text == '"' || text == "'") {
512 var quote = text;
513 var selection = editor.getSelectionRange();
514 var selected = session.doc.getTextRange(selection);
515 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
516 return {
517 text: quote + selected + quote,
518 selection: false
519 };
520 } else {
521 var cursor = editor.getCursorPosition();
522 var line = session.doc.getLine(cursor.row);
523 var leftChar = line.substring(cursor.column-1, cursor.column);
524 if (leftChar == '\\') {
525 return null;
526 }
527 var tokens = session.getTokens(selection.start.row);
528 var col = 0, token;
529 var quotepos = -1; // Track whether we're inside an open quote.
530
531 for (var x = 0; x < tokens.length; x++) {
532 token = tokens[x];
533 if (token.type == "string") {
534 quotepos = -1;
535 } else if (quotepos < 0) {
536 quotepos = token.value.indexOf(quote);
537 }
538 if ((token.value.length + col) > selection.start.column) {
539 break;
540 }
541 col += tokens[x].value.length;
542 }
543 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
544 if (!CstyleBehaviour.isSaneInsertion(editor, session))
545 return;
546 return {
547 text: quote + quote,
548 selection: [1,1]
549 };
550 } else if (token && token.type === "string") {
551 var rightChar = line.substring(cursor.column, cursor.column + 1);
552 if (rightChar == quote) {
553 return {
554 text: '',
555 selection: [1, 1]
556 };
557 }
558 }
559 }
560 }
561 });
562
563 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
564 var selected = session.doc.getTextRange(range);
565 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
566 var line = session.doc.getLine(range.start.row);
567 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
568 if (rightChar == selected) {
569 range.end.column++;
570 return range;
571 }
572 }
573 });
574
575 };
576
577 oop.inherits(CstyleBehaviour, Behaviour);
578
579 exports.CstyleBehaviour = CstyleBehaviour;
580 });
581
582 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
583
584
585 var oop = require("../../lib/oop");
586 var Range = require("../../range").Range;
587 var BaseFoldMode = require("./fold_mode").FoldMode;
588
589 var FoldMode = exports.FoldMode = function(commentRegex) {
590 if (commentRegex) {
591 this.foldingStartMarker = new RegExp(
592 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
593 );
594 this.foldingStopMarker = new RegExp(
595 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
596 );
597 }
598 };
599 oop.inherits(FoldMode, BaseFoldMode);
600
601 (function() {
602
603 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
604 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
605
606 this.getFoldWidgetRange = function(session, foldStyle, row) {
607 var line = session.getLine(row);
608 var match = line.match(this.foldingStartMarker);
609 if (match) {
610 var i = match.index;
611
612 if (match[1])
613 return this.openingBracketBlock(session, match[1], row, i);
614
615 return session.getCommentFoldRange(row, i + match[0].length, 1);
616 }
617
618 if (foldStyle !== "markbeginend")
619 return;
620
621 var match = line.match(this.foldingStopMarker);
622 if (match) {
623 var i = match.index + match[0].length;
624
625 if (match[1])
626 return this.closingBracketBlock(session, match[1], row, i);
627
628 return session.getCommentFoldRange(row, i, -1);
629 }
630 };
631
632 }).call(FoldMode.prototype);
633
634 });
+0
-245
try/ace/mode-julia.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * Contributor(s):
30 *
31 *
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35 define('ace/mode/julia', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/julia_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
36
37
38 var oop = require("../lib/oop");
39 var TextMode = require("./text").Mode;
40 var Tokenizer = require("../tokenizer").Tokenizer;
41 var JuliaHighlightRules = require("./julia_highlight_rules").JuliaHighlightRules;
42 var FoldMode = require("./folding/cstyle").FoldMode;
43
44 var Mode = function() {
45 var highlighter = new JuliaHighlightRules();
46 this.foldingRules = new FoldMode();
47 this.$tokenizer = new Tokenizer(highlighter.getRules());
48 };
49 oop.inherits(Mode, TextMode);
50
51 (function() {
52 this.lineCommentStart = "#";
53 this.blockComment = "";
54 }).call(Mode.prototype);
55
56 exports.Mode = Mode;
57 });
58
59 define('ace/mode/julia_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
60
61
62 var oop = require("../lib/oop");
63 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
64
65 var JuliaHighlightRules = function() {
66
67 this.$rules = { start:
68 [ { include: '#function_decl' },
69 { include: '#function_call' },
70 { include: '#type_decl' },
71 { include: '#keyword' },
72 { include: '#operator' },
73 { include: '#number' },
74 { include: '#string' },
75 { include: '#comment' } ],
76 '#bracket':
77 [ { token: 'keyword.bracket.julia',
78 regex: '\\(|\\)|\\[|\\]|\\{|\\}|,' } ],
79 '#comment':
80 [ { token:
81 [ 'punctuation.definition.comment.julia',
82 'comment.line.number-sign.julia' ],
83 regex: '(#)(?!\\{)(.*$)'} ],
84 '#function_call':
85 [ { token: [ 'support.function.julia', 'text' ],
86 regex: '([a-zA-Z0-9_]+!?)(\\w*\\()'} ],
87 '#function_decl':
88 [ { token: [ 'keyword.other.julia', 'meta.function.julia',
89 'entity.name.function.julia', 'meta.function.julia','text' ],
90 regex: '(function|macro)(\\s*)([a-zA-Z0-9_\\{]+!?)(\\w*)([(\\\\{])'} ],
91 '#keyword':
92 [ { token: 'keyword.other.julia',
93 regex: '\\b(?:function|type|immutable|macro|quote|abstract|bitstype|typealias|module|baremodule|new)\\b' },
94 { token: 'keyword.control.julia',
95 regex: '\\b(?:if|else|elseif|while|for|in|begin|let|end|do|try|catch|finally|return|break|continue)\\b' },
96 { token: 'storage.modifier.variable.julia',
97 regex: '\\b(?:global|local|const|export|import|importall|using)\\b' },
98 { token: 'variable.macro.julia', regex: '@\\w+\\b' } ],
99 '#number':
100 [ { token: 'constant.numeric.julia',
101 regex: '\\b0(?:x|X)[0-9a-fA-F]*|(?:\\b[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]*)?(?:im)?|\\bInf(?:32)?\\b|\\bNaN(?:32)?\\b|\\btrue\\b|\\bfalse\\b' } ],
102 '#operator':
103 [ { token: 'keyword.operator.update.julia',
104 regex: '=|:=|\\+=|-=|\\*=|/=|//=|\\.//=|\\.\\*=|\\\\=|\\.\\\\=|^=|\\.^=|%=|\\|=|&=|\\$=|<<=|>>=' },
105 { token: 'keyword.operator.ternary.julia', regex: '\\?|:' },
106 { token: 'keyword.operator.boolean.julia',
107 regex: '\\|\\||&&|!' },
108 { token: 'keyword.operator.arrow.julia', regex: '->|<-|-->' },
109 { token: 'keyword.operator.relation.julia',
110 regex: '>|<|>=|<=|==|!=|\\.>|\\.<|\\.>=|\\.>=|\\.==|\\.!=|\\.=|\\.!|<:|:>' },
111 { token: 'keyword.operator.range.julia', regex: ':' },
112 { token: 'keyword.operator.shift.julia', regex: '<<|>>' },
113 { token: 'keyword.operator.bitwise.julia', regex: '\\||\\&|~' },
114 { token: 'keyword.operator.arithmetic.julia',
115 regex: '\\+|-|\\*|\\.\\*|/|\\./|//|\\.//|%|\\.%|\\\\|\\.\\\\|\\^|\\.\\^' },
116 { token: 'keyword.operator.isa.julia', regex: '::' },
117 { token: 'keyword.operator.dots.julia',
118 regex: '\\.(?=[a-zA-Z])|\\.\\.+' },
119 { token: 'keyword.operator.interpolation.julia',
120 regex: '\\$#?(?=.)' },
121 { token: [ 'variable', 'keyword.operator.transposed-variable.julia' ],
122 regex: '(\\w+)((?:\'|\\.\')*\\.?\')' },
123 { token: 'text',
124 regex: '\\[|\\('},
125 { token: [ 'text', 'keyword.operator.transposed-matrix.julia' ],
126 regex: "([\\]\\)])((?:'|\\.')*\\.?')"} ],
127 '#string':
128 [ { token: 'punctuation.definition.string.begin.julia',
129 regex: '\'',
130 push:
131 [ { token: 'punctuation.definition.string.end.julia',
132 regex: '\'',
133 next: 'pop' },
134 { include: '#string_escaped_char' },
135 { defaultToken: 'string.quoted.single.julia' } ] },
136 { token: 'punctuation.definition.string.begin.julia',
137 regex: '"',
138 push:
139 [ { token: 'punctuation.definition.string.end.julia',
140 regex: '"',
141 next: 'pop' },
142 { include: '#string_escaped_char' },
143 { defaultToken: 'string.quoted.double.julia' } ] },
144 { token: 'punctuation.definition.string.begin.julia',
145 regex: '\\b\\w+"',
146 push:
147 [ { token: 'punctuation.definition.string.end.julia',
148 regex: '"\\w*',
149 next: 'pop' },
150 { include: '#string_custom_escaped_char' },
151 { defaultToken: 'string.quoted.custom-double.julia' } ] },
152 { token: 'punctuation.definition.string.begin.julia',
153 regex: '`',
154 push:
155 [ { token: 'punctuation.definition.string.end.julia',
156 regex: '`',
157 next: 'pop' },
158 { include: '#string_escaped_char' },
159 { defaultToken: 'string.quoted.backtick.julia' } ] } ],
160 '#string_custom_escaped_char': [ { token: 'constant.character.escape.julia', regex: '\\\\"' } ],
161 '#string_escaped_char':
162 [ { token: 'constant.character.escape.julia',
163 regex: '\\\\(?:\\\\|[0-3]\\d{,2}|[4-7]\\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}|.)' } ],
164 '#type_decl':
165 [ { token:
166 [ 'keyword.control.type.julia',
167 'meta.type.julia',
168 'entity.name.type.julia',
169 'entity.other.inherited-class.julia',
170 'punctuation.separator.inheritance.julia',
171 'entity.other.inherited-class.julia' ],
172 regex: '(type|immutable)(\\s+)([a-zA-Z0-9_]+)(?:(\\s*)(<:)(\\s*[.a-zA-Z0-9_:]+))?' },
173 { token: [ 'other.typed-variable.julia', 'support.type.julia' ],
174 regex: '([a-zA-Z0-9_]+)(::[a-zA-Z0-9_{}]+)' } ] }
175
176 this.normalizeRules();
177 };
178
179 JuliaHighlightRules.metaData = { fileTypes: [ 'jl' ],
180 firstLineMatch: '^#!.*\\bjulia\\s*$',
181 foldingStartMarker: '^\\s*(?:if|while|for|begin|function|macro|module|baremodule|type|immutable|let)\\b(?!.*\\bend\\b).*$',
182 foldingStopMarker: '^\\s*(?:end)\\b.*$',
183 name: 'Julia',
184 scopeName: 'source.julia' }
185
186
187 oop.inherits(JuliaHighlightRules, TextHighlightRules);
188
189 exports.JuliaHighlightRules = JuliaHighlightRules;
190 });
191
192 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
193
194
195 var oop = require("../../lib/oop");
196 var Range = require("../../range").Range;
197 var BaseFoldMode = require("./fold_mode").FoldMode;
198
199 var FoldMode = exports.FoldMode = function(commentRegex) {
200 if (commentRegex) {
201 this.foldingStartMarker = new RegExp(
202 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
203 );
204 this.foldingStopMarker = new RegExp(
205 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
206 );
207 }
208 };
209 oop.inherits(FoldMode, BaseFoldMode);
210
211 (function() {
212
213 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
214 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
215
216 this.getFoldWidgetRange = function(session, foldStyle, row) {
217 var line = session.getLine(row);
218 var match = line.match(this.foldingStartMarker);
219 if (match) {
220 var i = match.index;
221
222 if (match[1])
223 return this.openingBracketBlock(session, match[1], row, i);
224
225 return session.getCommentFoldRange(row, i + match[0].length, 1);
226 }
227
228 if (foldStyle !== "markbeginend")
229 return;
230
231 var match = line.match(this.foldingStopMarker);
232 if (match) {
233 var i = match.index + match[0].length;
234
235 if (match[1])
236 return this.closingBracketBlock(session, match[1], row, i);
237
238 return session.getCommentFoldRange(row, i, -1);
239 }
240 };
241
242 }).call(FoldMode.prototype);
243
244 });
+0
-189
try/ace/mode-latex.js less more
0 define('ace/mode/latex', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/latex_highlight_rules', 'ace/mode/folding/latex', 'ace/range'], function(require, exports, module) {
1
2
3 var oop = require("../lib/oop");
4 var TextMode = require("./text").Mode;
5 var Tokenizer = require("../tokenizer").Tokenizer;
6 var LatexHighlightRules = require("./latex_highlight_rules").LatexHighlightRules;
7 var LatexFoldMode = require("./folding/latex").FoldMode;
8 var Range = require("../range").Range;
9
10 var Mode = function() {
11 this.$tokenizer = new Tokenizer(new LatexHighlightRules().getRules());
12 this.foldingRules = new LatexFoldMode();
13 };
14 oop.inherits(Mode, TextMode);
15
16 (function() {
17 this.lineCommentStart = "%";
18
19 }).call(Mode.prototype);
20
21 exports.Mode = Mode;
22
23 });
24 define('ace/mode/latex_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
25
26
27 var oop = require("../lib/oop");
28 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
29
30 var LatexHighlightRules = function() {
31 this.$rules = {
32 "start" : [{
33 token : "keyword",
34 regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
35 }, {
36 token : "lparen",
37 regex : "[[({]"
38 }, {
39 token : "rparen",
40 regex : "[\\])}]"
41 }, {
42 token : "string",
43 regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
44 }, {
45 token : "comment",
46 regex : "%.*$"
47 }]
48 };
49 };
50
51 oop.inherits(LatexHighlightRules, TextHighlightRules);
52
53 exports.LatexHighlightRules = LatexHighlightRules;
54
55 });
56
57 define('ace/mode/folding/latex', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range', 'ace/token_iterator'], function(require, exports, module) {
58
59
60 var oop = require("../../lib/oop");
61 var BaseFoldMode = require("./fold_mode").FoldMode;
62 var Range = require("../../range").Range;
63 var TokenIterator = require("../../token_iterator").TokenIterator;
64
65 var FoldMode = exports.FoldMode = function() {};
66
67 oop.inherits(FoldMode, BaseFoldMode);
68
69 (function() {
70
71 this.foldingStartMarker = /^\s*\\(begin)|(section|subsection)\b|{\s*$/;
72 this.foldingStopMarker = /^\s*\\(end)\b|^\s*}/;
73
74 this.getFoldWidgetRange = function(session, foldStyle, row) {
75 var line = session.doc.getLine(row);
76 var match = this.foldingStartMarker.exec(line);
77 if (match) {
78 if (match[1])
79 return this.latexBlock(session, row, match[0].length - 1);
80 if (match[2])
81 return this.latexSection(session, row, match[0].length - 1);
82
83 return this.openingBracketBlock(session, "{", row, match.index);
84 }
85
86 var match = this.foldingStopMarker.exec(line);
87 if (match) {
88 if (match[1])
89 return this.latexBlock(session, row, match[0].length - 1);
90
91 return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
92 }
93 };
94
95 this.latexBlock = function(session, row, column) {
96 var keywords = {
97 "\\begin": 1,
98 "\\end": -1
99 };
100
101 var stream = new TokenIterator(session, row, column);
102 var token = stream.getCurrentToken();
103 if (!token || token.type !== "keyword")
104 return;
105
106 var val = token.value;
107 var dir = keywords[val];
108
109 var getType = function() {
110 var token = stream.stepForward();
111 var type = token.type == "lparen" ?stream.stepForward().value : "";
112 if (dir === -1) {
113 stream.stepBackward();
114 if (type)
115 stream.stepBackward();
116 }
117 return type;
118 };
119 var stack = [getType()];
120 var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;
121 var startRow = row;
122
123 stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
124 while(token = stream.step()) {
125 if (token.type !== "keyword")
126 continue;
127 var level = keywords[token.value];
128 if (!level)
129 continue;
130 var type = getType();
131 if (level === dir)
132 stack.unshift(type);
133 else if (stack.shift() !== type || !stack.length)
134 break;
135 }
136
137 if (stack.length)
138 return;
139
140 var row = stream.getCurrentTokenRow();
141 if (dir === -1)
142 return new Range(row, session.getLine(row).length, startRow, startColumn);
143 stream.stepBackward();
144 return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());
145 };
146
147 this.latexSection = function(session, row, column) {
148 var keywords = ["\\subsection", "\\section", "\\begin", "\\end"];
149
150 var stream = new TokenIterator(session, row, column);
151 var token = stream.getCurrentToken();
152 if (!token || token.type != "keyword")
153 return;
154
155 var startLevel = keywords.indexOf(token.value);
156 var stackDepth = 0
157 var endRow = row;
158
159 while(token = stream.stepForward()) {
160 if (token.type !== "keyword")
161 continue;
162 var level = keywords.indexOf(token.value);
163
164 if (level >= 2) {
165 if (!stackDepth)
166 endRow = stream.getCurrentTokenRow() - 1;
167 stackDepth += level == 2 ? 1 : - 1;
168 if (stackDepth < 0)
169 break
170 } else if (level >= startLevel)
171 break;
172 }
173
174 if (!stackDepth)
175 endRow = stream.getCurrentTokenRow() - 1;
176
177 while (endRow > row && !/\S/.test(session.getLine(endRow)))
178 endRow--;
179
180 return new Range(
181 row, session.getLine(row).length,
182 endRow, session.getLine(endRow).length
183 );
184 };
185
186 }).call(FoldMode.prototype);
187
188 });
+0
-807
try/ace/mode-less.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/less', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/less_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
37 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38 var CssBehaviour = require("./behaviour/css").CssBehaviour;
39 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
40
41 var Mode = function() {
42 this.$tokenizer = new Tokenizer(new LessHighlightRules().getRules());
43 this.$outdent = new MatchingBraceOutdent();
44 this.$behaviour = new CssBehaviour();
45 this.foldingRules = new CStyleFoldMode();
46 };
47 oop.inherits(Mode, TextMode);
48
49 (function() {
50
51 this.lineCommentStart = "//";
52 this.blockComment = {start: "/*", end: "*/"};
53
54 this.getNextLineIndent = function(state, line, tab) {
55 var indent = this.$getIndent(line);
56 var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
57 if (tokens.length && tokens[tokens.length-1].type == "comment") {
58 return indent;
59 }
60
61 var match = line.match(/^.*\{\s*$/);
62 if (match) {
63 indent += tab;
64 }
65
66 return indent;
67 };
68
69 this.checkOutdent = function(state, line, input) {
70 return this.$outdent.checkOutdent(line, input);
71 };
72
73 this.autoOutdent = function(state, doc, row) {
74 this.$outdent.autoOutdent(doc, row);
75 };
76
77 }).call(Mode.prototype);
78
79 exports.Mode = Mode;
80
81 });
82
83 define('ace/mode/less_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
84
85
86 var oop = require("../lib/oop");
87 var lang = require("../lib/lang");
88 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
89
90 var LessHighlightRules = function() {
91
92 var properties = lang.arrayToMap( (function () {
93
94 var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
95
96 var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
97 "background-size|binding|border-bottom-colors|border-left-colors|" +
98 "border-right-colors|border-top-colors|border-end|border-end-color|" +
99 "border-end-style|border-end-width|border-image|border-start|" +
100 "border-start-color|border-start-style|border-start-width|box-align|" +
101 "box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
102 "box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
103 "column-rule-width|column-rule-style|column-rule-color|float-edge|" +
104 "font-feature-settings|font-language-override|force-broken-image-icon|" +
105 "image-region|margin-end|margin-start|opacity|outline|outline-color|" +
106 "outline-offset|outline-radius|outline-radius-bottomleft|" +
107 "outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
108 "outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
109 "tab-size|text-blink|text-decoration-color|text-decoration-line|" +
110 "text-decoration-style|transform|transform-origin|transition|" +
111 "transition-delay|transition-duration|transition-property|" +
112 "transition-timing-function|user-focus|user-input|user-modify|user-select|" +
113 "window-shadow|border-radius").split("|");
114
115 var properties = ("azimuth|background-attachment|background-color|background-image|" +
116 "background-position|background-repeat|background|border-bottom-color|" +
117 "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
118 "border-color|border-left-color|border-left-style|border-left-width|" +
119 "border-left|border-right-color|border-right-style|border-right-width|" +
120 "border-right|border-spacing|border-style|border-top-color|" +
121 "border-top-style|border-top-width|border-top|border-width|border|" +
122 "bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
123 "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
124 "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
125 "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
126 "letter-spacing|line-height|list-style-image|list-style-position|" +
127 "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
128 "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
129 "min-width|opacity|orphans|outline-color|" +
130 "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
131 "padding-left|padding-right|padding-top|padding|page-break-after|" +
132 "page-break-before|page-break-inside|page|pause-after|pause-before|" +
133 "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
134 "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
135 "stress|table-layout|text-align|text-decoration|text-indent|" +
136 "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
137 "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
138 "z-index").split("|");
139 var ret = [];
140 for (var i=0, ln=browserPrefix.length; i<ln; i++) {
141 Array.prototype.push.apply(
142 ret,
143 (( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
144 );
145 }
146 Array.prototype.push.apply(ret, prefixProperties);
147 Array.prototype.push.apply(ret, properties);
148
149 return ret;
150
151 })() );
152
153
154
155 var functions = lang.arrayToMap(
156 ("hsl|hsla|rgb|rgba|url|attr|counter|counters|lighten|darken|saturate|" +
157 "desaturate|fadein|fadeout|fade|spin|mix|hue|saturation|lightness|" +
158 "alpha|round|ceil|floor|percentage|color|iscolor|isnumber|isstring|" +
159 "iskeyword|isurl|ispixel|ispercentage|isem").split("|")
160 );
161
162 var constants = lang.arrayToMap(
163 ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
164 "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
165 "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
166 "decimal-leading-zero|decimal|default|disabled|disc|" +
167 "distribute-all-lines|distribute-letter|distribute-space|" +
168 "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
169 "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
170 "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
171 "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
172 "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
173 "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
174 "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
175 "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
176 "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
177 "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
178 "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
179 "solid|square|static|strict|super|sw-resize|table-footer-group|" +
180 "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
181 "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
182 "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
183 "zero").split("|")
184 );
185
186 var colors = lang.arrayToMap(
187 ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
188 "purple|red|silver|teal|white|yellow").split("|")
189 );
190
191 var keywords = lang.arrayToMap(
192 ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|" +
193 "@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|" +
194 "def|end|declare|when|not|and").split("|")
195 );
196
197 var tags = lang.arrayToMap(
198 ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
199 "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
200 "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
201 "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
202 "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
203 "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
204 "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
205 "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
206 "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
207 );
208
209 var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
210
211 this.$rules = {
212 "start" : [
213 {
214 token : "comment",
215 regex : "\\/\\/.*$"
216 },
217 {
218 token : "comment", // multi line comment
219 regex : "\\/\\*",
220 next : "comment"
221 }, {
222 token : "string", // single line
223 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
224 }, {
225 token : "string", // single line
226 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
227 }, {
228 token : "constant.numeric",
229 regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
230 }, {
231 token : "constant.numeric", // hex6 color
232 regex : "#[a-f0-9]{6}"
233 }, {
234 token : "constant.numeric", // hex3 color
235 regex : "#[a-f0-9]{3}"
236 }, {
237 token : "constant.numeric",
238 regex : numRe
239 }, {
240 token : function(value) {
241 if (keywords.hasOwnProperty(value))
242 return "keyword";
243 else
244 return "variable";
245 },
246 regex : "@[a-z0-9_\\-@]*\\b"
247 }, {
248 token : function(value) {
249 if (properties.hasOwnProperty(value.toLowerCase()))
250 return "support.type";
251 else if (keywords.hasOwnProperty(value))
252 return "keyword";
253 else if (constants.hasOwnProperty(value))
254 return "constant.language";
255 else if (functions.hasOwnProperty(value))
256 return "support.function";
257 else if (colors.hasOwnProperty(value.toLowerCase()))
258 return "support.constant.color";
259 else if (tags.hasOwnProperty(value.toLowerCase()))
260 return "variable.language";
261 else
262 return "text";
263 },
264 regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
265 }, {
266 token: "variable.language",
267 regex: "#[a-z0-9-_]+"
268 }, {
269 token: "variable.language",
270 regex: "\\.[a-z0-9-_]+"
271 }, {
272 token: "variable.language",
273 regex: ":[a-z0-9-_]+"
274 }, {
275 token: "constant",
276 regex: "[a-z0-9-_]+"
277 }, {
278 token : "keyword.operator",
279 regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
280 }, {
281 token : "paren.lparen",
282 regex : "[[({]"
283 }, {
284 token : "paren.rparen",
285 regex : "[\\])}]"
286 }, {
287 token : "text",
288 regex : "\\s+"
289 }, {
290 caseInsensitive: true
291 }
292 ],
293 "comment" : [
294 {
295 token : "comment", // closing comment
296 regex : ".*?\\*\\/",
297 next : "start"
298 }, {
299 token : "comment", // comment spanning whole line
300 regex : ".+"
301 }
302 ]
303 };
304 };
305
306 oop.inherits(LessHighlightRules, TextHighlightRules);
307
308 exports.LessHighlightRules = LessHighlightRules;
309
310 });
311
312 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
313
314
315 var Range = require("../range").Range;
316
317 var MatchingBraceOutdent = function() {};
318
319 (function() {
320
321 this.checkOutdent = function(line, input) {
322 if (! /^\s+$/.test(line))
323 return false;
324
325 return /^\s*\}/.test(input);
326 };
327
328 this.autoOutdent = function(doc, row) {
329 var line = doc.getLine(row);
330 var match = line.match(/^(\s*\})/);
331
332 if (!match) return 0;
333
334 var column = match[1].length;
335 var openBracePos = doc.findMatchingBracket({row: row, column: column});
336
337 if (!openBracePos || openBracePos.row == row) return 0;
338
339 var indent = this.$getIndent(doc.getLine(openBracePos.row));
340 doc.replace(new Range(row, 0, row, column-1), indent);
341 };
342
343 this.$getIndent = function(line) {
344 return line.match(/^\s*/)[0];
345 };
346
347 }).call(MatchingBraceOutdent.prototype);
348
349 exports.MatchingBraceOutdent = MatchingBraceOutdent;
350 });
351
352 define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
353
354
355 var oop = require("../../lib/oop");
356 var Behaviour = require("../behaviour").Behaviour;
357 var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
358 var TokenIterator = require("../../token_iterator").TokenIterator;
359
360 var CssBehaviour = function () {
361
362 this.inherit(CstyleBehaviour);
363
364 this.add("colon", "insertion", function (state, action, editor, session, text) {
365 if (text === ':') {
366 var cursor = editor.getCursorPosition();
367 var iterator = new TokenIterator(session, cursor.row, cursor.column);
368 var token = iterator.getCurrentToken();
369 if (token && token.value.match(/\s+/)) {
370 token = iterator.stepBackward();
371 }
372 if (token && token.type === 'support.type') {
373 var line = session.doc.getLine(cursor.row);
374 var rightChar = line.substring(cursor.column, cursor.column + 1);
375 if (rightChar === ':') {
376 return {
377 text: '',
378 selection: [1, 1]
379 }
380 }
381 if (!line.substring(cursor.column).match(/^\s*;/)) {
382 return {
383 text: ':;',
384 selection: [1, 1]
385 }
386 }
387 }
388 }
389 });
390
391 this.add("colon", "deletion", function (state, action, editor, session, range) {
392 var selected = session.doc.getTextRange(range);
393 if (!range.isMultiLine() && selected === ':') {
394 var cursor = editor.getCursorPosition();
395 var iterator = new TokenIterator(session, cursor.row, cursor.column);
396 var token = iterator.getCurrentToken();
397 if (token && token.value.match(/\s+/)) {
398 token = iterator.stepBackward();
399 }
400 if (token && token.type === 'support.type') {
401 var line = session.doc.getLine(range.start.row);
402 var rightChar = line.substring(range.end.column, range.end.column + 1);
403 if (rightChar === ';') {
404 range.end.column ++;
405 return range;
406 }
407 }
408 }
409 });
410
411 this.add("semicolon", "insertion", function (state, action, editor, session, text) {
412 if (text === ';') {
413 var cursor = editor.getCursorPosition();
414 var line = session.doc.getLine(cursor.row);
415 var rightChar = line.substring(cursor.column, cursor.column + 1);
416 if (rightChar === ';') {
417 return {
418 text: '',
419 selection: [1, 1]
420 }
421 }
422 }
423 });
424
425 }
426 oop.inherits(CssBehaviour, CstyleBehaviour);
427
428 exports.CssBehaviour = CssBehaviour;
429 });
430
431 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
432
433
434 var oop = require("../../lib/oop");
435 var Behaviour = require("../behaviour").Behaviour;
436 var TokenIterator = require("../../token_iterator").TokenIterator;
437 var lang = require("../../lib/lang");
438
439 var SAFE_INSERT_IN_TOKENS =
440 ["text", "paren.rparen", "punctuation.operator"];
441 var SAFE_INSERT_BEFORE_TOKENS =
442 ["text", "paren.rparen", "punctuation.operator", "comment"];
443
444
445 var autoInsertedBrackets = 0;
446 var autoInsertedRow = -1;
447 var autoInsertedLineEnd = "";
448 var maybeInsertedBrackets = 0;
449 var maybeInsertedRow = -1;
450 var maybeInsertedLineStart = "";
451 var maybeInsertedLineEnd = "";
452
453 var CstyleBehaviour = function () {
454
455 CstyleBehaviour.isSaneInsertion = function(editor, session) {
456 var cursor = editor.getCursorPosition();
457 var iterator = new TokenIterator(session, cursor.row, cursor.column);
458 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
459 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
460 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
461 return false;
462 }
463 iterator.stepForward();
464 return iterator.getCurrentTokenRow() !== cursor.row ||
465 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
466 };
467
468 CstyleBehaviour.$matchTokenType = function(token, types) {
469 return types.indexOf(token.type || token) > -1;
470 };
471
472 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
473 var cursor = editor.getCursorPosition();
474 var line = session.doc.getLine(cursor.row);
475 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
476 autoInsertedBrackets = 0;
477 autoInsertedRow = cursor.row;
478 autoInsertedLineEnd = bracket + line.substr(cursor.column);
479 autoInsertedBrackets++;
480 };
481
482 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
483 var cursor = editor.getCursorPosition();
484 var line = session.doc.getLine(cursor.row);
485 if (!this.isMaybeInsertedClosing(cursor, line))
486 maybeInsertedBrackets = 0;
487 maybeInsertedRow = cursor.row;
488 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
489 maybeInsertedLineEnd = line.substr(cursor.column);
490 maybeInsertedBrackets++;
491 };
492
493 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
494 return autoInsertedBrackets > 0 &&
495 cursor.row === autoInsertedRow &&
496 bracket === autoInsertedLineEnd[0] &&
497 line.substr(cursor.column) === autoInsertedLineEnd;
498 };
499
500 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
501 return maybeInsertedBrackets > 0 &&
502 cursor.row === maybeInsertedRow &&
503 line.substr(cursor.column) === maybeInsertedLineEnd &&
504 line.substr(0, cursor.column) == maybeInsertedLineStart;
505 };
506
507 CstyleBehaviour.popAutoInsertedClosing = function() {
508 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
509 autoInsertedBrackets--;
510 };
511
512 CstyleBehaviour.clearMaybeInsertedClosing = function() {
513 maybeInsertedBrackets = 0;
514 maybeInsertedRow = -1;
515 };
516
517 this.add("braces", "insertion", function (state, action, editor, session, text) {
518 var cursor = editor.getCursorPosition();
519 var line = session.doc.getLine(cursor.row);
520 if (text == '{') {
521 var selection = editor.getSelectionRange();
522 var selected = session.doc.getTextRange(selection);
523 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
524 return {
525 text: '{' + selected + '}',
526 selection: false
527 };
528 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
529 if (/[\]\}\)]/.test(line[cursor.column])) {
530 CstyleBehaviour.recordAutoInsert(editor, session, "}");
531 return {
532 text: '{}',
533 selection: [1, 1]
534 };
535 } else {
536 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
537 return {
538 text: '{',
539 selection: [1, 1]
540 };
541 }
542 }
543 } else if (text == '}') {
544 var rightChar = line.substring(cursor.column, cursor.column + 1);
545 if (rightChar == '}') {
546 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
547 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
548 CstyleBehaviour.popAutoInsertedClosing();
549 return {
550 text: '',
551 selection: [1, 1]
552 };
553 }
554 }
555 } else if (text == "\n" || text == "\r\n") {
556 var closing = "";
557 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
558 closing = lang.stringRepeat("}", maybeInsertedBrackets);
559 CstyleBehaviour.clearMaybeInsertedClosing();
560 }
561 var rightChar = line.substring(cursor.column, cursor.column + 1);
562 if (rightChar == '}' || closing !== "") {
563 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
564 if (!openBracePos)
565 return null;
566
567 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
568 var next_indent = this.$getIndent(line);
569
570 return {
571 text: '\n' + indent + '\n' + next_indent + closing,
572 selection: [1, indent.length, 1, indent.length]
573 };
574 }
575 }
576 });
577
578 this.add("braces", "deletion", function (state, action, editor, session, range) {
579 var selected = session.doc.getTextRange(range);
580 if (!range.isMultiLine() && selected == '{') {
581 var line = session.doc.getLine(range.start.row);
582 var rightChar = line.substring(range.end.column, range.end.column + 1);
583 if (rightChar == '}') {
584 range.end.column++;
585 return range;
586 } else {
587 maybeInsertedBrackets--;
588 }
589 }
590 });
591
592 this.add("parens", "insertion", function (state, action, editor, session, text) {
593 if (text == '(') {
594 var selection = editor.getSelectionRange();
595 var selected = session.doc.getTextRange(selection);
596 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
597 return {
598 text: '(' + selected + ')',
599 selection: false
600 };
601 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
602 CstyleBehaviour.recordAutoInsert(editor, session, ")");
603 return {
604 text: '()',
605 selection: [1, 1]
606 };
607 }
608 } else if (text == ')') {
609 var cursor = editor.getCursorPosition();
610 var line = session.doc.getLine(cursor.row);
611 var rightChar = line.substring(cursor.column, cursor.column + 1);
612 if (rightChar == ')') {
613 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
614 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
615 CstyleBehaviour.popAutoInsertedClosing();
616 return {
617 text: '',
618 selection: [1, 1]
619 };
620 }
621 }
622 }
623 });
624
625 this.add("parens", "deletion", function (state, action, editor, session, range) {
626 var selected = session.doc.getTextRange(range);
627 if (!range.isMultiLine() && selected == '(') {
628 var line = session.doc.getLine(range.start.row);
629 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
630 if (rightChar == ')') {
631 range.end.column++;
632 return range;
633 }
634 }
635 });
636
637 this.add("brackets", "insertion", function (state, action, editor, session, text) {
638 if (text == '[') {
639 var selection = editor.getSelectionRange();
640 var selected = session.doc.getTextRange(selection);
641 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
642 return {
643 text: '[' + selected + ']',
644 selection: false
645 };
646 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
647 CstyleBehaviour.recordAutoInsert(editor, session, "]");
648 return {
649 text: '[]',
650 selection: [1, 1]
651 };
652 }
653 } else if (text == ']') {
654 var cursor = editor.getCursorPosition();
655 var line = session.doc.getLine(cursor.row);
656 var rightChar = line.substring(cursor.column, cursor.column + 1);
657 if (rightChar == ']') {
658 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
659 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
660 CstyleBehaviour.popAutoInsertedClosing();
661 return {
662 text: '',
663 selection: [1, 1]
664 };
665 }
666 }
667 }
668 });
669
670 this.add("brackets", "deletion", function (state, action, editor, session, range) {
671 var selected = session.doc.getTextRange(range);
672 if (!range.isMultiLine() && selected == '[') {
673 var line = session.doc.getLine(range.start.row);
674 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
675 if (rightChar == ']') {
676 range.end.column++;
677 return range;
678 }
679 }
680 });
681
682 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
683 if (text == '"' || text == "'") {
684 var quote = text;
685 var selection = editor.getSelectionRange();
686 var selected = session.doc.getTextRange(selection);
687 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
688 return {
689 text: quote + selected + quote,
690 selection: false
691 };
692 } else {
693 var cursor = editor.getCursorPosition();
694 var line = session.doc.getLine(cursor.row);
695 var leftChar = line.substring(cursor.column-1, cursor.column);
696 if (leftChar == '\\') {
697 return null;
698 }
699 var tokens = session.getTokens(selection.start.row);
700 var col = 0, token;
701 var quotepos = -1; // Track whether we're inside an open quote.
702
703 for (var x = 0; x < tokens.length; x++) {
704 token = tokens[x];
705 if (token.type == "string") {
706 quotepos = -1;
707 } else if (quotepos < 0) {
708 quotepos = token.value.indexOf(quote);
709 }
710 if ((token.value.length + col) > selection.start.column) {
711 break;
712 }
713 col += tokens[x].value.length;
714 }
715 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
716 if (!CstyleBehaviour.isSaneInsertion(editor, session))
717 return;
718 return {
719 text: quote + quote,
720 selection: [1,1]
721 };
722 } else if (token && token.type === "string") {
723 var rightChar = line.substring(cursor.column, cursor.column + 1);
724 if (rightChar == quote) {
725 return {
726 text: '',
727 selection: [1, 1]
728 };
729 }
730 }
731 }
732 }
733 });
734
735 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
736 var selected = session.doc.getTextRange(range);
737 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
738 var line = session.doc.getLine(range.start.row);
739 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
740 if (rightChar == selected) {
741 range.end.column++;
742 return range;
743 }
744 }
745 });
746
747 };
748
749 oop.inherits(CstyleBehaviour, Behaviour);
750
751 exports.CstyleBehaviour = CstyleBehaviour;
752 });
753
754 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
755
756
757 var oop = require("../../lib/oop");
758 var Range = require("../../range").Range;
759 var BaseFoldMode = require("./fold_mode").FoldMode;
760
761 var FoldMode = exports.FoldMode = function(commentRegex) {
762 if (commentRegex) {
763 this.foldingStartMarker = new RegExp(
764 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
765 );
766 this.foldingStopMarker = new RegExp(
767 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
768 );
769 }
770 };
771 oop.inherits(FoldMode, BaseFoldMode);
772
773 (function() {
774
775 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
776 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
777
778 this.getFoldWidgetRange = function(session, foldStyle, row) {
779 var line = session.getLine(row);
780 var match = line.match(this.foldingStartMarker);
781 if (match) {
782 var i = match.index;
783
784 if (match[1])
785 return this.openingBracketBlock(session, match[1], row, i);
786
787 return session.getCommentFoldRange(row, i + match[0].length, 1);
788 }
789
790 if (foldStyle !== "markbeginend")
791 return;
792
793 var match = line.match(this.foldingStopMarker);
794 if (match) {
795 var i = match.index + match[0].length;
796
797 if (match[1])
798 return this.closingBracketBlock(session, match[1], row, i);
799
800 return session.getCommentFoldRange(row, i, -1);
801 }
802 };
803
804 }).call(FoldMode.prototype);
805
806 });
+0
-138
try/ace/mode-lisp.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * ***** END LICENSE BLOCK ***** */
30
31 define('ace/mode/lisp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/lisp_highlight_rules'], function(require, exports, module) {
32
33
34 var oop = require("../lib/oop");
35 var TextMode = require("./text").Mode;
36 var Tokenizer = require("../tokenizer").Tokenizer;
37 var LispHighlightRules = require("./lisp_highlight_rules").LispHighlightRules;
38
39 var Mode = function() {
40 var highlighter = new LispHighlightRules();
41
42 this.$tokenizer = new Tokenizer(highlighter.getRules());
43 };
44 oop.inherits(Mode, TextMode);
45
46 (function() {
47
48 this.lineCommentStart = ";";
49
50 }).call(Mode.prototype);
51
52 exports.Mode = Mode;
53 });
54
55
56 define('ace/mode/lisp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
57
58
59 var oop = require("../lib/oop");
60 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
61
62 var LispHighlightRules = function() {
63 var keywordControl = "case|do|let|loop|if|else|when";
64 var keywordOperator = "eq|neq|and|or";
65 var constantLanguage = "null|nil";
66 var supportFunctions = "cons|car|cdr|cond|lambda|format|setq|setf|quote|eval|append|list|listp|memberp|t|load|progn";
67
68 var keywordMapper = this.createKeywordMapper({
69 "keyword.control": keywordControl,
70 "keyword.operator": keywordOperator,
71 "constant.language": constantLanguage,
72 "support.function": supportFunctions
73 }, "identifier", true);
74
75 this.$rules =
76 {
77 "start": [
78 {
79 token : "comment",
80 regex : ";.*$"
81 },
82 {
83 token: ["storage.type.function-type.lisp", "text", "entity.name.function.lisp"],
84 regex: "(?:\\b(?:(defun|defmethod|defmacro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)"
85 },
86 {
87 token: ["punctuation.definition.constant.character.lisp", "constant.character.lisp"],
88 regex: "(#)((?:\\w|[\\\\+-=<>'\"&#])+)"
89 },
90 {
91 token: ["punctuation.definition.variable.lisp", "variable.other.global.lisp", "punctuation.definition.variable.lisp"],
92 regex: "(\\*)(\\S*)(\\*)"
93 },
94 {
95 token : "constant.numeric", // hex
96 regex : "0[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
97 },
98 {
99 token : "constant.numeric", // float
100 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
101 },
102 {
103 token : keywordMapper,
104 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
105 },
106 {
107 token : "string",
108 regex : '"(?=.)',
109 next : "qqstring"
110 }
111 ],
112 "qqstring": [
113 {
114 token: "constant.character.escape.lisp",
115 regex: "\\\\."
116 },
117 {
118 token : "string",
119 regex : '[^"\\\\]+'
120 }, {
121 token : "string",
122 regex : "\\\\$",
123 next : "qqstring"
124 }, {
125 token : "string",
126 regex : '"|$',
127 next : "start"
128 }
129 ]
130 }
131
132 };
133
134 oop.inherits(LispHighlightRules, TextHighlightRules);
135
136 exports.LispHighlightRules = LispHighlightRules;
137 });
+0
-288
try/ace/mode-livescript.js less more
0 define('ace/mode/livescript', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/text'], function(require, exports, module) {
1 var identifier, LiveScriptMode, keywordend, stringfill;
2 identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
3 exports.Mode = LiveScriptMode = (function(superclass){
4 var indenter, prototype = extend$((import$(LiveScriptMode, superclass).displayName = 'LiveScriptMode', LiveScriptMode), superclass).prototype, constructor = LiveScriptMode;
5 function LiveScriptMode(){
6 var that;
7 this.$tokenizer = new (require('../tokenizer')).Tokenizer(LiveScriptMode.Rules);
8 if (that = require('../mode/matching_brace_outdent')) {
9 this.$outdent = new that.MatchingBraceOutdent;
10 }
11 }
12 indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
13 prototype.getNextLineIndent = function(state, line, tab){
14 var indent, tokens;
15 indent = this.$getIndent(line);
16 tokens = this.$tokenizer.getLineTokens(line, state).tokens;
17 if (!(tokens.length && tokens[tokens.length - 1].type === 'comment')) {
18 if (state === 'start' && indenter.test(line)) {
19 indent += tab;
20 }
21 }
22 return indent;
23 };
24 prototype.toggleCommentLines = function(state, doc, startRow, endRow){
25 var comment, range, i$, i, out, line;
26 comment = /^(\s*)#/;
27 range = new (require('../range')).Range(0, 0, 0, 0);
28 for (i$ = startRow; i$ <= endRow; ++i$) {
29 i = i$;
30 if (out = comment.test(line = doc.getLine(i))) {
31 line = line.replace(comment, '$1');
32 } else {
33 line = line.replace(/^\s*/, '$&#');
34 }
35 range.end.row = range.start.row = i;
36 range.end.column = line.length + 1;
37 doc.replace(range, line);
38 }
39 return 1 - out * 2;
40 };
41 prototype.checkOutdent = function(state, line, input){
42 var ref$;
43 return (ref$ = this.$outdent) != null ? ref$.checkOutdent(line, input) : void 8;
44 };
45 prototype.autoOutdent = function(state, doc, row){
46 var ref$;
47 return (ref$ = this.$outdent) != null ? ref$.autoOutdent(doc, row) : void 8;
48 };
49 return LiveScriptMode;
50 }(require('../mode/text').Mode));
51 keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
52 stringfill = {
53 token: 'string',
54 regex: '.+'
55 };
56 LiveScriptMode.Rules = {
57 start: [
58 {
59 token: 'keyword',
60 regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend
61 }, {
62 token: 'constant.language',
63 regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
64 }, {
65 token: 'invalid.illegal',
66 regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
67 }, {
68 token: 'language.support.class',
69 regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
70 }, {
71 token: 'language.support.function',
72 regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
73 }, {
74 token: 'variable.language',
75 regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
76 }, {
77 token: 'identifier',
78 regex: identifier + '\\s*:(?![:=])'
79 }, {
80 token: 'variable',
81 regex: identifier
82 }, {
83 token: 'keyword.operator',
84 regex: '(?:\\.{3}|\\s+\\?)'
85 }, {
86 token: 'keyword.variable',
87 regex: '(?:@+|::|\\.\\.)',
88 next: 'key'
89 }, {
90 token: 'keyword.operator',
91 regex: '\\.\\s*',
92 next: 'key'
93 }, {
94 token: 'string',
95 regex: '\\\\\\S[^\\s,;)}\\]]*'
96 }, {
97 token: 'string.doc',
98 regex: '\'\'\'',
99 next: 'qdoc'
100 }, {
101 token: 'string.doc',
102 regex: '"""',
103 next: 'qqdoc'
104 }, {
105 token: 'string',
106 regex: '\'',
107 next: 'qstring'
108 }, {
109 token: 'string',
110 regex: '"',
111 next: 'qqstring'
112 }, {
113 token: 'string',
114 regex: '`',
115 next: 'js'
116 }, {
117 token: 'string',
118 regex: '<\\[',
119 next: 'words'
120 }, {
121 token: 'string.regex',
122 regex: '//',
123 next: 'heregex'
124 }, {
125 token: 'comment.doc',
126 regex: '/\\*',
127 next: 'comment'
128 }, {
129 token: 'comment',
130 regex: '#.*'
131 }, {
132 token: 'string.regex',
133 regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
134 next: 'key'
135 }, {
136 token: 'constant.numeric',
137 regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)'
138 }, {
139 token: 'lparen',
140 regex: '[({[]'
141 }, {
142 token: 'rparen',
143 regex: '[)}\\]]',
144 next: 'key'
145 }, {
146 token: 'keyword.operator',
147 regex: '\\S+'
148 }, {
149 token: 'text',
150 regex: '\\s+'
151 }
152 ],
153 heregex: [
154 {
155 token: 'string.regex',
156 regex: '.*?//[gimy$?]{0,4}',
157 next: 'start'
158 }, {
159 token: 'string.regex',
160 regex: '\\s*#{'
161 }, {
162 token: 'comment.regex',
163 regex: '\\s+(?:#.*)?'
164 }, {
165 token: 'string.regex',
166 regex: '\\S+'
167 }
168 ],
169 key: [
170 {
171 token: 'keyword.operator',
172 regex: '[.?@!]+'
173 }, {
174 token: 'identifier',
175 regex: identifier,
176 next: 'start'
177 }, {
178 token: 'text',
179 regex: '.',
180 next: 'start'
181 }
182 ],
183 comment: [
184 {
185 token: 'comment.doc',
186 regex: '.*?\\*/',
187 next: 'start'
188 }, {
189 token: 'comment.doc',
190 regex: '.+'
191 }
192 ],
193 qdoc: [
194 {
195 token: 'string',
196 regex: ".*?'''",
197 next: 'key'
198 }, stringfill
199 ],
200 qqdoc: [
201 {
202 token: 'string',
203 regex: '.*?"""',
204 next: 'key'
205 }, stringfill
206 ],
207 qstring: [
208 {
209 token: 'string',
210 regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
211 next: 'key'
212 }, stringfill
213 ],
214 qqstring: [
215 {
216 token: 'string',
217 regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
218 next: 'key'
219 }, stringfill
220 ],
221 js: [
222 {
223 token: 'string',
224 regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
225 next: 'key'
226 }, stringfill
227 ],
228 words: [
229 {
230 token: 'string',
231 regex: '.*?\\]>',
232 next: 'key'
233 }, stringfill
234 ]
235 };
236 function extend$(sub, sup){
237 function fun(){} fun.prototype = (sub.superclass = sup).prototype;
238 (sub.prototype = new fun).constructor = sub;
239 if (typeof sup.extended == 'function') sup.extended(sub);
240 return sub;
241 }
242 function import$(obj, src){
243 var own = {}.hasOwnProperty;
244 for (var key in src) if (own.call(src, key)) obj[key] = src[key];
245 return obj;
246 }
247 });
248
249 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
250
251
252 var Range = require("../range").Range;
253
254 var MatchingBraceOutdent = function() {};
255
256 (function() {
257
258 this.checkOutdent = function(line, input) {
259 if (! /^\s+$/.test(line))
260 return false;
261
262 return /^\s*\}/.test(input);
263 };
264
265 this.autoOutdent = function(doc, row) {
266 var line = doc.getLine(row);
267 var match = line.match(/^(\s*\})/);
268
269 if (!match) return 0;
270
271 var column = match[1].length;
272 var openBracePos = doc.findMatchingBracket({row: row, column: column});
273
274 if (!openBracePos || openBracePos.row == row) return 0;
275
276 var indent = this.$getIndent(doc.getLine(openBracePos.row));
277 doc.replace(new Range(row, 0, row, column-1), indent);
278 };
279
280 this.$getIndent = function(line) {
281 return line.match(/^\s*/)[0];
282 };
283
284 }).call(MatchingBraceOutdent.prototype);
285
286 exports.MatchingBraceOutdent = MatchingBraceOutdent;
287 });
+0
-664
try/ace/mode-logiql.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/logiql', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/logiql_highlight_rules', 'ace/mode/folding/coffee', 'ace/token_iterator', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var LogiQLHighlightRules = require("./logiql_highlight_rules").LogiQLHighlightRules;
37 var FoldMode = require("./folding/coffee").FoldMode;
38 var TokenIterator = require("../token_iterator").TokenIterator;
39 var Range = require("../range").Range;
40 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
41 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
42
43 var Mode = function() {
44 var highlighter = new LogiQLHighlightRules();
45 this.foldingRules = new FoldMode();
46 this.$tokenizer = new Tokenizer(highlighter.getRules());
47 this.$outdent = new MatchingBraceOutdent();
48 this.$behaviour = new CstyleBehaviour();
49 };
50 oop.inherits(Mode, TextMode);
51
52 (function() {
53 this.lineCommentStart = "//";
54 this.blockComment = {start: "/*", end: "*/"};
55
56 this.getNextLineIndent = function(state, line, tab) {
57 var indent = this.$getIndent(line);
58
59 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
60 var tokens = tokenizedLine.tokens;
61 var endState = tokenizedLine.state;
62 if (/comment|string/.test(endState))
63 return indent;
64 if (tokens.length && tokens[tokens.length - 1].type == "comment.single")
65 return indent;
66
67 var match = line.match();
68 if (/(-->|<--|<-|->|{)\s*$/.test(line))
69 indent += tab;
70 return indent;
71 };
72
73 this.checkOutdent = function(state, line, input) {
74 if (this.$outdent.checkOutdent(line, input))
75 return true;
76
77 if (input !== "\n" && input !== "\r\n")
78 return false;
79
80 if (!/^\s+/.test(line))
81 return false;
82
83 return true;
84 };
85
86 this.autoOutdent = function(state, doc, row) {
87 if (this.$outdent.autoOutdent(doc, row))
88 return;
89 var prevLine = doc.getLine(row);
90 var match = prevLine.match(/^\s+/);
91 var column = prevLine.lastIndexOf(".") + 1;
92 if (!match || !row || !column) return 0;
93
94 var line = doc.getLine(row + 1);
95 var startRange = this.getMatching(doc, {row: row, column: column});
96 if (!startRange || startRange.start.row == row) return 0;
97
98 column = match[0].length;
99 var indent = this.$getIndent(doc.getLine(startRange.start.row));
100 doc.replace(new Range(row + 1, 0, row + 1, column), indent);
101 };
102
103 this.getMatching = function(session, row, column) {
104 if (row == undefined)
105 row = session.selection.lead
106 if (typeof row == "object") {
107 column = row.column;
108 row = row.row;
109 }
110
111 var startToken = session.getTokenAt(row, column);
112 var KW_START = "keyword.start", KW_END = "keyword.end";
113 var tok;
114 if (!startToken)
115 return;
116 if (startToken.type == KW_START) {
117 var it = new TokenIterator(session, row, column);
118 it.step = it.stepForward;
119 } else if (startToken.type == KW_END) {
120 var it = new TokenIterator(session, row, column);
121 it.step = it.stepBackward;
122 } else
123 return;
124
125 while (tok = it.step()) {
126 if (tok.type == KW_START || tok.type == KW_END)
127 break;
128 }
129 if (!tok || tok.type == startToken.type)
130 return;
131
132 var col = it.getCurrentTokenColumn();
133 var row = it.getCurrentTokenRow();
134 return new Range(row, col, row, col + tok.value.length);
135 };
136 }).call(Mode.prototype);
137
138 exports.Mode = Mode;
139 });
140
141 define('ace/mode/logiql_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
142
143
144 var oop = require("../lib/oop");
145 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
146
147 var LogiQLHighlightRules = function() {
148
149 this.$rules = { start:
150 [ { token: 'comment.block',
151 regex: '/\\*',
152 push:
153 [ { token: 'comment.block', regex: '\\*/', next: 'pop' },
154 { defaultToken: 'comment.block' } ],
155 },
156 { token: 'comment.single',
157 regex: '//.*',
158 },
159 { token: 'constant.numeric',
160 regex: '\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?',
161 },
162 { token: 'string',
163 regex: '"',
164 push:
165 [ { token: 'string', regex: '"', next: 'pop' },
166 { defaultToken: 'string' } ],
167 },
168 { token: 'constant.language',
169 regex: '\\b(true|false)\\b',
170 },
171 { token: 'entity.name.type.logicblox',
172 regex: '`[a-zA-Z_:]+(\\d|\\a)*\\b',
173 },
174 { token: 'keyword.start', regex: '->', comment: 'Constraint' },
175 { token: 'keyword.start', regex: '-->', comment: 'Level 1 Constraint'},
176 { token: 'keyword.start', regex: '<-', comment: 'Rule' },
177 { token: 'keyword.start', regex: '<--', comment: 'Level 1 Rule' },
178 { token: 'keyword.end', regex: '\\.', comment: 'Terminator' },
179 { token: 'keyword.other', regex: '!', comment: 'Negation' },
180 { token: 'keyword.other', regex: ',', comment: 'Conjunction' },
181 { token: 'keyword.other', regex: ';', comment: 'Disjunction' },
182 { token: 'keyword.operator', regex: '<=|>=|!=|<|>', comment: 'Equality'},
183 { token: 'keyword.other', regex: '@', comment: 'Equality' },
184 { token: 'keyword.operator', regex: '\\+|-|\\*|/', comment: 'Arithmetic operations'},
185 { token: 'keyword', regex: '::', comment: 'Colon colon' },
186 { token: 'support.function',
187 regex: '\\b(agg\\s*<<)',
188 push:
189 [ { include: '$self' },
190 { token: 'support.function',
191 regex: '>>',
192 next: 'pop' } ],
193 },
194 { token: 'storage.modifier',
195 regex: '\\b(lang:[\\w:]*)',
196 },
197 { token: [ 'storage.type', 'text' ],
198 regex: '(export|sealed|clauses|block|alias)(\\s*\\()(?=`)',
199 },
200 { token: 'entity.name',
201 regex: '[a-zA-Z_][a-zA-Z_0-9:]*(@prev|@init|@final)?(?=(\\(|\\[))',
202 },
203 { token: 'variable.parameter',
204 regex: '([a-zA-Z][a-zA-Z_0-9]*|_)\\s*(?=(,|\\.|<-|->|\\)|\\]|=))',
205 } ] }
206
207 this.normalizeRules();
208 };
209
210 oop.inherits(LogiQLHighlightRules, TextHighlightRules);
211
212 exports.LogiQLHighlightRules = LogiQLHighlightRules;
213 });
214
215 define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
216
217
218 var oop = require("../../lib/oop");
219 var BaseFoldMode = require("./fold_mode").FoldMode;
220 var Range = require("../../range").Range;
221
222 var FoldMode = exports.FoldMode = function() {};
223 oop.inherits(FoldMode, BaseFoldMode);
224
225 (function() {
226
227 this.getFoldWidgetRange = function(session, foldStyle, row) {
228 var range = this.indentationBlock(session, row);
229 if (range)
230 return range;
231
232 var re = /\S/;
233 var line = session.getLine(row);
234 var startLevel = line.search(re);
235 if (startLevel == -1 || line[startLevel] != "#")
236 return;
237
238 var startColumn = line.length;
239 var maxRow = session.getLength();
240 var startRow = row;
241 var endRow = row;
242
243 while (++row < maxRow) {
244 line = session.getLine(row);
245 var level = line.search(re);
246
247 if (level == -1)
248 continue;
249
250 if (line[level] != "#")
251 break;
252
253 endRow = row;
254 }
255
256 if (endRow > startRow) {
257 var endColumn = session.getLine(endRow).length;
258 return new Range(startRow, startColumn, endRow, endColumn);
259 }
260 };
261 this.getFoldWidget = function(session, foldStyle, row) {
262 var line = session.getLine(row);
263 var indent = line.search(/\S/);
264 var next = session.getLine(row + 1);
265 var prev = session.getLine(row - 1);
266 var prevIndent = prev.search(/\S/);
267 var nextIndent = next.search(/\S/);
268
269 if (indent == -1) {
270 session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
271 return "";
272 }
273 if (prevIndent == -1) {
274 if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
275 session.foldWidgets[row - 1] = "";
276 session.foldWidgets[row + 1] = "";
277 return "start";
278 }
279 } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
280 if (session.getLine(row - 2).search(/\S/) == -1) {
281 session.foldWidgets[row - 1] = "start";
282 session.foldWidgets[row + 1] = "";
283 return "";
284 }
285 }
286
287 if (prevIndent!= -1 && prevIndent < indent)
288 session.foldWidgets[row - 1] = "start";
289 else
290 session.foldWidgets[row - 1] = "";
291
292 if (indent < nextIndent)
293 return "start";
294 else
295 return "";
296 };
297
298 }).call(FoldMode.prototype);
299
300 });
301
302 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
303
304
305 var oop = require("../../lib/oop");
306 var Behaviour = require("../behaviour").Behaviour;
307 var TokenIterator = require("../../token_iterator").TokenIterator;
308 var lang = require("../../lib/lang");
309
310 var SAFE_INSERT_IN_TOKENS =
311 ["text", "paren.rparen", "punctuation.operator"];
312 var SAFE_INSERT_BEFORE_TOKENS =
313 ["text", "paren.rparen", "punctuation.operator", "comment"];
314
315
316 var autoInsertedBrackets = 0;
317 var autoInsertedRow = -1;
318 var autoInsertedLineEnd = "";
319 var maybeInsertedBrackets = 0;
320 var maybeInsertedRow = -1;
321 var maybeInsertedLineStart = "";
322 var maybeInsertedLineEnd = "";
323
324 var CstyleBehaviour = function () {
325
326 CstyleBehaviour.isSaneInsertion = function(editor, session) {
327 var cursor = editor.getCursorPosition();
328 var iterator = new TokenIterator(session, cursor.row, cursor.column);
329 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
330 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
331 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
332 return false;
333 }
334 iterator.stepForward();
335 return iterator.getCurrentTokenRow() !== cursor.row ||
336 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
337 };
338
339 CstyleBehaviour.$matchTokenType = function(token, types) {
340 return types.indexOf(token.type || token) > -1;
341 };
342
343 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
344 var cursor = editor.getCursorPosition();
345 var line = session.doc.getLine(cursor.row);
346 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
347 autoInsertedBrackets = 0;
348 autoInsertedRow = cursor.row;
349 autoInsertedLineEnd = bracket + line.substr(cursor.column);
350 autoInsertedBrackets++;
351 };
352
353 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
354 var cursor = editor.getCursorPosition();
355 var line = session.doc.getLine(cursor.row);
356 if (!this.isMaybeInsertedClosing(cursor, line))
357 maybeInsertedBrackets = 0;
358 maybeInsertedRow = cursor.row;
359 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
360 maybeInsertedLineEnd = line.substr(cursor.column);
361 maybeInsertedBrackets++;
362 };
363
364 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
365 return autoInsertedBrackets > 0 &&
366 cursor.row === autoInsertedRow &&
367 bracket === autoInsertedLineEnd[0] &&
368 line.substr(cursor.column) === autoInsertedLineEnd;
369 };
370
371 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
372 return maybeInsertedBrackets > 0 &&
373 cursor.row === maybeInsertedRow &&
374 line.substr(cursor.column) === maybeInsertedLineEnd &&
375 line.substr(0, cursor.column) == maybeInsertedLineStart;
376 };
377
378 CstyleBehaviour.popAutoInsertedClosing = function() {
379 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
380 autoInsertedBrackets--;
381 };
382
383 CstyleBehaviour.clearMaybeInsertedClosing = function() {
384 maybeInsertedBrackets = 0;
385 maybeInsertedRow = -1;
386 };
387
388 this.add("braces", "insertion", function (state, action, editor, session, text) {
389 var cursor = editor.getCursorPosition();
390 var line = session.doc.getLine(cursor.row);
391 if (text == '{') {
392 var selection = editor.getSelectionRange();
393 var selected = session.doc.getTextRange(selection);
394 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
395 return {
396 text: '{' + selected + '}',
397 selection: false
398 };
399 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
400 if (/[\]\}\)]/.test(line[cursor.column])) {
401 CstyleBehaviour.recordAutoInsert(editor, session, "}");
402 return {
403 text: '{}',
404 selection: [1, 1]
405 };
406 } else {
407 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
408 return {
409 text: '{',
410 selection: [1, 1]
411 };
412 }
413 }
414 } else if (text == '}') {
415 var rightChar = line.substring(cursor.column, cursor.column + 1);
416 if (rightChar == '}') {
417 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
418 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
419 CstyleBehaviour.popAutoInsertedClosing();
420 return {
421 text: '',
422 selection: [1, 1]
423 };
424 }
425 }
426 } else if (text == "\n" || text == "\r\n") {
427 var closing = "";
428 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
429 closing = lang.stringRepeat("}", maybeInsertedBrackets);
430 CstyleBehaviour.clearMaybeInsertedClosing();
431 }
432 var rightChar = line.substring(cursor.column, cursor.column + 1);
433 if (rightChar == '}' || closing !== "") {
434 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
435 if (!openBracePos)
436 return null;
437
438 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
439 var next_indent = this.$getIndent(line);
440
441 return {
442 text: '\n' + indent + '\n' + next_indent + closing,
443 selection: [1, indent.length, 1, indent.length]
444 };
445 }
446 }
447 });
448
449 this.add("braces", "deletion", function (state, action, editor, session, range) {
450 var selected = session.doc.getTextRange(range);
451 if (!range.isMultiLine() && selected == '{') {
452 var line = session.doc.getLine(range.start.row);
453 var rightChar = line.substring(range.end.column, range.end.column + 1);
454 if (rightChar == '}') {
455 range.end.column++;
456 return range;
457 } else {
458 maybeInsertedBrackets--;
459 }
460 }
461 });
462
463 this.add("parens", "insertion", function (state, action, editor, session, text) {
464 if (text == '(') {
465 var selection = editor.getSelectionRange();
466 var selected = session.doc.getTextRange(selection);
467 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
468 return {
469 text: '(' + selected + ')',
470 selection: false
471 };
472 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
473 CstyleBehaviour.recordAutoInsert(editor, session, ")");
474 return {
475 text: '()',
476 selection: [1, 1]
477 };
478 }
479 } else if (text == ')') {
480 var cursor = editor.getCursorPosition();
481 var line = session.doc.getLine(cursor.row);
482 var rightChar = line.substring(cursor.column, cursor.column + 1);
483 if (rightChar == ')') {
484 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
485 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
486 CstyleBehaviour.popAutoInsertedClosing();
487 return {
488 text: '',
489 selection: [1, 1]
490 };
491 }
492 }
493 }
494 });
495
496 this.add("parens", "deletion", function (state, action, editor, session, range) {
497 var selected = session.doc.getTextRange(range);
498 if (!range.isMultiLine() && selected == '(') {
499 var line = session.doc.getLine(range.start.row);
500 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
501 if (rightChar == ')') {
502 range.end.column++;
503 return range;
504 }
505 }
506 });
507
508 this.add("brackets", "insertion", function (state, action, editor, session, text) {
509 if (text == '[') {
510 var selection = editor.getSelectionRange();
511 var selected = session.doc.getTextRange(selection);
512 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
513 return {
514 text: '[' + selected + ']',
515 selection: false
516 };
517 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
518 CstyleBehaviour.recordAutoInsert(editor, session, "]");
519 return {
520 text: '[]',
521 selection: [1, 1]
522 };
523 }
524 } else if (text == ']') {
525 var cursor = editor.getCursorPosition();
526 var line = session.doc.getLine(cursor.row);
527 var rightChar = line.substring(cursor.column, cursor.column + 1);
528 if (rightChar == ']') {
529 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
530 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
531 CstyleBehaviour.popAutoInsertedClosing();
532 return {
533 text: '',
534 selection: [1, 1]
535 };
536 }
537 }
538 }
539 });
540
541 this.add("brackets", "deletion", function (state, action, editor, session, range) {
542 var selected = session.doc.getTextRange(range);
543 if (!range.isMultiLine() && selected == '[') {
544 var line = session.doc.getLine(range.start.row);
545 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
546 if (rightChar == ']') {
547 range.end.column++;
548 return range;
549 }
550 }
551 });
552
553 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
554 if (text == '"' || text == "'") {
555 var quote = text;
556 var selection = editor.getSelectionRange();
557 var selected = session.doc.getTextRange(selection);
558 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
559 return {
560 text: quote + selected + quote,
561 selection: false
562 };
563 } else {
564 var cursor = editor.getCursorPosition();
565 var line = session.doc.getLine(cursor.row);
566 var leftChar = line.substring(cursor.column-1, cursor.column);
567 if (leftChar == '\\') {
568 return null;
569 }
570 var tokens = session.getTokens(selection.start.row);
571 var col = 0, token;
572 var quotepos = -1; // Track whether we're inside an open quote.
573
574 for (var x = 0; x < tokens.length; x++) {
575 token = tokens[x];
576 if (token.type == "string") {
577 quotepos = -1;
578 } else if (quotepos < 0) {
579 quotepos = token.value.indexOf(quote);
580 }
581 if ((token.value.length + col) > selection.start.column) {
582 break;
583 }
584 col += tokens[x].value.length;
585 }
586 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
587 if (!CstyleBehaviour.isSaneInsertion(editor, session))
588 return;
589 return {
590 text: quote + quote,
591 selection: [1,1]
592 };
593 } else if (token && token.type === "string") {
594 var rightChar = line.substring(cursor.column, cursor.column + 1);
595 if (rightChar == quote) {
596 return {
597 text: '',
598 selection: [1, 1]
599 };
600 }
601 }
602 }
603 }
604 });
605
606 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
607 var selected = session.doc.getTextRange(range);
608 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
609 var line = session.doc.getLine(range.start.row);
610 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
611 if (rightChar == selected) {
612 range.end.column++;
613 return range;
614 }
615 }
616 });
617
618 };
619
620 oop.inherits(CstyleBehaviour, Behaviour);
621
622 exports.CstyleBehaviour = CstyleBehaviour;
623 });
624
625 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
626
627
628 var Range = require("../range").Range;
629
630 var MatchingBraceOutdent = function() {};
631
632 (function() {
633
634 this.checkOutdent = function(line, input) {
635 if (! /^\s+$/.test(line))
636 return false;
637
638 return /^\s*\}/.test(input);
639 };
640
641 this.autoOutdent = function(doc, row) {
642 var line = doc.getLine(row);
643 var match = line.match(/^(\s*\})/);
644
645 if (!match) return 0;
646
647 var column = match[1].length;
648 var openBracePos = doc.findMatchingBracket({row: row, column: column});
649
650 if (!openBracePos || openBracePos.row == row) return 0;
651
652 var indent = this.$getIndent(doc.getLine(openBracePos.row));
653 doc.replace(new Range(row, 0, row, column-1), indent);
654 };
655
656 this.$getIndent = function(line) {
657 return line.match(/^\s*/)[0];
658 };
659
660 }).call(MatchingBraceOutdent.prototype);
661
662 exports.MatchingBraceOutdent = MatchingBraceOutdent;
663 });
+0
-832
try/ace/mode-lsl.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2013, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/lsl', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/lsl_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/text', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle', 'ace/lib/oop'], function(require, exports, module) {
31
32
33 var Tokenizer = require("../tokenizer").Tokenizer;
34 var Rules = require("./lsl_highlight_rules").LSLHighlightRules;
35 var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
36 var Range = require("../range").Range;
37 var TextMode = require("./text").Mode;
38 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
39 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
40 var oop = require("../lib/oop");
41
42 var Mode = function() {
43 this.$tokenizer = new Tokenizer(new Rules().getRules());
44 this.$outdent = new Outdent();
45 this.$behaviour = new CstyleBehaviour();
46 this.foldingRules = new CStyleFoldMode();
47 };
48 oop.inherits(Mode, TextMode);
49
50 (function() {
51
52 this.lineCommentStart = ["//"];
53
54 this.blockComment = {
55 start: "/*",
56 end: "*/"
57 };
58
59 this.getNextLineIndent = function(state, line, tab) {
60 var indent = this.$getIndent(line);
61
62 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
63 var tokens = tokenizedLine.tokens;
64 var endState = tokenizedLine.state;
65
66 if (tokens.length && tokens[tokens.length-1].type === "comment.block.lsl") {
67 return indent;
68 }
69
70 if (state === "start") {
71 var match = line.match(/^.*[\{\(\[]\s*$/);
72 if (match) {
73 indent += tab;
74 }
75 }
76
77 return indent;
78 };
79
80 this.checkOutdent = function(state, line, input) {
81 return this.$outdent.checkOutdent(line, input);
82 };
83
84 this.autoOutdent = function(state, doc, row) {
85 this.$outdent.autoOutdent(doc, row);
86 };
87
88 }).call(Mode.prototype);
89
90 exports.Mode = Mode;
91 });
92
93 define('ace/mode/lsl_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
94
95
96 var oop = require("../lib/oop");
97 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
98
99 oop.inherits(LSLHighlightRules, TextHighlightRules);
100
101 function LSLHighlightRules() {
102 var keywordMapper = this.createKeywordMapper({
103 "constant.language.float.lsl" : "DEG_TO_RAD|PI|PI_BY_TWO|RAD_TO_DEG|SQRT2|TWO_PI",
104 "constant.language.integer.lsl": "ACTIVE|ALWAYS_RUN|AGENT_ATTACHMENTS|AGENT_AUTOPILOT|" +
105 "AGENT_AWAY|AGENT_BUSY|AGENT_BY_LEGACY_NAME|AGENT_BY_USERNAME|AGENT_CROUCHING|" +
106 "AGENT_FLYING|AGENT_IN_AIR|AGENT_LIST_PARCEL|AGENT_LIST_PARCEL_OWNER|" +
107 "AGENT_LIST_REGION|AGENT_MOUSELOOK|AGENT_ON_OBJECT|AGENT_SCRIPTED|AGENT_SITTING|" +
108 "AGENT_TYPING|AGENT_WALKING|ALL_SIDES|ANIM_ON|ATTACH_AVATAR_CENTER|ATTACH_BACK|ATTACH_BELLY|" +
109 "ATTACH_CHEST|ATTACH_CHIN|ATTACH_HEAD|ATTACH_HUD_BOTTOM|ATTACH_HUD_BOTTOM_LEFT|" +
110 "ATTACH_HUD_BOTTOM_RIGHT|ATTACH_HUD_CENTER_1|ATTACH_HUD_CENTER_2|ATTACH_HUD_TOP_CENTER|" +
111 "ATTACH_HUD_TOP_LEFT|ATTACH_HUD_TOP_RIGHT|ATTACH_LEAR|ATTACH_LEFT_PEC|" +
112 "ATTACH_LEYE|ATTACH_LFOOT|ATTACH_LHAND|ATTACH_LHIP|ATTACH_LLARM|ATTACH_LLLEG|" +
113 "ATTACH_LSHOULDER|ATTACH_LUARM|ATTACH_LULEG|ATTACH_MOUTH|ATTACH_NECK|ATTACH_NOSE|" +
114 "ATTACH_PELVIS|ATTACH_REAR|ATTACH_REYE|ATTACH_RFOOT|ATTACH_RHAND|ATTACH_RHIP|" +
115 "ATTACH_RIGHT_PEC|ATTACH_RLARM|ATTACH_RLLEG|ATTACH_RSHOULDER|ATTACH_RUARM|" +
116 "ATTACH_RULEG|AVOID_CHARACTERS|AVOID_DYNAMIC_OBSTACLES|AVOID_NONE|CAMERA_ACTIVE|" +
117 "CAMERA_BEHINDNESS_ANGLE|CAMERA_BEHINDNESS_LAG|CAMERA_DISTANCE|CAMERA_FOCUS|" +
118 "CAMERA_FOCUS_LAG|CAMERA_FOCUS_LOCKED|CAMERA_FOCUS_OFFSET|CAMERA_FOCUS_THRESHOLD|" +
119 "CAMERA_PITCH|CAMERA_POSITION|CAMERA_POSITION_LAG|CAMERA_POSITION_LOCKED|" +
120 "CAMERA_POSITION_THRESHOLD|CHANGED_ALLOWED_DROP|CHANGED_COLOR|CHANGED_INVENTORY|" +
121 "CHANGED_LINK|CHANGED_MEDIA|CHANGED_OWNER|CHANGED_REGION|CHANGED_REGION_START|" +
122 "CHANGED_SCALE|CHANGED_SHAPE|CHANGED_TELEPORT|CHANGED_TEXTURE|CHARACTER_ACCOUNT_FOR_SKIPPED_FRAMES|" +
123 "CHARACTER_AVOIDANCE_MODE|CHARACTER_CMD_JUMP|CHARACTER_CMD_SMOOTH_STOP|" +
124 "CHARACTER_CMD_STOP|CHARACTER_DESIRED_SPEED|CHARACTER_DESIRED_TURN_SPEED|" +
125 "CHARACTER_LENGTH|CHARACTER_MAX_ACCEL|" +
126 "CHARACTER_MAX_DECEL|CHARACTER_MAX_SPEED|CHARACTER_MAX_TURN_RADIUS|CHARACTER_ORIENTATION|" +
127 "CHARACTER_RADIUS|CHARACTER_TYPE|CHARACTER_TYPE_A|CHARACTER_TYPE_B|CHARACTER_TYPE_C|" +
128 "CHARACTER_TYPE_D|CHARACTER_TYPE_NONE|CLICK_ACTION_BUY|CLICK_ACTION_NONE|" +
129 "CLICK_ACTION_OPEN|CLICK_ACTION_OPEN_MEDIA|CLICK_ACTION_PAY|CLICK_ACTION_PLAY|" +
130 "CLICK_ACTION_SIT|CLICK_ACTION_TOUCH|CONTENT_TYPE_ATOM|CONTENT_TYPE_FORM|" +
131 "CONTENT_TYPE_HTML|CONTENT_TYPE_JSON|CONTENT_TYPE_LLSD|CONTENT_TYPE_RSS|" +
132 "CONTENT_TYPE_TEXT|CONTENT_TYPE_XHTML|CONTENT_TYPE_XML|" +
133 "CONTROL_BACK|CONTROL_DOWN|CONTROL_FWD|CONTROL_LBUTTON|CONTROL_LEFT|CONTROL_ML_LBUTTON|" +
134 "CONTROL_RIGHT|CONTROL_ROT_LEFT|CONTROL_ROT_RIGHT|CONTROL_UP|DATA_BORN|" +
135 "DATA_NAME|DATA_ONLINE|DATA_PAYINFO|DATA_SIM_POS|DATA_SIM_RATING|DATA_SIM_STATUS|" +
136 "DENSITY|DEBUG_CHANNEL|ESTATE_ACCESS_ALLOWED_AGENT_ADD|ESTATE_ACCESS_ALLOWED_AGENT_REMOVE|" +
137 "ESTATE_ACCESS_ALLOWED_GROUP_ADD|ESTATE_ACCESS_ALLOWED_GROUP_REMOVE|" +
138 "ESTATE_ACCESS_BANNED_AGENT_ADD|ESTATE_ACCESS_BANNED_AGENT_REMOVE|" +
139 "FORCE_DIRECT_PATH|FRICTION|GCNP_RADIUS|GCNP_STATIC|GRAVITY_MULTIPLIER|" +
140 "HORIZONTAL|HTTP_BODY_MAXLENGTH|HTTP_BODY_TRUNCATED|HTTP_CUSTOM_HEADER|" +
141 "HTTP_METHOD|HTTP_MIMETYPE|HTTP_PRAGMA_NO_CACHE|HTTP_VERBOSE_THROTTLE|" +
142 "HTTP_VERIFY_CERT|INVENTORY_ALL|INVENTORY_ANIMATION|INVENTORY_BODYPART|" +
143 "INVENTORY_CLOTHING|INVENTORY_GESTURE|INVENTORY_LANDMARK|INVENTORY_NONE|" +
144 "INVENTORY_NOTECARD|INVENTORY_OBJECT|INVENTORY_SCRIPT|INVENTORY_SOUND|" +
145 "INVENTORY_TEXTURE|JSON_APPEND|KFM_CMD_PAUSE|KFM_CMD_PLAY|" +
146 "KFM_CMD_SET_MODE|KFM_CMD_STOP|KFM_COMMAND|KFM_DATA|" +
147 "KFM_FORWARD|KFM_LOOP|KFM_MODE|KFM_PING_PONG|KFM_REVERSE|KFM_ROTATION|" +
148 "KFM_TRANSLATION|LAND_LEVEL|LAND_LOWER|LAND_NOISE|LAND_RAISE|LAND_REVERT|" +
149 "LAND_SMOOTH|LINK_ALL_CHILDREN|LINK_ALL_OTHERS|LINK_ROOT|LINK_SET|LINK_THIS|" +
150 "LIST_STAT_GEOMETRIC_MEAN|LIST_STAT_MAX|LIST_STAT_MEAN|LIST_STAT_MEDIAN|" +
151 "LIST_STAT_MIN|LIST_STAT_NUM_COUNT|LIST_STAT_RANGE|LIST_STAT_STD_DEV|LIST_STAT_SUM|" +
152 "LIST_STAT_SUM_SQUARES|LOOP|MASK_BASE|MASK_EVERYONE|MASK_GROUP|MASK_NEXT|" +
153 "MASK_OWNER|OBJECT_ATTACHED_POINT|OBJECT_CREATOR|OBJECT_DESC|" +
154 "OBJECT_GROUP|OBJECT_NAME|OBJECT_OWNER|OBJECT_PATHFINDING_TYPE|OBJECT_PHYSICS_COST|" +
155 "OBJECT_POS|OBJECT_PRIM_EQUIVALENCE|OBJECT_ROOT|OBJECT_ROT|OBJECT_RUNNING_SCRIPT_COUNT|" +
156 "OBJECT_SCRIPT_MEMORY|OBJECT_SCRIPT_TIME|OBJECT_SERVER_COST|OBJECT_STREAMING_COST|" +
157 "OBJECT_TOTAL_SCRIPT_COUNT|OBJECT_UNKNOWN_DETAIL|OBJECT_VELOCITY|OPT_AVATAR|" +
158 "OPT_CHARACTER|OPT_EXCLUSION_VOLUME|OPT_LEGACY_LINKSET|OPT_MATERIAL_VOLUME|" +
159 "OPT_OTHER|OPT_STATIC_OBSTACLE|OPT_WALKABLE|PARCEL_COUNT_GROUP|PARCEL_COUNT_OTHER|" +
160 "PARCEL_COUNT_OWNER|PARCEL_COUNT_SELECTED|PARCEL_COUNT_TEMP|PARCEL_COUNT_TOTAL|" +
161 "PARCEL_DETAILS_AREA|PARCEL_DETAILS_DESC|PARCEL_DETAILS_GROUP|PARCEL_DETAILS_ID|" +
162 "PARCEL_DETAILS_NAME|PARCEL_DETAILS_OWNER|PARCEL_DETAILS_SEE_AVATARS|" +
163 "PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY|PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS|" +
164 "PARCEL_FLAG_ALLOW_CREATE_OBJECTS|PARCEL_FLAG_ALLOW_DAMAGE|PARCEL_FLAG_ALLOW_FLY|" +
165 "PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY|PARCEL_FLAG_ALLOW_GROUP_SCRIPTS|" +
166 "PARCEL_FLAG_ALLOW_LANDMARK|PARCEL_FLAG_ALLOW_SCRIPTS|PARCEL_FLAG_ALLOW_TERRAFORM|" +
167 "PARCEL_FLAG_LOCAL_SOUND_ONLY|PARCEL_FLAG_RESTRICT_PUSHOBJECT|PARCEL_FLAG_USE_ACCESS_GROUP|" +
168 "PARCEL_FLAG_USE_ACCESS_LIST|PARCEL_FLAG_USE_BAN_LIST|PARCEL_FLAG_USE_LAND_PASS_LIST|" +
169 "PARCEL_MEDIA_COMMAND_AGENT|PARCEL_MEDIA_COMMAND_AUTO_ALIGN|PARCEL_MEDIA_COMMAND_DESC|" +
170 "PARCEL_MEDIA_COMMAND_LOOP|PARCEL_MEDIA_COMMAND_LOOP_SET|PARCEL_MEDIA_COMMAND_PAUSE|" +
171 "PARCEL_MEDIA_COMMAND_PLAY|PARCEL_MEDIA_COMMAND_SIZE|PARCEL_MEDIA_COMMAND_STOP|" +
172 "PARCEL_MEDIA_COMMAND_TEXTURE|PARCEL_MEDIA_COMMAND_TIME|PARCEL_MEDIA_COMMAND_TYPE|" +
173 "PARCEL_MEDIA_COMMAND_UNLOAD|PARCEL_MEDIA_COMMAND_URL|PASSIVE|PATROL_PAUSE_AT_WAYPOINTS|" +
174 "PAYMENT_INFO_ON_FILE|PAYMENT_INFO_USED|PAY_DEFAULT|PAY_HIDE|PERMISSION_ATTACH|" +
175 "PERMISSION_CHANGE_LINKS|PERMISSION_CONTROL_CAMERA|PERMISSION_DEBIT|PERMISSION_OVERRIDE_ANIMATIONS|" +
176 "PERMISSION_SILENT_ESTATE_MANAGEMENT|PERMISSION_TAKE_CONTROLS|PERMISSION_TELEPORT|" +
177 "PERMISSION_TRACK_CAMERA|PERMISSION_TRIGGER_ANIMATION|PERM_ALL|PERM_COPY|PERM_MODIFY|" +
178 "PERM_MOVE|PERM_TRANSFER|PING_PONG|PRIM_BUMP_BARK|PRIM_BUMP_BLOBS|PRIM_BUMP_BRICKS|" +
179 "PRIM_BUMP_BRIGHT|PRIM_BUMP_CHECKER|PRIM_BUMP_CONCRETE|PRIM_BUMP_DARK|PRIM_BUMP_DISKS|" +
180 "PRIM_BUMP_GRAVEL|PRIM_BUMP_LARGETILE|PRIM_BUMP_NONE|PRIM_BUMP_SHINY|PRIM_BUMP_SIDING|" +
181 "PRIM_BUMP_STONE|PRIM_BUMP_STUCCO|PRIM_BUMP_SUCTION|PRIM_BUMP_TILE|PRIM_BUMP_WEAVE|" +
182 "PRIM_BUMP_WOOD|PRIM_COLOR|PRIM_DESC|PRIM_FLEXIBLE|PRIM_FULLBRIGHT|PRIM_GLOW|" +
183 "PRIM_HOLE_CIRCLE|PRIM_HOLE_DEFAULT|PRIM_HOLE_SQUARE|PRIM_HOLE_TRIANGLE|PRIM_LINK_TARGET|" +
184 "PRIM_MATERIAL|PRIM_MATERIAL_FLESH|PRIM_MATERIAL_GLASS|PRIM_MATERIAL_LIGHT|" +
185 "PRIM_MATERIAL_METAL|PRIM_MATERIAL_PLASTIC|PRIM_MATERIAL_RUBBER|PRIM_MATERIAL_STONE|" +
186 "PRIM_MATERIAL_WOOD|PRIM_MEDIA_ALT_IMAGE_ENABLE|PRIM_MEDIA_AUTO_LOOP|PRIM_MEDIA_AUTO_PLAY|" +
187 "PRIM_MEDIA_AUTO_SCALE|PRIM_MEDIA_AUTO_ZOOM|PRIM_MEDIA_CONTROLS|PRIM_MEDIA_CONTROLS_STANDARD|" +
188 "PRIM_MEDIA_CONTROLS_MINI|PRIM_MEDIA_CURRENT_URL|PRIM_MEDIA_FIRST_CLICK_INTERACT|" +
189 "PRIM_MEDIA_HEIGHT_PIXELS|PRIM_MEDIA_HOME_URL|PRIM_MEDIA_MAX_HEIGHT_PIXELS|" +
190 "PRIM_MEDIA_MAX_URL_LENGTH|PRIM_MEDIA_MAX_WHITELIST_COUNT|PRIM_MEDIA_MAX_WHITELIST_SIZE|" +
191 "PRIM_MEDIA_MAX_WIDTH_PIXELS|PRIM_MEDIA_PARAM_MAX|PRIM_MEDIA_PERM_ANYONE|PRIM_MEDIA_PERM_GROUP|" +
192 "PRIM_MEDIA_PERM_NONE|PRIM_MEDIA_PERM_OWNER|PRIM_MEDIA_PERMS_CONTROL|PRIM_MEDIA_PERMS_INTERACT|" +
193 "PRIM_MEDIA_WIDTH_PIXELS|PRIM_MEDIA_WHITELIST|PRIM_MEDIA_WHITELIST_ENABLE|" +
194 "PRIM_NAME|PRIM_OMEGA|PRIM_PHANTOM|PRIM_PHYSICS|PRIM_PHYSICS_SHAPE_CONVEX|" +
195 "PRIM_PHYSICS_SHAPE_NONE|PRIM_PHYSICS_SHAPE_PRIM|PRIM_PHYSICS_SHAPE_TYPE|" +
196 "PRIM_POINT_LIGHT|PRIM_POSITION|PRIM_POS_LOCAL|PRIM_ROTATION|PRIM_ROT_LOCAL|" +
197 "PRIM_SCULPT_FLAG_INVERT|PRIM_SCULPT_FLAG_MIRROR|PRIM_SCULPT_TYPE_CYLINDER|" +
198 "PRIM_SCULPT_TYPE_MASK|PRIM_SCULPT_TYPE_PLANE|PRIM_SCULPT_TYPE_SPHERE|PRIM_SCULPT_TYPE_TORUS|" +
199 "PRIM_SHINY_HIGH|PRIM_SHINY_LOW|PRIM_SHINY_MEDIUM|PRIM_SHINY_NONE|PRIM_SIZE|" +
200 "PRIM_SLICE|PRIM_TEMP_ON_REZ|PRIM_TEXGEN|PRIM_TEXGEN_DEFAULT|PRIM_TEXGEN_PLANAR|" +
201 "PRIM_TEXT|PRIM_TEXTURE|PRIM_TYPE|PRIM_TYPE_BOX|PRIM_TYPE_CYLINDER|PRIM_TYPE_PRISM|PRIM_TYPE_RING|" +
202 "PRIM_TYPE_SCULPT|PRIM_TYPE_SPHERE|PRIM_TYPE_TORUS|PRIM_TYPE_TUBE|PROFILE_NONE|" +
203 "PROFILE_SCRIPT_MEMORY|PSYS_PART_BOUNCE_MASK|PSYS_PART_EMISSIVE_MASK|PSYS_PART_END_ALPHA|" +
204 "PSYS_PART_END_COLOR|PSYS_PART_END_SCALE|PSYS_PART_FLAGS|PSYS_PART_FOLLOW_SRC_MASK|" +
205 "PSYS_PART_FOLLOW_VELOCITY_MASK|PSYS_PART_INTERP_COLOR_MASK|PSYS_PART_INTERP_SCALE_MASK|" +
206 "PSYS_PART_MAX_AGE|PSYS_PART_START_ALPHA|PSYS_PART_START_COLOR|PSYS_PART_START_SCALE|" +
207 "PSYS_PART_TARGET_LINEAR_MASK|PSYS_PART_TARGET_POS_MASK|PSYS_PART_WIND_MASK|" +
208 "PSYS_SRC_ACCEL|PSYS_SRC_ANGLE_BEGIN|PSYS_SRC_ANGLE_END|PSYS_SRC_BURST_PART_COUNT|" +
209 "PSYS_SRC_BURST_RADIUS|PSYS_SRC_BURST_RATE|PSYS_SRC_BURST_SPEED_MAX|PSYS_SRC_BURST_SPEED_MIN|" +
210 "PSYS_SRC_MAX_AGE|PSYS_SRC_OMEGA|PSYS_SRC_PATTERN|PSYS_SRC_PATTERN_ANGLE|" +
211 "PSYS_SRC_PATTERN_ANGLE_CONE|PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY|PSYS_SRC_PATTERN_DROP|" +
212 "PSYS_SRC_PATTERN_EXPLODE|PSYS_SRC_TARGET_KEY|PSYS_SRC_TEXTURE|PUBLIC_CHANNEL|" +
213 "PURSUIT_FUZZ_FACTOR|PURSUIT_GOAL_TOLERANCE|PURSUIT_INTERCEPT|PURSUIT_OFFSET|" +
214 "PU_EVADE_HIDDEN|PU_EVADE_SPOTTED|PU_FAILURE_DYNAMIC_PATHFINDING_DISABLED|" +
215 "PU_FAILURE_INVALID_GOAL|PU_FAILURE_INVALID_START|PU_FAILURE_NO_NAVMESH|" +
216 "PU_FAILURE_NO_VALID_DESTINATION|PU_FAILURE_OTHER|PU_FAILURE_PARCEL_UNREACHABLE|" +
217 "PU_FAILURE_TARGET_GONE|PU_FAILURE_UNREACHABLE|PU_GOAL_REACHED|PU_SLOWDOWN_DISTANCE_REACHED|" +
218 "RC_DATA_FLAGS|RC_DETECT_PHANTOM|RC_GET_LINK_NUM|RC_GET_NORMAL|RC_GET_ROOT_KEY|" +
219 "RC_MAX_HITS|RC_REJECT_AGENTS|RC_REJECT_LAND|RC_REJECT_NONPHYSICAL|RC_REJECT_PHYSICAL|" +
220 "RC_REJECT_TYPES|RCERR_CAST_TIME_EXCEEDED|RCERR_SIM_PERF_LOW|RCERR_UNKNOWN|" +
221 "REGION_FLAG_ALLOW_DAMAGE|REGION_FLAG_ALLOW_DIRECT_TELEPORT|REGION_FLAG_BLOCK_FLY|" +
222 "REGION_FLAG_BLOCK_TERRAFORM|REGION_FLAG_DISABLE_COLLISIONS|REGION_FLAG_DISABLE_PHYSICS|" +
223 "REGION_FLAG_FIXED_SUN|REGION_FLAG_RESTRICT_PUSHOBJECT|REGION_FLAG_SANDBOX|" +
224 "REMOTE_DATA_CHANNEL|REMOTE_DATA_REPLY|REMOTE_DATA_REQUEST|REQUIRE_LINE_OF_SIGHT|" +
225 "RESTITUTION|REVERSE|ROTATE|SCALE|SCRIPTED|SIM_STAT_PCT_CHARS_STEPPED|SMOOTH|" +
226 "STATUS_BLOCK_GRAB|STATUS_BLOCK_GRAB_OBJECT|STATUS_BOUNDS_ERROR|STATUS_CAST_SHADOWS|" +
227 "STATUS_DIE_AT_EDGE|STATUS_INTERNAL_ERROR|STATUS_MALFORMED_PARAMS|STATUS_NOT_FOUND|" +
228 "STATUS_NOT_SUPPORTED|STATUS_OK|STATUS_PHANTOM|STATUS_PHYSICS|STATUS_RETURN_AT_EDGE|" +
229 "STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z|STATUS_SANDBOX|STATUS_TYPE_MISMATCH|" +
230 "STATUS_WHITELIST_FAILED|STRING_TRIM|STRING_TRIM_HEAD|STRING_TRIM_TAIL|TOUCH_INVALID_FACE|" +
231 "TRAVERSAL_TYPE|TRAVERSAL_TYPE_FAST|TRAVERSAL_TYPE_NONE|TRAVERSAL_TYPE_SLOW|" +
232 "TYPE_FLOAT|TYPE_INTEGER|TYPE_INVALID|TYPE_KEY|TYPE_ROTATION|TYPE_STRING|" +
233 "TYPE_VECTOR|VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY|" +
234 "VEHICLE_ANGULAR_DEFLECTION_TIMESCALE|VEHICLE_ANGULAR_FRICTION_TIMESCALE|" +
235 "VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE|VEHICLE_ANGULAR_MOTOR_DIRECTION|VEHICLE_ANGULAR_MOTOR_TIMESCALE|" +
236 "VEHICLE_BANKING_EFFICIENCY|VEHICLE_BANKING_MIX|VEHICLE_BANKING_TIMESCALE|" +
237 "VEHICLE_BUOYANCY|VEHICLE_FLAG_CAMERA_DECOUPLED|VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT|" +
238 "VEHICLE_FLAG_HOVER_TERRAIN_ONLY|VEHICLE_FLAG_HOVER_UP_ONLY|VEHICLE_FLAG_HOVER_WATER_ONLY|" +
239 "VEHICLE_FLAG_LIMIT_MOTOR_UP|VEHICLE_FLAG_LIMIT_ROLL_ONLY|VEHICLE_FLAG_MOUSELOOK_BANK|" +
240 "VEHICLE_FLAG_MOUSELOOK_STEER|VEHICLE_FLAG_NO_DEFLECTION_UP|VEHICLE_HOVER_EFFICIENCY|" +
241 "VEHICLE_HOVER_HEIGHT|VEHICLE_HOVER_TIMESCALE|VEHICLE_LINEAR_DEFLECTION_EFFICIENCY|" +
242 "VEHICLE_LINEAR_DEFLECTION_TIMESCALE|VEHICLE_LINEAR_FRICTION_TIMESCALE|VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE|" +
243 "VEHICLE_LINEAR_MOTOR_DIRECTION|VEHICLE_LINEAR_MOTOR_OFFSET|VEHICLE_LINEAR_MOTOR_TIMESCALE|" +
244 "VEHICLE_REFERENCE_FRAME|VEHICLE_TYPE_AIRPLANE|VEHICLE_TYPE_BALLOON|VEHICLE_TYPE_BOAT|" +
245 "VEHICLE_TYPE_CAR|VEHICLE_TYPE_NONE|VEHICLE_TYPE_SLED|VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY|" +
246 "VEHICLE_VERTICAL_ATTRACTION_TIMESCALE|VERTICAL|WANDER_PAUSE_AT_WAYPOINTS",
247 "constant.language.integer.boolean.lsl" : "FALSE|TRUE",
248 "constant.language.quaternion.lsl" : "ZERO_ROTATION",
249 "constant.language.string.lsl" : "EOF|JSON_ARRAY|JSON_FALSE|JSON_INVALID|" +
250 "JSON_NULL|JSON_NUMBER|JSON_OBJECT|JSON_STRING|JSON_TRUE|NULL_KEY|" +
251 "TEXTURE_BLANK|TEXTURE_DEFAULT|TEXTURE_MEDIA|TEXTURE_PLYWOOD|" +
252 "TEXTURE_TRANSPARENT|URL_REQUEST_DENIED|URL_REQUEST_GRANTED",
253 "constant.language.vector.lsl" : "TOUCH_INVALID_TEXCOORD|TOUCH_INVALID_VECTOR|ZERO_VECTOR",
254 "invalid.deprecated.lsl" : "llCloud|llCollisionSprite|llGodLikeRezObject|llMakeExplosion|" +
255 "llMakeFountain|llMakeSmoke|llMakeFire|llPointAt|llStopPointAt|llRefreshPrimURL|" +
256 "llSetPrimURL|llReleaseCamera|llTakeCamera|llRemoteDataSetRegion|llRemoteLoadScript|" +
257 "llSetInventoryPermMask|llSound|llSoundPreload|llXorBase64Strings|AGENT|" +
258 "CHARACTER_MAX_ANGULAR_ACCEL|CHARACTER_MAX_ANGULAR_SPEED|CHARACTER_TURN_SPEED_MULTIPLIER|" +
259 "DATA_RATING|LAND_LARGE_BRUSH|LAND_MEDIUM_BRUSH|LAND_SMALL_BRUSH|PERMISSION_CHANGE_JOINTS|" +
260 "PERMISSION_CHANGE_PERMISSIONS|PERMISSION_RELEASE_OWNERSHIP|PERMISSION_REMAP_CONTROLS|" +
261 "PRIM_CAST_SHADOWS|PRIM_PHYSICS_MATERIAL|PRIM_TYPE_LEGACY|PSYS_SRC_INNERANGLE|" +
262 "PSYS_SRC_OUTERANGLE|VEHICLE_FLAG_NO_FLY_UP",
263 "invalid.illegal.lsl" : "event|print",
264 "keyword.control.lsl" : "do|else|for|if|jump|return|while",
265 "storage.type.lsl" : "float|integer|key|list|quaternion|rotation|string|vector",
266 "support.function.lsl": "llAbs|llAcos|llAddToLandBanList|llAddToLandPassList|" +
267 "llAdjustSoundVolume|llAllowInventoryDrop|llAngleBetween|llApplyImpulse|" +
268 "llApplyRotationalImpulse|llAsin|llAtan2|llAttachToAvatar|llAttachToAvatarTemp|" +
269 "llAvatarOnLinkSitTarget|llAvatarOnSitTarget|llAxes2Rot|llAxisAngle2Rot|" +
270 "llBase64ToInteger|llBase64ToString|llBreakAllLinks|llBreakLink|llCastRay|" +
271 "llCeil|llClearCameraParams|llClearLinkMedia|llClearPrimMedia|llCloseRemoteDataChannel|" +
272 "llCollisionFilter|llCollisionSound|llCos|llCreateCharacter|llCreateLink|" +
273 "llCSV2List|llDeleteCharacter|llDeleteSubList|llDeleteSubString|llDetachFromAvatar|" +
274 "llDetectedGrab|llDetectedGroup|llDetectedKey|llDetectedLinkNumber|llDetectedName|" +
275 "llDetectedOwner|llDetectedPos|llDetectedRot|llDetectedTouchBinormal|" +
276 "llDetectedTouchFace|llDetectedTouchNormal|llDetectedTouchPos|llDetectedTouchST|" +
277 "llDetectedTouchUV|llDetectedType|llDetectedVel|llDialog|llDie|llDumpList2String|" +
278 "llEdgeOfWorld|llEjectFromLand|llEmail|llEscapeURL|llEuler2Rot|llExecCharacterCmd|" +
279 "llEvade|llFabs|llFleeFrom|llFloor|llForceMouselook|llFrand|llGenerateKey|" +
280 "llGetAccel|llGetAgentInfo|llGetAgentLanguage|llGetAgentList|llGetAgentSize|" +
281 "llGetAlpha|llGetAndResetTime|llGetAnimation|llGetAnimationList|llGetAnimationOverride|" +
282 "llGetAttached|llGetBoundingBox|llGetCameraPos|llGetCameraRot|llGetCenterOfMass|" +
283 "llGetClosestNavPoint|llGetColor|llGetCreator|llGetDate|llGetDisplayName|" +
284 "llGetEnergy|llGetEnv|llGetForce|llGetFreeMemory|llGetFreeURLs|llGetGeometricCenter|" +
285 "llGetGMTclock|llGetHTTPHeader|llGetInventoryCreator|llGetInventoryKey|llGetInventoryName|" +
286 "llGetInventoryNumber|llGetInventoryPermMask|llGetInventoryType|llGetKey|" +
287 "llGetLandOwnerAt|llGetLinkKey|llGetLinkMedia|llGetLinkName|llGetLinkNumber|" +
288 "llGetLinkNumberOfSides|llGetLinkPrimitiveParams|llGetListEntryType|llGetListLength|" +
289 "llGetLocalPos|llGetLocalRot|llGetMass|llGetMassMKS|llGetMemoryLimit|" +
290 "llGetNextEmail|llGetNotecardLine|llGetNumberOfNotecardLines|llGetNumberOfPrims|" +
291 "llGetNumberOfSides|llGetObjectDesc|llGetObjectDetails|llGetObjectMass|" +
292 "llGetObjectName|llGetObjectPermMask|llGetObjectPrimCount|llGetOmega|" +
293 "llGetOwner|llGetOwnerKey|llGetParcelDetails|llGetParcelFlags|llGetParcelMaxPrims|" +
294 "llGetParcelMusicURL|llGetParcelPrimCount|llGetParcelPrimOwners|llGetPermissions|" +
295 "llGetPermissionsKey|llGetPhysicsMaterial|llGetPos|llGetPrimitiveParams|" +
296 "llGetPrimMediaParams|llGetRegionAgentCount|llGetRegionCorner|llGetRegionFlags|" +
297 "llGetRegionFPS|llGetRegionName|llGetRegionTimeDilation|llGetRootPosition|" +
298 "llGetRootRotation|llGetRot|llGetScale|llGetScriptName|llGetScriptState|" +
299 "llGetSimStats|llGetSimulatorHostname|llGetSPMaxMemory|llGetStartParameter|" +
300 "llGetStaticPath|llGetStatus|llGetSubString|llGetSunDirection|llGetTexture|" +
301 "llGetTextureOffset|llGetTextureRot|llGetTextureScale|llGetTime|llGetTimeOfDay|" +
302 "llGetTimestamp|llGetTorque|llGetUnixTime|llGetUsedMemory|llGetUsername|" +
303 "llGetVel|llGetWallclock|llGiveInventory|llGiveInventoryList|llGiveMoney|" +
304 "llGround|llGroundContour|llGroundNormal|llGroundRepel|llGroundSlope|" +
305 "llHTTPRequest|llHTTPResponse|llInsertString|llInstantMessage|llIntegerToBase64|" +
306 "llJson2List|llJsonGetValue|llJsonSetValue|llJsonValueType|llKey2Name|" +
307 "llLinkParticleSystem|llLinkSitTarget|llList2CSV|llList2Float|llList2Integer|" +
308 "llList2Json|llList2Key|llList2List|llList2ListStrided|llList2Rot|" +
309 "llList2String|llList2Vector|llListen|llListenControl|llListenRemove|" +
310 "llListFindList|llListInsertList|llListRandomize|llListReplaceList|llListSort|" +
311 "llListStatistics|llLoadURL|llLog|llLog10|llLookAt|llLoopSound|llLoopSoundMaster|" +
312 "llLoopSoundSlave|llManageEstateAccess|llMapDestination|llMD5String|llMessageLinked|" +
313 "llMinEventDelay|llModifyLand|llModPow|llMoveToTarget|llNavigateTo|llOffsetTexture|" +
314 "llOpenRemoteDataChannel|llOverMyLand|llOwnerSay|llParcelMediaCommandList|" +
315 "llParcelMediaQuery|llParseString2List|llParseStringKeepNulls|llParticleSystem|" +
316 "llPassCollisions|llPassTouches|llPatrolPoints|llPlaySound|llPlaySoundSlave|" +
317 "llPow|llPreloadSound|llPursue|llPushObject|llRegionSay|llRegionSayTo|" +
318 "llReleaseControls|llReleaseURL|llRemoteDataReply|llRemoteLoadScriptPin|" +
319 "llRemoveFromLandBanList|llRemoveFromLandPassList|llRemoveInventory|llRemoveVehicleFlags|" +
320 "llRequestAgentData|llRequestDisplayName|llRequestInventoryData|llRequestPermissions|" +
321 "llRequestSecureURL|llRequestSimulatorData|llRequestURL|llRequestUsername|" +
322 "llResetAnimationOverride|llResetLandBanList|llResetLandPassList|llResetOtherScript|" +
323 "llResetScript|llResetTime|llRezAtRoot|llRezObject|llRot2Angle|llRot2Axis|llRot2Euler|" +
324 "llRot2Fwd|llRot2Left|llRot2Up|llRotateTexture|llRotBetween|llRotLookAt|" +
325 "llRotTarget|llRotTargetRemove|llRound|llSameGroup|llSay|llScaleTexture|" +
326 "llScriptDanger|llScriptProfiler|llSendRemoteData|llSensor|llSensorRemove|" +
327 "llSensorRepeat|llSetAlpha|llSetAngularVelocity|llSetAnimationOverride|llSetBuoyancy|" +
328 "llSetCameraAtOffset|llSetCameraEyeOffset|llSetCameraParams|llSetClickAction|" +
329 "llSetColor|llSetContentType|llSetDamage|llSetForce|llSetForceAndTorque|llSetHoverHeight|" +
330 "llSetKeyframedMotion|llSetLinkAlpha|llSetLinkCamera|llSetLinkColor|llSetLinkMedia|" +
331 "llSetLinkPrimitiveParams|llSetLinkPrimitiveParamsFast|llSetLinkTexture|llSetLinkTextureAnim|" +
332 "llSetLocalRot|llSetMemoryLimit|llSetObjectDesc|llSetObjectName|llSetParcelMusicURL|" +
333 "llSetPayPrice|llSetPhysicsMaterial|llSetPos|llSetPrimitiveParams|llSetPrimMediaParams|" +
334 "llSetRegionPos|llSetRemoteScriptAccessPin|llSetRot|llSetScale|llSetScriptState|" +
335 "llSetSitText|llSetSoundQueueing|llSetSoundRadius|llSetStatus|llSetText|" +
336 "llSetTexture|llSetTextureAnim|llSetTimerEvent|llSetTorque|llSetTouchText|" +
337 "llSetVehicleFlags|llSetVehicleFloatParam|llSetVehicleRotationParam|llSetVehicleType|" +
338 "llSetVehicleVectorParam|llSetVelocity|llSHA1String|llShout|llSin|llSitTarget|" +
339 "llSleep|llSqrt|llStartAnimation|llStopAnimation|llStopHover|llStopLookAt|" +
340 "llStopMoveToTarget|llStopSound|llStringLength|llStringToBase64|llStringTrim|" +
341 "llSubStringIndex|llTakeControls|llTan|llTarget|llTargetOmega|llTargetRemove|" +
342 "llTeleportAgent|llTeleportAgentGlobalCoords|llTeleportAgentHome|llTextBox|" +
343 "llToLower|llToUpper|llTransferLindenDollars|llTriggerSound|llTriggerSoundLimited|" +
344 "llUnescapeURL|llUnSit|llUpdateCharacter|llVecDist|llVecMag|llVecNorm|" +
345 "llVolumeDetect|llWanderWithin|llWater|llWhisper|llWind|llXorBase64StringsCorrect",
346 "support.function.event.lsl" : "at_rot_target|at_target|attach|changed|collision|" +
347 "collision_end|collision_start|control|dataserver|email|http_request|" +
348 "http_response|land_collision|land_collision_end|land_collision_start|" +
349 "link_message|listen|money|moving_end|moving_start|no_sensor|not_at_rot_target|" +
350 "not_at_target|object_rez|on_rez|path_update|remote_data|run_time_permissions|" +
351 "sensor|state_entry|state_exit|timer|touch|touch_end|touch_start|transaction_result"
352 }, "identifier");
353
354 this.$rules = {
355 "start" : [
356 {
357 token : "comment.line.double-slash.lsl",
358 regex : "\\/\\/.*$"
359 }, {
360 token : "comment.block.lsl",
361 regex : "\\/\\*",
362 next : "comment"
363 }, {
364 token : "string.quoted.double.lsl",
365 start : '"',
366 end : '"',
367 next : [{
368 token : "constant.language.escape.lsl", regex : /\\[tn"\\]/
369 }]
370 }, {
371 token : "constant.numeric.lsl",
372 regex : "(0[xX][0-9a-fA-F]+|[+-]?[0-9]+(?:(?:\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?)?)\\b"
373 }, {
374 token : "entity.name.state.lsl",
375 regex : "\\b((state)\\s+\\w+|default)\\b"
376 }, {
377 token : keywordMapper,
378 regex : "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
379 }, {
380 token : "support.function.user-defined.lsl",
381 regex : /\b([a-zA-Z_]\w*)(?=\(.*?\))/
382 }, {
383 token : "keyword.operator.lsl",
384 regex : "\\+\\+|\\-\\-|<<|>>|&&?|\\|\\|?|\\^|~|[!%<>=*+\\-\\/]=?"
385 }, {
386 token : "punctuation.operator.lsl",
387 regex : "\\,|\\;"
388 }, {
389 token : "paren.lparen.lsl",
390 regex : "[\\[\\(\\{]"
391 }, {
392 token : "paren.rparen.lsl",
393 regex : "[\\]\\)\\}]"
394 }, {
395 token : "text.lsl",
396 regex : "\\s+"
397 }
398 ],
399 "comment" : [
400 {
401 token : "comment.block.lsl",
402 regex : ".*?\\*\\/",
403 next : "start"
404 }, {
405 token : "comment.block.lsl",
406 regex : ".+"
407 }
408 ]
409 };
410 this.normalizeRules();
411 }
412
413 exports.LSLHighlightRules = LSLHighlightRules;
414 });
415
416 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
417
418
419 var Range = require("../range").Range;
420
421 var MatchingBraceOutdent = function() {};
422
423 (function() {
424
425 this.checkOutdent = function(line, input) {
426 if (! /^\s+$/.test(line))
427 return false;
428
429 return /^\s*\}/.test(input);
430 };
431
432 this.autoOutdent = function(doc, row) {
433 var line = doc.getLine(row);
434 var match = line.match(/^(\s*\})/);
435
436 if (!match) return 0;
437
438 var column = match[1].length;
439 var openBracePos = doc.findMatchingBracket({row: row, column: column});
440
441 if (!openBracePos || openBracePos.row == row) return 0;
442
443 var indent = this.$getIndent(doc.getLine(openBracePos.row));
444 doc.replace(new Range(row, 0, row, column-1), indent);
445 };
446
447 this.$getIndent = function(line) {
448 return line.match(/^\s*/)[0];
449 };
450
451 }).call(MatchingBraceOutdent.prototype);
452
453 exports.MatchingBraceOutdent = MatchingBraceOutdent;
454 });
455
456 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
457
458
459 var oop = require("../../lib/oop");
460 var Behaviour = require("../behaviour").Behaviour;
461 var TokenIterator = require("../../token_iterator").TokenIterator;
462 var lang = require("../../lib/lang");
463
464 var SAFE_INSERT_IN_TOKENS =
465 ["text", "paren.rparen", "punctuation.operator"];
466 var SAFE_INSERT_BEFORE_TOKENS =
467 ["text", "paren.rparen", "punctuation.operator", "comment"];
468
469
470 var autoInsertedBrackets = 0;
471 var autoInsertedRow = -1;
472 var autoInsertedLineEnd = "";
473 var maybeInsertedBrackets = 0;
474 var maybeInsertedRow = -1;
475 var maybeInsertedLineStart = "";
476 var maybeInsertedLineEnd = "";
477
478 var CstyleBehaviour = function () {
479
480 CstyleBehaviour.isSaneInsertion = function(editor, session) {
481 var cursor = editor.getCursorPosition();
482 var iterator = new TokenIterator(session, cursor.row, cursor.column);
483 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
484 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
485 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
486 return false;
487 }
488 iterator.stepForward();
489 return iterator.getCurrentTokenRow() !== cursor.row ||
490 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
491 };
492
493 CstyleBehaviour.$matchTokenType = function(token, types) {
494 return types.indexOf(token.type || token) > -1;
495 };
496
497 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
498 var cursor = editor.getCursorPosition();
499 var line = session.doc.getLine(cursor.row);
500 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
501 autoInsertedBrackets = 0;
502 autoInsertedRow = cursor.row;
503 autoInsertedLineEnd = bracket + line.substr(cursor.column);
504 autoInsertedBrackets++;
505 };
506
507 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
508 var cursor = editor.getCursorPosition();
509 var line = session.doc.getLine(cursor.row);
510 if (!this.isMaybeInsertedClosing(cursor, line))
511 maybeInsertedBrackets = 0;
512 maybeInsertedRow = cursor.row;
513 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
514 maybeInsertedLineEnd = line.substr(cursor.column);
515 maybeInsertedBrackets++;
516 };
517
518 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
519 return autoInsertedBrackets > 0 &&
520 cursor.row === autoInsertedRow &&
521 bracket === autoInsertedLineEnd[0] &&
522 line.substr(cursor.column) === autoInsertedLineEnd;
523 };
524
525 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
526 return maybeInsertedBrackets > 0 &&
527 cursor.row === maybeInsertedRow &&
528 line.substr(cursor.column) === maybeInsertedLineEnd &&
529 line.substr(0, cursor.column) == maybeInsertedLineStart;
530 };
531
532 CstyleBehaviour.popAutoInsertedClosing = function() {
533 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
534 autoInsertedBrackets--;
535 };
536
537 CstyleBehaviour.clearMaybeInsertedClosing = function() {
538 maybeInsertedBrackets = 0;
539 maybeInsertedRow = -1;
540 };
541
542 this.add("braces", "insertion", function (state, action, editor, session, text) {
543 var cursor = editor.getCursorPosition();
544 var line = session.doc.getLine(cursor.row);
545 if (text == '{') {
546 var selection = editor.getSelectionRange();
547 var selected = session.doc.getTextRange(selection);
548 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
549 return {
550 text: '{' + selected + '}',
551 selection: false
552 };
553 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
554 if (/[\]\}\)]/.test(line[cursor.column])) {
555 CstyleBehaviour.recordAutoInsert(editor, session, "}");
556 return {
557 text: '{}',
558 selection: [1, 1]
559 };
560 } else {
561 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
562 return {
563 text: '{',
564 selection: [1, 1]
565 };
566 }
567 }
568 } else if (text == '}') {
569 var rightChar = line.substring(cursor.column, cursor.column + 1);
570 if (rightChar == '}') {
571 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
572 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
573 CstyleBehaviour.popAutoInsertedClosing();
574 return {
575 text: '',
576 selection: [1, 1]
577 };
578 }
579 }
580 } else if (text == "\n" || text == "\r\n") {
581 var closing = "";
582 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
583 closing = lang.stringRepeat("}", maybeInsertedBrackets);
584 CstyleBehaviour.clearMaybeInsertedClosing();
585 }
586 var rightChar = line.substring(cursor.column, cursor.column + 1);
587 if (rightChar == '}' || closing !== "") {
588 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
589 if (!openBracePos)
590 return null;
591
592 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
593 var next_indent = this.$getIndent(line);
594
595 return {
596 text: '\n' + indent + '\n' + next_indent + closing,
597 selection: [1, indent.length, 1, indent.length]
598 };
599 }
600 }
601 });
602
603 this.add("braces", "deletion", function (state, action, editor, session, range) {
604 var selected = session.doc.getTextRange(range);
605 if (!range.isMultiLine() && selected == '{') {
606 var line = session.doc.getLine(range.start.row);
607 var rightChar = line.substring(range.end.column, range.end.column + 1);
608 if (rightChar == '}') {
609 range.end.column++;
610 return range;
611 } else {
612 maybeInsertedBrackets--;
613 }
614 }
615 });
616
617 this.add("parens", "insertion", function (state, action, editor, session, text) {
618 if (text == '(') {
619 var selection = editor.getSelectionRange();
620 var selected = session.doc.getTextRange(selection);
621 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
622 return {
623 text: '(' + selected + ')',
624 selection: false
625 };
626 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
627 CstyleBehaviour.recordAutoInsert(editor, session, ")");
628 return {
629 text: '()',
630 selection: [1, 1]
631 };
632 }
633 } else if (text == ')') {
634 var cursor = editor.getCursorPosition();
635 var line = session.doc.getLine(cursor.row);
636 var rightChar = line.substring(cursor.column, cursor.column + 1);
637 if (rightChar == ')') {
638 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
639 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
640 CstyleBehaviour.popAutoInsertedClosing();
641 return {
642 text: '',
643 selection: [1, 1]
644 };
645 }
646 }
647 }
648 });
649
650 this.add("parens", "deletion", function (state, action, editor, session, range) {
651 var selected = session.doc.getTextRange(range);
652 if (!range.isMultiLine() && selected == '(') {
653 var line = session.doc.getLine(range.start.row);
654 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
655 if (rightChar == ')') {
656 range.end.column++;
657 return range;
658 }
659 }
660 });
661
662 this.add("brackets", "insertion", function (state, action, editor, session, text) {
663 if (text == '[') {
664 var selection = editor.getSelectionRange();
665 var selected = session.doc.getTextRange(selection);
666 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
667 return {
668 text: '[' + selected + ']',
669 selection: false
670 };
671 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
672 CstyleBehaviour.recordAutoInsert(editor, session, "]");
673 return {
674 text: '[]',
675 selection: [1, 1]
676 };
677 }
678 } else if (text == ']') {
679 var cursor = editor.getCursorPosition();
680 var line = session.doc.getLine(cursor.row);
681 var rightChar = line.substring(cursor.column, cursor.column + 1);
682 if (rightChar == ']') {
683 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
684 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
685 CstyleBehaviour.popAutoInsertedClosing();
686 return {
687 text: '',
688 selection: [1, 1]
689 };
690 }
691 }
692 }
693 });
694
695 this.add("brackets", "deletion", function (state, action, editor, session, range) {
696 var selected = session.doc.getTextRange(range);
697 if (!range.isMultiLine() && selected == '[') {
698 var line = session.doc.getLine(range.start.row);
699 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
700 if (rightChar == ']') {
701 range.end.column++;
702 return range;
703 }
704 }
705 });
706
707 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
708 if (text == '"' || text == "'") {
709 var quote = text;
710 var selection = editor.getSelectionRange();
711 var selected = session.doc.getTextRange(selection);
712 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
713 return {
714 text: quote + selected + quote,
715 selection: false
716 };
717 } else {
718 var cursor = editor.getCursorPosition();
719 var line = session.doc.getLine(cursor.row);
720 var leftChar = line.substring(cursor.column-1, cursor.column);
721 if (leftChar == '\\') {
722 return null;
723 }
724 var tokens = session.getTokens(selection.start.row);
725 var col = 0, token;
726 var quotepos = -1; // Track whether we're inside an open quote.
727
728 for (var x = 0; x < tokens.length; x++) {
729 token = tokens[x];
730 if (token.type == "string") {
731 quotepos = -1;
732 } else if (quotepos < 0) {
733 quotepos = token.value.indexOf(quote);
734 }
735 if ((token.value.length + col) > selection.start.column) {
736 break;
737 }
738 col += tokens[x].value.length;
739 }
740 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
741 if (!CstyleBehaviour.isSaneInsertion(editor, session))
742 return;
743 return {
744 text: quote + quote,
745 selection: [1,1]
746 };
747 } else if (token && token.type === "string") {
748 var rightChar = line.substring(cursor.column, cursor.column + 1);
749 if (rightChar == quote) {
750 return {
751 text: '',
752 selection: [1, 1]
753 };
754 }
755 }
756 }
757 }
758 });
759
760 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
761 var selected = session.doc.getTextRange(range);
762 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
763 var line = session.doc.getLine(range.start.row);
764 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
765 if (rightChar == selected) {
766 range.end.column++;
767 return range;
768 }
769 }
770 });
771
772 };
773
774 oop.inherits(CstyleBehaviour, Behaviour);
775
776 exports.CstyleBehaviour = CstyleBehaviour;
777 });
778
779 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
780
781
782 var oop = require("../../lib/oop");
783 var Range = require("../../range").Range;
784 var BaseFoldMode = require("./fold_mode").FoldMode;
785
786 var FoldMode = exports.FoldMode = function(commentRegex) {
787 if (commentRegex) {
788 this.foldingStartMarker = new RegExp(
789 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
790 );
791 this.foldingStopMarker = new RegExp(
792 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
793 );
794 }
795 };
796 oop.inherits(FoldMode, BaseFoldMode);
797
798 (function() {
799
800 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
801 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
802
803 this.getFoldWidgetRange = function(session, foldStyle, row) {
804 var line = session.getLine(row);
805 var match = line.match(this.foldingStartMarker);
806 if (match) {
807 var i = match.index;
808
809 if (match[1])
810 return this.openingBracketBlock(session, match[1], row, i);
811
812 return session.getCommentFoldRange(row, i + match[0].length, 1);
813 }
814
815 if (foldStyle !== "markbeginend")
816 return;
817
818 var match = line.match(this.foldingStopMarker);
819 if (match) {
820 var i = match.index + match[0].length;
821
822 if (match[1])
823 return this.closingBracketBlock(session, match[1], row, i);
824
825 return session.getCommentFoldRange(row, i, -1);
826 }
827 };
828
829 }).call(FoldMode.prototype);
830
831 });
+0
-455
try/ace/mode-lua.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/lua', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/lua_highlight_rules', 'ace/mode/folding/lua', 'ace/range', 'ace/worker/worker_client'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
37 var LuaFoldMode = require("./folding/lua").FoldMode;
38 var Range = require("../range").Range;
39 var WorkerClient = require("../worker/worker_client").WorkerClient;
40
41 var Mode = function() {
42 this.$tokenizer = new Tokenizer(new LuaHighlightRules().getRules());
43 this.foldingRules = new LuaFoldMode();
44 };
45 oop.inherits(Mode, TextMode);
46
47 (function() {
48
49 this.lineCommentStart = "--";
50 this.blockComment = {start: "--[", end: "]--"};
51
52 var indentKeywords = {
53 "function": 1,
54 "then": 1,
55 "do": 1,
56 "else": 1,
57 "elseif": 1,
58 "repeat": 1,
59 "end": -1,
60 "until": -1
61 };
62 var outdentKeywords = [
63 "else",
64 "elseif",
65 "end",
66 "until"
67 ];
68
69 function getNetIndentLevel(tokens) {
70 var level = 0;
71 for (var i = 0; i < tokens.length; i++) {
72 var token = tokens[i];
73 if (token.type == "keyword") {
74 if (token.value in indentKeywords) {
75 level += indentKeywords[token.value];
76 }
77 } else if (token.type == "paren.lparen") {
78 level ++;
79 } else if (token.type == "paren.rparen") {
80 level --;
81 }
82 }
83 if (level < 0) {
84 return -1;
85 } else if (level > 0) {
86 return 1;
87 } else {
88 return 0;
89 }
90 }
91
92 this.getNextLineIndent = function(state, line, tab) {
93 var indent = this.$getIndent(line);
94 var level = 0;
95
96 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
97 var tokens = tokenizedLine.tokens;
98
99 if (state == "start") {
100 level = getNetIndentLevel(tokens);
101 }
102 if (level > 0) {
103 return indent + tab;
104 } else if (level < 0 && indent.substr(indent.length - tab.length) == tab) {
105 if (!this.checkOutdent(state, line, "\n")) {
106 return indent.substr(0, indent.length - tab.length);
107 }
108 }
109 return indent;
110 };
111
112 this.checkOutdent = function(state, line, input) {
113 if (input != "\n" && input != "\r" && input != "\r\n")
114 return false;
115
116 if (line.match(/^\s*[\)\}\]]$/))
117 return true;
118
119 var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
120
121 if (!tokens || !tokens.length)
122 return false;
123
124 return (tokens[0].type == "keyword" && outdentKeywords.indexOf(tokens[0].value) != -1);
125 };
126
127 this.autoOutdent = function(state, session, row) {
128 var prevLine = session.getLine(row - 1);
129 var prevIndent = this.$getIndent(prevLine).length;
130 var prevTokens = this.$tokenizer.getLineTokens(prevLine, "start").tokens;
131 var tabLength = session.getTabString().length;
132 var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens);
133 var curIndent = this.$getIndent(session.getLine(row)).length;
134 if (curIndent < expectedIndent) {
135 return;
136 }
137 session.outdentRows(new Range(row, 0, row + 2, 0));
138 };
139
140 this.createWorker = function(session) {
141 var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker");
142 worker.attachToDocument(session.getDocument());
143
144 worker.on("error", function(e) {
145 session.setAnnotations([e.data]);
146 });
147
148 worker.on("ok", function(e) {
149 session.clearAnnotations();
150 });
151
152 return worker;
153 };
154
155 }).call(Mode.prototype);
156
157 exports.Mode = Mode;
158 });
159
160 define('ace/mode/lua_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
161
162
163 var oop = require("../lib/oop");
164 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
165
166 var LuaHighlightRules = function() {
167
168 var keywords = (
169 "break|do|else|elseif|end|for|function|if|in|local|repeat|"+
170 "return|then|until|while|or|and|not"
171 );
172
173 var builtinConstants = ("true|false|nil|_G|_VERSION");
174
175 var functions = (
176 "string|xpcall|package|tostring|print|os|unpack|require|"+
177 "getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+
178 "collectgarbage|getmetatable|module|rawset|math|debug|"+
179 "pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+
180 "pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|"+
181 "load|error|loadfile|"+
182
183 "sub|upper|len|gfind|rep|find|match|char|dump|gmatch|"+
184 "reverse|byte|format|gsub|lower|preload|loadlib|loaded|"+
185 "loaders|cpath|config|path|seeall|exit|setlocale|date|"+
186 "getenv|difftime|remove|time|clock|tmpname|rename|execute|"+
187 "lines|write|close|flush|open|output|type|read|stderr|"+
188 "stdin|input|stdout|popen|tmpfile|log|max|acos|huge|"+
189 "ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|"+
190 "frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|"+
191 "atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|"+
192 "gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+
193 "setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+
194 "foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+
195 "status|wrap|create|running|"+
196 "__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+
197 "__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber"
198 );
199
200 var stdLibaries = ("string|package|os|io|math|debug|table|coroutine");
201
202 var futureReserved = "";
203
204 var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn");
205
206 var keywordMapper = this.createKeywordMapper({
207 "keyword": keywords,
208 "support.function": functions,
209 "invalid.deprecated": deprecatedIn5152,
210 "constant.library": stdLibaries,
211 "constant.language": builtinConstants,
212 "invalid.illegal": futureReserved,
213 "variable.language": "this"
214 }, "identifier");
215
216 var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
217 var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
218 var integer = "(?:" + decimalInteger + "|" + hexInteger + ")";
219
220 var fraction = "(?:\\.\\d+)";
221 var intPart = "(?:\\d+)";
222 var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
223 var floatNumber = "(?:" + pointFloat + ")";
224
225 this.$rules = {
226 "start" : [{
227 stateName: "bracketedComment",
228 onMatch : function(value, currentState, stack){
229 stack.unshift(this.next, value.length, currentState);
230 return "comment";
231 },
232 regex : /\-\-\[=*\[/,
233 next : [
234 {
235 onMatch : function(value, currentState, stack) {
236 if (value.length == stack[1]) {
237 stack.shift();
238 stack.shift();
239 this.next = stack.shift();
240 } else {
241 this.next = "";
242 }
243 return "comment";
244 },
245 regex : /(?:[^\\]|\\.)*?\]=*\]/,
246 next : "start"
247 }, {
248 defaultToken : "comment"
249 }
250 ]
251 },
252
253 {
254 token : "comment",
255 regex : "\\-\\-.*$"
256 },
257 {
258 stateName: "bracketedString",
259 onMatch : function(value, currentState, stack){
260 stack.unshift(this.next, value.length, currentState);
261 return "comment";
262 },
263 regex : /\[=*\[/,
264 next : [
265 {
266 onMatch : function(value, currentState, stack) {
267 if (value.length == stack[1]) {
268 stack.shift();
269 stack.shift();
270 this.next = stack.shift();
271 } else {
272 this.next = "";
273 }
274 return "comment";
275 },
276
277 regex : /(?:[^\\]|\\.)*?\]=*\]/,
278 next : "start"
279 }, {
280 defaultToken : "comment"
281 }
282 ]
283 },
284 {
285 token : "string", // " string
286 regex : '"(?:[^\\\\]|\\\\.)*?"'
287 }, {
288 token : "string", // ' string
289 regex : "'(?:[^\\\\]|\\\\.)*?'"
290 }, {
291 token : "constant.numeric", // float
292 regex : floatNumber
293 }, {
294 token : "constant.numeric", // integer
295 regex : integer + "\\b"
296 }, {
297 token : keywordMapper,
298 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
299 }, {
300 token : "keyword.operator",
301 regex : "\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\."
302 }, {
303 token : "paren.lparen",
304 regex : "[\\[\\(\\{]"
305 }, {
306 token : "paren.rparen",
307 regex : "[\\]\\)\\}]"
308 }, {
309 token : "text",
310 regex : "\\s+|\\w+"
311 } ]
312 };
313
314 this.normalizeRules();
315 }
316
317 oop.inherits(LuaHighlightRules, TextHighlightRules);
318
319 exports.LuaHighlightRules = LuaHighlightRules;
320 });
321
322 define('ace/mode/folding/lua', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range', 'ace/token_iterator'], function(require, exports, module) {
323
324
325 var oop = require("../../lib/oop");
326 var BaseFoldMode = require("./fold_mode").FoldMode;
327 var Range = require("../../range").Range;
328 var TokenIterator = require("../../token_iterator").TokenIterator;
329
330
331 var FoldMode = exports.FoldMode = function() {};
332
333 oop.inherits(FoldMode, BaseFoldMode);
334
335 (function() {
336
337 this.foldingStartMarker = /\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/;
338 this.foldingStopMarker = /\bend\b|^\s*}|\]=*\]/;
339
340 this.getFoldWidget = function(session, foldStyle, row) {
341 var line = session.getLine(row);
342 var isStart = this.foldingStartMarker.test(line);
343 var isEnd = this.foldingStopMarker.test(line);
344
345 if (isStart && !isEnd) {
346 var match = line.match(this.foldingStartMarker);
347 if (match[1] == "then" && /\belseif\b/.test(line))
348 return;
349 if (match[1]) {
350 if (session.getTokenAt(row, match.index + 1).type === "keyword")
351 return "start";
352 } else if (match[2]) {
353 var type = session.bgTokenizer.getState(row) || "";
354 if (type[0] == "bracketedComment" || type[0] == "bracketedString")
355 return "start";
356 } else {
357 return "start";
358 }
359 }
360 if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd)
361 return "";
362
363 var match = line.match(this.foldingStopMarker);
364 if (match[0] === "end") {
365 if (session.getTokenAt(row, match.index + 1).type === "keyword")
366 return "end";
367 } else if (match[0][0] === "]") {
368 var type = session.bgTokenizer.getState(row - 1) || "";
369 if (type[0] == "bracketedComment" || type[0] == "bracketedString")
370 return "end";
371 } else
372 return "end";
373 };
374
375 this.getFoldWidgetRange = function(session, foldStyle, row) {
376 var line = session.doc.getLine(row);
377 var match = this.foldingStartMarker.exec(line);
378 if (match) {
379 if (match[1])
380 return this.luaBlock(session, row, match.index + 1);
381
382 if (match[2])
383 return session.getCommentFoldRange(row, match.index + 1);
384
385 return this.openingBracketBlock(session, "{", row, match.index);
386 }
387
388 var match = this.foldingStopMarker.exec(line);
389 if (match) {
390 if (match[0] === "end") {
391 if (session.getTokenAt(row, match.index + 1).type === "keyword")
392 return this.luaBlock(session, row, match.index + 1);
393 }
394
395 if (match[0][0] === "]")
396 return session.getCommentFoldRange(row, match.index + 1);
397
398 return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
399 }
400 };
401
402 this.luaBlock = function(session, row, column) {
403 var stream = new TokenIterator(session, row, column);
404 var indentKeywords = {
405 "function": 1,
406 "do": 1,
407 "then": 1,
408 "elseif": -1,
409 "end": -1,
410 "repeat": 1,
411 "until": -1
412 };
413
414 var token = stream.getCurrentToken();
415 if (!token || token.type != "keyword")
416 return;
417
418 var val = token.value;
419 var stack = [val];
420 var dir = indentKeywords[val];
421
422 if (!dir)
423 return;
424
425 var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;
426 var startRow = row;
427
428 stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
429 while(token = stream.step()) {
430 if (token.type !== "keyword")
431 continue;
432 var level = dir * indentKeywords[token.value];
433
434 if (level > 0) {
435 stack.unshift(token.value);
436 } else if (level <= 0) {
437 stack.shift();
438 if (!stack.length && token.value != "elseif")
439 break;
440 if (level === 0)
441 stack.unshift(token.value);
442 }
443 }
444
445 var row = stream.getCurrentTokenRow();
446 if (dir === -1)
447 return new Range(row, session.getLine(row).length, startRow, startColumn);
448 else
449 return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());
450 };
451
452 }).call(FoldMode.prototype);
453
454 });
+0
-64
try/ace/mode-lucene.js less more
0 define('ace/mode/lucene', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/lucene_highlight_rules'], function(require, exports, module) {
1
2
3 var oop = require("../lib/oop");
4 var TextMode = require("./text").Mode;
5 var Tokenizer = require("../tokenizer").Tokenizer;
6 var LuceneHighlightRules = require("./lucene_highlight_rules").LuceneHighlightRules;
7
8 var Mode = function() {
9 this.$tokenizer = new Tokenizer(new LuceneHighlightRules().getRules());
10 };
11
12 oop.inherits(Mode, TextMode);
13
14 exports.Mode = Mode;
15 });define('ace/mode/lucene_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
16
17
18 var oop = require("../lib/oop");
19 var lang = require("../lib/lang");
20 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
21
22 var LuceneHighlightRules = function() {
23 this.$rules = {
24 "start" : [
25 {
26 token : "constant.character.negation",
27 regex : "[\\-]"
28 }, {
29 token : "constant.character.interro",
30 regex : "[\\?]"
31 }, {
32 token : "constant.character.asterisk",
33 regex : "[\\*]"
34 }, {
35 token: 'constant.character.proximity',
36 regex: '~[0-9]+\\b'
37 }, {
38 token : 'keyword.operator',
39 regex: '(?:AND|OR|NOT)\\b'
40 }, {
41 token : "paren.lparen",
42 regex : "[\\(]"
43 }, {
44 token : "paren.rparen",
45 regex : "[\\)]"
46 }, {
47 token : "keyword",
48 regex : "[\\S]+:"
49 }, {
50 token : "string", // " string
51 regex : '".*?"'
52 }, {
53 token : "text",
54 regex : "\\s+"
55 }
56 ]
57 };
58 };
59
60 oop.inherits(LuceneHighlightRules, TextHighlightRules);
61
62 exports.LuceneHighlightRules = LuceneHighlightRules;
63 });
+0
-313
try/ace/mode-makefile.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * Contributor(s):
30 *
31 *
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35 define('ace/mode/makefile', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/makefile_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
36
37
38 var oop = require("../lib/oop");
39 var TextMode = require("./text").Mode;
40 var Tokenizer = require("../tokenizer").Tokenizer;
41 var MakefileHighlightRules = require("./makefile_highlight_rules").MakefileHighlightRules;
42 var FoldMode = require("./folding/coffee").FoldMode;
43
44 var Mode = function() {
45 var highlighter = new MakefileHighlightRules();
46 this.foldingRules = new FoldMode();
47
48 this.$tokenizer = new Tokenizer(highlighter.getRules());
49 };
50 oop.inherits(Mode, TextMode);
51
52 (function() {
53
54 this.lineCommentStart = "#";
55 }).call(Mode.prototype);
56
57 exports.Mode = Mode;
58 });define('ace/mode/makefile_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/sh_highlight_rules'], function(require, exports, module) {
59
60
61 var oop = require("../lib/oop");
62 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
63
64 var ShHighlightFile = require("./sh_highlight_rules");
65
66 var MakefileHighlightRules = function() {
67
68 var keywordMapper = this.createKeywordMapper({
69 "keyword": ShHighlightFile.reservedKeywords,
70 "support.function.builtin": ShHighlightFile.languageConstructs,
71 "invalid.deprecated": "debugger"
72 }, "string");
73
74 this.$rules =
75 {
76 "start": [
77 {
78 token: "string.interpolated.backtick.makefile",
79 regex: "`",
80 next: "shell-start"
81 },
82 {
83 token: "punctuation.definition.comment.makefile",
84 regex: /#(?=.)/,
85 next: "comment"
86 },
87 {
88 token: [ "keyword.control.makefile"],
89 regex: "^(?:\\s*\\b)(\\-??include|ifeq|ifneq|ifdef|ifndef|else|endif|vpath|export|unexport|define|endef|override)(?:\\b)"
90 },
91 {// ^([^\t ]+(\s[^\t ]+)*:(?!\=))\s*.*
92 token: ["entity.name.function.makefile", "text"],
93 regex: "^([^\\t ]+(?:\\s[^\\t ]+)*:)(\\s*.*)"
94 }
95 ],
96 "comment": [
97 {
98 token : "punctuation.definition.comment.makefile",
99 regex : /.+\\/
100 },
101 {
102 token : "punctuation.definition.comment.makefile",
103 regex : ".+",
104 next : "start"
105 }
106 ],
107 "shell-start": [
108 {
109 token: keywordMapper,
110 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
111 },
112 {
113 token: "string",
114 regex : "\\w+"
115 },
116 {
117 token : "string.interpolated.backtick.makefile",
118 regex : "`",
119 next : "start"
120 }
121 ]
122 }
123
124 };
125
126 oop.inherits(MakefileHighlightRules, TextHighlightRules);
127
128 exports.MakefileHighlightRules = MakefileHighlightRules;
129 });
130
131 define('ace/mode/sh_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
132
133
134 var oop = require("../lib/oop");
135 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
136
137 var reservedKeywords = exports.reservedKeywords = (
138 '!|{|}|case|do|done|elif|else|'+
139 'esac|fi|for|if|in|then|until|while|'+
140 '&|;|export|local|read|typeset|unset|'+
141 'elif|select|set'
142 );
143
144 var languageConstructs = exports.languageConstructs = (
145 '[|]|alias|bg|bind|break|builtin|'+
146 'cd|command|compgen|complete|continue|'+
147 'dirs|disown|echo|enable|eval|exec|'+
148 'exit|fc|fg|getopts|hash|help|history|'+
149 'jobs|kill|let|logout|popd|printf|pushd|'+
150 'pwd|return|set|shift|shopt|source|'+
151 'suspend|test|times|trap|type|ulimit|'+
152 'umask|unalias|wait'
153 );
154
155 var ShHighlightRules = function() {
156 var keywordMapper = this.createKeywordMapper({
157 "keyword": reservedKeywords,
158 "support.function.builtin": languageConstructs,
159 "invalid.deprecated": "debugger"
160 }, "identifier");
161
162 var integer = "(?:(?:[1-9]\\d*)|(?:0))";
163
164 var fraction = "(?:\\.\\d+)";
165 var intPart = "(?:\\d+)";
166 var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
167 var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
168 var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
169 var fileDescriptor = "(?:&" + intPart + ")";
170
171 var variableName = "[a-zA-Z][a-zA-Z0-9_]*";
172 var variable = "(?:(?:\\$" + variableName + ")|(?:" + variableName + "=))";
173
174 var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
175
176 var func = "(?:" + variableName + "\\s*\\(\\))";
177
178 this.$rules = {
179 "start" : [ {
180 token : ["text", "comment"],
181 regex : /(^|\s)(#.*)$/
182 }, {
183 token : "string", // " string
184 regex : '"(?:[^\\\\]|\\\\.)*?"'
185 }, {
186 token : "variable.language",
187 regex : builtinVariable
188 }, {
189 token : "variable",
190 regex : variable
191 }, {
192 token : "support.function",
193 regex : func
194 }, {
195 token : "support.function",
196 regex : fileDescriptor
197 }, {
198 token : "string", // ' string
199 regex : "'(?:[^\\\\]|\\\\.)*?'"
200 }, {
201 token : "constant.numeric", // float
202 regex : floatNumber
203 }, {
204 token : "constant.numeric", // integer
205 regex : integer + "\\b"
206 }, {
207 token : keywordMapper,
208 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
209 }, {
210 token : "keyword.operator",
211 regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="
212 }, {
213 token : "paren.lparen",
214 regex : "[\\[\\(\\{]"
215 }, {
216 token : "paren.rparen",
217 regex : "[\\]\\)\\}]"
218 } ]
219 };
220 };
221
222 oop.inherits(ShHighlightRules, TextHighlightRules);
223
224 exports.ShHighlightRules = ShHighlightRules;
225 });
226
227 define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
228
229
230 var oop = require("../../lib/oop");
231 var BaseFoldMode = require("./fold_mode").FoldMode;
232 var Range = require("../../range").Range;
233
234 var FoldMode = exports.FoldMode = function() {};
235 oop.inherits(FoldMode, BaseFoldMode);
236
237 (function() {
238
239 this.getFoldWidgetRange = function(session, foldStyle, row) {
240 var range = this.indentationBlock(session, row);
241 if (range)
242 return range;
243
244 var re = /\S/;
245 var line = session.getLine(row);
246 var startLevel = line.search(re);
247 if (startLevel == -1 || line[startLevel] != "#")
248 return;
249
250 var startColumn = line.length;
251 var maxRow = session.getLength();
252 var startRow = row;
253 var endRow = row;
254
255 while (++row < maxRow) {
256 line = session.getLine(row);
257 var level = line.search(re);
258
259 if (level == -1)
260 continue;
261
262 if (line[level] != "#")
263 break;
264
265 endRow = row;
266 }
267
268 if (endRow > startRow) {
269 var endColumn = session.getLine(endRow).length;
270 return new Range(startRow, startColumn, endRow, endColumn);
271 }
272 };
273 this.getFoldWidget = function(session, foldStyle, row) {
274 var line = session.getLine(row);
275 var indent = line.search(/\S/);
276 var next = session.getLine(row + 1);
277 var prev = session.getLine(row - 1);
278 var prevIndent = prev.search(/\S/);
279 var nextIndent = next.search(/\S/);
280
281 if (indent == -1) {
282 session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
283 return "";
284 }
285 if (prevIndent == -1) {
286 if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
287 session.foldWidgets[row - 1] = "";
288 session.foldWidgets[row + 1] = "";
289 return "start";
290 }
291 } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
292 if (session.getLine(row - 2).search(/\S/) == -1) {
293 session.foldWidgets[row - 1] = "start";
294 session.foldWidgets[row + 1] = "";
295 return "";
296 }
297 }
298
299 if (prevIndent!= -1 && prevIndent < indent)
300 session.foldWidgets[row - 1] = "start";
301 else
302 session.foldWidgets[row - 1] = "";
303
304 if (indent < nextIndent)
305 return "start";
306 else
307 return "";
308 };
309
310 }).call(FoldMode.prototype);
311
312 });
+0
-229
try/ace/mode-matlab.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/matlab', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/matlab_highlight_rules', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var MatlabHighlightRules = require("./matlab_highlight_rules").MatlabHighlightRules;
37 var Range = require("../range").Range;
38
39 var Mode = function() {
40 this.$tokenizer = new Tokenizer(new MatlabHighlightRules().getRules());
41 };
42 oop.inherits(Mode, TextMode);
43
44 (function() {
45
46 this.lineCommentStart = "%";
47 this.blockComment = {start: "%{", end: "%}"};
48
49 }).call(Mode.prototype);
50
51 exports.Mode = Mode;
52
53 });
54
55 define('ace/mode/matlab_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
56
57
58 var oop = require("../lib/oop");
59 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
60
61 var MatlabHighlightRules = function() {
62
63 var keywords = (
64 "break|case|catch|classdef|continue|else|elseif|end|for|function|global|if|otherwise|parfor|persistent|return|spmd|switch|try|while"
65 );
66
67 var builtinConstants = (
68 "true|false|inf|Inf|nan|NaN|eps|pi|ans|nargin|nargout|varargin|varargout"
69 );
70
71 var builtinFunctions = (
72 "abs|accumarray|acos(?:d|h)?|acot(?:d|h)?|acsc(?:d|h)?|actxcontrol(?:list|select)?|actxGetRunningServer|actxserver|addlistener|addpath|addpref|addtodate|"+
73 "airy|align|alim|all|allchild|alpha|alphamap|amd|ancestor|and|angle|annotation|any|area|arrayfun|asec(?:d|h)?|asin(?:d|h)?|assert|assignin|atan(?:2|d|h)?|" +
74 "audiodevinfo|audioplayer|audiorecorder|aufinfo|auread|autumn|auwrite|avifile|aviinfo|aviread|axes|axis|balance|bar(?:3|3h|h)?|base2dec|beep|BeginInvoke|bench|"+
75 "bessel(?:h|i|j|k|y)|beta|betainc|betaincinv|betaln|bicg|bicgstab|bicgstabl|bin2dec|bitand|bitcmp|bitget|bitmax|bitnot|bitor|bitset|bitshift|bitxor|blanks|blkdiag|"+
76 "bone|box|brighten|brush|bsxfun|builddocsearchdb|builtin|bvp4c|bvp5c|bvpget|bvpinit|bvpset|bvpxtend|calendar|calllib|callSoapService|camdolly|cameratoolbar|camlight|"+
77 "camlookat|camorbit|campan|campos|camproj|camroll|camtarget|camup|camva|camzoom|cart2pol|cart2sph|cast|cat|caxis|cd|cdf2rdf|cdfepoch|cdfinfo|cdflib(?:\.(?:close|closeVar|"+
78 "computeEpoch|computeEpoch16|create|createAttr|createVar|delete|deleteAttr|deleteAttrEntry|deleteAttrgEntry|deleteVar|deleteVarRecords|epoch16Breakdown|epochBreakdown|getAttrEntry|"+
79 "getAttrgEntry|getAttrMaxEntry|getAttrMaxgEntry|getAttrName|getAttrNum|getAttrScope|getCacheSize|getChecksum|getCompression|getCompressionCacheSize|getConstantNames|"+
80 "getConstantValue|getCopyright|getFileBackward|getFormat|getLibraryCopyright|getLibraryVersion|getMajority|getName|getNumAttrEntries|getNumAttrgEntries|getNumAttributes|"+
81 "getNumgAttributes|getReadOnlyMode|getStageCacheSize|getValidate|getVarAllocRecords|getVarBlockingFactor|getVarCacheSize|getVarCompression|getVarData|getVarMaxAllocRecNum|"+
82 "getVarMaxWrittenRecNum|getVarName|getVarNum|getVarNumRecsWritten|getVarPadValue|getVarRecordData|getVarReservePercent|getVarsMaxWrittenRecNum|getVarSparseRecords|getVersion|"+
83 "hyperGetVarData|hyperPutVarData|inquire|inquireAttr|inquireAttrEntry|inquireAttrgEntry|inquireVar|open|putAttrEntry|putAttrgEntry|putVarData|putVarRecordData|renameAttr|"+
84 "renameVar|setCacheSize|setChecksum|setCompression|setCompressionCacheSize|setFileBackward|setFormat|setMajority|setReadOnlyMode|setStageCacheSize|setValidate|"+
85 "setVarAllocBlockRecords|setVarBlockingFactor|setVarCacheSize|setVarCompression|setVarInitialRecs|setVarPadValue|SetVarReservePercent|setVarsCacheSize|setVarSparseRecords))?|"+
86 "cdfread|cdfwrite|ceil|cell2mat|cell2struct|celldisp|cellfun|cellplot|cellstr|cgs|checkcode|checkin|checkout|chol|cholinc|cholupdate|circshift|cla|clabel|class|clc|clear|"+
87 "clearvars|clf|clipboard|clock|close|closereq|cmopts|cmpermute|cmunique|colamd|colon|colorbar|colordef|colormap|colormapeditor|colperm|Combine|comet|comet3|commandhistory|"+
88 "commandwindow|compan|compass|complex|computer|cond|condeig|condest|coneplot|conj|containers\.Map|contour(?:3|c|f|slice)?|contrast|conv|conv2|convhull|convhulln|convn|cool|"+
89 "copper|copyfile|copyobj|corrcoef|cos(?:d|h)?|cot(?:d|h)?|cov|cplxpair|cputime|createClassFromWsdl|createSoapMessage|cross|csc(?:d|h)?|csvread|csvwrite|ctranspose|cumprod|"+
90 "cumsum|cumtrapz|curl|customverctrl|cylinder|daqread|daspect|datacursormode|datatipinfo|date|datenum|datestr|datetick|datevec|dbclear|dbcont|dbdown|dblquad|dbmex|dbquit|"+
91 "dbstack|dbstatus|dbstep|dbstop|dbtype|dbup|dde23|ddeget|ddesd|ddeset|deal|deblank|dec2base|dec2bin|dec2hex|decic|deconv|del2|delaunay|delaunay3|delaunayn|DelaunayTri|delete|"+
92 "demo|depdir|depfun|det|detrend|deval|diag|dialog|diary|diff|diffuse|dir|disp|display|dither|divergence|dlmread|dlmwrite|dmperm|doc|docsearch|dos|dot|dragrect|drawnow|dsearch|"+
93 "dsearchn|dynamicprops|echo|echodemo|edit|eig|eigs|ellipj|ellipke|ellipsoid|empty|enableNETfromNetworkDrive|enableservice|EndInvoke|enumeration|eomday|eq|erf|erfc|erfcinv|"+
94 "erfcx|erfinv|error|errorbar|errordlg|etime|etree|etreeplot|eval|evalc|evalin|event\.(?:EventData|listener|PropertyEvent|proplistener)|exifread|exist|exit|exp|expint|expm|"+
95 "expm1|export2wsdlg|eye|ezcontour|ezcontourf|ezmesh|ezmeshc|ezplot|ezplot3|ezpolar|ezsurf|ezsurfc|factor|factorial|fclose|feather|feature|feof|ferror|feval|fft|fft2|fftn|"+
96 "fftshift|fftw|fgetl|fgets|fieldnames|figure|figurepalette|fileattrib|filebrowser|filemarker|fileparts|fileread|filesep|fill|fill3|filter|filter2|find|findall|findfigs|"+
97 "findobj|findstr|finish|fitsdisp|fitsinfo|fitsread|fitswrite|fix|flag|flipdim|fliplr|flipud|floor|flow|fminbnd|fminsearch|fopen|format|fplot|fprintf|frame2im|fread|freqspace|"+
98 "frewind|fscanf|fseek|ftell|FTP|full|fullfile|func2str|functions|funm|fwrite|fzero|gallery|gamma|gammainc|gammaincinv|gammaln|gca|gcbf|gcbo|gcd|gcf|gco|ge|genpath|genvarname|"+
99 "get|getappdata|getenv|getfield|getframe|getpixelposition|getpref|ginput|gmres|gplot|grabcode|gradient|gray|graymon|grid|griddata(?:3|n)?|griddedInterpolant|gsvd|gt|gtext|"+
100 "guidata|guide|guihandles|gunzip|gzip|h5create|h5disp|h5info|h5read|h5readatt|h5write|h5writeatt|hadamard|handle|hankel|hdf|hdf5|hdf5info|hdf5read|hdf5write|hdfinfo|"+
101 "hdfread|hdftool|help|helpbrowser|helpdesk|helpdlg|helpwin|hess|hex2dec|hex2num|hgexport|hggroup|hgload|hgsave|hgsetget|hgtransform|hidden|hilb|hist|histc|hold|home|horzcat|"+
102 "hostid|hot|hsv|hsv2rgb|hypot|ichol|idivide|ifft|ifft2|ifftn|ifftshift|ilu|im2frame|im2java|imag|image|imagesc|imapprox|imfinfo|imformats|import|importdata|imread|imwrite|"+
103 "ind2rgb|ind2sub|inferiorto|info|inline|inmem|inpolygon|input|inputdlg|inputname|inputParser|inspect|instrcallback|instrfind|instrfindall|int2str|integral(?:2|3)?|interp(?:1|"+
104 "1q|2|3|ft|n)|interpstreamspeed|intersect|intmax|intmin|inv|invhilb|ipermute|isa|isappdata|iscell|iscellstr|ischar|iscolumn|isdir|isempty|isequal|isequaln|isequalwithequalnans|"+
105 "isfield|isfinite|isfloat|isglobal|ishandle|ishghandle|ishold|isinf|isinteger|isjava|iskeyword|isletter|islogical|ismac|ismatrix|ismember|ismethod|isnan|isnumeric|isobject|"+
106 "isocaps|isocolors|isonormals|isosurface|ispc|ispref|isprime|isprop|isreal|isrow|isscalar|issorted|isspace|issparse|isstr|isstrprop|isstruct|isstudent|isunix|isvarname|"+
107 "isvector|javaaddpath|javaArray|javachk|javaclasspath|javacomponent|javaMethod|javaMethodEDT|javaObject|javaObjectEDT|javarmpath|jet|keyboard|kron|lasterr|lasterror|"+
108 "lastwarn|lcm|ldivide|ldl|le|legend|legendre|length|libfunctions|libfunctionsview|libisloaded|libpointer|libstruct|license|light|lightangle|lighting|lin2mu|line|lines|"+
109 "linkaxes|linkdata|linkprop|linsolve|linspace|listdlg|listfonts|load|loadlibrary|loadobj|log|log10|log1p|log2|loglog|logm|logspace|lookfor|lower|ls|lscov|lsqnonneg|lsqr|"+
110 "lt|lu|luinc|magic|makehgtform|mat2cell|mat2str|material|matfile|matlab\.io\.MatFile|matlab\.mixin\.(?:Copyable|Heterogeneous(?:\.getDefaultScalarElement)?)|matlabrc|"+
111 "matlabroot|max|maxNumCompThreads|mean|median|membrane|memmapfile|memory|menu|mesh|meshc|meshgrid|meshz|meta\.(?:class(?:\.fromName)?|DynamicProperty|EnumeratedValue|event|"+
112 "MetaData|method|package(?:\.(?:fromName|getAllPackages))?|property)|metaclass|methods|methodsview|mex(?:\.getCompilerConfigurations)?|MException|mexext|mfilename|min|minres|"+
113 "minus|mislocked|mkdir|mkpp|mldivide|mlint|mlintrpt|mlock|mmfileinfo|mmreader|mod|mode|more|move|movefile|movegui|movie|movie2avi|mpower|mrdivide|msgbox|mtimes|mu2lin|"+
114 "multibandread|multibandwrite|munlock|namelengthmax|nargchk|narginchk|nargoutchk|native2unicode|nccreate|ncdisp|nchoosek|ncinfo|ncread|ncreadatt|ncwrite|ncwriteatt|"+
115 "ncwriteschema|ndgrid|ndims|ne|NET(?:\.(?:addAssembly|Assembly|convertArray|createArray|createGeneric|disableAutoRelease|enableAutoRelease|GenericClass|invokeGenericMethod|"+
116 "NetException|setStaticProperty))?|netcdf\.(?:abort|close|copyAtt|create|defDim|defGrp|defVar|defVarChunking|defVarDeflate|defVarFill|defVarFletcher32|delAtt|endDef|getAtt|"+
117 "getChunkCache|getConstant|getConstantNames|getVar|inq|inqAtt|inqAttID|inqAttName|inqDim|inqDimID|inqDimIDs|inqFormat|inqGrpName|inqGrpNameFull|inqGrpParent|inqGrps|"+
118 "inqLibVers|inqNcid|inqUnlimDims|inqVar|inqVarChunking|inqVarDeflate|inqVarFill|inqVarFletcher32|inqVarID|inqVarIDs|open|putAtt|putVar|reDef|renameAtt|renameDim|renameVar|"+
119 "setChunkCache|setDefaultFormat|setFill|sync)|newplot|nextpow2|nnz|noanimate|nonzeros|norm|normest|not|notebook|now|nthroot|null|num2cell|num2hex|num2str|numel|nzmax|"+
120 "ode(?:113|15i|15s|23|23s|23t|23tb|45)|odeget|odeset|odextend|onCleanup|ones|open|openfig|opengl|openvar|optimget|optimset|or|ordeig|orderfields|ordqz|ordschur|orient|"+
121 "orth|pack|padecoef|pagesetupdlg|pan|pareto|parseSoapResponse|pascal|patch|path|path2rc|pathsep|pathtool|pause|pbaspect|pcg|pchip|pcode|pcolor|pdepe|pdeval|peaks|perl|perms|"+
122 "permute|pie|pink|pinv|planerot|playshow|plot|plot3|plotbrowser|plotedit|plotmatrix|plottools|plotyy|plus|pol2cart|polar|poly|polyarea|polyder|polyeig|polyfit|polyint|polyval|"+
123 "polyvalm|pow2|power|ppval|prefdir|preferences|primes|print|printdlg|printopt|printpreview|prod|profile|profsave|propedit|propertyeditor|psi|publish|PutCharArray|PutFullMatrix|"+
124 "PutWorkspaceData|pwd|qhull|qmr|qr|qrdelete|qrinsert|qrupdate|quad|quad2d|quadgk|quadl|quadv|questdlg|quit|quiver|quiver3|qz|rand|randi|randn|randperm|RandStream(?:\.(?:create|"+
125 "getDefaultStream|getGlobalStream|list|setDefaultStream|setGlobalStream))?|rank|rat|rats|rbbox|rcond|rdivide|readasync|real|reallog|realmax|realmin|realpow|realsqrt|record|"+
126 "rectangle|rectint|recycle|reducepatch|reducevolume|refresh|refreshdata|regexp|regexpi|regexprep|regexptranslate|rehash|rem|Remove|RemoveAll|repmat|reset|reshape|residue|"+
127 "restoredefaultpath|rethrow|rgb2hsv|rgb2ind|rgbplot|ribbon|rmappdata|rmdir|rmfield|rmpath|rmpref|rng|roots|rose|rosser|rot90|rotate|rotate3d|round|rref|rsf2csf|run|save|saveas|"+
128 "saveobj|savepath|scatter|scatter3|schur|sec|secd|sech|selectmoveresize|semilogx|semilogy|sendmail|serial|set|setappdata|setdiff|setenv|setfield|setpixelposition|setpref|setstr|"+
129 "setxor|shading|shg|shiftdim|showplottool|shrinkfaces|sign|sin(?:d|h)?|size|slice|smooth3|snapnow|sort|sortrows|sound|soundsc|spalloc|spaugment|spconvert|spdiags|specular|speye|"+
130 "spfun|sph2cart|sphere|spinmap|spline|spones|spparms|sprand|sprandn|sprandsym|sprank|spring|sprintf|spy|sqrt|sqrtm|squeeze|ss2tf|sscanf|stairs|startup|std|stem|stem3|stopasync|"+
131 "str2double|str2func|str2mat|str2num|strcat|strcmp|strcmpi|stream2|stream3|streamline|streamparticles|streamribbon|streamslice|streamtube|strfind|strjust|strmatch|strncmp|"+
132 "strncmpi|strread|strrep|strtok|strtrim|struct2cell|structfun|strvcat|sub2ind|subplot|subsasgn|subsindex|subspace|subsref|substruct|subvolume|sum|summer|superclasses|superiorto|"+
133 "support|surf|surf2patch|surface|surfc|surfl|surfnorm|svd|svds|swapbytes|symamd|symbfact|symmlq|symrcm|symvar|system|tan(?:d|h)?|tar|tempdir|tempname|tetramesh|texlabel|text|"+
134 "textread|textscan|textwrap|tfqmr|throw|tic|Tiff(?:\.(?:getTagNames|getVersion))?|timer|timerfind|timerfindall|times|timeseries|title|toc|todatenum|toeplitz|toolboxdir|trace|"+
135 "transpose|trapz|treelayout|treeplot|tril|trimesh|triplequad|triplot|TriRep|TriScatteredInterp|trisurf|triu|tscollection|tsearch|tsearchn|tstool|type|typecast|uibuttongroup|"+
136 "uicontextmenu|uicontrol|uigetdir|uigetfile|uigetpref|uiimport|uimenu|uiopen|uipanel|uipushtool|uiputfile|uiresume|uisave|uisetcolor|uisetfont|uisetpref|uistack|uitable|"+
137 "uitoggletool|uitoolbar|uiwait|uminus|undocheckout|unicode2native|union|unique|unix|unloadlibrary|unmesh|unmkpp|untar|unwrap|unzip|uplus|upper|urlread|urlwrite|usejava|"+
138 "userpath|validateattributes|validatestring|vander|var|vectorize|ver|verctrl|verLessThan|version|vertcat|VideoReader(?:\.isPlatformSupported)?|VideoWriter(?:\.getProfiles)?|"+
139 "view|viewmtx|visdiff|volumebounds|voronoi|voronoin|wait|waitbar|waitfor|waitforbuttonpress|warndlg|warning|waterfall|wavfinfo|wavplay|wavread|wavrecord|wavwrite|web|weekday|"+
140 "what|whatsnew|which|whitebg|who|whos|wilkinson|winopen|winqueryreg|winter|wk1finfo|wk1read|wk1write|workspace|xlabel|xlim|xlsfinfo|xlsread|xlswrite|xmlread|xmlwrite|xor|xslt|"+
141 "ylabel|ylim|zeros|zip|zlabel|zlim|zoom|addedvarplot|andrewsplot|anova(?:1|2|n)|ansaribradley|aoctool|barttest|bbdesign|beta(?:cdf|fit|inv|like|pdf|rnd|stat)|bino(?:cdf|fit|inv|"+
142 "pdf|rnd|stat)|biplot|bootci|bootstrp|boxplot|candexch|candgen|canoncorr|capability|capaplot|caseread|casewrite|categorical|ccdesign|cdfplot|chi2(?:cdf|gof|inv|pdf|rnd|stat)|"+
143 "cholcov|Classification(?:BaggedEnsemble|Discriminant(?:\.(?:fit|make|template))?|Ensemble|KNN(?:\.(?:fit|template))?|PartitionedEnsemble|PartitionedModel|Tree(?:\.(?:fit|"+
144 "template))?)|classify|classregtree|cluster|clusterdata|cmdscale|combnk|Compact(?:Classification(?:Discriminant|Ensemble|Tree)|Regression(?:Ensemble|Tree)|TreeBagger)|confusionmat|"+
145 "controlchart|controlrules|cophenet|copula(?:cdf|fit|param|pdf|rnd|stat)|cordexch|corr|corrcov|coxphfit|createns|crosstab|crossval|cvpartition|datasample|dataset|daugment|dcovary|"+
146 "dendrogram|dfittool|disttool|dummyvar|dwtest|ecdf|ecdfhist|ev(?:cdf|fit|inv|like|pdf|rnd|stat)|ExhaustiveSearcher|exp(?:cdf|fit|inv|like|pdf|rnd|stat)|factoran|fcdf|ff2n|finv|"+
147 "fitdist|fitensemble|fpdf|fracfact|fracfactgen|friedman|frnd|fstat|fsurfht|fullfact|gagerr|gam(?:cdf|fit|inv|like|pdf|rnd|stat)|GeneralizedLinearModel(?:\.fit)?|geo(?:cdf|inv|mean|"+
148 "pdf|rnd|stat)|gev(?:cdf|fit|inv|like|pdf|rnd|stat)|gline|glmfit|glmval|glyphplot|gmdistribution(?:\.fit)?|gname|gp(?:cdf|fit|inv|like|pdf|rnd|stat)|gplotmatrix|grp2idx|grpstats|"+
149 "gscatter|haltonset|harmmean|hist3|histfit|hmm(?:decode|estimate|generate|train|viterbi)|hougen|hyge(?:cdf|inv|pdf|rnd|stat)|icdf|inconsistent|interactionplot|invpred|iqr|iwishrnd|"+
150 "jackknife|jbtest|johnsrnd|KDTreeSearcher|kmeans|knnsearch|kruskalwallis|ksdensity|kstest|kstest2|kurtosis|lasso|lassoglm|lassoPlot|leverage|lhsdesign|lhsnorm|lillietest|"+
151 "LinearModel(?:\.fit)?|linhyptest|linkage|logn(?:cdf|fit|inv|like|pdf|rnd|stat)|lsline|mad|mahal|maineffectsplot|manova1|manovacluster|mdscale|mhsample|mle|mlecov|mnpdf|"+
152 "mnrfit|mnrnd|mnrval|moment|multcompare|multivarichart|mvn(?:cdf|pdf|rnd)|mvregress|mvregresslike|mvt(?:cdf|pdf|rnd)|NaiveBayes(?:\.fit)?|nan(?:cov|max|mean|median|min|std|"+
153 "sum|var)|nbin(?:cdf|fit|inv|pdf|rnd|stat)|ncf(?:cdf|inv|pdf|rnd|stat)|nct(?:cdf|inv|pdf|rnd|stat)|ncx2(?:cdf|inv|pdf|rnd|stat)|NeighborSearcher|nlinfit|nlintool|nlmefit|nlmefitsa|"+
154 "nlparci|nlpredci|nnmf|nominal|NonLinearModel(?:\.fit)?|norm(?:cdf|fit|inv|like|pdf|rnd|stat)|normplot|normspec|ordinal|outlierMeasure|parallelcoords|paretotails|partialcorr|"+
155 "pcacov|pcares|pdf|pdist|pdist2|pearsrnd|perfcurve|perms|piecewisedistribution|plsregress|poiss(?:cdf|fit|inv|pdf|rnd|tat)|polyconf|polytool|prctile|princomp|ProbDist(?:Kernel|"+
156 "Parametric|UnivKernel|UnivParam)?|probplot|procrustes|qqplot|qrandset|qrandstream|quantile|randg|random|randsample|randtool|range|rangesearch|ranksum|rayl(?:cdf|fit|inv|pdf|"+
157 "rnd|stat)|rcoplot|refcurve|refline|regress|Regression(?:BaggedEnsemble|Ensemble|PartitionedEnsemble|PartitionedModel|Tree(?:\.(?:fit|template))?)|regstats|relieff|ridge|"+
158 "robustdemo|robustfit|rotatefactors|rowexch|rsmdemo|rstool|runstest|sampsizepwr|scatterhist|sequentialfs|signrank|signtest|silhouette|skewness|slicesample|sobolset|squareform|"+
159 "statget|statset|stepwise|stepwisefit|surfht|tabulate|tblread|tblwrite|tcdf|tdfread|tiedrank|tinv|tpdf|TreeBagger|treedisp|treefit|treeprune|treetest|treeval|trimmean|trnd|tstat|"+
160 "ttest|ttest2|unid(?:cdf|inv|pdf|rnd|stat)|unif(?:cdf|inv|it|pdf|rnd|stat)|vartest(?:2|n)?|wbl(?:cdf|fit|inv|like|pdf|rnd|stat)|wblplot|wishrnd|x2fx|xptread|zscore|ztest"+
161 "adapthisteq|analyze75info|analyze75read|applycform|applylut|axes2pix|bestblk|blockproc|bwarea|bwareaopen|bwboundaries|bwconncomp|bwconvhull|bwdist|bwdistgeodesic|bweuler|"+
162 "bwhitmiss|bwlabel|bwlabeln|bwmorph|bwpack|bwperim|bwselect|bwtraceboundary|bwulterode|bwunpack|checkerboard|col2im|colfilt|conndef|convmtx2|corner|cornermetric|corr2|cp2tform|"+
163 "cpcorr|cpselect|cpstruct2pairs|dct2|dctmtx|deconvblind|deconvlucy|deconvreg|deconvwnr|decorrstretch|demosaic|dicom(?:anon|dict|info|lookup|read|uid|write)|edge|edgetaper|entropy|"+
164 "entropyfilt|fan2para|fanbeam|findbounds|fliptform|freqz2|fsamp2|fspecial|ftrans2|fwind1|fwind2|getheight|getimage|getimagemodel|getline|getneighbors|getnhood|getpts|"+
165 "getrangefromclass|getrect|getsequence|gray2ind|graycomatrix|graycoprops|graydist|grayslice|graythresh|hdrread|hdrwrite|histeq|hough|houghlines|houghpeaks|iccfind|iccread|"+
166 "iccroot|iccwrite|idct2|ifanbeam|im2bw|im2col|im2double|im2int16|im2java2d|im2single|im2uint16|im2uint8|imabsdiff|imadd|imadjust|ImageAdapter|imageinfo|imagemodel|imapplymatrix|"+
167 "imattributes|imbothat|imclearborder|imclose|imcolormaptool|imcomplement|imcontour|imcontrast|imcrop|imdilate|imdisplayrange|imdistline|imdivide|imellipse|imerode|imextendedmax|"+
168 "imextendedmin|imfill|imfilter|imfindcircles|imfreehand|imfuse|imgca|imgcf|imgetfile|imhandles|imhist|imhmax|imhmin|imimposemin|imlincomb|imline|immagbox|immovie|immultiply|imnoise|"+
169 "imopen|imoverview|imoverviewpanel|impixel|impixelinfo|impixelinfoval|impixelregion|impixelregionpanel|implay|impoint|impoly|impositionrect|improfile|imputfile|impyramid|"+
170 "imreconstruct|imrect|imregconfig|imregionalmax|imregionalmin|imregister|imresize|imroi|imrotate|imsave|imscrollpanel|imshow|imshowpair|imsubtract|imtool|imtophat|imtransform|"+
171 "imview|ind2gray|ind2rgb|interfileinfo|interfileread|intlut|ippl|iptaddcallback|iptcheckconn|iptcheckhandle|iptcheckinput|iptcheckmap|iptchecknargin|iptcheckstrs|iptdemos|iptgetapi|"+
172 "iptGetPointerBehavior|iptgetpref|ipticondir|iptnum2ordinal|iptPointerManager|iptprefs|iptremovecallback|iptSetPointerBehavior|iptsetpref|iptwindowalign|iradon|isbw|isflat|isgray|"+
173 "isicc|isind|isnitf|isrgb|isrset|lab2double|lab2uint16|lab2uint8|label2rgb|labelmatrix|makecform|makeConstrainToRectFcn|makehdr|makelut|makeresampler|maketform|mat2gray|mean2|"+
174 "medfilt2|montage|nitfinfo|nitfread|nlfilter|normxcorr2|ntsc2rgb|openrset|ordfilt2|otf2psf|padarray|para2fan|phantom|poly2mask|psf2otf|qtdecomp|qtgetblk|qtsetblk|radon|rangefilt|"+
175 "reflect|regionprops|registration\.metric\.(?:MattesMutualInformation|MeanSquares)|registration\.optimizer\.(?:OnePlusOneEvolutionary|RegularStepGradientDescent)|rgb2gray|"+
176 "rgb2ntsc|rgb2ycbcr|roicolor|roifill|roifilt2|roipoly|rsetwrite|std2|stdfilt|strel|stretchlim|subimage|tformarray|tformfwd|tforminv|tonemap|translate|truesize|uintlut|viscircles|"+
177 "warp|watershed|whitepoint|wiener2|xyz2double|xyz2uint16|ycbcr2rgb|bintprog|color|fgoalattain|fminbnd|fmincon|fminimax|fminsearch|fminunc|fseminf|fsolve|fzero|fzmult|gangstr|ktrlink|"+
178 "linprog|lsqcurvefit|lsqlin|lsqnonlin|lsqnonneg|optimget|optimset|optimtool|quadprog"
179 );
180 var storageType = (
181 "cell|struct|char|double|single|logical|u?int(?:8|16|32|64)|sparse"
182 );
183 var keywordMapper = this.createKeywordMapper({
184 "storage.type": storageType,
185 "support.function": builtinFunctions,
186 "keyword": keywords,
187 "constant.language": builtinConstants
188 }, "identifier", true);
189
190 this.$rules = {
191 "start" : [ {
192 token : "comment",
193 regex : "^%[^\r\n]*"
194 }, {
195 token : "string", // " string
196 regex : '".*?"'
197 }, {
198 token : "string", // ' string
199 regex : "'.*?'"
200 }, {
201 token : "constant.numeric", // float
202 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
203 }, {
204 token : keywordMapper,
205 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
206 }, {
207 token : "keyword.operator",
208 regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
209 }, {
210 token : "punctuation.operator",
211 regex : "\\?|\\:|\\,|\\;|\\."
212 }, {
213 token : "paren.lparen",
214 regex : "[\\(]"
215 }, {
216 token : "paren.rparen",
217 regex : "[\\)]"
218 }, {
219 token : "text",
220 regex : "\\s+"
221 } ]
222 };
223 };
224
225 oop.inherits(MatlabHighlightRules, TextHighlightRules);
226
227 exports.MatlabHighlightRules = MatlabHighlightRules;
228 });
+0
-704
try/ace/mode-mushcode.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/mushcode', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/mushcode_high_rules', 'ace/mode/folding/pythonic', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var MushCodeRules = require("./mushcode_high_rules").MushCodeRules;
37 var PythonFoldMode = require("./folding/pythonic").FoldMode;
38 var Range = require("../range").Range;
39
40 var Mode = function() {
41 this.$tokenizer = new Tokenizer(new MushCodeRules().getRules());
42 this.foldingRules = new PythonFoldMode("\\:");
43 };
44 oop.inherits(Mode, TextMode);
45
46 (function() {
47
48 this.lineCommentStart = "#";
49
50 this.getNextLineIndent = function(state, line, tab) {
51 var indent = this.$getIndent(line);
52
53 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
54 var tokens = tokenizedLine.tokens;
55
56 if (tokens.length && tokens[tokens.length-1].type == "comment") {
57 return indent;
58 }
59
60 if (state == "start") {
61 var match = line.match(/^.*[\{\(\[\:]\s*$/);
62 if (match) {
63 indent += tab;
64 }
65 }
66
67 return indent;
68 };
69
70 var outdents = {
71 "pass": 1,
72 "return": 1,
73 "raise": 1,
74 "break": 1,
75 "continue": 1
76 };
77
78 this.checkOutdent = function(state, line, input) {
79 if (input !== "\r\n" && input !== "\r" && input !== "\n")
80 return false;
81
82 var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
83
84 if (!tokens)
85 return false;
86 do {
87 var last = tokens.pop();
88 } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
89
90 if (!last)
91 return false;
92
93 return (last.type == "keyword" && outdents[last.value]);
94 };
95
96 this.autoOutdent = function(state, doc, row) {
97
98 row += 1;
99 var indent = this.$getIndent(doc.getLine(row));
100 var tab = doc.getTabString();
101 if (indent.slice(-tab.length) == tab)
102 doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
103 };
104
105 }).call(Mode.prototype);
106
107 exports.Mode = Mode;
108 });
109
110 define('ace/mode/mushcode_high_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
111
112
113 var oop = require("../lib/oop");
114 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
115
116 var MushCodeRules = function() {
117
118
119 var keywords = (
120 "@if|"+
121 "@ifelse|"+
122 "@switch|"+
123 "@halt|"+
124 "@dolist|"+
125 "@create|"+
126 "@scent|"+
127 "@sound|"+
128 "@touch|"+
129 "@ataste|"+
130 "@osound|"+
131 "@ahear|"+
132 "@aahear|"+
133 "@amhear|"+
134 "@otouch|"+
135 "@otaste|"+
136 "@drop|"+
137 "@odrop|"+
138 "@adrop|"+
139 "@dropfail|"+
140 "@odropfail|"+
141 "@smell|"+
142 "@oemit|"+
143 "@emit|"+
144 "@pemit|"+
145 "@parent|"+
146 "@clone|"+
147 "@taste|"+
148 "whisper|"+
149 "page|"+
150 "say|"+
151 "pose|"+
152 "semipose|"+
153 "teach|"+
154 "touch|"+
155 "taste|"+
156 "smell|"+
157 "listen|"+
158 "look|"+
159 "move|"+
160 "go|"+
161 "home|"+
162 "follow|"+
163 "unfollow|"+
164 "desert|"+
165 "dismiss|"+
166 "@tel"
167 );
168
169 var builtinConstants = (
170 "=#0"
171 );
172
173 var builtinFunctions = (
174 "default|"+
175 "edefault|"+
176 "eval|"+
177 "get_eval|"+
178 "get|"+
179 "grep|"+
180 "grepi|"+
181 "hasattr|"+
182 "hasattrp|"+
183 "hasattrval|"+
184 "hasattrpval|"+
185 "lattr|"+
186 "nattr|"+
187 "poss|"+
188 "udefault|"+
189 "ufun|"+
190 "u|"+
191 "v|"+
192 "uldefault|"+
193 "xget|"+
194 "zfun|"+
195 "band|"+
196 "bnand|"+
197 "bnot|"+
198 "bor|"+
199 "bxor|"+
200 "shl|"+
201 "shr|"+
202 "and|"+
203 "cand|"+
204 "cor|"+
205 "eq|"+
206 "gt|"+
207 "gte|"+
208 "lt|"+
209 "lte|"+
210 "nand|"+
211 "neq|"+
212 "nor|"+
213 "not|"+
214 "or|"+
215 "t|"+
216 "xor|"+
217 "con|"+
218 "entrances|"+
219 "exit|"+
220 "followers|"+
221 "home|"+
222 "lcon|"+
223 "lexits|"+
224 "loc|"+
225 "locate|"+
226 "lparent|"+
227 "lsearch|"+
228 "next|"+
229 "num|"+
230 "owner|"+
231 "parent|"+
232 "pmatch|"+
233 "rloc|"+
234 "rnum|"+
235 "room|"+
236 "where|"+
237 "zone|"+
238 "worn|"+
239 "held|"+
240 "carried|"+
241 "acos|"+
242 "asin|"+
243 "atan|"+
244 "ceil|"+
245 "cos|"+
246 "e|"+
247 "exp|"+
248 "fdiv|"+
249 "fmod|"+
250 "floor|"+
251 "log|"+
252 "ln|"+
253 "pi|"+
254 "power|"+
255 "round|"+
256 "sin|"+
257 "sqrt|"+
258 "tan|"+
259 "aposs|"+
260 "andflags|"+
261 "conn|"+
262 "commandssent|"+
263 "controls|"+
264 "doing|"+
265 "elock|"+
266 "findable|"+
267 "flags|"+
268 "fullname|"+
269 "hasflag|"+
270 "haspower|"+
271 "hastype|"+
272 "hidden|"+
273 "idle|"+
274 "isbaker|"+
275 "lock|"+
276 "lstats|"+
277 "money|"+
278 "who|"+
279 "name|"+
280 "nearby|"+
281 "obj|"+
282 "objflags|"+
283 "photo|"+
284 "poll|"+
285 "powers|"+
286 "pendingtext|"+
287 "receivedtext|"+
288 "restarts|"+
289 "restarttime|"+
290 "subj|"+
291 "shortestpath|"+
292 "tmoney|"+
293 "type|"+
294 "visible|"+
295 "cat|"+
296 "element|"+
297 "elements|"+
298 "extract|"+
299 "filter|"+
300 "filterbool|"+
301 "first|"+
302 "foreach|"+
303 "fold|"+
304 "grab|"+
305 "graball|"+
306 "index|"+
307 "insert|"+
308 "itemize|"+
309 "items|"+
310 "iter|"+
311 "last|"+
312 "ldelete|"+
313 "map|"+
314 "match|"+
315 "matchall|"+
316 "member|"+
317 "mix|"+
318 "munge|"+
319 "pick|"+
320 "remove|"+
321 "replace|"+
322 "rest|"+
323 "revwords|"+
324 "setdiff|"+
325 "setinter|"+
326 "setunion|"+
327 "shuffle|"+
328 "sort|"+
329 "sortby|"+
330 "splice|"+
331 "step|"+
332 "wordpos|"+
333 "words|"+
334 "add|"+
335 "lmath|"+
336 "max|"+
337 "mean|"+
338 "median|"+
339 "min|"+
340 "mul|"+
341 "percent|"+
342 "sign|"+
343 "stddev|"+
344 "sub|"+
345 "val|"+
346 "bound|"+
347 "abs|"+
348 "inc|"+
349 "dec|"+
350 "dist2d|"+
351 "dist3d|"+
352 "div|"+
353 "floordiv|"+
354 "mod|"+
355 "modulo|"+
356 "remainder|"+
357 "vadd|"+
358 "vdim|"+
359 "vdot|"+
360 "vmag|"+
361 "vmax|"+
362 "vmin|"+
363 "vmul|"+
364 "vsub|"+
365 "vunit|"+
366 "regedit|"+
367 "regeditall|"+
368 "regeditalli|"+
369 "regediti|"+
370 "regmatch|"+
371 "regmatchi|"+
372 "regrab|"+
373 "regraball|"+
374 "regraballi|"+
375 "regrabi|"+
376 "regrep|"+
377 "regrepi|"+
378 "after|"+
379 "alphamin|"+
380 "alphamax|"+
381 "art|"+
382 "before|"+
383 "brackets|"+
384 "capstr|"+
385 "case|"+
386 "caseall|"+
387 "center|"+
388 "containsfansi|"+
389 "comp|"+
390 "decompose|"+
391 "decrypt|"+
392 "delete|"+
393 "edit|"+
394 "encrypt|"+
395 "escape|"+
396 "if|"+
397 "ifelse|"+
398 "lcstr|"+
399 "left|"+
400 "lit|"+
401 "ljust|"+
402 "merge|"+
403 "mid|"+
404 "ostrlen|"+
405 "pos|"+
406 "repeat|"+
407 "reverse|"+
408 "right|"+
409 "rjust|"+
410 "scramble|"+
411 "secure|"+
412 "space|"+
413 "spellnum|"+
414 "squish|"+
415 "strcat|"+
416 "strmatch|"+
417 "strinsert|"+
418 "stripansi|"+
419 "stripfansi|"+
420 "strlen|"+
421 "switch|"+
422 "switchall|"+
423 "table|"+
424 "tr|"+
425 "trim|"+
426 "ucstr|"+
427 "unsafe|"+
428 "wrap|"+
429 "ctitle|"+
430 "cwho|"+
431 "channels|"+
432 "clock|"+
433 "cflags|"+
434 "ilev|"+
435 "itext|"+
436 "inum|"+
437 "convsecs|"+
438 "convutcsecs|"+
439 "convtime|"+
440 "ctime|"+
441 "etimefmt|"+
442 "isdaylight|"+
443 "mtime|"+
444 "secs|"+
445 "msecs|"+
446 "starttime|"+
447 "time|"+
448 "timefmt|"+
449 "timestring|"+
450 "utctime|"+
451 "atrlock|"+
452 "clone|"+
453 "create|"+
454 "cook|"+
455 "dig|"+
456 "emit|"+
457 "lemit|"+
458 "link|"+
459 "oemit|"+
460 "open|"+
461 "pemit|"+
462 "remit|"+
463 "set|"+
464 "tel|"+
465 "wipe|"+
466 "zemit|"+
467 "fbcreate|"+
468 "fbdestroy|"+
469 "fbwrite|"+
470 "fbclear|"+
471 "fbcopy|"+
472 "fbcopyto|"+
473 "fbclip|"+
474 "fbdump|"+
475 "fbflush|"+
476 "fbhset|"+
477 "fblist|"+
478 "fbstats|"+
479 "qentries|"+
480 "qentry|"+
481 "play|"+
482 "ansi|"+
483 "break|"+
484 "c|"+
485 "asc|"+
486 "die|"+
487 "isdbref|"+
488 "isint|"+
489 "isnum|"+
490 "isletters|"+
491 "linecoords|"+
492 "localize|"+
493 "lnum|"+
494 "nameshort|"+
495 "null|"+
496 "objeval|"+
497 "r|"+
498 "rand|"+
499 "s|"+
500 "setq|"+
501 "setr|"+
502 "soundex|"+
503 "soundslike|"+
504 "valid|"+
505 "vchart|"+
506 "vchart2|"+
507 "vlabel|"+
508 "@@|"+
509 "bakerdays|"+
510 "bodybuild|"+
511 "box|"+
512 "capall|"+
513 "catalog|"+
514 "children|"+
515 "ctrailer|"+
516 "darttime|"+
517 "debt|"+
518 "detailbar|"+
519 "exploredroom|"+
520 "fansitoansi|"+
521 "fansitoxansi|"+
522 "fullbar|"+
523 "halfbar|"+
524 "isdarted|"+
525 "isnewbie|"+
526 "isword|"+
527 "lambda|"+
528 "lobjects|"+
529 "lplayers|"+
530 "lthings|"+
531 "lvexits|"+
532 "lvobjects|"+
533 "lvplayers|"+
534 "lvthings|"+
535 "newswrap|"+
536 "numsuffix|"+
537 "playerson|"+
538 "playersthisweek|"+
539 "randomad|"+
540 "randword|"+
541 "realrandword|"+
542 "replacechr|"+
543 "second|"+
544 "splitamount|"+
545 "strlenall|"+
546 "text|"+
547 "third|"+
548 "tofansi|"+
549 "totalac|"+
550 "unique|"+
551 "getaddressroom|"+
552 "listpropertycomm|"+
553 "listpropertyres|"+
554 "lotowner|"+
555 "lotrating|"+
556 "lotratingcount|"+
557 "lotvalue|"+
558 "boughtproduct|"+
559 "companyabb|"+
560 "companyicon|"+
561 "companylist|"+
562 "companyname|"+
563 "companyowners|"+
564 "companyvalue|"+
565 "employees|"+
566 "invested|"+
567 "productlist|"+
568 "productname|"+
569 "productowners|"+
570 "productrating|"+
571 "productratingcount|"+
572 "productsoldat|"+
573 "producttype|"+
574 "ratedproduct|"+
575 "soldproduct|"+
576 "topproducts|"+
577 "totalspentonproduct|"+
578 "totalstock|"+
579 "transfermoney|"+
580 "uniquebuyercount|"+
581 "uniqueproductsbought|"+
582 "validcompany|"+
583 "deletepicture|"+
584 "fbsave|"+
585 "getpicturesecurity|"+
586 "haspicture|"+
587 "listpictures|"+
588 "picturesize|"+
589 "replacecolor|"+
590 "rgbtocolor|"+
591 "savepicture|"+
592 "setpicturesecurity|"+
593 "showpicture|"+
594 "piechart|"+
595 "piechartlabel|"+
596 "createmaze|"+
597 "drawmaze|"+
598 "drawwireframe"
599 );
600 var keywordMapper = this.createKeywordMapper({
601 "invalid.deprecated": "debugger",
602 "support.function": builtinFunctions,
603 "constant.language": builtinConstants,
604 "keyword": keywords
605 }, "identifier");
606
607 var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
608
609 var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
610 var octInteger = "(?:0[oO]?[0-7]+)";
611 var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
612 var binInteger = "(?:0[bB][01]+)";
613 var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
614
615 var exponent = "(?:[eE][+-]?\\d+)";
616 var fraction = "(?:\\.\\d+)";
617 var intPart = "(?:\\d+)";
618 var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
619 var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
620 var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
621
622 this.$rules = {
623 "start" : [
624 {
625 token : "variable", // mush substitution register
626 regex : "%[0-9]{1}"
627 },
628 {
629 token : "variable", // mush substitution register
630 regex : "%q[0-9A-Za-z]{1}"
631 },
632 {
633 token : "variable", // mush special character register
634 regex : "%[a-zA-Z]{1}"
635 },
636 {
637 token: "variable.language",
638 regex: "%[a-z0-9-_]+"
639 },
640 {
641 token : "constant.numeric", // imaginary
642 regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
643 }, {
644 token : "constant.numeric", // float
645 regex : floatNumber
646 }, {
647 token : "constant.numeric", // long integer
648 regex : integer + "[lL]\\b"
649 }, {
650 token : "constant.numeric", // integer
651 regex : integer + "\\b"
652 }, {
653 token : keywordMapper,
654 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
655 }, {
656 token : "keyword.operator",
657 regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|#|%|<<|>>|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
658 }, {
659 token : "paren.lparen",
660 regex : "[\\[\\(\\{]"
661 }, {
662 token : "paren.rparen",
663 regex : "[\\]\\)\\}]"
664 }, {
665 token : "text",
666 regex : "\\s+"
667 } ],
668 };
669 };
670
671 oop.inherits(MushCodeRules, TextHighlightRules);
672
673 exports.MushCodeRules = MushCodeRules;
674 });
675
676 define('ace/mode/folding/pythonic', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
677
678
679 var oop = require("../../lib/oop");
680 var BaseFoldMode = require("./fold_mode").FoldMode;
681
682 var FoldMode = exports.FoldMode = function(markers) {
683 this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$");
684 };
685 oop.inherits(FoldMode, BaseFoldMode);
686
687 (function() {
688
689 this.getFoldWidgetRange = function(session, foldStyle, row) {
690 var line = session.getLine(row);
691 var match = line.match(this.foldingStartMarker);
692 if (match) {
693 if (match[1])
694 return this.openingBracketBlock(session, match[1], row, match.index);
695 if (match[2])
696 return this.indentationBlock(session, row, match.index + match[2].length);
697 return this.indentationBlock(session, row);
698 }
699 }
700
701 }).call(FoldMode.prototype);
702
703 });
+0
-569
try/ace/mode-mushcode_high_rules.js less more
0 /*
1 * MUSHCodeMode
2 */
3
4 define('ace/mode/mushcode_high_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
5
6
7 var oop = require("../lib/oop");
8 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
9
10 var MushCodeRules = function() {
11
12
13 var keywords = (
14 "@if|"+
15 "@ifelse|"+
16 "@switch|"+
17 "@halt|"+
18 "@dolist|"+
19 "@create|"+
20 "@scent|"+
21 "@sound|"+
22 "@touch|"+
23 "@ataste|"+
24 "@osound|"+
25 "@ahear|"+
26 "@aahear|"+
27 "@amhear|"+
28 "@otouch|"+
29 "@otaste|"+
30 "@drop|"+
31 "@odrop|"+
32 "@adrop|"+
33 "@dropfail|"+
34 "@odropfail|"+
35 "@smell|"+
36 "@oemit|"+
37 "@emit|"+
38 "@pemit|"+
39 "@parent|"+
40 "@clone|"+
41 "@taste|"+
42 "whisper|"+
43 "page|"+
44 "say|"+
45 "pose|"+
46 "semipose|"+
47 "teach|"+
48 "touch|"+
49 "taste|"+
50 "smell|"+
51 "listen|"+
52 "look|"+
53 "move|"+
54 "go|"+
55 "home|"+
56 "follow|"+
57 "unfollow|"+
58 "desert|"+
59 "dismiss|"+
60 "@tel"
61 );
62
63 var builtinConstants = (
64 "=#0"
65 );
66
67 var builtinFunctions = (
68 "default|"+
69 "edefault|"+
70 "eval|"+
71 "get_eval|"+
72 "get|"+
73 "grep|"+
74 "grepi|"+
75 "hasattr|"+
76 "hasattrp|"+
77 "hasattrval|"+
78 "hasattrpval|"+
79 "lattr|"+
80 "nattr|"+
81 "poss|"+
82 "udefault|"+
83 "ufun|"+
84 "u|"+
85 "v|"+
86 "uldefault|"+
87 "xget|"+
88 "zfun|"+
89 "band|"+
90 "bnand|"+
91 "bnot|"+
92 "bor|"+
93 "bxor|"+
94 "shl|"+
95 "shr|"+
96 "and|"+
97 "cand|"+
98 "cor|"+
99 "eq|"+
100 "gt|"+
101 "gte|"+
102 "lt|"+
103 "lte|"+
104 "nand|"+
105 "neq|"+
106 "nor|"+
107 "not|"+
108 "or|"+
109 "t|"+
110 "xor|"+
111 "con|"+
112 "entrances|"+
113 "exit|"+
114 "followers|"+
115 "home|"+
116 "lcon|"+
117 "lexits|"+
118 "loc|"+
119 "locate|"+
120 "lparent|"+
121 "lsearch|"+
122 "next|"+
123 "num|"+
124 "owner|"+
125 "parent|"+
126 "pmatch|"+
127 "rloc|"+
128 "rnum|"+
129 "room|"+
130 "where|"+
131 "zone|"+
132 "worn|"+
133 "held|"+
134 "carried|"+
135 "acos|"+
136 "asin|"+
137 "atan|"+
138 "ceil|"+
139 "cos|"+
140 "e|"+
141 "exp|"+
142 "fdiv|"+
143 "fmod|"+
144 "floor|"+
145 "log|"+
146 "ln|"+
147 "pi|"+
148 "power|"+
149 "round|"+
150 "sin|"+
151 "sqrt|"+
152 "tan|"+
153 "aposs|"+
154 "andflags|"+
155 "conn|"+
156 "commandssent|"+
157 "controls|"+
158 "doing|"+
159 "elock|"+
160 "findable|"+
161 "flags|"+
162 "fullname|"+
163 "hasflag|"+
164 "haspower|"+
165 "hastype|"+
166 "hidden|"+
167 "idle|"+
168 "isbaker|"+
169 "lock|"+
170 "lstats|"+
171 "money|"+
172 "who|"+
173 "name|"+
174 "nearby|"+
175 "obj|"+
176 "objflags|"+
177 "photo|"+
178 "poll|"+
179 "powers|"+
180 "pendingtext|"+
181 "receivedtext|"+
182 "restarts|"+
183 "restarttime|"+
184 "subj|"+
185 "shortestpath|"+
186 "tmoney|"+
187 "type|"+
188 "visible|"+
189 "cat|"+
190 "element|"+
191 "elements|"+
192 "extract|"+
193 "filter|"+
194 "filterbool|"+
195 "first|"+
196 "foreach|"+
197 "fold|"+
198 "grab|"+
199 "graball|"+
200 "index|"+
201 "insert|"+
202 "itemize|"+
203 "items|"+
204 "iter|"+
205 "last|"+
206 "ldelete|"+
207 "map|"+
208 "match|"+
209 "matchall|"+
210 "member|"+
211 "mix|"+
212 "munge|"+
213 "pick|"+
214 "remove|"+
215 "replace|"+
216 "rest|"+
217 "revwords|"+
218 "setdiff|"+
219 "setinter|"+
220 "setunion|"+
221 "shuffle|"+
222 "sort|"+
223 "sortby|"+
224 "splice|"+
225 "step|"+
226 "wordpos|"+
227 "words|"+
228 "add|"+
229 "lmath|"+
230 "max|"+
231 "mean|"+
232 "median|"+
233 "min|"+
234 "mul|"+
235 "percent|"+
236 "sign|"+
237 "stddev|"+
238 "sub|"+
239 "val|"+
240 "bound|"+
241 "abs|"+
242 "inc|"+
243 "dec|"+
244 "dist2d|"+
245 "dist3d|"+
246 "div|"+
247 "floordiv|"+
248 "mod|"+
249 "modulo|"+
250 "remainder|"+
251 "vadd|"+
252 "vdim|"+
253 "vdot|"+
254 "vmag|"+
255 "vmax|"+
256 "vmin|"+
257 "vmul|"+
258 "vsub|"+
259 "vunit|"+
260 "regedit|"+
261 "regeditall|"+
262 "regeditalli|"+
263 "regediti|"+
264 "regmatch|"+
265 "regmatchi|"+
266 "regrab|"+
267 "regraball|"+
268 "regraballi|"+
269 "regrabi|"+
270 "regrep|"+
271 "regrepi|"+
272 "after|"+
273 "alphamin|"+
274 "alphamax|"+
275 "art|"+
276 "before|"+
277 "brackets|"+
278 "capstr|"+
279 "case|"+
280 "caseall|"+
281 "center|"+
282 "containsfansi|"+
283 "comp|"+
284 "decompose|"+
285 "decrypt|"+
286 "delete|"+
287 "edit|"+
288 "encrypt|"+
289 "escape|"+
290 "if|"+
291 "ifelse|"+
292 "lcstr|"+
293 "left|"+
294 "lit|"+
295 "ljust|"+
296 "merge|"+
297 "mid|"+
298 "ostrlen|"+
299 "pos|"+
300 "repeat|"+
301 "reverse|"+
302 "right|"+
303 "rjust|"+
304 "scramble|"+
305 "secure|"+
306 "space|"+
307 "spellnum|"+
308 "squish|"+
309 "strcat|"+
310 "strmatch|"+
311 "strinsert|"+
312 "stripansi|"+
313 "stripfansi|"+
314 "strlen|"+
315 "switch|"+
316 "switchall|"+
317 "table|"+
318 "tr|"+
319 "trim|"+
320 "ucstr|"+
321 "unsafe|"+
322 "wrap|"+
323 "ctitle|"+
324 "cwho|"+
325 "channels|"+
326 "clock|"+
327 "cflags|"+
328 "ilev|"+
329 "itext|"+
330 "inum|"+
331 "convsecs|"+
332 "convutcsecs|"+
333 "convtime|"+
334 "ctime|"+
335 "etimefmt|"+
336 "isdaylight|"+
337 "mtime|"+
338 "secs|"+
339 "msecs|"+
340 "starttime|"+
341 "time|"+
342 "timefmt|"+
343 "timestring|"+
344 "utctime|"+
345 "atrlock|"+
346 "clone|"+
347 "create|"+
348 "cook|"+
349 "dig|"+
350 "emit|"+
351 "lemit|"+
352 "link|"+
353 "oemit|"+
354 "open|"+
355 "pemit|"+
356 "remit|"+
357 "set|"+
358 "tel|"+
359 "wipe|"+
360 "zemit|"+
361 "fbcreate|"+
362 "fbdestroy|"+
363 "fbwrite|"+
364 "fbclear|"+
365 "fbcopy|"+
366 "fbcopyto|"+
367 "fbclip|"+
368 "fbdump|"+
369 "fbflush|"+
370 "fbhset|"+
371 "fblist|"+
372 "fbstats|"+
373 "qentries|"+
374 "qentry|"+
375 "play|"+
376 "ansi|"+
377 "break|"+
378 "c|"+
379 "asc|"+
380 "die|"+
381 "isdbref|"+
382 "isint|"+
383 "isnum|"+
384 "isletters|"+
385 "linecoords|"+
386 "localize|"+
387 "lnum|"+
388 "nameshort|"+
389 "null|"+
390 "objeval|"+
391 "r|"+
392 "rand|"+
393 "s|"+
394 "setq|"+
395 "setr|"+
396 "soundex|"+
397 "soundslike|"+
398 "valid|"+
399 "vchart|"+
400 "vchart2|"+
401 "vlabel|"+
402 "@@|"+
403 "bakerdays|"+
404 "bodybuild|"+
405 "box|"+
406 "capall|"+
407 "catalog|"+
408 "children|"+
409 "ctrailer|"+
410 "darttime|"+
411 "debt|"+
412 "detailbar|"+
413 "exploredroom|"+
414 "fansitoansi|"+
415 "fansitoxansi|"+
416 "fullbar|"+
417 "halfbar|"+
418 "isdarted|"+
419 "isnewbie|"+
420 "isword|"+
421 "lambda|"+
422 "lobjects|"+
423 "lplayers|"+
424 "lthings|"+
425 "lvexits|"+
426 "lvobjects|"+
427 "lvplayers|"+
428 "lvthings|"+
429 "newswrap|"+
430 "numsuffix|"+
431 "playerson|"+
432 "playersthisweek|"+
433 "randomad|"+
434 "randword|"+
435 "realrandword|"+
436 "replacechr|"+
437 "second|"+
438 "splitamount|"+
439 "strlenall|"+
440 "text|"+
441 "third|"+
442 "tofansi|"+
443 "totalac|"+
444 "unique|"+
445 "getaddressroom|"+
446 "listpropertycomm|"+
447 "listpropertyres|"+
448 "lotowner|"+
449 "lotrating|"+
450 "lotratingcount|"+
451 "lotvalue|"+
452 "boughtproduct|"+
453 "companyabb|"+
454 "companyicon|"+
455 "companylist|"+
456 "companyname|"+
457 "companyowners|"+
458 "companyvalue|"+
459 "employees|"+
460 "invested|"+
461 "productlist|"+
462 "productname|"+
463 "productowners|"+
464 "productrating|"+
465 "productratingcount|"+
466 "productsoldat|"+
467 "producttype|"+
468 "ratedproduct|"+
469 "soldproduct|"+
470 "topproducts|"+
471 "totalspentonproduct|"+
472 "totalstock|"+
473 "transfermoney|"+
474 "uniquebuyercount|"+
475 "uniqueproductsbought|"+
476 "validcompany|"+
477 "deletepicture|"+
478 "fbsave|"+
479 "getpicturesecurity|"+
480 "haspicture|"+
481 "listpictures|"+
482 "picturesize|"+
483 "replacecolor|"+
484 "rgbtocolor|"+
485 "savepicture|"+
486 "setpicturesecurity|"+
487 "showpicture|"+
488 "piechart|"+
489 "piechartlabel|"+
490 "createmaze|"+
491 "drawmaze|"+
492 "drawwireframe"
493 );
494 var keywordMapper = this.createKeywordMapper({
495 "invalid.deprecated": "debugger",
496 "support.function": builtinFunctions,
497 "constant.language": builtinConstants,
498 "keyword": keywords
499 }, "identifier");
500
501 var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
502
503 var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
504 var octInteger = "(?:0[oO]?[0-7]+)";
505 var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
506 var binInteger = "(?:0[bB][01]+)";
507 var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
508
509 var exponent = "(?:[eE][+-]?\\d+)";
510 var fraction = "(?:\\.\\d+)";
511 var intPart = "(?:\\d+)";
512 var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
513 var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
514 var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
515
516 this.$rules = {
517 "start" : [
518 {
519 token : "variable", // mush substitution register
520 regex : "%[0-9]{1}"
521 },
522 {
523 token : "variable", // mush substitution register
524 regex : "%q[0-9A-Za-z]{1}"
525 },
526 {
527 token : "variable", // mush special character register
528 regex : "%[a-zA-Z]{1}"
529 },
530 {
531 token: "variable.language",
532 regex: "%[a-z0-9-_]+"
533 },
534 {
535 token : "constant.numeric", // imaginary
536 regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
537 }, {
538 token : "constant.numeric", // float
539 regex : floatNumber
540 }, {
541 token : "constant.numeric", // long integer
542 regex : integer + "[lL]\\b"
543 }, {
544 token : "constant.numeric", // integer
545 regex : integer + "\\b"
546 }, {
547 token : keywordMapper,
548 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
549 }, {
550 token : "keyword.operator",
551 regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|#|%|<<|>>|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
552 }, {
553 token : "paren.lparen",
554 regex : "[\\[\\(\\{]"
555 }, {
556 token : "paren.rparen",
557 regex : "[\\]\\)\\}]"
558 }, {
559 token : "text",
560 regex : "\\s+"
561 } ],
562 };
563 };
564
565 oop.inherits(MushCodeRules, TextHighlightRules);
566
567 exports.MushCodeRules = MushCodeRules;
568 });
+0
-443
try/ace/mode-ocaml.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/ocaml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ocaml_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var OcamlHighlightRules = require("./ocaml_highlight_rules").OcamlHighlightRules;
37 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38 var Range = require("../range").Range;
39
40 var Mode = function() {
41 this.$tokenizer = new Tokenizer(new OcamlHighlightRules().getRules());
42 this.$outdent = new MatchingBraceOutdent();
43 };
44 oop.inherits(Mode, TextMode);
45
46 var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/;
47
48 (function() {
49
50 this.toggleCommentLines = function(state, doc, startRow, endRow) {
51 var i, line;
52 var outdent = true;
53 var re = /^\s*\(\*(.*)\*\)/;
54
55 for (i=startRow; i<= endRow; i++) {
56 if (!re.test(doc.getLine(i))) {
57 outdent = false;
58 break;
59 }
60 }
61
62 var range = new Range(0, 0, 0, 0);
63 for (i=startRow; i<= endRow; i++) {
64 line = doc.getLine(i);
65 range.start.row = i;
66 range.end.row = i;
67 range.end.column = line.length;
68
69 doc.replace(range, outdent ? line.match(re)[1] : "(*" + line + "*)");
70 }
71 };
72
73 this.getNextLineIndent = function(state, line, tab) {
74 var indent = this.$getIndent(line);
75 var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
76
77 if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
78 state === 'start' && indenter.test(line))
79 indent += tab;
80 return indent;
81 };
82
83 this.checkOutdent = function(state, line, input) {
84 return this.$outdent.checkOutdent(line, input);
85 };
86
87 this.autoOutdent = function(state, doc, row) {
88 this.$outdent.autoOutdent(doc, row);
89 };
90
91 }).call(Mode.prototype);
92
93 exports.Mode = Mode;
94 });
95
96 define('ace/mode/ocaml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
97
98
99 var oop = require("../lib/oop");
100 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
101
102 var OcamlHighlightRules = function() {
103
104 var keywords = (
105 "and|as|assert|begin|class|constraint|do|done|downto|else|end|" +
106 "exception|external|for|fun|function|functor|if|in|include|" +
107 "inherit|initializer|lazy|let|match|method|module|mutable|new|" +
108 "object|of|open|or|private|rec|sig|struct|then|to|try|type|val|" +
109 "virtual|when|while|with"
110 );
111
112 var builtinConstants = ("true|false");
113
114 var builtinFunctions = (
115 "abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|" +
116 "add_available_units|add_big_int|add_buffer|add_channel|add_char|" +
117 "add_initializer|add_int_big_int|add_interfaces|add_num|add_string|" +
118 "add_substitute|add_substring|alarm|allocated_bytes|allow_only|" +
119 "allow_unsafe_modules|always|append|appname_get|appname_set|" +
120 "approx_num_exp|approx_num_fix|arg|argv|arith_status|array|" +
121 "array1_of_genarray|array2_of_genarray|array3_of_genarray|asin|asr|" +
122 "assoc|assq|at_exit|atan|atan2|auto_synchronize|background|basename|" +
123 "beginning_of_input|big_int_of_int|big_int_of_num|big_int_of_string|bind|" +
124 "bind_class|bind_tag|bits|bits_of_float|black|blit|blit_image|blue|bool|" +
125 "bool_of_string|bounded_full_split|bounded_split|bounded_split_delim|" +
126 "bprintf|break|broadcast|bscanf|button_down|c_layout|capitalize|cardinal|" +
127 "cardinal|catch|catch_break|ceil|ceiling_num|channel|char|char_of_int|" +
128 "chdir|check|check_suffix|chmod|choose|chop_extension|chop_suffix|chown|" +
129 "chown|chr|chroot|classify_float|clear|clear_available_units|" +
130 "clear_close_on_exec|clear_graph|clear_nonblock|clear_parser|" +
131 "close|close|closeTk|close_box|close_graph|close_in|close_in_noerr|" +
132 "close_out|close_out_noerr|close_process|close_process|" +
133 "close_process_full|close_process_in|close_process_out|close_subwindow|" +
134 "close_tag|close_tbox|closedir|closedir|closure_tag|code|combine|" +
135 "combine|combine|command|compact|compare|compare_big_int|compare_num|" +
136 "complex32|complex64|concat|conj|connect|contains|contains_from|contents|" +
137 "copy|cos|cosh|count|count|counters|create|create_alarm|create_image|" +
138 "create_matrix|create_matrix|create_matrix|create_object|" +
139 "create_object_and_run_initializers|create_object_opt|create_process|" +
140 "create_process|create_process_env|create_process_env|create_table|" +
141 "current|current_dir_name|current_point|current_x|current_y|curveto|" +
142 "custom_tag|cyan|data_size|decr|decr_num|default_available_units|delay|" +
143 "delete_alarm|descr_of_in_channel|descr_of_out_channel|destroy|diff|dim|" +
144 "dim1|dim2|dim3|dims|dirname|display_mode|div|div_big_int|div_num|" +
145 "double_array_tag|double_tag|draw_arc|draw_char|draw_circle|draw_ellipse|" +
146 "draw_image|draw_poly|draw_poly_line|draw_rect|draw_segments|draw_string|" +
147 "dummy_pos|dummy_table|dump_image|dup|dup2|elements|empty|end_of_input|" +
148 "environment|eprintf|epsilon_float|eq_big_int|eq_num|equal|err_formatter|" +
149 "error_message|escaped|establish_server|executable_name|execv|execve|execvp|" +
150 "execvpe|exists|exists2|exit|exp|failwith|fast_sort|fchmod|fchown|field|" +
151 "file|file_exists|fill|fill_arc|fill_circle|fill_ellipse|fill_poly|fill_rect|" +
152 "filter|final_tag|finalise|find|find_all|first_chars|firstkey|flatten|" +
153 "float|float32|float64|float_of_big_int|float_of_bits|float_of_int|" +
154 "float_of_num|float_of_string|floor|floor_num|flush|flush_all|flush_input|" +
155 "flush_str_formatter|fold|fold_left|fold_left2|fold_right|fold_right2|" +
156 "for_all|for_all2|force|force_newline|force_val|foreground|fork|" +
157 "format_of_string|formatter_of_buffer|formatter_of_out_channel|" +
158 "fortran_layout|forward_tag|fprintf|frexp|from|from_channel|from_file|" +
159 "from_file_bin|from_function|from_string|fscanf|fst|fstat|ftruncate|" +
160 "full_init|full_major|full_split|gcd_big_int|ge_big_int|ge_num|" +
161 "genarray_of_array1|genarray_of_array2|genarray_of_array3|get|" +
162 "get_all_formatter_output_functions|get_approx_printing|get_copy|" +
163 "get_ellipsis_text|get_error_when_null_denominator|get_floating_precision|" +
164 "get_formatter_output_functions|get_formatter_tag_functions|get_image|" +
165 "get_margin|get_mark_tags|get_max_boxes|get_max_indent|get_method|" +
166 "get_method_label|get_normalize_ratio|get_normalize_ratio_when_printing|" +
167 "get_print_tags|get_state|get_variable|getcwd|getegid|getegid|getenv|" +
168 "getenv|getenv|geteuid|geteuid|getgid|getgid|getgrgid|getgrgid|getgrnam|" +
169 "getgrnam|getgroups|gethostbyaddr|gethostbyname|gethostname|getitimer|" +
170 "getlogin|getpeername|getpid|getppid|getprotobyname|getprotobynumber|" +
171 "getpwnam|getpwuid|getservbyname|getservbyport|getsockname|getsockopt|" +
172 "getsockopt_float|getsockopt_int|getsockopt_optint|gettimeofday|getuid|" +
173 "global_replace|global_substitute|gmtime|green|grid|group_beginning|" +
174 "group_end|gt_big_int|gt_num|guard|handle_unix_error|hash|hash_param|" +
175 "hd|header_size|i|id|ignore|in_channel_length|in_channel_of_descr|incr|" +
176 "incr_num|index|index_from|inet_addr_any|inet_addr_of_string|infinity|" +
177 "infix_tag|init|init_class|input|input_binary_int|input_byte|input_char|" +
178 "input_line|input_value|int|int16_signed|int16_unsigned|int32|int64|" +
179 "int8_signed|int8_unsigned|int_of_big_int|int_of_char|int_of_float|" +
180 "int_of_num|int_of_string|integer_num|inter|interactive|inv|invalid_arg|" +
181 "is_block|is_empty|is_implicit|is_int|is_int_big_int|is_integer_num|" +
182 "is_relative|iter|iter2|iteri|join|junk|key_pressed|kill|kind|kprintf|" +
183 "kscanf|land|last_chars|layout|lazy_from_fun|lazy_from_val|lazy_is_val|" +
184 "lazy_tag|ldexp|le_big_int|le_num|length|lexeme|lexeme_char|lexeme_end|" +
185 "lexeme_end_p|lexeme_start|lexeme_start_p|lineto|link|list|listen|lnot|" +
186 "loadfile|loadfile_private|localtime|lock|lockf|log|log10|logand|lognot|" +
187 "logor|logxor|lor|lower_window|lowercase|lseek|lsl|lsr|lstat|lt_big_int|" +
188 "lt_num|lxor|magenta|magic|mainLoop|major|major_slice|make|make_formatter|" +
189 "make_image|make_lexer|make_matrix|make_self_init|map|map2|map_file|mapi|" +
190 "marshal|match_beginning|match_end|matched_group|matched_string|max|" +
191 "max_array_length|max_big_int|max_elt|max_float|max_int|max_num|" +
192 "max_string_length|mem|mem_assoc|mem_assq|memq|merge|min|min_big_int|" +
193 "min_elt|min_float|min_int|min_num|minor|minus_big_int|minus_num|" +
194 "minus_one|mkdir|mkfifo|mktime|mod|mod_big_int|mod_float|mod_num|modf|" +
195 "mouse_pos|moveto|mul|mult_big_int|mult_int_big_int|mult_num|nan|narrow|" +
196 "nat_of_num|nativeint|neg|neg_infinity|new_block|new_channel|new_method|" +
197 "new_variable|next|nextkey|nice|nice|no_scan_tag|norm|norm2|not|npeek|" +
198 "nth|nth_dim|num_digits_big_int|num_dims|num_of_big_int|num_of_int|" +
199 "num_of_nat|num_of_ratio|num_of_string|O|obj|object_tag|ocaml_version|" +
200 "of_array|of_channel|of_float|of_int|of_int32|of_list|of_nativeint|" +
201 "of_string|one|openTk|open_box|open_connection|open_graph|open_hbox|" +
202 "open_hovbox|open_hvbox|open_in|open_in_bin|open_in_gen|open_out|" +
203 "open_out_bin|open_out_gen|open_process|open_process_full|open_process_in|" +
204 "open_process_out|open_subwindow|open_tag|open_tbox|open_temp_file|" +
205 "open_vbox|opendbm|opendir|openfile|or|os_type|out_channel_length|" +
206 "out_channel_of_descr|output|output_binary_int|output_buffer|output_byte|" +
207 "output_char|output_string|output_value|over_max_boxes|pack|params|" +
208 "parent_dir_name|parse|parse_argv|partition|pause|peek|pipe|pixels|" +
209 "place|plot|plots|point_color|polar|poll|pop|pos_in|pos_out|pow|" +
210 "power_big_int_positive_big_int|power_big_int_positive_int|" +
211 "power_int_positive_big_int|power_int_positive_int|power_num|" +
212 "pp_close_box|pp_close_tag|pp_close_tbox|pp_force_newline|" +
213 "pp_get_all_formatter_output_functions|pp_get_ellipsis_text|" +
214 "pp_get_formatter_output_functions|pp_get_formatter_tag_functions|" +
215 "pp_get_margin|pp_get_mark_tags|pp_get_max_boxes|pp_get_max_indent|" +
216 "pp_get_print_tags|pp_open_box|pp_open_hbox|pp_open_hovbox|pp_open_hvbox|" +
217 "pp_open_tag|pp_open_tbox|pp_open_vbox|pp_over_max_boxes|pp_print_as|" +
218 "pp_print_bool|pp_print_break|pp_print_char|pp_print_cut|pp_print_float|" +
219 "pp_print_flush|pp_print_if_newline|pp_print_int|pp_print_newline|" +
220 "pp_print_space|pp_print_string|pp_print_tab|pp_print_tbreak|" +
221 "pp_set_all_formatter_output_functions|pp_set_ellipsis_text|" +
222 "pp_set_formatter_out_channel|pp_set_formatter_output_functions|" +
223 "pp_set_formatter_tag_functions|pp_set_margin|pp_set_mark_tags|" +
224 "pp_set_max_boxes|pp_set_max_indent|pp_set_print_tags|pp_set_tab|" +
225 "pp_set_tags|pred|pred_big_int|pred_num|prerr_char|prerr_endline|" +
226 "prerr_float|prerr_int|prerr_newline|prerr_string|print|print_as|" +
227 "print_bool|print_break|print_char|print_cut|print_endline|print_float|" +
228 "print_flush|print_if_newline|print_int|print_newline|print_space|" +
229 "print_stat|print_string|print_tab|print_tbreak|printf|prohibit|" +
230 "public_method_label|push|putenv|quo_num|quomod_big_int|quote|raise|" +
231 "raise_window|ratio_of_num|rcontains_from|read|read_float|read_int|" +
232 "read_key|read_line|readdir|readdir|readlink|really_input|receive|recv|" +
233 "recvfrom|red|ref|regexp|regexp_case_fold|regexp_string|" +
234 "regexp_string_case_fold|register|register_exception|rem|remember_mode|" +
235 "remove|remove_assoc|remove_assq|rename|replace|replace_first|" +
236 "replace_matched|repr|reset|reshape|reshape_1|reshape_2|reshape_3|rev|" +
237 "rev_append|rev_map|rev_map2|rewinddir|rgb|rhs_end|rhs_end_pos|rhs_start|" +
238 "rhs_start_pos|rindex|rindex_from|rlineto|rmdir|rmoveto|round_num|" +
239 "run_initializers|run_initializers_opt|scanf|search_backward|" +
240 "search_forward|seek_in|seek_out|select|self|self_init|send|sendto|set|" +
241 "set_all_formatter_output_functions|set_approx_printing|" +
242 "set_binary_mode_in|set_binary_mode_out|set_close_on_exec|" +
243 "set_close_on_exec|set_color|set_ellipsis_text|" +
244 "set_error_when_null_denominator|set_field|set_floating_precision|" +
245 "set_font|set_formatter_out_channel|set_formatter_output_functions|" +
246 "set_formatter_tag_functions|set_line_width|set_margin|set_mark_tags|" +
247 "set_max_boxes|set_max_indent|set_method|set_nonblock|set_nonblock|" +
248 "set_normalize_ratio|set_normalize_ratio_when_printing|set_print_tags|" +
249 "set_signal|set_state|set_tab|set_tag|set_tags|set_text_size|" +
250 "set_window_title|setgid|setgid|setitimer|setitimer|setsid|setsid|" +
251 "setsockopt|setsockopt|setsockopt_float|setsockopt_float|setsockopt_int|" +
252 "setsockopt_int|setsockopt_optint|setsockopt_optint|setuid|setuid|" +
253 "shift_left|shift_left|shift_left|shift_right|shift_right|shift_right|" +
254 "shift_right_logical|shift_right_logical|shift_right_logical|show_buckets|" +
255 "shutdown|shutdown|shutdown_connection|shutdown_connection|sigabrt|" +
256 "sigalrm|sigchld|sigcont|sigfpe|sighup|sigill|sigint|sigkill|sign_big_int|" +
257 "sign_num|signal|signal|sigpending|sigpending|sigpipe|sigprocmask|" +
258 "sigprocmask|sigprof|sigquit|sigsegv|sigstop|sigsuspend|sigsuspend|" +
259 "sigterm|sigtstp|sigttin|sigttou|sigusr1|sigusr2|sigvtalrm|sin|singleton|" +
260 "sinh|size|size|size_x|size_y|sleep|sleep|sleep|slice_left|slice_left|" +
261 "slice_left_1|slice_left_2|slice_right|slice_right|slice_right_1|" +
262 "slice_right_2|snd|socket|socket|socket|socketpair|socketpair|sort|sound|" +
263 "split|split_delim|sprintf|sprintf|sqrt|sqrt|sqrt_big_int|square_big_int|" +
264 "square_num|sscanf|stable_sort|stable_sort|stable_sort|stable_sort|stable_sort|" +
265 "stable_sort|stat|stat|stat|stat|stat|stats|stats|std_formatter|stdbuf|" +
266 "stderr|stderr|stderr|stdib|stdin|stdin|stdin|stdout|stdout|stdout|" +
267 "str_formatter|string|string_after|string_before|string_match|" +
268 "string_of_big_int|string_of_bool|string_of_float|string_of_format|" +
269 "string_of_inet_addr|string_of_inet_addr|string_of_int|string_of_num|" +
270 "string_partial_match|string_tag|sub|sub|sub_big_int|sub_left|sub_num|" +
271 "sub_right|subset|subset|substitute_first|substring|succ|succ|" +
272 "succ|succ|succ_big_int|succ_num|symbol_end|symbol_end_pos|symbol_start|" +
273 "symbol_start_pos|symlink|symlink|sync|synchronize|system|system|system|" +
274 "tag|take|tan|tanh|tcdrain|tcdrain|tcflow|tcflow|tcflush|tcflush|" +
275 "tcgetattr|tcgetattr|tcsendbreak|tcsendbreak|tcsetattr|tcsetattr|" +
276 "temp_file|text_size|time|time|time|timed_read|timed_write|times|times|" +
277 "tl|tl|tl|to_buffer|to_channel|to_float|to_hex|to_int|to_int32|to_list|" +
278 "to_list|to_list|to_nativeint|to_string|to_string|to_string|to_string|" +
279 "to_string|top|top|total_size|transfer|transp|truncate|truncate|truncate|" +
280 "truncate|truncate|truncate|try_lock|umask|umask|uncapitalize|uncapitalize|" +
281 "uncapitalize|union|union|unit_big_int|unlink|unlink|unlock|unmarshal|" +
282 "unsafe_blit|unsafe_fill|unsafe_get|unsafe_get|unsafe_set|unsafe_set|" +
283 "update|uppercase|uppercase|uppercase|uppercase|usage|utimes|utimes|wait|" +
284 "wait|wait|wait|wait_next_event|wait_pid|wait_read|wait_signal|" +
285 "wait_timed_read|wait_timed_write|wait_write|waitpid|white|" +
286 "widen|window_id|word_size|wrap|wrap_abort|write|yellow|yield|zero|zero_big_int|" +
287
288 "Arg|Arith_status|Array|Array1|Array2|Array3|ArrayLabels|Big_int|Bigarray|" +
289 "Buffer|Callback|CamlinternalOO|Char|Complex|Condition|Dbm|Digest|Dynlink|" +
290 "Event|Filename|Format|Gc|Genarray|Genlex|Graphics|GraphicsX11|Hashtbl|" +
291 "Int32|Int64|LargeFile|Lazy|Lexing|List|ListLabels|Make|Map|Marshal|" +
292 "MoreLabels|Mutex|Nativeint|Num|Obj|Oo|Parsing|Pervasives|Printexc|" +
293 "Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|" +
294 "Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak"
295 );
296
297 var keywordMapper = this.createKeywordMapper({
298 "variable.language": "this",
299 "keyword": keywords,
300 "constant.language": builtinConstants,
301 "support.function": builtinFunctions
302 }, "identifier");
303
304 var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
305 var octInteger = "(?:0[oO]?[0-7]+)";
306 var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
307 var binInteger = "(?:0[bB][01]+)";
308 var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
309
310 var exponent = "(?:[eE][+-]?\\d+)";
311 var fraction = "(?:\\.\\d+)";
312 var intPart = "(?:\\d+)";
313 var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
314 var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
315 var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
316
317 this.$rules = {
318 "start" : [
319 {
320 token : "comment",
321 regex : '\\(\\*.*?\\*\\)\\s*?$'
322 },
323 {
324 token : "comment",
325 regex : '\\(\\*.*',
326 next : "comment"
327 },
328 {
329 token : "string", // single line
330 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
331 },
332 {
333 token : "string", // single char
334 regex : "'.'"
335 },
336 {
337 token : "string", // " string
338 regex : '"',
339 next : "qstring"
340 },
341 {
342 token : "constant.numeric", // imaginary
343 regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
344 },
345 {
346 token : "constant.numeric", // float
347 regex : floatNumber
348 },
349 {
350 token : "constant.numeric", // integer
351 regex : integer + "\\b"
352 },
353 {
354 token : keywordMapper,
355 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
356 },
357 {
358 token : "keyword.operator",
359 regex : "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|="
360 },
361 {
362 token : "paren.lparen",
363 regex : "[[({]"
364 },
365 {
366 token : "paren.rparen",
367 regex : "[\\])}]"
368 },
369 {
370 token : "text",
371 regex : "\\s+"
372 }
373 ],
374 "comment" : [
375 {
376 token : "comment", // closing comment
377 regex : ".*?\\*\\)",
378 next : "start"
379 },
380 {
381 token : "comment", // comment spanning whole line
382 regex : ".+"
383 }
384 ],
385
386 "qstring" : [
387 {
388 token : "string",
389 regex : '"',
390 next : "start"
391 }, {
392 token : "string",
393 regex : '.+'
394 }
395 ]
396 };
397 };
398
399 oop.inherits(OcamlHighlightRules, TextHighlightRules);
400
401 exports.OcamlHighlightRules = OcamlHighlightRules;
402 });
403
404 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
405
406
407 var Range = require("../range").Range;
408
409 var MatchingBraceOutdent = function() {};
410
411 (function() {
412
413 this.checkOutdent = function(line, input) {
414 if (! /^\s+$/.test(line))
415 return false;
416
417 return /^\s*\}/.test(input);
418 };
419
420 this.autoOutdent = function(doc, row) {
421 var line = doc.getLine(row);
422 var match = line.match(/^(\s*\})/);
423
424 if (!match) return 0;
425
426 var column = match[1].length;
427 var openBracePos = doc.findMatchingBracket({row: row, column: column});
428
429 if (!openBracePos || openBracePos.row == row) return 0;
430
431 var indent = this.$getIndent(doc.getLine(openBracePos.row));
432 doc.replace(new Range(row, 0, row, column-1), indent);
433 };
434
435 this.$getIndent = function(line) {
436 return line.match(/^\s*/)[0];
437 };
438
439 }).call(MatchingBraceOutdent.prototype);
440
441 exports.MatchingBraceOutdent = MatchingBraceOutdent;
442 });
+0
-316
try/ace/mode-perl.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/perl', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/perl_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/folding/cstyle'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules;
37 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38 var Range = require("../range").Range;
39 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
40
41 var Mode = function() {
42 this.$tokenizer = new Tokenizer(new PerlHighlightRules().getRules());
43 this.$outdent = new MatchingBraceOutdent();
44 this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"});
45 };
46 oop.inherits(Mode, TextMode);
47
48 (function() {
49
50 this.lineCommentStart = "#";
51 this.blockComment = [
52 {start: "=begin", end: "=cut"},
53 {start: "=item", end: "=cut"}
54 ];
55
56
57 this.getNextLineIndent = function(state, line, tab) {
58 var indent = this.$getIndent(line);
59
60 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
61 var tokens = tokenizedLine.tokens;
62
63 if (tokens.length && tokens[tokens.length-1].type == "comment") {
64 return indent;
65 }
66
67 if (state == "start") {
68 var match = line.match(/^.*[\{\(\[\:]\s*$/);
69 if (match) {
70 indent += tab;
71 }
72 }
73
74 return indent;
75 };
76
77 this.checkOutdent = function(state, line, input) {
78 return this.$outdent.checkOutdent(line, input);
79 };
80
81 this.autoOutdent = function(state, doc, row) {
82 this.$outdent.autoOutdent(doc, row);
83 };
84
85 }).call(Mode.prototype);
86
87 exports.Mode = Mode;
88 });
89
90 define('ace/mode/perl_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
91
92
93 var oop = require("../lib/oop");
94 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
95
96 var PerlHighlightRules = function() {
97
98 var keywords = (
99 "base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" +
100 "no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars"
101 );
102
103 var buildinConstants = ("ARGV|ENV|INC|SIG");
104
105 var builtinFunctions = (
106 "getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
107 "gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" +
108 "getpeername|setpriority|getprotoent|setprotoent|getpriority|" +
109 "endprotoent|getservent|setservent|endservent|sethostent|socketpair|" +
110 "getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|" +
111 "localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|" +
112 "closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|" +
113 "shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|" +
114 "dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|" +
115 "setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|" +
116 "lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|" +
117 "waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|" +
118 "chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|" +
119 "unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|" +
120 "length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|" +
121 "undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|" +
122 "sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|" +
123 "BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|" +
124 "join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" +
125 "keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" +
126 "eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" +
127 "map|die|uc|lc|do"
128 );
129
130 var keywordMapper = this.createKeywordMapper({
131 "keyword": keywords,
132 "constant.language": buildinConstants,
133 "support.function": builtinFunctions
134 }, "identifier");
135
136 this.$rules = {
137 "start" : [
138 {
139 token : "comment",
140 regex : "#.*$"
141 }, {
142 token : "comment.doc",
143 regex : "^=(?:begin|item)\\b",
144 next : "block_comment"
145 }, {
146 token : "string.regexp",
147 regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
148 }, {
149 token : "string", // single line
150 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
151 }, {
152 token : "string", // multi line string start
153 regex : '["].*\\\\$',
154 next : "qqstring"
155 }, {
156 token : "string", // single line
157 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
158 }, {
159 token : "string", // multi line string start
160 regex : "['].*\\\\$",
161 next : "qstring"
162 }, {
163 token : "constant.numeric", // hex
164 regex : "0x[0-9a-fA-F]+\\b"
165 }, {
166 token : "constant.numeric", // float
167 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
168 }, {
169 token : keywordMapper,
170 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
171 }, {
172 token : "keyword.operator",
173 regex : "\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"
174 }, {
175 token : "lparen",
176 regex : "[[({]"
177 }, {
178 token : "rparen",
179 regex : "[\\])}]"
180 }, {
181 token : "text",
182 regex : "\\s+"
183 }
184 ],
185 "qqstring" : [
186 {
187 token : "string",
188 regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
189 next : "start"
190 }, {
191 token : "string",
192 regex : '.+'
193 }
194 ],
195 "qstring" : [
196 {
197 token : "string",
198 regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
199 next : "start"
200 }, {
201 token : "string",
202 regex : '.+'
203 }
204 ],
205 "block_comment": [
206 {
207 token: "comment.doc",
208 regex: "^=cut\\b",
209 next: "start"
210 },
211 {
212 defaultToken: "comment.doc"
213 }
214 ]
215 };
216 };
217
218 oop.inherits(PerlHighlightRules, TextHighlightRules);
219
220 exports.PerlHighlightRules = PerlHighlightRules;
221 });
222
223 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
224
225
226 var Range = require("../range").Range;
227
228 var MatchingBraceOutdent = function() {};
229
230 (function() {
231
232 this.checkOutdent = function(line, input) {
233 if (! /^\s+$/.test(line))
234 return false;
235
236 return /^\s*\}/.test(input);
237 };
238
239 this.autoOutdent = function(doc, row) {
240 var line = doc.getLine(row);
241 var match = line.match(/^(\s*\})/);
242
243 if (!match) return 0;
244
245 var column = match[1].length;
246 var openBracePos = doc.findMatchingBracket({row: row, column: column});
247
248 if (!openBracePos || openBracePos.row == row) return 0;
249
250 var indent = this.$getIndent(doc.getLine(openBracePos.row));
251 doc.replace(new Range(row, 0, row, column-1), indent);
252 };
253
254 this.$getIndent = function(line) {
255 return line.match(/^\s*/)[0];
256 };
257
258 }).call(MatchingBraceOutdent.prototype);
259
260 exports.MatchingBraceOutdent = MatchingBraceOutdent;
261 });
262
263 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
264
265
266 var oop = require("../../lib/oop");
267 var Range = require("../../range").Range;
268 var BaseFoldMode = require("./fold_mode").FoldMode;
269
270 var FoldMode = exports.FoldMode = function(commentRegex) {
271 if (commentRegex) {
272 this.foldingStartMarker = new RegExp(
273 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
274 );
275 this.foldingStopMarker = new RegExp(
276 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
277 );
278 }
279 };
280 oop.inherits(FoldMode, BaseFoldMode);
281
282 (function() {
283
284 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
285 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
286
287 this.getFoldWidgetRange = function(session, foldStyle, row) {
288 var line = session.getLine(row);
289 var match = line.match(this.foldingStartMarker);
290 if (match) {
291 var i = match.index;
292
293 if (match[1])
294 return this.openingBracketBlock(session, match[1], row, i);
295
296 return session.getCommentFoldRange(row, i + match[0].length, 1);
297 }
298
299 if (foldStyle !== "markbeginend")
300 return;
301
302 var match = line.match(this.foldingStopMarker);
303 if (match) {
304 var i = match.index + match[0].length;
305
306 if (match[1])
307 return this.closingBracketBlock(session, match[1], row, i);
308
309 return session.getCommentFoldRange(row, i, -1);
310 }
311 };
312
313 }).call(FoldMode.prototype);
314
315 });
+0
-929
try/ace/mode-pgsql.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/pgsql', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/pgsql_highlight_rules', 'ace/range'], function(require, exports, module) {
31
32 var oop = require("../lib/oop");
33 var TextMode = require("../mode/text").Mode;
34 var Tokenizer = require("../tokenizer").Tokenizer;
35 var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules;
36 var Range = require("../range").Range;
37
38 var Mode = function() {
39 this.$tokenizer = new Tokenizer(new PgsqlHighlightRules().getRules());
40 };
41 oop.inherits(Mode, TextMode);
42
43 (function() {
44 this.lineCommentStart = "--";
45 this.blockComment = {start: "/*", end: "*/"};
46
47 this.getNextLineIndent = function(state, line, tab) {
48 if (state == "start" || state == "keyword.statementEnd") {
49 return "";
50 } else {
51 return this.$getIndent(line); // Keep whatever indent the previous line has
52 }
53 }
54
55 }).call(Mode.prototype);
56
57 exports.Mode = Mode;
58 });
59
60 define('ace/mode/pgsql_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules', 'ace/mode/perl_highlight_rules', 'ace/mode/python_highlight_rules'], function(require, exports, module) {
61
62 var oop = require("../lib/oop");
63 var lang = require("../lib/lang");
64 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
65 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
66 var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules;
67 var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules;
68
69 var PgsqlHighlightRules = function() {
70 var keywords = (
71 "abort|absolute|abstime|access|aclitem|action|add|admin|after|aggregate|all|also|alter|always|" +
72 "analyse|analyze|and|any|anyarray|anyelement|anyenum|anynonarray|array|as|asc|assertion|" +
73 "assignment|asymmetric|at|attribute|authorization|backward|before|begin|between|bigint|" +
74 "binary|bit|bool|boolean|both|box|bpchar|by|bytea|cache|called|cascade|cascaded|case|cast|" +
75 "catalog|chain|char|character|characteristics|check|checkpoint|cid|cidr|circle|class|close|" +
76 "cluster|coalesce|collate|collation|column|comment|comments|commit|committed|concurrently|" +
77 "configuration|connection|constraint|constraints|content|continue|conversion|copy|cost|" +
78 "create|cross|cstring|csv|current|current_catalog|current_date|current_role|" +
79 "current_schema|current_time|current_timestamp|current_user|cursor|cycle|data|database|" +
80 "date|day|deallocate|dec|decimal|declare|default|defaults|deferrable|deferred|definer|delete|" +
81 "delimiter|delimiters|desc|dictionary|disable|discard|distinct|do|document|domain|double|" +
82 "drop|each|else|enable|encoding|encrypted|end|enum|escape|except|exclude|excluding|exclusive|" +
83 "execute|exists|explain|extension|external|extract|false|family|fdw_handler|fetch|first|" +
84 "float|float4|float8|following|for|force|foreign|forward|freeze|from|full|function|functions|" +
85 "global|grant|granted|greatest|group|gtsvector|handler|having|header|hold|hour|identity|if|" +
86 "ilike|immediate|immutable|implicit|in|including|increment|index|indexes|inet|inherit|" +
87 "inherits|initially|inline|inner|inout|input|insensitive|insert|instead|int|int2|int2vector|" +
88 "int4|int8|integer|internal|intersect|interval|into|invoker|is|isnull|isolation|join|key|label|" +
89 "language|language_handler|large|last|lc_collate|lc_ctype|leading|least|left|level|like|" +
90 "limit|line|listen|load|local|localtime|localtimestamp|location|lock|lseg|macaddr|mapping|" +
91 "match|maxvalue|minute|minvalue|mode|money|month|move|name|names|national|natural|nchar|next|no|" +
92 "none|not|nothing|notify|notnull|nowait|null|nullif|nulls|numeric|object|of|off|offset|oid|oids|" +
93 "oidvector|on|only|opaque|operator|option|options|or|order|out|outer|over|overlaps|overlay|" +
94 "owned|owner|parser|partial|partition|passing|password|path|pg_attribute|pg_auth_members|" +
95 "pg_authid|pg_class|pg_database|pg_node_tree|pg_proc|pg_type|placing|plans|point|polygon|" +
96 "position|preceding|precision|prepare|prepared|preserve|primary|prior|privileges|" +
97 "procedural|procedure|quote|range|read|real|reassign|recheck|record|recursive|ref|refcursor|" +
98 "references|regclass|regconfig|regdictionary|regoper|regoperator|regproc|regprocedure|" +
99 "regtype|reindex|relative|release|reltime|rename|repeatable|replace|replica|reset|restart|" +
100 "restrict|returning|returns|revoke|right|role|rollback|row|rows|rule|savepoint|schema|scroll|" +
101 "search|second|security|select|sequence|sequences|serializable|server|session|session_user|" +
102 "set|setof|share|show|similar|simple|smallint|smgr|some|stable|standalone|start|statement|" +
103 "statistics|stdin|stdout|storage|strict|strip|substring|symmetric|sysid|system|table|tables|" +
104 "tablespace|temp|template|temporary|text|then|tid|time|timestamp|timestamptz|timetz|" +
105 "tinterval|to|trailing|transaction|treat|trigger|trim|true|truncate|trusted|tsquery|tsvector|" +
106 "txid_snapshot|type|unbounded|uncommitted|unencrypted|union|unique|unknown|unlisten|" +
107 "unlogged|until|update|user|using|uuid|vacuum|valid|validate|validator|value|values|varbit|" +
108 "varchar|variadic|varying|verbose|version|view|void|volatile|when|where|whitespace|window|" +
109 "with|without|work|wrapper|write|xid|xml|xmlattributes|xmlconcat|xmlelement|xmlexists|" +
110 "xmlforest|xmlparse|xmlpi|xmlroot|xmlserialize|year|yes|zone"
111 );
112
113
114 var builtinFunctions = (
115 "RI_FKey_cascade_del|RI_FKey_cascade_upd|RI_FKey_check_ins|RI_FKey_check_upd|" +
116 "RI_FKey_noaction_del|RI_FKey_noaction_upd|RI_FKey_restrict_del|RI_FKey_restrict_upd|" +
117 "RI_FKey_setdefault_del|RI_FKey_setdefault_upd|RI_FKey_setnull_del|" +
118 "RI_FKey_setnull_upd|abbrev|abs|abstime|abstimeeq|abstimege|abstimegt|abstimein|abstimele|" +
119 "abstimelt|abstimene|abstimeout|abstimerecv|abstimesend|aclcontains|aclexplode|aclinsert|" +
120 "aclitemeq|aclitemin|aclitemout|aclremove|acos|age|any_in|any_out|anyarray_in|anyarray_out|" +
121 "anyarray_recv|anyarray_send|anyelement_in|anyelement_out|anyenum_in|anyenum_out|" +
122 "anynonarray_in|anynonarray_out|anytextcat|area|areajoinsel|areasel|array_agg|" +
123 "array_agg_finalfn|array_agg_transfn|array_append|array_cat|array_dims|array_eq|" +
124 "array_fill|array_ge|array_gt|array_in|array_larger|array_le|array_length|array_lower|" +
125 "array_lt|array_ndims|array_ne|array_out|array_prepend|array_recv|array_send|" +
126 "array_smaller|array_to_string|array_upper|arraycontained|arraycontains|arrayoverlap|" +
127 "ascii|ascii_to_mic|ascii_to_utf8|asin|atan|atan2|avg|big5_to_euc_tw|big5_to_mic|" +
128 "big5_to_utf8|bit_and|bit_in|bit_length|bit_or|bit_out|bit_recv|bit_send|bitand|bitcat|" +
129 "bitcmp|biteq|bitge|bitgt|bitle|bitlt|bitne|bitnot|bitor|bitshiftleft|bitshiftright|" +
130 "bittypmodin|bittypmodout|bitxor|bool|bool_and|bool_or|booland_statefunc|booleq|boolge|" +
131 "boolgt|boolin|boolle|boollt|boolne|boolor_statefunc|boolout|boolrecv|boolsend|box|" +
132 "box_above|box_above_eq|box_add|box_below|box_below_eq|box_center|box_contain|" +
133 "box_contain_pt|box_contained|box_distance|box_div|box_eq|box_ge|box_gt|box_in|" +
134 "box_intersect|box_le|box_left|box_lt|box_mul|box_out|box_overabove|box_overbelow|" +
135 "box_overlap|box_overleft|box_overright|box_recv|box_right|box_same|box_send|box_sub|" +
136 "bpchar_larger|bpchar_pattern_ge|bpchar_pattern_gt|bpchar_pattern_le|" +
137 "bpchar_pattern_lt|bpchar_smaller|bpcharcmp|bpchareq|bpcharge|bpchargt|bpchariclike|" +
138 "bpcharicnlike|bpcharicregexeq|bpcharicregexne|bpcharin|bpcharle|bpcharlike|bpcharlt|" +
139 "bpcharne|bpcharnlike|bpcharout|bpcharrecv|bpcharregexeq|bpcharregexne|bpcharsend|" +
140 "bpchartypmodin|bpchartypmodout|broadcast|btabstimecmp|btarraycmp|btbeginscan|btboolcmp|" +
141 "btbpchar_pattern_cmp|btbuild|btbuildempty|btbulkdelete|btcharcmp|btcostestimate|" +
142 "btendscan|btfloat48cmp|btfloat4cmp|btfloat84cmp|btfloat8cmp|btgetbitmap|btgettuple|" +
143 "btinsert|btint24cmp|btint28cmp|btint2cmp|btint42cmp|btint48cmp|btint4cmp|btint82cmp|" +
144 "btint84cmp|btint8cmp|btmarkpos|btnamecmp|btoidcmp|btoidvectorcmp|btoptions|btrecordcmp|" +
145 "btreltimecmp|btrescan|btrestrpos|btrim|bttext_pattern_cmp|bttextcmp|bttidcmp|" +
146 "bttintervalcmp|btvacuumcleanup|byteacat|byteacmp|byteaeq|byteage|byteagt|byteain|byteale|" +
147 "bytealike|bytealt|byteane|byteanlike|byteaout|bytearecv|byteasend|cash_cmp|cash_div_cash|" +
148 "cash_div_flt4|cash_div_flt8|cash_div_int2|cash_div_int4|cash_eq|cash_ge|cash_gt|cash_in|" +
149 "cash_le|cash_lt|cash_mi|cash_mul_flt4|cash_mul_flt8|cash_mul_int2|cash_mul_int4|cash_ne|" +
150 "cash_out|cash_pl|cash_recv|cash_send|cash_words|cashlarger|cashsmaller|cbrt|ceil|ceiling|" +
151 "center|char|char_length|character_length|chareq|charge|chargt|charin|charle|charlt|charne|" +
152 "charout|charrecv|charsend|chr|cideq|cidin|cidout|cidr|cidr_in|cidr_out|cidr_recv|cidr_send|" +
153 "cidrecv|cidsend|circle|circle_above|circle_add_pt|circle_below|circle_center|" +
154 "circle_contain|circle_contain_pt|circle_contained|circle_distance|circle_div_pt|" +
155 "circle_eq|circle_ge|circle_gt|circle_in|circle_le|circle_left|circle_lt|circle_mul_pt|" +
156 "circle_ne|circle_out|circle_overabove|circle_overbelow|circle_overlap|circle_overleft|" +
157 "circle_overright|circle_recv|circle_right|circle_same|circle_send|circle_sub_pt|" +
158 "clock_timestamp|close_lb|close_ls|close_lseg|close_pb|close_pl|close_ps|close_sb|" +
159 "close_sl|col_description|concat|concat_ws|contjoinsel|contsel|convert|convert_from|" +
160 "convert_to|corr|cos|cot|count|covar_pop|covar_samp|cstring_in|cstring_out|cstring_recv|" +
161 "cstring_send|cume_dist|current_database|current_query|current_schema|current_schemas|" +
162 "current_setting|current_user|currtid|currtid2|currval|cursor_to_xml|" +
163 "cursor_to_xmlschema|database_to_xml|database_to_xml_and_xmlschema|" +
164 "database_to_xmlschema|date|date_cmp|date_cmp_timestamp|date_cmp_timestamptz|date_eq|" +
165 "date_eq_timestamp|date_eq_timestamptz|date_ge|date_ge_timestamp|date_ge_timestamptz|" +
166 "date_gt|date_gt_timestamp|date_gt_timestamptz|date_in|date_larger|date_le|" +
167 "date_le_timestamp|date_le_timestamptz|date_lt|date_lt_timestamp|date_lt_timestamptz|" +
168 "date_mi|date_mi_interval|date_mii|date_ne|date_ne_timestamp|date_ne_timestamptz|" +
169 "date_out|date_part|date_pl_interval|date_pli|date_recv|date_send|date_smaller|" +
170 "date_trunc|datetime_pl|datetimetz_pl|dcbrt|decode|degrees|dense_rank|dexp|diagonal|" +
171 "diameter|dispell_init|dispell_lexize|dist_cpoly|dist_lb|dist_pb|dist_pc|dist_pl|" +
172 "dist_ppath|dist_ps|dist_sb|dist_sl|div|dlog1|dlog10|domain_in|domain_recv|dpow|dround|" +
173 "dsimple_init|dsimple_lexize|dsnowball_init|dsnowball_lexize|dsqrt|dsynonym_init|" +
174 "dsynonym_lexize|dtrunc|encode|enum_cmp|enum_eq|enum_first|enum_ge|enum_gt|enum_in|" +
175 "enum_larger|enum_last|enum_le|enum_lt|enum_ne|enum_out|enum_range|enum_recv|enum_send|" +
176 "enum_smaller|eqjoinsel|eqsel|euc_cn_to_mic|euc_cn_to_utf8|" +
177 "euc_jis_2004_to_shift_jis_2004|euc_jis_2004_to_utf8|euc_jp_to_mic|euc_jp_to_sjis|" +
178 "euc_jp_to_utf8|euc_kr_to_mic|euc_kr_to_utf8|euc_tw_to_big5|euc_tw_to_mic|" +
179 "euc_tw_to_utf8|every|exp|factorial|family|fdw_handler_in|fdw_handler_out|first_value|" +
180 "float4|float48div|float48eq|float48ge|float48gt|float48le|float48lt|float48mi|float48mul|" +
181 "float48ne|float48pl|float4_accum|float4abs|float4div|float4eq|float4ge|float4gt|float4in|" +
182 "float4larger|float4le|float4lt|float4mi|float4mul|float4ne|float4out|float4pl|float4recv|" +
183 "float4send|float4smaller|float4um|float4up|float8|float84div|float84eq|float84ge|" +
184 "float84gt|float84le|float84lt|float84mi|float84mul|float84ne|float84pl|float8_accum|" +
185 "float8_avg|float8_corr|float8_covar_pop|float8_covar_samp|float8_regr_accum|" +
186 "float8_regr_avgx|float8_regr_avgy|float8_regr_intercept|float8_regr_r2|" +
187 "float8_regr_slope|float8_regr_sxx|float8_regr_sxy|float8_regr_syy|float8_stddev_pop|" +
188 "float8_stddev_samp|float8_var_pop|float8_var_samp|float8abs|float8div|float8eq|" +
189 "float8ge|float8gt|float8in|float8larger|float8le|float8lt|float8mi|float8mul|float8ne|" +
190 "float8out|float8pl|float8recv|float8send|float8smaller|float8um|float8up|floor|" +
191 "flt4_mul_cash|flt8_mul_cash|fmgr_c_validator|fmgr_internal_validator|" +
192 "fmgr_sql_validator|format|format_type|gb18030_to_utf8|gbk_to_utf8|generate_series|" +
193 "generate_subscripts|get_bit|get_byte|get_current_ts_config|getdatabaseencoding|" +
194 "getpgusername|gin_cmp_prefix|gin_cmp_tslexeme|gin_extract_tsquery|" +
195 "gin_extract_tsvector|gin_tsquery_consistent|ginarrayconsistent|ginarrayextract|" +
196 "ginbeginscan|ginbuild|ginbuildempty|ginbulkdelete|gincostestimate|ginendscan|" +
197 "gingetbitmap|gininsert|ginmarkpos|ginoptions|ginqueryarrayextract|ginrescan|" +
198 "ginrestrpos|ginvacuumcleanup|gist_box_compress|gist_box_consistent|" +
199 "gist_box_decompress|gist_box_penalty|gist_box_picksplit|gist_box_same|gist_box_union|" +
200 "gist_circle_compress|gist_circle_consistent|gist_point_compress|" +
201 "gist_point_consistent|gist_point_distance|gist_poly_compress|gist_poly_consistent|" +
202 "gistbeginscan|gistbuild|gistbuildempty|gistbulkdelete|gistcostestimate|gistendscan|" +
203 "gistgetbitmap|gistgettuple|gistinsert|gistmarkpos|gistoptions|gistrescan|gistrestrpos|" +
204 "gistvacuumcleanup|gtsquery_compress|gtsquery_consistent|gtsquery_decompress|" +
205 "gtsquery_penalty|gtsquery_picksplit|gtsquery_same|gtsquery_union|gtsvector_compress|" +
206 "gtsvector_consistent|gtsvector_decompress|gtsvector_penalty|gtsvector_picksplit|" +
207 "gtsvector_same|gtsvector_union|gtsvectorin|gtsvectorout|has_any_column_privilege|" +
208 "has_column_privilege|has_database_privilege|has_foreign_data_wrapper_privilege|" +
209 "has_function_privilege|has_language_privilege|has_schema_privilege|" +
210 "has_sequence_privilege|has_server_privilege|has_table_privilege|" +
211 "has_tablespace_privilege|hash_aclitem|hash_array|hash_numeric|hashbeginscan|" +
212 "hashbpchar|hashbuild|hashbuildempty|hashbulkdelete|hashchar|hashcostestimate|" +
213 "hashendscan|hashenum|hashfloat4|hashfloat8|hashgetbitmap|hashgettuple|hashinet|" +
214 "hashinsert|hashint2|hashint2vector|hashint4|hashint8|hashmacaddr|hashmarkpos|hashname|" +
215 "hashoid|hashoidvector|hashoptions|hashrescan|hashrestrpos|hashtext|hashvacuumcleanup|" +
216 "hashvarlena|height|host|hostmask|iclikejoinsel|iclikesel|icnlikejoinsel|icnlikesel|" +
217 "icregexeqjoinsel|icregexeqsel|icregexnejoinsel|icregexnesel|inet_client_addr|" +
218 "inet_client_port|inet_in|inet_out|inet_recv|inet_send|inet_server_addr|" +
219 "inet_server_port|inetand|inetmi|inetmi_int8|inetnot|inetor|inetpl|initcap|int2|int24div|" +
220 "int24eq|int24ge|int24gt|int24le|int24lt|int24mi|int24mul|int24ne|int24pl|int28div|int28eq|" +
221 "int28ge|int28gt|int28le|int28lt|int28mi|int28mul|int28ne|int28pl|int2_accum|" +
222 "int2_avg_accum|int2_mul_cash|int2_sum|int2abs|int2and|int2div|int2eq|int2ge|int2gt|int2in|" +
223 "int2larger|int2le|int2lt|int2mi|int2mod|int2mul|int2ne|int2not|int2or|int2out|int2pl|" +
224 "int2recv|int2send|int2shl|int2shr|int2smaller|int2um|int2up|int2vectoreq|int2vectorin|" +
225 "int2vectorout|int2vectorrecv|int2vectorsend|int2xor|int4|int42div|int42eq|int42ge|" +
226 "int42gt|int42le|int42lt|int42mi|int42mul|int42ne|int42pl|int48div|int48eq|int48ge|int48gt|" +
227 "int48le|int48lt|int48mi|int48mul|int48ne|int48pl|int4_accum|int4_avg_accum|int4_mul_cash|" +
228 "int4_sum|int4abs|int4and|int4div|int4eq|int4ge|int4gt|int4in|int4inc|int4larger|int4le|" +
229 "int4lt|int4mi|int4mod|int4mul|int4ne|int4not|int4or|int4out|int4pl|int4recv|int4send|" +
230 "int4shl|int4shr|int4smaller|int4um|int4up|int4xor|int8|int82div|int82eq|int82ge|int82gt|" +
231 "int82le|int82lt|int82mi|int82mul|int82ne|int82pl|int84div|int84eq|int84ge|int84gt|int84le|" +
232 "int84lt|int84mi|int84mul|int84ne|int84pl|int8_accum|int8_avg|int8_avg_accum|int8_sum|" +
233 "int8abs|int8and|int8div|int8eq|int8ge|int8gt|int8in|int8inc|int8inc_any|" +
234 "int8inc_float8_float8|int8larger|int8le|int8lt|int8mi|int8mod|int8mul|int8ne|int8not|" +
235 "int8or|int8out|int8pl|int8pl_inet|int8recv|int8send|int8shl|int8shr|int8smaller|int8um|" +
236 "int8up|int8xor|integer_pl_date|inter_lb|inter_sb|inter_sl|internal_in|internal_out|" +
237 "interval_accum|interval_avg|interval_cmp|interval_div|interval_eq|interval_ge|" +
238 "interval_gt|interval_hash|interval_in|interval_larger|interval_le|interval_lt|" +
239 "interval_mi|interval_mul|interval_ne|interval_out|interval_pl|interval_pl_date|" +
240 "interval_pl_time|interval_pl_timestamp|interval_pl_timestamptz|interval_pl_timetz|" +
241 "interval_recv|interval_send|interval_smaller|interval_um|intervaltypmodin|" +
242 "intervaltypmodout|intinterval|isclosed|isfinite|ishorizontal|iso8859_1_to_utf8|" +
243 "iso8859_to_utf8|iso_to_koi8r|iso_to_mic|iso_to_win1251|iso_to_win866|isopen|isparallel|" +
244 "isperp|isvertical|johab_to_utf8|justify_days|justify_hours|justify_interval|" +
245 "koi8r_to_iso|koi8r_to_mic|koi8r_to_utf8|koi8r_to_win1251|koi8r_to_win866|" +
246 "koi8u_to_utf8|lag|language_handler_in|language_handler_out|last_value|lastval|" +
247 "latin1_to_mic|latin2_to_mic|latin2_to_win1250|latin3_to_mic|latin4_to_mic|lead|left|" +
248 "length|like|like_escape|likejoinsel|likesel|line|line_distance|line_eq|line_horizontal|" +
249 "line_in|line_interpt|line_intersect|line_out|line_parallel|line_perp|line_recv|" +
250 "line_send|line_vertical|ln|lo_close|lo_creat|lo_create|lo_export|lo_import|lo_lseek|" +
251 "lo_open|lo_tell|lo_truncate|lo_unlink|log|loread|lower|lowrite|lpad|lseg|lseg_center|" +
252 "lseg_distance|lseg_eq|lseg_ge|lseg_gt|lseg_horizontal|lseg_in|lseg_interpt|" +
253 "lseg_intersect|lseg_le|lseg_length|lseg_lt|lseg_ne|lseg_out|lseg_parallel|lseg_perp|" +
254 "lseg_recv|lseg_send|lseg_vertical|ltrim|macaddr_cmp|macaddr_eq|macaddr_ge|macaddr_gt|" +
255 "macaddr_in|macaddr_le|macaddr_lt|macaddr_ne|macaddr_out|macaddr_recv|macaddr_send|" +
256 "makeaclitem|masklen|max|md5|mic_to_ascii|mic_to_big5|mic_to_euc_cn|mic_to_euc_jp|" +
257 "mic_to_euc_kr|mic_to_euc_tw|mic_to_iso|mic_to_koi8r|mic_to_latin1|mic_to_latin2|" +
258 "mic_to_latin3|mic_to_latin4|mic_to_sjis|mic_to_win1250|mic_to_win1251|mic_to_win866|" +
259 "min|mktinterval|mod|money|mul_d_interval|name|nameeq|namege|namegt|nameiclike|nameicnlike|" +
260 "nameicregexeq|nameicregexne|namein|namele|namelike|namelt|namene|namenlike|nameout|" +
261 "namerecv|nameregexeq|nameregexne|namesend|neqjoinsel|neqsel|netmask|network|network_cmp|" +
262 "network_eq|network_ge|network_gt|network_le|network_lt|network_ne|network_sub|" +
263 "network_subeq|network_sup|network_supeq|nextval|nlikejoinsel|nlikesel|notlike|now|" +
264 "npoints|nth_value|ntile|numeric_abs|numeric_accum|numeric_add|numeric_avg|" +
265 "numeric_avg_accum|numeric_cmp|numeric_div|numeric_div_trunc|numeric_eq|numeric_exp|" +
266 "numeric_fac|numeric_ge|numeric_gt|numeric_in|numeric_inc|numeric_larger|numeric_le|" +
267 "numeric_ln|numeric_log|numeric_lt|numeric_mod|numeric_mul|numeric_ne|numeric_out|" +
268 "numeric_power|numeric_recv|numeric_send|numeric_smaller|numeric_sqrt|" +
269 "numeric_stddev_pop|numeric_stddev_samp|numeric_sub|numeric_uminus|numeric_uplus|" +
270 "numeric_var_pop|numeric_var_samp|numerictypmodin|numerictypmodout|numnode|" +
271 "obj_description|octet_length|oid|oideq|oidge|oidgt|oidin|oidlarger|oidle|oidlt|oidne|oidout|" +
272 "oidrecv|oidsend|oidsmaller|oidvectoreq|oidvectorge|oidvectorgt|oidvectorin|oidvectorle|" +
273 "oidvectorlt|oidvectorne|oidvectorout|oidvectorrecv|oidvectorsend|oidvectortypes|on_pb|" +
274 "on_pl|on_ppath|on_ps|on_sb|on_sl|opaque_in|opaque_out|overlaps|overlay|path|path_add|" +
275 "path_add_pt|path_center|path_contain_pt|path_distance|path_div_pt|path_in|path_inter|" +
276 "path_length|path_mul_pt|path_n_eq|path_n_ge|path_n_gt|path_n_le|path_n_lt|path_npoints|" +
277 "path_out|path_recv|path_send|path_sub_pt|pclose|percent_rank|pg_advisory_lock|" +
278 "pg_advisory_lock_shared|pg_advisory_unlock|pg_advisory_unlock_all|" +
279 "pg_advisory_unlock_shared|pg_advisory_xact_lock|pg_advisory_xact_lock_shared|" +
280 "pg_available_extension_versions|pg_available_extensions|pg_backend_pid|" +
281 "pg_cancel_backend|pg_char_to_encoding|pg_client_encoding|pg_collation_is_visible|" +
282 "pg_column_size|pg_conf_load_time|pg_conversion_is_visible|pg_create_restore_point|" +
283 "pg_current_xlog_insert_location|pg_current_xlog_location|pg_cursor|pg_database_size|" +
284 "pg_describe_object|pg_encoding_max_length|pg_encoding_to_char|" +
285 "pg_extension_config_dump|pg_extension_update_paths|pg_function_is_visible|" +
286 "pg_get_constraintdef|pg_get_expr|pg_get_function_arguments|" +
287 "pg_get_function_identity_arguments|pg_get_function_result|pg_get_functiondef|" +
288 "pg_get_indexdef|pg_get_keywords|pg_get_ruledef|pg_get_serial_sequence|" +
289 "pg_get_triggerdef|pg_get_userbyid|pg_get_viewdef|pg_has_role|pg_indexes_size|" +
290 "pg_is_in_recovery|pg_is_other_temp_schema|pg_is_xlog_replay_paused|" +
291 "pg_last_xact_replay_timestamp|pg_last_xlog_receive_location|" +
292 "pg_last_xlog_replay_location|pg_listening_channels|pg_lock_status|pg_ls_dir|" +
293 "pg_my_temp_schema|pg_node_tree_in|pg_node_tree_out|pg_node_tree_recv|" +
294 "pg_node_tree_send|pg_notify|pg_opclass_is_visible|pg_operator_is_visible|" +
295 "pg_options_to_table|pg_postmaster_start_time|pg_prepared_statement|pg_prepared_xact|" +
296 "pg_read_binary_file|pg_read_file|pg_relation_filenode|pg_relation_filepath|" +
297 "pg_relation_size|pg_reload_conf|pg_rotate_logfile|pg_sequence_parameters|" +
298 "pg_show_all_settings|pg_size_pretty|pg_sleep|pg_start_backup|pg_stat_clear_snapshot|" +
299 "pg_stat_file|pg_stat_get_activity|pg_stat_get_analyze_count|" +
300 "pg_stat_get_autoanalyze_count|pg_stat_get_autovacuum_count|" +
301 "pg_stat_get_backend_activity|pg_stat_get_backend_activity_start|" +
302 "pg_stat_get_backend_client_addr|pg_stat_get_backend_client_port|" +
303 "pg_stat_get_backend_dbid|pg_stat_get_backend_idset|pg_stat_get_backend_pid|" +
304 "pg_stat_get_backend_start|pg_stat_get_backend_userid|pg_stat_get_backend_waiting|" +
305 "pg_stat_get_backend_xact_start|pg_stat_get_bgwriter_buf_written_checkpoints|" +
306 "pg_stat_get_bgwriter_buf_written_clean|pg_stat_get_bgwriter_maxwritten_clean|" +
307 "pg_stat_get_bgwriter_requested_checkpoints|pg_stat_get_bgwriter_stat_reset_time|" +
308 "pg_stat_get_bgwriter_timed_checkpoints|pg_stat_get_blocks_fetched|" +
309 "pg_stat_get_blocks_hit|pg_stat_get_buf_alloc|pg_stat_get_buf_fsync_backend|" +
310 "pg_stat_get_buf_written_backend|pg_stat_get_db_blocks_fetched|" +
311 "pg_stat_get_db_blocks_hit|pg_stat_get_db_conflict_all|" +
312 "pg_stat_get_db_conflict_bufferpin|pg_stat_get_db_conflict_lock|" +
313 "pg_stat_get_db_conflict_snapshot|pg_stat_get_db_conflict_startup_deadlock|" +
314 "pg_stat_get_db_conflict_tablespace|pg_stat_get_db_numbackends|" +
315 "pg_stat_get_db_stat_reset_time|pg_stat_get_db_tuples_deleted|" +
316 "pg_stat_get_db_tuples_fetched|pg_stat_get_db_tuples_inserted|" +
317 "pg_stat_get_db_tuples_returned|pg_stat_get_db_tuples_updated|" +
318 "pg_stat_get_db_xact_commit|pg_stat_get_db_xact_rollback|pg_stat_get_dead_tuples|" +
319 "pg_stat_get_function_calls|pg_stat_get_function_self_time|" +
320 "pg_stat_get_function_time|pg_stat_get_last_analyze_time|" +
321 "pg_stat_get_last_autoanalyze_time|pg_stat_get_last_autovacuum_time|" +
322 "pg_stat_get_last_vacuum_time|pg_stat_get_live_tuples|pg_stat_get_numscans|" +
323 "pg_stat_get_tuples_deleted|pg_stat_get_tuples_fetched|" +
324 "pg_stat_get_tuples_hot_updated|pg_stat_get_tuples_inserted|" +
325 "pg_stat_get_tuples_returned|pg_stat_get_tuples_updated|pg_stat_get_vacuum_count|" +
326 "pg_stat_get_wal_senders|pg_stat_get_xact_blocks_fetched|" +
327 "pg_stat_get_xact_blocks_hit|pg_stat_get_xact_function_calls|" +
328 "pg_stat_get_xact_function_self_time|pg_stat_get_xact_function_time|" +
329 "pg_stat_get_xact_numscans|pg_stat_get_xact_tuples_deleted|" +
330 "pg_stat_get_xact_tuples_fetched|pg_stat_get_xact_tuples_hot_updated|" +
331 "pg_stat_get_xact_tuples_inserted|pg_stat_get_xact_tuples_returned|" +
332 "pg_stat_get_xact_tuples_updated|pg_stat_reset|pg_stat_reset_shared|" +
333 "pg_stat_reset_single_function_counters|pg_stat_reset_single_table_counters|" +
334 "pg_stop_backup|pg_switch_xlog|pg_table_is_visible|pg_table_size|" +
335 "pg_tablespace_databases|pg_tablespace_size|pg_terminate_backend|pg_timezone_abbrevs|" +
336 "pg_timezone_names|pg_total_relation_size|pg_try_advisory_lock|" +
337 "pg_try_advisory_lock_shared|pg_try_advisory_xact_lock|" +
338 "pg_try_advisory_xact_lock_shared|pg_ts_config_is_visible|pg_ts_dict_is_visible|" +
339 "pg_ts_parser_is_visible|pg_ts_template_is_visible|pg_type_is_visible|pg_typeof|" +
340 "pg_xlog_replay_pause|pg_xlog_replay_resume|pg_xlogfile_name|pg_xlogfile_name_offset|" +
341 "pi|plainto_tsquery|plpgsql_call_handler|plpgsql_inline_handler|plpgsql_validator|" +
342 "point|point_above|point_add|point_below|point_distance|point_div|point_eq|point_horiz|" +
343 "point_in|point_left|point_mul|point_ne|point_out|point_recv|point_right|point_send|" +
344 "point_sub|point_vert|poly_above|poly_below|poly_center|poly_contain|poly_contain_pt|" +
345 "poly_contained|poly_distance|poly_in|poly_left|poly_npoints|poly_out|poly_overabove|" +
346 "poly_overbelow|poly_overlap|poly_overleft|poly_overright|poly_recv|poly_right|" +
347 "poly_same|poly_send|polygon|popen|position|positionjoinsel|positionsel|" +
348 "postgresql_fdw_validator|pow|power|prsd_end|prsd_headline|prsd_lextype|prsd_nexttoken|" +
349 "prsd_start|pt_contained_circle|pt_contained_poly|query_to_xml|" +
350 "query_to_xml_and_xmlschema|query_to_xmlschema|querytree|quote_ident|quote_literal|" +
351 "quote_nullable|radians|radius|random|rank|record_eq|record_ge|record_gt|record_in|" +
352 "record_le|record_lt|record_ne|record_out|record_recv|record_send|regclass|regclassin|" +
353 "regclassout|regclassrecv|regclasssend|regconfigin|regconfigout|regconfigrecv|" +
354 "regconfigsend|regdictionaryin|regdictionaryout|regdictionaryrecv|regdictionarysend|" +
355 "regexeqjoinsel|regexeqsel|regexnejoinsel|regexnesel|regexp_matches|regexp_replace|" +
356 "regexp_split_to_array|regexp_split_to_table|regoperatorin|regoperatorout|" +
357 "regoperatorrecv|regoperatorsend|regoperin|regoperout|regoperrecv|regopersend|" +
358 "regprocedurein|regprocedureout|regprocedurerecv|regproceduresend|regprocin|regprocout|" +
359 "regprocrecv|regprocsend|regr_avgx|regr_avgy|regr_count|regr_intercept|regr_r2|" +
360 "regr_slope|regr_sxx|regr_sxy|regr_syy|regtypein|regtypeout|regtyperecv|regtypesend|" +
361 "reltime|reltimeeq|reltimege|reltimegt|reltimein|reltimele|reltimelt|reltimene|reltimeout|" +
362 "reltimerecv|reltimesend|repeat|replace|reverse|right|round|row_number|rpad|rtrim|" +
363 "scalargtjoinsel|scalargtsel|scalarltjoinsel|scalarltsel|schema_to_xml|" +
364 "schema_to_xml_and_xmlschema|schema_to_xmlschema|session_user|set_bit|set_byte|" +
365 "set_config|set_masklen|setseed|setval|setweight|shell_in|shell_out|" +
366 "shift_jis_2004_to_euc_jis_2004|shift_jis_2004_to_utf8|shobj_description|sign|" +
367 "similar_escape|sin|sjis_to_euc_jp|sjis_to_mic|sjis_to_utf8|slope|smgreq|smgrin|smgrne|" +
368 "smgrout|split_part|sqrt|statement_timestamp|stddev|stddev_pop|stddev_samp|string_agg|" +
369 "string_agg_finalfn|string_agg_transfn|string_to_array|strip|strpos|substr|substring|sum|" +
370 "suppress_redundant_updates_trigger|table_to_xml|table_to_xml_and_xmlschema|" +
371 "table_to_xmlschema|tan|text|text_ge|text_gt|text_larger|text_le|text_lt|text_pattern_ge|" +
372 "text_pattern_gt|text_pattern_le|text_pattern_lt|text_smaller|textanycat|textcat|texteq|" +
373 "texticlike|texticnlike|texticregexeq|texticregexne|textin|textlen|textlike|textne|" +
374 "textnlike|textout|textrecv|textregexeq|textregexne|textsend|thesaurus_init|" +
375 "thesaurus_lexize|tideq|tidge|tidgt|tidin|tidlarger|tidle|tidlt|tidne|tidout|tidrecv|tidsend|" +
376 "tidsmaller|time_cmp|time_eq|time_ge|time_gt|time_hash|time_in|time_larger|time_le|time_lt|" +
377 "time_mi_interval|time_mi_time|time_ne|time_out|time_pl_interval|time_recv|time_send|" +
378 "time_smaller|timedate_pl|timemi|timenow|timeofday|timepl|timestamp_cmp|" +
379 "timestamp_cmp_date|timestamp_cmp_timestamptz|timestamp_eq|timestamp_eq_date|" +
380 "timestamp_eq_timestamptz|timestamp_ge|timestamp_ge_date|timestamp_ge_timestamptz|" +
381 "timestamp_gt|timestamp_gt_date|timestamp_gt_timestamptz|timestamp_hash|timestamp_in|" +
382 "timestamp_larger|timestamp_le|timestamp_le_date|timestamp_le_timestamptz|" +
383 "timestamp_lt|timestamp_lt_date|timestamp_lt_timestamptz|timestamp_mi|" +
384 "timestamp_mi_interval|timestamp_ne|timestamp_ne_date|timestamp_ne_timestamptz|" +
385 "timestamp_out|timestamp_pl_interval|timestamp_recv|timestamp_send|timestamp_smaller|" +
386 "timestamptypmodin|timestamptypmodout|timestamptz_cmp|timestamptz_cmp_date|" +
387 "timestamptz_cmp_timestamp|timestamptz_eq|timestamptz_eq_date|" +
388 "timestamptz_eq_timestamp|timestamptz_ge|timestamptz_ge_date|" +
389 "timestamptz_ge_timestamp|timestamptz_gt|timestamptz_gt_date|" +
390 "timestamptz_gt_timestamp|timestamptz_in|timestamptz_larger|timestamptz_le|" +
391 "timestamptz_le_date|timestamptz_le_timestamp|timestamptz_lt|timestamptz_lt_date|" +
392 "timestamptz_lt_timestamp|timestamptz_mi|timestamptz_mi_interval|timestamptz_ne|" +
393 "timestamptz_ne_date|timestamptz_ne_timestamp|timestamptz_out|" +
394 "timestamptz_pl_interval|timestamptz_recv|timestamptz_send|timestamptz_smaller|" +
395 "timestamptztypmodin|timestamptztypmodout|timetypmodin|timetypmodout|timetz_cmp|" +
396 "timetz_eq|timetz_ge|timetz_gt|timetz_hash|timetz_in|timetz_larger|timetz_le|timetz_lt|" +
397 "timetz_mi_interval|timetz_ne|timetz_out|timetz_pl_interval|timetz_recv|timetz_send|" +
398 "timetz_smaller|timetzdate_pl|timetztypmodin|timetztypmodout|timezone|tinterval|" +
399 "tintervalct|tintervalend|tintervaleq|tintervalge|tintervalgt|tintervalin|tintervalle|" +
400 "tintervalleneq|tintervallenge|tintervallengt|tintervallenle|tintervallenlt|" +
401 "tintervallenne|tintervallt|tintervalne|tintervalout|tintervalov|tintervalrecv|" +
402 "tintervalrel|tintervalsame|tintervalsend|tintervalstart|to_ascii|to_char|to_date|to_hex|" +
403 "to_number|to_timestamp|to_tsquery|to_tsvector|transaction_timestamp|translate|" +
404 "trigger_in|trigger_out|trunc|ts_debug|ts_headline|ts_lexize|ts_match_qv|ts_match_tq|" +
405 "ts_match_tt|ts_match_vq|ts_parse|ts_rank|ts_rank_cd|ts_rewrite|ts_stat|ts_token_type|" +
406 "ts_typanalyze|tsmatchjoinsel|tsmatchsel|tsq_mcontained|tsq_mcontains|tsquery_and|" +
407 "tsquery_cmp|tsquery_eq|tsquery_ge|tsquery_gt|tsquery_le|tsquery_lt|tsquery_ne|" +
408 "tsquery_not|tsquery_or|tsqueryin|tsqueryout|tsqueryrecv|tsquerysend|tsvector_cmp|" +
409 "tsvector_concat|tsvector_eq|tsvector_ge|tsvector_gt|tsvector_le|tsvector_lt|" +
410 "tsvector_ne|tsvector_update_trigger|tsvector_update_trigger_column|tsvectorin|" +
411 "tsvectorout|tsvectorrecv|tsvectorsend|txid_current|txid_current_snapshot|" +
412 "txid_snapshot_in|txid_snapshot_out|txid_snapshot_recv|txid_snapshot_send|" +
413 "txid_snapshot_xip|txid_snapshot_xmax|txid_snapshot_xmin|txid_visible_in_snapshot|" +
414 "uhc_to_utf8|unique_key_recheck|unknownin|unknownout|unknownrecv|unknownsend|unnest|" +
415 "upper|utf8_to_ascii|utf8_to_big5|utf8_to_euc_cn|utf8_to_euc_jis_2004|utf8_to_euc_jp|" +
416 "utf8_to_euc_kr|utf8_to_euc_tw|utf8_to_gb18030|utf8_to_gbk|utf8_to_iso8859|" +
417 "utf8_to_iso8859_1|utf8_to_johab|utf8_to_koi8r|utf8_to_koi8u|utf8_to_shift_jis_2004|" +
418 "utf8_to_sjis|utf8_to_uhc|utf8_to_win|uuid_cmp|uuid_eq|uuid_ge|uuid_gt|uuid_hash|uuid_in|" +
419 "uuid_le|uuid_lt|uuid_ne|uuid_out|uuid_recv|uuid_send|var_pop|var_samp|varbit_in|" +
420 "varbit_out|varbit_recv|varbit_send|varbitcmp|varbiteq|varbitge|varbitgt|varbitle|" +
421 "varbitlt|varbitne|varbittypmodin|varbittypmodout|varcharin|varcharout|varcharrecv|" +
422 "varcharsend|varchartypmodin|varchartypmodout|variance|version|void_in|void_out|" +
423 "void_recv|void_send|width|width_bucket|win1250_to_latin2|win1250_to_mic|win1251_to_iso|" +
424 "win1251_to_koi8r|win1251_to_mic|win1251_to_win866|win866_to_iso|win866_to_koi8r|" +
425 "win866_to_mic|win866_to_win1251|win_to_utf8|xideq|xideqint4|xidin|xidout|xidrecv|xidsend|" +
426 "xml|xml_in|xml_is_well_formed|xml_is_well_formed_content|xml_is_well_formed_document|" +
427 "xml_out|xml_recv|xml_send|xmlagg|xmlcomment|xmlconcat2|xmlexists|xmlvalidate|xpath|" +
428 "xpath_exists"
429 );
430
431 var keywordMapper = this.createKeywordMapper({
432 "support.function": builtinFunctions,
433 "keyword": keywords
434 }, "identifier", true);
435
436
437 var sqlRules = [{
438 token : "string", // single line string -- assume dollar strings if multi-line for now
439 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
440 }, {
441 token : "variable.language", // pg identifier
442 regex : '".*?"'
443 }, {
444 token : "constant.numeric", // float
445 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
446 }, {
447 token : keywordMapper,
448 regex : "[a-zA-Z_][a-zA-Z0-9_$]*\\b" // TODO - Unicode in identifiers
449 }, {
450 token : "keyword.operator",
451 regex : "!|!!|!~|!~\\*|!~~|!~~\\*|#|##|#<|#<=|#<>|#=|#>|#>=|%|\\&|\\&\\&|\\&<|\\&<\\||\\&>|\\*|\\+|" +
452 "\\-|/|<|<#>|<\\->|<<|<<=|<<\\||<=|<>|<\\?>|<@|<\\^|=|>|>=|>>|>>=|>\\^|\\?#|\\?\\-|\\?\\-\\||" +
453 "\\?\\||\\?\\|\\||@|@\\-@|@>|@@|@@@|\\^|\\||\\|\\&>|\\|/|\\|>>|\\|\\||\\|\\|/|~|~\\*|~<=~|~<~|" +
454 "~=|~>=~|~>~|~~|~~\\*"
455 }, {
456 token : "paren.lparen",
457 regex : "[\\(]"
458 }, {
459 token : "paren.rparen",
460 regex : "[\\)]"
461 }, {
462 token : "text",
463 regex : "\\s+"
464 }
465 ];
466
467
468 this.$rules = {
469 "start" : [{
470 token : "comment",
471 regex : "--.*$"
472 },
473 DocCommentHighlightRules.getStartRule("doc-start"),
474 {
475 token : "comment", // multi-line comment
476 regex : "\\/\\*",
477 next : "comment"
478 },{
479 token : "keyword.statementBegin",
480 regex : "^[a-zA-Z]+", // Could enumerate starting keywords but this allows things to work when new statements are added.
481 next : "statement"
482 },{
483 token : "support.buildin", // psql directive
484 regex : "^\\\\[\\S]+.*$"
485 }
486 ],
487
488 "statement" : [{
489 token : "comment",
490 regex : "--.*$"
491 }, {
492 token : "comment", // multi-line comment
493 regex : "\\/\\*",
494 next : "commentStatement"
495 }, {
496 token : "statementEnd",
497 regex : ";",
498 next : "start"
499 }, {
500 token : "string", // perl, python, tcl are in the pg default dist (no tcl highlighter)
501 regex : "\\$perl\\$",
502 next : "perl-start"
503 }, {
504 token : "string",
505 regex : "\\$python\\$",
506 next : "python-start"
507 },{
508 token : "string",
509 regex : "\\$[\\w_0-9]*\\$$", // dollar quote at the end of a line
510 next : "dollarSql"
511 }, {
512 token : "string",
513 regex : "\\$[\\w_0-9]*\\$",
514 next : "dollarStatementString"
515 }
516 ].concat(sqlRules),
517
518 "dollarSql" : [{
519 token : "comment",
520 regex : "--.*$"
521 }, {
522 token : "comment", // multi-line comment
523 regex : "\\/\\*",
524 next : "commentDollarSql"
525 }, {
526 token : "string", // end quoting with dollar at the start of a line
527 regex : "^\\$[\\w_0-9]*\\$",
528 next : "statement"
529 }, {
530 token : "string",
531 regex : "\\$[\\w_0-9]*\\$",
532 next : "dollarSqlString"
533 }
534 ].concat(sqlRules),
535
536 "comment" : [{
537 token : "comment", // closing comment
538 regex : ".*?\\*\\/",
539 next : "start"
540 }, {
541 token : "comment", // comment spanning whole line
542 regex : ".+"
543 }
544 ],
545
546 "commentStatement" : [{
547 token : "comment", // closing comment
548 regex : ".*?\\*\\/",
549 next : "statement"
550 }, {
551 token : "comment", // comment spanning whole line
552 regex : ".+"
553 }
554 ],
555
556 "commentDollarSql" : [{
557 token : "comment", // closing comment
558 regex : ".*?\\*\\/",
559 next : "dollarSql"
560 }, {
561 token : "comment", // comment spanning whole line
562 regex : ".+"
563 }
564 ],
565
566 "dollarStatementString" : [{
567 token : "string", // closing dollarstring
568 regex : ".*?\\$[\\w_0-9]*\\$",
569 next : "statement"
570 }, {
571 token : "string", // dollarstring spanning whole line
572 regex : ".+"
573 }
574 ],
575
576 "dollarSqlString" : [{
577 token : "string", // closing dollarstring
578 regex : ".*?\\$[\\w_0-9]*\\$",
579 next : "dollarSql"
580 }, {
581 token : "string", // dollarstring spanning whole line
582 regex : ".+"
583 }
584 ]
585 };
586
587 this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
588 this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]);
589 this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]);
590 };
591
592 oop.inherits(PgsqlHighlightRules, TextHighlightRules);
593
594 exports.PgsqlHighlightRules = PgsqlHighlightRules;
595 });
596
597 define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
598
599
600 var oop = require("../lib/oop");
601 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
602
603 var DocCommentHighlightRules = function() {
604
605 this.$rules = {
606 "start" : [ {
607 token : "comment.doc.tag",
608 regex : "@[\\w\\d_]+" // TODO: fix email addresses
609 }, {
610 token : "comment.doc.tag",
611 regex : "\\bTODO\\b"
612 }, {
613 defaultToken : "comment.doc"
614 }]
615 };
616 };
617
618 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
619
620 DocCommentHighlightRules.getStartRule = function(start) {
621 return {
622 token : "comment.doc", // doc comment
623 regex : "\\/\\*(?=\\*)",
624 next : start
625 };
626 };
627
628 DocCommentHighlightRules.getEndRule = function (start) {
629 return {
630 token : "comment.doc", // closing comment
631 regex : "\\*\\/",
632 next : start
633 };
634 };
635
636
637 exports.DocCommentHighlightRules = DocCommentHighlightRules;
638
639 });
640
641 define('ace/mode/perl_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
642
643
644 var oop = require("../lib/oop");
645 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
646
647 var PerlHighlightRules = function() {
648
649 var keywords = (
650 "base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" +
651 "no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars"
652 );
653
654 var buildinConstants = ("ARGV|ENV|INC|SIG");
655
656 var builtinFunctions = (
657 "getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
658 "gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" +
659 "getpeername|setpriority|getprotoent|setprotoent|getpriority|" +
660 "endprotoent|getservent|setservent|endservent|sethostent|socketpair|" +
661 "getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|" +
662 "localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|" +
663 "closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|" +
664 "shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|" +
665 "dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|" +
666 "setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|" +
667 "lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|" +
668 "waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|" +
669 "chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|" +
670 "unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|" +
671 "length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|" +
672 "undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|" +
673 "sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|" +
674 "BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|" +
675 "join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" +
676 "keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" +
677 "eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" +
678 "map|die|uc|lc|do"
679 );
680
681 var keywordMapper = this.createKeywordMapper({
682 "keyword": keywords,
683 "constant.language": buildinConstants,
684 "support.function": builtinFunctions
685 }, "identifier");
686
687 this.$rules = {
688 "start" : [
689 {
690 token : "comment",
691 regex : "#.*$"
692 }, {
693 token : "comment.doc",
694 regex : "^=(?:begin|item)\\b",
695 next : "block_comment"
696 }, {
697 token : "string.regexp",
698 regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
699 }, {
700 token : "string", // single line
701 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
702 }, {
703 token : "string", // multi line string start
704 regex : '["].*\\\\$',
705 next : "qqstring"
706 }, {
707 token : "string", // single line
708 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
709 }, {
710 token : "string", // multi line string start
711 regex : "['].*\\\\$",
712 next : "qstring"
713 }, {
714 token : "constant.numeric", // hex
715 regex : "0x[0-9a-fA-F]+\\b"
716 }, {
717 token : "constant.numeric", // float
718 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
719 }, {
720 token : keywordMapper,
721 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
722 }, {
723 token : "keyword.operator",
724 regex : "\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"
725 }, {
726 token : "lparen",
727 regex : "[[({]"
728 }, {
729 token : "rparen",
730 regex : "[\\])}]"
731 }, {
732 token : "text",
733 regex : "\\s+"
734 }
735 ],
736 "qqstring" : [
737 {
738 token : "string",
739 regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
740 next : "start"
741 }, {
742 token : "string",
743 regex : '.+'
744 }
745 ],
746 "qstring" : [
747 {
748 token : "string",
749 regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
750 next : "start"
751 }, {
752 token : "string",
753 regex : '.+'
754 }
755 ],
756 "block_comment": [
757 {
758 token: "comment.doc",
759 regex: "^=cut\\b",
760 next: "start"
761 },
762 {
763 defaultToken: "comment.doc"
764 }
765 ]
766 };
767 };
768
769 oop.inherits(PerlHighlightRules, TextHighlightRules);
770
771 exports.PerlHighlightRules = PerlHighlightRules;
772 });
773
774 define('ace/mode/python_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
775
776
777 var oop = require("../lib/oop");
778 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
779
780 var PythonHighlightRules = function() {
781
782 var keywords = (
783 "and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
784 "finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" +
785 "raise|return|try|while|with|yield"
786 );
787
788 var builtinConstants = (
789 "True|False|None|NotImplemented|Ellipsis|__debug__"
790 );
791
792 var builtinFunctions = (
793 "abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" +
794 "eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" +
795 "binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" +
796 "float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" +
797 "chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" +
798 "cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" +
799 "__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" +
800 "buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern"
801 );
802 var keywordMapper = this.createKeywordMapper({
803 "invalid.deprecated": "debugger",
804 "support.function": builtinFunctions,
805 "constant.language": builtinConstants,
806 "keyword": keywords
807 }, "identifier");
808
809 var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
810
811 var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
812 var octInteger = "(?:0[oO]?[0-7]+)";
813 var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
814 var binInteger = "(?:0[bB][01]+)";
815 var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
816
817 var exponent = "(?:[eE][+-]?\\d+)";
818 var fraction = "(?:\\.\\d+)";
819 var intPart = "(?:\\d+)";
820 var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
821 var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
822 var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
823
824 var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
825
826 this.$rules = {
827 "start" : [ {
828 token : "comment",
829 regex : "#.*$"
830 }, {
831 token : "string", // multi line """ string start
832 regex : strPre + '"{3}',
833 next : "qqstring3"
834 }, {
835 token : "string", // " string
836 regex : strPre + '"(?=.)',
837 next : "qqstring"
838 }, {
839 token : "string", // multi line ''' string start
840 regex : strPre + "'{3}",
841 next : "qstring3"
842 }, {
843 token : "string", // ' string
844 regex : strPre + "'(?=.)",
845 next : "qstring"
846 }, {
847 token : "constant.numeric", // imaginary
848 regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
849 }, {
850 token : "constant.numeric", // float
851 regex : floatNumber
852 }, {
853 token : "constant.numeric", // long integer
854 regex : integer + "[lL]\\b"
855 }, {
856 token : "constant.numeric", // integer
857 regex : integer + "\\b"
858 }, {
859 token : keywordMapper,
860 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
861 }, {
862 token : "keyword.operator",
863 regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
864 }, {
865 token : "paren.lparen",
866 regex : "[\\[\\(\\{]"
867 }, {
868 token : "paren.rparen",
869 regex : "[\\]\\)\\}]"
870 }, {
871 token : "text",
872 regex : "\\s+"
873 } ],
874 "qqstring3" : [ {
875 token : "constant.language.escape",
876 regex : stringEscape
877 }, {
878 token : "string", // multi line """ string end
879 regex : '"{3}',
880 next : "start"
881 }, {
882 defaultToken : "string"
883 } ],
884 "qstring3" : [ {
885 token : "constant.language.escape",
886 regex : stringEscape
887 }, {
888 token : "string", // multi line ''' string end
889 regex : "'{3}",
890 next : "start"
891 }, {
892 defaultToken : "string"
893 } ],
894 "qqstring" : [{
895 token : "constant.language.escape",
896 regex : stringEscape
897 }, {
898 token : "string",
899 regex : "\\\\$",
900 next : "qqstring"
901 }, {
902 token : "string",
903 regex : '"|$',
904 next : "start"
905 }, {
906 defaultToken: "string"
907 }],
908 "qstring" : [{
909 token : "constant.language.escape",
910 regex : stringEscape
911 }, {
912 token : "string",
913 regex : "\\\\$",
914 next : "qstring"
915 }, {
916 token : "string",
917 regex : "'|$",
918 next : "start"
919 }, {
920 defaultToken: "string"
921 }]
922 };
923 };
924
925 oop.inherits(PythonHighlightRules, TextHighlightRules);
926
927 exports.PythonHighlightRules = PythonHighlightRules;
928 });
+0
-2291
try/ace/mode-php.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/php', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/php_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle', 'ace/unicode'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var PhpHighlightRules = require("./php_highlight_rules").PhpHighlightRules;
37 var PhpLangHighlightRules = require("./php_highlight_rules").PhpLangHighlightRules;
38 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
39 var Range = require("../range").Range;
40 var WorkerClient = require("../worker/worker_client").WorkerClient;
41 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
42 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
43 var unicode = require("../unicode");
44
45 var Mode = function(opts) {
46 var inline = opts && opts.inline;
47 var HighlightRules = inline ? PhpLangHighlightRules : PhpHighlightRules;
48 this.$tokenizer = new Tokenizer(new HighlightRules().getRules());
49 this.$outdent = new MatchingBraceOutdent();
50 this.$behaviour = new CstyleBehaviour();
51 this.foldingRules = new CStyleFoldMode();
52 };
53 oop.inherits(Mode, TextMode);
54
55 (function() {
56
57 this.tokenRe = new RegExp("^["
58 + unicode.packages.L
59 + unicode.packages.Mn + unicode.packages.Mc
60 + unicode.packages.Nd
61 + unicode.packages.Pc + "\_]+", "g"
62 );
63
64 this.nonTokenRe = new RegExp("^(?:[^"
65 + unicode.packages.L
66 + unicode.packages.Mn + unicode.packages.Mc
67 + unicode.packages.Nd
68 + unicode.packages.Pc + "\_]|\s])+", "g"
69 );
70
71
72 this.lineCommentStart = ["//", "#"];
73 this.blockComment = {start: "/*", end: "*/"};
74
75 this.getNextLineIndent = function(state, line, tab) {
76 var indent = this.$getIndent(line);
77
78 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
79 var tokens = tokenizedLine.tokens;
80 var endState = tokenizedLine.state;
81
82
83 if (tokens.length && tokens[tokens.length-1].type == "comment") {
84 return indent;
85 }
86
87 if (state == "php-start") {
88 var match = line.match(/^.*[\{\(\[\:]\s*$/);
89 if (match) {
90 indent += tab;
91 }
92 } else if (state == "php-doc-start") {
93 if (endState != "php-doc-start") {
94 return "";
95 }
96 var match = line.match(/^\s*(\/?)\*/);
97 if (match) {
98 if (match[1]) {
99 indent += " ";
100 }
101 indent += "* ";
102 }
103 }
104
105 return indent;
106 };
107
108 this.checkOutdent = function(state, line, input) {
109 return this.$outdent.checkOutdent(line, input);
110 };
111
112 this.autoOutdent = function(state, doc, row) {
113 this.$outdent.autoOutdent(doc, row);
114 };
115
116 this.createWorker = function(session) {
117 var worker = new WorkerClient(["ace"], "ace/mode/php_worker", "PhpWorker");
118 worker.attachToDocument(session.getDocument());
119
120 worker.on("error", function(e) {
121 session.setAnnotations(e.data);
122 });
123
124 worker.on("ok", function() {
125 session.clearAnnotations();
126 });
127
128 return worker;
129 };
130
131 }).call(Mode.prototype);
132
133 exports.Mode = Mode;
134 });
135
136 define('ace/mode/php_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules', 'ace/mode/html_highlight_rules'], function(require, exports, module) {
137
138
139 var oop = require("../lib/oop");
140 var lang = require("../lib/lang");
141 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
142 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
143 var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
144
145 var PhpLangHighlightRules = function() {
146 var docComment = DocCommentHighlightRules;
147 var builtinFunctions = lang.arrayToMap(
148 ('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' +
149 'aggregate_properties|aggregate_properties_by_list|aggregate_properties_by_regexp|aggregation_info|amqpconnection|amqpexchange|amqpqueue|' +
150 'apache_child_terminate|apache_get_modules|apache_get_version|apache_getenv|apache_lookup_uri|apache_note|apache_request_headers|' +
151 'apache_reset_timeout|apache_response_headers|apache_setenv|apc_add|apc_bin_dump|apc_bin_dumpfile|apc_bin_load|apc_bin_loadfile|' +
152 '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|' +
153 'apc_inc|apc_load_constants|apc_sma_info|apc_store|apciterator|apd_breakpoint|apd_callstack|apd_clunk|apd_continue|apd_croak|' +
154 'apd_dump_function_table|apd_dump_persistent_resources|apd_dump_regular_resources|apd_echo|apd_get_active_symbols|apd_set_pprof_trace|' +
155 'apd_set_session|apd_set_session_trace|apd_set_session_trace_socket|appenditerator|array|array_change_key_case|array_chunk|array_combine|' +
156 'array_count_values|array_diff|array_diff_assoc|array_diff_key|array_diff_uassoc|array_diff_ukey|array_fill|array_fill_keys|array_filter|' +
157 'array_flip|array_intersect|array_intersect_assoc|array_intersect_key|array_intersect_uassoc|array_intersect_ukey|array_key_exists|' +
158 'array_keys|array_map|array_merge|array_merge_recursive|array_multisort|array_pad|array_pop|array_product|array_push|array_rand|' +
159 'array_reduce|array_replace|array_replace_recursive|array_reverse|array_search|array_shift|array_slice|array_splice|array_sum|array_udiff|' +
160 'array_udiff_assoc|array_udiff_uassoc|array_uintersect|array_uintersect_assoc|array_uintersect_uassoc|array_unique|array_unshift|' +
161 'array_values|array_walk|array_walk_recursive|arrayaccess|arrayiterator|arrayobject|arsort|asin|asinh|asort|assert|assert_options|atan|' +
162 'atan2|atanh|audioproperties|badfunctioncallexception|badmethodcallexception|base64_decode|base64_encode|base_convert|basename|' +
163 'bbcode_add_element|bbcode_add_smiley|bbcode_create|bbcode_destroy|bbcode_parse|bbcode_set_arg_parser|bbcode_set_flags|bcadd|bccomp|bcdiv|' +
164 'bcmod|bcmul|bcompiler_load|bcompiler_load_exe|bcompiler_parse_class|bcompiler_read|bcompiler_write_class|bcompiler_write_constant|' +
165 'bcompiler_write_exe_footer|bcompiler_write_file|bcompiler_write_footer|bcompiler_write_function|bcompiler_write_functions_from_file|' +
166 'bcompiler_write_header|bcompiler_write_included_filename|bcpow|bcpowmod|bcscale|bcsqrt|bcsub|bin2hex|bind_textdomain_codeset|bindec|' +
167 'bindtextdomain|bson_decode|bson_encode|bumpValue|bzclose|bzcompress|bzdecompress|bzerrno|bzerror|bzerrstr|bzflush|bzopen|bzread|bzwrite|' +
168 'cachingiterator|cairo|cairo_create|cairo_font_face_get_type|cairo_font_face_status|cairo_font_options_create|cairo_font_options_equal|' +
169 'cairo_font_options_get_antialias|cairo_font_options_get_hint_metrics|cairo_font_options_get_hint_style|' +
170 'cairo_font_options_get_subpixel_order|cairo_font_options_hash|cairo_font_options_merge|cairo_font_options_set_antialias|' +
171 'cairo_font_options_set_hint_metrics|cairo_font_options_set_hint_style|cairo_font_options_set_subpixel_order|cairo_font_options_status|' +
172 'cairo_format_stride_for_width|cairo_image_surface_create|cairo_image_surface_create_for_data|cairo_image_surface_create_from_png|' +
173 'cairo_image_surface_get_data|cairo_image_surface_get_format|cairo_image_surface_get_height|cairo_image_surface_get_stride|' +
174 'cairo_image_surface_get_width|cairo_matrix_create_scale|cairo_matrix_create_translate|cairo_matrix_invert|cairo_matrix_multiply|' +
175 'cairo_matrix_rotate|cairo_matrix_transform_distance|cairo_matrix_transform_point|cairo_matrix_translate|cairo_pattern_add_color_stop_rgb|' +
176 'cairo_pattern_add_color_stop_rgba|cairo_pattern_create_for_surface|cairo_pattern_create_linear|cairo_pattern_create_radial|' +
177 'cairo_pattern_create_rgb|cairo_pattern_create_rgba|cairo_pattern_get_color_stop_count|cairo_pattern_get_color_stop_rgba|' +
178 'cairo_pattern_get_extend|cairo_pattern_get_filter|cairo_pattern_get_linear_points|cairo_pattern_get_matrix|' +
179 'cairo_pattern_get_radial_circles|cairo_pattern_get_rgba|cairo_pattern_get_surface|cairo_pattern_get_type|cairo_pattern_set_extend|' +
180 'cairo_pattern_set_filter|cairo_pattern_set_matrix|cairo_pattern_status|cairo_pdf_surface_create|cairo_pdf_surface_set_size|' +
181 'cairo_ps_get_levels|cairo_ps_level_to_string|cairo_ps_surface_create|cairo_ps_surface_dsc_begin_page_setup|' +
182 'cairo_ps_surface_dsc_begin_setup|cairo_ps_surface_dsc_comment|cairo_ps_surface_get_eps|cairo_ps_surface_restrict_to_level|' +
183 'cairo_ps_surface_set_eps|cairo_ps_surface_set_size|cairo_scaled_font_create|cairo_scaled_font_extents|cairo_scaled_font_get_ctm|' +
184 'cairo_scaled_font_get_font_face|cairo_scaled_font_get_font_matrix|cairo_scaled_font_get_font_options|cairo_scaled_font_get_scale_matrix|' +
185 'cairo_scaled_font_get_type|cairo_scaled_font_glyph_extents|cairo_scaled_font_status|cairo_scaled_font_text_extents|' +
186 'cairo_surface_copy_page|cairo_surface_create_similar|cairo_surface_finish|cairo_surface_flush|cairo_surface_get_content|' +
187 'cairo_surface_get_device_offset|cairo_surface_get_font_options|cairo_surface_get_type|cairo_surface_mark_dirty|' +
188 'cairo_surface_mark_dirty_rectangle|cairo_surface_set_device_offset|cairo_surface_set_fallback_resolution|cairo_surface_show_page|' +
189 'cairo_surface_status|cairo_surface_write_to_png|cairo_svg_surface_create|cairo_svg_surface_restrict_to_version|' +
190 'cairo_svg_version_to_string|cairoantialias|cairocontent|cairocontext|cairoexception|cairoextend|cairofillrule|cairofilter|cairofontface|' +
191 'cairofontoptions|cairofontslant|cairofonttype|cairofontweight|cairoformat|cairogradientpattern|cairohintmetrics|cairohintstyle|' +
192 'cairoimagesurface|cairolineargradient|cairolinecap|cairolinejoin|cairomatrix|cairooperator|cairopath|cairopattern|cairopatterntype|' +
193 'cairopdfsurface|cairopslevel|cairopssurface|cairoradialgradient|cairoscaledfont|cairosolidpattern|cairostatus|cairosubpixelorder|' +
194 'cairosurface|cairosurfacepattern|cairosurfacetype|cairosvgsurface|cairosvgversion|cairotoyfontface|cal_days_in_month|cal_from_jd|cal_info|' +
195 'cal_to_jd|calcul_hmac|calculhmac|call_user_func|call_user_func_array|call_user_method|call_user_method_array|callbackfilteriterator|ceil|' +
196 'chdb|chdb_create|chdir|checkdate|checkdnsrr|chgrp|chmod|chop|chown|chr|chroot|chunk_split|class_alias|class_exists|class_implements|' +
197 'class_parents|classkit_import|classkit_method_add|classkit_method_copy|classkit_method_redefine|classkit_method_remove|' +
198 'classkit_method_rename|clearstatcache|clone|closedir|closelog|collator|com|com_addref|com_create_guid|com_event_sink|com_get|' +
199 'com_get_active_object|com_invoke|com_isenum|com_load|com_load_typelib|com_message_pump|com_print_typeinfo|com_propget|com_propput|' +
200 'com_propset|com_release|com_set|compact|connection_aborted|connection_status|connection_timeout|constant|construct|construct|construct|' +
201 'convert_cyr_string|convert_uudecode|convert_uuencode|copy|cos|cosh|count|count_chars|countable|counter_bump|counter_bump_value|' +
202 'counter_create|counter_get|counter_get_meta|counter_get_named|counter_get_value|counter_reset|counter_reset_value|crack_check|' +
203 'crack_closedict|crack_getlastmessage|crack_opendict|crc32|create_function|crypt|ctype_alnum|ctype_alpha|ctype_cntrl|ctype_digit|' +
204 'ctype_graph|ctype_lower|ctype_print|ctype_punct|ctype_space|ctype_upper|ctype_xdigit|cubrid_affected_rows|cubrid_bind|' +
205 'cubrid_client_encoding|cubrid_close|cubrid_close_prepare|cubrid_close_request|cubrid_col_get|cubrid_col_size|cubrid_column_names|' +
206 'cubrid_column_types|cubrid_commit|cubrid_connect|cubrid_connect_with_url|cubrid_current_oid|cubrid_data_seek|cubrid_db_name|' +
207 'cubrid_disconnect|cubrid_drop|cubrid_errno|cubrid_error|cubrid_error_code|cubrid_error_code_facility|cubrid_error_msg|cubrid_execute|' +
208 'cubrid_fetch|cubrid_fetch_array|cubrid_fetch_assoc|cubrid_fetch_field|cubrid_fetch_lengths|cubrid_fetch_object|cubrid_fetch_row|' +
209 'cubrid_field_flags|cubrid_field_len|cubrid_field_name|cubrid_field_seek|cubrid_field_table|cubrid_field_type|cubrid_free_result|' +
210 'cubrid_get|cubrid_get_autocommit|cubrid_get_charset|cubrid_get_class_name|cubrid_get_client_info|cubrid_get_db_parameter|' +
211 'cubrid_get_server_info|cubrid_insert_id|cubrid_is_instance|cubrid_list_dbs|cubrid_load_from_glo|cubrid_lob_close|cubrid_lob_export|' +
212 'cubrid_lob_get|cubrid_lob_send|cubrid_lob_size|cubrid_lock_read|cubrid_lock_write|cubrid_move_cursor|cubrid_new_glo|cubrid_next_result|' +
213 'cubrid_num_cols|cubrid_num_fields|cubrid_num_rows|cubrid_ping|cubrid_prepare|cubrid_put|cubrid_query|cubrid_real_escape_string|' +
214 'cubrid_result|cubrid_rollback|cubrid_save_to_glo|cubrid_schema|cubrid_send_glo|cubrid_seq_drop|cubrid_seq_insert|cubrid_seq_put|' +
215 'cubrid_set_add|cubrid_set_autocommit|cubrid_set_db_parameter|cubrid_set_drop|cubrid_unbuffered_query|cubrid_version|curl_close|' +
216 'curl_copy_handle|curl_errno|curl_error|curl_exec|curl_getinfo|curl_init|curl_multi_add_handle|curl_multi_close|curl_multi_exec|' +
217 'curl_multi_getcontent|curl_multi_info_read|curl_multi_init|curl_multi_remove_handle|curl_multi_select|curl_setopt|curl_setopt_array|' +
218 'curl_version|current|cyrus_authenticate|cyrus_bind|cyrus_close|cyrus_connect|cyrus_query|cyrus_unbind|date|date_add|date_create|' +
219 'date_create_from_format|date_date_set|date_default_timezone_get|date_default_timezone_set|date_diff|date_format|date_get_last_errors|' +
220 'date_interval_create_from_date_string|date_interval_format|date_isodate_set|date_modify|date_offset_get|date_parse|date_parse_from_format|' +
221 'date_sub|date_sun_info|date_sunrise|date_sunset|date_time_set|date_timestamp_get|date_timestamp_set|date_timezone_get|date_timezone_set|' +
222 'dateinterval|dateperiod|datetime|datetimezone|db2_autocommit|db2_bind_param|db2_client_info|db2_close|db2_column_privileges|db2_columns|' +
223 'db2_commit|db2_conn_error|db2_conn_errormsg|db2_connect|db2_cursor_type|db2_escape_string|db2_exec|db2_execute|db2_fetch_array|' +
224 '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|' +
225 '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|' +
226 'db2_lob_read|db2_next_result|db2_num_fields|db2_num_rows|db2_pclose|db2_pconnect|db2_prepare|db2_primary_keys|db2_procedure_columns|' +
227 'db2_procedures|db2_result|db2_rollback|db2_server_info|db2_set_option|db2_special_columns|db2_statistics|db2_stmt_error|db2_stmt_errormsg|' +
228 'db2_table_privileges|db2_tables|dba_close|dba_delete|dba_exists|dba_fetch|dba_firstkey|dba_handlers|dba_insert|dba_key_split|dba_list|' +
229 'dba_nextkey|dba_open|dba_optimize|dba_popen|dba_replace|dba_sync|dbase_add_record|dbase_close|dbase_create|dbase_delete_record|' +
230 'dbase_get_header_info|dbase_get_record|dbase_get_record_with_names|dbase_numfields|dbase_numrecords|dbase_open|dbase_pack|' +
231 'dbase_replace_record|dbplus_add|dbplus_aql|dbplus_chdir|dbplus_close|dbplus_curr|dbplus_errcode|dbplus_errno|dbplus_find|dbplus_first|' +
232 'dbplus_flush|dbplus_freealllocks|dbplus_freelock|dbplus_freerlocks|dbplus_getlock|dbplus_getunique|dbplus_info|dbplus_last|dbplus_lockrel|' +
233 'dbplus_next|dbplus_open|dbplus_prev|dbplus_rchperm|dbplus_rcreate|dbplus_rcrtexact|dbplus_rcrtlike|dbplus_resolve|dbplus_restorepos|' +
234 'dbplus_rkeys|dbplus_ropen|dbplus_rquery|dbplus_rrename|dbplus_rsecindex|dbplus_runlink|dbplus_rzap|dbplus_savepos|dbplus_setindex|' +
235 'dbplus_setindexbynumber|dbplus_sql|dbplus_tcl|dbplus_tremove|dbplus_undo|dbplus_undoprepare|dbplus_unlockrel|dbplus_unselect|' +
236 'dbplus_update|dbplus_xlockrel|dbplus_xunlockrel|dbx_close|dbx_compare|dbx_connect|dbx_error|dbx_escape_string|dbx_fetch_row|dbx_query|' +
237 'dbx_sort|dcgettext|dcngettext|deaggregate|debug_backtrace|debug_print_backtrace|debug_zval_dump|decbin|dechex|decoct|define|' +
238 'define_syslog_variables|defined|deg2rad|delete|dgettext|die|dio_close|dio_fcntl|dio_open|dio_read|dio_seek|dio_stat|dio_tcsetattr|' +
239 'dio_truncate|dio_write|dir|directoryiterator|dirname|disk_free_space|disk_total_space|diskfreespace|dl|dngettext|dns_check_record|' +
240 'dns_get_mx|dns_get_record|dom_import_simplexml|domainexception|domattr|domattribute_name|domattribute_set_value|domattribute_specified|' +
241 'domattribute_value|domcharacterdata|domcomment|domdocument|domdocument_add_root|domdocument_create_attribute|' +
242 'domdocument_create_cdata_section|domdocument_create_comment|domdocument_create_element|domdocument_create_element_ns|' +
243 'domdocument_create_entity_reference|domdocument_create_processing_instruction|domdocument_create_text_node|domdocument_doctype|' +
244 'domdocument_document_element|domdocument_dump_file|domdocument_dump_mem|domdocument_get_element_by_id|domdocument_get_elements_by_tagname|' +
245 'domdocument_html_dump_mem|domdocument_xinclude|domdocumentfragment|domdocumenttype|domdocumenttype_entities|' +
246 'domdocumenttype_internal_subset|domdocumenttype_name|domdocumenttype_notations|domdocumenttype_public_id|domdocumenttype_system_id|' +
247 'domelement|domelement_get_attribute|domelement_get_attribute_node|domelement_get_elements_by_tagname|domelement_has_attribute|' +
248 'domelement_remove_attribute|domelement_set_attribute|domelement_set_attribute_node|domelement_tagname|domentity|domentityreference|' +
249 'domexception|domimplementation|domnamednodemap|domnode|domnode_add_namespace|domnode_append_child|domnode_append_sibling|' +
250 'domnode_attributes|domnode_child_nodes|domnode_clone_node|domnode_dump_node|domnode_first_child|domnode_get_content|' +
251 'domnode_has_attributes|domnode_has_child_nodes|domnode_insert_before|domnode_is_blank_node|domnode_last_child|domnode_next_sibling|' +
252 'domnode_node_name|domnode_node_type|domnode_node_value|domnode_owner_document|domnode_parent_node|domnode_prefix|domnode_previous_sibling|' +
253 'domnode_remove_child|domnode_replace_child|domnode_replace_node|domnode_set_content|domnode_set_name|domnode_set_namespace|' +
254 'domnode_unlink_node|domnodelist|domnotation|domprocessinginstruction|domprocessinginstruction_data|domprocessinginstruction_target|' +
255 'domtext|domxml_new_doc|domxml_open_file|domxml_open_mem|domxml_version|domxml_xmltree|domxml_xslt_stylesheet|domxml_xslt_stylesheet_doc|' +
256 'domxml_xslt_stylesheet_file|domxml_xslt_version|domxpath|domxsltstylesheet_process|domxsltstylesheet_result_dump_file|' +
257 'domxsltstylesheet_result_dump_mem|dotnet|dotnet_load|doubleval|each|easter_date|easter_days|echo|empty|emptyiterator|' +
258 'enchant_broker_describe|enchant_broker_dict_exists|enchant_broker_free|enchant_broker_free_dict|enchant_broker_get_error|' +
259 'enchant_broker_init|enchant_broker_list_dicts|enchant_broker_request_dict|enchant_broker_request_pwl_dict|enchant_broker_set_ordering|' +
260 'enchant_dict_add_to_personal|enchant_dict_add_to_session|enchant_dict_check|enchant_dict_describe|enchant_dict_get_error|' +
261 'enchant_dict_is_in_session|enchant_dict_quick_check|enchant_dict_store_replacement|enchant_dict_suggest|end|ereg|ereg_replace|eregi|' +
262 'eregi_replace|error_get_last|error_log|error_reporting|errorexception|escapeshellarg|escapeshellcmd|eval|event_add|event_base_free|' +
263 'event_base_loop|event_base_loopbreak|event_base_loopexit|event_base_new|event_base_priority_init|event_base_set|event_buffer_base_set|' +
264 'event_buffer_disable|event_buffer_enable|event_buffer_fd_set|event_buffer_free|event_buffer_new|event_buffer_priority_set|' +
265 'event_buffer_read|event_buffer_set_callback|event_buffer_timeout_set|event_buffer_watermark_set|event_buffer_write|event_del|event_free|' +
266 'event_new|event_set|exception|exec|exif_imagetype|exif_read_data|exif_tagname|exif_thumbnail|exit|exp|expect_expectl|expect_popen|explode|' +
267 'expm1|export|export|extension_loaded|extract|ezmlm_hash|fam_cancel_monitor|fam_close|fam_monitor_collection|fam_monitor_directory|' +
268 'fam_monitor_file|fam_next_event|fam_open|fam_pending|fam_resume_monitor|fam_suspend_monitor|fbsql_affected_rows|fbsql_autocommit|' +
269 'fbsql_blob_size|fbsql_change_user|fbsql_clob_size|fbsql_close|fbsql_commit|fbsql_connect|fbsql_create_blob|fbsql_create_clob|' +
270 'fbsql_create_db|fbsql_data_seek|fbsql_database|fbsql_database_password|fbsql_db_query|fbsql_db_status|fbsql_drop_db|fbsql_errno|' +
271 'fbsql_error|fbsql_fetch_array|fbsql_fetch_assoc|fbsql_fetch_field|fbsql_fetch_lengths|fbsql_fetch_object|fbsql_fetch_row|' +
272 'fbsql_field_flags|fbsql_field_len|fbsql_field_name|fbsql_field_seek|fbsql_field_table|fbsql_field_type|fbsql_free_result|' +
273 'fbsql_get_autostart_info|fbsql_hostname|fbsql_insert_id|fbsql_list_dbs|fbsql_list_fields|fbsql_list_tables|fbsql_next_result|' +
274 'fbsql_num_fields|fbsql_num_rows|fbsql_password|fbsql_pconnect|fbsql_query|fbsql_read_blob|fbsql_read_clob|fbsql_result|fbsql_rollback|' +
275 'fbsql_rows_fetched|fbsql_select_db|fbsql_set_characterset|fbsql_set_lob_mode|fbsql_set_password|fbsql_set_transaction|fbsql_start_db|' +
276 'fbsql_stop_db|fbsql_table_name|fbsql_tablename|fbsql_username|fbsql_warnings|fclose|fdf_add_doc_javascript|fdf_add_template|fdf_close|' +
277 '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|' +
278 '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|' +
279 '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|' +
280 '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|' +
281 'file_exists|file_get_contents|file_put_contents|fileatime|filectime|filegroup|fileinode|filemtime|fileowner|fileperms|filepro|' +
282 'filepro_fieldcount|filepro_fieldname|filepro_fieldtype|filepro_fieldwidth|filepro_retrieve|filepro_rowcount|filesize|filesystemiterator|' +
283 'filetype|filter_has_var|filter_id|filter_input|filter_input_array|filter_list|filter_var|filter_var_array|filteriterator|finfo_buffer|' +
284 'finfo_close|finfo_file|finfo_open|finfo_set_flags|floatval|flock|floor|flush|fmod|fnmatch|fopen|forward_static_call|' +
285 'forward_static_call_array|fpassthru|fprintf|fputcsv|fputs|fread|frenchtojd|fribidi_log2vis|fscanf|fseek|fsockopen|fstat|ftell|ftok|' +
286 '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|' +
287 '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|' +
288 '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|' +
289 'func_num_args|function_exists|fwrite|gc_collect_cycles|gc_disable|gc_enable|gc_enabled|gd_info|gearmanclient|gearmanjob|gearmantask|' +
290 'gearmanworker|geoip_continent_code_by_name|geoip_country_code3_by_name|geoip_country_code_by_name|geoip_country_name_by_name|' +
291 '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|' +
292 'geoip_record_by_name|geoip_region_by_name|geoip_region_name_by_code|geoip_time_zone_by_country_and_region|getMeta|getNamed|getValue|' +
293 'get_browser|get_called_class|get_cfg_var|get_class|get_class_methods|get_class_vars|get_current_user|get_declared_classes|' +
294 'get_declared_interfaces|get_defined_constants|get_defined_functions|get_defined_vars|get_extension_funcs|get_headers|' +
295 'get_html_translation_table|get_include_path|get_included_files|get_loaded_extensions|get_magic_quotes_gpc|get_magic_quotes_runtime|' +
296 'get_meta_tags|get_object_vars|get_parent_class|get_required_files|get_resource_type|getallheaders|getconstant|getconstants|getconstructor|' +
297 'getcwd|getdate|getdefaultproperties|getdoccomment|getendline|getenv|getextension|getextensionname|getfilename|gethostbyaddr|gethostbyname|' +
298 'gethostbynamel|gethostname|getimagesize|getinterfacenames|getinterfaces|getlastmod|getmethod|getmethods|getmodifiers|getmxrr|getmygid|' +
299 'getmyinode|getmypid|getmyuid|getname|getnamespacename|getopt|getparentclass|getproperties|getproperty|getprotobyname|getprotobynumber|' +
300 'getrandmax|getrusage|getservbyname|getservbyport|getshortname|getstartline|getstaticproperties|getstaticpropertyvalue|gettext|' +
301 'gettimeofday|gettype|glob|globiterator|gmagick|gmagickdraw|gmagickpixel|gmdate|gmmktime|gmp_abs|gmp_add|gmp_and|gmp_clrbit|gmp_cmp|' +
302 '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|' +
303 '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|' +
304 'gmp_random|gmp_scan0|gmp_scan1|gmp_setbit|gmp_sign|gmp_sqrt|gmp_sqrtrem|gmp_strval|gmp_sub|gmp_testbit|gmp_xor|gmstrftime|' +
305 'gnupg_adddecryptkey|gnupg_addencryptkey|gnupg_addsignkey|gnupg_cleardecryptkeys|gnupg_clearencryptkeys|gnupg_clearsignkeys|gnupg_decrypt|' +
306 'gnupg_decryptverify|gnupg_encrypt|gnupg_encryptsign|gnupg_export|gnupg_geterror|gnupg_getprotocol|gnupg_import|gnupg_init|gnupg_keyinfo|' +
307 'gnupg_setarmor|gnupg_seterrormode|gnupg_setsignmode|gnupg_sign|gnupg_verify|gopher_parsedir|grapheme_extract|grapheme_stripos|' +
308 'grapheme_stristr|grapheme_strlen|grapheme_strpos|grapheme_strripos|grapheme_strrpos|grapheme_strstr|grapheme_substr|gregoriantojd|' +
309 'gupnp_context_get_host_ip|gupnp_context_get_port|gupnp_context_get_subscription_timeout|gupnp_context_host_path|gupnp_context_new|' +
310 'gupnp_context_set_subscription_timeout|gupnp_context_timeout_add|gupnp_context_unhost_path|gupnp_control_point_browse_start|' +
311 'gupnp_control_point_browse_stop|gupnp_control_point_callback_set|gupnp_control_point_new|gupnp_device_action_callback_set|' +
312 'gupnp_device_info_get|gupnp_device_info_get_service|gupnp_root_device_get_available|gupnp_root_device_get_relative_location|' +
313 'gupnp_root_device_new|gupnp_root_device_set_available|gupnp_root_device_start|gupnp_root_device_stop|gupnp_service_action_get|' +
314 'gupnp_service_action_return|gupnp_service_action_return_error|gupnp_service_action_set|gupnp_service_freeze_notify|gupnp_service_info_get|' +
315 'gupnp_service_info_get_introspection|gupnp_service_introspection_get_state_variable|gupnp_service_notify|gupnp_service_proxy_action_get|' +
316 'gupnp_service_proxy_action_set|gupnp_service_proxy_add_notify|gupnp_service_proxy_callback_set|gupnp_service_proxy_get_subscribed|' +
317 'gupnp_service_proxy_remove_notify|gupnp_service_proxy_set_subscribed|gupnp_service_thaw_notify|gzclose|gzcompress|gzdecode|gzdeflate|' +
318 'gzencode|gzeof|gzfile|gzgetc|gzgets|gzgetss|gzinflate|gzopen|gzpassthru|gzputs|gzread|gzrewind|gzseek|gztell|gzuncompress|gzwrite|' +
319 'halt_compiler|haruannotation|haruannotation_setborderstyle|haruannotation_sethighlightmode|haruannotation_seticon|' +
320 'haruannotation_setopened|harudestination|harudestination_setfit|harudestination_setfitb|harudestination_setfitbh|harudestination_setfitbv|' +
321 'harudestination_setfith|harudestination_setfitr|harudestination_setfitv|harudestination_setxyz|harudoc|harudoc_addpage|' +
322 'harudoc_addpagelabel|harudoc_construct|harudoc_createoutline|harudoc_getcurrentencoder|harudoc_getcurrentpage|harudoc_getencoder|' +
323 'harudoc_getfont|harudoc_getinfoattr|harudoc_getpagelayout|harudoc_getpagemode|harudoc_getstreamsize|harudoc_insertpage|harudoc_loadjpeg|' +
324 'harudoc_loadpng|harudoc_loadraw|harudoc_loadttc|harudoc_loadttf|harudoc_loadtype1|harudoc_output|harudoc_readfromstream|' +
325 'harudoc_reseterror|harudoc_resetstream|harudoc_save|harudoc_savetostream|harudoc_setcompressionmode|harudoc_setcurrentencoder|' +
326 'harudoc_setencryptionmode|harudoc_setinfoattr|harudoc_setinfodateattr|harudoc_setopenaction|harudoc_setpagelayout|harudoc_setpagemode|' +
327 'harudoc_setpagesconfiguration|harudoc_setpassword|harudoc_setpermission|harudoc_usecnsencodings|harudoc_usecnsfonts|' +
328 'harudoc_usecntencodings|harudoc_usecntfonts|harudoc_usejpencodings|harudoc_usejpfonts|harudoc_usekrencodings|harudoc_usekrfonts|' +
329 'haruencoder|haruencoder_getbytetype|haruencoder_gettype|haruencoder_getunicode|haruencoder_getwritingmode|haruexception|harufont|' +
330 'harufont_getascent|harufont_getcapheight|harufont_getdescent|harufont_getencodingname|harufont_getfontname|harufont_gettextwidth|' +
331 'harufont_getunicodewidth|harufont_getxheight|harufont_measuretext|haruimage|haruimage_getbitspercomponent|haruimage_getcolorspace|' +
332 'haruimage_getheight|haruimage_getsize|haruimage_getwidth|haruimage_setcolormask|haruimage_setmaskimage|haruoutline|' +
333 'haruoutline_setdestination|haruoutline_setopened|harupage|harupage_arc|harupage_begintext|harupage_circle|harupage_closepath|' +
334 'harupage_concat|harupage_createdestination|harupage_createlinkannotation|harupage_createtextannotation|harupage_createurlannotation|' +
335 'harupage_curveto|harupage_curveto2|harupage_curveto3|harupage_drawimage|harupage_ellipse|harupage_endpath|harupage_endtext|' +
336 'harupage_eofill|harupage_eofillstroke|harupage_fill|harupage_fillstroke|harupage_getcharspace|harupage_getcmykfill|harupage_getcmykstroke|' +
337 'harupage_getcurrentfont|harupage_getcurrentfontsize|harupage_getcurrentpos|harupage_getcurrenttextpos|harupage_getdash|' +
338 'harupage_getfillingcolorspace|harupage_getflatness|harupage_getgmode|harupage_getgrayfill|harupage_getgraystroke|harupage_getheight|' +
339 'harupage_gethorizontalscaling|harupage_getlinecap|harupage_getlinejoin|harupage_getlinewidth|harupage_getmiterlimit|harupage_getrgbfill|' +
340 'harupage_getrgbstroke|harupage_getstrokingcolorspace|harupage_gettextleading|harupage_gettextmatrix|harupage_gettextrenderingmode|' +
341 'harupage_gettextrise|harupage_gettextwidth|harupage_gettransmatrix|harupage_getwidth|harupage_getwordspace|harupage_lineto|' +
342 'harupage_measuretext|harupage_movetextpos|harupage_moveto|harupage_movetonextline|harupage_rectangle|harupage_setcharspace|' +
343 'harupage_setcmykfill|harupage_setcmykstroke|harupage_setdash|harupage_setflatness|harupage_setfontandsize|harupage_setgrayfill|' +
344 'harupage_setgraystroke|harupage_setheight|harupage_sethorizontalscaling|harupage_setlinecap|harupage_setlinejoin|harupage_setlinewidth|' +
345 'harupage_setmiterlimit|harupage_setrgbfill|harupage_setrgbstroke|harupage_setrotate|harupage_setsize|harupage_setslideshow|' +
346 'harupage_settextleading|harupage_settextmatrix|harupage_settextrenderingmode|harupage_settextrise|harupage_setwidth|harupage_setwordspace|' +
347 'harupage_showtext|harupage_showtextnextline|harupage_stroke|harupage_textout|harupage_textrect|hasconstant|hash|hash_algos|hash_copy|' +
348 'hash_file|hash_final|hash_hmac|hash_hmac_file|hash_init|hash_update|hash_update_file|hash_update_stream|hasmethod|hasproperty|header|' +
349 'header_register_callback|header_remove|headers_list|headers_sent|hebrev|hebrevc|hex2bin|hexdec|highlight_file|highlight_string|' +
350 'html_entity_decode|htmlentities|htmlspecialchars|htmlspecialchars_decode|http_build_cookie|http_build_query|http_build_str|http_build_url|' +
351 'http_cache_etag|http_cache_last_modified|http_chunked_decode|http_date|http_deflate|http_get|http_get_request_body|' +
352 'http_get_request_body_stream|http_get_request_headers|http_head|http_inflate|http_match_etag|http_match_modified|' +
353 'http_match_request_header|http_negotiate_charset|http_negotiate_content_type|http_negotiate_language|http_parse_cookie|http_parse_headers|' +
354 'http_parse_message|http_parse_params|http_persistent_handles_clean|http_persistent_handles_count|http_persistent_handles_ident|' +
355 'http_post_data|http_post_fields|http_put_data|http_put_file|http_put_stream|http_redirect|http_request|http_request_body_encode|' +
356 'http_request_method_exists|http_request_method_name|http_request_method_register|http_request_method_unregister|http_response_code|' +
357 'http_send_content_disposition|http_send_content_type|http_send_data|http_send_file|http_send_last_modified|http_send_status|' +
358 'http_send_stream|http_support|http_throttle|httpdeflatestream|httpdeflatestream_construct|httpdeflatestream_factory|' +
359 'httpdeflatestream_finish|httpdeflatestream_flush|httpdeflatestream_update|httpinflatestream|httpinflatestream_construct|' +
360 'httpinflatestream_factory|httpinflatestream_finish|httpinflatestream_flush|httpinflatestream_update|httpmessage|httpmessage_addheaders|' +
361 'httpmessage_construct|httpmessage_detach|httpmessage_factory|httpmessage_fromenv|httpmessage_fromstring|httpmessage_getbody|' +
362 'httpmessage_getheader|httpmessage_getheaders|httpmessage_gethttpversion|httpmessage_getparentmessage|httpmessage_getrequestmethod|' +
363 'httpmessage_getrequesturl|httpmessage_getresponsecode|httpmessage_getresponsestatus|httpmessage_gettype|httpmessage_guesscontenttype|' +
364 'httpmessage_prepend|httpmessage_reverse|httpmessage_send|httpmessage_setbody|httpmessage_setheaders|httpmessage_sethttpversion|' +
365 'httpmessage_setrequestmethod|httpmessage_setrequesturl|httpmessage_setresponsecode|httpmessage_setresponsestatus|httpmessage_settype|' +
366 'httpmessage_tomessagetypeobject|httpmessage_tostring|httpquerystring|httpquerystring_construct|httpquerystring_get|httpquerystring_mod|' +
367 'httpquerystring_set|httpquerystring_singleton|httpquerystring_toarray|httpquerystring_tostring|httpquerystring_xlate|httprequest|' +
368 'httprequest_addcookies|httprequest_addheaders|httprequest_addpostfields|httprequest_addpostfile|httprequest_addputdata|' +
369 'httprequest_addquerydata|httprequest_addrawpostdata|httprequest_addssloptions|httprequest_clearhistory|httprequest_construct|' +
370 'httprequest_enablecookies|httprequest_getcontenttype|httprequest_getcookies|httprequest_getheaders|httprequest_gethistory|' +
371 'httprequest_getmethod|httprequest_getoptions|httprequest_getpostfields|httprequest_getpostfiles|httprequest_getputdata|' +
372 'httprequest_getputfile|httprequest_getquerydata|httprequest_getrawpostdata|httprequest_getrawrequestmessage|' +
373 'httprequest_getrawresponsemessage|httprequest_getrequestmessage|httprequest_getresponsebody|httprequest_getresponsecode|' +
374 'httprequest_getresponsecookies|httprequest_getresponsedata|httprequest_getresponseheader|httprequest_getresponseinfo|' +
375 'httprequest_getresponsemessage|httprequest_getresponsestatus|httprequest_getssloptions|httprequest_geturl|httprequest_resetcookies|' +
376 'httprequest_send|httprequest_setcontenttype|httprequest_setcookies|httprequest_setheaders|httprequest_setmethod|httprequest_setoptions|' +
377 'httprequest_setpostfields|httprequest_setpostfiles|httprequest_setputdata|httprequest_setputfile|httprequest_setquerydata|' +
378 'httprequest_setrawpostdata|httprequest_setssloptions|httprequest_seturl|httprequestpool|httprequestpool_attach|httprequestpool_construct|' +
379 'httprequestpool_destruct|httprequestpool_detach|httprequestpool_getattachedrequests|httprequestpool_getfinishedrequests|' +
380 'httprequestpool_reset|httprequestpool_send|httprequestpool_socketperform|httprequestpool_socketselect|httpresponse|httpresponse_capture|' +
381 'httpresponse_getbuffersize|httpresponse_getcache|httpresponse_getcachecontrol|httpresponse_getcontentdisposition|' +
382 'httpresponse_getcontenttype|httpresponse_getdata|httpresponse_getetag|httpresponse_getfile|httpresponse_getgzip|httpresponse_getheader|' +
383 'httpresponse_getlastmodified|httpresponse_getrequestbody|httpresponse_getrequestbodystream|httpresponse_getrequestheaders|' +
384 'httpresponse_getstream|httpresponse_getthrottledelay|httpresponse_guesscontenttype|httpresponse_redirect|httpresponse_send|' +
385 'httpresponse_setbuffersize|httpresponse_setcache|httpresponse_setcachecontrol|httpresponse_setcontentdisposition|' +
386 'httpresponse_setcontenttype|httpresponse_setdata|httpresponse_setetag|httpresponse_setfile|httpresponse_setgzip|httpresponse_setheader|' +
387 'httpresponse_setlastmodified|httpresponse_setstream|httpresponse_setthrottledelay|httpresponse_status|hw_array2objrec|hw_changeobject|' +
388 'hw_children|hw_childrenobj|hw_close|hw_connect|hw_connection_info|hw_cp|hw_deleteobject|hw_docbyanchor|hw_docbyanchorobj|' +
389 'hw_document_attributes|hw_document_bodytag|hw_document_content|hw_document_setcontent|hw_document_size|hw_dummy|hw_edittext|hw_error|' +
390 'hw_errormsg|hw_free_document|hw_getanchors|hw_getanchorsobj|hw_getandlock|hw_getchildcoll|hw_getchildcollobj|hw_getchilddoccoll|' +
391 'hw_getchilddoccollobj|hw_getobject|hw_getobjectbyquery|hw_getobjectbyquerycoll|hw_getobjectbyquerycollobj|hw_getobjectbyqueryobj|' +
392 'hw_getparents|hw_getparentsobj|hw_getrellink|hw_getremote|hw_getremotechildren|hw_getsrcbydestobj|hw_gettext|hw_getusername|hw_identify|' +
393 'hw_incollections|hw_info|hw_inscoll|hw_insdoc|hw_insertanchors|hw_insertdocument|hw_insertobject|hw_mapid|hw_modifyobject|hw_mv|' +
394 'hw_new_document|hw_objrec2array|hw_output_document|hw_pconnect|hw_pipedocument|hw_root|hw_setlinkroot|hw_stat|hw_unlock|hw_who|' +
395 'hwapi_attribute|hwapi_attribute_key|hwapi_attribute_langdepvalue|hwapi_attribute_value|hwapi_attribute_values|hwapi_checkin|' +
396 'hwapi_checkout|hwapi_children|hwapi_content|hwapi_content_mimetype|hwapi_content_read|hwapi_copy|hwapi_dbstat|hwapi_dcstat|' +
397 'hwapi_dstanchors|hwapi_dstofsrcanchor|hwapi_error_count|hwapi_error_reason|hwapi_find|hwapi_ftstat|hwapi_hgcsp|hwapi_hwstat|' +
398 'hwapi_identify|hwapi_info|hwapi_insert|hwapi_insertanchor|hwapi_insertcollection|hwapi_insertdocument|hwapi_link|hwapi_lock|hwapi_move|' +
399 'hwapi_new_content|hwapi_object|hwapi_object_assign|hwapi_object_attreditable|hwapi_object_count|hwapi_object_insert|hwapi_object_new|' +
400 'hwapi_object_remove|hwapi_object_title|hwapi_object_value|hwapi_objectbyanchor|hwapi_parents|hwapi_reason_description|hwapi_reason_type|' +
401 'hwapi_remove|hwapi_replace|hwapi_setcommittedversion|hwapi_srcanchors|hwapi_srcsofdst|hwapi_unlock|hwapi_user|hwapi_userlist|hypot|' +
402 'ibase_add_user|ibase_affected_rows|ibase_backup|ibase_blob_add|ibase_blob_cancel|ibase_blob_close|ibase_blob_create|ibase_blob_echo|' +
403 'ibase_blob_get|ibase_blob_import|ibase_blob_info|ibase_blob_open|ibase_close|ibase_commit|ibase_commit_ret|ibase_connect|ibase_db_info|' +
404 'ibase_delete_user|ibase_drop_db|ibase_errcode|ibase_errmsg|ibase_execute|ibase_fetch_assoc|ibase_fetch_object|ibase_fetch_row|' +
405 'ibase_field_info|ibase_free_event_handler|ibase_free_query|ibase_free_result|ibase_gen_id|ibase_maintain_db|ibase_modify_user|' +
406 'ibase_name_result|ibase_num_fields|ibase_num_params|ibase_param_info|ibase_pconnect|ibase_prepare|ibase_query|ibase_restore|' +
407 'ibase_rollback|ibase_rollback_ret|ibase_server_info|ibase_service_attach|ibase_service_detach|ibase_set_event_handler|ibase_timefmt|' +
408 'ibase_trans|ibase_wait_event|iconv|iconv_get_encoding|iconv_mime_decode|iconv_mime_decode_headers|iconv_mime_encode|iconv_set_encoding|' +
409 '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|' +
410 'id3_get_genre_name|id3_get_tag|id3_get_version|id3_remove_tag|id3_set_tag|id3v2attachedpictureframe|id3v2frame|id3v2tag|idate|' +
411 'idn_to_ascii|idn_to_unicode|idn_to_utf8|ifx_affected_rows|ifx_blobinfile_mode|ifx_byteasvarchar|ifx_close|ifx_connect|ifx_copy_blob|' +
412 'ifx_create_blob|ifx_create_char|ifx_do|ifx_error|ifx_errormsg|ifx_fetch_row|ifx_fieldproperties|ifx_fieldtypes|ifx_free_blob|' +
413 '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|' +
414 'ifx_pconnect|ifx_prepare|ifx_query|ifx_textasvarchar|ifx_update_blob|ifx_update_char|ifxus_close_slob|ifxus_create_slob|ifxus_free_slob|' +
415 '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|' +
416 '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|' +
417 '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|' +
418 'iis_stop_service|image2wbmp|image_type_to_extension|image_type_to_mime_type|imagealphablending|imageantialias|imagearc|imagechar|' +
419 'imagecharup|imagecolorallocate|imagecolorallocatealpha|imagecolorat|imagecolorclosest|imagecolorclosestalpha|imagecolorclosesthwb|' +
420 'imagecolordeallocate|imagecolorexact|imagecolorexactalpha|imagecolormatch|imagecolorresolve|imagecolorresolvealpha|imagecolorset|' +
421 'imagecolorsforindex|imagecolorstotal|imagecolortransparent|imageconvolution|imagecopy|imagecopymerge|imagecopymergegray|' +
422 'imagecopyresampled|imagecopyresized|imagecreate|imagecreatefromgd|imagecreatefromgd2|imagecreatefromgd2part|imagecreatefromgif|' +
423 'imagecreatefromjpeg|imagecreatefrompng|imagecreatefromstring|imagecreatefromwbmp|imagecreatefromxbm|imagecreatefromxpm|' +
424 'imagecreatetruecolor|imagedashedline|imagedestroy|imageellipse|imagefill|imagefilledarc|imagefilledellipse|imagefilledpolygon|' +
425 'imagefilledrectangle|imagefilltoborder|imagefilter|imagefontheight|imagefontwidth|imageftbbox|imagefttext|imagegammacorrect|imagegd|' +
426 'imagegd2|imagegif|imagegrabscreen|imagegrabwindow|imageinterlace|imageistruecolor|imagejpeg|imagelayereffect|imageline|imageloadfont|' +
427 'imagepalettecopy|imagepng|imagepolygon|imagepsbbox|imagepsencodefont|imagepsextendfont|imagepsfreefont|imagepsloadfont|imagepsslantfont|' +
428 'imagepstext|imagerectangle|imagerotate|imagesavealpha|imagesetbrush|imagesetpixel|imagesetstyle|imagesetthickness|imagesettile|' +
429 'imagestring|imagestringup|imagesx|imagesy|imagetruecolortopalette|imagettfbbox|imagettftext|imagetypes|imagewbmp|imagexbm|imagick|' +
430 'imagick_adaptiveblurimage|imagick_adaptiveresizeimage|imagick_adaptivesharpenimage|imagick_adaptivethresholdimage|imagick_addimage|' +
431 'imagick_addnoiseimage|imagick_affinetransformimage|imagick_animateimages|imagick_annotateimage|imagick_appendimages|imagick_averageimages|' +
432 'imagick_blackthresholdimage|imagick_blurimage|imagick_borderimage|imagick_charcoalimage|imagick_chopimage|imagick_clear|imagick_clipimage|' +
433 'imagick_clippathimage|imagick_clone|imagick_clutimage|imagick_coalesceimages|imagick_colorfloodfillimage|imagick_colorizeimage|' +
434 'imagick_combineimages|imagick_commentimage|imagick_compareimagechannels|imagick_compareimagelayers|imagick_compareimages|' +
435 'imagick_compositeimage|imagick_construct|imagick_contrastimage|imagick_contraststretchimage|imagick_convolveimage|imagick_cropimage|' +
436 'imagick_cropthumbnailimage|imagick_current|imagick_cyclecolormapimage|imagick_decipherimage|imagick_deconstructimages|' +
437 'imagick_deleteimageartifact|imagick_despeckleimage|imagick_destroy|imagick_displayimage|imagick_displayimages|imagick_distortimage|' +
438 'imagick_drawimage|imagick_edgeimage|imagick_embossimage|imagick_encipherimage|imagick_enhanceimage|imagick_equalizeimage|' +
439 'imagick_evaluateimage|imagick_extentimage|imagick_flattenimages|imagick_flipimage|imagick_floodfillpaintimage|imagick_flopimage|' +
440 'imagick_frameimage|imagick_fximage|imagick_gammaimage|imagick_gaussianblurimage|imagick_getcolorspace|imagick_getcompression|' +
441 'imagick_getcompressionquality|imagick_getcopyright|imagick_getfilename|imagick_getfont|imagick_getformat|imagick_getgravity|' +
442 'imagick_gethomeurl|imagick_getimage|imagick_getimagealphachannel|imagick_getimageartifact|imagick_getimagebackgroundcolor|' +
443 'imagick_getimageblob|imagick_getimageblueprimary|imagick_getimagebordercolor|imagick_getimagechanneldepth|' +
444 'imagick_getimagechanneldistortion|imagick_getimagechanneldistortions|imagick_getimagechannelextrema|imagick_getimagechannelmean|' +
445 'imagick_getimagechannelrange|imagick_getimagechannelstatistics|imagick_getimageclipmask|imagick_getimagecolormapcolor|' +
446 'imagick_getimagecolors|imagick_getimagecolorspace|imagick_getimagecompose|imagick_getimagecompression|imagick_getimagecompressionquality|' +
447 'imagick_getimagedelay|imagick_getimagedepth|imagick_getimagedispose|imagick_getimagedistortion|imagick_getimageextrema|' +
448 'imagick_getimagefilename|imagick_getimageformat|imagick_getimagegamma|imagick_getimagegeometry|imagick_getimagegravity|' +
449 'imagick_getimagegreenprimary|imagick_getimageheight|imagick_getimagehistogram|imagick_getimageindex|imagick_getimageinterlacescheme|' +
450 'imagick_getimageinterpolatemethod|imagick_getimageiterations|imagick_getimagelength|imagick_getimagemagicklicense|imagick_getimagematte|' +
451 'imagick_getimagemattecolor|imagick_getimageorientation|imagick_getimagepage|imagick_getimagepixelcolor|imagick_getimageprofile|' +
452 'imagick_getimageprofiles|imagick_getimageproperties|imagick_getimageproperty|imagick_getimageredprimary|imagick_getimageregion|' +
453 'imagick_getimagerenderingintent|imagick_getimageresolution|imagick_getimagesblob|imagick_getimagescene|imagick_getimagesignature|' +
454 'imagick_getimagesize|imagick_getimagetickspersecond|imagick_getimagetotalinkdensity|imagick_getimagetype|imagick_getimageunits|' +
455 'imagick_getimagevirtualpixelmethod|imagick_getimagewhitepoint|imagick_getimagewidth|imagick_getinterlacescheme|imagick_getiteratorindex|' +
456 'imagick_getnumberimages|imagick_getoption|imagick_getpackagename|imagick_getpage|imagick_getpixeliterator|imagick_getpixelregioniterator|' +
457 'imagick_getpointsize|imagick_getquantumdepth|imagick_getquantumrange|imagick_getreleasedate|imagick_getresource|imagick_getresourcelimit|' +
458 'imagick_getsamplingfactors|imagick_getsize|imagick_getsizeoffset|imagick_getversion|imagick_hasnextimage|imagick_haspreviousimage|' +
459 'imagick_identifyimage|imagick_implodeimage|imagick_labelimage|imagick_levelimage|imagick_linearstretchimage|imagick_liquidrescaleimage|' +
460 'imagick_magnifyimage|imagick_mapimage|imagick_mattefloodfillimage|imagick_medianfilterimage|imagick_mergeimagelayers|imagick_minifyimage|' +
461 'imagick_modulateimage|imagick_montageimage|imagick_morphimages|imagick_mosaicimages|imagick_motionblurimage|imagick_negateimage|' +
462 'imagick_newimage|imagick_newpseudoimage|imagick_nextimage|imagick_normalizeimage|imagick_oilpaintimage|imagick_opaquepaintimage|' +
463 'imagick_optimizeimagelayers|imagick_orderedposterizeimage|imagick_paintfloodfillimage|imagick_paintopaqueimage|' +
464 'imagick_painttransparentimage|imagick_pingimage|imagick_pingimageblob|imagick_pingimagefile|imagick_polaroidimage|imagick_posterizeimage|' +
465 'imagick_previewimages|imagick_previousimage|imagick_profileimage|imagick_quantizeimage|imagick_quantizeimages|imagick_queryfontmetrics|' +
466 'imagick_queryfonts|imagick_queryformats|imagick_radialblurimage|imagick_raiseimage|imagick_randomthresholdimage|imagick_readimage|' +
467 'imagick_readimageblob|imagick_readimagefile|imagick_recolorimage|imagick_reducenoiseimage|imagick_removeimage|imagick_removeimageprofile|' +
468 'imagick_render|imagick_resampleimage|imagick_resetimagepage|imagick_resizeimage|imagick_rollimage|imagick_rotateimage|' +
469 'imagick_roundcorners|imagick_sampleimage|imagick_scaleimage|imagick_separateimagechannel|imagick_sepiatoneimage|' +
470 'imagick_setbackgroundcolor|imagick_setcolorspace|imagick_setcompression|imagick_setcompressionquality|imagick_setfilename|' +
471 'imagick_setfirstiterator|imagick_setfont|imagick_setformat|imagick_setgravity|imagick_setimage|imagick_setimagealphachannel|' +
472 'imagick_setimageartifact|imagick_setimagebackgroundcolor|imagick_setimagebias|imagick_setimageblueprimary|imagick_setimagebordercolor|' +
473 'imagick_setimagechanneldepth|imagick_setimageclipmask|imagick_setimagecolormapcolor|imagick_setimagecolorspace|imagick_setimagecompose|' +
474 'imagick_setimagecompression|imagick_setimagecompressionquality|imagick_setimagedelay|imagick_setimagedepth|imagick_setimagedispose|' +
475 'imagick_setimageextent|imagick_setimagefilename|imagick_setimageformat|imagick_setimagegamma|imagick_setimagegravity|' +
476 'imagick_setimagegreenprimary|imagick_setimageindex|imagick_setimageinterlacescheme|imagick_setimageinterpolatemethod|' +
477 'imagick_setimageiterations|imagick_setimagematte|imagick_setimagemattecolor|imagick_setimageopacity|imagick_setimageorientation|' +
478 'imagick_setimagepage|imagick_setimageprofile|imagick_setimageproperty|imagick_setimageredprimary|imagick_setimagerenderingintent|' +
479 'imagick_setimageresolution|imagick_setimagescene|imagick_setimagetickspersecond|imagick_setimagetype|imagick_setimageunits|' +
480 'imagick_setimagevirtualpixelmethod|imagick_setimagewhitepoint|imagick_setinterlacescheme|imagick_setiteratorindex|imagick_setlastiterator|' +
481 'imagick_setoption|imagick_setpage|imagick_setpointsize|imagick_setresolution|imagick_setresourcelimit|imagick_setsamplingfactors|' +
482 'imagick_setsize|imagick_setsizeoffset|imagick_settype|imagick_shadeimage|imagick_shadowimage|imagick_sharpenimage|imagick_shaveimage|' +
483 'imagick_shearimage|imagick_sigmoidalcontrastimage|imagick_sketchimage|imagick_solarizeimage|imagick_spliceimage|imagick_spreadimage|' +
484 'imagick_steganoimage|imagick_stereoimage|imagick_stripimage|imagick_swirlimage|imagick_textureimage|imagick_thresholdimage|' +
485 'imagick_thumbnailimage|imagick_tintimage|imagick_transformimage|imagick_transparentpaintimage|imagick_transposeimage|' +
486 'imagick_transverseimage|imagick_trimimage|imagick_uniqueimagecolors|imagick_unsharpmaskimage|imagick_valid|imagick_vignetteimage|' +
487 'imagick_waveimage|imagick_whitethresholdimage|imagick_writeimage|imagick_writeimagefile|imagick_writeimages|imagick_writeimagesfile|' +
488 'imagickdraw|imagickdraw_affine|imagickdraw_annotation|imagickdraw_arc|imagickdraw_bezier|imagickdraw_circle|imagickdraw_clear|' +
489 'imagickdraw_clone|imagickdraw_color|imagickdraw_comment|imagickdraw_composite|imagickdraw_construct|imagickdraw_destroy|' +
490 'imagickdraw_ellipse|imagickdraw_getclippath|imagickdraw_getcliprule|imagickdraw_getclipunits|imagickdraw_getfillcolor|' +
491 'imagickdraw_getfillopacity|imagickdraw_getfillrule|imagickdraw_getfont|imagickdraw_getfontfamily|imagickdraw_getfontsize|' +
492 'imagickdraw_getfontstyle|imagickdraw_getfontweight|imagickdraw_getgravity|imagickdraw_getstrokeantialias|imagickdraw_getstrokecolor|' +
493 'imagickdraw_getstrokedasharray|imagickdraw_getstrokedashoffset|imagickdraw_getstrokelinecap|imagickdraw_getstrokelinejoin|' +
494 'imagickdraw_getstrokemiterlimit|imagickdraw_getstrokeopacity|imagickdraw_getstrokewidth|imagickdraw_gettextalignment|' +
495 'imagickdraw_gettextantialias|imagickdraw_gettextdecoration|imagickdraw_gettextencoding|imagickdraw_gettextundercolor|' +
496 'imagickdraw_getvectorgraphics|imagickdraw_line|imagickdraw_matte|imagickdraw_pathclose|imagickdraw_pathcurvetoabsolute|' +
497 'imagickdraw_pathcurvetoquadraticbezierabsolute|imagickdraw_pathcurvetoquadraticbezierrelative|' +
498 'imagickdraw_pathcurvetoquadraticbeziersmoothabsolute|imagickdraw_pathcurvetoquadraticbeziersmoothrelative|imagickdraw_pathcurvetorelative|' +
499 'imagickdraw_pathcurvetosmoothabsolute|imagickdraw_pathcurvetosmoothrelative|imagickdraw_pathellipticarcabsolute|' +
500 'imagickdraw_pathellipticarcrelative|imagickdraw_pathfinish|imagickdraw_pathlinetoabsolute|imagickdraw_pathlinetohorizontalabsolute|' +
501 'imagickdraw_pathlinetohorizontalrelative|imagickdraw_pathlinetorelative|imagickdraw_pathlinetoverticalabsolute|' +
502 'imagickdraw_pathlinetoverticalrelative|imagickdraw_pathmovetoabsolute|imagickdraw_pathmovetorelative|imagickdraw_pathstart|' +
503 'imagickdraw_point|imagickdraw_polygon|imagickdraw_polyline|imagickdraw_pop|imagickdraw_popclippath|imagickdraw_popdefs|' +
504 'imagickdraw_poppattern|imagickdraw_push|imagickdraw_pushclippath|imagickdraw_pushdefs|imagickdraw_pushpattern|imagickdraw_rectangle|' +
505 'imagickdraw_render|imagickdraw_rotate|imagickdraw_roundrectangle|imagickdraw_scale|imagickdraw_setclippath|imagickdraw_setcliprule|' +
506 'imagickdraw_setclipunits|imagickdraw_setfillalpha|imagickdraw_setfillcolor|imagickdraw_setfillopacity|imagickdraw_setfillpatternurl|' +
507 'imagickdraw_setfillrule|imagickdraw_setfont|imagickdraw_setfontfamily|imagickdraw_setfontsize|imagickdraw_setfontstretch|' +
508 'imagickdraw_setfontstyle|imagickdraw_setfontweight|imagickdraw_setgravity|imagickdraw_setstrokealpha|imagickdraw_setstrokeantialias|' +
509 'imagickdraw_setstrokecolor|imagickdraw_setstrokedasharray|imagickdraw_setstrokedashoffset|imagickdraw_setstrokelinecap|' +
510 'imagickdraw_setstrokelinejoin|imagickdraw_setstrokemiterlimit|imagickdraw_setstrokeopacity|imagickdraw_setstrokepatternurl|' +
511 'imagickdraw_setstrokewidth|imagickdraw_settextalignment|imagickdraw_settextantialias|imagickdraw_settextdecoration|' +
512 'imagickdraw_settextencoding|imagickdraw_settextundercolor|imagickdraw_setvectorgraphics|imagickdraw_setviewbox|imagickdraw_skewx|' +
513 'imagickdraw_skewy|imagickdraw_translate|imagickpixel|imagickpixel_clear|imagickpixel_construct|imagickpixel_destroy|imagickpixel_getcolor|' +
514 'imagickpixel_getcolorasstring|imagickpixel_getcolorcount|imagickpixel_getcolorvalue|imagickpixel_gethsl|imagickpixel_issimilar|' +
515 'imagickpixel_setcolor|imagickpixel_setcolorvalue|imagickpixel_sethsl|imagickpixeliterator|imagickpixeliterator_clear|' +
516 'imagickpixeliterator_construct|imagickpixeliterator_destroy|imagickpixeliterator_getcurrentiteratorrow|' +
517 'imagickpixeliterator_getiteratorrow|imagickpixeliterator_getnextiteratorrow|imagickpixeliterator_getpreviousiteratorrow|' +
518 'imagickpixeliterator_newpixeliterator|imagickpixeliterator_newpixelregioniterator|imagickpixeliterator_resetiterator|' +
519 'imagickpixeliterator_setiteratorfirstrow|imagickpixeliterator_setiteratorlastrow|imagickpixeliterator_setiteratorrow|' +
520 'imagickpixeliterator_synciterator|imap_8bit|imap_alerts|imap_append|imap_base64|imap_binary|imap_body|imap_bodystruct|imap_check|' +
521 'imap_clearflag_full|imap_close|imap_create|imap_createmailbox|imap_delete|imap_deletemailbox|imap_errors|imap_expunge|imap_fetch_overview|' +
522 'imap_fetchbody|imap_fetchheader|imap_fetchmime|imap_fetchstructure|imap_fetchtext|imap_gc|imap_get_quota|imap_get_quotaroot|imap_getacl|' +
523 'imap_getmailboxes|imap_getsubscribed|imap_header|imap_headerinfo|imap_headers|imap_last_error|imap_list|imap_listmailbox|imap_listscan|' +
524 'imap_listsubscribed|imap_lsub|imap_mail|imap_mail_compose|imap_mail_copy|imap_mail_move|imap_mailboxmsginfo|imap_mime_header_decode|' +
525 'imap_msgno|imap_num_msg|imap_num_recent|imap_open|imap_ping|imap_qprint|imap_rename|imap_renamemailbox|imap_reopen|' +
526 'imap_rfc822_parse_adrlist|imap_rfc822_parse_headers|imap_rfc822_write_address|imap_savebody|imap_scan|imap_scanmailbox|imap_search|' +
527 'imap_set_quota|imap_setacl|imap_setflag_full|imap_sort|imap_status|imap_subscribe|imap_thread|imap_timeout|imap_uid|imap_undelete|' +
528 'imap_unsubscribe|imap_utf7_decode|imap_utf7_encode|imap_utf8|implementsinterface|implode|import_request_variables|in_array|include|' +
529 'include_once|inclued_get_data|inet_ntop|inet_pton|infiniteiterator|ingres_autocommit|ingres_autocommit_state|ingres_charset|ingres_close|' +
530 'ingres_commit|ingres_connect|ingres_cursor|ingres_errno|ingres_error|ingres_errsqlstate|ingres_escape_string|ingres_execute|' +
531 'ingres_fetch_array|ingres_fetch_assoc|ingres_fetch_object|ingres_fetch_proc_return|ingres_fetch_row|ingres_field_length|ingres_field_name|' +
532 'ingres_field_nullable|ingres_field_precision|ingres_field_scale|ingres_field_type|ingres_free_result|ingres_next_error|ingres_num_fields|' +
533 'ingres_num_rows|ingres_pconnect|ingres_prepare|ingres_query|ingres_result_seek|ingres_rollback|ingres_set_environment|' +
534 'ingres_unbuffered_query|ini_alter|ini_get|ini_get_all|ini_restore|ini_set|innamespace|inotify_add_watch|inotify_init|inotify_queue_len|' +
535 'inotify_read|inotify_rm_watch|interface_exists|intl_error_name|intl_get_error_code|intl_get_error_message|intl_is_failure|' +
536 'intldateformatter|intval|invalidargumentexception|invoke|invokeargs|ip2long|iptcembed|iptcparse|is_a|is_array|is_bool|is_callable|is_dir|' +
537 '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|' +
538 'is_readable|is_real|is_resource|is_scalar|is_soap_fault|is_string|is_subclass_of|is_uploaded_file|is_writable|is_writeable|isabstract|' +
539 'iscloneable|isdisabled|isfinal|isinstance|isinstantiable|isinterface|isinternal|isiterateable|isset|issubclassof|isuserdefined|iterator|' +
540 'iterator_apply|iterator_count|iterator_to_array|iteratoraggregate|iteratoriterator|java_last_exception_clear|java_last_exception_get|' +
541 'jddayofweek|jdmonthname|jdtofrench|jdtogregorian|jdtojewish|jdtojulian|jdtounix|jewishtojd|join|jpeg2wbmp|json_decode|json_encode|' +
542 'json_last_error|jsonserializable|judy|judy_type|judy_version|juliantojd|kadm5_chpass_principal|kadm5_create_principal|' +
543 'kadm5_delete_principal|kadm5_destroy|kadm5_flush|kadm5_get_policies|kadm5_get_principal|kadm5_get_principals|kadm5_init_with_password|' +
544 'kadm5_modify_principal|key|krsort|ksort|lcfirst|lcg_value|lchgrp|lchown|ldap_8859_to_t61|ldap_add|ldap_bind|ldap_close|ldap_compare|' +
545 'ldap_connect|ldap_count_entries|ldap_delete|ldap_dn2ufn|ldap_err2str|ldap_errno|ldap_error|ldap_explode_dn|ldap_first_attribute|' +
546 'ldap_first_entry|ldap_first_reference|ldap_free_result|ldap_get_attributes|ldap_get_dn|ldap_get_entries|ldap_get_option|ldap_get_values|' +
547 'ldap_get_values_len|ldap_list|ldap_mod_add|ldap_mod_del|ldap_mod_replace|ldap_modify|ldap_next_attribute|ldap_next_entry|' +
548 'ldap_next_reference|ldap_parse_reference|ldap_parse_result|ldap_read|ldap_rename|ldap_sasl_bind|ldap_search|ldap_set_option|' +
549 'ldap_set_rebind_proc|ldap_sort|ldap_start_tls|ldap_t61_to_8859|ldap_unbind|lengthexception|levenshtein|libxml_clear_errors|' +
550 'libxml_disable_entity_loader|libxml_get_errors|libxml_get_last_error|libxml_set_streams_context|libxml_use_internal_errors|libxmlerror|' +
551 'limititerator|link|linkinfo|list|locale|localeconv|localtime|log|log10|log1p|logicexception|long2ip|lstat|ltrim|lzf_compress|' +
552 'lzf_decompress|lzf_optimized_for|m_checkstatus|m_completeauthorizations|m_connect|m_connectionerror|m_deletetrans|m_destroyconn|' +
553 'm_destroyengine|m_getcell|m_getcellbynum|m_getcommadelimited|m_getheader|m_initconn|m_initengine|m_iscommadelimited|m_maxconntimeout|' +
554 'm_monitor|m_numcolumns|m_numrows|m_parsecommadelimited|m_responsekeys|m_responseparam|m_returnstatus|m_setblocking|m_setdropfile|m_setip|' +
555 'm_setssl|m_setssl_cafile|m_setssl_files|m_settimeout|m_sslcert_gen_hash|m_transactionssent|m_transinqueue|m_transkeyval|m_transnew|' +
556 'm_transsend|m_uwait|m_validateidentifier|m_verifyconnection|m_verifysslcert|magic_quotes_runtime|mail|' +
557 'mailparse_determine_best_xfer_encoding|mailparse_msg_create|mailparse_msg_extract_part|mailparse_msg_extract_part_file|' +
558 'mailparse_msg_extract_whole_part_file|mailparse_msg_free|mailparse_msg_get_part|mailparse_msg_get_part_data|mailparse_msg_get_structure|' +
559 'mailparse_msg_parse|mailparse_msg_parse_file|mailparse_rfc822_parse_addresses|mailparse_stream_encode|mailparse_uudecode_all|main|max|' +
560 'maxdb_affected_rows|maxdb_autocommit|maxdb_bind_param|maxdb_bind_result|maxdb_change_user|maxdb_character_set_name|maxdb_client_encoding|' +
561 'maxdb_close|maxdb_close_long_data|maxdb_commit|maxdb_connect|maxdb_connect_errno|maxdb_connect_error|maxdb_data_seek|maxdb_debug|' +
562 'maxdb_disable_reads_from_master|maxdb_disable_rpl_parse|maxdb_dump_debug_info|maxdb_embedded_connect|maxdb_enable_reads_from_master|' +
563 'maxdb_enable_rpl_parse|maxdb_errno|maxdb_error|maxdb_escape_string|maxdb_execute|maxdb_fetch|maxdb_fetch_array|maxdb_fetch_assoc|' +
564 'maxdb_fetch_field|maxdb_fetch_field_direct|maxdb_fetch_fields|maxdb_fetch_lengths|maxdb_fetch_object|maxdb_fetch_row|maxdb_field_count|' +
565 'maxdb_field_seek|maxdb_field_tell|maxdb_free_result|maxdb_get_client_info|maxdb_get_client_version|maxdb_get_host_info|maxdb_get_metadata|' +
566 'maxdb_get_proto_info|maxdb_get_server_info|maxdb_get_server_version|maxdb_info|maxdb_init|maxdb_insert_id|maxdb_kill|maxdb_master_query|' +
567 'maxdb_more_results|maxdb_multi_query|maxdb_next_result|maxdb_num_fields|maxdb_num_rows|maxdb_options|maxdb_param_count|maxdb_ping|' +
568 'maxdb_prepare|maxdb_query|maxdb_real_connect|maxdb_real_escape_string|maxdb_real_query|maxdb_report|maxdb_rollback|' +
569 'maxdb_rpl_parse_enabled|maxdb_rpl_probe|maxdb_rpl_query_type|maxdb_select_db|maxdb_send_long_data|maxdb_send_query|maxdb_server_end|' +
570 'maxdb_server_init|maxdb_set_opt|maxdb_sqlstate|maxdb_ssl_set|maxdb_stat|maxdb_stmt_affected_rows|maxdb_stmt_bind_param|' +
571 'maxdb_stmt_bind_result|maxdb_stmt_close|maxdb_stmt_close_long_data|maxdb_stmt_data_seek|maxdb_stmt_errno|maxdb_stmt_error|' +
572 'maxdb_stmt_execute|maxdb_stmt_fetch|maxdb_stmt_free_result|maxdb_stmt_init|maxdb_stmt_num_rows|maxdb_stmt_param_count|maxdb_stmt_prepare|' +
573 'maxdb_stmt_reset|maxdb_stmt_result_metadata|maxdb_stmt_send_long_data|maxdb_stmt_sqlstate|maxdb_stmt_store_result|maxdb_store_result|' +
574 'maxdb_thread_id|maxdb_thread_safe|maxdb_use_result|maxdb_warning_count|mb_check_encoding|mb_convert_case|mb_convert_encoding|' +
575 'mb_convert_kana|mb_convert_variables|mb_decode_mimeheader|mb_decode_numericentity|mb_detect_encoding|mb_detect_order|mb_encode_mimeheader|' +
576 'mb_encode_numericentity|mb_encoding_aliases|mb_ereg|mb_ereg_match|mb_ereg_replace|mb_ereg_search|mb_ereg_search_getpos|' +
577 '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|' +
578 'mb_get_info|mb_http_input|mb_http_output|mb_internal_encoding|mb_language|mb_list_encodings|mb_output_handler|mb_parse_str|' +
579 'mb_preferred_mime_name|mb_regex_encoding|mb_regex_set_options|mb_send_mail|mb_split|mb_strcut|mb_strimwidth|mb_stripos|mb_stristr|' +
580 'mb_strlen|mb_strpos|mb_strrchr|mb_strrichr|mb_strripos|mb_strrpos|mb_strstr|mb_strtolower|mb_strtoupper|mb_strwidth|' +
581 'mb_substitute_character|mb_substr|mb_substr_count|mcrypt_cbc|mcrypt_cfb|mcrypt_create_iv|mcrypt_decrypt|mcrypt_ecb|' +
582 '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|' +
583 'mcrypt_enc_get_supported_key_sizes|mcrypt_enc_is_block_algorithm|mcrypt_enc_is_block_algorithm_mode|mcrypt_enc_is_block_mode|' +
584 'mcrypt_enc_self_test|mcrypt_encrypt|mcrypt_generic|mcrypt_generic_deinit|mcrypt_generic_end|mcrypt_generic_init|mcrypt_get_block_size|' +
585 'mcrypt_get_cipher_name|mcrypt_get_iv_size|mcrypt_get_key_size|mcrypt_list_algorithms|mcrypt_list_modes|mcrypt_module_close|' +
586 'mcrypt_module_get_algo_block_size|mcrypt_module_get_algo_key_size|mcrypt_module_get_supported_key_sizes|mcrypt_module_is_block_algorithm|' +
587 'mcrypt_module_is_block_algorithm_mode|mcrypt_module_is_block_mode|mcrypt_module_open|mcrypt_module_self_test|mcrypt_ofb|md5|md5_file|' +
588 'mdecrypt_generic|memcache|memcache_debug|memcached|memory_get_peak_usage|memory_get_usage|messageformatter|metaphone|method_exists|mhash|' +
589 'mhash_count|mhash_get_block_size|mhash_get_hash_name|mhash_keygen_s2k|microtime|mime_content_type|min|ming_keypress|' +
590 'ming_setcubicthreshold|ming_setscale|ming_setswfcompression|ming_useconstants|ming_useswfversion|mkdir|mktime|money_format|mongo|' +
591 'mongobindata|mongocode|mongocollection|mongoconnectionexception|mongocursor|mongocursorexception|mongocursortimeoutexception|mongodate|' +
592 'mongodb|mongodbref|mongoexception|mongogridfs|mongogridfscursor|mongogridfsexception|mongogridfsfile|mongoid|mongoint32|mongoint64|' +
593 'mongomaxkey|mongominkey|mongoregex|mongotimestamp|move_uploaded_file|mpegfile|mqseries_back|mqseries_begin|mqseries_close|mqseries_cmit|' +
594 'mqseries_conn|mqseries_connx|mqseries_disc|mqseries_get|mqseries_inq|mqseries_open|mqseries_put|mqseries_put1|mqseries_set|' +
595 'mqseries_strerror|msession_connect|msession_count|msession_create|msession_destroy|msession_disconnect|msession_find|msession_get|' +
596 'msession_get_array|msession_get_data|msession_inc|msession_list|msession_listvar|msession_lock|msession_plugin|msession_randstr|' +
597 'msession_set|msession_set_array|msession_set_data|msession_timeout|msession_uniq|msession_unlock|msg_get_queue|msg_queue_exists|' +
598 'msg_receive|msg_remove_queue|msg_send|msg_set_queue|msg_stat_queue|msql|msql_affected_rows|msql_close|msql_connect|msql_create_db|' +
599 'msql_createdb|msql_data_seek|msql_db_query|msql_dbname|msql_drop_db|msql_error|msql_fetch_array|msql_fetch_field|msql_fetch_object|' +
600 'msql_fetch_row|msql_field_flags|msql_field_len|msql_field_name|msql_field_seek|msql_field_table|msql_field_type|msql_fieldflags|' +
601 'msql_fieldlen|msql_fieldname|msql_fieldtable|msql_fieldtype|msql_free_result|msql_list_dbs|msql_list_fields|msql_list_tables|' +
602 'msql_num_fields|msql_num_rows|msql_numfields|msql_numrows|msql_pconnect|msql_query|msql_regcase|msql_result|msql_select_db|msql_tablename|' +
603 'mssql_bind|mssql_close|mssql_connect|mssql_data_seek|mssql_execute|mssql_fetch_array|mssql_fetch_assoc|mssql_fetch_batch|' +
604 'mssql_fetch_field|mssql_fetch_object|mssql_fetch_row|mssql_field_length|mssql_field_name|mssql_field_seek|mssql_field_type|' +
605 'mssql_free_result|mssql_free_statement|mssql_get_last_message|mssql_guid_string|mssql_init|mssql_min_error_severity|' +
606 'mssql_min_message_severity|mssql_next_result|mssql_num_fields|mssql_num_rows|mssql_pconnect|mssql_query|mssql_result|mssql_rows_affected|' +
607 'mssql_select_db|mt_getrandmax|mt_rand|mt_srand|multipleiterator|mysql_affected_rows|mysql_client_encoding|mysql_close|mysql_connect|' +
608 '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|' +
609 'mysql_fetch_assoc|mysql_fetch_field|mysql_fetch_lengths|mysql_fetch_object|mysql_fetch_row|mysql_field_flags|mysql_field_len|' +
610 'mysql_field_name|mysql_field_seek|mysql_field_table|mysql_field_type|mysql_free_result|mysql_get_client_info|mysql_get_host_info|' +
611 'mysql_get_proto_info|mysql_get_server_info|mysql_info|mysql_insert_id|mysql_list_dbs|mysql_list_fields|mysql_list_processes|' +
612 'mysql_list_tables|mysql_num_fields|mysql_num_rows|mysql_pconnect|mysql_ping|mysql_query|mysql_real_escape_string|mysql_result|' +
613 'mysql_select_db|mysql_set_charset|mysql_stat|mysql_tablename|mysql_thread_id|mysql_unbuffered_query|mysqli|mysqli_bind_param|' +
614 'mysqli_bind_result|mysqli_client_encoding|mysqli_connect|mysqli_disable_reads_from_master|mysqli_disable_rpl_parse|mysqli_driver|' +
615 'mysqli_enable_reads_from_master|mysqli_enable_rpl_parse|mysqli_escape_string|mysqli_execute|mysqli_fetch|mysqli_get_metadata|' +
616 'mysqli_master_query|mysqli_param_count|mysqli_report|mysqli_result|mysqli_rpl_parse_enabled|mysqli_rpl_probe|mysqli_rpl_query_type|' +
617 'mysqli_send_long_data|mysqli_send_query|mysqli_set_opt|mysqli_slave_query|mysqli_stmt|mysqli_warning|mysqlnd_ms_get_stats|' +
618 'mysqlnd_ms_query_is_select|mysqlnd_ms_set_user_pick_server|mysqlnd_qc_change_handler|mysqlnd_qc_clear_cache|mysqlnd_qc_get_cache_info|' +
619 'mysqlnd_qc_get_core_stats|mysqlnd_qc_get_handler|mysqlnd_qc_get_query_trace_log|mysqlnd_qc_set_user_handlers|natcasesort|natsort|' +
620 'ncurses_addch|ncurses_addchnstr|ncurses_addchstr|ncurses_addnstr|ncurses_addstr|ncurses_assume_default_colors|ncurses_attroff|' +
621 'ncurses_attron|ncurses_attrset|ncurses_baudrate|ncurses_beep|ncurses_bkgd|ncurses_bkgdset|ncurses_border|ncurses_bottom_panel|' +
622 'ncurses_can_change_color|ncurses_cbreak|ncurses_clear|ncurses_clrtobot|ncurses_clrtoeol|ncurses_color_content|ncurses_color_set|' +
623 'ncurses_curs_set|ncurses_def_prog_mode|ncurses_def_shell_mode|ncurses_define_key|ncurses_del_panel|ncurses_delay_output|ncurses_delch|' +
624 'ncurses_deleteln|ncurses_delwin|ncurses_doupdate|ncurses_echo|ncurses_echochar|ncurses_end|ncurses_erase|ncurses_erasechar|ncurses_filter|' +
625 'ncurses_flash|ncurses_flushinp|ncurses_getch|ncurses_getmaxyx|ncurses_getmouse|ncurses_getyx|ncurses_halfdelay|ncurses_has_colors|' +
626 'ncurses_has_ic|ncurses_has_il|ncurses_has_key|ncurses_hide_panel|ncurses_hline|ncurses_inch|ncurses_init|ncurses_init_color|' +
627 'ncurses_init_pair|ncurses_insch|ncurses_insdelln|ncurses_insertln|ncurses_insstr|ncurses_instr|ncurses_isendwin|ncurses_keyok|' +
628 'ncurses_keypad|ncurses_killchar|ncurses_longname|ncurses_meta|ncurses_mouse_trafo|ncurses_mouseinterval|ncurses_mousemask|ncurses_move|' +
629 'ncurses_move_panel|ncurses_mvaddch|ncurses_mvaddchnstr|ncurses_mvaddchstr|ncurses_mvaddnstr|ncurses_mvaddstr|ncurses_mvcur|' +
630 'ncurses_mvdelch|ncurses_mvgetch|ncurses_mvhline|ncurses_mvinch|ncurses_mvvline|ncurses_mvwaddstr|ncurses_napms|ncurses_new_panel|' +
631 'ncurses_newpad|ncurses_newwin|ncurses_nl|ncurses_nocbreak|ncurses_noecho|ncurses_nonl|ncurses_noqiflush|ncurses_noraw|' +
632 'ncurses_pair_content|ncurses_panel_above|ncurses_panel_below|ncurses_panel_window|ncurses_pnoutrefresh|ncurses_prefresh|ncurses_putp|' +
633 'ncurses_qiflush|ncurses_raw|ncurses_refresh|ncurses_replace_panel|ncurses_reset_prog_mode|ncurses_reset_shell_mode|ncurses_resetty|' +
634 'ncurses_savetty|ncurses_scr_dump|ncurses_scr_init|ncurses_scr_restore|ncurses_scr_set|ncurses_scrl|ncurses_show_panel|ncurses_slk_attr|' +
635 'ncurses_slk_attroff|ncurses_slk_attron|ncurses_slk_attrset|ncurses_slk_clear|ncurses_slk_color|ncurses_slk_init|ncurses_slk_noutrefresh|' +
636 'ncurses_slk_refresh|ncurses_slk_restore|ncurses_slk_set|ncurses_slk_touch|ncurses_standend|ncurses_standout|ncurses_start_color|' +
637 'ncurses_termattrs|ncurses_termname|ncurses_timeout|ncurses_top_panel|ncurses_typeahead|ncurses_ungetch|ncurses_ungetmouse|' +
638 'ncurses_update_panels|ncurses_use_default_colors|ncurses_use_env|ncurses_use_extended_names|ncurses_vidattr|ncurses_vline|ncurses_waddch|' +
639 'ncurses_waddstr|ncurses_wattroff|ncurses_wattron|ncurses_wattrset|ncurses_wborder|ncurses_wclear|ncurses_wcolor_set|ncurses_werase|' +
640 'ncurses_wgetch|ncurses_whline|ncurses_wmouse_trafo|ncurses_wmove|ncurses_wnoutrefresh|ncurses_wrefresh|ncurses_wstandend|' +
641 'ncurses_wstandout|ncurses_wvline|newinstance|newinstanceargs|newt_bell|newt_button|newt_button_bar|newt_centered_window|newt_checkbox|' +
642 'newt_checkbox_get_value|newt_checkbox_set_flags|newt_checkbox_set_value|newt_checkbox_tree|newt_checkbox_tree_add_item|' +
643 'newt_checkbox_tree_find_item|newt_checkbox_tree_get_current|newt_checkbox_tree_get_entry_value|newt_checkbox_tree_get_multi_selection|' +
644 'newt_checkbox_tree_get_selection|newt_checkbox_tree_multi|newt_checkbox_tree_set_current|newt_checkbox_tree_set_entry|' +
645 'newt_checkbox_tree_set_entry_value|newt_checkbox_tree_set_width|newt_clear_key_buffer|newt_cls|newt_compact_button|' +
646 'newt_component_add_callback|newt_component_takes_focus|newt_create_grid|newt_cursor_off|newt_cursor_on|newt_delay|newt_draw_form|' +
647 '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|' +
648 'newt_form_add_component|newt_form_add_components|newt_form_add_hot_key|newt_form_destroy|newt_form_get_current|newt_form_run|' +
649 'newt_form_set_background|newt_form_set_height|newt_form_set_size|newt_form_set_timer|newt_form_set_width|newt_form_watch_fd|' +
650 '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|' +
651 'newt_grid_h_stacked|newt_grid_place|newt_grid_set_field|newt_grid_simple_window|newt_grid_v_close_stacked|newt_grid_v_stacked|' +
652 'newt_grid_wrapped_window|newt_grid_wrapped_window_at|newt_init|newt_label|newt_label_set_text|newt_listbox|newt_listbox_append_entry|' +
653 'newt_listbox_clear|newt_listbox_clear_selection|newt_listbox_delete_entry|newt_listbox_get_current|newt_listbox_get_selection|' +
654 'newt_listbox_insert_entry|newt_listbox_item_count|newt_listbox_select_item|newt_listbox_set_current|newt_listbox_set_current_by_key|' +
655 'newt_listbox_set_data|newt_listbox_set_entry|newt_listbox_set_width|newt_listitem|newt_listitem_get_data|newt_listitem_set|' +
656 'newt_open_window|newt_pop_help_line|newt_pop_window|newt_push_help_line|newt_radio_get_current|newt_radiobutton|newt_redraw_help_line|' +
657 'newt_reflow_text|newt_refresh|newt_resize_screen|newt_resume|newt_run_form|newt_scale|newt_scale_set|newt_scrollbar_set|' +
658 'newt_set_help_callback|newt_set_suspend_callback|newt_suspend|newt_textbox|newt_textbox_get_num_lines|newt_textbox_reflowed|' +
659 'newt_textbox_set_height|newt_textbox_set_text|newt_vertical_scrollbar|newt_wait_for_key|newt_win_choice|newt_win_entries|newt_win_menu|' +
660 'newt_win_message|newt_win_messagev|newt_win_ternary|next|ngettext|nl2br|nl_langinfo|norewinditerator|normalizer|notes_body|notes_copy_db|' +
661 'notes_create_db|notes_create_note|notes_drop_db|notes_find_note|notes_header_info|notes_list_msgs|notes_mark_read|notes_mark_unread|' +
662 'notes_nav_create|notes_search|notes_unread|notes_version|nsapi_request_headers|nsapi_response_headers|nsapi_virtual|nthmac|number_format|' +
663 'numberformatter|oauth|oauth_get_sbs|oauth_urlencode|oauthexception|oauthprovider|ob_clean|ob_deflatehandler|ob_end_clean|ob_end_flush|' +
664 '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|' +
665 'ob_implicit_flush|ob_inflatehandler|ob_list_handlers|ob_start|ob_tidyhandler|oci_bind_array_by_name|oci_bind_by_name|oci_cancel|' +
666 'oci_client_version|oci_close|oci_collection_append|oci_collection_assign|oci_collection_element_assign|oci_collection_element_get|' +
667 'oci_collection_free|oci_collection_max|oci_collection_size|oci_collection_trim|oci_commit|oci_connect|oci_define_by_name|oci_error|' +
668 '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|' +
669 '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|' +
670 '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|' +
671 '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|' +
672 'oci_lob_tell|oci_lob_truncate|oci_lob_write|oci_lob_writetemporary|oci_lob_writetofile|oci_new_collection|oci_new_connect|oci_new_cursor|' +
673 'oci_new_descriptor|oci_num_fields|oci_num_rows|oci_parse|oci_password_change|oci_pconnect|oci_result|oci_rollback|oci_server_version|' +
674 'oci_set_action|oci_set_client_identifier|oci_set_client_info|oci_set_edition|oci_set_module_name|oci_set_prefetch|oci_statement_type|' +
675 'ocibindbyname|ocicancel|ocicloselob|ocicollappend|ocicollassign|ocicollassignelem|ocicollgetelem|ocicollmax|ocicollsize|ocicolltrim|' +
676 'ocicolumnisnull|ocicolumnname|ocicolumnprecision|ocicolumnscale|ocicolumnsize|ocicolumntype|ocicolumntyperaw|ocicommit|ocidefinebyname|' +
677 'ocierror|ociexecute|ocifetch|ocifetchinto|ocifetchstatement|ocifreecollection|ocifreecursor|ocifreedesc|ocifreestatement|ociinternaldebug|' +
678 'ociloadlob|ocilogoff|ocilogon|ocinewcollection|ocinewcursor|ocinewdescriptor|ocinlogon|ocinumcols|ociparse|ociplogon|ociresult|' +
679 'ocirollback|ocirowcount|ocisavelob|ocisavelobfile|ociserverversion|ocisetprefetch|ocistatementtype|ociwritelobtofile|ociwritetemporarylob|' +
680 'octdec|odbc_autocommit|odbc_binmode|odbc_close|odbc_close_all|odbc_columnprivileges|odbc_columns|odbc_commit|odbc_connect|odbc_cursor|' +
681 'odbc_data_source|odbc_do|odbc_error|odbc_errormsg|odbc_exec|odbc_execute|odbc_fetch_array|odbc_fetch_into|odbc_fetch_object|' +
682 'odbc_fetch_row|odbc_field_len|odbc_field_name|odbc_field_num|odbc_field_precision|odbc_field_scale|odbc_field_type|odbc_foreignkeys|' +
683 'odbc_free_result|odbc_gettypeinfo|odbc_longreadlen|odbc_next_result|odbc_num_fields|odbc_num_rows|odbc_pconnect|odbc_prepare|' +
684 'odbc_primarykeys|odbc_procedurecolumns|odbc_procedures|odbc_result|odbc_result_all|odbc_rollback|odbc_setoption|odbc_specialcolumns|' +
685 'odbc_statistics|odbc_tableprivileges|odbc_tables|openal_buffer_create|openal_buffer_data|openal_buffer_destroy|openal_buffer_get|' +
686 'openal_buffer_loadwav|openal_context_create|openal_context_current|openal_context_destroy|openal_context_process|openal_context_suspend|' +
687 'openal_device_close|openal_device_open|openal_listener_get|openal_listener_set|openal_source_create|openal_source_destroy|' +
688 'openal_source_get|openal_source_pause|openal_source_play|openal_source_rewind|openal_source_set|openal_source_stop|openal_stream|opendir|' +
689 'openlog|openssl_cipher_iv_length|openssl_csr_export|openssl_csr_export_to_file|openssl_csr_get_public_key|openssl_csr_get_subject|' +
690 'openssl_csr_new|openssl_csr_sign|openssl_decrypt|openssl_dh_compute_key|openssl_digest|openssl_encrypt|openssl_error_string|' +
691 'openssl_free_key|openssl_get_cipher_methods|openssl_get_md_methods|openssl_get_privatekey|openssl_get_publickey|openssl_open|' +
692 'openssl_pkcs12_export|openssl_pkcs12_export_to_file|openssl_pkcs12_read|openssl_pkcs7_decrypt|openssl_pkcs7_encrypt|openssl_pkcs7_sign|' +
693 'openssl_pkcs7_verify|openssl_pkey_export|openssl_pkey_export_to_file|openssl_pkey_free|openssl_pkey_get_details|openssl_pkey_get_private|' +
694 'openssl_pkey_get_public|openssl_pkey_new|openssl_private_decrypt|openssl_private_encrypt|openssl_public_decrypt|openssl_public_encrypt|' +
695 'openssl_random_pseudo_bytes|openssl_seal|openssl_sign|openssl_verify|openssl_x509_check_private_key|openssl_x509_checkpurpose|' +
696 'openssl_x509_export|openssl_x509_export_to_file|openssl_x509_free|openssl_x509_parse|openssl_x509_read|ord|outeriterator|' +
697 'outofboundsexception|outofrangeexception|output_add_rewrite_var|output_reset_rewrite_vars|overflowexception|overload|override_function|' +
698 'ovrimos_close|ovrimos_commit|ovrimos_connect|ovrimos_cursor|ovrimos_exec|ovrimos_execute|ovrimos_fetch_into|ovrimos_fetch_row|' +
699 'ovrimos_field_len|ovrimos_field_name|ovrimos_field_num|ovrimos_field_type|ovrimos_free_result|ovrimos_longreadlen|ovrimos_num_fields|' +
700 'ovrimos_num_rows|ovrimos_prepare|ovrimos_result|ovrimos_result_all|ovrimos_rollback|pack|parentiterator|parse_ini_file|parse_ini_string|' +
701 'parse_str|parse_url|parsekit_compile_file|parsekit_compile_string|parsekit_func_arginfo|passthru|pathinfo|pclose|pcntl_alarm|pcntl_exec|' +
702 'pcntl_fork|pcntl_getpriority|pcntl_setpriority|pcntl_signal|pcntl_signal_dispatch|pcntl_sigprocmask|pcntl_sigtimedwait|pcntl_sigwaitinfo|' +
703 'pcntl_wait|pcntl_waitpid|pcntl_wexitstatus|pcntl_wifexited|pcntl_wifsignaled|pcntl_wifstopped|pcntl_wstopsig|pcntl_wtermsig|' +
704 'pdf_activate_item|pdf_add_annotation|pdf_add_bookmark|pdf_add_launchlink|pdf_add_locallink|pdf_add_nameddest|pdf_add_note|pdf_add_outline|' +
705 '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|' +
706 '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|' +
707 'pdf_begin_template_ext|pdf_circle|pdf_clip|pdf_close|pdf_close_image|pdf_close_pdi|pdf_close_pdi_page|pdf_closepath|' +
708 'pdf_closepath_fill_stroke|pdf_closepath_stroke|pdf_concat|pdf_continue_text|pdf_create_3dview|pdf_create_action|pdf_create_annotation|' +
709 'pdf_create_bookmark|pdf_create_field|pdf_create_fieldgroup|pdf_create_gstate|pdf_create_pvf|pdf_create_textflow|pdf_curveto|' +
710 'pdf_define_layer|pdf_delete|pdf_delete_pvf|pdf_delete_table|pdf_delete_textflow|pdf_encoding_set_char|pdf_end_document|pdf_end_font|' +
711 '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|' +
712 'pdf_fill_imageblock|pdf_fill_pdfblock|pdf_fill_stroke|pdf_fill_textblock|pdf_findfont|pdf_fit_image|pdf_fit_pdi_page|pdf_fit_table|' +
713 'pdf_fit_textflow|pdf_fit_textline|pdf_get_apiname|pdf_get_buffer|pdf_get_errmsg|pdf_get_errnum|pdf_get_font|pdf_get_fontname|' +
714 'pdf_get_fontsize|pdf_get_image_height|pdf_get_image_width|pdf_get_majorversion|pdf_get_minorversion|pdf_get_parameter|' +
715 '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|' +
716 'pdf_initgraphics|pdf_lineto|pdf_load_3ddata|pdf_load_font|pdf_load_iccprofile|pdf_load_image|pdf_makespotcolor|pdf_moveto|pdf_new|' +
717 '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|' +
718 '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|' +
719 'pdf_place_pdi_page|pdf_process_pdi|pdf_rect|pdf_restore|pdf_resume_page|pdf_rotate|pdf_save|pdf_scale|pdf_set_border_color|' +
720 '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|' +
721 'pdf_set_info_author|pdf_set_info_creator|pdf_set_info_keywords|pdf_set_info_subject|pdf_set_info_title|pdf_set_layer_dependency|' +
722 '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|' +
723 'pdf_set_word_spacing|pdf_setcolor|pdf_setdash|pdf_setdashpattern|pdf_setflat|pdf_setfont|pdf_setgray|pdf_setgray_fill|pdf_setgray_stroke|' +
724 'pdf_setlinecap|pdf_setlinejoin|pdf_setlinewidth|pdf_setmatrix|pdf_setmiterlimit|pdf_setpolydash|pdf_setrgbcolor|pdf_setrgbcolor_fill|' +
725 'pdf_setrgbcolor_stroke|pdf_shading|pdf_shading_pattern|pdf_shfill|pdf_show|pdf_show_boxed|pdf_show_xy|pdf_skew|pdf_stringwidth|pdf_stroke|' +
726 'pdf_suspend_page|pdf_translate|pdf_utf16_to_utf8|pdf_utf32_to_utf16|pdf_utf8_to_utf16|pdo|pdo_cubrid_schema|pdo_pgsqllobcreate|' +
727 'pdo_pgsqllobopen|pdo_pgsqllobunlink|pdo_sqlitecreateaggregate|pdo_sqlitecreatefunction|pdoexception|pdostatement|pfsockopen|' +
728 'pg_affected_rows|pg_cancel_query|pg_client_encoding|pg_close|pg_connect|pg_connection_busy|pg_connection_reset|pg_connection_status|' +
729 '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|' +
730 '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|' +
731 '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|' +
732 '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|' +
733 '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|' +
734 '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|' +
735 '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|' +
736 'pg_set_error_verbosity|pg_trace|pg_transaction_status|pg_tty|pg_unescape_bytea|pg_untrace|pg_update|pg_version|php_check_syntax|' +
737 'php_ini_loaded_file|php_ini_scanned_files|php_logo_guid|php_sapi_name|php_strip_whitespace|php_uname|phpcredits|phpinfo|phpversion|pi|' +
738 'png2wbmp|popen|pos|posix_access|posix_ctermid|posix_errno|posix_get_last_error|posix_getcwd|posix_getegid|posix_geteuid|posix_getgid|' +
739 'posix_getgrgid|posix_getgrnam|posix_getgroups|posix_getlogin|posix_getpgid|posix_getpgrp|posix_getpid|posix_getppid|posix_getpwnam|' +
740 'posix_getpwuid|posix_getrlimit|posix_getsid|posix_getuid|posix_initgroups|posix_isatty|posix_kill|posix_mkfifo|posix_mknod|posix_setegid|' +
741 'posix_seteuid|posix_setgid|posix_setpgid|posix_setsid|posix_setuid|posix_strerror|posix_times|posix_ttyname|posix_uname|pow|preg_filter|' +
742 'preg_grep|preg_last_error|preg_match|preg_match_all|preg_quote|preg_replace|preg_replace_callback|preg_split|prev|print|print_r|' +
743 'printer_abort|printer_close|printer_create_brush|printer_create_dc|printer_create_font|printer_create_pen|printer_delete_brush|' +
744 'printer_delete_dc|printer_delete_font|printer_delete_pen|printer_draw_bmp|printer_draw_chord|printer_draw_elipse|printer_draw_line|' +
745 'printer_draw_pie|printer_draw_rectangle|printer_draw_roundrect|printer_draw_text|printer_end_doc|printer_end_page|printer_get_option|' +
746 'printer_list|printer_logical_fontheight|printer_open|printer_select_brush|printer_select_font|printer_select_pen|printer_set_option|' +
747 'printer_start_doc|printer_start_page|printer_write|printf|proc_close|proc_get_status|proc_nice|proc_open|proc_terminate|property_exists|' +
748 '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|' +
749 '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|' +
750 '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|' +
751 'ps_hyphenate|ps_include_file|ps_lineto|ps_makespotcolor|ps_moveto|ps_new|ps_open_file|ps_open_image|ps_open_image_file|' +
752 '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|' +
753 '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|' +
754 'ps_setlinecap|ps_setlinejoin|ps_setlinewidth|ps_setmiterlimit|ps_setoverprintmode|ps_setpolydash|ps_shading|ps_shading_pattern|ps_shfill|' +
755 '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|' +
756 'ps_symbol_width|ps_translate|pspell_add_to_personal|pspell_add_to_session|pspell_check|pspell_clear_session|pspell_config_create|' +
757 'pspell_config_data_dir|pspell_config_dict_dir|pspell_config_ignore|pspell_config_mode|pspell_config_personal|pspell_config_repl|' +
758 'pspell_config_runtogether|pspell_config_save_repl|pspell_new|pspell_new_config|pspell_new_personal|pspell_save_wordlist|' +
759 'pspell_store_replacement|pspell_suggest|putenv|px_close|px_create_fp|px_date2string|px_delete|px_delete_record|px_get_field|px_get_info|' +
760 '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|' +
761 'px_retrieve_record|px_set_blob_file|px_set_parameter|px_set_tablename|px_set_targetencoding|px_set_value|px_timestamp2string|' +
762 'px_update_record|qdom_error|qdom_tree|quoted_printable_decode|quoted_printable_encode|quotemeta|rad2deg|radius_acct_open|' +
763 'radius_add_server|radius_auth_open|radius_close|radius_config|radius_create_request|radius_cvt_addr|radius_cvt_int|radius_cvt_string|' +
764 'radius_demangle|radius_demangle_mppe_key|radius_get_attr|radius_get_vendor_attr|radius_put_addr|radius_put_attr|radius_put_int|' +
765 'radius_put_string|radius_put_vendor_addr|radius_put_vendor_attr|radius_put_vendor_int|radius_put_vendor_string|' +
766 'radius_request_authenticator|radius_send_request|radius_server_secret|radius_strerror|rand|range|rangeexception|rar_wrapper_cache_stats|' +
767 'rararchive|rarentry|rarexception|rawurldecode|rawurlencode|read_exif_data|readdir|readfile|readgzfile|readline|readline_add_history|' +
768 'readline_callback_handler_install|readline_callback_handler_remove|readline_callback_read_char|readline_clear_history|' +
769 'readline_completion_function|readline_info|readline_list_history|readline_on_new_line|readline_read_history|readline_redisplay|' +
770 'readline_write_history|readlink|realpath|realpath_cache_get|realpath_cache_size|recode|recode_file|recode_string|recursivearrayiterator|' +
771 'recursivecachingiterator|recursivecallbackfilteriterator|recursivedirectoryiterator|recursivefilteriterator|recursiveiterator|' +
772 'recursiveiteratoriterator|recursiveregexiterator|recursivetreeiterator|reflection|reflectionclass|reflectionexception|reflectionextension|' +
773 'reflectionfunction|reflectionfunctionabstract|reflectionmethod|reflectionobject|reflectionparameter|reflectionproperty|reflector|' +
774 'regexiterator|register_shutdown_function|register_tick_function|rename|rename_function|require|require_once|reset|resetValue|' +
775 'resourcebundle|restore_error_handler|restore_exception_handler|restore_include_path|return|rewind|rewinddir|rmdir|round|rpm_close|' +
776 '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|' +
777 'rrd_restore|rrd_tune|rrd_update|rrd_xport|rrdcreator|rrdgraph|rrdupdater|rsort|rtrim|runkit_class_adopt|runkit_class_emancipate|' +
778 'runkit_constant_add|runkit_constant_redefine|runkit_constant_remove|runkit_function_add|runkit_function_copy|runkit_function_redefine|' +
779 'runkit_function_remove|runkit_function_rename|runkit_import|runkit_lint|runkit_lint_file|runkit_method_add|runkit_method_copy|' +
780 'runkit_method_redefine|runkit_method_remove|runkit_method_rename|runkit_return_value_used|runkit_sandbox_output_handler|' +
781 'runkit_superglobals|runtimeexception|samconnection_commit|samconnection_connect|samconnection_constructor|samconnection_disconnect|' +
782 'samconnection_errno|samconnection_error|samconnection_isconnected|samconnection_peek|samconnection_peekall|samconnection_receive|' +
783 'samconnection_remove|samconnection_rollback|samconnection_send|samconnection_setDebug|samconnection_subscribe|samconnection_unsubscribe|' +
784 'sammessage_body|sammessage_constructor|sammessage_header|sca_createdataobject|sca_getservice|sca_localproxy_createdataobject|' +
785 'sca_soapproxy_createdataobject|scandir|sdo_das_changesummary_beginlogging|sdo_das_changesummary_endlogging|' +
786 'sdo_das_changesummary_getchangeddataobjects|sdo_das_changesummary_getchangetype|sdo_das_changesummary_getoldcontainer|' +
787 'sdo_das_changesummary_getoldvalues|sdo_das_changesummary_islogging|sdo_das_datafactory_addpropertytotype|sdo_das_datafactory_addtype|' +
788 'sdo_das_datafactory_getdatafactory|sdo_das_dataobject_getchangesummary|sdo_das_relational_applychanges|sdo_das_relational_construct|' +
789 'sdo_das_relational_createrootdataobject|sdo_das_relational_executepreparedquery|sdo_das_relational_executequery|' +
790 'sdo_das_setting_getlistindex|sdo_das_setting_getpropertyindex|sdo_das_setting_getpropertyname|sdo_das_setting_getvalue|' +
791 'sdo_das_setting_isset|sdo_das_xml_addtypes|sdo_das_xml_create|sdo_das_xml_createdataobject|sdo_das_xml_createdocument|' +
792 'sdo_das_xml_document_getrootdataobject|sdo_das_xml_document_getrootelementname|sdo_das_xml_document_getrootelementuri|' +
793 'sdo_das_xml_document_setencoding|sdo_das_xml_document_setxmldeclaration|sdo_das_xml_document_setxmlversion|sdo_das_xml_loadfile|' +
794 'sdo_das_xml_loadstring|sdo_das_xml_savefile|sdo_das_xml_savestring|sdo_datafactory_create|sdo_dataobject_clear|' +
795 'sdo_dataobject_createdataobject|sdo_dataobject_getcontainer|sdo_dataobject_getsequence|sdo_dataobject_gettypename|' +
796 'sdo_dataobject_gettypenamespaceuri|sdo_exception_getcause|sdo_list_insert|sdo_model_property_getcontainingtype|' +
797 'sdo_model_property_getdefault|sdo_model_property_getname|sdo_model_property_gettype|sdo_model_property_iscontainment|' +
798 'sdo_model_property_ismany|sdo_model_reflectiondataobject_construct|sdo_model_reflectiondataobject_export|' +
799 'sdo_model_reflectiondataobject_getcontainmentproperty|sdo_model_reflectiondataobject_getinstanceproperties|' +
800 'sdo_model_reflectiondataobject_gettype|sdo_model_type_getbasetype|sdo_model_type_getname|sdo_model_type_getnamespaceuri|' +
801 'sdo_model_type_getproperties|sdo_model_type_getproperty|sdo_model_type_isabstracttype|sdo_model_type_isdatatype|sdo_model_type_isinstance|' +
802 'sdo_model_type_isopentype|sdo_model_type_issequencedtype|sdo_sequence_getproperty|sdo_sequence_insert|sdo_sequence_move|seekableiterator|' +
803 'sem_acquire|sem_get|sem_release|sem_remove|serializable|serialize|session_cache_expire|session_cache_limiter|session_commit|' +
804 'session_decode|session_destroy|session_encode|session_get_cookie_params|session_id|session_is_registered|session_module_name|session_name|' +
805 'session_pgsql_add_error|session_pgsql_get_error|session_pgsql_get_field|session_pgsql_reset|session_pgsql_set_field|session_pgsql_status|' +
806 'session_regenerate_id|session_register|session_save_path|session_set_cookie_params|session_set_save_handler|session_start|' +
807 'session_unregister|session_unset|session_write_close|setCounterClass|set_error_handler|set_exception_handler|set_file_buffer|' +
808 'set_include_path|set_magic_quotes_runtime|set_socket_blocking|set_time_limit|setcookie|setlocale|setproctitle|setrawcookie|' +
809 'setstaticpropertyvalue|setthreadtitle|settype|sha1|sha1_file|shell_exec|shm_attach|shm_detach|shm_get_var|shm_has_var|shm_put_var|' +
810 'shm_remove|shm_remove_var|shmop_close|shmop_delete|shmop_open|shmop_read|shmop_size|shmop_write|show_source|shuffle|signeurlpaiement|' +
811 'similar_text|simplexml_import_dom|simplexml_load_file|simplexml_load_string|simplexmlelement|simplexmliterator|sin|sinh|sizeof|sleep|snmp|' +
812 'snmp2_get|snmp2_getnext|snmp2_real_walk|snmp2_set|snmp2_walk|snmp3_get|snmp3_getnext|snmp3_real_walk|snmp3_set|snmp3_walk|' +
813 'snmp_get_quick_print|snmp_get_valueretrieval|snmp_read_mib|snmp_set_enum_print|snmp_set_oid_numeric_print|snmp_set_oid_output_format|' +
814 'snmp_set_quick_print|snmp_set_valueretrieval|snmpget|snmpgetnext|snmprealwalk|snmpset|snmpwalk|snmpwalkoid|soapclient|soapfault|' +
815 'soapheader|soapparam|soapserver|soapvar|socket_accept|socket_bind|socket_clear_error|socket_close|socket_connect|socket_create|' +
816 'socket_create_listen|socket_create_pair|socket_get_option|socket_get_status|socket_getpeername|socket_getsockname|socket_last_error|' +
817 'socket_listen|socket_read|socket_recv|socket_recvfrom|socket_select|socket_send|socket_sendto|socket_set_block|socket_set_blocking|' +
818 'socket_set_nonblock|socket_set_option|socket_set_timeout|socket_shutdown|socket_strerror|socket_write|solr_get_version|solrclient|' +
819 'solrclientexception|solrdocument|solrdocumentfield|solrexception|solrgenericresponse|solrillegalargumentexception|' +
820 'solrillegaloperationexception|solrinputdocument|solrmodifiableparams|solrobject|solrparams|solrpingresponse|solrquery|solrqueryresponse|' +
821 'solrresponse|solrupdateresponse|solrutils|sort|soundex|sphinxclient|spl_autoload|spl_autoload_call|spl_autoload_extensions|' +
822 'spl_autoload_functions|spl_autoload_register|spl_autoload_unregister|spl_classes|spl_object_hash|splbool|spldoublylinkedlist|splenum|' +
823 'splfileinfo|splfileobject|splfixedarray|splfloat|splheap|splint|split|spliti|splmaxheap|splminheap|splobjectstorage|splobserver|' +
824 'splpriorityqueue|splqueue|splstack|splstring|splsubject|spltempfileobject|spoofchecker|sprintf|sql_regcase|sqlite3|sqlite3result|' +
825 'sqlite3stmt|sqlite_array_query|sqlite_busy_timeout|sqlite_changes|sqlite_close|sqlite_column|sqlite_create_aggregate|' +
826 'sqlite_create_function|sqlite_current|sqlite_error_string|sqlite_escape_string|sqlite_exec|sqlite_factory|sqlite_fetch_all|' +
827 'sqlite_fetch_array|sqlite_fetch_column_types|sqlite_fetch_object|sqlite_fetch_single|sqlite_fetch_string|sqlite_field_name|' +
828 'sqlite_has_more|sqlite_has_prev|sqlite_key|sqlite_last_error|sqlite_last_insert_rowid|sqlite_libencoding|sqlite_libversion|sqlite_next|' +
829 'sqlite_num_fields|sqlite_num_rows|sqlite_open|sqlite_popen|sqlite_prev|sqlite_query|sqlite_rewind|sqlite_seek|sqlite_single_query|' +
830 'sqlite_udf_decode_binary|sqlite_udf_encode_binary|sqlite_unbuffered_query|sqlite_valid|sqrt|srand|sscanf|ssdeep_fuzzy_compare|' +
831 'ssdeep_fuzzy_hash|ssdeep_fuzzy_hash_filename|ssh2_auth_hostbased_file|ssh2_auth_none|ssh2_auth_password|ssh2_auth_pubkey_file|' +
832 'ssh2_connect|ssh2_exec|ssh2_fetch_stream|ssh2_fingerprint|ssh2_methods_negotiated|ssh2_publickey_add|ssh2_publickey_init|' +
833 'ssh2_publickey_list|ssh2_publickey_remove|ssh2_scp_recv|ssh2_scp_send|ssh2_sftp|ssh2_sftp_lstat|ssh2_sftp_mkdir|ssh2_sftp_readlink|' +
834 'ssh2_sftp_realpath|ssh2_sftp_rename|ssh2_sftp_rmdir|ssh2_sftp_stat|ssh2_sftp_symlink|ssh2_sftp_unlink|ssh2_shell|ssh2_tunnel|stat|' +
835 'stats_absolute_deviation|stats_cdf_beta|stats_cdf_binomial|stats_cdf_cauchy|stats_cdf_chisquare|stats_cdf_exponential|stats_cdf_f|' +
836 'stats_cdf_gamma|stats_cdf_laplace|stats_cdf_logistic|stats_cdf_negative_binomial|stats_cdf_noncentral_chisquare|stats_cdf_noncentral_f|' +
837 'stats_cdf_poisson|stats_cdf_t|stats_cdf_uniform|stats_cdf_weibull|stats_covariance|stats_den_uniform|stats_dens_beta|stats_dens_cauchy|' +
838 'stats_dens_chisquare|stats_dens_exponential|stats_dens_f|stats_dens_gamma|stats_dens_laplace|stats_dens_logistic|' +
839 'stats_dens_negative_binomial|stats_dens_normal|stats_dens_pmf_binomial|stats_dens_pmf_hypergeometric|stats_dens_pmf_poisson|stats_dens_t|' +
840 'stats_dens_weibull|stats_harmonic_mean|stats_kurtosis|stats_rand_gen_beta|stats_rand_gen_chisquare|stats_rand_gen_exponential|' +
841 'stats_rand_gen_f|stats_rand_gen_funiform|stats_rand_gen_gamma|stats_rand_gen_ibinomial|stats_rand_gen_ibinomial_negative|' +
842 'stats_rand_gen_int|stats_rand_gen_ipoisson|stats_rand_gen_iuniform|stats_rand_gen_noncenral_chisquare|stats_rand_gen_noncentral_f|' +
843 '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|' +
844 'stats_rand_setall|stats_skew|stats_standard_deviation|stats_stat_binomial_coef|stats_stat_correlation|stats_stat_gennch|' +
845 'stats_stat_independent_t|stats_stat_innerproduct|stats_stat_noncentral_t|stats_stat_paired_t|stats_stat_percentile|stats_stat_powersum|' +
846 'stats_variance|stomp|stomp_connect_error|stomp_version|stompexception|stompframe|str_getcsv|str_ireplace|str_pad|str_repeat|str_replace|' +
847 'str_rot13|str_shuffle|str_split|str_word_count|strcasecmp|strchr|strcmp|strcoll|strcspn|stream_bucket_append|stream_bucket_make_writeable|' +
848 'stream_bucket_new|stream_bucket_prepend|stream_context_create|stream_context_get_default|stream_context_get_options|' +
849 'stream_context_get_params|stream_context_set_default|stream_context_set_option|stream_context_set_params|stream_copy_to_stream|' +
850 'stream_encoding|stream_filter_append|stream_filter_prepend|stream_filter_register|stream_filter_remove|stream_get_contents|' +
851 'stream_get_filters|stream_get_line|stream_get_meta_data|stream_get_transports|stream_get_wrappers|stream_is_local|' +
852 'stream_notification_callback|stream_register_wrapper|stream_resolve_include_path|stream_select|stream_set_blocking|stream_set_read_buffer|' +
853 'stream_set_timeout|stream_set_write_buffer|stream_socket_accept|stream_socket_client|stream_socket_enable_crypto|stream_socket_get_name|' +
854 'stream_socket_pair|stream_socket_recvfrom|stream_socket_sendto|stream_socket_server|stream_socket_shutdown|stream_supports_lock|' +
855 'stream_wrapper_register|stream_wrapper_restore|stream_wrapper_unregister|streamwrapper|strftime|strip_tags|stripcslashes|stripos|' +
856 'stripslashes|stristr|strlen|strnatcasecmp|strnatcmp|strncasecmp|strncmp|strpbrk|strpos|strptime|strrchr|strrev|strripos|strrpos|strspn|' +
857 'strstr|strtok|strtolower|strtotime|strtoupper|strtr|strval|substr|substr_compare|substr_count|substr_replace|svm|svmmodel|svn_add|' +
858 'svn_auth_get_parameter|svn_auth_set_parameter|svn_blame|svn_cat|svn_checkout|svn_cleanup|svn_client_version|svn_commit|svn_delete|' +
859 '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|' +
860 '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|' +
861 '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|' +
862 '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|' +
863 'svn_repos_fs_commit_txn|svn_repos_hotcopy|svn_repos_open|svn_repos_recover|svn_revert|svn_status|svn_update|swf_actiongeturl|' +
864 'swf_actiongotoframe|swf_actiongotolabel|swf_actionnextframe|swf_actionplay|swf_actionprevframe|swf_actionsettarget|swf_actionstop|' +
865 'swf_actiontogglequality|swf_actionwaitforframe|swf_addbuttonrecord|swf_addcolor|swf_closefile|swf_definebitmap|swf_definefont|' +
866 'swf_defineline|swf_definepoly|swf_definerect|swf_definetext|swf_endbutton|swf_enddoaction|swf_endshape|swf_endsymbol|swf_fontsize|' +
867 'swf_fontslant|swf_fonttracking|swf_getbitmapinfo|swf_getfontinfo|swf_getframe|swf_labelframe|swf_lookat|swf_modifyobject|swf_mulcolor|' +
868 'swf_nextid|swf_oncondition|swf_openfile|swf_ortho|swf_ortho2|swf_perspective|swf_placeobject|swf_polarview|swf_popmatrix|swf_posround|' +
869 'swf_pushmatrix|swf_removeobject|swf_rotate|swf_scale|swf_setfont|swf_setframe|swf_shapearc|swf_shapecurveto|swf_shapecurveto3|' +
870 'swf_shapefillbitmapclip|swf_shapefillbitmaptile|swf_shapefilloff|swf_shapefillsolid|swf_shapelinesolid|swf_shapelineto|swf_shapemoveto|' +
871 'swf_showframe|swf_startbutton|swf_startdoaction|swf_startshape|swf_startsymbol|swf_textwidth|swf_translate|swf_viewport|swfaction|' +
872 'swfbitmap|swfbutton|swfdisplayitem|swffill|swffont|swffontchar|swfgradient|swfmorph|swfmovie|swfprebuiltclip|swfshape|swfsound|' +
873 'swfsoundinstance|swfsprite|swftext|swftextfield|swfvideostream|swish_construct|swish_getmetalist|swish_getpropertylist|swish_prepare|' +
874 'swish_query|swishresult_getmetalist|swishresult_stem|swishresults_getparsedwords|swishresults_getremovedstopwords|swishresults_nextresult|' +
875 'swishresults_seekresult|swishsearch_execute|swishsearch_resetlimit|swishsearch_setlimit|swishsearch_setphrasedelimiter|' +
876 'swishsearch_setsort|swishsearch_setstructure|sybase_affected_rows|sybase_close|sybase_connect|sybase_data_seek|' +
877 'sybase_deadlock_retry_count|sybase_fetch_array|sybase_fetch_assoc|sybase_fetch_field|sybase_fetch_object|sybase_fetch_row|' +
878 'sybase_field_seek|sybase_free_result|sybase_get_last_message|sybase_min_client_severity|sybase_min_error_severity|' +
879 'sybase_min_message_severity|sybase_min_server_severity|sybase_num_fields|sybase_num_rows|sybase_pconnect|sybase_query|sybase_result|' +
880 'sybase_select_db|sybase_set_message_handler|sybase_unbuffered_query|symlink|sys_get_temp_dir|sys_getloadavg|syslog|system|tag|tan|tanh|' +
881 'tcpwrap_check|tempnam|textdomain|tidy|tidy_access_count|tidy_config_count|tidy_diagnose|tidy_error_count|tidy_get_error_buffer|' +
882 'tidy_get_output|tidy_load_config|tidy_reset_config|tidy_save_config|tidy_set_encoding|tidy_setopt|tidy_warning_count|tidynode|time|' +
883 'time_nanosleep|time_sleep_until|timezone_abbreviations_list|timezone_identifiers_list|timezone_location_get|timezone_name_from_abbr|' +
884 'timezone_name_get|timezone_offset_get|timezone_open|timezone_transitions_get|timezone_version_get|tmpfile|token_get_all|token_name|' +
885 'tokyotyrant|tokyotyrantquery|tokyotyranttable|tostring|tostring|touch|transliterator|traversable|trigger_error|trim|uasort|ucfirst|' +
886 'ucwords|udm_add_search_limit|udm_alloc_agent|udm_alloc_agent_array|udm_api_version|udm_cat_list|udm_cat_path|udm_check_charset|' +
887 '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|' +
888 '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|' +
889 'uksort|umask|underflowexception|unexpectedvalueexception|uniqid|unixtojd|unlink|unpack|unregister_tick_function|unserialize|unset|' +
890 'urldecode|urlencode|use_soap_error_handler|user_error|usleep|usort|utf8_decode|utf8_encode|v8js|v8jsexception|var_dump|var_export|variant|' +
891 'variant_abs|variant_add|variant_and|variant_cast|variant_cat|variant_cmp|variant_date_from_timestamp|variant_date_to_timestamp|' +
892 'variant_div|variant_eqv|variant_fix|variant_get_type|variant_idiv|variant_imp|variant_int|variant_mod|variant_mul|variant_neg|variant_not|' +
893 'variant_or|variant_pow|variant_round|variant_set|variant_set_type|variant_sub|variant_xor|version_compare|vfprintf|virtual|' +
894 'vpopmail_add_alias_domain|vpopmail_add_alias_domain_ex|vpopmail_add_domain|vpopmail_add_domain_ex|vpopmail_add_user|vpopmail_alias_add|' +
895 'vpopmail_alias_del|vpopmail_alias_del_domain|vpopmail_alias_get|vpopmail_alias_get_all|vpopmail_auth_user|vpopmail_del_domain|' +
896 'vpopmail_del_domain_ex|vpopmail_del_user|vpopmail_error|vpopmail_passwd|vpopmail_set_user_quota|vprintf|vsprintf|w32api_deftype|' +
897 'w32api_init_dtype|w32api_invoke_function|w32api_register_function|w32api_set_call_method|wddx_add_vars|wddx_deserialize|wddx_packet_end|' +
898 'wddx_packet_start|wddx_serialize_value|wddx_serialize_vars|win32_continue_service|win32_create_service|win32_delete_service|' +
899 'win32_get_last_control_message|win32_pause_service|win32_ps_list_procs|win32_ps_stat_mem|win32_ps_stat_proc|win32_query_service_status|' +
900 'win32_set_service_status|win32_start_service|win32_start_service_ctrl_dispatcher|win32_stop_service|wincache_fcache_fileinfo|' +
901 'wincache_fcache_meminfo|wincache_lock|wincache_ocache_fileinfo|wincache_ocache_meminfo|wincache_refresh_if_changed|' +
902 'wincache_rplist_fileinfo|wincache_rplist_meminfo|wincache_scache_info|wincache_scache_meminfo|wincache_ucache_add|wincache_ucache_cas|' +
903 'wincache_ucache_clear|wincache_ucache_dec|wincache_ucache_delete|wincache_ucache_exists|wincache_ucache_get|wincache_ucache_inc|' +
904 'wincache_ucache_info|wincache_ucache_meminfo|wincache_ucache_set|wincache_unlock|wordwrap|xattr_get|xattr_list|xattr_remove|xattr_set|' +
905 'xattr_supported|xdiff_file_bdiff|xdiff_file_bdiff_size|xdiff_file_bpatch|xdiff_file_diff|xdiff_file_diff_binary|xdiff_file_merge3|' +
906 'xdiff_file_patch|xdiff_file_patch_binary|xdiff_file_rabdiff|xdiff_string_bdiff|xdiff_string_bdiff_size|xdiff_string_bpatch|' +
907 'xdiff_string_diff|xdiff_string_diff_binary|xdiff_string_merge3|xdiff_string_patch|xdiff_string_patch_binary|xdiff_string_rabdiff|' +
908 'xhprof_disable|xhprof_enable|xhprof_sample_disable|xhprof_sample_enable|xml_error_string|xml_get_current_byte_index|' +
909 'xml_get_current_column_number|xml_get_current_line_number|xml_get_error_code|xml_parse|xml_parse_into_struct|xml_parser_create|' +
910 'xml_parser_create_ns|xml_parser_free|xml_parser_get_option|xml_parser_set_option|xml_set_character_data_handler|xml_set_default_handler|' +
911 'xml_set_element_handler|xml_set_end_namespace_decl_handler|xml_set_external_entity_ref_handler|xml_set_notation_decl_handler|' +
912 'xml_set_object|xml_set_processing_instruction_handler|xml_set_start_namespace_decl_handler|xml_set_unparsed_entity_decl_handler|xmlreader|' +
913 'xmlrpc_decode|xmlrpc_decode_request|xmlrpc_encode|xmlrpc_encode_request|xmlrpc_get_type|xmlrpc_is_fault|xmlrpc_parse_method_descriptions|' +
914 'xmlrpc_server_add_introspection_data|xmlrpc_server_call_method|xmlrpc_server_create|xmlrpc_server_destroy|' +
915 'xmlrpc_server_register_introspection_callback|xmlrpc_server_register_method|xmlrpc_set_type|xmlwriter_end_attribute|xmlwriter_end_cdata|' +
916 'xmlwriter_end_comment|xmlwriter_end_document|xmlwriter_end_dtd|xmlwriter_end_dtd_attlist|xmlwriter_end_dtd_element|' +
917 'xmlwriter_end_dtd_entity|xmlwriter_end_element|xmlwriter_end_pi|xmlwriter_flush|xmlwriter_full_end_element|xmlwriter_open_memory|' +
918 'xmlwriter_open_uri|xmlwriter_output_memory|xmlwriter_set_indent|xmlwriter_set_indent_string|xmlwriter_start_attribute|' +
919 'xmlwriter_start_attribute_ns|xmlwriter_start_cdata|xmlwriter_start_comment|xmlwriter_start_document|xmlwriter_start_dtd|' +
920 'xmlwriter_start_dtd_attlist|xmlwriter_start_dtd_element|xmlwriter_start_dtd_entity|xmlwriter_start_element|xmlwriter_start_element_ns|' +
921 'xmlwriter_start_pi|xmlwriter_text|xmlwriter_write_attribute|xmlwriter_write_attribute_ns|xmlwriter_write_cdata|xmlwriter_write_comment|' +
922 'xmlwriter_write_dtd|xmlwriter_write_dtd_attlist|xmlwriter_write_dtd_element|xmlwriter_write_dtd_entity|xmlwriter_write_element|' +
923 'xmlwriter_write_element_ns|xmlwriter_write_pi|xmlwriter_write_raw|xpath_eval|xpath_eval_expression|xpath_new_context|xpath_register_ns|' +
924 'xpath_register_ns_auto|xptr_eval|xptr_new_context|xslt_backend_info|xslt_backend_name|xslt_backend_version|xslt_create|xslt_errno|' +
925 'xslt_error|xslt_free|xslt_getopt|xslt_process|xslt_set_base|xslt_set_encoding|xslt_set_error_handler|xslt_set_log|xslt_set_object|' +
926 'xslt_set_sax_handler|xslt_set_sax_handlers|xslt_set_scheme_handler|xslt_set_scheme_handlers|xslt_setopt|xsltprocessor|yaml_emit|' +
927 '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|' +
928 '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|' +
929 '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|' +
930 '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|' +
931 'zip_entry_compressedsize|zip_entry_compressionmethod|zip_entry_filesize|zip_entry_name|zip_entry_open|zip_entry_read|zip_open|zip_read|' +
932 'ziparchive|ziparchive_addemptydir|ziparchive_addfile|ziparchive_addfromstring|ziparchive_close|ziparchive_deleteindex|' +
933 'ziparchive_deletename|ziparchive_extractto|ziparchive_getarchivecomment|ziparchive_getcommentindex|ziparchive_getcommentname|' +
934 'ziparchive_getfromindex|ziparchive_getfromname|ziparchive_getnameindex|ziparchive_getstatusstring|ziparchive_getstream|' +
935 'ziparchive_locatename|ziparchive_open|ziparchive_renameindex|ziparchive_renamename|ziparchive_setCommentName|ziparchive_setarchivecomment|' +
936 'ziparchive_setcommentindex|ziparchive_statindex|ziparchive_statname|ziparchive_unchangeall|ziparchive_unchangearchive|' +
937 'ziparchive_unchangeindex|ziparchive_unchangename|zlib_get_coding_type').split('|')
938 );
939 var keywords = lang.arrayToMap(
940 ('abstract|and|array|as|break|case|catch|class|clone|const|continue|declare|default|do|else|elseif|enddeclare|endfor|endforeach|endif|' +
941 'endswitch|endwhile|extends|final|for|foreach|function|global|goto|if|implements|interface|instanceof|namespace|new|or|private|protected|' +
942 'public|static|switch|throw|try|use|var|while|xor').split('|')
943 );
944 var languageConstructs = lang.arrayToMap(
945 ('die|echo|empty|exit|eval|include|include_once|isset|list|require|require_once|return|print|unset').split('|')
946 );
947
948 var builtinConstants = lang.arrayToMap(
949 ('true|false|null|__CLASS__|__DIR__|__FILE__|__LINE__|__METHOD__|__FUNCTION__|__NAMESPACE__').split('|')
950 );
951
952 var builtinVariables = lang.arrayToMap(
953 ('$GLOBALS|$_SERVER|$_GET|$_POST|$_FILES|$_REQUEST|$_SESSION|$_ENV|$_COOKIE|$php_errormsg|$HTTP_RAW_POST_DATA|' +
954 '$http_response_header|$argc|$argv').split('|')
955 );
956 var builtinFunctionsDeprecated = lang.arrayToMap(
957 ('key_exists|cairo_matrix_create_scale|cairo_matrix_create_translate|call_user_method|call_user_method_array|com_addref|com_get|' +
958 'com_invoke|com_isenum|com_load|com_release|com_set|connection_timeout|cubrid_load_from_glo|cubrid_new_glo|cubrid_save_to_glo|' +
959 'cubrid_send_glo|define_syslog_variables|dl|ereg|ereg_replace|eregi|eregi_replace|hw_documentattributes|hw_documentbodytag|' +
960 'hw_documentsize|hw_outputdocument|imagedashedline|maxdb_bind_param|maxdb_bind_result|maxdb_client_encoding|maxdb_close_long_data|' +
961 'maxdb_execute|maxdb_fetch|maxdb_get_metadata|maxdb_param_count|maxdb_send_long_data|mcrypt_ecb|mcrypt_generic_end|mime_content_type|' +
962 'mysql_createdb|mysql_dbname|mysql_db_query|mysql_drop_db|mysql_dropdb|mysql_escape_string|mysql_fieldflags|mysql_fieldflags|' +
963 'mysql_fieldname|mysql_fieldtable|mysql_fieldtype|mysql_freeresult|mysql_listdbs|mysql_list_fields|mysql_listfields|mysql_list_tables|' +
964 'mysql_listtables|mysql_numfields|mysql_numrows|mysql_selectdb|mysql_tablename|mysqli_bind_param|mysqli_bind_result|' +
965 'mysqli_disable_reads_from_master|mysqli_disable_rpl_parse|mysqli_enable_reads_from_master|mysqli_enable_rpl_parse|mysqli_execute|' +
966 'mysqli_fetch|mysqli_get_metadata|mysqli_master_query|mysqli_param_count|mysqli_rpl_parse_enabled|mysqli_rpl_probe|mysqli_rpl_query_type|' +
967 'mysqli_send_long_data|mysqli_send_query|mysqli_slave_query|ocibindbyname|ocicancel|ocicloselob|ocicollappend|ocicollassign|' +
968 'ocicollassignelem|ocicollgetelem|ocicollmax|ocicollsize|ocicolltrim|ocicolumnisnull|ocicolumnname|ocicolumnprecision|ocicolumnscale|' +
969 'ocicolumnsize|ocicolumntype|ocicolumntyperaw|ocicommit|ocidefinebyname|ocierror|ociexecute|ocifetch|ocifetchinto|ocifetchstatement|' +
970 'ocifreecollection|ocifreecursor|ocifreedesc|ocifreestatement|ociinternaldebug|ociloadlob|ocilogoff|ocilogon|ocinewcollection|' +
971 'ocinewcursor|ocinewdescriptor|ocinlogon|ocinumcols|ociparse|ociplogon|ociresult|ocirollback|ocirowcount|ocisavelob|ocisavelobfile|' +
972 'ociserverversion|ocisetprefetch|ocistatementtype|ociwritelobtofile|ociwritetemporarylob|PDF_add_annotation|PDF_add_bookmark|' +
973 'PDF_add_launchlink|PDF_add_locallink|PDF_add_note|PDF_add_outline|PDF_add_pdflink|PDF_add_weblink|PDF_attach_file|PDF_begin_page|' +
974 'PDF_begin_template|PDF_close_pdi|PDF_close|PDF_findfont|PDF_get_font|PDF_get_fontname|PDF_get_fontsize|PDF_get_image_height|' +
975 'PDF_get_image_width|PDF_get_majorversion|PDF_get_minorversion|PDF_get_pdi_parameter|PDF_get_pdi_value|PDF_open_ccitt|PDF_open_file|' +
976 '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|' +
977 'PDF_set_border_color|PDF_set_border_dash|PDF_set_border_style|PDF_set_char_spacing|PDF_set_duration|PDF_set_horiz_scaling|' +
978 'PDF_set_info_author|PDF_set_info_creator|PDF_set_info_keywords|PDF_set_info_subject|PDF_set_info_title|PDF_set_leading|' +
979 'PDF_set_text_matrix|PDF_set_text_rendering|PDF_set_text_rise|PDF_set_word_spacing|PDF_setgray_fill|PDF_setgray_stroke|PDF_setgray|' +
980 'PDF_setpolydash|PDF_setrgbcolor_fill|PDF_setrgbcolor_stroke|PDF_setrgbcolor|PDF_show_boxed|php_check_syntax|px_set_tablename|' +
981 'px_set_targetencoding|runkit_sandbox_output_handler|session_is_registered|session_register|session_unregister' +
982 'set_magic_quotes_runtime|magic_quotes_runtime|set_socket_blocking|socket_set_blocking|set_socket_timeout|socket_set_timeout|split|spliti|' +
983 'sql_regcase').split('|')
984 );
985
986 var keywordsDeprecated = lang.arrayToMap(
987 ('cfunction|old_function').split('|')
988 );
989
990 var futureReserved = lang.arrayToMap([]);
991
992 this.$rules = {
993 "start" : [
994 {
995 token : "comment",
996 regex : /(?:#|\/\/)(?:[^?]|\?[^>])*/
997 },
998 docComment.getStartRule("doc-start"),
999 {
1000 token : "comment", // multi line comment
1001 regex : "\\/\\*",
1002 next : "comment"
1003 }, {
1004 token : "string.regexp",
1005 regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"
1006 }, {
1007 token : "string", // " string start
1008 regex : '"',
1009 next : "qqstring"
1010 }, {
1011 token : "string", // ' string start
1012 regex : "'",
1013 next : "qstring"
1014 }, {
1015 token : "constant.numeric", // hex
1016 regex : "0[xX][0-9a-fA-F]+\\b"
1017 }, {
1018 token : "constant.numeric", // float
1019 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
1020 }, {
1021 token : "constant.language", // constants
1022 regex : "\\b(?:DEFAULT_INCLUDE_PATH|E_(?:ALL|CO(?:MPILE_(?:ERROR|WARNING)|RE_(?:ERROR|WARNING))|" +
1023 "ERROR|NOTICE|PARSE|STRICT|USER_(?:ERROR|NOTICE|WARNING)|WARNING)|P(?:EAR_(?:EXTENSION_DIR|INSTALL_DIR)|" +
1024 "HP_(?:BINDIR|CONFIG_FILE_(?:PATH|SCAN_DIR)|DATADIR|E(?:OL|XTENSION_DIR)|INT_(?:MAX|SIZE)|" +
1025 "L(?:IBDIR|OCALSTATEDIR)|O(?:S|UTPUT_HANDLER_(?:CONT|END|START))|PREFIX|S(?:API|HLIB_SUFFIX|YSCONFDIR)|" +
1026 "VERSION))|__COMPILER_HALT_OFFSET__)\\b"
1027 }, {
1028 token : ["keyword", "text", "support.class"],
1029 regex : "\\b(new)(\\s+)(\\w+)"
1030 }, {
1031 token : ["support.class", "keyword.operator"],
1032 regex : "\\b(\\w+)(::)"
1033 }, {
1034 token : "constant.language", // constants
1035 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|" +
1036 "SSERT_(?:ACTIVE|BAIL|CALLBACK|QUIET_EVAL|WARNING))|C(?:ASE_(?:LOWER|UPPER)|HAR_MAX|" +
1037 "O(?:DESET|NNECTION_(?:ABORTED|NORMAL|TIMEOUT)|UNT_(?:NORMAL|RECURSIVE))|" +
1038 "R(?:EDITS_(?:ALL|DOCS|FULLPAGE|G(?:ENERAL|ROUP)|MODULES|QA|SAPI)|NCYSTR|" +
1039 "YPT_(?:BLOWFISH|EXT_DES|MD5|S(?:ALT_LENGTH|TD_DES)))|URRENCY_SYMBOL)|D(?:AY_(?:1|2|3|4|5|6|7)|" +
1040 "ECIMAL_POINT|IRECTORY_SEPARATOR|_(?:FMT|T_FMT))|E(?:NT_(?:COMPAT|NOQUOTES|QUOTES)|RA(?:_(?:D_(?:FMT|T_FMT)|" +
1041 "T_FMT|YEAR)|)|XTR_(?:IF_EXISTS|OVERWRITE|PREFIX_(?:ALL|I(?:F_EXISTS|NVALID)|SAME)|SKIP))|FRAC_DIGITS|GROUPING|" +
1042 "HTML_(?:ENTITIES|SPECIALCHARS)|IN(?:FO_(?:ALL|C(?:ONFIGURATION|REDITS)|ENVIRONMENT|GENERAL|LICENSE|MODULES|VARIABLES)|" +
1043 "I_(?:ALL|PERDIR|SYSTEM|USER)|T_(?:CURR_SYMBOL|FRAC_DIGITS))|L(?:C_(?:ALL|C(?:OLLATE|TYPE)|M(?:ESSAGES|ONETARY)|NUMERIC|TIME)|" +
1044 "O(?:CK_(?:EX|NB|SH|UN)|G_(?:A(?:LERT|UTH(?:PRIV|))|C(?:ONS|R(?:IT|ON))|D(?:AEMON|EBUG)|E(?:MERG|RR)|INFO|KERN|" +
1045 "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)))|" +
1046 "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)|" +
1047 "OG(?:10E|2E))|PI(?:_(?:2|4)|)|SQRT(?:1_2|2)))|N(?:EGATIVE_SIGN|O(?:EXPR|STR)|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|" +
1048 "P(?:ATH(?:INFO_(?:BASENAME|DIRNAME|EXTENSION)|_SEPARATOR)|M_STR|OSITIVE_SIGN|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|" +
1049 "RADIXCHAR|S(?:EEK_(?:CUR|END|SET)|ORT_(?:ASC|DESC|NUMERIC|REGULAR|STRING)|TR_PAD_(?:BOTH|LEFT|RIGHT))|" +
1050 "T(?:HOUS(?:ANDS_SEP|EP)|_FMT(?:_AMPM|))|YES(?:EXPR|STR)|STD(?:IN|OUT|ERR))\\b"
1051 }, {
1052 token : function(value) {
1053 if (keywords.hasOwnProperty(value))
1054 return "keyword";
1055 else if (builtinConstants.hasOwnProperty(value))
1056 return "constant.language";
1057 else if (builtinVariables.hasOwnProperty(value))
1058 return "variable.language";
1059 else if (futureReserved.hasOwnProperty(value))
1060 return "invalid.illegal";
1061 else if (builtinFunctions.hasOwnProperty(value))
1062 return "support.function";
1063 else if (value == "debugger")
1064 return "invalid.deprecated";
1065 else
1066 if(value.match(/^(\$[a-zA-Z][a-zA-Z0-9_]*|self|parent)$/))
1067 return "variable";
1068 return "identifier";
1069 },
1070 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
1071 }, {
1072 onMatch : function(value, currentSate, state) {
1073 value = value.substr(3);
1074 if (value[0] == "'" || value[0] == '"')
1075 value = value.slice(1, -1);
1076 state.unshift(this.next, value);
1077 return "markup.list";
1078 },
1079 regex : /<<<(?:\w+|'\w+'|"\w+")$/,
1080 next: "heredoc"
1081 }, {
1082 token : "keyword.operator",
1083 regex : "::|!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
1084 }, {
1085 token : "paren.lparen",
1086 regex : "[[({]"
1087 }, {
1088 token : "paren.rparen",
1089 regex : "[\\])}]"
1090 }, {
1091 token : "text",
1092 regex : "\\s+"
1093 }
1094 ],
1095 "heredoc" : [
1096 {
1097 onMatch : function(value, currentSate, stack) {
1098 if (stack[1] + ";" != value)
1099 return "string";
1100 stack.shift();
1101 stack.shift();
1102 return "markup.list"
1103 },
1104 regex : "^\\w+;$",
1105 next: "start"
1106 }, {
1107 token: "string",
1108 regex : ".*",
1109 }
1110 ],
1111 "comment" : [
1112 {
1113 token : "comment", // closing comment
1114 regex : ".*?\\*\\/",
1115 next : "start"
1116 }, {
1117 token : "comment", // comment spanning whole line
1118 regex : ".+"
1119 }
1120 ],
1121 "qqstring" : [
1122 {
1123 token : "constant.language.escape",
1124 regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
1125 }, {
1126 token : "constant.language.escape",
1127 regex : /\$[\w]+(?:\[[\w\]+]|=>\w+)?/
1128 }, {
1129 token : "constant.language.escape",
1130 regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now
1131 },
1132 {token : "string", regex : '"', next : "start"},
1133 {defaultToken : "string"}
1134 ],
1135 "qstring" : [
1136 {token : "constant.language.escape", regex : /\\['\\]/},
1137 {token : "string", regex : "'", next : "start"},
1138 {defaultToken : "string"}
1139 ]
1140 };
1141
1142 this.embedRules(DocCommentHighlightRules, "doc-",
1143 [ DocCommentHighlightRules.getEndRule("start") ]);
1144 };
1145
1146 oop.inherits(PhpLangHighlightRules, TextHighlightRules);
1147
1148
1149 var PhpHighlightRules = function() {
1150 HtmlHighlightRules.call(this);
1151
1152 for (var i in this.$rules) {
1153 this.$rules[i].unshift({
1154 token : "support.php_tag", // php open tag
1155 regex : "<\\?(?:php|=)?",
1156 push : "php-start"
1157 });
1158 }
1159
1160 this.embedRules(PhpLangHighlightRules, "php-");
1161
1162 this.$rules["php-start"].unshift({
1163 token : "support.php_tag", // php close tag
1164 regex : "\\?>",
1165 next : "pop"
1166 });
1167 this.normalizeRules();
1168 };
1169
1170 oop.inherits(PhpHighlightRules, HtmlHighlightRules);
1171
1172 exports.PhpHighlightRules = PhpHighlightRules;
1173 exports.PhpLangHighlightRules = PhpLangHighlightRules;
1174 });
1175
1176 define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1177
1178
1179 var oop = require("../lib/oop");
1180 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1181
1182 var DocCommentHighlightRules = function() {
1183
1184 this.$rules = {
1185 "start" : [ {
1186 token : "comment.doc.tag",
1187 regex : "@[\\w\\d_]+" // TODO: fix email addresses
1188 }, {
1189 token : "comment.doc.tag",
1190 regex : "\\bTODO\\b"
1191 }, {
1192 defaultToken : "comment.doc"
1193 }]
1194 };
1195 };
1196
1197 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
1198
1199 DocCommentHighlightRules.getStartRule = function(start) {
1200 return {
1201 token : "comment.doc", // doc comment
1202 regex : "\\/\\*(?=\\*)",
1203 next : start
1204 };
1205 };
1206
1207 DocCommentHighlightRules.getEndRule = function (start) {
1208 return {
1209 token : "comment.doc", // closing comment
1210 regex : "\\*\\/",
1211 next : start
1212 };
1213 };
1214
1215
1216 exports.DocCommentHighlightRules = DocCommentHighlightRules;
1217
1218 });
1219
1220 define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1221
1222
1223 var oop = require("../lib/oop");
1224 var lang = require("../lib/lang");
1225 var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1226 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1227 var xmlUtil = require("./xml_util");
1228 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1229
1230 var tagMap = lang.createMap({
1231 a : 'anchor',
1232 button : 'form',
1233 form : 'form',
1234 img : 'image',
1235 input : 'form',
1236 label : 'form',
1237 script : 'script',
1238 select : 'form',
1239 textarea : 'form',
1240 style : 'style',
1241 table : 'table',
1242 tbody : 'table',
1243 td : 'table',
1244 tfoot : 'table',
1245 th : 'table',
1246 tr : 'table'
1247 });
1248
1249 var HtmlHighlightRules = function() {
1250 this.$rules = {
1251 start : [{
1252 token : "text",
1253 regex : "<\\!\\[CDATA\\[",
1254 next : "cdata"
1255 }, {
1256 token : "xml-pe",
1257 regex : "<\\?.*?\\?>"
1258 }, {
1259 token : "comment",
1260 regex : "<\\!--",
1261 next : "comment"
1262 }, {
1263 token : "xml-pe",
1264 regex : "<\\!.*?>"
1265 }, {
1266 token : "meta.tag",
1267 regex : "<(?=script\\b)",
1268 next : "script"
1269 }, {
1270 token : "meta.tag",
1271 regex : "<(?=style\\b)",
1272 next : "style"
1273 }, {
1274 token : "meta.tag", // opening tag
1275 regex : "<\\/?(?=\\S)",
1276 next : "tag"
1277 }, {
1278 token : "text",
1279 regex : "\\s+"
1280 }, {
1281 token : "constant.character.entity",
1282 regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1283 }],
1284
1285 cdata : [ {
1286 token : "text",
1287 regex : "\\]\\]>",
1288 next : "start"
1289 } ],
1290
1291 comment : [ {
1292 token : "comment",
1293 regex : ".*?-->",
1294 next : "start"
1295 }, {
1296 defaultToken : "comment"
1297 } ]
1298 };
1299
1300 xmlUtil.tag(this.$rules, "tag", "start", tagMap);
1301 xmlUtil.tag(this.$rules, "style", "css-start", tagMap);
1302 xmlUtil.tag(this.$rules, "script", "js-start", tagMap);
1303
1304 this.embedRules(JavaScriptHighlightRules, "js-", [{
1305 token: "comment",
1306 regex: "\\/\\/.*(?=<\\/script>)",
1307 next: "tag"
1308 }, {
1309 token: "meta.tag",
1310 regex: "<\\/(?=script)",
1311 next: "tag"
1312 }]);
1313
1314 this.embedRules(CssHighlightRules, "css-", [{
1315 token: "meta.tag",
1316 regex: "<\\/(?=style)",
1317 next: "tag"
1318 }]);
1319 };
1320
1321 oop.inherits(HtmlHighlightRules, TextHighlightRules);
1322
1323 exports.HtmlHighlightRules = HtmlHighlightRules;
1324 });
1325
1326 define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1327
1328
1329 var oop = require("../lib/oop");
1330 var lang = require("../lib/lang");
1331 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1332 var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
1333 var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1334 var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
1335 var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1336 var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
1337
1338 var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1339 var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1340 var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
1341
1342 var CssHighlightRules = function() {
1343
1344 var keywordMapper = this.createKeywordMapper({
1345 "support.function": supportFunction,
1346 "support.constant": supportConstant,
1347 "support.type": supportType,
1348 "support.constant.color": supportConstantColor,
1349 "support.constant.fonts": supportConstantFonts
1350 }, "text", true);
1351
1352 var base_ruleset = [
1353 {
1354 token : "comment", // multi line comment
1355 regex : "\\/\\*",
1356 next : "ruleset_comment"
1357 }, {
1358 token : "string", // single line
1359 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1360 }, {
1361 token : "string", // single line
1362 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1363 }, {
1364 token : ["constant.numeric", "keyword"],
1365 regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
1366 }, {
1367 token : "constant.numeric",
1368 regex : numRe
1369 }, {
1370 token : "constant.numeric", // hex6 color
1371 regex : "#[a-f0-9]{6}"
1372 }, {
1373 token : "constant.numeric", // hex3 color
1374 regex : "#[a-f0-9]{3}"
1375 }, {
1376 token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1377 regex : pseudoElements
1378 }, {
1379 token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1380 regex : pseudoClasses
1381 }, {
1382 token : ["support.function", "string", "support.function"],
1383 regex : "(url\\()(.*)(\\))"
1384 }, {
1385 token : keywordMapper,
1386 regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1387 }, {
1388 caseInsensitive: true
1389 }
1390 ];
1391
1392 var ruleset = lang.copyArray(base_ruleset);
1393 ruleset.unshift({
1394 token : "paren.rparen",
1395 regex : "\\}",
1396 next: "start"
1397 });
1398
1399 var media_ruleset = lang.copyArray( base_ruleset );
1400 media_ruleset.unshift({
1401 token : "paren.rparen",
1402 regex : "\\}",
1403 next: "media"
1404 });
1405
1406 var base_comment = [{
1407 token : "comment", // comment spanning whole line
1408 regex : ".+"
1409 }];
1410
1411 var comment = lang.copyArray(base_comment);
1412 comment.unshift({
1413 token : "comment", // closing comment
1414 regex : ".*?\\*\\/",
1415 next : "start"
1416 });
1417
1418 var media_comment = lang.copyArray(base_comment);
1419 media_comment.unshift({
1420 token : "comment", // closing comment
1421 regex : ".*?\\*\\/",
1422 next : "media"
1423 });
1424
1425 var ruleset_comment = lang.copyArray(base_comment);
1426 ruleset_comment.unshift({
1427 token : "comment", // closing comment
1428 regex : ".*?\\*\\/",
1429 next : "ruleset"
1430 });
1431
1432 this.$rules = {
1433 "start" : [{
1434 token : "comment", // multi line comment
1435 regex : "\\/\\*",
1436 next : "comment"
1437 }, {
1438 token: "paren.lparen",
1439 regex: "\\{",
1440 next: "ruleset"
1441 }, {
1442 token: "string",
1443 regex: "@.*?{",
1444 next: "media"
1445 },{
1446 token: "keyword",
1447 regex: "#[a-z0-9-_]+"
1448 },{
1449 token: "variable",
1450 regex: "\\.[a-z0-9-_]+"
1451 },{
1452 token: "string",
1453 regex: ":[a-z0-9-_]+"
1454 },{
1455 token: "constant",
1456 regex: "[a-z0-9-_]+"
1457 },{
1458 caseInsensitive: true
1459 }],
1460
1461 "media" : [ {
1462 token : "comment", // multi line comment
1463 regex : "\\/\\*",
1464 next : "media_comment"
1465 }, {
1466 token: "paren.lparen",
1467 regex: "\\{",
1468 next: "media_ruleset"
1469 },{
1470 token: "string",
1471 regex: "\\}",
1472 next: "start"
1473 },{
1474 token: "keyword",
1475 regex: "#[a-z0-9-_]+"
1476 },{
1477 token: "variable",
1478 regex: "\\.[a-z0-9-_]+"
1479 },{
1480 token: "string",
1481 regex: ":[a-z0-9-_]+"
1482 },{
1483 token: "constant",
1484 regex: "[a-z0-9-_]+"
1485 },{
1486 caseInsensitive: true
1487 }],
1488
1489 "comment" : comment,
1490
1491 "ruleset" : ruleset,
1492 "ruleset_comment" : ruleset_comment,
1493
1494 "media_ruleset" : media_ruleset,
1495 "media_comment" : media_comment
1496 };
1497 };
1498
1499 oop.inherits(CssHighlightRules, TextHighlightRules);
1500
1501 exports.CssHighlightRules = CssHighlightRules;
1502
1503 });
1504
1505 define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1506
1507
1508 var oop = require("../lib/oop");
1509 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
1510 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1511
1512 var JavaScriptHighlightRules = function() {
1513 var keywordMapper = this.createKeywordMapper({
1514 "variable.language":
1515 "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
1516 "Namespace|QName|XML|XMLList|" + // E4X
1517 "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
1518 "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
1519 "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
1520 "SyntaxError|TypeError|URIError|" +
1521 "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
1522 "isNaN|parseFloat|parseInt|" +
1523 "JSON|Math|" + // Other
1524 "this|arguments|prototype|window|document" , // Pseudo
1525 "keyword":
1526 "const|yield|import|get|set|" +
1527 "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
1528 "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
1529 "__parent__|__count__|escape|unescape|with|__proto__|" +
1530 "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
1531 "storage.type":
1532 "const|let|var|function",
1533 "constant.language":
1534 "null|Infinity|NaN|undefined",
1535 "support.function":
1536 "alert",
1537 "constant.language.boolean": "true|false"
1538 }, "identifier");
1539 var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
1540 var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
1541
1542 var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
1543 "u[0-9a-fA-F]{4}|" + // unicode
1544 "[0-2][0-7]{0,2}|" + // oct
1545 "3[0-6][0-7]?|" + // oct
1546 "37[0-7]?|" + // oct
1547 "[4-7][0-7]?|" + //oct
1548 ".)";
1549
1550 this.$rules = {
1551 "no_regex" : [
1552 {
1553 token : "comment",
1554 regex : /\/\/.*$/
1555 },
1556 DocCommentHighlightRules.getStartRule("doc-start"),
1557 {
1558 token : "comment", // multi line comment
1559 regex : /\/\*/,
1560 next : "comment"
1561 }, {
1562 token : "string",
1563 regex : "'(?=.)",
1564 next : "qstring"
1565 }, {
1566 token : "string",
1567 regex : '"(?=.)',
1568 next : "qqstring"
1569 }, {
1570 token : "constant.numeric", // hex
1571 regex : /0[xX][0-9a-fA-F]+\b/
1572 }, {
1573 token : "constant.numeric", // float
1574 regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
1575 }, {
1576 token : [
1577 "storage.type", "punctuation.operator", "support.function",
1578 "punctuation.operator", "entity.name.function", "text","keyword.operator"
1579 ],
1580 regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
1581 next: "function_arguments"
1582 }, {
1583 token : [
1584 "storage.type", "punctuation.operator", "entity.name.function", "text",
1585 "keyword.operator", "text", "storage.type", "text", "paren.lparen"
1586 ],
1587 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1588 next: "function_arguments"
1589 }, {
1590 token : [
1591 "entity.name.function", "text", "keyword.operator", "text", "storage.type",
1592 "text", "paren.lparen"
1593 ],
1594 regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1595 next: "function_arguments"
1596 }, {
1597 token : [
1598 "storage.type", "punctuation.operator", "entity.name.function", "text",
1599 "keyword.operator", "text",
1600 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
1601 ],
1602 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
1603 next: "function_arguments"
1604 }, {
1605 token : [
1606 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
1607 ],
1608 regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
1609 next: "function_arguments"
1610 }, {
1611 token : [
1612 "entity.name.function", "text", "punctuation.operator",
1613 "text", "storage.type", "text", "paren.lparen"
1614 ],
1615 regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
1616 next: "function_arguments"
1617 }, {
1618 token : [
1619 "text", "text", "storage.type", "text", "paren.lparen"
1620 ],
1621 regex : "(:)(\\s*)(function)(\\s*)(\\()",
1622 next: "function_arguments"
1623 }, {
1624 token : "keyword",
1625 regex : "(?:" + kwBeforeRe + ")\\b",
1626 next : "start"
1627 }, {
1628 token : ["punctuation.operator", "support.function"],
1629 regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
1630 }, {
1631 token : ["punctuation.operator", "support.function.dom"],
1632 regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
1633 }, {
1634 token : ["punctuation.operator", "support.constant"],
1635 regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
1636 }, {
1637 token : ["storage.type", "punctuation.operator", "support.function.firebug"],
1638 regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
1639 }, {
1640 token : keywordMapper,
1641 regex : identifierRe
1642 }, {
1643 token : "keyword.operator",
1644 regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
1645 next : "start"
1646 }, {
1647 token : "punctuation.operator",
1648 regex : /\?|\:|\,|\;|\./,
1649 next : "start"
1650 }, {
1651 token : "paren.lparen",
1652 regex : /[\[({]/,
1653 next : "start"
1654 }, {
1655 token : "paren.rparen",
1656 regex : /[\])}]/
1657 }, {
1658 token : "keyword.operator",
1659 regex : /\/=?/,
1660 next : "start"
1661 }, {
1662 token: "comment",
1663 regex: /^#!.*$/
1664 }
1665 ],
1666 "start": [
1667 DocCommentHighlightRules.getStartRule("doc-start"),
1668 {
1669 token : "comment", // multi line comment
1670 regex : "\\/\\*",
1671 next : "comment_regex_allowed"
1672 }, {
1673 token : "comment",
1674 regex : "\\/\\/.*$",
1675 next : "start"
1676 }, {
1677 token: "string.regexp",
1678 regex: "\\/",
1679 next: "regex"
1680 }, {
1681 token : "text",
1682 regex : "\\s+|^$",
1683 next : "start"
1684 }, {
1685 token: "empty",
1686 regex: "",
1687 next: "no_regex"
1688 }
1689 ],
1690 "regex": [
1691 {
1692 token: "regexp.keyword.operator",
1693 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1694 }, {
1695 token: "string.regexp",
1696 regex: "/\\w*",
1697 next: "no_regex"
1698 }, {
1699 token : "invalid",
1700 regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
1701 }, {
1702 token : "constant.language.escape",
1703 regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
1704 }, {
1705 token : "constant.language.delimiter",
1706 regex: /\|/
1707 }, {
1708 token: "constant.language.escape",
1709 regex: /\[\^?/,
1710 next: "regex_character_class"
1711 }, {
1712 token: "empty",
1713 regex: "$",
1714 next: "no_regex"
1715 }, {
1716 defaultToken: "string.regexp"
1717 }
1718 ],
1719 "regex_character_class": [
1720 {
1721 token: "regexp.keyword.operator",
1722 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1723 }, {
1724 token: "constant.language.escape",
1725 regex: "]",
1726 next: "regex"
1727 }, {
1728 token: "constant.language.escape",
1729 regex: "-"
1730 }, {
1731 token: "empty",
1732 regex: "$",
1733 next: "no_regex"
1734 }, {
1735 defaultToken: "string.regexp.charachterclass"
1736 }
1737 ],
1738 "function_arguments": [
1739 {
1740 token: "variable.parameter",
1741 regex: identifierRe
1742 }, {
1743 token: "punctuation.operator",
1744 regex: "[, ]+"
1745 }, {
1746 token: "punctuation.operator",
1747 regex: "$"
1748 }, {
1749 token: "empty",
1750 regex: "",
1751 next: "no_regex"
1752 }
1753 ],
1754 "comment_regex_allowed" : [
1755 {token : "comment", regex : "\\*\\/", next : "start"},
1756 {defaultToken : "comment"}
1757 ],
1758 "comment" : [
1759 {token : "comment", regex : "\\*\\/", next : "no_regex"},
1760 {defaultToken : "comment"}
1761 ],
1762 "qqstring" : [
1763 {
1764 token : "constant.language.escape",
1765 regex : escapedRe
1766 }, {
1767 token : "string",
1768 regex : "\\\\$",
1769 next : "qqstring"
1770 }, {
1771 token : "string",
1772 regex : '"|$',
1773 next : "no_regex"
1774 }, {
1775 defaultToken: "string"
1776 }
1777 ],
1778 "qstring" : [
1779 {
1780 token : "constant.language.escape",
1781 regex : escapedRe
1782 }, {
1783 token : "string",
1784 regex : "\\\\$",
1785 next : "qstring"
1786 }, {
1787 token : "string",
1788 regex : "'|$",
1789 next : "no_regex"
1790 }, {
1791 defaultToken: "string"
1792 }
1793 ]
1794 };
1795
1796 this.embedRules(DocCommentHighlightRules, "doc-",
1797 [ DocCommentHighlightRules.getEndRule("no_regex") ]);
1798 };
1799
1800 oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
1801
1802 exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
1803 });
1804
1805 define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
1806
1807
1808 function string(state) {
1809 return [{
1810 token : "string",
1811 regex : '"',
1812 next : state + "_qqstring"
1813 }, {
1814 token : "string",
1815 regex : "'",
1816 next : state + "_qstring"
1817 }];
1818 }
1819
1820 function multiLineString(quote, state) {
1821 return [
1822 {token : "string", regex : quote, next : state},
1823 {
1824 token : "constant.language.escape",
1825 regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1826 },
1827 {defaultToken : "string"}
1828 ];
1829 }
1830
1831 exports.tag = function(states, name, nextState, tagMap) {
1832 states[name] = [{
1833 token : "text",
1834 regex : "\\s+"
1835 }, {
1836
1837 token : !tagMap ? "meta.tag.tag-name" : function(value) {
1838 if (tagMap[value])
1839 return "meta.tag.tag-name." + tagMap[value];
1840 else
1841 return "meta.tag.tag-name";
1842 },
1843 regex : "[-_a-zA-Z0-9:]+",
1844 next : name + "_embed_attribute_list"
1845 }, {
1846 token: "empty",
1847 regex: "",
1848 next : name + "_embed_attribute_list"
1849 }];
1850
1851 states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
1852 states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
1853
1854 states[name + "_embed_attribute_list"] = [{
1855 token : "meta.tag.r",
1856 regex : "/?>",
1857 next : nextState
1858 }, {
1859 token : "keyword.operator",
1860 regex : "="
1861 }, {
1862 token : "entity.other.attribute-name",
1863 regex : "[-_a-zA-Z0-9:]+"
1864 }, {
1865 token : "constant.numeric", // float
1866 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
1867 }, {
1868 token : "text",
1869 regex : "\\s+"
1870 }].concat(string(name));
1871 };
1872
1873 });
1874
1875 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1876
1877
1878 var Range = require("../range").Range;
1879
1880 var MatchingBraceOutdent = function() {};
1881
1882 (function() {
1883
1884 this.checkOutdent = function(line, input) {
1885 if (! /^\s+$/.test(line))
1886 return false;
1887
1888 return /^\s*\}/.test(input);
1889 };
1890
1891 this.autoOutdent = function(doc, row) {
1892 var line = doc.getLine(row);
1893 var match = line.match(/^(\s*\})/);
1894
1895 if (!match) return 0;
1896
1897 var column = match[1].length;
1898 var openBracePos = doc.findMatchingBracket({row: row, column: column});
1899
1900 if (!openBracePos || openBracePos.row == row) return 0;
1901
1902 var indent = this.$getIndent(doc.getLine(openBracePos.row));
1903 doc.replace(new Range(row, 0, row, column-1), indent);
1904 };
1905
1906 this.$getIndent = function(line) {
1907 return line.match(/^\s*/)[0];
1908 };
1909
1910 }).call(MatchingBraceOutdent.prototype);
1911
1912 exports.MatchingBraceOutdent = MatchingBraceOutdent;
1913 });
1914
1915 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
1916
1917
1918 var oop = require("../../lib/oop");
1919 var Behaviour = require("../behaviour").Behaviour;
1920 var TokenIterator = require("../../token_iterator").TokenIterator;
1921 var lang = require("../../lib/lang");
1922
1923 var SAFE_INSERT_IN_TOKENS =
1924 ["text", "paren.rparen", "punctuation.operator"];
1925 var SAFE_INSERT_BEFORE_TOKENS =
1926 ["text", "paren.rparen", "punctuation.operator", "comment"];
1927
1928
1929 var autoInsertedBrackets = 0;
1930 var autoInsertedRow = -1;
1931 var autoInsertedLineEnd = "";
1932 var maybeInsertedBrackets = 0;
1933 var maybeInsertedRow = -1;
1934 var maybeInsertedLineStart = "";
1935 var maybeInsertedLineEnd = "";
1936
1937 var CstyleBehaviour = function () {
1938
1939 CstyleBehaviour.isSaneInsertion = function(editor, session) {
1940 var cursor = editor.getCursorPosition();
1941 var iterator = new TokenIterator(session, cursor.row, cursor.column);
1942 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
1943 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
1944 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
1945 return false;
1946 }
1947 iterator.stepForward();
1948 return iterator.getCurrentTokenRow() !== cursor.row ||
1949 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
1950 };
1951
1952 CstyleBehaviour.$matchTokenType = function(token, types) {
1953 return types.indexOf(token.type || token) > -1;
1954 };
1955
1956 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
1957 var cursor = editor.getCursorPosition();
1958 var line = session.doc.getLine(cursor.row);
1959 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
1960 autoInsertedBrackets = 0;
1961 autoInsertedRow = cursor.row;
1962 autoInsertedLineEnd = bracket + line.substr(cursor.column);
1963 autoInsertedBrackets++;
1964 };
1965
1966 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
1967 var cursor = editor.getCursorPosition();
1968 var line = session.doc.getLine(cursor.row);
1969 if (!this.isMaybeInsertedClosing(cursor, line))
1970 maybeInsertedBrackets = 0;
1971 maybeInsertedRow = cursor.row;
1972 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
1973 maybeInsertedLineEnd = line.substr(cursor.column);
1974 maybeInsertedBrackets++;
1975 };
1976
1977 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
1978 return autoInsertedBrackets > 0 &&
1979 cursor.row === autoInsertedRow &&
1980 bracket === autoInsertedLineEnd[0] &&
1981 line.substr(cursor.column) === autoInsertedLineEnd;
1982 };
1983
1984 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
1985 return maybeInsertedBrackets > 0 &&
1986 cursor.row === maybeInsertedRow &&
1987 line.substr(cursor.column) === maybeInsertedLineEnd &&
1988 line.substr(0, cursor.column) == maybeInsertedLineStart;
1989 };
1990
1991 CstyleBehaviour.popAutoInsertedClosing = function() {
1992 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
1993 autoInsertedBrackets--;
1994 };
1995
1996 CstyleBehaviour.clearMaybeInsertedClosing = function() {
1997 maybeInsertedBrackets = 0;
1998 maybeInsertedRow = -1;
1999 };
2000
2001 this.add("braces", "insertion", function (state, action, editor, session, text) {
2002 var cursor = editor.getCursorPosition();
2003 var line = session.doc.getLine(cursor.row);
2004 if (text == '{') {
2005 var selection = editor.getSelectionRange();
2006 var selected = session.doc.getTextRange(selection);
2007 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
2008 return {
2009 text: '{' + selected + '}',
2010 selection: false
2011 };
2012 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
2013 if (/[\]\}\)]/.test(line[cursor.column])) {
2014 CstyleBehaviour.recordAutoInsert(editor, session, "}");
2015 return {
2016 text: '{}',
2017 selection: [1, 1]
2018 };
2019 } else {
2020 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
2021 return {
2022 text: '{',
2023 selection: [1, 1]
2024 };
2025 }
2026 }
2027 } else if (text == '}') {
2028 var rightChar = line.substring(cursor.column, cursor.column + 1);
2029 if (rightChar == '}') {
2030 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
2031 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
2032 CstyleBehaviour.popAutoInsertedClosing();
2033 return {
2034 text: '',
2035 selection: [1, 1]
2036 };
2037 }
2038 }
2039 } else if (text == "\n" || text == "\r\n") {
2040 var closing = "";
2041 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
2042 closing = lang.stringRepeat("}", maybeInsertedBrackets);
2043 CstyleBehaviour.clearMaybeInsertedClosing();
2044 }
2045 var rightChar = line.substring(cursor.column, cursor.column + 1);
2046 if (rightChar == '}' || closing !== "") {
2047 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
2048 if (!openBracePos)
2049 return null;
2050
2051 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
2052 var next_indent = this.$getIndent(line);
2053
2054 return {
2055 text: '\n' + indent + '\n' + next_indent + closing,
2056 selection: [1, indent.length, 1, indent.length]
2057 };
2058 }
2059 }
2060 });
2061
2062 this.add("braces", "deletion", function (state, action, editor, session, range) {
2063 var selected = session.doc.getTextRange(range);
2064 if (!range.isMultiLine() && selected == '{') {
2065 var line = session.doc.getLine(range.start.row);
2066 var rightChar = line.substring(range.end.column, range.end.column + 1);
2067 if (rightChar == '}') {
2068 range.end.column++;
2069 return range;
2070 } else {
2071 maybeInsertedBrackets--;
2072 }
2073 }
2074 });
2075
2076 this.add("parens", "insertion", function (state, action, editor, session, text) {
2077 if (text == '(') {
2078 var selection = editor.getSelectionRange();
2079 var selected = session.doc.getTextRange(selection);
2080 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
2081 return {
2082 text: '(' + selected + ')',
2083 selection: false
2084 };
2085 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
2086 CstyleBehaviour.recordAutoInsert(editor, session, ")");
2087 return {
2088 text: '()',
2089 selection: [1, 1]
2090 };
2091 }
2092 } else if (text == ')') {
2093 var cursor = editor.getCursorPosition();
2094 var line = session.doc.getLine(cursor.row);
2095 var rightChar = line.substring(cursor.column, cursor.column + 1);
2096 if (rightChar == ')') {
2097 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
2098 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
2099 CstyleBehaviour.popAutoInsertedClosing();
2100 return {
2101 text: '',
2102 selection: [1, 1]
2103 };
2104 }
2105 }
2106 }
2107 });
2108
2109 this.add("parens", "deletion", function (state, action, editor, session, range) {
2110 var selected = session.doc.getTextRange(range);
2111 if (!range.isMultiLine() && selected == '(') {
2112 var line = session.doc.getLine(range.start.row);
2113 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
2114 if (rightChar == ')') {
2115 range.end.column++;
2116 return range;
2117 }
2118 }
2119 });
2120
2121 this.add("brackets", "insertion", function (state, action, editor, session, text) {
2122 if (text == '[') {
2123 var selection = editor.getSelectionRange();
2124 var selected = session.doc.getTextRange(selection);
2125 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
2126 return {
2127 text: '[' + selected + ']',
2128 selection: false
2129 };
2130 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
2131 CstyleBehaviour.recordAutoInsert(editor, session, "]");
2132 return {
2133 text: '[]',
2134 selection: [1, 1]
2135 };
2136 }
2137 } else if (text == ']') {
2138 var cursor = editor.getCursorPosition();
2139 var line = session.doc.getLine(cursor.row);
2140 var rightChar = line.substring(cursor.column, cursor.column + 1);
2141 if (rightChar == ']') {
2142 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
2143 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
2144 CstyleBehaviour.popAutoInsertedClosing();
2145 return {
2146 text: '',
2147 selection: [1, 1]
2148 };
2149 }
2150 }
2151 }
2152 });
2153
2154 this.add("brackets", "deletion", function (state, action, editor, session, range) {
2155 var selected = session.doc.getTextRange(range);
2156 if (!range.isMultiLine() && selected == '[') {
2157 var line = session.doc.getLine(range.start.row);
2158 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
2159 if (rightChar == ']') {
2160 range.end.column++;
2161 return range;
2162 }
2163 }
2164 });
2165
2166 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
2167 if (text == '"' || text == "'") {
2168 var quote = text;
2169 var selection = editor.getSelectionRange();
2170 var selected = session.doc.getTextRange(selection);
2171 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
2172 return {
2173 text: quote + selected + quote,
2174 selection: false
2175 };
2176 } else {
2177 var cursor = editor.getCursorPosition();
2178 var line = session.doc.getLine(cursor.row);
2179 var leftChar = line.substring(cursor.column-1, cursor.column);
2180 if (leftChar == '\\') {
2181 return null;
2182 }
2183 var tokens = session.getTokens(selection.start.row);
2184 var col = 0, token;
2185 var quotepos = -1; // Track whether we're inside an open quote.
2186
2187 for (var x = 0; x < tokens.length; x++) {
2188 token = tokens[x];
2189 if (token.type == "string") {
2190 quotepos = -1;
2191 } else if (quotepos < 0) {
2192 quotepos = token.value.indexOf(quote);
2193 }
2194 if ((token.value.length + col) > selection.start.column) {
2195 break;
2196 }
2197 col += tokens[x].value.length;
2198 }
2199 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
2200 if (!CstyleBehaviour.isSaneInsertion(editor, session))
2201 return;
2202 return {
2203 text: quote + quote,
2204 selection: [1,1]
2205 };
2206 } else if (token && token.type === "string") {
2207 var rightChar = line.substring(cursor.column, cursor.column + 1);
2208 if (rightChar == quote) {
2209 return {
2210 text: '',
2211 selection: [1, 1]
2212 };
2213 }
2214 }
2215 }
2216 }
2217 });
2218
2219 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
2220 var selected = session.doc.getTextRange(range);
2221 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
2222 var line = session.doc.getLine(range.start.row);
2223 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
2224 if (rightChar == selected) {
2225 range.end.column++;
2226 return range;
2227 }
2228 }
2229 });
2230
2231 };
2232
2233 oop.inherits(CstyleBehaviour, Behaviour);
2234
2235 exports.CstyleBehaviour = CstyleBehaviour;
2236 });
2237
2238 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
2239
2240
2241 var oop = require("../../lib/oop");
2242 var Range = require("../../range").Range;
2243 var BaseFoldMode = require("./fold_mode").FoldMode;
2244
2245 var FoldMode = exports.FoldMode = function(commentRegex) {
2246 if (commentRegex) {
2247 this.foldingStartMarker = new RegExp(
2248 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
2249 );
2250 this.foldingStopMarker = new RegExp(
2251 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
2252 );
2253 }
2254 };
2255 oop.inherits(FoldMode, BaseFoldMode);
2256
2257 (function() {
2258
2259 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
2260 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
2261
2262 this.getFoldWidgetRange = function(session, foldStyle, row) {
2263 var line = session.getLine(row);
2264 var match = line.match(this.foldingStartMarker);
2265 if (match) {
2266 var i = match.index;
2267
2268 if (match[1])
2269 return this.openingBracketBlock(session, match[1], row, i);
2270
2271 return session.getCommentFoldRange(row, i + match[0].length, 1);
2272 }
2273
2274 if (foldStyle !== "markbeginend")
2275 return;
2276
2277 var match = line.match(this.foldingStopMarker);
2278 if (match) {
2279 var i = match.index + match[0].length;
2280
2281 if (match[1])
2282 return this.closingBracketBlock(session, match[1], row, i);
2283
2284 return session.getCommentFoldRange(row, i, -1);
2285 }
2286 };
2287
2288 }).call(FoldMode.prototype);
2289
2290 });
+0
-618
try/ace/mode-powershell.js less more
0 define('ace/mode/powershell', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/powershell_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
1
2
3 var oop = require("../lib/oop");
4 var TextMode = require("./text").Mode;
5 var Tokenizer = require("../tokenizer").Tokenizer;
6 var PowershellHighlightRules = require("./powershell_highlight_rules").PowershellHighlightRules;
7 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
8 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
9 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
10
11 var Mode = function() {
12 this.$tokenizer = new Tokenizer(new PowershellHighlightRules().getRules());
13 this.$outdent = new MatchingBraceOutdent();
14 this.$behaviour = new CstyleBehaviour();
15 this.foldingRules = new CStyleFoldMode({start: "^\\s*(<#)", end: "^[#\\s]>\\s*$"});
16 };
17 oop.inherits(Mode, TextMode);
18
19 (function() {
20
21 this.lineCommentStart = "#";
22 this.blockComment = {start: "<#", end: "#>"};
23
24 this.getNextLineIndent = function(state, line, tab) {
25 var indent = this.$getIndent(line);
26
27 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
28 var tokens = tokenizedLine.tokens;
29
30 if (tokens.length && tokens[tokens.length-1].type == "comment") {
31 return indent;
32 }
33
34 if (state == "start") {
35 var match = line.match(/^.*[\{\(\[]\s*$/);
36 if (match) {
37 indent += tab;
38 }
39 }
40
41 return indent;
42 };
43
44 this.checkOutdent = function(state, line, input) {
45 return this.$outdent.checkOutdent(line, input);
46 };
47
48 this.autoOutdent = function(state, doc, row) {
49 this.$outdent.autoOutdent(doc, row);
50 };
51
52
53 this.createWorker = function(session) {
54 return null;
55 };
56
57 }).call(Mode.prototype);
58
59 exports.Mode = Mode;
60 });
61 define('ace/mode/powershell_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
62
63
64 var oop = require("../lib/oop");
65 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
66
67 var PowershellHighlightRules = function() {
68
69 var keywords = (
70 "function|if|else|elseif|switch|while|default|for|do|until|break|continue|" +
71 "foreach|return|filter|in|trap|throw|param|begin|process|end"
72 );
73
74 var builtinFunctions = (
75 "Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|" +
76 "Set-Location|Get-ChildItem|Clear-Item|Get-Command|Measure-Command|Trace-Command|" +
77 "Add-Computer|Checkpoint-Computer|Remove-Computer|Restart-Computer|Restore-Computer|Stop-Computer|" +
78 "Reset-ComputerMachinePassword|Test-ComputerSecureChannel|Add-Content|Get-Content|Set-Content|Clear-Content|" +
79 "Get-Command|Invoke-Command|Enable-ComputerRestore|Disable-ComputerRestore|Get-ComputerRestorePoint|Test-Connection|" +
80 "ConvertFrom-CSV|ConvertTo-CSV|ConvertTo-Html|ConvertTo-Xml|ConvertFrom-SecureString|ConvertTo-SecureString|" +
81 "Copy-Item|Export-Counter|Get-Counter|Import-Counter|Get-Credential|Get-Culture|" +
82 "Get-ChildItem|Get-Date|Set-Date|Remove-Item|Compare-Object|Get-Event|" +
83 "Get-WinEvent|New-Event|Remove-Event|Unregister-Event|Wait-Event|Clear-EventLog|" +
84 "Get-Eventlog|Limit-EventLog|New-Eventlog|Remove-EventLog|Show-EventLog|Write-EventLog|" +
85 "Get-EventSubscriber|Register-EngineEvent|Register-ObjectEvent|Register-WmiEvent|Get-ExecutionPolicy|Set-ExecutionPolicy|" +
86 "Export-Alias|Export-Clixml|Export-Console|Export-Csv|ForEach-Object|Format-Custom|" +
87 "Format-List|Format-Table|Format-Wide|Export-FormatData|Get-FormatData|Get-Item|" +
88 "Get-ChildItem|Get-Help|Add-History|Clear-History|Get-History|Invoke-History|" +
89 "Get-Host|Read-Host|Write-Host|Get-HotFix|Import-Clixml|Import-Csv|" +
90 "Invoke-Command|Invoke-Expression|Get-Item|Invoke-Item|New-Item|Remove-Item|" +
91 "Set-Item|Clear-ItemProperty|Copy-ItemProperty|Get-ItemProperty|Move-ItemProperty|New-ItemProperty|" +
92 "Remove-ItemProperty|Rename-ItemProperty|Set-ItemProperty|Get-Job|Receive-Job|Remove-Job|" +
93 "Start-Job|Stop-Job|Wait-Job|Stop-Process|Update-List|Get-Location|" +
94 "Pop-Location|Push-Location|Set-Location|Send-MailMessage|Add-Member|Get-Member|" +
95 "Move-Item|Compare-Object|Group-Object|Measure-Object|New-Object|Select-Object|" +
96 "Sort-Object|Where-Object|Out-Default|Out-File|Out-GridView|Out-Host|" +
97 "Out-Null|Out-Printer|Out-String|Convert-Path|Join-Path|Resolve-Path|" +
98 "Split-Path|Test-Path|Get-Pfxcertificate|Pop-Location|Push-Location|Get-Process|" +
99 "Start-Process|Stop-Process|Wait-Process|Enable-PSBreakpoint|Disable-PSBreakpoint|Get-PSBreakpoint|" +
100 "Set-PSBreakpoint|Remove-PSBreakpoint|Get-PSDrive|New-PSDrive|Remove-PSDrive|Get-PSProvider|" +
101 "Set-PSdebug|Enter-PSSession|Exit-PSSession|Export-PSSession|Get-PSSession|Import-PSSession|" +
102 "New-PSSession|Remove-PSSession|Disable-PSSessionConfiguration|Enable-PSSessionConfiguration|Get-PSSessionConfiguration|Register-PSSessionConfiguration|" +
103 "Set-PSSessionConfiguration|Unregister-PSSessionConfiguration|New-PSSessionOption|Add-PsSnapIn|Get-PsSnapin|Remove-PSSnapin|" +
104 "Get-Random|Read-Host|Remove-Item|Rename-Item|Rename-ItemProperty|Select-Object|" +
105 "Select-XML|Send-MailMessage|Get-Service|New-Service|Restart-Service|Resume-Service|" +
106 "Set-Service|Start-Service|Stop-Service|Suspend-Service|Sort-Object|Start-Sleep|" +
107 "ConvertFrom-StringData|Select-String|Tee-Object|New-Timespan|Trace-Command|Get-Tracesource|" +
108 "Set-Tracesource|Start-Transaction|Complete-Transaction|Get-Transaction|Use-Transaction|Undo-Transaction|" +
109 "Start-Transcript|Stop-Transcript|Add-Type|Update-TypeData|Get-Uiculture|Get-Unique|" +
110 "Update-Formatdata|Update-Typedata|Clear-Variable|Get-Variable|New-Variable|Remove-Variable|" +
111 "Set-Variable|New-WebServiceProxy|Where-Object|Write-Debug|Write-Error|Write-Host|" +
112 "Write-Output|Write-Progress|Write-Verbose|Write-Warning|Set-WmiInstance|Invoke-WmiMethod|" +
113 "Get-WmiObject|Remove-WmiObject|Connect-WSMan|Disconnect-WSMan|Test-WSMan|Invoke-WSManAction|" +
114 "Disable-WSManCredSSP|Enable-WSManCredSSP|Get-WSManCredSSP|New-WSManInstance|Get-WSManInstance|Set-WSManInstance|" +
115 "Remove-WSManInstance|Set-WSManQuickConfig|New-WSManSessionOption"
116 );
117
118 var keywordMapper = this.createKeywordMapper({
119 "support.function": builtinFunctions,
120 "keyword": keywords
121 }, "identifier");
122
123 var binaryOperatorsRe = "eq|ne|ge|gt|lt|le|like|notlike|match|notmatch|replace|contains|notcontains|" +
124 "ieq|ine|ige|igt|ile|ilt|ilike|inotlike|imatch|inotmatch|ireplace|icontains|inotcontains|" +
125 "is|isnot|as|" +
126 "and|or|band|bor|not";
127
128 this.$rules = {
129 "start" : [
130 {
131 token : "comment",
132 regex : "#.*$"
133 }, {
134 token : "comment.start",
135 regex : "<#",
136 next : "comment"
137 }, {
138 token : "string", // single line
139 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
140 }, {
141 token : "string", // single line
142 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
143 }, {
144 token : "constant.numeric", // hex
145 regex : "0[xX][0-9a-fA-F]+\\b"
146 }, {
147 token : "constant.numeric", // float
148 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
149 }, {
150 token : "constant.language.boolean",
151 regex : "[$](?:[Tt]rue|[Ff]alse)\\b"
152 }, {
153 token : "constant.language",
154 regex : "[$][Nn]ull\\b"
155 }, {
156 token : "variable.instance",
157 regex : "[$][a-zA-Z][a-zA-Z0-9_]*\\b"
158 }, {
159 token : keywordMapper,
160 regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"
161 }, {
162 token : "keyword.operator",
163 regex : "\\-(?:" + binaryOperatorsRe + ")"
164 }, {
165 token : "keyword.operator",
166 regex : "&|\\*|\\+|\\-|\\=|\\+=|\\-="
167 }, {
168 token : "lparen",
169 regex : "[[({]"
170 }, {
171 token : "rparen",
172 regex : "[\\])}]"
173 }, {
174 token : "text",
175 regex : "\\s+"
176 }
177 ],
178 "comment" : [
179 {
180 token : "comment.end",
181 regex : "#>",
182 next : "start"
183 }, {
184 token : "doc.comment.tag",
185 regex : "^\\.\\w+"
186 }, {
187 token : "comment",
188 regex : "\\w+"
189 }, {
190 token : "comment",
191 regex : "."
192 }
193 ]
194 };
195 };
196
197 oop.inherits(PowershellHighlightRules, TextHighlightRules);
198
199 exports.PowershellHighlightRules = PowershellHighlightRules;
200 });
201
202 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
203
204
205 var Range = require("../range").Range;
206
207 var MatchingBraceOutdent = function() {};
208
209 (function() {
210
211 this.checkOutdent = function(line, input) {
212 if (! /^\s+$/.test(line))
213 return false;
214
215 return /^\s*\}/.test(input);
216 };
217
218 this.autoOutdent = function(doc, row) {
219 var line = doc.getLine(row);
220 var match = line.match(/^(\s*\})/);
221
222 if (!match) return 0;
223
224 var column = match[1].length;
225 var openBracePos = doc.findMatchingBracket({row: row, column: column});
226
227 if (!openBracePos || openBracePos.row == row) return 0;
228
229 var indent = this.$getIndent(doc.getLine(openBracePos.row));
230 doc.replace(new Range(row, 0, row, column-1), indent);
231 };
232
233 this.$getIndent = function(line) {
234 return line.match(/^\s*/)[0];
235 };
236
237 }).call(MatchingBraceOutdent.prototype);
238
239 exports.MatchingBraceOutdent = MatchingBraceOutdent;
240 });
241
242 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
243
244
245 var oop = require("../../lib/oop");
246 var Behaviour = require("../behaviour").Behaviour;
247 var TokenIterator = require("../../token_iterator").TokenIterator;
248 var lang = require("../../lib/lang");
249
250 var SAFE_INSERT_IN_TOKENS =
251 ["text", "paren.rparen", "punctuation.operator"];
252 var SAFE_INSERT_BEFORE_TOKENS =
253 ["text", "paren.rparen", "punctuation.operator", "comment"];
254
255
256 var autoInsertedBrackets = 0;
257 var autoInsertedRow = -1;
258 var autoInsertedLineEnd = "";
259 var maybeInsertedBrackets = 0;
260 var maybeInsertedRow = -1;
261 var maybeInsertedLineStart = "";
262 var maybeInsertedLineEnd = "";
263
264 var CstyleBehaviour = function () {
265
266 CstyleBehaviour.isSaneInsertion = function(editor, session) {
267 var cursor = editor.getCursorPosition();
268 var iterator = new TokenIterator(session, cursor.row, cursor.column);
269 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
270 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
271 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
272 return false;
273 }
274 iterator.stepForward();
275 return iterator.getCurrentTokenRow() !== cursor.row ||
276 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
277 };
278
279 CstyleBehaviour.$matchTokenType = function(token, types) {
280 return types.indexOf(token.type || token) > -1;
281 };
282
283 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
284 var cursor = editor.getCursorPosition();
285 var line = session.doc.getLine(cursor.row);
286 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
287 autoInsertedBrackets = 0;
288 autoInsertedRow = cursor.row;
289 autoInsertedLineEnd = bracket + line.substr(cursor.column);
290 autoInsertedBrackets++;
291 };
292
293 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
294 var cursor = editor.getCursorPosition();
295 var line = session.doc.getLine(cursor.row);
296 if (!this.isMaybeInsertedClosing(cursor, line))
297 maybeInsertedBrackets = 0;
298 maybeInsertedRow = cursor.row;
299 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
300 maybeInsertedLineEnd = line.substr(cursor.column);
301 maybeInsertedBrackets++;
302 };
303
304 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
305 return autoInsertedBrackets > 0 &&
306 cursor.row === autoInsertedRow &&
307 bracket === autoInsertedLineEnd[0] &&
308 line.substr(cursor.column) === autoInsertedLineEnd;
309 };
310
311 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
312 return maybeInsertedBrackets > 0 &&
313 cursor.row === maybeInsertedRow &&
314 line.substr(cursor.column) === maybeInsertedLineEnd &&
315 line.substr(0, cursor.column) == maybeInsertedLineStart;
316 };
317
318 CstyleBehaviour.popAutoInsertedClosing = function() {
319 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
320 autoInsertedBrackets--;
321 };
322
323 CstyleBehaviour.clearMaybeInsertedClosing = function() {
324 maybeInsertedBrackets = 0;
325 maybeInsertedRow = -1;
326 };
327
328 this.add("braces", "insertion", function (state, action, editor, session, text) {
329 var cursor = editor.getCursorPosition();
330 var line = session.doc.getLine(cursor.row);
331 if (text == '{') {
332 var selection = editor.getSelectionRange();
333 var selected = session.doc.getTextRange(selection);
334 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
335 return {
336 text: '{' + selected + '}',
337 selection: false
338 };
339 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
340 if (/[\]\}\)]/.test(line[cursor.column])) {
341 CstyleBehaviour.recordAutoInsert(editor, session, "}");
342 return {
343 text: '{}',
344 selection: [1, 1]
345 };
346 } else {
347 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
348 return {
349 text: '{',
350 selection: [1, 1]
351 };
352 }
353 }
354 } else if (text == '}') {
355 var rightChar = line.substring(cursor.column, cursor.column + 1);
356 if (rightChar == '}') {
357 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
358 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
359 CstyleBehaviour.popAutoInsertedClosing();
360 return {
361 text: '',
362 selection: [1, 1]
363 };
364 }
365 }
366 } else if (text == "\n" || text == "\r\n") {
367 var closing = "";
368 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
369 closing = lang.stringRepeat("}", maybeInsertedBrackets);
370 CstyleBehaviour.clearMaybeInsertedClosing();
371 }
372 var rightChar = line.substring(cursor.column, cursor.column + 1);
373 if (rightChar == '}' || closing !== "") {
374 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
375 if (!openBracePos)
376 return null;
377
378 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
379 var next_indent = this.$getIndent(line);
380
381 return {
382 text: '\n' + indent + '\n' + next_indent + closing,
383 selection: [1, indent.length, 1, indent.length]
384 };
385 }
386 }
387 });
388
389 this.add("braces", "deletion", function (state, action, editor, session, range) {
390 var selected = session.doc.getTextRange(range);
391 if (!range.isMultiLine() && selected == '{') {
392 var line = session.doc.getLine(range.start.row);
393 var rightChar = line.substring(range.end.column, range.end.column + 1);
394 if (rightChar == '}') {
395 range.end.column++;
396 return range;
397 } else {
398 maybeInsertedBrackets--;
399 }
400 }
401 });
402
403 this.add("parens", "insertion", function (state, action, editor, session, text) {
404 if (text == '(') {
405 var selection = editor.getSelectionRange();
406 var selected = session.doc.getTextRange(selection);
407 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
408 return {
409 text: '(' + selected + ')',
410 selection: false
411 };
412 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
413 CstyleBehaviour.recordAutoInsert(editor, session, ")");
414 return {
415 text: '()',
416 selection: [1, 1]
417 };
418 }
419 } else if (text == ')') {
420 var cursor = editor.getCursorPosition();
421 var line = session.doc.getLine(cursor.row);
422 var rightChar = line.substring(cursor.column, cursor.column + 1);
423 if (rightChar == ')') {
424 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
425 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
426 CstyleBehaviour.popAutoInsertedClosing();
427 return {
428 text: '',
429 selection: [1, 1]
430 };
431 }
432 }
433 }
434 });
435
436 this.add("parens", "deletion", function (state, action, editor, session, range) {
437 var selected = session.doc.getTextRange(range);
438 if (!range.isMultiLine() && selected == '(') {
439 var line = session.doc.getLine(range.start.row);
440 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
441 if (rightChar == ')') {
442 range.end.column++;
443 return range;
444 }
445 }
446 });
447
448 this.add("brackets", "insertion", function (state, action, editor, session, text) {
449 if (text == '[') {
450 var selection = editor.getSelectionRange();
451 var selected = session.doc.getTextRange(selection);
452 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
453 return {
454 text: '[' + selected + ']',
455 selection: false
456 };
457 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
458 CstyleBehaviour.recordAutoInsert(editor, session, "]");
459 return {
460 text: '[]',
461 selection: [1, 1]
462 };
463 }
464 } else if (text == ']') {
465 var cursor = editor.getCursorPosition();
466 var line = session.doc.getLine(cursor.row);
467 var rightChar = line.substring(cursor.column, cursor.column + 1);
468 if (rightChar == ']') {
469 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
470 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
471 CstyleBehaviour.popAutoInsertedClosing();
472 return {
473 text: '',
474 selection: [1, 1]
475 };
476 }
477 }
478 }
479 });
480
481 this.add("brackets", "deletion", function (state, action, editor, session, range) {
482 var selected = session.doc.getTextRange(range);
483 if (!range.isMultiLine() && selected == '[') {
484 var line = session.doc.getLine(range.start.row);
485 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
486 if (rightChar == ']') {
487 range.end.column++;
488 return range;
489 }
490 }
491 });
492
493 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
494 if (text == '"' || text == "'") {
495 var quote = text;
496 var selection = editor.getSelectionRange();
497 var selected = session.doc.getTextRange(selection);
498 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
499 return {
500 text: quote + selected + quote,
501 selection: false
502 };
503 } else {
504 var cursor = editor.getCursorPosition();
505 var line = session.doc.getLine(cursor.row);
506 var leftChar = line.substring(cursor.column-1, cursor.column);
507 if (leftChar == '\\') {
508 return null;
509 }
510 var tokens = session.getTokens(selection.start.row);
511 var col = 0, token;
512 var quotepos = -1; // Track whether we're inside an open quote.
513
514 for (var x = 0; x < tokens.length; x++) {
515 token = tokens[x];
516 if (token.type == "string") {
517 quotepos = -1;
518 } else if (quotepos < 0) {
519 quotepos = token.value.indexOf(quote);
520 }
521 if ((token.value.length + col) > selection.start.column) {
522 break;
523 }
524 col += tokens[x].value.length;
525 }
526 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
527 if (!CstyleBehaviour.isSaneInsertion(editor, session))
528 return;
529 return {
530 text: quote + quote,
531 selection: [1,1]
532 };
533 } else if (token && token.type === "string") {
534 var rightChar = line.substring(cursor.column, cursor.column + 1);
535 if (rightChar == quote) {
536 return {
537 text: '',
538 selection: [1, 1]
539 };
540 }
541 }
542 }
543 }
544 });
545
546 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
547 var selected = session.doc.getTextRange(range);
548 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
549 var line = session.doc.getLine(range.start.row);
550 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
551 if (rightChar == selected) {
552 range.end.column++;
553 return range;
554 }
555 }
556 });
557
558 };
559
560 oop.inherits(CstyleBehaviour, Behaviour);
561
562 exports.CstyleBehaviour = CstyleBehaviour;
563 });
564
565 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
566
567
568 var oop = require("../../lib/oop");
569 var Range = require("../../range").Range;
570 var BaseFoldMode = require("./fold_mode").FoldMode;
571
572 var FoldMode = exports.FoldMode = function(commentRegex) {
573 if (commentRegex) {
574 this.foldingStartMarker = new RegExp(
575 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
576 );
577 this.foldingStopMarker = new RegExp(
578 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
579 );
580 }
581 };
582 oop.inherits(FoldMode, BaseFoldMode);
583
584 (function() {
585
586 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
587 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
588
589 this.getFoldWidgetRange = function(session, foldStyle, row) {
590 var line = session.getLine(row);
591 var match = line.match(this.foldingStartMarker);
592 if (match) {
593 var i = match.index;
594
595 if (match[1])
596 return this.openingBracketBlock(session, match[1], row, i);
597
598 return session.getCommentFoldRange(row, i + match[0].length, 1);
599 }
600
601 if (foldStyle !== "markbeginend")
602 return;
603
604 var match = line.match(this.foldingStopMarker);
605 if (match) {
606 var i = match.index + match[0].length;
607
608 if (match[1])
609 return this.closingBracketBlock(session, match[1], row, i);
610
611 return session.getCommentFoldRange(row, i, -1);
612 }
613 };
614
615 }).call(FoldMode.prototype);
616
617 });
+0
-101
try/ace/mode-properties.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/properties', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/properties_highlight_rules'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var PropertiesHighlightRules = require("./properties_highlight_rules").PropertiesHighlightRules;
37
38 var Mode = function() {
39 var highlighter = new PropertiesHighlightRules();
40 this.$tokenizer = new Tokenizer(highlighter.getRules());
41 };
42 oop.inherits(Mode, TextMode);
43
44 exports.Mode = Mode;
45 });
46
47 define('ace/mode/properties_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
48
49
50 var oop = require("../lib/oop");
51 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
52
53 var PropertiesHighlightRules = function() {
54
55 var escapeRe = /\\u[0-9a-fA-F]{4}|\\/;
56
57 this.$rules = {
58 "start" : [
59 {
60 token : "comment",
61 regex : /[!#].*$/
62 }, {
63 token : "keyword",
64 regex : /[=:]$/
65 }, {
66 token : "keyword",
67 regex : /[=:]/,
68 next : "value"
69 }, {
70 token : "constant.language.escape",
71 regex : escapeRe,
72 }, {
73 defaultToken: "variable"
74 }
75 ],
76 "value" : [
77 {
78 regex : /\\$/,
79 token : "string",
80 next : "value"
81 }, {
82 regex : /$/,
83 token : "string",
84 next : "start"
85 }, {
86 token : "constant.language.escape",
87 regex : escapeRe
88 }, {
89 defaultToken: "string"
90 }
91 ]
92 };
93
94 };
95
96 oop.inherits(PropertiesHighlightRules, TextHighlightRules);
97
98 exports.PropertiesHighlightRules = PropertiesHighlightRules;
99 });
100
+0
-294
try/ace/mode-python.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/python', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/python_highlight_rules', 'ace/mode/folding/pythonic', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules;
37 var PythonFoldMode = require("./folding/pythonic").FoldMode;
38 var Range = require("../range").Range;
39
40 var Mode = function() {
41 this.$tokenizer = new Tokenizer(new PythonHighlightRules().getRules());
42 this.foldingRules = new PythonFoldMode("\\:");
43 };
44 oop.inherits(Mode, TextMode);
45
46 (function() {
47
48 this.lineCommentStart = "#";
49
50 this.getNextLineIndent = function(state, line, tab) {
51 var indent = this.$getIndent(line);
52
53 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
54 var tokens = tokenizedLine.tokens;
55
56 if (tokens.length && tokens[tokens.length-1].type == "comment") {
57 return indent;
58 }
59
60 if (state == "start") {
61 var match = line.match(/^.*[\{\(\[\:]\s*$/);
62 if (match) {
63 indent += tab;
64 }
65 }
66
67 return indent;
68 };
69
70 var outdents = {
71 "pass": 1,
72 "return": 1,
73 "raise": 1,
74 "break": 1,
75 "continue": 1
76 };
77
78 this.checkOutdent = function(state, line, input) {
79 if (input !== "\r\n" && input !== "\r" && input !== "\n")
80 return false;
81
82 var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
83
84 if (!tokens)
85 return false;
86 do {
87 var last = tokens.pop();
88 } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
89
90 if (!last)
91 return false;
92
93 return (last.type == "keyword" && outdents[last.value]);
94 };
95
96 this.autoOutdent = function(state, doc, row) {
97
98 row += 1;
99 var indent = this.$getIndent(doc.getLine(row));
100 var tab = doc.getTabString();
101 if (indent.slice(-tab.length) == tab)
102 doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
103 };
104
105 }).call(Mode.prototype);
106
107 exports.Mode = Mode;
108 });
109
110 define('ace/mode/python_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
111
112
113 var oop = require("../lib/oop");
114 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
115
116 var PythonHighlightRules = function() {
117
118 var keywords = (
119 "and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
120 "finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" +
121 "raise|return|try|while|with|yield"
122 );
123
124 var builtinConstants = (
125 "True|False|None|NotImplemented|Ellipsis|__debug__"
126 );
127
128 var builtinFunctions = (
129 "abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" +
130 "eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" +
131 "binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" +
132 "float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" +
133 "chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" +
134 "cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" +
135 "__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" +
136 "buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern"
137 );
138 var keywordMapper = this.createKeywordMapper({
139 "invalid.deprecated": "debugger",
140 "support.function": builtinFunctions,
141 "constant.language": builtinConstants,
142 "keyword": keywords
143 }, "identifier");
144
145 var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
146
147 var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
148 var octInteger = "(?:0[oO]?[0-7]+)";
149 var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
150 var binInteger = "(?:0[bB][01]+)";
151 var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
152
153 var exponent = "(?:[eE][+-]?\\d+)";
154 var fraction = "(?:\\.\\d+)";
155 var intPart = "(?:\\d+)";
156 var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
157 var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
158 var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
159
160 var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
161
162 this.$rules = {
163 "start" : [ {
164 token : "comment",
165 regex : "#.*$"
166 }, {
167 token : "string", // multi line """ string start
168 regex : strPre + '"{3}',
169 next : "qqstring3"
170 }, {
171 token : "string", // " string
172 regex : strPre + '"(?=.)',
173 next : "qqstring"
174 }, {
175 token : "string", // multi line ''' string start
176 regex : strPre + "'{3}",
177 next : "qstring3"
178 }, {
179 token : "string", // ' string
180 regex : strPre + "'(?=.)",
181 next : "qstring"
182 }, {
183 token : "constant.numeric", // imaginary
184 regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
185 }, {
186 token : "constant.numeric", // float
187 regex : floatNumber
188 }, {
189 token : "constant.numeric", // long integer
190 regex : integer + "[lL]\\b"
191 }, {
192 token : "constant.numeric", // integer
193 regex : integer + "\\b"
194 }, {
195 token : keywordMapper,
196 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
197 }, {
198 token : "keyword.operator",
199 regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
200 }, {
201 token : "paren.lparen",
202 regex : "[\\[\\(\\{]"
203 }, {
204 token : "paren.rparen",
205 regex : "[\\]\\)\\}]"
206 }, {
207 token : "text",
208 regex : "\\s+"
209 } ],
210 "qqstring3" : [ {
211 token : "constant.language.escape",
212 regex : stringEscape
213 }, {
214 token : "string", // multi line """ string end
215 regex : '"{3}',
216 next : "start"
217 }, {
218 defaultToken : "string"
219 } ],
220 "qstring3" : [ {
221 token : "constant.language.escape",
222 regex : stringEscape
223 }, {
224 token : "string", // multi line ''' string end
225 regex : "'{3}",
226 next : "start"
227 }, {
228 defaultToken : "string"
229 } ],
230 "qqstring" : [{
231 token : "constant.language.escape",
232 regex : stringEscape
233 }, {
234 token : "string",
235 regex : "\\\\$",
236 next : "qqstring"
237 }, {
238 token : "string",
239 regex : '"|$',
240 next : "start"
241 }, {
242 defaultToken: "string"
243 }],
244 "qstring" : [{
245 token : "constant.language.escape",
246 regex : stringEscape
247 }, {
248 token : "string",
249 regex : "\\\\$",
250 next : "qstring"
251 }, {
252 token : "string",
253 regex : "'|$",
254 next : "start"
255 }, {
256 defaultToken: "string"
257 }]
258 };
259 };
260
261 oop.inherits(PythonHighlightRules, TextHighlightRules);
262
263 exports.PythonHighlightRules = PythonHighlightRules;
264 });
265
266 define('ace/mode/folding/pythonic', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
267
268
269 var oop = require("../../lib/oop");
270 var BaseFoldMode = require("./fold_mode").FoldMode;
271
272 var FoldMode = exports.FoldMode = function(markers) {
273 this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$");
274 };
275 oop.inherits(FoldMode, BaseFoldMode);
276
277 (function() {
278
279 this.getFoldWidgetRange = function(session, foldStyle, row) {
280 var line = session.getLine(row);
281 var match = line.match(this.foldingStartMarker);
282 if (match) {
283 if (match[1])
284 return this.openingBracketBlock(session, match[1], row, match.index);
285 if (match[2])
286 return this.indentationBlock(session, row, match.index + match[2].length);
287 return this.indentationBlock(session, row);
288 }
289 }
290
291 }).call(FoldMode.prototype);
292
293 });
+0
-316
try/ace/mode-r.js less more
0 /*
1 * r.js
2 *
3 * Copyright (C) 2009-11 by RStudio, Inc.
4 *
5 * The Initial Developer of the Original Code is
6 * Ajax.org B.V.
7 * Portions created by the Initial Developer are Copyright (C) 2010
8 * the Initial Developer. All Rights Reserved.
9 *
10 * This program is licensed to you under the terms of version 3 of the
11 * GNU Affero General Public License. This program is distributed WITHOUT
12 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
14 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
15 *
16 */
17 define('ace/mode/r', ['require', 'exports', 'module' , 'ace/range', 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/r_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/unicode'], function(require, exports, module) {
18
19
20 var Range = require("../range").Range;
21 var oop = require("../lib/oop");
22 var TextMode = require("./text").Mode;
23 var Tokenizer = require("../tokenizer").Tokenizer;
24 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
25 var RHighlightRules = require("./r_highlight_rules").RHighlightRules;
26 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
27 var unicode = require("../unicode");
28
29 var Mode = function()
30 {
31 this.$tokenizer = new Tokenizer(new RHighlightRules().getRules());
32 this.$outdent = new MatchingBraceOutdent();
33 };
34 oop.inherits(Mode, TextMode);
35
36 (function()
37 {
38 this.lineCommentStart = "#";
39 }).call(Mode.prototype);
40 exports.Mode = Mode;
41 });
42 define('ace/mode/r_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules', 'ace/mode/tex_highlight_rules'], function(require, exports, module) {
43
44 var oop = require("../lib/oop");
45 var lang = require("../lib/lang");
46 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
47 var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules;
48
49 var RHighlightRules = function()
50 {
51
52 var keywords = lang.arrayToMap(
53 ("function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass")
54 .split("|")
55 );
56
57 var buildinConstants = lang.arrayToMap(
58 ("NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|" +
59 "NA_complex_").split("|")
60 );
61
62 this.$rules = {
63 "start" : [
64 {
65 token : "comment.sectionhead",
66 regex : "#+(?!').*(?:----|====|####)\\s*$"
67 },
68 {
69 token : "comment",
70 regex : "#+'",
71 next : "rd-start"
72 },
73 {
74 token : "comment",
75 regex : "#.*$"
76 },
77 {
78 token : "string", // multi line string start
79 regex : '["]',
80 next : "qqstring"
81 },
82 {
83 token : "string", // multi line string start
84 regex : "[']",
85 next : "qstring"
86 },
87 {
88 token : "constant.numeric", // hex
89 regex : "0[xX][0-9a-fA-F]+[Li]?\\b"
90 },
91 {
92 token : "constant.numeric", // explicit integer
93 regex : "\\d+L\\b"
94 },
95 {
96 token : "constant.numeric", // number
97 regex : "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b"
98 },
99 {
100 token : "constant.numeric", // number with leading decimal
101 regex : "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b"
102 },
103 {
104 token : "constant.language.boolean",
105 regex : "(?:TRUE|FALSE|T|F)\\b"
106 },
107 {
108 token : "identifier",
109 regex : "`.*?`"
110 },
111 {
112 onMatch : function(value) {
113 if (keywords[value])
114 return "keyword";
115 else if (buildinConstants[value])
116 return "constant.language";
117 else if (value == '...' || value.match(/^\.\.\d+$/))
118 return "variable.language";
119 else
120 return "identifier";
121 },
122 regex : "[a-zA-Z.][a-zA-Z0-9._]*\\b"
123 },
124 {
125 token : "keyword.operator",
126 regex : "%%|>=|<=|==|!=|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||~|\\$|:"
127 },
128 {
129 token : "keyword.operator", // infix operators
130 regex : "%.*?%"
131 },
132 {
133 token : "paren.keyword.operator",
134 regex : "[[({]"
135 },
136 {
137 token : "paren.keyword.operator",
138 regex : "[\\])}]"
139 },
140 {
141 token : "text",
142 regex : "\\s+"
143 }
144 ],
145 "qqstring" : [
146 {
147 token : "string",
148 regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
149 next : "start"
150 },
151 {
152 token : "string",
153 regex : '.+'
154 }
155 ],
156 "qstring" : [
157 {
158 token : "string",
159 regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
160 next : "start"
161 },
162 {
163 token : "string",
164 regex : '.+'
165 }
166 ]
167 };
168
169 var rdRules = new TexHighlightRules("comment").getRules();
170 for (var i = 0; i < rdRules["start"].length; i++) {
171 rdRules["start"][i].token += ".virtual-comment";
172 }
173
174 this.addRules(rdRules, "rd-");
175 this.$rules["rd-start"].unshift({
176 token: "text",
177 regex: "^",
178 next: "start"
179 });
180 this.$rules["rd-start"].unshift({
181 token : "keyword",
182 regex : "@(?!@)[^ ]*"
183 });
184 this.$rules["rd-start"].unshift({
185 token : "comment",
186 regex : "@@"
187 });
188 this.$rules["rd-start"].push({
189 token : "comment",
190 regex : "[^%\\\\[({\\])}]+"
191 });
192 };
193
194 oop.inherits(RHighlightRules, TextHighlightRules);
195
196 exports.RHighlightRules = RHighlightRules;
197 });
198 define('ace/mode/tex_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
199
200
201 var oop = require("../lib/oop");
202 var lang = require("../lib/lang");
203 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
204
205 var TexHighlightRules = function(textClass) {
206
207 if (!textClass)
208 textClass = "text";
209
210 this.$rules = {
211 "start" : [
212 {
213 token : "comment",
214 regex : "%.*$"
215 }, {
216 token : textClass, // non-command
217 regex : "\\\\[$&%#\\{\\}]"
218 }, {
219 token : "keyword", // command
220 regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b",
221 next : "nospell"
222 }, {
223 token : "keyword", // command
224 regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])"
225 }, {
226 token : "paren.keyword.operator",
227 regex : "[[({]"
228 }, {
229 token : "paren.keyword.operator",
230 regex : "[\\])}]"
231 }, {
232 token : textClass,
233 regex : "\\s+"
234 }
235 ],
236 "nospell" : [
237 {
238 token : "comment",
239 regex : "%.*$",
240 next : "start"
241 }, {
242 token : "nospell." + textClass, // non-command
243 regex : "\\\\[$&%#\\{\\}]"
244 }, {
245 token : "keyword", // command
246 regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b"
247 }, {
248 token : "keyword", // command
249 regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])",
250 next : "start"
251 }, {
252 token : "paren.keyword.operator",
253 regex : "[[({]"
254 }, {
255 token : "paren.keyword.operator",
256 regex : "[\\])]"
257 }, {
258 token : "paren.keyword.operator",
259 regex : "}",
260 next : "start"
261 }, {
262 token : "nospell." + textClass,
263 regex : "\\s+"
264 }, {
265 token : "nospell." + textClass,
266 regex : "\\w+"
267 }
268 ]
269 };
270 };
271
272 oop.inherits(TexHighlightRules, TextHighlightRules);
273
274 exports.TexHighlightRules = TexHighlightRules;
275 });
276
277 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
278
279
280 var Range = require("../range").Range;
281
282 var MatchingBraceOutdent = function() {};
283
284 (function() {
285
286 this.checkOutdent = function(line, input) {
287 if (! /^\s+$/.test(line))
288 return false;
289
290 return /^\s*\}/.test(input);
291 };
292
293 this.autoOutdent = function(doc, row) {
294 var line = doc.getLine(row);
295 var match = line.match(/^(\s*\})/);
296
297 if (!match) return 0;
298
299 var column = match[1].length;
300 var openBracePos = doc.findMatchingBracket({row: row, column: column});
301
302 if (!openBracePos || openBracePos.row == row) return 0;
303
304 var indent = this.$getIndent(doc.getLine(openBracePos.row));
305 doc.replace(new Range(row, 0, row, column-1), indent);
306 };
307
308 this.$getIndent = function(line) {
309 return line.match(/^\s*/)[0];
310 };
311
312 }).call(MatchingBraceOutdent.prototype);
313
314 exports.MatchingBraceOutdent = MatchingBraceOutdent;
315 });
+0
-184
try/ace/mode-rdoc.js less more
0 /*
1 * rdoc.js
2 *
3 * Copyright (C) 2009-11 by RStudio, Inc.
4 *
5 * This program is licensed to you under the terms of version 3 of the
6 * GNU Affero General Public License. This program is distributed WITHOUT
7 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
8 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
9 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
10 *
11 */
12 define('ace/mode/rdoc', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/rdoc_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
13
14
15 var oop = require("../lib/oop");
16 var TextMode = require("./text").Mode;
17 var Tokenizer = require("../tokenizer").Tokenizer;
18 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
19 var RDocHighlightRules = require("./rdoc_highlight_rules").RDocHighlightRules;
20 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
21
22 var Mode = function(suppressHighlighting) {
23 this.$tokenizer = new Tokenizer(new RDocHighlightRules().getRules());
24 this.$outdent = new MatchingBraceOutdent();
25 };
26 oop.inherits(Mode, TextMode);
27
28 (function() {
29 this.getNextLineIndent = function(state, line, tab) {
30 return this.$getIndent(line);
31 };
32 }).call(Mode.prototype);
33
34 exports.Mode = Mode;
35 });
36 define('ace/mode/rdoc_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules', 'ace/mode/latex_highlight_rules'], function(require, exports, module) {
37
38
39 var oop = require("../lib/oop");
40 var lang = require("../lib/lang");
41 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
42 var LaTeXHighlightRules = require("./latex_highlight_rules");
43
44 var RDocHighlightRules = function() {
45
46 this.$rules = {
47 "start" : [
48 {
49 token : "comment",
50 regex : "%.*$"
51 }, {
52 token : "text", // non-command
53 regex : "\\\\[$&%#\\{\\}]"
54 }, {
55 token : "keyword", // command
56 regex : "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b",
57 next : "nospell"
58 }, {
59 token : "keyword", // command
60 regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])"
61 }, {
62 token : "paren.keyword.operator",
63 regex : "[[({]"
64 }, {
65 token : "paren.keyword.operator",
66 regex : "[\\])}]"
67 }, {
68 token : "text",
69 regex : "\\s+"
70 }
71 ],
72 "nospell" : [
73 {
74 token : "comment",
75 regex : "%.*$",
76 next : "start"
77 }, {
78 token : "nospell.text", // non-command
79 regex : "\\\\[$&%#\\{\\}]"
80 }, {
81 token : "keyword", // command
82 regex : "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b"
83 }, {
84 token : "keyword", // command
85 regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])",
86 next : "start"
87 }, {
88 token : "paren.keyword.operator",
89 regex : "[[({]"
90 }, {
91 token : "paren.keyword.operator",
92 regex : "[\\])]"
93 }, {
94 token : "paren.keyword.operator",
95 regex : "}",
96 next : "start"
97 }, {
98 token : "nospell.text",
99 regex : "\\s+"
100 }, {
101 token : "nospell.text",
102 regex : "\\w+"
103 }
104 ]
105 };
106 };
107
108 oop.inherits(RDocHighlightRules, TextHighlightRules);
109
110 exports.RDocHighlightRules = RDocHighlightRules;
111 });
112 define('ace/mode/latex_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
113
114
115 var oop = require("../lib/oop");
116 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
117
118 var LatexHighlightRules = function() {
119 this.$rules = {
120 "start" : [{
121 token : "keyword",
122 regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
123 }, {
124 token : "lparen",
125 regex : "[[({]"
126 }, {
127 token : "rparen",
128 regex : "[\\])}]"
129 }, {
130 token : "string",
131 regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
132 }, {
133 token : "comment",
134 regex : "%.*$"
135 }]
136 };
137 };
138
139 oop.inherits(LatexHighlightRules, TextHighlightRules);
140
141 exports.LatexHighlightRules = LatexHighlightRules;
142
143 });
144
145 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
146
147
148 var Range = require("../range").Range;
149
150 var MatchingBraceOutdent = function() {};
151
152 (function() {
153
154 this.checkOutdent = function(line, input) {
155 if (! /^\s+$/.test(line))
156 return false;
157
158 return /^\s*\}/.test(input);
159 };
160
161 this.autoOutdent = function(doc, row) {
162 var line = doc.getLine(row);
163 var match = line.match(/^(\s*\})/);
164
165 if (!match) return 0;
166
167 var column = match[1].length;
168 var openBracePos = doc.findMatchingBracket({row: row, column: column});
169
170 if (!openBracePos || openBracePos.row == row) return 0;
171
172 var indent = this.$getIndent(doc.getLine(openBracePos.row));
173 doc.replace(new Range(row, 0, row, column-1), indent);
174 };
175
176 this.$getIndent = function(line) {
177 return line.match(/^\s*/)[0];
178 };
179
180 }).call(MatchingBraceOutdent.prototype);
181
182 exports.MatchingBraceOutdent = MatchingBraceOutdent;
183 });
+0
-431
try/ace/mode-ruby.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/ruby', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ruby_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/folding/coffee'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
37 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38 var Range = require("../range").Range;
39 var FoldMode = require("./folding/coffee").FoldMode;
40
41 var Mode = function() {
42 this.$tokenizer = new Tokenizer(new RubyHighlightRules().getRules());
43 this.$outdent = new MatchingBraceOutdent();
44 this.foldingRules = new FoldMode();
45 };
46 oop.inherits(Mode, TextMode);
47
48 (function() {
49
50
51 this.lineCommentStart = "#";
52
53 this.getNextLineIndent = function(state, line, tab) {
54 var indent = this.$getIndent(line);
55
56 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
57 var tokens = tokenizedLine.tokens;
58
59 if (tokens.length && tokens[tokens.length-1].type == "comment") {
60 return indent;
61 }
62
63 if (state == "start") {
64 var match = line.match(/^.*[\{\(\[]\s*$/);
65 var startingClassOrMethod = line.match(/^\s*(class|def)\s.*$/);
66 var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
67 var startingConditional = line.match(/^\s*(if|else)\s*/)
68 if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
69 indent += tab;
70 }
71 }
72
73 return indent;
74 };
75
76 this.checkOutdent = function(state, line, input) {
77 return /^\s+end$/.test(line + input) || /^\s+}$/.test(line + input) || /^\s+else$/.test(line + input);
78 };
79
80 this.autoOutdent = function(state, doc, row) {
81 var indent = this.$getIndent(doc.getLine(row));
82 var tab = doc.getTabString();
83 if (indent.slice(-tab.length) == tab)
84 doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
85 };
86
87 }).call(Mode.prototype);
88
89 exports.Mode = Mode;
90 });
91
92 define('ace/mode/ruby_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
93
94
95 var oop = require("../lib/oop");
96 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
97 var constantOtherSymbol = exports.constantOtherSymbol = {
98 token : "constant.other.symbol.ruby", // symbol
99 regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
100 };
101
102 var qString = exports.qString = {
103 token : "string", // single line
104 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
105 };
106
107 var qqString = exports.qqString = {
108 token : "string", // single line
109 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
110 };
111
112 var tString = exports.tString = {
113 token : "string", // backtick string
114 regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
115 };
116
117 var constantNumericHex = exports.constantNumericHex = {
118 token : "constant.numeric", // hex
119 regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
120 };
121
122 var constantNumericFloat = exports.constantNumericFloat = {
123 token : "constant.numeric", // float
124 regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
125 };
126
127 var RubyHighlightRules = function() {
128
129 var builtinFunctions = (
130 "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
131 "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
132 "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
133 "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
134 "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
135 "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
136 "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
137 "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
138 "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
139 "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
140 "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
141 "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
142 "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
143 "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
144 "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
145 "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
146 "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
147 "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
148 "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
149 "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
150 "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
151 "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
152 "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
153 "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
154 "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
155 "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
156 "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
157 "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
158 "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
159 "has_many|has_one|belongs_to|has_and_belongs_to_many"
160 );
161
162 var keywords = (
163 "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
164 "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
165 "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
166 );
167
168 var buildinConstants = (
169 "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
170 "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
171 );
172
173 var builtinVariables = (
174 "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
175 "$!|root_url|flash|session|cookies|params|request|response|logger|self"
176 );
177
178 var keywordMapper = this.$keywords = this.createKeywordMapper({
179 "keyword": keywords,
180 "constant.language": buildinConstants,
181 "variable.language": builtinVariables,
182 "support.function": builtinFunctions,
183 "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
184 }, "identifier");
185
186 this.$rules = {
187 "start" : [
188 {
189 token : "comment",
190 regex : "#.*$"
191 }, {
192 token : "comment", // multi line comment
193 regex : "^=begin(?:$|\\s.*$)",
194 next : "comment"
195 }, {
196 token : "string.regexp",
197 regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
198 },
199
200 qString,
201 qqString,
202 tString,
203
204 {
205 token : "text", // namespaces aren't symbols
206 regex : "::"
207 }, {
208 token : "variable.instance", // instance variable
209 regex : "@{1,2}[a-zA-Z_\\d]+"
210 }, {
211 token : "support.class", // class name
212 regex : "[A-Z][a-zA-Z_\\d]+"
213 },
214
215 constantOtherSymbol,
216 constantNumericHex,
217 constantNumericFloat,
218
219 {
220 token : "constant.language.boolean",
221 regex : "(?:true|false)\\b"
222 }, {
223 token : keywordMapper,
224 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
225 }, {
226 token : "punctuation.separator.key-value",
227 regex : "=>"
228 }, {
229 stateName: "heredoc",
230 onMatch : function(value, currentState, stack) {
231 var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
232 var tokens = value.split(this.splitRegex);
233 stack.push(next, tokens[3]);
234 return [
235 {type:"constant", value: tokens[1]},
236 {type:"string", value: tokens[2]},
237 {type:"support.class", value: tokens[3]},
238 {type:"string", value: tokens[4]}
239 ];
240 },
241 regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
242 rules: {
243 heredoc: [{
244 onMatch: function(value, currentState, stack) {
245 if (value == stack[1]) {
246 stack.shift();
247 stack.shift();
248 return "support.class";
249 }
250 return "string";
251 },
252 regex: ".*$",
253 next: "start"
254 }],
255 indentedHeredoc: [{
256 token: "string",
257 regex: "^ +"
258 }, {
259 onMatch: function(value, currentState, stack) {
260 if (value == stack[1]) {
261 stack.shift();
262 stack.shift();
263 return "support.class";
264 }
265 return "string";
266 },
267 regex: ".*$",
268 next: "start"
269 }]
270 }
271 }, {
272 token : "keyword.operator",
273 regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
274 }, {
275 token : "paren.lparen",
276 regex : "[[({]"
277 }, {
278 token : "paren.rparen",
279 regex : "[\\])}]"
280 }, {
281 token : "text",
282 regex : "\\s+"
283 }
284 ],
285 "comment" : [
286 {
287 token : "comment", // closing comment
288 regex : "^=end(?:$|\\s.*$)",
289 next : "start"
290 }, {
291 token : "comment", // comment spanning whole line
292 regex : ".+"
293 }
294 ]
295 };
296
297 this.normalizeRules();
298 };
299
300 oop.inherits(RubyHighlightRules, TextHighlightRules);
301
302 exports.RubyHighlightRules = RubyHighlightRules;
303 });
304
305 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
306
307
308 var Range = require("../range").Range;
309
310 var MatchingBraceOutdent = function() {};
311
312 (function() {
313
314 this.checkOutdent = function(line, input) {
315 if (! /^\s+$/.test(line))
316 return false;
317
318 return /^\s*\}/.test(input);
319 };
320
321 this.autoOutdent = function(doc, row) {
322 var line = doc.getLine(row);
323 var match = line.match(/^(\s*\})/);
324
325 if (!match) return 0;
326
327 var column = match[1].length;
328 var openBracePos = doc.findMatchingBracket({row: row, column: column});
329
330 if (!openBracePos || openBracePos.row == row) return 0;
331
332 var indent = this.$getIndent(doc.getLine(openBracePos.row));
333 doc.replace(new Range(row, 0, row, column-1), indent);
334 };
335
336 this.$getIndent = function(line) {
337 return line.match(/^\s*/)[0];
338 };
339
340 }).call(MatchingBraceOutdent.prototype);
341
342 exports.MatchingBraceOutdent = MatchingBraceOutdent;
343 });
344
345 define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
346
347
348 var oop = require("../../lib/oop");
349 var BaseFoldMode = require("./fold_mode").FoldMode;
350 var Range = require("../../range").Range;
351
352 var FoldMode = exports.FoldMode = function() {};
353 oop.inherits(FoldMode, BaseFoldMode);
354
355 (function() {
356
357 this.getFoldWidgetRange = function(session, foldStyle, row) {
358 var range = this.indentationBlock(session, row);
359 if (range)
360 return range;
361
362 var re = /\S/;
363 var line = session.getLine(row);
364 var startLevel = line.search(re);
365 if (startLevel == -1 || line[startLevel] != "#")
366 return;
367
368 var startColumn = line.length;
369 var maxRow = session.getLength();
370 var startRow = row;
371 var endRow = row;
372
373 while (++row < maxRow) {
374 line = session.getLine(row);
375 var level = line.search(re);
376
377 if (level == -1)
378 continue;
379
380 if (line[level] != "#")
381 break;
382
383 endRow = row;
384 }
385
386 if (endRow > startRow) {
387 var endColumn = session.getLine(endRow).length;
388 return new Range(startRow, startColumn, endRow, endColumn);
389 }
390 };
391 this.getFoldWidget = function(session, foldStyle, row) {
392 var line = session.getLine(row);
393 var indent = line.search(/\S/);
394 var next = session.getLine(row + 1);
395 var prev = session.getLine(row - 1);
396 var prevIndent = prev.search(/\S/);
397 var nextIndent = next.search(/\S/);
398
399 if (indent == -1) {
400 session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
401 return "";
402 }
403 if (prevIndent == -1) {
404 if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
405 session.foldWidgets[row - 1] = "";
406 session.foldWidgets[row + 1] = "";
407 return "start";
408 }
409 } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
410 if (session.getLine(row - 2).search(/\S/) == -1) {
411 session.foldWidgets[row - 1] = "start";
412 session.foldWidgets[row + 1] = "";
413 return "";
414 }
415 }
416
417 if (prevIndent!= -1 && prevIndent < indent)
418 session.foldWidgets[row - 1] = "start";
419 else
420 session.foldWidgets[row - 1] = "";
421
422 if (indent < nextIndent)
423 return "start";
424 else
425 return "";
426 };
427
428 }).call(FoldMode.prototype);
429
430 });
+0
-204
try/ace/mode-rust.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * Contributor(s):
30 *
31 *
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35 define('ace/mode/rust', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/rust_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
36
37
38 var oop = require("../lib/oop");
39 var TextMode = require("./text").Mode;
40 var Tokenizer = require("../tokenizer").Tokenizer;
41 var RustHighlightRules = require("./rust_highlight_rules").RustHighlightRules;
42 var FoldMode = require("./folding/cstyle").FoldMode;
43
44 var Mode = function() {
45 var highlighter = new RustHighlightRules();
46 this.foldingRules = new FoldMode();
47 this.$tokenizer = new Tokenizer(highlighter.getRules());
48 };
49 oop.inherits(Mode, TextMode);
50
51 (function() {
52 this.lineCommentStart = "/\\*";
53 this.blockComment = {start: "/*", end: "*/"};
54 }).call(Mode.prototype);
55
56 exports.Mode = Mode;
57 });
58
59 define('ace/mode/rust_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
60
61
62 var oop = require("../lib/oop");
63 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
64
65 var RustHighlightRules = function() {
66
67 this.$rules = { start:
68 [ { token: 'variable.other.source.rust',
69 regex: '\'[a-zA-Z_][a-zA-Z0-9_]*[^\\\']' },
70 { token: 'string.quoted.single.source.rust',
71 regex: '\'',
72 push:
73 [ { token: 'string.quoted.single.source.rust',
74 regex: '\'',
75 next: 'pop' },
76 { include: '#rust_escaped_character' },
77 { defaultToken: 'string.quoted.single.source.rust' } ] },
78 { token: 'string.quoted.double.source.rust',
79 regex: '"',
80 push:
81 [ { token: 'string.quoted.double.source.rust',
82 regex: '"',
83 next: 'pop' },
84 { include: '#rust_escaped_character' },
85 { defaultToken: 'string.quoted.double.source.rust' } ] },
86 { token: [ 'keyword.source.rust', 'meta.function.source.rust',
87 'entity.name.function.source.rust', 'meta.function.source.rust' ],
88 regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_][\\w\\:,+ \\\'<>]*)(\\s*\\()' },
89 { token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' },
90 { token: 'keyword.source.rust',
91 regex: '\\b(?:as|assert|break|claim|const|copy|Copy|do|drop|else|extern|fail|for|if|impl|in|let|log|loop|match|mod|module|move|mut|Owned|priv|pub|pure|ref|return|unchecked|unsafe|use|while|mod|Send|static|trait|class|struct|enum|type)\\b' },
92 { token: 'storage.type.source.rust',
93 regex: '\\b(?:Self|m32|m64|m128|f80|f16|f128|int|uint|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b' },
94 { token: 'variable.language.source.rust', regex: '\\bself\\b' },
95 { token: 'keyword.operator',
96 regex: '!|\\$|\\*|\\-\\-|\\-|\\+\\+|\\+|-->|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|,|;' },
97 { token: 'constant.language.source.rust',
98 regex: '\\b(?:true|false|Some|None|Left|Right|Ok|Err)\\b' },
99 { token: 'support.constant.source.rust',
100 regex: '\\b(?:EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\b' },
101 { token: 'meta.preprocessor.source.rust',
102 regex: '\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b' },
103 { token: 'constant.numeric.integer.source.rust',
104 regex: '\\b(?:[0-9][0-9_]*|[0-9][0-9_]*(?:u|u8|u16|u32|u64)|[0-9][0-9_]*(?:i|i8|i16|i32|i64))\\b' },
105 { token: 'constant.numeric.hex.source.rust',
106 regex: '\\b(?:0x[a-fA-F0-9_]+|0x[a-fA-F0-9_]+(?:u|u8|u16|u32|u64)|0x[a-fA-F0-9_]+(?:i|i8|i16|i32|i64))\\b' },
107 { token: 'constant.numeric.binary.source.rust',
108 regex: '\\b(?:0b[01_]+|0b[01_]+(?:u|u8|u16|u32|u64)|0b[01_]+(?:i|i8|i16|i32|i64))\\b' },
109 { token: 'constant.numeric.float.source.rust',
110 regex: '[0-9][0-9_]*(?:f32|f64|f)|[0-9][0-9_]*[eE][+-]=[0-9_]+|[0-9][0-9_]*[eE][+-]=[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+|[0-9][0-9_]*\\.[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+(?:f32|f64|f)' },
111 { token: 'comment.line.documentation.source.rust',
112 regex: '//!.*$',
113 push_:
114 [ { token: 'comment.line.documentation.source.rust',
115 regex: '$',
116 next: 'pop' },
117 { defaultToken: 'comment.line.documentation.source.rust' } ] },
118 { token: 'comment.line.double-dash.source.rust',
119 regex: '//.*$',
120 push_:
121 [ { token: 'comment.line.double-dash.source.rust',
122 regex: '$',
123 next: 'pop' },
124 { defaultToken: 'comment.line.double-dash.source.rust' } ] },
125 { token: 'comment.block.source.rust',
126 regex: '/\\*',
127 push:
128 [ { token: 'comment.block.source.rust',
129 regex: '\\*/',
130 next: 'pop' },
131 { defaultToken: 'comment.block.source.rust' } ] } ],
132 '#rust_escaped_character':
133 [ { token: 'constant.character.escape.source.rust',
134 regex: '\\\\(?:x[\\da-fA-F]{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)' } ] }
135
136 this.normalizeRules();
137 };
138
139 RustHighlightRules.metaData = { fileTypes: [ 'rs', 'rc' ],
140 foldingStartMarker: '^.*\\bfn\\s*(\\w+\\s*)?\\([^\\)]*\\)(\\s*\\{[^\\}]*)?\\s*$',
141 foldingStopMarker: '^\\s*\\}',
142 name: 'Rust',
143 scopeName: 'source.rust' }
144
145
146 oop.inherits(RustHighlightRules, TextHighlightRules);
147
148 exports.RustHighlightRules = RustHighlightRules;
149 });
150
151 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
152
153
154 var oop = require("../../lib/oop");
155 var Range = require("../../range").Range;
156 var BaseFoldMode = require("./fold_mode").FoldMode;
157
158 var FoldMode = exports.FoldMode = function(commentRegex) {
159 if (commentRegex) {
160 this.foldingStartMarker = new RegExp(
161 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
162 );
163 this.foldingStopMarker = new RegExp(
164 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
165 );
166 }
167 };
168 oop.inherits(FoldMode, BaseFoldMode);
169
170 (function() {
171
172 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
173 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
174
175 this.getFoldWidgetRange = function(session, foldStyle, row) {
176 var line = session.getLine(row);
177 var match = line.match(this.foldingStartMarker);
178 if (match) {
179 var i = match.index;
180
181 if (match[1])
182 return this.openingBracketBlock(session, match[1], row, i);
183
184 return session.getCommentFoldRange(row, i + match[0].length, 1);
185 }
186
187 if (foldStyle !== "markbeginend")
188 return;
189
190 var match = line.match(this.foldingStopMarker);
191 if (match) {
192 var i = match.index + match[0].length;
193
194 if (match[1])
195 return this.closingBracketBlock(session, match[1], row, i);
196
197 return session.getCommentFoldRange(row, i, -1);
198 }
199 };
200
201 }).call(FoldMode.prototype);
202
203 });
+0
-442
try/ace/mode-sass.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/sass', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/sass_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var SassHighlightRules = require("./sass_highlight_rules").SassHighlightRules;
37 var FoldMode = require("./folding/coffee").FoldMode;
38
39 var Mode = function() {
40 this.$tokenizer = new Tokenizer(new SassHighlightRules().getRules());
41 this.foldingRules = new FoldMode();
42 };
43 oop.inherits(Mode, TextMode);
44
45 (function() {
46 this.lineCommentStart = "//";
47 }).call(Mode.prototype);
48
49 exports.Mode = Mode;
50
51 });
52
53 define('ace/mode/sass_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/scss_highlight_rules'], function(require, exports, module) {
54
55
56 var oop = require("../lib/oop");
57 var lang = require("../lib/lang");
58 var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
59
60 var SassHighlightRules = function() {
61 ScssHighlightRules.call(this);
62 var start = this.$rules.start;
63 if (start[1].token == "comment") {
64 start.splice(1, 1, {
65 onMatch: function(value, currentState, stack) {
66 stack.unshift(this.next, -1, value.length - 2, currentState);
67 return "comment";
68 },
69 regex: /^\s*\/\*/,
70 next: "comment"
71 }, {
72 token: "error.invalid",
73 regex: "/\\*|[{;}]"
74 }, {
75 token: "support.type",
76 regex: /^\s*:[\w\-]+\s/
77 });
78
79 this.$rules.comment = [
80 {regex: /^\s*/, onMatch: function(value, currentState, stack) {
81 if (stack[1] === -1)
82 stack[1] = Math.max(stack[2], value.length - 1);
83 if (value.length <= stack[1]) {stack.shift();stack.shift();stack.shift();
84 this.next = stack.shift();
85 return "text";
86 } else {
87 this.next = "";
88 return "comment";
89 }
90 }, next: "start"},
91 {defaultToken: "comment"}
92 ]
93 }
94 };
95
96 oop.inherits(SassHighlightRules, ScssHighlightRules);
97
98 exports.SassHighlightRules = SassHighlightRules;
99
100 });
101
102 define('ace/mode/scss_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
103
104
105 var oop = require("../lib/oop");
106 var lang = require("../lib/lang");
107 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
108
109 var ScssHighlightRules = function() {
110
111 var properties = lang.arrayToMap( (function () {
112
113 var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
114
115 var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
116 "background-size|binding|border-bottom-colors|border-left-colors|" +
117 "border-right-colors|border-top-colors|border-end|border-end-color|" +
118 "border-end-style|border-end-width|border-image|border-start|" +
119 "border-start-color|border-start-style|border-start-width|box-align|" +
120 "box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
121 "box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
122 "column-rule-width|column-rule-style|column-rule-color|float-edge|" +
123 "font-feature-settings|font-language-override|force-broken-image-icon|" +
124 "image-region|margin-end|margin-start|opacity|outline|outline-color|" +
125 "outline-offset|outline-radius|outline-radius-bottomleft|" +
126 "outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
127 "outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
128 "tab-size|text-blink|text-decoration-color|text-decoration-line|" +
129 "text-decoration-style|transform|transform-origin|transition|" +
130 "transition-delay|transition-duration|transition-property|" +
131 "transition-timing-function|user-focus|user-input|user-modify|user-select|" +
132 "window-shadow|border-radius").split("|");
133
134 var properties = ("azimuth|background-attachment|background-color|background-image|" +
135 "background-position|background-repeat|background|border-bottom-color|" +
136 "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
137 "border-color|border-left-color|border-left-style|border-left-width|" +
138 "border-left|border-right-color|border-right-style|border-right-width|" +
139 "border-right|border-spacing|border-style|border-top-color|" +
140 "border-top-style|border-top-width|border-top|border-width|border|bottom|" +
141 "box-shadow|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
142 "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
143 "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
144 "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
145 "letter-spacing|line-height|list-style-image|list-style-position|" +
146 "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
147 "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
148 "min-width|opacity|orphans|outline-color|" +
149 "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
150 "padding-left|padding-right|padding-top|padding|page-break-after|" +
151 "page-break-before|page-break-inside|page|pause-after|pause-before|" +
152 "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
153 "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
154 "stress|table-layout|text-align|text-decoration|text-indent|" +
155 "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
156 "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
157 "z-index").split("|");
158 var ret = [];
159 for (var i=0, ln=browserPrefix.length; i<ln; i++) {
160 Array.prototype.push.apply(
161 ret,
162 (( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
163 );
164 }
165 Array.prototype.push.apply(ret, prefixProperties);
166 Array.prototype.push.apply(ret, properties);
167
168 return ret;
169
170 })() );
171
172
173
174 var functions = lang.arrayToMap(
175 ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" +
176 "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" +
177 "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" +
178 "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" +
179 "scale_color|transparentize|type_of|unit|unitless|unqoute").split("|")
180 );
181
182 var constants = lang.arrayToMap(
183 ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
184 "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
185 "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
186 "decimal-leading-zero|decimal|default|disabled|disc|" +
187 "distribute-all-lines|distribute-letter|distribute-space|" +
188 "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
189 "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
190 "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
191 "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
192 "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
193 "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
194 "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
195 "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
196 "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
197 "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
198 "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
199 "solid|square|static|strict|super|sw-resize|table-footer-group|" +
200 "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
201 "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
202 "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
203 "zero").split("|")
204 );
205
206 var colors = lang.arrayToMap(
207 ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
208 "purple|red|silver|teal|white|yellow").split("|")
209 );
210
211 var keywords = lang.arrayToMap(
212 ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")
213 )
214
215 var tags = lang.arrayToMap(
216 ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
217 "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
218 "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
219 "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
220 "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
221 "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
222 "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
223 "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
224 "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
225 );
226
227 var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
228
229 this.$rules = {
230 "start" : [
231 {
232 token : "comment",
233 regex : "\\/\\/.*$"
234 },
235 {
236 token : "comment", // multi line comment
237 regex : "\\/\\*",
238 next : "comment"
239 }, {
240 token : "string", // single line
241 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
242 }, {
243 token : "string", // multi line string start
244 regex : '["].*\\\\$',
245 next : "qqstring"
246 }, {
247 token : "string", // single line
248 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
249 }, {
250 token : "string", // multi line string start
251 regex : "['].*\\\\$",
252 next : "qstring"
253 }, {
254 token : "constant.numeric",
255 regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
256 }, {
257 token : "constant.numeric", // hex6 color
258 regex : "#[a-f0-9]{6}"
259 }, {
260 token : "constant.numeric", // hex3 color
261 regex : "#[a-f0-9]{3}"
262 }, {
263 token : "constant.numeric",
264 regex : numRe
265 }, {
266 token : ["support.function", "string", "support.function"],
267 regex : "(url\\()(.*)(\\))"
268 }, {
269 token : function(value) {
270 if (properties.hasOwnProperty(value.toLowerCase()))
271 return "support.type";
272 if (keywords.hasOwnProperty(value))
273 return "keyword";
274 else if (constants.hasOwnProperty(value))
275 return "constant.language";
276 else if (functions.hasOwnProperty(value))
277 return "support.function";
278 else if (colors.hasOwnProperty(value.toLowerCase()))
279 return "support.constant.color";
280 else if (tags.hasOwnProperty(value.toLowerCase()))
281 return "variable.language";
282 else
283 return "text";
284 },
285 regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
286 }, {
287 token : "variable",
288 regex : "[a-z_\\-$][a-z0-9_\\-$]*\\b"
289 }, {
290 token: "variable.language",
291 regex: "#[a-z0-9-_]+"
292 }, {
293 token: "variable.language",
294 regex: "\\.[a-z0-9-_]+"
295 }, {
296 token: "variable.language",
297 regex: ":[a-z0-9-_]+"
298 }, {
299 token: "constant",
300 regex: "[a-z0-9-_]+"
301 }, {
302 token : "keyword.operator",
303 regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
304 }, {
305 token : "paren.lparen",
306 regex : "[[({]"
307 }, {
308 token : "paren.rparen",
309 regex : "[\\])}]"
310 }, {
311 token : "text",
312 regex : "\\s+"
313 }, {
314 caseInsensitive: true
315 }
316 ],
317 "comment" : [
318 {
319 token : "comment", // closing comment
320 regex : ".*?\\*\\/",
321 next : "start"
322 }, {
323 token : "comment", // comment spanning whole line
324 regex : ".+"
325 }
326 ],
327 "qqstring" : [
328 {
329 token : "string",
330 regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
331 next : "start"
332 }, {
333 token : "string",
334 regex : '.+'
335 }
336 ],
337 "qstring" : [
338 {
339 token : "string",
340 regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
341 next : "start"
342 }, {
343 token : "string",
344 regex : '.+'
345 }
346 ]
347 };
348 };
349
350 oop.inherits(ScssHighlightRules, TextHighlightRules);
351
352 exports.ScssHighlightRules = ScssHighlightRules;
353
354 });
355
356 define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
357
358
359 var oop = require("../../lib/oop");
360 var BaseFoldMode = require("./fold_mode").FoldMode;
361 var Range = require("../../range").Range;
362
363 var FoldMode = exports.FoldMode = function() {};
364 oop.inherits(FoldMode, BaseFoldMode);
365
366 (function() {
367
368 this.getFoldWidgetRange = function(session, foldStyle, row) {
369 var range = this.indentationBlock(session, row);
370 if (range)
371 return range;
372
373 var re = /\S/;
374 var line = session.getLine(row);
375 var startLevel = line.search(re);
376 if (startLevel == -1 || line[startLevel] != "#")
377 return;
378
379 var startColumn = line.length;
380 var maxRow = session.getLength();
381 var startRow = row;
382 var endRow = row;
383
384 while (++row < maxRow) {
385 line = session.getLine(row);
386 var level = line.search(re);
387
388 if (level == -1)
389 continue;
390
391 if (line[level] != "#")
392 break;
393
394 endRow = row;
395 }
396
397 if (endRow > startRow) {
398 var endColumn = session.getLine(endRow).length;
399 return new Range(startRow, startColumn, endRow, endColumn);
400 }
401 };
402 this.getFoldWidget = function(session, foldStyle, row) {
403 var line = session.getLine(row);
404 var indent = line.search(/\S/);
405 var next = session.getLine(row + 1);
406 var prev = session.getLine(row - 1);
407 var prevIndent = prev.search(/\S/);
408 var nextIndent = next.search(/\S/);
409
410 if (indent == -1) {
411 session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
412 return "";
413 }
414 if (prevIndent == -1) {
415 if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
416 session.foldWidgets[row - 1] = "";
417 session.foldWidgets[row + 1] = "";
418 return "start";
419 }
420 } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
421 if (session.getLine(row - 2).search(/\S/) == -1) {
422 session.foldWidgets[row - 1] = "start";
423 session.foldWidgets[row + 1] = "";
424 return "";
425 }
426 }
427
428 if (prevIndent!= -1 && prevIndent < indent)
429 session.foldWidgets[row - 1] = "start";
430 else
431 session.foldWidgets[row - 1] = "";
432
433 if (indent < nextIndent)
434 return "start";
435 else
436 return "";
437 };
438
439 }).call(FoldMode.prototype);
440
441 });
+0
-670
try/ace/mode-scad.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/scad', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/scad_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var scadHighlightRules = require("./scad_highlight_rules").scadHighlightRules;
37 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38 var Range = require("../range").Range;
39 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
40 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
41
42 var Mode = function() {
43 this.$tokenizer = new Tokenizer(new scadHighlightRules().getRules());
44 this.$outdent = new MatchingBraceOutdent();
45 this.$behaviour = new CstyleBehaviour();
46 this.foldingRules = new CStyleFoldMode();
47 };
48 oop.inherits(Mode, TextMode);
49
50 (function() {
51
52 this.lineCommentStart = "//";
53 this.blockComment = {start: "/*", end: "*/"};
54
55 this.getNextLineIndent = function(state, line, tab) {
56 var indent = this.$getIndent(line);
57
58 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
59 var tokens = tokenizedLine.tokens;
60 var endState = tokenizedLine.state;
61
62 if (tokens.length && tokens[tokens.length-1].type == "comment") {
63 return indent;
64 }
65
66 if (state == "start") {
67 var match = line.match(/^.*[\{\(\[]\s*$/);
68 if (match) {
69 indent += tab;
70 }
71 } else if (state == "doc-start") {
72 if (endState == "start") {
73 return "";
74 }
75 var match = line.match(/^\s*(\/?)\*/);
76 if (match) {
77 if (match[1]) {
78 indent += " ";
79 }
80 indent += "* ";
81 }
82 }
83
84 return indent;
85 };
86
87 this.checkOutdent = function(state, line, input) {
88 return this.$outdent.checkOutdent(line, input);
89 };
90
91 this.autoOutdent = function(state, doc, row) {
92 this.$outdent.autoOutdent(doc, row);
93 };
94
95 }).call(Mode.prototype);
96
97 exports.Mode = Mode;
98 });
99
100 define('ace/mode/scad_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
101
102
103 var oop = require("../lib/oop");
104 var lang = require("../lib/lang");
105 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
106 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
107
108 var scadHighlightRules = function() {
109 var keywordMapper = this.createKeywordMapper({
110 "variable.language": "this",
111 "keyword": "module|if|else|for",
112 "constant.language": "NULL"
113 }, "identifier");
114
115 this.$rules = {
116 "start" : [
117 {
118 token : "comment",
119 regex : "\\/\\/.*$"
120 },
121 DocCommentHighlightRules.getStartRule("start"),
122 {
123 token : "comment", // multi line comment
124 regex : "\\/\\*",
125 next : "comment"
126 }, {
127 token : "string", // single line
128 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
129 }, {
130 token : "string", // multi line string start
131 regex : '["].*\\\\$',
132 next : "qqstring"
133 }, {
134 token : "string", // single line
135 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
136 }, {
137 token : "string", // multi line string start
138 regex : "['].*\\\\$",
139 next : "qstring"
140 }, {
141 token : "constant.numeric", // hex
142 regex : "0[xX][0-9a-fA-F]+\\b"
143 }, {
144 token : "constant.numeric", // float
145 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
146 }, {
147 token : "constant", // <CONSTANT>
148 regex : "<[a-zA-Z0-9.]+>"
149 }, {
150 token : "keyword", // pre-compiler directivs
151 regex : "(?:use|include)"
152 }, {
153 token : keywordMapper,
154 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
155 }, {
156 token : "keyword.operator",
157 regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
158 }, {
159 token : "paren.lparen",
160 regex : "[[({]"
161 }, {
162 token : "paren.rparen",
163 regex : "[\\])}]"
164 }, {
165 token : "text",
166 regex : "\\s+"
167 }
168 ],
169 "comment" : [
170 {
171 token : "comment", // closing comment
172 regex : ".*?\\*\\/",
173 next : "start"
174 }, {
175 token : "comment", // comment spanning whole line
176 regex : ".+"
177 }
178 ],
179 "qqstring" : [
180 {
181 token : "string",
182 regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
183 next : "start"
184 }, {
185 token : "string",
186 regex : '.+'
187 }
188 ],
189 "qstring" : [
190 {
191 token : "string",
192 regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
193 next : "start"
194 }, {
195 token : "string",
196 regex : '.+'
197 }
198 ]
199 };
200
201 this.embedRules(DocCommentHighlightRules, "doc-",
202 [ DocCommentHighlightRules.getEndRule("start") ]);
203 };
204
205 oop.inherits(scadHighlightRules, TextHighlightRules);
206
207 exports.scadHighlightRules = scadHighlightRules;
208 });
209
210 define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
211
212
213 var oop = require("../lib/oop");
214 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
215
216 var DocCommentHighlightRules = function() {
217
218 this.$rules = {
219 "start" : [ {
220 token : "comment.doc.tag",
221 regex : "@[\\w\\d_]+" // TODO: fix email addresses
222 }, {
223 token : "comment.doc.tag",
224 regex : "\\bTODO\\b"
225 }, {
226 defaultToken : "comment.doc"
227 }]
228 };
229 };
230
231 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
232
233 DocCommentHighlightRules.getStartRule = function(start) {
234 return {
235 token : "comment.doc", // doc comment
236 regex : "\\/\\*(?=\\*)",
237 next : start
238 };
239 };
240
241 DocCommentHighlightRules.getEndRule = function (start) {
242 return {
243 token : "comment.doc", // closing comment
244 regex : "\\*\\/",
245 next : start
246 };
247 };
248
249
250 exports.DocCommentHighlightRules = DocCommentHighlightRules;
251
252 });
253
254 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
255
256
257 var Range = require("../range").Range;
258
259 var MatchingBraceOutdent = function() {};
260
261 (function() {
262
263 this.checkOutdent = function(line, input) {
264 if (! /^\s+$/.test(line))
265 return false;
266
267 return /^\s*\}/.test(input);
268 };
269
270 this.autoOutdent = function(doc, row) {
271 var line = doc.getLine(row);
272 var match = line.match(/^(\s*\})/);
273
274 if (!match) return 0;
275
276 var column = match[1].length;
277 var openBracePos = doc.findMatchingBracket({row: row, column: column});
278
279 if (!openBracePos || openBracePos.row == row) return 0;
280
281 var indent = this.$getIndent(doc.getLine(openBracePos.row));
282 doc.replace(new Range(row, 0, row, column-1), indent);
283 };
284
285 this.$getIndent = function(line) {
286 return line.match(/^\s*/)[0];
287 };
288
289 }).call(MatchingBraceOutdent.prototype);
290
291 exports.MatchingBraceOutdent = MatchingBraceOutdent;
292 });
293
294 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
295
296
297 var oop = require("../../lib/oop");
298 var Behaviour = require("../behaviour").Behaviour;
299 var TokenIterator = require("../../token_iterator").TokenIterator;
300 var lang = require("../../lib/lang");
301
302 var SAFE_INSERT_IN_TOKENS =
303 ["text", "paren.rparen", "punctuation.operator"];
304 var SAFE_INSERT_BEFORE_TOKENS =
305 ["text", "paren.rparen", "punctuation.operator", "comment"];
306
307
308 var autoInsertedBrackets = 0;
309 var autoInsertedRow = -1;
310 var autoInsertedLineEnd = "";
311 var maybeInsertedBrackets = 0;
312 var maybeInsertedRow = -1;
313 var maybeInsertedLineStart = "";
314 var maybeInsertedLineEnd = "";
315
316 var CstyleBehaviour = function () {
317
318 CstyleBehaviour.isSaneInsertion = function(editor, session) {
319 var cursor = editor.getCursorPosition();
320 var iterator = new TokenIterator(session, cursor.row, cursor.column);
321 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
322 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
323 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
324 return false;
325 }
326 iterator.stepForward();
327 return iterator.getCurrentTokenRow() !== cursor.row ||
328 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
329 };
330
331 CstyleBehaviour.$matchTokenType = function(token, types) {
332 return types.indexOf(token.type || token) > -1;
333 };
334
335 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
336 var cursor = editor.getCursorPosition();
337 var line = session.doc.getLine(cursor.row);
338 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
339 autoInsertedBrackets = 0;
340 autoInsertedRow = cursor.row;
341 autoInsertedLineEnd = bracket + line.substr(cursor.column);
342 autoInsertedBrackets++;
343 };
344
345 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
346 var cursor = editor.getCursorPosition();
347 var line = session.doc.getLine(cursor.row);
348 if (!this.isMaybeInsertedClosing(cursor, line))
349 maybeInsertedBrackets = 0;
350 maybeInsertedRow = cursor.row;
351 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
352 maybeInsertedLineEnd = line.substr(cursor.column);
353 maybeInsertedBrackets++;
354 };
355
356 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
357 return autoInsertedBrackets > 0 &&
358 cursor.row === autoInsertedRow &&
359 bracket === autoInsertedLineEnd[0] &&
360 line.substr(cursor.column) === autoInsertedLineEnd;
361 };
362
363 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
364 return maybeInsertedBrackets > 0 &&
365 cursor.row === maybeInsertedRow &&
366 line.substr(cursor.column) === maybeInsertedLineEnd &&
367 line.substr(0, cursor.column) == maybeInsertedLineStart;
368 };
369
370 CstyleBehaviour.popAutoInsertedClosing = function() {
371 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
372 autoInsertedBrackets--;
373 };
374
375 CstyleBehaviour.clearMaybeInsertedClosing = function() {
376 maybeInsertedBrackets = 0;
377 maybeInsertedRow = -1;
378 };
379
380 this.add("braces", "insertion", function (state, action, editor, session, text) {
381 var cursor = editor.getCursorPosition();
382 var line = session.doc.getLine(cursor.row);
383 if (text == '{') {
384 var selection = editor.getSelectionRange();
385 var selected = session.doc.getTextRange(selection);
386 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
387 return {
388 text: '{' + selected + '}',
389 selection: false
390 };
391 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
392 if (/[\]\}\)]/.test(line[cursor.column])) {
393 CstyleBehaviour.recordAutoInsert(editor, session, "}");
394 return {
395 text: '{}',
396 selection: [1, 1]
397 };
398 } else {
399 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
400 return {
401 text: '{',
402 selection: [1, 1]
403 };
404 }
405 }
406 } else if (text == '}') {
407 var rightChar = line.substring(cursor.column, cursor.column + 1);
408 if (rightChar == '}') {
409 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
410 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
411 CstyleBehaviour.popAutoInsertedClosing();
412 return {
413 text: '',
414 selection: [1, 1]
415 };
416 }
417 }
418 } else if (text == "\n" || text == "\r\n") {
419 var closing = "";
420 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
421 closing = lang.stringRepeat("}", maybeInsertedBrackets);
422 CstyleBehaviour.clearMaybeInsertedClosing();
423 }
424 var rightChar = line.substring(cursor.column, cursor.column + 1);
425 if (rightChar == '}' || closing !== "") {
426 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
427 if (!openBracePos)
428 return null;
429
430 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
431 var next_indent = this.$getIndent(line);
432
433 return {
434 text: '\n' + indent + '\n' + next_indent + closing,
435 selection: [1, indent.length, 1, indent.length]
436 };
437 }
438 }
439 });
440
441 this.add("braces", "deletion", function (state, action, editor, session, range) {
442 var selected = session.doc.getTextRange(range);
443 if (!range.isMultiLine() && selected == '{') {
444 var line = session.doc.getLine(range.start.row);
445 var rightChar = line.substring(range.end.column, range.end.column + 1);
446 if (rightChar == '}') {
447 range.end.column++;
448 return range;
449 } else {
450 maybeInsertedBrackets--;
451 }
452 }
453 });
454
455 this.add("parens", "insertion", function (state, action, editor, session, text) {
456 if (text == '(') {
457 var selection = editor.getSelectionRange();
458 var selected = session.doc.getTextRange(selection);
459 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
460 return {
461 text: '(' + selected + ')',
462 selection: false
463 };
464 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
465 CstyleBehaviour.recordAutoInsert(editor, session, ")");
466 return {
467 text: '()',
468 selection: [1, 1]
469 };
470 }
471 } else if (text == ')') {
472 var cursor = editor.getCursorPosition();
473 var line = session.doc.getLine(cursor.row);
474 var rightChar = line.substring(cursor.column, cursor.column + 1);
475 if (rightChar == ')') {
476 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
477 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
478 CstyleBehaviour.popAutoInsertedClosing();
479 return {
480 text: '',
481 selection: [1, 1]
482 };
483 }
484 }
485 }
486 });
487
488 this.add("parens", "deletion", function (state, action, editor, session, range) {
489 var selected = session.doc.getTextRange(range);
490 if (!range.isMultiLine() && selected == '(') {
491 var line = session.doc.getLine(range.start.row);
492 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
493 if (rightChar == ')') {
494 range.end.column++;
495 return range;
496 }
497 }
498 });
499
500 this.add("brackets", "insertion", function (state, action, editor, session, text) {
501 if (text == '[') {
502 var selection = editor.getSelectionRange();
503 var selected = session.doc.getTextRange(selection);
504 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
505 return {
506 text: '[' + selected + ']',
507 selection: false
508 };
509 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
510 CstyleBehaviour.recordAutoInsert(editor, session, "]");
511 return {
512 text: '[]',
513 selection: [1, 1]
514 };
515 }
516 } else if (text == ']') {
517 var cursor = editor.getCursorPosition();
518 var line = session.doc.getLine(cursor.row);
519 var rightChar = line.substring(cursor.column, cursor.column + 1);
520 if (rightChar == ']') {
521 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
522 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
523 CstyleBehaviour.popAutoInsertedClosing();
524 return {
525 text: '',
526 selection: [1, 1]
527 };
528 }
529 }
530 }
531 });
532
533 this.add("brackets", "deletion", function (state, action, editor, session, range) {
534 var selected = session.doc.getTextRange(range);
535 if (!range.isMultiLine() && selected == '[') {
536 var line = session.doc.getLine(range.start.row);
537 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
538 if (rightChar == ']') {
539 range.end.column++;
540 return range;
541 }
542 }
543 });
544
545 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
546 if (text == '"' || text == "'") {
547 var quote = text;
548 var selection = editor.getSelectionRange();
549 var selected = session.doc.getTextRange(selection);
550 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
551 return {
552 text: quote + selected + quote,
553 selection: false
554 };
555 } else {
556 var cursor = editor.getCursorPosition();
557 var line = session.doc.getLine(cursor.row);
558 var leftChar = line.substring(cursor.column-1, cursor.column);
559 if (leftChar == '\\') {
560 return null;
561 }
562 var tokens = session.getTokens(selection.start.row);
563 var col = 0, token;
564 var quotepos = -1; // Track whether we're inside an open quote.
565
566 for (var x = 0; x < tokens.length; x++) {
567 token = tokens[x];
568 if (token.type == "string") {
569 quotepos = -1;
570 } else if (quotepos < 0) {
571 quotepos = token.value.indexOf(quote);
572 }
573 if ((token.value.length + col) > selection.start.column) {
574 break;
575 }
576 col += tokens[x].value.length;
577 }
578 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
579 if (!CstyleBehaviour.isSaneInsertion(editor, session))
580 return;
581 return {
582 text: quote + quote,
583 selection: [1,1]
584 };
585 } else if (token && token.type === "string") {
586 var rightChar = line.substring(cursor.column, cursor.column + 1);
587 if (rightChar == quote) {
588 return {
589 text: '',
590 selection: [1, 1]
591 };
592 }
593 }
594 }
595 }
596 });
597
598 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
599 var selected = session.doc.getTextRange(range);
600 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
601 var line = session.doc.getLine(range.start.row);
602 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
603 if (rightChar == selected) {
604 range.end.column++;
605 return range;
606 }
607 }
608 });
609
610 };
611
612 oop.inherits(CstyleBehaviour, Behaviour);
613
614 exports.CstyleBehaviour = CstyleBehaviour;
615 });
616
617 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
618
619
620 var oop = require("../../lib/oop");
621 var Range = require("../../range").Range;
622 var BaseFoldMode = require("./fold_mode").FoldMode;
623
624 var FoldMode = exports.FoldMode = function(commentRegex) {
625 if (commentRegex) {
626 this.foldingStartMarker = new RegExp(
627 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
628 );
629 this.foldingStopMarker = new RegExp(
630 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
631 );
632 }
633 };
634 oop.inherits(FoldMode, BaseFoldMode);
635
636 (function() {
637
638 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
639 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
640
641 this.getFoldWidgetRange = function(session, foldStyle, row) {
642 var line = session.getLine(row);
643 var match = line.match(this.foldingStartMarker);
644 if (match) {
645 var i = match.index;
646
647 if (match[1])
648 return this.openingBracketBlock(session, match[1], row, i);
649
650 return session.getCommentFoldRange(row, i + match[0].length, 1);
651 }
652
653 if (foldStyle !== "markbeginend")
654 return;
655
656 var match = line.match(this.foldingStopMarker);
657 if (match) {
658 var i = match.index + match[0].length;
659
660 if (match[1])
661 return this.closingBracketBlock(session, match[1], row, i);
662
663 return session.getCommentFoldRange(row, i, -1);
664 }
665 };
666
667 }).call(FoldMode.prototype);
668
669 });
+0
-144
try/ace/mode-scheme.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2012, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * Contributor(s):
30 *
31 * NalaGinrut@gmail.com
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35 define('ace/mode/scheme', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/scheme_highlight_rules'], function(require, exports, module) {
36
37
38 var oop = require("../lib/oop");
39 var TextMode = require("./text").Mode;
40 var Tokenizer = require("../tokenizer").Tokenizer;
41 var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules;
42
43 var Mode = function() {
44 var highlighter = new SchemeHighlightRules();
45
46 this.$tokenizer = new Tokenizer(highlighter.getRules());
47 };
48 oop.inherits(Mode, TextMode);
49
50 (function() {
51
52 this.lineCommentStart = ";";
53
54 }).call(Mode.prototype);
55
56 exports.Mode = Mode;
57 });
58
59 define('ace/mode/scheme_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
60
61
62 var oop = require("../lib/oop");
63 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
64
65 var SchemeHighlightRules = function() {
66 var keywordControl = "case|do|let|loop|if|else|when";
67 var keywordOperator = "eq?|eqv?|equal?|and|or|not|null?";
68 var constantLanguage = "#t|#f";
69 var supportFunctions = "cons|car|cdr|cond|lambda|lambda*|syntax-rules|format|set!|quote|eval|append|list|list?|member?|load";
70
71 var keywordMapper = this.createKeywordMapper({
72 "keyword.control": keywordControl,
73 "keyword.operator": keywordOperator,
74 "constant.language": constantLanguage,
75 "support.function": supportFunctions
76 }, "identifier", true);
77
78 this.$rules =
79 {
80 "start": [
81 {
82 token : "comment",
83 regex : ";.*$"
84 },
85 {
86 "token": ["storage.type.function-type.scheme", "text", "entity.name.function.scheme"],
87 "regex": "(?:\\b(?:(define|define-syntax|define-macro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)"
88 },
89 {
90 "token": "punctuation.definition.constant.character.scheme",
91 "regex": "#:\\S+"
92 },
93 {
94 "token": ["punctuation.definition.variable.scheme", "variable.other.global.scheme", "punctuation.definition.variable.scheme"],
95 "regex": "(\\*)(\\S*)(\\*)"
96 },
97 {
98 "token" : "constant.numeric", // hex
99 "regex" : "#[xXoObB][0-9a-fA-F]+"
100 },
101 {
102 "token" : "constant.numeric", // float
103 "regex" : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?"
104 },
105 {
106 "token" : keywordMapper,
107 "regex" : "[a-zA-Z_#][a-zA-Z0-9_\\-\\?\\!\\*]*"
108 },
109 {
110 "token" : "string",
111 "regex" : '"(?=.)',
112 "next" : "qqstring"
113 }
114 ],
115 "qqstring": [
116 {
117 "token": "constant.character.escape.scheme",
118 "regex": "\\\\."
119 },
120 {
121 "token" : "string",
122 "regex" : '[^"\\\\]+',
123 "merge" : true
124 }, {
125 "token" : "string",
126 "regex" : "\\\\$",
127 "next" : "qqstring",
128 "merge" : true
129 }, {
130 "token" : "string",
131 "regex" : '"|$',
132 "next" : "start",
133 "merge" : true
134 }
135 ]
136 }
137
138 };
139
140 oop.inherits(SchemeHighlightRules, TextHighlightRules);
141
142 exports.SchemeHighlightRules = SchemeHighlightRules;
143 });
+0
-832
try/ace/mode-scss.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/scss', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/scss_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
37 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38 var CssBehaviour = require("./behaviour/css").CssBehaviour;
39 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
40
41 var Mode = function() {
42 this.$tokenizer = new Tokenizer(new ScssHighlightRules().getRules());
43 this.$outdent = new MatchingBraceOutdent();
44 this.$behaviour = new CssBehaviour();
45 this.foldingRules = new CStyleFoldMode();
46 };
47 oop.inherits(Mode, TextMode);
48
49 (function() {
50
51 this.lineCommentStart = "//";
52 this.blockComment = {start: "/*", end: "*/"};
53
54 this.getNextLineIndent = function(state, line, tab) {
55 var indent = this.$getIndent(line);
56 var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
57 if (tokens.length && tokens[tokens.length-1].type == "comment") {
58 return indent;
59 }
60
61 var match = line.match(/^.*\{\s*$/);
62 if (match) {
63 indent += tab;
64 }
65
66 return indent;
67 };
68
69 this.checkOutdent = function(state, line, input) {
70 return this.$outdent.checkOutdent(line, input);
71 };
72
73 this.autoOutdent = function(state, doc, row) {
74 this.$outdent.autoOutdent(doc, row);
75 };
76
77 }).call(Mode.prototype);
78
79 exports.Mode = Mode;
80
81 });
82
83 define('ace/mode/scss_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
84
85
86 var oop = require("../lib/oop");
87 var lang = require("../lib/lang");
88 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
89
90 var ScssHighlightRules = function() {
91
92 var properties = lang.arrayToMap( (function () {
93
94 var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
95
96 var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
97 "background-size|binding|border-bottom-colors|border-left-colors|" +
98 "border-right-colors|border-top-colors|border-end|border-end-color|" +
99 "border-end-style|border-end-width|border-image|border-start|" +
100 "border-start-color|border-start-style|border-start-width|box-align|" +
101 "box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
102 "box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
103 "column-rule-width|column-rule-style|column-rule-color|float-edge|" +
104 "font-feature-settings|font-language-override|force-broken-image-icon|" +
105 "image-region|margin-end|margin-start|opacity|outline|outline-color|" +
106 "outline-offset|outline-radius|outline-radius-bottomleft|" +
107 "outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
108 "outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
109 "tab-size|text-blink|text-decoration-color|text-decoration-line|" +
110 "text-decoration-style|transform|transform-origin|transition|" +
111 "transition-delay|transition-duration|transition-property|" +
112 "transition-timing-function|user-focus|user-input|user-modify|user-select|" +
113 "window-shadow|border-radius").split("|");
114
115 var properties = ("azimuth|background-attachment|background-color|background-image|" +
116 "background-position|background-repeat|background|border-bottom-color|" +
117 "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
118 "border-color|border-left-color|border-left-style|border-left-width|" +
119 "border-left|border-right-color|border-right-style|border-right-width|" +
120 "border-right|border-spacing|border-style|border-top-color|" +
121 "border-top-style|border-top-width|border-top|border-width|border|bottom|" +
122 "box-shadow|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
123 "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
124 "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
125 "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
126 "letter-spacing|line-height|list-style-image|list-style-position|" +
127 "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
128 "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
129 "min-width|opacity|orphans|outline-color|" +
130 "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
131 "padding-left|padding-right|padding-top|padding|page-break-after|" +
132 "page-break-before|page-break-inside|page|pause-after|pause-before|" +
133 "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
134 "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
135 "stress|table-layout|text-align|text-decoration|text-indent|" +
136 "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
137 "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
138 "z-index").split("|");
139 var ret = [];
140 for (var i=0, ln=browserPrefix.length; i<ln; i++) {
141 Array.prototype.push.apply(
142 ret,
143 (( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
144 );
145 }
146 Array.prototype.push.apply(ret, prefixProperties);
147 Array.prototype.push.apply(ret, properties);
148
149 return ret;
150
151 })() );
152
153
154
155 var functions = lang.arrayToMap(
156 ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" +
157 "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" +
158 "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" +
159 "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" +
160 "scale_color|transparentize|type_of|unit|unitless|unqoute").split("|")
161 );
162
163 var constants = lang.arrayToMap(
164 ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
165 "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
166 "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
167 "decimal-leading-zero|decimal|default|disabled|disc|" +
168 "distribute-all-lines|distribute-letter|distribute-space|" +
169 "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
170 "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
171 "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
172 "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
173 "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
174 "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
175 "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
176 "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
177 "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
178 "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
179 "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
180 "solid|square|static|strict|super|sw-resize|table-footer-group|" +
181 "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
182 "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
183 "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
184 "zero").split("|")
185 );
186
187 var colors = lang.arrayToMap(
188 ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
189 "purple|red|silver|teal|white|yellow").split("|")
190 );
191
192 var keywords = lang.arrayToMap(
193 ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")
194 )
195
196 var tags = lang.arrayToMap(
197 ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
198 "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
199 "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
200 "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
201 "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
202 "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
203 "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
204 "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
205 "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
206 );
207
208 var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
209
210 this.$rules = {
211 "start" : [
212 {
213 token : "comment",
214 regex : "\\/\\/.*$"
215 },
216 {
217 token : "comment", // multi line comment
218 regex : "\\/\\*",
219 next : "comment"
220 }, {
221 token : "string", // single line
222 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
223 }, {
224 token : "string", // multi line string start
225 regex : '["].*\\\\$',
226 next : "qqstring"
227 }, {
228 token : "string", // single line
229 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
230 }, {
231 token : "string", // multi line string start
232 regex : "['].*\\\\$",
233 next : "qstring"
234 }, {
235 token : "constant.numeric",
236 regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
237 }, {
238 token : "constant.numeric", // hex6 color
239 regex : "#[a-f0-9]{6}"
240 }, {
241 token : "constant.numeric", // hex3 color
242 regex : "#[a-f0-9]{3}"
243 }, {
244 token : "constant.numeric",
245 regex : numRe
246 }, {
247 token : ["support.function", "string", "support.function"],
248 regex : "(url\\()(.*)(\\))"
249 }, {
250 token : function(value) {
251 if (properties.hasOwnProperty(value.toLowerCase()))
252 return "support.type";
253 if (keywords.hasOwnProperty(value))
254 return "keyword";
255 else if (constants.hasOwnProperty(value))
256 return "constant.language";
257 else if (functions.hasOwnProperty(value))
258 return "support.function";
259 else if (colors.hasOwnProperty(value.toLowerCase()))
260 return "support.constant.color";
261 else if (tags.hasOwnProperty(value.toLowerCase()))
262 return "variable.language";
263 else
264 return "text";
265 },
266 regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
267 }, {
268 token : "variable",
269 regex : "[a-z_\\-$][a-z0-9_\\-$]*\\b"
270 }, {
271 token: "variable.language",
272 regex: "#[a-z0-9-_]+"
273 }, {
274 token: "variable.language",
275 regex: "\\.[a-z0-9-_]+"
276 }, {
277 token: "variable.language",
278 regex: ":[a-z0-9-_]+"
279 }, {
280 token: "constant",
281 regex: "[a-z0-9-_]+"
282 }, {
283 token : "keyword.operator",
284 regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
285 }, {
286 token : "paren.lparen",
287 regex : "[[({]"
288 }, {
289 token : "paren.rparen",
290 regex : "[\\])}]"
291 }, {
292 token : "text",
293 regex : "\\s+"
294 }, {
295 caseInsensitive: true
296 }
297 ],
298 "comment" : [
299 {
300 token : "comment", // closing comment
301 regex : ".*?\\*\\/",
302 next : "start"
303 }, {
304 token : "comment", // comment spanning whole line
305 regex : ".+"
306 }
307 ],
308 "qqstring" : [
309 {
310 token : "string",
311 regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
312 next : "start"
313 }, {
314 token : "string",
315 regex : '.+'
316 }
317 ],
318 "qstring" : [
319 {
320 token : "string",
321 regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
322 next : "start"
323 }, {
324 token : "string",
325 regex : '.+'
326 }
327 ]
328 };
329 };
330
331 oop.inherits(ScssHighlightRules, TextHighlightRules);
332
333 exports.ScssHighlightRules = ScssHighlightRules;
334
335 });
336
337 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
338
339
340 var Range = require("../range").Range;
341
342 var MatchingBraceOutdent = function() {};
343
344 (function() {
345
346 this.checkOutdent = function(line, input) {
347 if (! /^\s+$/.test(line))
348 return false;
349
350 return /^\s*\}/.test(input);
351 };
352
353 this.autoOutdent = function(doc, row) {
354 var line = doc.getLine(row);
355 var match = line.match(/^(\s*\})/);
356
357 if (!match) return 0;
358
359 var column = match[1].length;
360 var openBracePos = doc.findMatchingBracket({row: row, column: column});
361
362 if (!openBracePos || openBracePos.row == row) return 0;
363
364 var indent = this.$getIndent(doc.getLine(openBracePos.row));
365 doc.replace(new Range(row, 0, row, column-1), indent);
366 };
367
368 this.$getIndent = function(line) {
369 return line.match(/^\s*/)[0];
370 };
371
372 }).call(MatchingBraceOutdent.prototype);
373
374 exports.MatchingBraceOutdent = MatchingBraceOutdent;
375 });
376
377 define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
378
379
380 var oop = require("../../lib/oop");
381 var Behaviour = require("../behaviour").Behaviour;
382 var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
383 var TokenIterator = require("../../token_iterator").TokenIterator;
384
385 var CssBehaviour = function () {
386
387 this.inherit(CstyleBehaviour);
388
389 this.add("colon", "insertion", function (state, action, editor, session, text) {
390 if (text === ':') {
391 var cursor = editor.getCursorPosition();
392 var iterator = new TokenIterator(session, cursor.row, cursor.column);
393 var token = iterator.getCurrentToken();
394 if (token && token.value.match(/\s+/)) {
395 token = iterator.stepBackward();
396 }
397 if (token && token.type === 'support.type') {
398 var line = session.doc.getLine(cursor.row);
399 var rightChar = line.substring(cursor.column, cursor.column + 1);
400 if (rightChar === ':') {
401 return {
402 text: '',
403 selection: [1, 1]
404 }
405 }
406 if (!line.substring(cursor.column).match(/^\s*;/)) {
407 return {
408 text: ':;',
409 selection: [1, 1]
410 }
411 }
412 }
413 }
414 });
415
416 this.add("colon", "deletion", function (state, action, editor, session, range) {
417 var selected = session.doc.getTextRange(range);
418 if (!range.isMultiLine() && selected === ':') {
419 var cursor = editor.getCursorPosition();
420 var iterator = new TokenIterator(session, cursor.row, cursor.column);
421 var token = iterator.getCurrentToken();
422 if (token && token.value.match(/\s+/)) {
423 token = iterator.stepBackward();
424 }
425 if (token && token.type === 'support.type') {
426 var line = session.doc.getLine(range.start.row);
427 var rightChar = line.substring(range.end.column, range.end.column + 1);
428 if (rightChar === ';') {
429 range.end.column ++;
430 return range;
431 }
432 }
433 }
434 });
435
436 this.add("semicolon", "insertion", function (state, action, editor, session, text) {
437 if (text === ';') {
438 var cursor = editor.getCursorPosition();
439 var line = session.doc.getLine(cursor.row);
440 var rightChar = line.substring(cursor.column, cursor.column + 1);
441 if (rightChar === ';') {
442 return {
443 text: '',
444 selection: [1, 1]
445 }
446 }
447 }
448 });
449
450 }
451 oop.inherits(CssBehaviour, CstyleBehaviour);
452
453 exports.CssBehaviour = CssBehaviour;
454 });
455
456 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
457
458
459 var oop = require("../../lib/oop");
460 var Behaviour = require("../behaviour").Behaviour;
461 var TokenIterator = require("../../token_iterator").TokenIterator;
462 var lang = require("../../lib/lang");
463
464 var SAFE_INSERT_IN_TOKENS =
465 ["text", "paren.rparen", "punctuation.operator"];
466 var SAFE_INSERT_BEFORE_TOKENS =
467 ["text", "paren.rparen", "punctuation.operator", "comment"];
468
469
470 var autoInsertedBrackets = 0;
471 var autoInsertedRow = -1;
472 var autoInsertedLineEnd = "";
473 var maybeInsertedBrackets = 0;
474 var maybeInsertedRow = -1;
475 var maybeInsertedLineStart = "";
476 var maybeInsertedLineEnd = "";
477
478 var CstyleBehaviour = function () {
479
480 CstyleBehaviour.isSaneInsertion = function(editor, session) {
481 var cursor = editor.getCursorPosition();
482 var iterator = new TokenIterator(session, cursor.row, cursor.column);
483 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
484 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
485 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
486 return false;
487 }
488 iterator.stepForward();
489 return iterator.getCurrentTokenRow() !== cursor.row ||
490 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
491 };
492
493 CstyleBehaviour.$matchTokenType = function(token, types) {
494 return types.indexOf(token.type || token) > -1;
495 };
496
497 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
498 var cursor = editor.getCursorPosition();
499 var line = session.doc.getLine(cursor.row);
500 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
501 autoInsertedBrackets = 0;
502 autoInsertedRow = cursor.row;
503 autoInsertedLineEnd = bracket + line.substr(cursor.column);
504 autoInsertedBrackets++;
505 };
506
507 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
508 var cursor = editor.getCursorPosition();
509 var line = session.doc.getLine(cursor.row);
510 if (!this.isMaybeInsertedClosing(cursor, line))
511 maybeInsertedBrackets = 0;
512 maybeInsertedRow = cursor.row;
513 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
514 maybeInsertedLineEnd = line.substr(cursor.column);
515 maybeInsertedBrackets++;
516 };
517
518 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
519 return autoInsertedBrackets > 0 &&
520 cursor.row === autoInsertedRow &&
521 bracket === autoInsertedLineEnd[0] &&
522 line.substr(cursor.column) === autoInsertedLineEnd;
523 };
524
525 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
526 return maybeInsertedBrackets > 0 &&
527 cursor.row === maybeInsertedRow &&
528 line.substr(cursor.column) === maybeInsertedLineEnd &&
529 line.substr(0, cursor.column) == maybeInsertedLineStart;
530 };
531
532 CstyleBehaviour.popAutoInsertedClosing = function() {
533 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
534 autoInsertedBrackets--;
535 };
536
537 CstyleBehaviour.clearMaybeInsertedClosing = function() {
538 maybeInsertedBrackets = 0;
539 maybeInsertedRow = -1;
540 };
541
542 this.add("braces", "insertion", function (state, action, editor, session, text) {
543 var cursor = editor.getCursorPosition();
544 var line = session.doc.getLine(cursor.row);
545 if (text == '{') {
546 var selection = editor.getSelectionRange();
547 var selected = session.doc.getTextRange(selection);
548 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
549 return {
550 text: '{' + selected + '}',
551 selection: false
552 };
553 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
554 if (/[\]\}\)]/.test(line[cursor.column])) {
555 CstyleBehaviour.recordAutoInsert(editor, session, "}");
556 return {
557 text: '{}',
558 selection: [1, 1]
559 };
560 } else {
561 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
562 return {
563 text: '{',
564 selection: [1, 1]
565 };
566 }
567 }
568 } else if (text == '}') {
569 var rightChar = line.substring(cursor.column, cursor.column + 1);
570 if (rightChar == '}') {
571 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
572 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
573 CstyleBehaviour.popAutoInsertedClosing();
574 return {
575 text: '',
576 selection: [1, 1]
577 };
578 }
579 }
580 } else if (text == "\n" || text == "\r\n") {
581 var closing = "";
582 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
583 closing = lang.stringRepeat("}", maybeInsertedBrackets);
584 CstyleBehaviour.clearMaybeInsertedClosing();
585 }
586 var rightChar = line.substring(cursor.column, cursor.column + 1);
587 if (rightChar == '}' || closing !== "") {
588 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
589 if (!openBracePos)
590 return null;
591
592 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
593 var next_indent = this.$getIndent(line);
594
595 return {
596 text: '\n' + indent + '\n' + next_indent + closing,
597 selection: [1, indent.length, 1, indent.length]
598 };
599 }
600 }
601 });
602
603 this.add("braces", "deletion", function (state, action, editor, session, range) {
604 var selected = session.doc.getTextRange(range);
605 if (!range.isMultiLine() && selected == '{') {
606 var line = session.doc.getLine(range.start.row);
607 var rightChar = line.substring(range.end.column, range.end.column + 1);
608 if (rightChar == '}') {
609 range.end.column++;
610 return range;
611 } else {
612 maybeInsertedBrackets--;
613 }
614 }
615 });
616
617 this.add("parens", "insertion", function (state, action, editor, session, text) {
618 if (text == '(') {
619 var selection = editor.getSelectionRange();
620 var selected = session.doc.getTextRange(selection);
621 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
622 return {
623 text: '(' + selected + ')',
624 selection: false
625 };
626 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
627 CstyleBehaviour.recordAutoInsert(editor, session, ")");
628 return {
629 text: '()',
630 selection: [1, 1]
631 };
632 }
633 } else if (text == ')') {
634 var cursor = editor.getCursorPosition();
635 var line = session.doc.getLine(cursor.row);
636 var rightChar = line.substring(cursor.column, cursor.column + 1);
637 if (rightChar == ')') {
638 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
639 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
640 CstyleBehaviour.popAutoInsertedClosing();
641 return {
642 text: '',
643 selection: [1, 1]
644 };
645 }
646 }
647 }
648 });
649
650 this.add("parens", "deletion", function (state, action, editor, session, range) {
651 var selected = session.doc.getTextRange(range);
652 if (!range.isMultiLine() && selected == '(') {
653 var line = session.doc.getLine(range.start.row);
654 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
655 if (rightChar == ')') {
656 range.end.column++;
657 return range;
658 }
659 }
660 });
661
662 this.add("brackets", "insertion", function (state, action, editor, session, text) {
663 if (text == '[') {
664 var selection = editor.getSelectionRange();
665 var selected = session.doc.getTextRange(selection);
666 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
667 return {
668 text: '[' + selected + ']',
669 selection: false
670 };
671 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
672 CstyleBehaviour.recordAutoInsert(editor, session, "]");
673 return {
674 text: '[]',
675 selection: [1, 1]
676 };
677 }
678 } else if (text == ']') {
679 var cursor = editor.getCursorPosition();
680 var line = session.doc.getLine(cursor.row);
681 var rightChar = line.substring(cursor.column, cursor.column + 1);
682 if (rightChar == ']') {
683 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
684 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
685 CstyleBehaviour.popAutoInsertedClosing();
686 return {
687 text: '',
688 selection: [1, 1]
689 };
690 }
691 }
692 }
693 });
694
695 this.add("brackets", "deletion", function (state, action, editor, session, range) {
696 var selected = session.doc.getTextRange(range);
697 if (!range.isMultiLine() && selected == '[') {
698 var line = session.doc.getLine(range.start.row);
699 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
700 if (rightChar == ']') {
701 range.end.column++;
702 return range;
703 }
704 }
705 });
706
707 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
708 if (text == '"' || text == "'") {
709 var quote = text;
710 var selection = editor.getSelectionRange();
711 var selected = session.doc.getTextRange(selection);
712 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
713 return {
714 text: quote + selected + quote,
715 selection: false
716 };
717 } else {
718 var cursor = editor.getCursorPosition();
719 var line = session.doc.getLine(cursor.row);
720 var leftChar = line.substring(cursor.column-1, cursor.column);
721 if (leftChar == '\\') {
722 return null;
723 }
724 var tokens = session.getTokens(selection.start.row);
725 var col = 0, token;
726 var quotepos = -1; // Track whether we're inside an open quote.
727
728 for (var x = 0; x < tokens.length; x++) {
729 token = tokens[x];
730 if (token.type == "string") {
731 quotepos = -1;
732 } else if (quotepos < 0) {
733 quotepos = token.value.indexOf(quote);
734 }
735 if ((token.value.length + col) > selection.start.column) {
736 break;
737 }
738 col += tokens[x].value.length;
739 }
740 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
741 if (!CstyleBehaviour.isSaneInsertion(editor, session))
742 return;
743 return {
744 text: quote + quote,
745 selection: [1,1]
746 };
747 } else if (token && token.type === "string") {
748 var rightChar = line.substring(cursor.column, cursor.column + 1);
749 if (rightChar == quote) {
750 return {
751 text: '',
752 selection: [1, 1]
753 };
754 }
755 }
756 }
757 }
758 });
759
760 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
761 var selected = session.doc.getTextRange(range);
762 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
763 var line = session.doc.getLine(range.start.row);
764 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
765 if (rightChar == selected) {
766 range.end.column++;
767 return range;
768 }
769 }
770 });
771
772 };
773
774 oop.inherits(CstyleBehaviour, Behaviour);
775
776 exports.CstyleBehaviour = CstyleBehaviour;
777 });
778
779 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
780
781
782 var oop = require("../../lib/oop");
783 var Range = require("../../range").Range;
784 var BaseFoldMode = require("./fold_mode").FoldMode;
785
786 var FoldMode = exports.FoldMode = function(commentRegex) {
787 if (commentRegex) {
788 this.foldingStartMarker = new RegExp(
789 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
790 );
791 this.foldingStopMarker = new RegExp(
792 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
793 );
794 }
795 };
796 oop.inherits(FoldMode, BaseFoldMode);
797
798 (function() {
799
800 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
801 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
802
803 this.getFoldWidgetRange = function(session, foldStyle, row) {
804 var line = session.getLine(row);
805 var match = line.match(this.foldingStartMarker);
806 if (match) {
807 var i = match.index;
808
809 if (match[1])
810 return this.openingBracketBlock(session, match[1], row, i);
811
812 return session.getCommentFoldRange(row, i + match[0].length, 1);
813 }
814
815 if (foldStyle !== "markbeginend")
816 return;
817
818 var match = line.match(this.foldingStopMarker);
819 if (match) {
820 var i = match.index + match[0].length;
821
822 if (match[1])
823 return this.closingBracketBlock(session, match[1], row, i);
824
825 return session.getCommentFoldRange(row, i, -1);
826 }
827 };
828
829 }).call(FoldMode.prototype);
830
831 });
+0
-204
try/ace/mode-sh.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/sh', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/sh_highlight_rules', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
37 var Range = require("../range").Range;
38
39 var Mode = function() {
40 this.$tokenizer = new Tokenizer(new ShHighlightRules().getRules());
41 };
42 oop.inherits(Mode, TextMode);
43
44 (function() {
45
46
47 this.lineCommentStart = "#";
48
49 this.getNextLineIndent = function(state, line, tab) {
50 var indent = this.$getIndent(line);
51
52 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
53 var tokens = tokenizedLine.tokens;
54
55 if (tokens.length && tokens[tokens.length-1].type == "comment") {
56 return indent;
57 }
58
59 if (state == "start") {
60 var match = line.match(/^.*[\{\(\[\:]\s*$/);
61 if (match) {
62 indent += tab;
63 }
64 }
65
66 return indent;
67 };
68
69 var outdents = {
70 "pass": 1,
71 "return": 1,
72 "raise": 1,
73 "break": 1,
74 "continue": 1
75 };
76
77 this.checkOutdent = function(state, line, input) {
78 if (input !== "\r\n" && input !== "\r" && input !== "\n")
79 return false;
80
81 var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
82
83 if (!tokens)
84 return false;
85 do {
86 var last = tokens.pop();
87 } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
88
89 if (!last)
90 return false;
91
92 return (last.type == "keyword" && outdents[last.value]);
93 };
94
95 this.autoOutdent = function(state, doc, row) {
96
97 row += 1;
98 var indent = this.$getIndent(doc.getLine(row));
99 var tab = doc.getTabString();
100 if (indent.slice(-tab.length) == tab)
101 doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
102 };
103
104 }).call(Mode.prototype);
105
106 exports.Mode = Mode;
107 });
108
109 define('ace/mode/sh_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
110
111
112 var oop = require("../lib/oop");
113 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
114
115 var reservedKeywords = exports.reservedKeywords = (
116 '!|{|}|case|do|done|elif|else|'+
117 'esac|fi|for|if|in|then|until|while|'+
118 '&|;|export|local|read|typeset|unset|'+
119 'elif|select|set'
120 );
121
122 var languageConstructs = exports.languageConstructs = (
123 '[|]|alias|bg|bind|break|builtin|'+
124 'cd|command|compgen|complete|continue|'+
125 'dirs|disown|echo|enable|eval|exec|'+
126 'exit|fc|fg|getopts|hash|help|history|'+
127 'jobs|kill|let|logout|popd|printf|pushd|'+
128 'pwd|return|set|shift|shopt|source|'+
129 'suspend|test|times|trap|type|ulimit|'+
130 'umask|unalias|wait'
131 );
132
133 var ShHighlightRules = function() {
134 var keywordMapper = this.createKeywordMapper({
135 "keyword": reservedKeywords,
136 "support.function.builtin": languageConstructs,
137 "invalid.deprecated": "debugger"
138 }, "identifier");
139
140 var integer = "(?:(?:[1-9]\\d*)|(?:0))";
141
142 var fraction = "(?:\\.\\d+)";
143 var intPart = "(?:\\d+)";
144 var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
145 var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
146 var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
147 var fileDescriptor = "(?:&" + intPart + ")";
148
149 var variableName = "[a-zA-Z][a-zA-Z0-9_]*";
150 var variable = "(?:(?:\\$" + variableName + ")|(?:" + variableName + "=))";
151
152 var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
153
154 var func = "(?:" + variableName + "\\s*\\(\\))";
155
156 this.$rules = {
157 "start" : [ {
158 token : ["text", "comment"],
159 regex : /(^|\s)(#.*)$/
160 }, {
161 token : "string", // " string
162 regex : '"(?:[^\\\\]|\\\\.)*?"'
163 }, {
164 token : "variable.language",
165 regex : builtinVariable
166 }, {
167 token : "variable",
168 regex : variable
169 }, {
170 token : "support.function",
171 regex : func
172 }, {
173 token : "support.function",
174 regex : fileDescriptor
175 }, {
176 token : "string", // ' string
177 regex : "'(?:[^\\\\]|\\\\.)*?'"
178 }, {
179 token : "constant.numeric", // float
180 regex : floatNumber
181 }, {
182 token : "constant.numeric", // integer
183 regex : integer + "\\b"
184 }, {
185 token : keywordMapper,
186 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
187 }, {
188 token : "keyword.operator",
189 regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="
190 }, {
191 token : "paren.lparen",
192 regex : "[\\[\\(\\{]"
193 }, {
194 token : "paren.rparen",
195 regex : "[\\]\\)\\}]"
196 } ]
197 };
198 };
199
200 oop.inherits(ShHighlightRules, TextHighlightRules);
201
202 exports.ShHighlightRules = ShHighlightRules;
203 });
+0
-200
try/ace/mode-snippets.js less more
0 define('ace/mode/snippets', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
1
2
3 var oop = require("../lib/oop");
4 var TextMode = require("./text").Mode;
5 var Tokenizer = require("../tokenizer").Tokenizer;
6 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
7
8 var SnippetHighlightRules = function() {
9
10 var builtins = "SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|" +
11 "LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME";
12
13 this.$rules = {
14 "start" : [
15 {token:"constant.language.escape", regex: /\\[\$}`\\]/},
16 {token:"keyword", regex: "\\$(?:TM_)?(?:" + builtins + ")\\b"},
17 {token:"variable", regex: "\\$\\w+"},
18 {onMatch: function(value, state, stack) {
19 if (stack[1])
20 stack[1]++;
21 else
22 stack.unshift(state, 1);
23 return this.tokenName;
24 }, tokenName: "markup.list", regex: "\\${", next: "varDecl"},
25 {onMatch: function(value, state, stack) {
26 if (!stack[1])
27 return "text";
28 stack[1]--;
29 if (!stack[1])
30 stack.splice(0,2);
31 return this.tokenName;
32 }, tokenName: "markup.list", regex: "}"},
33 {token: "doc.comment", regex:/^\${2}-{5,}$/}
34 ],
35 "varDecl" : [
36 {regex: /\d+\b/, token: "constant.numeric"},
37 {token:"keyword", regex: "(?:TM_)?(?:" + builtins + ")\\b"},
38 {token:"variable", regex: "\\w+"},
39 {regex: /:/, token: "punctuation.operator", next: "start"},
40 {regex: /\//, token: "string.regex", next: "regexp"},
41 {regex: "", next: "start"}
42 ],
43 "regexp" : [
44 {regex: /\\./, token: "escape"},
45 {regex: /\[/, token: "regex.start", next: "charClass"},
46 {regex: "/", token: "string.regex", next: "format"},
47 {"token": "string.regex", regex:"."}
48 ],
49 charClass : [
50 {regex: "\\.", token: "escape"},
51 {regex: "\\]", token: "regex.end", next: "regexp"},
52 {"token": "string.regex", regex:"."}
53 ],
54 "format" : [
55 {regex: /\\[ulULE]/, token: "keyword"},
56 {regex: /\$\d+/, token: "variable"},
57 {regex: "/[gim]*:?", token: "string.regex", next: "start"},
58 {"token": "string", regex:"."}
59 ]
60 };
61 };
62 oop.inherits(SnippetHighlightRules, TextHighlightRules);
63
64 exports.SnippetHighlightRules = SnippetHighlightRules;
65
66 var SnippetGroupHighlightRules = function() {
67 this.$rules = {
68 "start" : [
69 {token: "text", regex: "^\\t", next: "sn-start"},
70 {token:"invalid", regex: /^ \s*/},
71 {token:"comment", regex: /^#.*/},
72 {token:"constant.language.escape", regex: "^regex ", next: "regex"},
73 {token:"constant.language.escape", regex: "^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\b"}
74 ],
75 "regex" : [
76 {token:"text", regex: "\\."},
77 {token:"keyword", regex: "/"},
78 {token:"empty", regex: "$", next: "start"}
79 ]
80 };
81 this.embedRules(SnippetHighlightRules, "sn-", [
82 {token: "text", regex: "^\\t", next: "sn-start"},
83 {onMatch: function(value, state, stack) {
84 stack.splice(stack.length);
85 return this.tokenName;
86 }, tokenName: "text", regex: "^(?!\t)", next: "start"},
87 ])
88
89 };
90
91 oop.inherits(SnippetGroupHighlightRules, TextHighlightRules);
92
93 exports.SnippetGroupHighlightRules = SnippetGroupHighlightRules;
94
95 var FoldMode = require("./folding/coffee").FoldMode;
96
97 var Mode = function() {
98 var highlighter = new SnippetGroupHighlightRules();
99 this.foldingRules = new FoldMode();
100 this.$tokenizer = new Tokenizer(highlighter.getRules());
101 };
102 oop.inherits(Mode, TextMode);
103
104 (function() {
105 this.getNextLineIndent = function(state, line, tab) {
106 return this.$getIndent(line);
107 };
108 }).call(Mode.prototype);
109 exports.Mode = Mode;
110
111
112 });
113
114 define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
115
116
117 var oop = require("../../lib/oop");
118 var BaseFoldMode = require("./fold_mode").FoldMode;
119 var Range = require("../../range").Range;
120
121 var FoldMode = exports.FoldMode = function() {};
122 oop.inherits(FoldMode, BaseFoldMode);
123
124 (function() {
125
126 this.getFoldWidgetRange = function(session, foldStyle, row) {
127 var range = this.indentationBlock(session, row);
128 if (range)
129 return range;
130
131 var re = /\S/;
132 var line = session.getLine(row);
133 var startLevel = line.search(re);
134 if (startLevel == -1 || line[startLevel] != "#")
135 return;
136
137 var startColumn = line.length;
138 var maxRow = session.getLength();
139 var startRow = row;
140 var endRow = row;
141
142 while (++row < maxRow) {
143 line = session.getLine(row);
144 var level = line.search(re);
145
146 if (level == -1)
147 continue;
148
149 if (line[level] != "#")
150 break;
151
152 endRow = row;
153 }
154
155 if (endRow > startRow) {
156 var endColumn = session.getLine(endRow).length;
157 return new Range(startRow, startColumn, endRow, endColumn);
158 }
159 };
160 this.getFoldWidget = function(session, foldStyle, row) {
161 var line = session.getLine(row);
162 var indent = line.search(/\S/);
163 var next = session.getLine(row + 1);
164 var prev = session.getLine(row - 1);
165 var prevIndent = prev.search(/\S/);
166 var nextIndent = next.search(/\S/);
167
168 if (indent == -1) {
169 session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
170 return "";
171 }
172 if (prevIndent == -1) {
173 if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
174 session.foldWidgets[row - 1] = "";
175 session.foldWidgets[row + 1] = "";
176 return "start";
177 }
178 } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
179 if (session.getLine(row - 2).search(/\S/) == -1) {
180 session.foldWidgets[row - 1] = "start";
181 session.foldWidgets[row + 1] = "";
182 return "";
183 }
184 }
185
186 if (prevIndent!= -1 && prevIndent < indent)
187 session.foldWidgets[row - 1] = "start";
188 else
189 session.foldWidgets[row - 1] = "";
190
191 if (indent < nextIndent)
192 return "start";
193 else
194 return "";
195 };
196
197 }).call(FoldMode.prototype);
198
199 });
+0
-118
try/ace/mode-sql.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/sql', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/sql_highlight_rules', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var SqlHighlightRules = require("./sql_highlight_rules").SqlHighlightRules;
37 var Range = require("../range").Range;
38
39 var Mode = function() {
40 this.$tokenizer = new Tokenizer(new SqlHighlightRules().getRules());
41 };
42 oop.inherits(Mode, TextMode);
43
44 (function() {
45
46 this.lineCommentStart = "--";
47
48 }).call(Mode.prototype);
49
50 exports.Mode = Mode;
51
52 });
53
54 define('ace/mode/sql_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
55
56
57 var oop = require("../lib/oop");
58 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
59
60 var SqlHighlightRules = function() {
61
62 var keywords = (
63 "select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|" +
64 "when|else|end|type|left|right|join|on|outer|desc|asc"
65 );
66
67 var builtinConstants = (
68 "true|false|null"
69 );
70
71 var builtinFunctions = (
72 "count|min|max|avg|sum|rank|now|coalesce"
73 );
74
75 var keywordMapper = this.createKeywordMapper({
76 "support.function": builtinFunctions,
77 "keyword": keywords,
78 "constant.language": builtinConstants
79 }, "identifier", true);
80
81 this.$rules = {
82 "start" : [ {
83 token : "comment",
84 regex : "--.*$"
85 }, {
86 token : "string", // " string
87 regex : '".*?"'
88 }, {
89 token : "string", // ' string
90 regex : "'.*?'"
91 }, {
92 token : "constant.numeric", // float
93 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
94 }, {
95 token : keywordMapper,
96 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
97 }, {
98 token : "keyword.operator",
99 regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
100 }, {
101 token : "paren.lparen",
102 regex : "[\\(]"
103 }, {
104 token : "paren.rparen",
105 regex : "[\\)]"
106 }, {
107 token : "text",
108 regex : "\\s+"
109 } ]
110 };
111 };
112
113 oop.inherits(SqlHighlightRules, TextHighlightRules);
114
115 exports.SqlHighlightRules = SqlHighlightRules;
116 });
117
+0
-1441
try/ace/mode-svg.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/svg', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/svg_highlight_rules', 'ace/mode/folding/mixed', 'ace/mode/folding/xml', 'ace/mode/folding/cstyle'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var XmlMode = require("./xml").Mode;
35 var JavaScriptMode = require("./javascript").Mode;
36 var Tokenizer = require("../tokenizer").Tokenizer;
37 var SvgHighlightRules = require("./svg_highlight_rules").SvgHighlightRules;
38 var MixedFoldMode = require("./folding/mixed").FoldMode;
39 var XmlFoldMode = require("./folding/xml").FoldMode;
40 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
41
42 var Mode = function() {
43 XmlMode.call(this);
44
45 this.highlighter = new SvgHighlightRules();
46 this.$tokenizer = new Tokenizer(this.highlighter.getRules());
47
48 this.$embeds = this.highlighter.getEmbeds();
49 this.createModeDelegates({
50 "js-": JavaScriptMode
51 });
52
53 this.foldingRules = new MixedFoldMode(new XmlFoldMode({}), {
54 "js-": new CStyleFoldMode()
55 });
56 };
57
58 oop.inherits(Mode, XmlMode);
59
60 (function() {
61
62 this.getNextLineIndent = function(state, line, tab) {
63 return this.$getIndent(line);
64 };
65
66
67 }).call(Mode.prototype);
68
69 exports.Mode = Mode;
70 });
71
72 define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) {
73
74
75 var oop = require("../lib/oop");
76 var TextMode = require("./text").Mode;
77 var Tokenizer = require("../tokenizer").Tokenizer;
78 var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
79 var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
80 var XmlFoldMode = require("./folding/xml").FoldMode;
81
82 var Mode = function() {
83 this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
84 this.$behaviour = new XmlBehaviour();
85 this.foldingRules = new XmlFoldMode();
86 };
87
88 oop.inherits(Mode, TextMode);
89
90 (function() {
91
92 this.blockComment = {start: "<!--", end: "-->"};
93
94 }).call(Mode.prototype);
95
96 exports.Mode = Mode;
97 });
98
99 define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
100
101
102 var oop = require("../lib/oop");
103 var xmlUtil = require("./xml_util");
104 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
105
106 var XmlHighlightRules = function() {
107 this.$rules = {
108 start : [
109 {token : "text", regex : "<\\!\\[CDATA\\[", next : "cdata"},
110 {token : "xml-pe", regex : "<\\?.*?\\?>"},
111 {token : "comment", regex : "<\\!--", next : "comment"},
112 {token : "xml-pe", regex : "<\\!.*?>"},
113 {token : "meta.tag", regex : "<\\/?", next : "tag"},
114 {token : "text", regex : "\\s+"},
115 {
116 token : "constant.character.entity",
117 regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
118 }
119 ],
120
121 cdata : [
122 {token : "text", regex : "\\]\\]>", next : "start"},
123 {token : "text", regex : "\\s+"},
124 {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"}
125 ],
126
127 comment : [
128 {token : "comment", regex : ".*?-->", next : "start"},
129 {token : "comment", regex : ".+"}
130 ]
131 };
132
133 xmlUtil.tag(this.$rules, "tag", "start");
134 };
135
136 oop.inherits(XmlHighlightRules, TextHighlightRules);
137
138 exports.XmlHighlightRules = XmlHighlightRules;
139 });
140
141 define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
142
143
144 function string(state) {
145 return [{
146 token : "string",
147 regex : '"',
148 next : state + "_qqstring"
149 }, {
150 token : "string",
151 regex : "'",
152 next : state + "_qstring"
153 }];
154 }
155
156 function multiLineString(quote, state) {
157 return [
158 {token : "string", regex : quote, next : state},
159 {
160 token : "constant.language.escape",
161 regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
162 },
163 {defaultToken : "string"}
164 ];
165 }
166
167 exports.tag = function(states, name, nextState, tagMap) {
168 states[name] = [{
169 token : "text",
170 regex : "\\s+"
171 }, {
172
173 token : !tagMap ? "meta.tag.tag-name" : function(value) {
174 if (tagMap[value])
175 return "meta.tag.tag-name." + tagMap[value];
176 else
177 return "meta.tag.tag-name";
178 },
179 regex : "[-_a-zA-Z0-9:]+",
180 next : name + "_embed_attribute_list"
181 }, {
182 token: "empty",
183 regex: "",
184 next : name + "_embed_attribute_list"
185 }];
186
187 states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
188 states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
189
190 states[name + "_embed_attribute_list"] = [{
191 token : "meta.tag.r",
192 regex : "/?>",
193 next : nextState
194 }, {
195 token : "keyword.operator",
196 regex : "="
197 }, {
198 token : "entity.other.attribute-name",
199 regex : "[-_a-zA-Z0-9:]+"
200 }, {
201 token : "constant.numeric", // float
202 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
203 }, {
204 token : "text",
205 regex : "\\s+"
206 }].concat(string(name));
207 };
208
209 });
210
211 define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
212
213
214 var oop = require("../../lib/oop");
215 var Behaviour = require("../behaviour").Behaviour;
216 var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
217 var TokenIterator = require("../../token_iterator").TokenIterator;
218
219 function hasType(token, type) {
220 var hasType = true;
221 var typeList = token.type.split('.');
222 var needleList = type.split('.');
223 needleList.forEach(function(needle){
224 if (typeList.indexOf(needle) == -1) {
225 hasType = false;
226 return false;
227 }
228 });
229 return hasType;
230 }
231
232 var XmlBehaviour = function () {
233
234 this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
235
236 this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
237 if (text == '>') {
238 var position = editor.getCursorPosition();
239 var iterator = new TokenIterator(session, position.row, position.column);
240 var token = iterator.getCurrentToken();
241 var atCursor = false;
242 if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
243 do {
244 token = iterator.stepBackward();
245 } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
246 } else {
247 atCursor = true;
248 }
249 if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
250 return
251 }
252 var tag = token.value;
253 if (atCursor){
254 var tag = tag.substring(0, position.column - token.start);
255 }
256
257 return {
258 text: '>' + '</' + tag + '>',
259 selection: [1, 1]
260 }
261 }
262 });
263
264 this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
265 if (text == "\n") {
266 var cursor = editor.getCursorPosition();
267 var line = session.doc.getLine(cursor.row);
268 var rightChars = line.substring(cursor.column, cursor.column + 2);
269 if (rightChars == '</') {
270 var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
271 var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
272
273 return {
274 text: '\n' + indent + '\n' + next_indent,
275 selection: [1, indent.length, 1, indent.length]
276 }
277 }
278 }
279 });
280
281 }
282 oop.inherits(XmlBehaviour, Behaviour);
283
284 exports.XmlBehaviour = XmlBehaviour;
285 });
286
287 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
288
289
290 var oop = require("../../lib/oop");
291 var Behaviour = require("../behaviour").Behaviour;
292 var TokenIterator = require("../../token_iterator").TokenIterator;
293 var lang = require("../../lib/lang");
294
295 var SAFE_INSERT_IN_TOKENS =
296 ["text", "paren.rparen", "punctuation.operator"];
297 var SAFE_INSERT_BEFORE_TOKENS =
298 ["text", "paren.rparen", "punctuation.operator", "comment"];
299
300
301 var autoInsertedBrackets = 0;
302 var autoInsertedRow = -1;
303 var autoInsertedLineEnd = "";
304 var maybeInsertedBrackets = 0;
305 var maybeInsertedRow = -1;
306 var maybeInsertedLineStart = "";
307 var maybeInsertedLineEnd = "";
308
309 var CstyleBehaviour = function () {
310
311 CstyleBehaviour.isSaneInsertion = function(editor, session) {
312 var cursor = editor.getCursorPosition();
313 var iterator = new TokenIterator(session, cursor.row, cursor.column);
314 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
315 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
316 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
317 return false;
318 }
319 iterator.stepForward();
320 return iterator.getCurrentTokenRow() !== cursor.row ||
321 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
322 };
323
324 CstyleBehaviour.$matchTokenType = function(token, types) {
325 return types.indexOf(token.type || token) > -1;
326 };
327
328 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
329 var cursor = editor.getCursorPosition();
330 var line = session.doc.getLine(cursor.row);
331 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
332 autoInsertedBrackets = 0;
333 autoInsertedRow = cursor.row;
334 autoInsertedLineEnd = bracket + line.substr(cursor.column);
335 autoInsertedBrackets++;
336 };
337
338 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
339 var cursor = editor.getCursorPosition();
340 var line = session.doc.getLine(cursor.row);
341 if (!this.isMaybeInsertedClosing(cursor, line))
342 maybeInsertedBrackets = 0;
343 maybeInsertedRow = cursor.row;
344 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
345 maybeInsertedLineEnd = line.substr(cursor.column);
346 maybeInsertedBrackets++;
347 };
348
349 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
350 return autoInsertedBrackets > 0 &&
351 cursor.row === autoInsertedRow &&
352 bracket === autoInsertedLineEnd[0] &&
353 line.substr(cursor.column) === autoInsertedLineEnd;
354 };
355
356 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
357 return maybeInsertedBrackets > 0 &&
358 cursor.row === maybeInsertedRow &&
359 line.substr(cursor.column) === maybeInsertedLineEnd &&
360 line.substr(0, cursor.column) == maybeInsertedLineStart;
361 };
362
363 CstyleBehaviour.popAutoInsertedClosing = function() {
364 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
365 autoInsertedBrackets--;
366 };
367
368 CstyleBehaviour.clearMaybeInsertedClosing = function() {
369 maybeInsertedBrackets = 0;
370 maybeInsertedRow = -1;
371 };
372
373 this.add("braces", "insertion", function (state, action, editor, session, text) {
374 var cursor = editor.getCursorPosition();
375 var line = session.doc.getLine(cursor.row);
376 if (text == '{') {
377 var selection = editor.getSelectionRange();
378 var selected = session.doc.getTextRange(selection);
379 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
380 return {
381 text: '{' + selected + '}',
382 selection: false
383 };
384 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
385 if (/[\]\}\)]/.test(line[cursor.column])) {
386 CstyleBehaviour.recordAutoInsert(editor, session, "}");
387 return {
388 text: '{}',
389 selection: [1, 1]
390 };
391 } else {
392 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
393 return {
394 text: '{',
395 selection: [1, 1]
396 };
397 }
398 }
399 } else if (text == '}') {
400 var rightChar = line.substring(cursor.column, cursor.column + 1);
401 if (rightChar == '}') {
402 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
403 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
404 CstyleBehaviour.popAutoInsertedClosing();
405 return {
406 text: '',
407 selection: [1, 1]
408 };
409 }
410 }
411 } else if (text == "\n" || text == "\r\n") {
412 var closing = "";
413 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
414 closing = lang.stringRepeat("}", maybeInsertedBrackets);
415 CstyleBehaviour.clearMaybeInsertedClosing();
416 }
417 var rightChar = line.substring(cursor.column, cursor.column + 1);
418 if (rightChar == '}' || closing !== "") {
419 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
420 if (!openBracePos)
421 return null;
422
423 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
424 var next_indent = this.$getIndent(line);
425
426 return {
427 text: '\n' + indent + '\n' + next_indent + closing,
428 selection: [1, indent.length, 1, indent.length]
429 };
430 }
431 }
432 });
433
434 this.add("braces", "deletion", function (state, action, editor, session, range) {
435 var selected = session.doc.getTextRange(range);
436 if (!range.isMultiLine() && selected == '{') {
437 var line = session.doc.getLine(range.start.row);
438 var rightChar = line.substring(range.end.column, range.end.column + 1);
439 if (rightChar == '}') {
440 range.end.column++;
441 return range;
442 } else {
443 maybeInsertedBrackets--;
444 }
445 }
446 });
447
448 this.add("parens", "insertion", function (state, action, editor, session, text) {
449 if (text == '(') {
450 var selection = editor.getSelectionRange();
451 var selected = session.doc.getTextRange(selection);
452 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
453 return {
454 text: '(' + selected + ')',
455 selection: false
456 };
457 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
458 CstyleBehaviour.recordAutoInsert(editor, session, ")");
459 return {
460 text: '()',
461 selection: [1, 1]
462 };
463 }
464 } else if (text == ')') {
465 var cursor = editor.getCursorPosition();
466 var line = session.doc.getLine(cursor.row);
467 var rightChar = line.substring(cursor.column, cursor.column + 1);
468 if (rightChar == ')') {
469 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
470 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
471 CstyleBehaviour.popAutoInsertedClosing();
472 return {
473 text: '',
474 selection: [1, 1]
475 };
476 }
477 }
478 }
479 });
480
481 this.add("parens", "deletion", function (state, action, editor, session, range) {
482 var selected = session.doc.getTextRange(range);
483 if (!range.isMultiLine() && selected == '(') {
484 var line = session.doc.getLine(range.start.row);
485 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
486 if (rightChar == ')') {
487 range.end.column++;
488 return range;
489 }
490 }
491 });
492
493 this.add("brackets", "insertion", function (state, action, editor, session, text) {
494 if (text == '[') {
495 var selection = editor.getSelectionRange();
496 var selected = session.doc.getTextRange(selection);
497 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
498 return {
499 text: '[' + selected + ']',
500 selection: false
501 };
502 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
503 CstyleBehaviour.recordAutoInsert(editor, session, "]");
504 return {
505 text: '[]',
506 selection: [1, 1]
507 };
508 }
509 } else if (text == ']') {
510 var cursor = editor.getCursorPosition();
511 var line = session.doc.getLine(cursor.row);
512 var rightChar = line.substring(cursor.column, cursor.column + 1);
513 if (rightChar == ']') {
514 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
515 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
516 CstyleBehaviour.popAutoInsertedClosing();
517 return {
518 text: '',
519 selection: [1, 1]
520 };
521 }
522 }
523 }
524 });
525
526 this.add("brackets", "deletion", function (state, action, editor, session, range) {
527 var selected = session.doc.getTextRange(range);
528 if (!range.isMultiLine() && selected == '[') {
529 var line = session.doc.getLine(range.start.row);
530 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
531 if (rightChar == ']') {
532 range.end.column++;
533 return range;
534 }
535 }
536 });
537
538 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
539 if (text == '"' || text == "'") {
540 var quote = text;
541 var selection = editor.getSelectionRange();
542 var selected = session.doc.getTextRange(selection);
543 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
544 return {
545 text: quote + selected + quote,
546 selection: false
547 };
548 } else {
549 var cursor = editor.getCursorPosition();
550 var line = session.doc.getLine(cursor.row);
551 var leftChar = line.substring(cursor.column-1, cursor.column);
552 if (leftChar == '\\') {
553 return null;
554 }
555 var tokens = session.getTokens(selection.start.row);
556 var col = 0, token;
557 var quotepos = -1; // Track whether we're inside an open quote.
558
559 for (var x = 0; x < tokens.length; x++) {
560 token = tokens[x];
561 if (token.type == "string") {
562 quotepos = -1;
563 } else if (quotepos < 0) {
564 quotepos = token.value.indexOf(quote);
565 }
566 if ((token.value.length + col) > selection.start.column) {
567 break;
568 }
569 col += tokens[x].value.length;
570 }
571 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
572 if (!CstyleBehaviour.isSaneInsertion(editor, session))
573 return;
574 return {
575 text: quote + quote,
576 selection: [1,1]
577 };
578 } else if (token && token.type === "string") {
579 var rightChar = line.substring(cursor.column, cursor.column + 1);
580 if (rightChar == quote) {
581 return {
582 text: '',
583 selection: [1, 1]
584 };
585 }
586 }
587 }
588 }
589 });
590
591 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
592 var selected = session.doc.getTextRange(range);
593 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
594 var line = session.doc.getLine(range.start.row);
595 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
596 if (rightChar == selected) {
597 range.end.column++;
598 return range;
599 }
600 }
601 });
602
603 };
604
605 oop.inherits(CstyleBehaviour, Behaviour);
606
607 exports.CstyleBehaviour = CstyleBehaviour;
608 });
609
610 define('ace/mode/folding/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/range', 'ace/mode/folding/fold_mode', 'ace/token_iterator'], function(require, exports, module) {
611
612
613 var oop = require("../../lib/oop");
614 var lang = require("../../lib/lang");
615 var Range = require("../../range").Range;
616 var BaseFoldMode = require("./fold_mode").FoldMode;
617 var TokenIterator = require("../../token_iterator").TokenIterator;
618
619 var FoldMode = exports.FoldMode = function(voidElements) {
620 BaseFoldMode.call(this);
621 this.voidElements = voidElements || {};
622 };
623 oop.inherits(FoldMode, BaseFoldMode);
624
625 (function() {
626
627 this.getFoldWidget = function(session, foldStyle, row) {
628 var tag = this._getFirstTagInLine(session, row);
629
630 if (tag.closing)
631 return foldStyle == "markbeginend" ? "end" : "";
632
633 if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
634 return "";
635
636 if (tag.selfClosing)
637 return "";
638
639 if (tag.value.indexOf("/" + tag.tagName) !== -1)
640 return "";
641
642 return "start";
643 };
644
645 this._getFirstTagInLine = function(session, row) {
646 var tokens = session.getTokens(row);
647 var value = "";
648 for (var i = 0; i < tokens.length; i++) {
649 var token = tokens[i];
650 if (token.type.indexOf("meta.tag") === 0)
651 value += token.value;
652 else
653 value += lang.stringRepeat(" ", token.value.length);
654 }
655
656 return this._parseTag(value);
657 };
658
659 this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
660 this._parseTag = function(tag) {
661
662 var match = tag.match(this.tagRe);
663 var column = 0;
664
665 return {
666 value: tag,
667 match: match ? match[2] : "",
668 closing: match ? !!match[3] : false,
669 selfClosing: match ? !!match[5] || match[2] == "/>" : false,
670 tagName: match ? match[4] : "",
671 column: match[1] ? column + match[1].length : column
672 };
673 };
674 this._readTagForward = function(iterator) {
675 var token = iterator.getCurrentToken();
676 if (!token)
677 return null;
678
679 var value = "";
680 var start;
681
682 do {
683 if (token.type.indexOf("meta.tag") === 0) {
684 if (!start) {
685 var start = {
686 row: iterator.getCurrentTokenRow(),
687 column: iterator.getCurrentTokenColumn()
688 };
689 }
690 value += token.value;
691 if (value.indexOf(">") !== -1) {
692 var tag = this._parseTag(value);
693 tag.start = start;
694 tag.end = {
695 row: iterator.getCurrentTokenRow(),
696 column: iterator.getCurrentTokenColumn() + token.value.length
697 };
698 iterator.stepForward();
699 return tag;
700 }
701 }
702 } while(token = iterator.stepForward());
703
704 return null;
705 };
706
707 this._readTagBackward = function(iterator) {
708 var token = iterator.getCurrentToken();
709 if (!token)
710 return null;
711
712 var value = "";
713 var end;
714
715 do {
716 if (token.type.indexOf("meta.tag") === 0) {
717 if (!end) {
718 end = {
719 row: iterator.getCurrentTokenRow(),
720 column: iterator.getCurrentTokenColumn() + token.value.length
721 };
722 }
723 value = token.value + value;
724 if (value.indexOf("<") !== -1) {
725 var tag = this._parseTag(value);
726 tag.end = end;
727 tag.start = {
728 row: iterator.getCurrentTokenRow(),
729 column: iterator.getCurrentTokenColumn()
730 };
731 iterator.stepBackward();
732 return tag;
733 }
734 }
735 } while(token = iterator.stepBackward());
736
737 return null;
738 };
739
740 this._pop = function(stack, tag) {
741 while (stack.length) {
742
743 var top = stack[stack.length-1];
744 if (!tag || top.tagName == tag.tagName) {
745 return stack.pop();
746 }
747 else if (this.voidElements[tag.tagName]) {
748 return;
749 }
750 else if (this.voidElements[top.tagName]) {
751 stack.pop();
752 continue;
753 } else {
754 return null;
755 }
756 }
757 };
758
759 this.getFoldWidgetRange = function(session, foldStyle, row) {
760 var firstTag = this._getFirstTagInLine(session, row);
761
762 if (!firstTag.match)
763 return null;
764
765 var isBackward = firstTag.closing || firstTag.selfClosing;
766 var stack = [];
767 var tag;
768
769 if (!isBackward) {
770 var iterator = new TokenIterator(session, row, firstTag.column);
771 var start = {
772 row: row,
773 column: firstTag.column + firstTag.tagName.length + 2
774 };
775 while (tag = this._readTagForward(iterator)) {
776 if (tag.selfClosing) {
777 if (!stack.length) {
778 tag.start.column += tag.tagName.length + 2;
779 tag.end.column -= 2;
780 return Range.fromPoints(tag.start, tag.end);
781 } else
782 continue;
783 }
784
785 if (tag.closing) {
786 this._pop(stack, tag);
787 if (stack.length == 0)
788 return Range.fromPoints(start, tag.start);
789 }
790 else {
791 stack.push(tag)
792 }
793 }
794 }
795 else {
796 var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
797 var end = {
798 row: row,
799 column: firstTag.column
800 };
801
802 while (tag = this._readTagBackward(iterator)) {
803 if (tag.selfClosing) {
804 if (!stack.length) {
805 tag.start.column += tag.tagName.length + 2;
806 tag.end.column -= 2;
807 return Range.fromPoints(tag.start, tag.end);
808 } else
809 continue;
810 }
811
812 if (!tag.closing) {
813 this._pop(stack, tag);
814 if (stack.length == 0) {
815 tag.start.column += tag.tagName.length + 2;
816 return Range.fromPoints(tag.start, end);
817 }
818 }
819 else {
820 stack.push(tag)
821 }
822 }
823 }
824
825 };
826
827 }).call(FoldMode.prototype);
828
829 });
830
831 define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/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', 'ace/mode/folding/cstyle'], function(require, exports, module) {
832
833
834 var oop = require("../lib/oop");
835 var TextMode = require("./text").Mode;
836 var Tokenizer = require("../tokenizer").Tokenizer;
837 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
838 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
839 var Range = require("../range").Range;
840 var WorkerClient = require("../worker/worker_client").WorkerClient;
841 var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
842 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
843
844 var Mode = function() {
845 this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
846 this.$outdent = new MatchingBraceOutdent();
847 this.$behaviour = new CstyleBehaviour();
848 this.foldingRules = new CStyleFoldMode();
849 };
850 oop.inherits(Mode, TextMode);
851
852 (function() {
853
854 this.lineCommentStart = "//";
855 this.blockComment = {start: "/*", end: "*/"};
856
857 this.getNextLineIndent = function(state, line, tab) {
858 var indent = this.$getIndent(line);
859
860 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
861 var tokens = tokenizedLine.tokens;
862 var endState = tokenizedLine.state;
863
864 if (tokens.length && tokens[tokens.length-1].type == "comment") {
865 return indent;
866 }
867
868 if (state == "start" || state == "no_regex") {
869 var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
870 if (match) {
871 indent += tab;
872 }
873 } else if (state == "doc-start") {
874 if (endState == "start" || endState == "no_regex") {
875 return "";
876 }
877 var match = line.match(/^\s*(\/?)\*/);
878 if (match) {
879 if (match[1]) {
880 indent += " ";
881 }
882 indent += "* ";
883 }
884 }
885
886 return indent;
887 };
888
889 this.checkOutdent = function(state, line, input) {
890 return this.$outdent.checkOutdent(line, input);
891 };
892
893 this.autoOutdent = function(state, doc, row) {
894 this.$outdent.autoOutdent(doc, row);
895 };
896
897 this.createWorker = function(session) {
898 var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
899 worker.attachToDocument(session.getDocument());
900
901 worker.on("jslint", function(results) {
902 session.setAnnotations(results.data);
903 });
904
905 worker.on("terminate", function() {
906 session.clearAnnotations();
907 });
908
909 return worker;
910 };
911
912 }).call(Mode.prototype);
913
914 exports.Mode = Mode;
915 });
916
917 define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
918
919
920 var oop = require("../lib/oop");
921 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
922 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
923
924 var JavaScriptHighlightRules = function() {
925 var keywordMapper = this.createKeywordMapper({
926 "variable.language":
927 "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
928 "Namespace|QName|XML|XMLList|" + // E4X
929 "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
930 "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
931 "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
932 "SyntaxError|TypeError|URIError|" +
933 "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
934 "isNaN|parseFloat|parseInt|" +
935 "JSON|Math|" + // Other
936 "this|arguments|prototype|window|document" , // Pseudo
937 "keyword":
938 "const|yield|import|get|set|" +
939 "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
940 "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
941 "__parent__|__count__|escape|unescape|with|__proto__|" +
942 "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
943 "storage.type":
944 "const|let|var|function",
945 "constant.language":
946 "null|Infinity|NaN|undefined",
947 "support.function":
948 "alert",
949 "constant.language.boolean": "true|false"
950 }, "identifier");
951 var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
952 var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
953
954 var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
955 "u[0-9a-fA-F]{4}|" + // unicode
956 "[0-2][0-7]{0,2}|" + // oct
957 "3[0-6][0-7]?|" + // oct
958 "37[0-7]?|" + // oct
959 "[4-7][0-7]?|" + //oct
960 ".)";
961
962 this.$rules = {
963 "no_regex" : [
964 {
965 token : "comment",
966 regex : /\/\/.*$/
967 },
968 DocCommentHighlightRules.getStartRule("doc-start"),
969 {
970 token : "comment", // multi line comment
971 regex : /\/\*/,
972 next : "comment"
973 }, {
974 token : "string",
975 regex : "'(?=.)",
976 next : "qstring"
977 }, {
978 token : "string",
979 regex : '"(?=.)',
980 next : "qqstring"
981 }, {
982 token : "constant.numeric", // hex
983 regex : /0[xX][0-9a-fA-F]+\b/
984 }, {
985 token : "constant.numeric", // float
986 regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
987 }, {
988 token : [
989 "storage.type", "punctuation.operator", "support.function",
990 "punctuation.operator", "entity.name.function", "text","keyword.operator"
991 ],
992 regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
993 next: "function_arguments"
994 }, {
995 token : [
996 "storage.type", "punctuation.operator", "entity.name.function", "text",
997 "keyword.operator", "text", "storage.type", "text", "paren.lparen"
998 ],
999 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1000 next: "function_arguments"
1001 }, {
1002 token : [
1003 "entity.name.function", "text", "keyword.operator", "text", "storage.type",
1004 "text", "paren.lparen"
1005 ],
1006 regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1007 next: "function_arguments"
1008 }, {
1009 token : [
1010 "storage.type", "punctuation.operator", "entity.name.function", "text",
1011 "keyword.operator", "text",
1012 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
1013 ],
1014 regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
1015 next: "function_arguments"
1016 }, {
1017 token : [
1018 "storage.type", "text", "entity.name.function", "text", "paren.lparen"
1019 ],
1020 regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
1021 next: "function_arguments"
1022 }, {
1023 token : [
1024 "entity.name.function", "text", "punctuation.operator",
1025 "text", "storage.type", "text", "paren.lparen"
1026 ],
1027 regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
1028 next: "function_arguments"
1029 }, {
1030 token : [
1031 "text", "text", "storage.type", "text", "paren.lparen"
1032 ],
1033 regex : "(:)(\\s*)(function)(\\s*)(\\()",
1034 next: "function_arguments"
1035 }, {
1036 token : "keyword",
1037 regex : "(?:" + kwBeforeRe + ")\\b",
1038 next : "start"
1039 }, {
1040 token : ["punctuation.operator", "support.function"],
1041 regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
1042 }, {
1043 token : ["punctuation.operator", "support.function.dom"],
1044 regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
1045 }, {
1046 token : ["punctuation.operator", "support.constant"],
1047 regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
1048 }, {
1049 token : ["storage.type", "punctuation.operator", "support.function.firebug"],
1050 regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
1051 }, {
1052 token : keywordMapper,
1053 regex : identifierRe
1054 }, {
1055 token : "keyword.operator",
1056 regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
1057 next : "start"
1058 }, {
1059 token : "punctuation.operator",
1060 regex : /\?|\:|\,|\;|\./,
1061 next : "start"
1062 }, {
1063 token : "paren.lparen",
1064 regex : /[\[({]/,
1065 next : "start"
1066 }, {
1067 token : "paren.rparen",
1068 regex : /[\])}]/
1069 }, {
1070 token : "keyword.operator",
1071 regex : /\/=?/,
1072 next : "start"
1073 }, {
1074 token: "comment",
1075 regex: /^#!.*$/
1076 }
1077 ],
1078 "start": [
1079 DocCommentHighlightRules.getStartRule("doc-start"),
1080 {
1081 token : "comment", // multi line comment
1082 regex : "\\/\\*",
1083 next : "comment_regex_allowed"
1084 }, {
1085 token : "comment",
1086 regex : "\\/\\/.*$",
1087 next : "start"
1088 }, {
1089 token: "string.regexp",
1090 regex: "\\/",
1091 next: "regex"
1092 }, {
1093 token : "text",
1094 regex : "\\s+|^$",
1095 next : "start"
1096 }, {
1097 token: "empty",
1098 regex: "",
1099 next: "no_regex"
1100 }
1101 ],
1102 "regex": [
1103 {
1104 token: "regexp.keyword.operator",
1105 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1106 }, {
1107 token: "string.regexp",
1108 regex: "/\\w*",
1109 next: "no_regex"
1110 }, {
1111 token : "invalid",
1112 regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
1113 }, {
1114 token : "constant.language.escape",
1115 regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
1116 }, {
1117 token : "constant.language.delimiter",
1118 regex: /\|/
1119 }, {
1120 token: "constant.language.escape",
1121 regex: /\[\^?/,
1122 next: "regex_character_class"
1123 }, {
1124 token: "empty",
1125 regex: "$",
1126 next: "no_regex"
1127 }, {
1128 defaultToken: "string.regexp"
1129 }
1130 ],
1131 "regex_character_class": [
1132 {
1133 token: "regexp.keyword.operator",
1134 regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1135 }, {
1136 token: "constant.language.escape",
1137 regex: "]",
1138 next: "regex"
1139 }, {
1140 token: "constant.language.escape",
1141 regex: "-"
1142 }, {
1143 token: "empty",
1144 regex: "$",
1145 next: "no_regex"
1146 }, {
1147 defaultToken: "string.regexp.charachterclass"
1148 }
1149 ],
1150 "function_arguments": [
1151 {
1152 token: "variable.parameter",
1153 regex: identifierRe
1154 }, {
1155 token: "punctuation.operator",
1156 regex: "[, ]+"
1157 }, {
1158 token: "punctuation.operator",
1159 regex: "$"
1160 }, {
1161 token: "empty",
1162 regex: "",
1163 next: "no_regex"
1164 }
1165 ],
1166 "comment_regex_allowed" : [
1167 {token : "comment", regex : "\\*\\/", next : "start"},
1168 {defaultToken : "comment"}
1169 ],
1170 "comment" : [
1171 {token : "comment", regex : "\\*\\/", next : "no_regex"},
1172 {defaultToken : "comment"}
1173 ],
1174 "qqstring" : [
1175 {
1176 token : "constant.language.escape",
1177 regex : escapedRe
1178 }, {
1179 token : "string",
1180 regex : "\\\\$",
1181 next : "qqstring"
1182 }, {
1183 token : "string",
1184 regex : '"|$',
1185 next : "no_regex"
1186 }, {
1187 defaultToken: "string"
1188 }
1189 ],
1190 "qstring" : [
1191 {
1192 token : "constant.language.escape",
1193 regex : escapedRe
1194 }, {
1195 token : "string",
1196 regex : "\\\\$",
1197 next : "qstring"
1198 }, {
1199 token : "string",
1200 regex : "'|$",
1201 next : "no_regex"
1202 }, {
1203 defaultToken: "string"
1204 }
1205 ]
1206 };
1207
1208 this.embedRules(DocCommentHighlightRules, "doc-",
1209 [ DocCommentHighlightRules.getEndRule("no_regex") ]);
1210 };
1211
1212 oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
1213
1214 exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
1215 });
1216
1217 define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1218
1219
1220 var oop = require("../lib/oop");
1221 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1222
1223 var DocCommentHighlightRules = function() {
1224
1225 this.$rules = {
1226 "start" : [ {
1227 token : "comment.doc.tag",
1228 regex : "@[\\w\\d_]+" // TODO: fix email addresses
1229 }, {
1230 token : "comment.doc.tag",
1231 regex : "\\bTODO\\b"
1232 }, {
1233 defaultToken : "comment.doc"
1234 }]
1235 };
1236 };
1237
1238 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
1239
1240 DocCommentHighlightRules.getStartRule = function(start) {
1241 return {
1242 token : "comment.doc", // doc comment
1243 regex : "\\/\\*(?=\\*)",
1244 next : start
1245 };
1246 };
1247
1248 DocCommentHighlightRules.getEndRule = function (start) {
1249 return {
1250 token : "comment.doc", // closing comment
1251 regex : "\\*\\/",
1252 next : start
1253 };
1254 };
1255
1256
1257 exports.DocCommentHighlightRules = DocCommentHighlightRules;
1258
1259 });
1260
1261 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1262
1263
1264 var Range = require("../range").Range;
1265
1266 var MatchingBraceOutdent = function() {};
1267
1268 (function() {
1269
1270 this.checkOutdent = function(line, input) {
1271 if (! /^\s+$/.test(line))
1272 return false;
1273
1274 return /^\s*\}/.test(input);
1275 };
1276
1277 this.autoOutdent = function(doc, row) {
1278 var line = doc.getLine(row);
1279 var match = line.match(/^(\s*\})/);
1280
1281 if (!match) return 0;
1282
1283 var column = match[1].length;
1284 var openBracePos = doc.findMatchingBracket({row: row, column: column});
1285
1286 if (!openBracePos || openBracePos.row == row) return 0;
1287
1288 var indent = this.$getIndent(doc.getLine(openBracePos.row));
1289 doc.replace(new Range(row, 0, row, column-1), indent);
1290 };
1291
1292 this.$getIndent = function(line) {
1293 return line.match(/^\s*/)[0];
1294 };
1295
1296 }).call(MatchingBraceOutdent.prototype);
1297
1298 exports.MatchingBraceOutdent = MatchingBraceOutdent;
1299 });
1300
1301 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1302
1303
1304 var oop = require("../../lib/oop");
1305 var Range = require("../../range").Range;
1306 var BaseFoldMode = require("./fold_mode").FoldMode;
1307
1308 var FoldMode = exports.FoldMode = function(commentRegex) {
1309 if (commentRegex) {
1310 this.foldingStartMarker = new RegExp(
1311 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
1312 );
1313 this.foldingStopMarker = new RegExp(
1314 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
1315 );
1316 }
1317 };
1318 oop.inherits(FoldMode, BaseFoldMode);
1319
1320 (function() {
1321
1322 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1323 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1324
1325 this.getFoldWidgetRange = function(session, foldStyle, row) {
1326 var line = session.getLine(row);
1327 var match = line.match(this.foldingStartMarker);
1328 if (match) {
1329 var i = match.index;
1330
1331 if (match[1])
1332 return this.openingBracketBlock(session, match[1], row, i);
1333
1334 return session.getCommentFoldRange(row, i + match[0].length, 1);
1335 }
1336
1337 if (foldStyle !== "markbeginend")
1338 return;
1339
1340 var match = line.match(this.foldingStopMarker);
1341 if (match) {
1342 var i = match.index + match[0].length;
1343
1344 if (match[1])
1345 return this.closingBracketBlock(session, match[1], row, i);
1346
1347 return session.getCommentFoldRange(row, i, -1);
1348 }
1349 };
1350
1351 }).call(FoldMode.prototype);
1352
1353 });
1354
1355 define('ace/mode/svg_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules', 'ace/mode/xml_util'], function(require, exports, module) {
1356
1357
1358 var oop = require("../lib/oop");
1359 var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1360 var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1361 var xmlUtil = require("./xml_util");
1362
1363 var SvgHighlightRules = function() {
1364 XmlHighlightRules.call(this);
1365
1366 this.$rules.start.splice(3, 0, {
1367 token : "meta.tag",
1368 regex : "<(?=script)",
1369 next : "script"
1370 });
1371
1372 xmlUtil.tag(this.$rules, "script", "js-start");
1373
1374 this.embedRules(JavaScriptHighlightRules, "js-", [{
1375 token: "comment",
1376 regex: "\\/\\/.*(?=<\\/script>)",
1377 next: "tag"
1378 }, {
1379 token: "meta.tag",
1380 regex: "<\\/(?=script)",
1381 next: "tag"
1382 }]);
1383 };
1384
1385 oop.inherits(SvgHighlightRules, XmlHighlightRules);
1386
1387 exports.SvgHighlightRules = SvgHighlightRules;
1388 });
1389
1390 define('ace/mode/folding/mixed', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1391
1392
1393 var oop = require("../../lib/oop");
1394 var BaseFoldMode = require("./fold_mode").FoldMode;
1395
1396 var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
1397 this.defaultMode = defaultMode;
1398 this.subModes = subModes;
1399 };
1400 oop.inherits(FoldMode, BaseFoldMode);
1401
1402 (function() {
1403
1404
1405 this.$getMode = function(state) {
1406 for (var key in this.subModes) {
1407 if (state.indexOf(key) === 0)
1408 return this.subModes[key];
1409 }
1410 return null;
1411 };
1412
1413 this.$tryMode = function(state, session, foldStyle, row) {
1414 var mode = this.$getMode(state);
1415 return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1416 };
1417
1418 this.getFoldWidget = function(session, foldStyle, row) {
1419 return (
1420 this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
1421 this.$tryMode(session.getState(row), session, foldStyle, row) ||
1422 this.defaultMode.getFoldWidget(session, foldStyle, row)
1423 );
1424 };
1425
1426 this.getFoldWidgetRange = function(session, foldStyle, row) {
1427 var mode = this.$getMode(session.getState(row-1));
1428
1429 if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1430 mode = this.$getMode(session.getState(row));
1431
1432 if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1433 mode = this.defaultMode;
1434
1435 return mode.getFoldWidgetRange(session, foldStyle, row);
1436 };
1437
1438 }).call(FoldMode.prototype);
1439
1440 });
+0
-319
try/ace/mode-tcl.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/tcl', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/folding/cstyle', 'ace/mode/tcl_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var CStyleFoldMode = require("./folding/cstyle").FoldMode;
37 var TclHighlightRules = require("./tcl_highlight_rules").TclHighlightRules;
38 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
39 var Range = require("../range").Range;
40
41 var Mode = function() {
42 this.$tokenizer = new Tokenizer(new TclHighlightRules().getRules());
43 this.$outdent = new MatchingBraceOutdent();
44 this.foldingRules = new CStyleFoldMode();
45 };
46 oop.inherits(Mode, TextMode);
47
48 (function() {
49
50 this.lineCommentStart = "#";
51
52 this.getNextLineIndent = function(state, line, tab) {
53 var indent = this.$getIndent(line);
54
55 var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
56 var tokens = tokenizedLine.tokens;
57
58 if (tokens.length && tokens[tokens.length-1].type == "comment") {
59 return indent;
60 }
61
62 if (state == "start") {
63 var match = line.match(/^.*[\{\(\[]\s*$/);
64 if (match) {
65 indent += tab;
66 }
67 }
68
69 return indent;
70 };
71
72 this.checkOutdent = function(state, line, input) {
73 return this.$outdent.checkOutdent(line, input);
74 };
75
76 this.autoOutdent = function(state, doc, row) {
77 this.$outdent.autoOutdent(doc, row);
78 };
79
80 }).call(Mode.prototype);
81
82 exports.Mode = Mode;
83 });
84
85 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
86
87
88 var oop = require("../../lib/oop");
89 var Range = require("../../range").Range;
90 var BaseFoldMode = require("./fold_mode").FoldMode;
91
92 var FoldMode = exports.FoldMode = function(commentRegex) {
93 if (commentRegex) {
94 this.foldingStartMarker = new RegExp(
95 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
96 );
97 this.foldingStopMarker = new RegExp(
98 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
99 );
100 }
101 };
102 oop.inherits(FoldMode, BaseFoldMode);
103
104 (function() {
105
106 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
107 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
108
109 this.getFoldWidgetRange = function(session, foldStyle, row) {
110 var line = session.getLine(row);
111 var match = line.match(this.foldingStartMarker);
112 if (match) {
113 var i = match.index;
114
115 if (match[1])
116 return this.openingBracketBlock(session, match[1], row, i);
117
118 return session.getCommentFoldRange(row, i + match[0].length, 1);
119 }
120
121 if (foldStyle !== "markbeginend")
122 return;
123
124 var match = line.match(this.foldingStopMarker);
125 if (match) {
126 var i = match.index + match[0].length;
127
128 if (match[1])
129 return this.closingBracketBlock(session, match[1], row, i);
130
131 return session.getCommentFoldRange(row, i, -1);
132 }
133 };
134
135 }).call(FoldMode.prototype);
136
137 });
138
139 define('ace/mode/tcl_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
140
141
142 var oop = require("../lib/oop");
143 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
144
145 var TclHighlightRules = function() {
146
147 this.$rules = {
148 "start" : [
149 {
150 token : "comment",
151 regex : "#.*\\\\$",
152 next : "commentfollow"
153 }, {
154 token : "comment",
155 regex : "#.*$"
156 }, {
157 token : "support.function",
158 regex : '[\\\\]$',
159 next : "splitlineStart"
160 }, {
161 token : "text",
162 regex : '[\\\\](?:["]|[{]|[}]|[[]|[]]|[$]|[\])'
163 }, {
164 token : "text", // last value before command
165 regex : '^|[^{][;][^}]|[/\r/]',
166 next : "commandItem"
167 }, {
168 token : "string", // single line
169 regex : '[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
170 }, {
171 token : "string", // multi line """ string start
172 regex : '[ ]*["]',
173 next : "qqstring"
174 }, {
175 token : "variable.instance",
176 regex : "[$]",
177 next : "variable"
178 }, {
179 token : "support.function",
180 regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::"
181 }, {
182 token : "identifier",
183 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
184 }, {
185 token : "paren.lparen",
186 regex : "[[{]",
187 next : "commandItem"
188 }, {
189 token : "paren.lparen",
190 regex : "[(]"
191 }, {
192 token : "paren.rparen",
193 regex : "[\\])}]"
194 }, {
195 token : "text",
196 regex : "\\s+"
197 }
198 ],
199 "commandItem" : [
200 {
201 token : "comment",
202 regex : "#.*\\\\$",
203 next : "commentfollow"
204 }, {
205 token : "comment",
206 regex : "#.*$",
207 next : "start"
208 }, {
209 token : "string", // single line
210 regex : '[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
211 }, {
212 token : "variable.instance",
213 regex : "[$]",
214 next : "variable"
215 }, {
216 token : "support.function",
217 regex : "(?:[:][:])[a-zA-Z0-9_/]+(?:[:][:])",
218 next : "commandItem"
219 }, {
220 token : "support.function",
221 regex : "[a-zA-Z0-9_/]+(?:[:][:])",
222 next : "commandItem"
223 }, {
224 token : "support.function",
225 regex : "(?:[:][:])",
226 next : "commandItem"
227 }, {
228 token : "paren.rparen",
229 regex : "[\\])}]"
230 }, {
231 token : "support.function",
232 regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::"
233 }, {
234 token : "keyword",
235 regex : "[a-zA-Z0-9_/]+",
236 next : "start"
237 } ],
238 "commentfollow" : [
239 {
240 token : "comment",
241 regex : ".*\\\\$",
242 next : "commentfollow"
243 }, {
244 token : "comment",
245 regex : '.+',
246 next : "start"
247 } ],
248 "splitlineStart" : [
249 {
250 token : "text",
251 regex : "^.",
252 next : "start"
253 }],
254 "variable" : [
255 {
256 token : "variable.instance", // variable tcl
257 regex : "[a-zA-Z_\\d]+(?:[(][a-zA-Z_\\d]+[)])?",
258 next : "start"
259 }, {
260 token : "variable.instance", // variable tcl with braces
261 regex : "{?[a-zA-Z_\\d]+}?",
262 next : "start"
263 }],
264 "qqstring" : [ {
265 token : "string", // multi line """ string end
266 regex : '(?:[^\\\\]|\\\\.)*?["]',
267 next : "start"
268 }, {
269 token : "string",
270 regex : '.+'
271 } ]
272 };
273 };
274
275 oop.inherits(TclHighlightRules, TextHighlightRules);
276
277 exports.TclHighlightRules = TclHighlightRules;
278 });
279
280 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
281
282
283 var Range = require("../range").Range;
284
285 var MatchingBraceOutdent = function() {};
286
287 (function() {
288
289 this.checkOutdent = function(line, input) {
290 if (! /^\s+$/.test(line))
291 return false;
292
293 return /^\s*\}/.test(input);
294 };
295
296 this.autoOutdent = function(doc, row) {
297 var line = doc.getLine(row);
298 var match = line.match(/^(\s*\})/);
299
300 if (!match) return 0;
301
302 var column = match[1].length;
303 var openBracePos = doc.findMatchingBracket({row: row, column: column});
304
305 if (!openBracePos || openBracePos.row == row) return 0;
306
307 var indent = this.$getIndent(doc.getLine(openBracePos.row));
308 doc.replace(new Range(row, 0, row, column-1), indent);
309 };
310
311 this.$getIndent = function(line) {
312 return line.match(/^\s*/)[0];
313 };
314
315 }).call(MatchingBraceOutdent.prototype);
316
317 exports.MatchingBraceOutdent = MatchingBraceOutdent;
318 });
+0
-166
try/ace/mode-tex.js less more
0 /*
1 * tex.js
2 *
3 * Copyright (C) 2009-11 by RStudio, Inc.
4 *
5 * The Initial Developer of the Original Code is
6 * Ajax.org B.V.
7 * Portions created by the Initial Developer are Copyright (C) 2010
8 * the Initial Developer. All Rights Reserved.
9 *
10 * This program is licensed to you under the terms of version 3 of the
11 * GNU Affero General Public License. This program is distributed WITHOUT
12 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
14 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
15 *
16 */
17 define('ace/mode/tex', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/tex_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
18
19
20 var oop = require("../lib/oop");
21 var TextMode = require("./text").Mode;
22 var Tokenizer = require("../tokenizer").Tokenizer;
23 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
24 var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules;
25 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
26
27 var Mode = function(suppressHighlighting) {
28 if (suppressHighlighting)
29 this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules());
30 else
31 this.$tokenizer = new Tokenizer(new TexHighlightRules().getRules());
32 this.$outdent = new MatchingBraceOutdent();
33 };
34 oop.inherits(Mode, TextMode);
35
36 (function() {
37 this.getNextLineIndent = function(state, line, tab) {
38 return this.$getIndent(line);
39 };
40
41 this.allowAutoInsert = function() {
42 return false;
43 };
44 }).call(Mode.prototype);
45
46 exports.Mode = Mode;
47 });
48 define('ace/mode/tex_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
49
50
51 var oop = require("../lib/oop");
52 var lang = require("../lib/lang");
53 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
54
55 var TexHighlightRules = function(textClass) {
56
57 if (!textClass)
58 textClass = "text";
59
60 this.$rules = {
61 "start" : [
62 {
63 token : "comment",
64 regex : "%.*$"
65 }, {
66 token : textClass, // non-command
67 regex : "\\\\[$&%#\\{\\}]"
68 }, {
69 token : "keyword", // command
70 regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b",
71 next : "nospell"
72 }, {
73 token : "keyword", // command
74 regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])"
75 }, {
76 token : "paren.keyword.operator",
77 regex : "[[({]"
78 }, {
79 token : "paren.keyword.operator",
80 regex : "[\\])}]"
81 }, {
82 token : textClass,
83 regex : "\\s+"
84 }
85 ],
86 "nospell" : [
87 {
88 token : "comment",
89 regex : "%.*$",
90 next : "start"
91 }, {
92 token : "nospell." + textClass, // non-command
93 regex : "\\\\[$&%#\\{\\}]"
94 }, {
95 token : "keyword", // command
96 regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b"
97 }, {
98 token : "keyword", // command
99 regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])",
100 next : "start"
101 }, {
102 token : "paren.keyword.operator",
103 regex : "[[({]"
104 }, {
105 token : "paren.keyword.operator",
106 regex : "[\\])]"
107 }, {
108 token : "paren.keyword.operator",
109 regex : "}",
110 next : "start"
111 }, {
112 token : "nospell." + textClass,
113 regex : "\\s+"
114 }, {
115 token : "nospell." + textClass,
116 regex : "\\w+"
117 }
118 ]
119 };
120 };
121
122 oop.inherits(TexHighlightRules, TextHighlightRules);
123
124 exports.TexHighlightRules = TexHighlightRules;
125 });
126
127 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
128
129
130 var Range = require("../range").Range;
131
132 var MatchingBraceOutdent = function() {};
133
134 (function() {
135
136 this.checkOutdent = function(line, input) {
137 if (! /^\s+$/.test(line))
138 return false;
139
140 return /^\s*\}/.test(input);
141 };
142
143 this.autoOutdent = function(doc, row) {
144 var line = doc.getLine(row);
145 var match = line.match(/^(\s*\})/);
146
147 if (!match) return 0;
148
149 var column = match[1].length;
150 var openBracePos = doc.findMatchingBracket({row: row, column: column});
151
152 if (!openBracePos || openBracePos.row == row) return 0;
153
154 var indent = this.$getIndent(doc.getLine(openBracePos.row));
155 doc.replace(new Range(row, 0, row, column-1), indent);
156 };
157
158 this.$getIndent = function(line) {
159 return line.match(/^\s*/)[0];
160 };
161
162 }).call(MatchingBraceOutdent.prototype);
163
164 exports.MatchingBraceOutdent = MatchingBraceOutdent;
165 });
+0
-0
try/ace/mode-text.js less more
(Empty file)
+0
-170
try/ace/mode-textile.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/textile', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/textile_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var TextileHighlightRules = require("./textile_highlight_rules").TextileHighlightRules;
37 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38
39 var Mode = function() {
40 this.$tokenizer = new Tokenizer(new TextileHighlightRules().getRules());
41 this.$outdent = new MatchingBraceOutdent();
42 };
43 oop.inherits(Mode, TextMode);
44
45 (function() {
46 this.getNextLineIndent = function(state, line, tab) {
47 if (state == "intag")
48 return tab;
49
50 return "";
51 };
52
53 this.checkOutdent = function(state, line, input) {
54 return this.$outdent.checkOutdent(line, input);
55 };
56
57 this.autoOutdent = function(state, doc, row) {
58 this.$outdent.autoOutdent(doc, row);
59 };
60
61 }).call(Mode.prototype);
62
63 exports.Mode = Mode;
64
65 });
66
67 define('ace/mode/textile_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
68
69
70 var oop = require("../lib/oop");
71 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
72
73 var TextileHighlightRules = function() {
74 this.$rules = {
75 "start" : [
76 {
77 token : function(value) {
78 if (value.charAt(0) == "h")
79 return "markup.heading." + value.charAt(1);
80 else
81 return "markup.heading";
82 },
83 regex : "h1|h2|h3|h4|h5|h6|bq|p|bc|pre",
84 next : "blocktag"
85 },
86 {
87 token : "keyword",
88 regex : "[\\*]+|[#]+"
89 },
90 {
91 token : "text",
92 regex : ".+"
93 }
94 ],
95 "blocktag" : [
96 {
97 token : "keyword",
98 regex : "\\. ",
99 next : "start"
100 },
101 {
102 token : "keyword",
103 regex : "\\(",
104 next : "blocktagproperties"
105 }
106 ],
107 "blocktagproperties" : [
108 {
109 token : "keyword",
110 regex : "\\)",
111 next : "blocktag"
112 },
113 {
114 token : "string",
115 regex : "[a-zA-Z0-9\\-_]+"
116 },
117 {
118 token : "keyword",
119 regex : "#"
120 }
121 ]
122 };
123 };
124
125 oop.inherits(TextileHighlightRules, TextHighlightRules);
126
127 exports.TextileHighlightRules = TextileHighlightRules;
128
129 });
130
131 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
132
133
134 var Range = require("../range").Range;
135
136 var MatchingBraceOutdent = function() {};
137
138 (function() {
139
140 this.checkOutdent = function(line, input) {
141 if (! /^\s+$/.test(line))
142 return false;
143
144 return /^\s*\}/.test(input);
145 };
146
147 this.autoOutdent = function(doc, row) {
148 var line = doc.getLine(row);
149 var match = line.match(/^(\s*\})/);
150
151 if (!match) return 0;
152
153 var column = match[1].length;
154 var openBracePos = doc.findMatchingBracket({row: row, column: column});
155
156 if (!openBracePos || openBracePos.row == row) return 0;
157
158 var indent = this.$getIndent(doc.getLine(openBracePos.row));
159 doc.replace(new Range(row, 0, row, column-1), indent);
160 };
161
162 this.$getIndent = function(line) {
163 return line.match(/^\s*/)[0];
164 };
165
166 }).call(MatchingBraceOutdent.prototype);
167
168 exports.MatchingBraceOutdent = MatchingBraceOutdent;
169 });
+0
-200
try/ace/mode-tmsnippet.js less more
0 define('ace/mode/tmsnippet', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/folding/coffee'], function(require, exports, module) {
1
2
3 var oop = require("../lib/oop");
4 var TextMode = require("./text").Mode;
5 var Tokenizer = require("../tokenizer").Tokenizer;
6 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
7
8 var SnippetHighlightRules = function() {
9
10 var builtins = "SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|" +
11 "LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME";
12
13 this.$rules = {
14 "start" : [
15 {token:"constant.language.escape", regex: /\\[\$}`\\]/},
16 {token:"keyword", regex: "\\$(?:TM_)?(?:" + builtins + ")\\b"},
17 {token:"variable", regex: "\\$\\w+"},
18 {onMatch: function(value, state, stack) {
19 if (stack[1])
20 stack[1]++;
21 else
22 stack.unshift(state, 1);
23 return this.tokenName;
24 }, tokenName: "markup.list", regex: "\\${", next: "varDecl"},
25 {onMatch: function(value, state, stack) {
26 if (!stack[1])
27 return "text";
28 stack[1]--;
29 if (!stack[1])
30 stack.splice(0,2);
31 return this.tokenName;
32 }, tokenName: "markup.list", regex: "}"},
33 {token: "doc.comment", regex:/^\${2}-{5,}$/}
34 ],
35 "varDecl" : [
36 {regex: /\d+\b/, token: "constant.numeric"},
37 {token:"keyword", regex: "(?:TM_)?(?:" + builtins + ")\\b"},
38 {token:"variable", regex: "\\w+"},
39 {regex: /:/, token: "punctuation.operator", next: "start"},
40 {regex: /\//, token: "string.regex", next: "regexp"},
41 {regex: "", next: "start"}
42 ],
43 "regexp" : [
44 {regex: /\\./, token: "escape"},
45 {regex: /\[/, token: "regex.start", next: "charClass"},
46 {regex: "/", token: "string.regex", next: "format"},
47 {"token": "string.regex", regex:"."}
48 ],
49 charClass : [
50 {regex: "\\.", token: "escape"},
51 {regex: "\\]", token: "regex.end", next: "regexp"},
52 {"token": "string.regex", regex:"."}
53 ],
54 "format" : [
55 {regex: /\\[ulULE]/, token: "keyword"},
56 {regex: /\$\d+/, token: "variable"},
57 {regex: "/[gim]*:?", token: "string.regex", next: "start"},
58 {"token": "string", regex:"."}
59 ]
60 };
61 };
62 oop.inherits(SnippetHighlightRules, TextHighlightRules);
63
64 exports.SnippetHighlightRules = SnippetHighlightRules;
65
66 var SnippetGroupHighlightRules = function() {
67 this.$rules = {
68 "start" : [
69 {token: "text", regex: "^\\t", next: "sn-start"},
70 {token:"invalid", regex: /^ \s*/},
71 {token:"comment", regex: /^#.*/},
72 {token:"constant.language.escape", regex: "^regex ", next: "regex"},
73 {token:"constant.language.escape", regex: "^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\b"}
74 ],
75 "regex" : [
76 {token:"text", regex: "\\."},
77 {token:"keyword", regex: "/"},
78 {token:"empty", regex: "$", next: "start"}
79 ]
80 };
81 this.embedRules(SnippetHighlightRules, "sn-", [
82 {token: "text", regex: "^\\t", next: "sn-start"},
83 {onMatch: function(value, state, stack) {
84 stack.splice(stack.length);
85 return this.tokenName;
86 }, tokenName: "text", regex: "^(?!\t)", next: "start"},
87 ])
88
89 };
90
91 oop.inherits(SnippetGroupHighlightRules, TextHighlightRules);
92
93 exports.SnippetGroupHighlightRules = SnippetGroupHighlightRules;
94
95 var FoldMode = require("./folding/coffee").FoldMode;
96
97 var Mode = function() {
98 var highlighter = new SnippetGroupHighlightRules();
99 this.foldingRules = new FoldMode();
100 this.$tokenizer = new Tokenizer(highlighter.getRules());
101 };
102 oop.inherits(Mode, TextMode);
103
104 (function() {
105 this.getNextLineIndent = function(state, line, tab) {
106 return this.$getIndent(line);
107 };
108 }).call(Mode.prototype);
109 exports.Mode = Mode;
110
111
112 });
113
114 define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
115
116
117 var oop = require("../../lib/oop");
118 var BaseFoldMode = require("./fold_mode").FoldMode;
119 var Range = require("../../range").Range;
120
121 var FoldMode = exports.FoldMode = function() {};
122 oop.inherits(FoldMode, BaseFoldMode);
123
124 (function() {
125
126 this.getFoldWidgetRange = function(session, foldStyle, row) {
127 var range = this.indentationBlock(session, row);
128 if (range)
129 return range;
130
131 var re = /\S/;
132 var line = session.getLine(row);
133 var startLevel = line.search(re);
134 if (startLevel == -1 || line[startLevel] != "#")
135 return;
136
137 var startColumn = line.length;
138 var maxRow = session.getLength();
139 var startRow = row;
140 var endRow = row;
141
142 while (++row < maxRow) {
143 line = session.getLine(row);
144 var level = line.search(re);
145
146 if (level == -1)
147 continue;
148
149 if (line[level] != "#")
150 break;
151
152 endRow = row;
153 }
154
155 if (endRow > startRow) {
156 var endColumn = session.getLine(endRow).length;
157 return new Range(startRow, startColumn, endRow, endColumn);
158 }
159 };
160 this.getFoldWidget = function(session, foldStyle, row) {
161 var line = session.getLine(row);
162 var indent = line.search(/\S/);
163 var next = session.getLine(row + 1);
164 var prev = session.getLine(row - 1);
165 var prevIndent = prev.search(/\S/);
166 var nextIndent = next.search(/\S/);
167
168 if (indent == -1) {
169 session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
170 return "";
171 }
172 if (prevIndent == -1) {
173 if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
174 session.foldWidgets[row - 1] = "";
175 session.foldWidgets[row + 1] = "";
176 return "start";
177 }
178 } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
179 if (session.getLine(row - 2).search(/\S/) == -1) {
180 session.foldWidgets[row - 1] = "start";
181 session.foldWidgets[row + 1] = "";
182 return "";
183 }
184 }
185
186 if (prevIndent!= -1 && prevIndent < indent)
187 session.foldWidgets[row - 1] = "start";
188 else
189 session.foldWidgets[row - 1] = "";
190
191 if (indent < nextIndent)
192 return "start";
193 else
194 return "";
195 };
196
197 }).call(FoldMode.prototype);
198
199 });
+0
-180
try/ace/mode-toml.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2013, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 *
29 * Contributor(s):
30 *
31 * Garen J. Torikian
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35 define('ace/mode/toml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/toml_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
36
37
38 var oop = require("../lib/oop");
39 var TextMode = require("./text").Mode;
40 var Tokenizer = require("../tokenizer").Tokenizer;
41 var TomlHighlightRules = require("./toml_highlight_rules").TomlHighlightRules;
42 var FoldMode = require("./folding/cstyle").FoldMode;
43
44 var Mode = function() {
45 var highlighter = new TomlHighlightRules();
46 this.foldingRules = new FoldMode();
47 this.$tokenizer = new Tokenizer(highlighter.getRules());
48 };
49 oop.inherits(Mode, TextMode);
50
51 (function() {
52 this.lineCommentStart = "#";
53 }).call(Mode.prototype);
54
55 exports.Mode = Mode;
56 });
57
58 define('ace/mode/toml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
59
60
61 var oop = require("../lib/oop");
62 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
63
64 var TomlHighlightRules = function() {
65 var keywordMapper = this.createKeywordMapper({
66 "constant.language.boolean": "true|false"
67 }, "identifier");
68
69 var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
70
71 this.$rules = {
72 "start": [
73 {
74 token: "comment.toml",
75 regex: /#.*$/
76 },
77 {
78 token : "string",
79 regex : '"(?=.)',
80 next : "qqstring"
81 },
82 {
83 token: ["variable.keygroup.toml"],
84 regex: "(?:^\\s*)(\\[([^\\]]+)\\])"
85 },
86 {
87 token : keywordMapper,
88 regex : identifierRe
89 },
90 {
91 token : "support.date.toml",
92 regex: "\\d{4}-\\d{2}-\\d{2}(T)\\d{2}:\\d{2}:\\d{2}(Z)"
93 },
94 {
95 token: "constant.numeric.toml",
96 regex: "-?\\d+(\\.?\\d+)?"
97 }
98 ],
99 "qqstring" : [
100 {
101 token : "string",
102 regex : "\\\\$",
103 next : "qqstring"
104 },
105 {
106 token : "constant.language.escape",
107 regex : '\\\\[0tnr"\\\\]'
108 },
109 {
110 token : "string",
111 regex : '"|$',
112 next : "start"
113 },
114 {
115 defaultToken: "string"
116 }
117 ]
118 }
119
120 };
121
122 oop.inherits(TomlHighlightRules, TextHighlightRules);
123
124 exports.TomlHighlightRules = TomlHighlightRules;
125 });
126
127 define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
128
129
130 var oop = require("../../lib/oop");
131 var Range = require("../../range").Range;
132 var BaseFoldMode = require("./fold_mode").FoldMode;
133
134 var FoldMode = exports.FoldMode = function(commentRegex) {
135 if (commentRegex) {
136 this.foldingStartMarker = new RegExp(
137 this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
138 );
139 this.foldingStopMarker = new RegExp(
140 this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
141 );
142 }
143 };
144 oop.inherits(FoldMode, BaseFoldMode);
145
146 (function() {
147
148 this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
149 this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
150
151 this.getFoldWidgetRange = function(session, foldStyle, row) {
152 var line = session.getLine(row);
153 var match = line.match(this.foldingStartMarker);
154 if (match) {
155 var i = match.index;
156
157 if (match[1])
158 return this.openingBracketBlock(session, match[1], row, i);
159
160 return session.getCommentFoldRange(row, i + match[0].length, 1);
161 }
162
163 if (foldStyle !== "markbeginend")
164 return;
165
166 var match = line.match(this.foldingStopMarker);
167 if (match) {
168 var i = match.index + match[0].length;
169
170 if (match[1])
171 return this.closingBracketBlock(session, match[1], row, i);
172
173 return session.getCommentFoldRange(row, i, -1);
174 }
175 };
176
177 }).call(FoldMode.prototype);
178
179 });
+0
-126
try/ace/mode-verilog.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/verilog', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/verilog_highlight_rules', 'ace/range'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var VerilogHighlightRules = require("./verilog_highlight_rules").VerilogHighlightRules;
37 var Range = require("../range").Range;
38
39 var Mode = function() {
40 this.$tokenizer = new Tokenizer(new VerilogHighlightRules().getRules());
41 };
42 oop.inherits(Mode, TextMode);
43
44 (function() {
45
46 this.lineCommentStart = "//";
47 this.blockComment = {start: "/*", end: "*/"};
48
49 }).call(Mode.prototype);
50
51 exports.Mode = Mode;
52
53 });
54
55
56 define('ace/mode/verilog_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
57
58
59 var oop = require("../lib/oop");
60 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
61
62 var VerilogHighlightRules = function() {
63 var keywords = "always|and|assign|automatic|begin|buf|bufif0|bufif1|case|casex|casez|cell|cmos|config|" +
64 "deassign|default|defparam|design|disable|edge|else|end|endcase|endconfig|endfunction|endgenerate|endmodule|" +
65 "endprimitive|endspecify|endtable|endtask|event|for|force|forever|fork|function|generate|genvar|highz0|" +
66 "highz1|if|ifnone|incdir|include|initial|inout|input|instance|integer|join|large|liblist|library|localparam|" +
67 "macromodule|medium|module|nand|negedge|nmos|nor|noshowcancelled|not|notif0|notif1|or|output|parameter|pmos|" +
68 "posedge|primitive|pull0|pull1|pulldown|pullup|pulsestyle_onevent|pulsestyle_ondetect|rcmos|real|realtime|" +
69 "reg|release|repeat|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|showcancelled|signed|small|specify|specparam|" +
70 "strong0|strong1|supply0|supply1|table|task|time|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|" +
71 "unsigned|use|vectored|wait|wand|weak0|weak1|while|wire|wor|xnor|xor" +
72 "begin|bufif0|bufif1|case|casex|casez|config|else|end|endcase|endconfig|endfunction|" +
73 "endgenerate|endmodule|endprimitive|endspecify|endtable|endtask|for|forever|function|generate|if|ifnone|" +
74 "macromodule|module|primitive|repeat|specify|table|task|while";
75
76 var builtinConstants = (
77 "true|false|null"
78 );
79
80 var builtinFunctions = (
81 "count|min|max|avg|sum|rank|now|coalesce|main"
82 );
83
84 var keywordMapper = this.createKeywordMapper({
85 "support.function": builtinFunctions,
86 "keyword": keywords,
87 "constant.language": builtinConstants
88 }, "identifier", true);
89
90 this.$rules = {
91 "start" : [ {
92 token : "comment",
93 regex : "//.*$"
94 }, {
95 token : "string", // " string
96 regex : '".*?"'
97 }, {
98 token : "string", // ' string
99 regex : "'.*?'"
100 }, {
101 token : "constant.numeric", // float
102 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
103 }, {
104 token : keywordMapper,
105 regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
106 }, {
107 token : "keyword.operator",
108 regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
109 }, {
110 token : "paren.lparen",
111 regex : "[\\(]"
112 }, {
113 token : "paren.rparen",
114 regex : "[\\)]"
115 }, {
116 token : "text",
117 regex : "\\s+"
118 } ]
119 };
120 };
121
122 oop.inherits(VerilogHighlightRules, TextHighlightRules);
123
124 exports.VerilogHighlightRules = VerilogHighlightRules;
125 });
+0
-788
try/ace/mode-xml.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
37 var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
38 var XmlFoldMode = require("./folding/xml").FoldMode;
39
40 var Mode = function() {
41 this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
42 this.$behaviour = new XmlBehaviour();
43 this.foldingRules = new XmlFoldMode();
44 };
45
46 oop.inherits(Mode, TextMode);
47
48 (function() {
49
50 this.blockComment = {start: "<!--", end: "-->"};
51
52 }).call(Mode.prototype);
53
54 exports.Mode = Mode;
55 });
56
57 define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
58
59
60 var oop = require("../lib/oop");
61 var xmlUtil = require("./xml_util");
62 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
63
64 var XmlHighlightRules = function() {
65 this.$rules = {
66 start : [
67 {token : "text", regex : "<\\!\\[CDATA\\[", next : "cdata"},
68 {token : "xml-pe", regex : "<\\?.*?\\?>"},
69 {token : "comment", regex : "<\\!--", next : "comment"},
70 {token : "xml-pe", regex : "<\\!.*?>"},
71 {token : "meta.tag", regex : "<\\/?", next : "tag"},
72 {token : "text", regex : "\\s+"},
73 {
74 token : "constant.character.entity",
75 regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
76 }
77 ],
78
79 cdata : [
80 {token : "text", regex : "\\]\\]>", next : "start"},
81 {token : "text", regex : "\\s+"},
82 {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"}
83 ],
84
85 comment : [
86 {token : "comment", regex : ".*?-->", next : "start"},
87 {token : "comment", regex : ".+"}
88 ]
89 };
90
91 xmlUtil.tag(this.$rules, "tag", "start");
92 };
93
94 oop.inherits(XmlHighlightRules, TextHighlightRules);
95
96 exports.XmlHighlightRules = XmlHighlightRules;
97 });
98
99 define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
100
101
102 function string(state) {
103 return [{
104 token : "string",
105 regex : '"',
106 next : state + "_qqstring"
107 }, {
108 token : "string",
109 regex : "'",
110 next : state + "_qstring"
111 }];
112 }
113
114 function multiLineString(quote, state) {
115 return [
116 {token : "string", regex : quote, next : state},
117 {
118 token : "constant.language.escape",
119 regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
120 },
121 {defaultToken : "string"}
122 ];
123 }
124
125 exports.tag = function(states, name, nextState, tagMap) {
126 states[name] = [{
127 token : "text",
128 regex : "\\s+"
129 }, {
130
131 token : !tagMap ? "meta.tag.tag-name" : function(value) {
132 if (tagMap[value])
133 return "meta.tag.tag-name." + tagMap[value];
134 else
135 return "meta.tag.tag-name";
136 },
137 regex : "[-_a-zA-Z0-9:]+",
138 next : name + "_embed_attribute_list"
139 }, {
140 token: "empty",
141 regex: "",
142 next : name + "_embed_attribute_list"
143 }];
144
145 states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
146 states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
147
148 states[name + "_embed_attribute_list"] = [{
149 token : "meta.tag.r",
150 regex : "/?>",
151 next : nextState
152 }, {
153 token : "keyword.operator",
154 regex : "="
155 }, {
156 token : "entity.other.attribute-name",
157 regex : "[-_a-zA-Z0-9:]+"
158 }, {
159 token : "constant.numeric", // float
160 regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
161 }, {
162 token : "text",
163 regex : "\\s+"
164 }].concat(string(name));
165 };
166
167 });
168
169 define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
170
171
172 var oop = require("../../lib/oop");
173 var Behaviour = require("../behaviour").Behaviour;
174 var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
175 var TokenIterator = require("../../token_iterator").TokenIterator;
176
177 function hasType(token, type) {
178 var hasType = true;
179 var typeList = token.type.split('.');
180 var needleList = type.split('.');
181 needleList.forEach(function(needle){
182 if (typeList.indexOf(needle) == -1) {
183 hasType = false;
184 return false;
185 }
186 });
187 return hasType;
188 }
189
190 var XmlBehaviour = function () {
191
192 this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
193
194 this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
195 if (text == '>') {
196 var position = editor.getCursorPosition();
197 var iterator = new TokenIterator(session, position.row, position.column);
198 var token = iterator.getCurrentToken();
199 var atCursor = false;
200 if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
201 do {
202 token = iterator.stepBackward();
203 } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
204 } else {
205 atCursor = true;
206 }
207 if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
208 return
209 }
210 var tag = token.value;
211 if (atCursor){
212 var tag = tag.substring(0, position.column - token.start);
213 }
214
215 return {
216 text: '>' + '</' + tag + '>',
217 selection: [1, 1]
218 }
219 }
220 });
221
222 this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
223 if (text == "\n") {
224 var cursor = editor.getCursorPosition();
225 var line = session.doc.getLine(cursor.row);
226 var rightChars = line.substring(cursor.column, cursor.column + 2);
227 if (rightChars == '</') {
228 var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
229 var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
230
231 return {
232 text: '\n' + indent + '\n' + next_indent,
233 selection: [1, indent.length, 1, indent.length]
234 }
235 }
236 }
237 });
238
239 }
240 oop.inherits(XmlBehaviour, Behaviour);
241
242 exports.XmlBehaviour = XmlBehaviour;
243 });
244
245 define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
246
247
248 var oop = require("../../lib/oop");
249 var Behaviour = require("../behaviour").Behaviour;
250 var TokenIterator = require("../../token_iterator").TokenIterator;
251 var lang = require("../../lib/lang");
252
253 var SAFE_INSERT_IN_TOKENS =
254 ["text", "paren.rparen", "punctuation.operator"];
255 var SAFE_INSERT_BEFORE_TOKENS =
256 ["text", "paren.rparen", "punctuation.operator", "comment"];
257
258
259 var autoInsertedBrackets = 0;
260 var autoInsertedRow = -1;
261 var autoInsertedLineEnd = "";
262 var maybeInsertedBrackets = 0;
263 var maybeInsertedRow = -1;
264 var maybeInsertedLineStart = "";
265 var maybeInsertedLineEnd = "";
266
267 var CstyleBehaviour = function () {
268
269 CstyleBehaviour.isSaneInsertion = function(editor, session) {
270 var cursor = editor.getCursorPosition();
271 var iterator = new TokenIterator(session, cursor.row, cursor.column);
272 if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
273 var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
274 if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
275 return false;
276 }
277 iterator.stepForward();
278 return iterator.getCurrentTokenRow() !== cursor.row ||
279 this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
280 };
281
282 CstyleBehaviour.$matchTokenType = function(token, types) {
283 return types.indexOf(token.type || token) > -1;
284 };
285
286 CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
287 var cursor = editor.getCursorPosition();
288 var line = session.doc.getLine(cursor.row);
289 if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
290 autoInsertedBrackets = 0;
291 autoInsertedRow = cursor.row;
292 autoInsertedLineEnd = bracket + line.substr(cursor.column);
293 autoInsertedBrackets++;
294 };
295
296 CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
297 var cursor = editor.getCursorPosition();
298 var line = session.doc.getLine(cursor.row);
299 if (!this.isMaybeInsertedClosing(cursor, line))
300 maybeInsertedBrackets = 0;
301 maybeInsertedRow = cursor.row;
302 maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
303 maybeInsertedLineEnd = line.substr(cursor.column);
304 maybeInsertedBrackets++;
305 };
306
307 CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
308 return autoInsertedBrackets > 0 &&
309 cursor.row === autoInsertedRow &&
310 bracket === autoInsertedLineEnd[0] &&
311 line.substr(cursor.column) === autoInsertedLineEnd;
312 };
313
314 CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
315 return maybeInsertedBrackets > 0 &&
316 cursor.row === maybeInsertedRow &&
317 line.substr(cursor.column) === maybeInsertedLineEnd &&
318 line.substr(0, cursor.column) == maybeInsertedLineStart;
319 };
320
321 CstyleBehaviour.popAutoInsertedClosing = function() {
322 autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
323 autoInsertedBrackets--;
324 };
325
326 CstyleBehaviour.clearMaybeInsertedClosing = function() {
327 maybeInsertedBrackets = 0;
328 maybeInsertedRow = -1;
329 };
330
331 this.add("braces", "insertion", function (state, action, editor, session, text) {
332 var cursor = editor.getCursorPosition();
333 var line = session.doc.getLine(cursor.row);
334 if (text == '{') {
335 var selection = editor.getSelectionRange();
336 var selected = session.doc.getTextRange(selection);
337 if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
338 return {
339 text: '{' + selected + '}',
340 selection: false
341 };
342 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
343 if (/[\]\}\)]/.test(line[cursor.column])) {
344 CstyleBehaviour.recordAutoInsert(editor, session, "}");
345 return {
346 text: '{}',
347 selection: [1, 1]
348 };
349 } else {
350 CstyleBehaviour.recordMaybeInsert(editor, session, "{");
351 return {
352 text: '{',
353 selection: [1, 1]
354 };
355 }
356 }
357 } else if (text == '}') {
358 var rightChar = line.substring(cursor.column, cursor.column + 1);
359 if (rightChar == '}') {
360 var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
361 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
362 CstyleBehaviour.popAutoInsertedClosing();
363 return {
364 text: '',
365 selection: [1, 1]
366 };
367 }
368 }
369 } else if (text == "\n" || text == "\r\n") {
370 var closing = "";
371 if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
372 closing = lang.stringRepeat("}", maybeInsertedBrackets);
373 CstyleBehaviour.clearMaybeInsertedClosing();
374 }
375 var rightChar = line.substring(cursor.column, cursor.column + 1);
376 if (rightChar == '}' || closing !== "") {
377 var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
378 if (!openBracePos)
379 return null;
380
381 var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
382 var next_indent = this.$getIndent(line);
383
384 return {
385 text: '\n' + indent + '\n' + next_indent + closing,
386 selection: [1, indent.length, 1, indent.length]
387 };
388 }
389 }
390 });
391
392 this.add("braces", "deletion", function (state, action, editor, session, range) {
393 var selected = session.doc.getTextRange(range);
394 if (!range.isMultiLine() && selected == '{') {
395 var line = session.doc.getLine(range.start.row);
396 var rightChar = line.substring(range.end.column, range.end.column + 1);
397 if (rightChar == '}') {
398 range.end.column++;
399 return range;
400 } else {
401 maybeInsertedBrackets--;
402 }
403 }
404 });
405
406 this.add("parens", "insertion", function (state, action, editor, session, text) {
407 if (text == '(') {
408 var selection = editor.getSelectionRange();
409 var selected = session.doc.getTextRange(selection);
410 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
411 return {
412 text: '(' + selected + ')',
413 selection: false
414 };
415 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
416 CstyleBehaviour.recordAutoInsert(editor, session, ")");
417 return {
418 text: '()',
419 selection: [1, 1]
420 };
421 }
422 } else if (text == ')') {
423 var cursor = editor.getCursorPosition();
424 var line = session.doc.getLine(cursor.row);
425 var rightChar = line.substring(cursor.column, cursor.column + 1);
426 if (rightChar == ')') {
427 var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
428 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
429 CstyleBehaviour.popAutoInsertedClosing();
430 return {
431 text: '',
432 selection: [1, 1]
433 };
434 }
435 }
436 }
437 });
438
439 this.add("parens", "deletion", function (state, action, editor, session, range) {
440 var selected = session.doc.getTextRange(range);
441 if (!range.isMultiLine() && selected == '(') {
442 var line = session.doc.getLine(range.start.row);
443 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
444 if (rightChar == ')') {
445 range.end.column++;
446 return range;
447 }
448 }
449 });
450
451 this.add("brackets", "insertion", function (state, action, editor, session, text) {
452 if (text == '[') {
453 var selection = editor.getSelectionRange();
454 var selected = session.doc.getTextRange(selection);
455 if (selected !== "" && editor.getWrapBehavioursEnabled()) {
456 return {
457 text: '[' + selected + ']',
458 selection: false
459 };
460 } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
461 CstyleBehaviour.recordAutoInsert(editor, session, "]");
462 return {
463 text: '[]',
464 selection: [1, 1]
465 };
466 }
467 } else if (text == ']') {
468 var cursor = editor.getCursorPosition();
469 var line = session.doc.getLine(cursor.row);
470 var rightChar = line.substring(cursor.column, cursor.column + 1);
471 if (rightChar == ']') {
472 var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
473 if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
474 CstyleBehaviour.popAutoInsertedClosing();
475 return {
476 text: '',
477 selection: [1, 1]
478 };
479 }
480 }
481 }
482 });
483
484 this.add("brackets", "deletion", function (state, action, editor, session, range) {
485 var selected = session.doc.getTextRange(range);
486 if (!range.isMultiLine() && selected == '[') {
487 var line = session.doc.getLine(range.start.row);
488 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
489 if (rightChar == ']') {
490 range.end.column++;
491 return range;
492 }
493 }
494 });
495
496 this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
497 if (text == '"' || text == "'") {
498 var quote = text;
499 var selection = editor.getSelectionRange();
500 var selected = session.doc.getTextRange(selection);
501 if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
502 return {
503 text: quote + selected + quote,
504 selection: false
505 };
506 } else {
507 var cursor = editor.getCursorPosition();
508 var line = session.doc.getLine(cursor.row);
509 var leftChar = line.substring(cursor.column-1, cursor.column);
510 if (leftChar == '\\') {
511 return null;
512 }
513 var tokens = session.getTokens(selection.start.row);
514 var col = 0, token;
515 var quotepos = -1; // Track whether we're inside an open quote.
516
517 for (var x = 0; x < tokens.length; x++) {
518 token = tokens[x];
519 if (token.type == "string") {
520 quotepos = -1;
521 } else if (quotepos < 0) {
522 quotepos = token.value.indexOf(quote);
523 }
524 if ((token.value.length + col) > selection.start.column) {
525 break;
526 }
527 col += tokens[x].value.length;
528 }
529 if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
530 if (!CstyleBehaviour.isSaneInsertion(editor, session))
531 return;
532 return {
533 text: quote + quote,
534 selection: [1,1]
535 };
536 } else if (token && token.type === "string") {
537 var rightChar = line.substring(cursor.column, cursor.column + 1);
538 if (rightChar == quote) {
539 return {
540 text: '',
541 selection: [1, 1]
542 };
543 }
544 }
545 }
546 }
547 });
548
549 this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
550 var selected = session.doc.getTextRange(range);
551 if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
552 var line = session.doc.getLine(range.start.row);
553 var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
554 if (rightChar == selected) {
555 range.end.column++;
556 return range;
557 }
558 }
559 });
560
561 };
562
563 oop.inherits(CstyleBehaviour, Behaviour);
564
565 exports.CstyleBehaviour = CstyleBehaviour;
566 });
567
568 define('ace/mode/folding/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/range', 'ace/mode/folding/fold_mode', 'ace/token_iterator'], function(require, exports, module) {
569
570
571 var oop = require("../../lib/oop");
572 var lang = require("../../lib/lang");
573 var Range = require("../../range").Range;
574 var BaseFoldMode = require("./fold_mode").FoldMode;
575 var TokenIterator = require("../../token_iterator").TokenIterator;
576
577 var FoldMode = exports.FoldMode = function(voidElements) {
578 BaseFoldMode.call(this);
579 this.voidElements = voidElements || {};
580 };
581 oop.inherits(FoldMode, BaseFoldMode);
582
583 (function() {
584
585 this.getFoldWidget = function(session, foldStyle, row) {
586 var tag = this._getFirstTagInLine(session, row);
587
588 if (tag.closing)
589 return foldStyle == "markbeginend" ? "end" : "";
590
591 if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
592 return "";
593
594 if (tag.selfClosing)
595 return "";
596
597 if (tag.value.indexOf("/" + tag.tagName) !== -1)
598 return "";
599
600 return "start";
601 };
602
603 this._getFirstTagInLine = function(session, row) {
604 var tokens = session.getTokens(row);
605 var value = "";
606 for (var i = 0; i < tokens.length; i++) {
607 var token = tokens[i];
608 if (token.type.indexOf("meta.tag") === 0)
609 value += token.value;
610 else
611 value += lang.stringRepeat(" ", token.value.length);
612 }
613
614 return this._parseTag(value);
615 };
616
617 this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
618 this._parseTag = function(tag) {
619
620 var match = tag.match(this.tagRe);
621 var column = 0;
622
623 return {
624 value: tag,
625 match: match ? match[2] : "",
626 closing: match ? !!match[3] : false,
627 selfClosing: match ? !!match[5] || match[2] == "/>" : false,
628 tagName: match ? match[4] : "",
629 column: match[1] ? column + match[1].length : column
630 };
631 };
632 this._readTagForward = function(iterator) {
633 var token = iterator.getCurrentToken();
634 if (!token)
635 return null;
636
637 var value = "";
638 var start;
639
640 do {
641 if (token.type.indexOf("meta.tag") === 0) {
642 if (!start) {
643 var start = {
644 row: iterator.getCurrentTokenRow(),
645 column: iterator.getCurrentTokenColumn()
646 };
647 }
648 value += token.value;
649 if (value.indexOf(">") !== -1) {
650 var tag = this._parseTag(value);
651 tag.start = start;
652 tag.end = {
653 row: iterator.getCurrentTokenRow(),
654 column: iterator.getCurrentTokenColumn() + token.value.length
655 };
656 iterator.stepForward();
657 return tag;
658 }
659 }
660 } while(token = iterator.stepForward());
661
662 return null;
663 };
664
665 this._readTagBackward = function(iterator) {
666 var token = iterator.getCurrentToken();
667 if (!token)
668 return null;
669
670 var value = "";
671 var end;
672
673 do {
674 if (token.type.indexOf("meta.tag") === 0) {
675 if (!end) {
676 end = {
677 row: iterator.getCurrentTokenRow(),
678 column: iterator.getCurrentTokenColumn() + token.value.length
679 };
680 }
681 value = token.value + value;
682 if (value.indexOf("<") !== -1) {
683 var tag = this._parseTag(value);
684 tag.end = end;
685 tag.start = {
686 row: iterator.getCurrentTokenRow(),
687 column: iterator.getCurrentTokenColumn()
688 };
689 iterator.stepBackward();
690 return tag;
691 }
692 }
693 } while(token = iterator.stepBackward());
694
695 return null;
696 };
697
698 this._pop = function(stack, tag) {
699 while (stack.length) {
700
701 var top = stack[stack.length-1];
702 if (!tag || top.tagName == tag.tagName) {
703 return stack.pop();
704 }
705 else if (this.voidElements[tag.tagName]) {
706 return;
707 }
708 else if (this.voidElements[top.tagName]) {
709 stack.pop();
710 continue;
711 } else {
712 return null;
713 }
714 }
715 };
716
717 this.getFoldWidgetRange = function(session, foldStyle, row) {
718 var firstTag = this._getFirstTagInLine(session, row);
719
720 if (!firstTag.match)
721 return null;
722
723 var isBackward = firstTag.closing || firstTag.selfClosing;
724 var stack = [];
725 var tag;
726
727 if (!isBackward) {
728 var iterator = new TokenIterator(session, row, firstTag.column);
729 var start = {
730 row: row,
731 column: firstTag.column + firstTag.tagName.length + 2
732 };
733 while (tag = this._readTagForward(iterator)) {
734 if (tag.selfClosing) {
735 if (!stack.length) {
736 tag.start.column += tag.tagName.length + 2;
737 tag.end.column -= 2;
738 return Range.fromPoints(tag.start, tag.end);
739 } else
740 continue;
741 }
742
743 if (tag.closing) {
744 this._pop(stack, tag);
745 if (stack.length == 0)
746 return Range.fromPoints(start, tag.start);
747 }
748 else {
749 stack.push(tag)
750 }
751 }
752 }
753 else {
754 var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
755 var end = {
756 row: row,
757 column: firstTag.column
758 };
759
760 while (tag = this._readTagBackward(iterator)) {
761 if (tag.selfClosing) {
762 if (!stack.length) {
763 tag.start.column += tag.tagName.length + 2;
764 tag.end.column -= 2;
765 return Range.fromPoints(tag.start, tag.end);
766 } else
767 continue;
768 }
769
770 if (!tag.closing) {
771 this._pop(stack, tag);
772 if (stack.length == 0) {
773 tag.start.column += tag.tagName.length + 2;
774 return Range.fromPoints(tag.start, end);
775 }
776 }
777 else {
778 stack.push(tag)
779 }
780 }
781 }
782
783 };
784
785 }).call(FoldMode.prototype);
786
787 });
+0
-289
try/ace/mode-yaml.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/mode/yaml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/yaml_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/coffee'], function(require, exports, module) {
31
32
33 var oop = require("../lib/oop");
34 var TextMode = require("./text").Mode;
35 var Tokenizer = require("../tokenizer").Tokenizer;
36 var YamlHighlightRules = require("./yaml_highlight_rules").YamlHighlightRules;
37 var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38 var FoldMode = require("./folding/coffee").FoldMode;
39
40 var Mode = function() {
41 this.$tokenizer = new Tokenizer(new YamlHighlightRules().getRules());
42 this.$outdent = new MatchingBraceOutdent();
43 this.foldingRules = new FoldMode();
44 };
45 oop.inherits(Mode, TextMode);
46
47 (function() {
48
49 this.lineCommentStart = "#";
50
51 this.getNextLineIndent = function(state, line, tab) {
52 var indent = this.$getIndent(line);
53
54 if (state == "start") {
55 var match = line.match(/^.*[\{\(\[]\s*$/);
56 if (match) {
57 indent += tab;
58 }
59 }
60
61 return indent;
62 };
63
64 this.checkOutdent = function(state, line, input) {
65 return this.$outdent.checkOutdent(line, input);
66 };
67
68 this.autoOutdent = function(state, doc, row) {
69 this.$outdent.autoOutdent(doc, row);
70 };
71
72
73 }).call(Mode.prototype);
74
75 exports.Mode = Mode;
76
77 });
78
79 define('ace/mode/yaml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
80
81
82 var oop = require("../lib/oop");
83 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
84
85 var YamlHighlightRules = function() {
86 this.$rules = {
87 "start" : [
88 {
89 token : "comment",
90 regex : "#.*$"
91 }, {
92 token : "list.markup",
93 regex : /^(?:-{3}|\.{3})\s*(?=#|$)/
94 }, {
95 token : "list.markup",
96 regex : /^\s*[\-?](?:$|\s)/
97 }, {
98 token: "constant",
99 regex: "!![\\w//]+"
100 }, {
101 token: "constant.language",
102 regex: "[&\\*][a-zA-Z0-9-_]+"
103 }, {
104 token: ["meta.tag", "keyword"],
105 regex: /^(\s*\w.*?)(\:(?:\s+|$))/
106 },{
107 token: ["meta.tag", "keyword"],
108 regex: /(\w+?)(\s*\:(?:\s+|$))/
109 }, {
110 token : "keyword.operator",
111 regex : "<<\\w*:\\w*"
112 }, {
113 token : "keyword.operator",
114 regex : "-\\s*(?=[{])"
115 }, {
116 token : "string", // single line
117 regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
118 }, {
119 token : "string", // multi line string start
120 regex : '[\\|>]\\w*',
121 next : "qqstring"
122 }, {
123 token : "string", // single quoted string
124 regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
125 }, {
126 token : "constant.numeric", // float
127 regex : /[+\-]?[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?\b/
128 }, {
129 token : "constant.numeric", // other number
130 regex : /[+\-]?\.inf\b|NaN\b|0x[\dA-Fa-f_]+|0b[10_]+/
131 }, {
132 token : "constant.language.boolean",
133 regex : "(?:true|false|TRUE|FALSE|True|False|yes|no)\\b"
134 }, {
135 token : "invalid.illegal", // comments are not allowed
136 regex : "\\/\\/.*$"
137 }, {
138 token : "paren.lparen",
139 regex : "[[({]"
140 }, {
141 token : "paren.rparen",
142 regex : "[\\])}]"
143 }
144 ],
145 "qqstring" : [
146 {
147 token : "string",
148 regex : '(?=(?:(?:\\\\.)|(?:[^:]))*?:)',
149 next : "start"
150 }, {
151 token : "string",
152 regex : '.+'
153 }
154 ]};
155
156 };
157
158 oop.inherits(YamlHighlightRules, TextHighlightRules);
159
160 exports.YamlHighlightRules = YamlHighlightRules;
161 });
162
163 define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
164
165
166 var Range = require("../range").Range;
167
168 var MatchingBraceOutdent = function() {};
169
170 (function() {
171
172 this.checkOutdent = function(line, input) {
173 if (! /^\s+$/.test(line))
174 return false;
175
176 return /^\s*\}/.test(input);
177 };
178
179 this.autoOutdent = function(doc, row) {
180 var line = doc.getLine(row);
181 var match = line.match(/^(\s*\})/);
182
183 if (!match) return 0;
184
185 var column = match[1].length;
186 var openBracePos = doc.findMatchingBracket({row: row, column: column});
187
188 if (!openBracePos || openBracePos.row == row) return 0;
189
190 var indent = this.$getIndent(doc.getLine(openBracePos.row));
191 doc.replace(new Range(row, 0, row, column-1), indent);
192 };
193
194 this.$getIndent = function(line) {
195 return line.match(/^\s*/)[0];
196 };
197
198 }).call(MatchingBraceOutdent.prototype);
199
200 exports.MatchingBraceOutdent = MatchingBraceOutdent;
201 });
202
203 define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
204
205
206 var oop = require("../../lib/oop");
207 var BaseFoldMode = require("./fold_mode").FoldMode;
208 var Range = require("../../range").Range;
209
210 var FoldMode = exports.FoldMode = function() {};
211 oop.inherits(FoldMode, BaseFoldMode);
212
213 (function() {
214
215 this.getFoldWidgetRange = function(session, foldStyle, row) {
216 var range = this.indentationBlock(session, row);
217 if (range)
218 return range;
219
220 var re = /\S/;
221 var line = session.getLine(row);
222 var startLevel = line.search(re);
223 if (startLevel == -1 || line[startLevel] != "#")
224 return;
225
226 var startColumn = line.length;
227 var maxRow = session.getLength();
228 var startRow = row;
229 var endRow = row;
230
231 while (++row < maxRow) {
232 line = session.getLine(row);
233 var level = line.search(re);
234
235 if (level == -1)
236 continue;
237
238 if (line[level] != "#")
239 break;
240
241 endRow = row;
242 }
243
244 if (endRow > startRow) {
245 var endColumn = session.getLine(endRow).length;
246 return new Range(startRow, startColumn, endRow, endColumn);
247 }
248 };
249 this.getFoldWidget = function(session, foldStyle, row) {
250 var line = session.getLine(row);
251 var indent = line.search(/\S/);
252 var next = session.getLine(row + 1);
253 var prev = session.getLine(row - 1);
254 var prevIndent = prev.search(/\S/);
255 var nextIndent = next.search(/\S/);
256
257 if (indent == -1) {
258 session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
259 return "";
260 }
261 if (prevIndent == -1) {
262 if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
263 session.foldWidgets[row - 1] = "";
264 session.foldWidgets[row + 1] = "";
265 return "start";
266 }
267 } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
268 if (session.getLine(row - 2).search(/\S/) == -1) {
269 session.foldWidgets[row - 1] = "start";
270 session.foldWidgets[row + 1] = "";
271 return "";
272 }
273 }
274
275 if (prevIndent!= -1 && prevIndent < indent)
276 session.foldWidgets[row - 1] = "start";
277 else
278 session.foldWidgets[row - 1] = "";
279
280 if (indent < nextIndent)
281 return "start";
282 else
283 return "";
284 };
285
286 }).call(FoldMode.prototype);
287
288 });
+0
-179
try/ace/theme-chaos.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright 2011 Irakli Gozalishvili. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
21 * ***** END LICENSE BLOCK ***** */
22
23 define('ace/theme/chaos', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
24
25 exports.isDark = true;
26 exports.cssClass = "ace-chaos";
27 exports.cssText = ".ace-chaos .ace_gutter {\
28 background: #141414;\
29 color: #595959;\
30 border-right: 1px solid #282828;\
31 }\
32 .ace-chaos .ace_gutter-cell.ace_warning {\
33 background-image: none;\
34 background: #FC0;\
35 border-left: none;\
36 padding-left: 0;\
37 color: #000;\
38 }\
39 .ace-chaos .ace_gutter-cell.ace_error {\
40 background-position: -6px center;\
41 background-image: none;\
42 background: #F10;\
43 border-left: none;\
44 padding-left: 0;\
45 color: #000;\
46 }\
47 .ace-chaos .ace_print-margin {\
48 border-left: 1px solid #555;\
49 right: 0;\
50 background: #1D1D1D;\
51 }\
52 .ace-chaos {\
53 background-color: #161616;\
54 color: #E6E1DC;\
55 }\
56 .ace-chaos .ace_cursor {\
57 border-left: 2px solid #FFFFFF;\
58 }\
59 .ace-chaos .ace_cursor.ace_overwrite {\
60 border-left: 0px;\
61 border-bottom: 1px solid #FFFFFF;\
62 }\
63 .ace-chaos .ace_marker-layer .ace_selection {\
64 background: #494836;\
65 }\
66 .ace-chaos .ace_marker-layer .ace_step {\
67 background: rgb(198, 219, 174);\
68 }\
69 .ace-chaos .ace_marker-layer .ace_bracket {\
70 margin: -1px 0 0 -1px;\
71 border: 1px solid #FCE94F;\
72 }\
73 .ace-chaos .ace_marker-layer .ace_active-line {\
74 background: #333;\
75 }\
76 .ace-chaos .ace_gutter-active-line {\
77 background-color: #222;\
78 }\
79 .ace-chaos .ace_invisible {\
80 color: #404040;\
81 }\
82 .ace-chaos .ace_keyword {\
83 color:#00698F;\
84 }\
85 .ace-chaos .ace_keyword.ace_operator {\
86 color:#FF308F;\
87 }\
88 .ace-chaos .ace_constant {\
89 color:#1EDAFB;\
90 }\
91 .ace-chaos .ace_constant.ace_language {\
92 color:#FDC251;\
93 }\
94 .ace-chaos .ace_constant.ace_library {\
95 color:#8DFF0A;\
96 }\
97 .ace-chaos .ace_constant.ace_numeric {\
98 color:#58C554;\
99 }\
100 .ace-chaos .ace_invalid {\
101 color:#FFFFFF;\
102 background-color:#990000;\
103 }\
104 .ace-chaos .ace_invalid.ace_deprecated {\
105 color:#FFFFFF;\
106 background-color:#990000;\
107 }\
108 .ace-chaos .ace_support {\
109 color: #999;\
110 }\
111 .ace-chaos .ace_support.ace_function {\
112 color:#00AEEF;\
113 }\
114 .ace-chaos .ace_function {\
115 color:#00AEEF;\
116 }\
117 .ace-chaos .ace_string {\
118 color:#58C554;\
119 }\
120 .ace-chaos .ace_comment {\
121 color:#555;\
122 font-style:italic;\
123 padding-bottom: 0px;\
124 }\
125 .ace-chaos .ace_variable {\
126 color:#997744;\
127 }\
128 .ace-chaos .ace_meta.ace_tag {\
129 color:#BE53E6;\
130 }\
131 .ace-chaos .ace_entity.ace_other.ace_attribute-name {\
132 color:#FFFF89;\
133 }\
134 .ace-chaos .ace_markup.ace_underline {\
135 text-decoration: underline;\
136 }\
137 .ace-chaos .ace_fold-widget {\
138 text-align: center;\
139 }\
140 .ace-chaos .ace_fold-widget:hover {\
141 color: #777;\
142 }\
143 .ace-chaos .ace_fold-widget.ace_start,\
144 .ace-chaos .ace_fold-widget.ace_end,\
145 .ace-chaos .ace_fold-widget.ace_closed{\
146 background: none;\
147 border: none;\
148 box-shadow: none;\
149 }\
150 .ace-chaos .ace_fold-widget.ace_start:after {\
151 content: '▾'\
152 }\
153 .ace-chaos .ace_fold-widget.ace_end:after {\
154 content: '▴'\
155 }\
156 .ace-chaos .ace_fold-widget.ace_closed:after {\
157 content: '‣'\
158 }\
159 .ace-chaos .ace_indent-guide {\
160 border-right:1px dotted #333;\
161 margin-right:-1px;\
162 }\
163 .ace-chaos .ace_fold { \
164 background: #222; \
165 border-radius: 3px; \
166 color: #7AF; \
167 border: none; \
168 }\
169 .ace-chaos .ace_fold:hover {\
170 background: #CCC; \
171 color: #000;\
172 }\
173 ";
174
175 var dom = require("../lib/dom");
176 dom.importCssString(exports.cssText, exports.cssClass);
177
178 });
+0
-161
try/ace/theme-chrome.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/chrome', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = false;
33 exports.cssClass = "ace-chrome";
34 exports.cssText = ".ace-chrome .ace_gutter {\
35 background: #ebebeb;\
36 color: #333;\
37 overflow : hidden;\
38 }\
39 .ace-chrome .ace_print-margin {\
40 width: 1px;\
41 background: #e8e8e8;\
42 }\
43 .ace-chrome {\
44 background-color: #FFFFFF;\
45 }\
46 .ace-chrome .ace_cursor {\
47 border-left: 2px solid black;\
48 }\
49 .ace-chrome .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid black;\
52 }\
53 .ace-chrome .ace_invisible {\
54 color: rgb(191, 191, 191);\
55 }\
56 .ace-chrome .ace_constant.ace_buildin {\
57 color: rgb(88, 72, 246);\
58 }\
59 .ace-chrome .ace_constant.ace_language {\
60 color: rgb(88, 92, 246);\
61 }\
62 .ace-chrome .ace_constant.ace_library {\
63 color: rgb(6, 150, 14);\
64 }\
65 .ace-chrome .ace_invalid {\
66 background-color: rgb(153, 0, 0);\
67 color: white;\
68 }\
69 .ace-chrome .ace_fold {\
70 }\
71 .ace-chrome .ace_support.ace_function {\
72 color: rgb(60, 76, 114);\
73 }\
74 .ace-chrome .ace_support.ace_constant {\
75 color: rgb(6, 150, 14);\
76 }\
77 .ace-chrome .ace_support.ace_type,\
78 .ace-chrome .ace_support.ace_class\
79 .ace-chrome .ace_support.ace_other {\
80 color: rgb(109, 121, 222);\
81 }\
82 .ace-chrome .ace_variable.ace_parameter {\
83 font-style:italic;\
84 color:#FD971F;\
85 }\
86 .ace-chrome .ace_keyword.ace_operator {\
87 color: rgb(104, 118, 135);\
88 }\
89 .ace-chrome .ace_comment {\
90 color: #236e24;\
91 }\
92 .ace-chrome .ace_comment.ace_doc {\
93 color: #236e24;\
94 }\
95 .ace-chrome .ace_comment.ace_doc.ace_tag {\
96 color: #236e24;\
97 }\
98 .ace-chrome .ace_constant.ace_numeric {\
99 color: rgb(0, 0, 205);\
100 }\
101 .ace-chrome .ace_variable {\
102 color: rgb(49, 132, 149);\
103 }\
104 .ace-chrome .ace_xml-pe {\
105 color: rgb(104, 104, 91);\
106 }\
107 .ace-chrome .ace_entity.ace_name.ace_function {\
108 color: #0000A2;\
109 }\
110 .ace-chrome .ace_markup.ace_heading {\
111 color: rgb(12, 7, 255);\
112 }\
113 .ace-chrome .ace_markup.ace_list {\
114 color:rgb(185, 6, 144);\
115 }\
116 .ace-chrome .ace_marker-layer .ace_selection {\
117 background: rgb(181, 213, 255);\
118 }\
119 .ace-chrome .ace_marker-layer .ace_step {\
120 background: rgb(252, 255, 0);\
121 }\
122 .ace-chrome .ace_marker-layer .ace_stack {\
123 background: rgb(164, 229, 101);\
124 }\
125 .ace-chrome .ace_marker-layer .ace_bracket {\
126 margin: -1px 0 0 -1px;\
127 border: 1px solid rgb(192, 192, 192);\
128 }\
129 .ace-chrome .ace_marker-layer .ace_active-line {\
130 background: rgba(0, 0, 0, 0.07);\
131 }\
132 .ace-chrome .ace_gutter-active-line {\
133 background-color : #dcdcdc;\
134 }\
135 .ace-chrome .ace_marker-layer .ace_selected-word {\
136 background: rgb(250, 250, 255);\
137 border: 1px solid rgb(200, 200, 250);\
138 }\
139 .ace-chrome .ace_storage,\
140 .ace-chrome .ace_keyword,\
141 .ace-chrome .ace_meta.ace_tag {\
142 color: rgb(147, 15, 128);\
143 }\
144 .ace-chrome .ace_string.ace_regex {\
145 color: rgb(255, 0, 0)\
146 }\
147 .ace-chrome .ace_string {\
148 color: #1A1AA6;\
149 }\
150 .ace-chrome .ace_entity.ace_other.ace_attribute-name {\
151 color: #994409;\
152 }\
153 .ace-chrome .ace_indent-guide {\
154 background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
155 }\
156 ";
157
158 var dom = require("../lib/dom");
159 dom.importCssString(exports.cssText, exports.cssClass);
160 });
+0
-133
try/ace/theme-clouds.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/clouds', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = false;
33 exports.cssClass = "ace-clouds";
34 exports.cssText = ".ace-clouds .ace_gutter {\
35 background: #ebebeb;\
36 color: #333\
37 }\
38 .ace-clouds .ace_print-margin {\
39 width: 1px;\
40 background: #e8e8e8\
41 }\
42 .ace-clouds {\
43 background-color: #FFFFFF;\
44 color: #000000\
45 }\
46 .ace-clouds .ace_cursor {\
47 border-left: 2px solid #000000\
48 }\
49 .ace-clouds .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #000000\
52 }\
53 .ace-clouds .ace_marker-layer .ace_selection {\
54 background: #BDD5FC\
55 }\
56 .ace-clouds.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #FFFFFF;\
58 border-radius: 2px\
59 }\
60 .ace-clouds .ace_marker-layer .ace_step {\
61 background: rgb(255, 255, 0)\
62 }\
63 .ace-clouds .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid #BFBFBF\
66 }\
67 .ace-clouds .ace_marker-layer .ace_active-line {\
68 background: #FFFBD1\
69 }\
70 .ace-clouds .ace_gutter-active-line {\
71 background-color : #dcdcdc\
72 }\
73 .ace-clouds .ace_marker-layer .ace_selected-word {\
74 border: 1px solid #BDD5FC\
75 }\
76 .ace-clouds .ace_invisible {\
77 color: #BFBFBF\
78 }\
79 .ace-clouds .ace_keyword,\
80 .ace-clouds .ace_meta,\
81 .ace-clouds .ace_support.ace_constant.ace_property-value {\
82 color: #AF956F\
83 }\
84 .ace-clouds .ace_keyword.ace_operator {\
85 color: #484848\
86 }\
87 .ace-clouds .ace_keyword.ace_other.ace_unit {\
88 color: #96DC5F\
89 }\
90 .ace-clouds .ace_constant.ace_language {\
91 color: #39946A\
92 }\
93 .ace-clouds .ace_constant.ace_numeric {\
94 color: #46A609\
95 }\
96 .ace-clouds .ace_constant.ace_character.ace_entity {\
97 color: #BF78CC\
98 }\
99 .ace-clouds .ace_invalid {\
100 background-color: #FF002A\
101 }\
102 .ace-clouds .ace_fold {\
103 background-color: #AF956F;\
104 border-color: #000000\
105 }\
106 .ace-clouds .ace_storage,\
107 .ace-clouds .ace_support.ace_class,\
108 .ace-clouds .ace_support.ace_function,\
109 .ace-clouds .ace_support.ace_other,\
110 .ace-clouds .ace_support.ace_type {\
111 color: #C52727\
112 }\
113 .ace-clouds .ace_string {\
114 color: #5D90CD\
115 }\
116 .ace-clouds .ace_comment {\
117 color: #BCC8BA\
118 }\
119 .ace-clouds .ace_entity.ace_name.ace_tag,\
120 .ace-clouds .ace_entity.ace_other.ace_attribute-name {\
121 color: #606060\
122 }\
123 .ace-clouds .ace_markup.ace_underline {\
124 text-decoration: underline\
125 }\
126 .ace-clouds .ace_indent-guide {\
127 background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y\
128 }";
129
130 var dom = require("../lib/dom");
131 dom.importCssString(exports.cssText, exports.cssClass);
132 });
+0
-134
try/ace/theme-clouds_midnight.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/clouds_midnight', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-clouds-midnight";
34 exports.cssText = ".ace-clouds-midnight .ace_gutter {\
35 background: #232323;\
36 color: #929292\
37 }\
38 .ace-clouds-midnight .ace_print-margin {\
39 width: 1px;\
40 background: #232323\
41 }\
42 .ace-clouds-midnight{\
43 background-color: #191919;\
44 color: #929292\
45 }\
46 .ace-clouds-midnight .ace_cursor {\
47 border-left: 2px solid #7DA5DC\
48 }\
49 .ace-clouds-midnight .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #7DA5DC\
52 }\
53 .ace-clouds-midnight .ace_marker-layer .ace_selection {\
54 background: #000000\
55 }\
56 .ace-clouds-midnight.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #191919;\
58 border-radius: 2px\
59 }\
60 .ace-clouds-midnight .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-clouds-midnight .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid #BFBFBF\
66 }\
67 .ace-clouds-midnight .ace_marker-layer .ace_active-line {\
68 background: rgba(215, 215, 215, 0.031)\
69 }\
70 .ace-clouds-midnight .ace_gutter-active-line {\
71 background-color: rgba(215, 215, 215, 0.031)\
72 }\
73 .ace-clouds-midnight .ace_marker-layer .ace_selected-word {\
74 border: 1px solid #000000\
75 }\
76 .ace-clouds-midnight .ace_invisible {\
77 color: #BFBFBF\
78 }\
79 .ace-clouds-midnight .ace_keyword,\
80 .ace-clouds-midnight .ace_meta,\
81 .ace-clouds-midnight .ace_support.ace_constant.ace_property-value {\
82 color: #927C5D\
83 }\
84 .ace-clouds-midnight .ace_keyword.ace_operator {\
85 color: #4B4B4B\
86 }\
87 .ace-clouds-midnight .ace_keyword.ace_other.ace_unit {\
88 color: #366F1A\
89 }\
90 .ace-clouds-midnight .ace_constant.ace_language {\
91 color: #39946A\
92 }\
93 .ace-clouds-midnight .ace_constant.ace_numeric {\
94 color: #46A609\
95 }\
96 .ace-clouds-midnight .ace_constant.ace_character.ace_entity {\
97 color: #A165AC\
98 }\
99 .ace-clouds-midnight .ace_invalid {\
100 color: #FFFFFF;\
101 background-color: #E92E2E\
102 }\
103 .ace-clouds-midnight .ace_fold {\
104 background-color: #927C5D;\
105 border-color: #929292\
106 }\
107 .ace-clouds-midnight .ace_storage,\
108 .ace-clouds-midnight .ace_support.ace_class,\
109 .ace-clouds-midnight .ace_support.ace_function,\
110 .ace-clouds-midnight .ace_support.ace_other,\
111 .ace-clouds-midnight .ace_support.ace_type {\
112 color: #E92E2E\
113 }\
114 .ace-clouds-midnight .ace_string {\
115 color: #5D90CD\
116 }\
117 .ace-clouds-midnight .ace_comment {\
118 color: #3C403B\
119 }\
120 .ace-clouds-midnight .ace_entity.ace_name.ace_tag,\
121 .ace-clouds-midnight .ace_entity.ace_other.ace_attribute-name {\
122 color: #606060\
123 }\
124 .ace-clouds-midnight .ace_markup.ace_underline {\
125 text-decoration: underline\
126 }\
127 .ace-clouds-midnight .ace_indent-guide {\
128 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHB3d/8PAAOIAdULw8qMAAAAAElFTkSuQmCC) right repeat-y;\
129 }";
130
131 var dom = require("../lib/dom");
132 dom.importCssString(exports.cssText, exports.cssClass);
133 });
+0
-148
try/ace/theme-cobalt.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/cobalt', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-cobalt";
34 exports.cssText = ".ace-cobalt .ace_gutter {\
35 background: #011e3a;\
36 color: #fff\
37 }\
38 .ace-cobalt .ace_print-margin {\
39 width: 1px;\
40 background: #011e3a\
41 }\
42 .ace-cobalt {\
43 background-color: #002240;\
44 color: #FFFFFF\
45 }\
46 .ace-cobalt .ace_cursor {\
47 border-left: 2px solid #FFFFFF\
48 }\
49 .ace-cobalt .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #FFFFFF\
52 }\
53 .ace-cobalt .ace_marker-layer .ace_selection {\
54 background: rgba(179, 101, 57, 0.75)\
55 }\
56 .ace-cobalt.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #002240;\
58 border-radius: 2px\
59 }\
60 .ace-cobalt .ace_marker-layer .ace_step {\
61 background: rgb(127, 111, 19)\
62 }\
63 .ace-cobalt .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid rgba(255, 255, 255, 0.15)\
66 }\
67 .ace-cobalt .ace_marker-layer .ace_active-line {\
68 background: rgba(0, 0, 0, 0.35)\
69 }\
70 .ace-cobalt .ace_gutter-active-line {\
71 background-color: rgba(0, 0, 0, 0.35)\
72 }\
73 .ace-cobalt .ace_marker-layer .ace_selected-word {\
74 border: 1px solid rgba(179, 101, 57, 0.75)\
75 }\
76 .ace-cobalt .ace_invisible {\
77 color: rgba(255, 255, 255, 0.15)\
78 }\
79 .ace-cobalt .ace_keyword,\
80 .ace-cobalt .ace_meta {\
81 color: #FF9D00\
82 }\
83 .ace-cobalt .ace_constant,\
84 .ace-cobalt .ace_constant.ace_character,\
85 .ace-cobalt .ace_constant.ace_character.ace_escape,\
86 .ace-cobalt .ace_constant.ace_other {\
87 color: #FF628C\
88 }\
89 .ace-cobalt .ace_invalid {\
90 color: #F8F8F8;\
91 background-color: #800F00\
92 }\
93 .ace-cobalt .ace_support {\
94 color: #80FFBB\
95 }\
96 .ace-cobalt .ace_support.ace_constant {\
97 color: #EB939A\
98 }\
99 .ace-cobalt .ace_fold {\
100 background-color: #FF9D00;\
101 border-color: #FFFFFF\
102 }\
103 .ace-cobalt .ace_support.ace_function {\
104 color: #FFB054\
105 }\
106 .ace-cobalt .ace_storage {\
107 color: #FFEE80\
108 }\
109 .ace-cobalt .ace_entity {\
110 color: #FFDD00\
111 }\
112 .ace-cobalt .ace_string {\
113 color: #3AD900\
114 }\
115 .ace-cobalt .ace_string.ace_regexp {\
116 color: #80FFC2\
117 }\
118 .ace-cobalt .ace_comment {\
119 font-style: italic;\
120 color: #0088FF\
121 }\
122 .ace-cobalt .ace_variable {\
123 color: #CCCCCC\
124 }\
125 .ace-cobalt .ace_variable.ace_language {\
126 color: #FF80E1\
127 }\
128 .ace-cobalt .ace_meta.ace_tag {\
129 color: #9EFFFF\
130 }\
131 .ace-cobalt .ace_markup.ace_underline {\
132 text-decoration: underline\
133 }\
134 .ace-cobalt .ace_markup.ace_heading {\
135 color: #C8E4FD;\
136 background-color: #001221\
137 }\
138 .ace-cobalt .ace_markup.ace_list {\
139 background-color: #130D26\
140 }\
141 .ace-cobalt .ace_indent-guide {\
142 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHCLSvkPAAP3AgSDTRd4AAAAAElFTkSuQmCC) right repeat-y;\
143 }";
144
145 var dom = require("../lib/dom");
146 dom.importCssString(exports.cssText, exports.cssClass);
147 });
+0
-152
try/ace/theme-crimson_editor.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/crimson_editor', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31 exports.isDark = false;
32 exports.cssText = ".ace-crimson-editor .ace_gutter {\
33 background: #ebebeb;\
34 color: #333;\
35 overflow : hidden;\
36 }\
37 .ace-crimson-editor .ace_gutter-layer {\
38 width: 100%;\
39 text-align: right;\
40 }\
41 .ace-crimson-editor .ace_print-margin {\
42 width: 1px;\
43 background: #e8e8e8;\
44 }\
45 .ace-crimson-editor {\
46 background-color: #FFFFFF;\
47 color: rgb(64, 64, 64);\
48 }\
49 .ace-crimson-editor .ace_cursor {\
50 border-left: 2px solid black;\
51 }\
52 .ace-crimson-editor .ace_overwrite-cursors .ace_cursor {\
53 border-left: 0px;\
54 border-bottom: 1px solid black;\
55 }\
56 .ace-crimson-editor .ace_invisible {\
57 color: rgb(191, 191, 191);\
58 }\
59 .ace-crimson-editor .ace_identifier {\
60 color: black;\
61 }\
62 .ace-crimson-editor .ace_keyword {\
63 color: blue;\
64 }\
65 .ace-crimson-editor .ace_constant.ace_buildin {\
66 color: rgb(88, 72, 246);\
67 }\
68 .ace-crimson-editor .ace_constant.ace_language {\
69 color: rgb(255, 156, 0);\
70 }\
71 .ace-crimson-editor .ace_constant.ace_library {\
72 color: rgb(6, 150, 14);\
73 }\
74 .ace-crimson-editor .ace_invalid {\
75 text-decoration: line-through;\
76 color: rgb(224, 0, 0);\
77 }\
78 .ace-crimson-editor .ace_fold {\
79 }\
80 .ace-crimson-editor .ace_support.ace_function {\
81 color: rgb(192, 0, 0);\
82 }\
83 .ace-crimson-editor .ace_support.ace_constant {\
84 color: rgb(6, 150, 14);\
85 }\
86 .ace-crimson-editor .ace_support.ace_type,\
87 .ace-crimson-editor .ace_support.ace_class {\
88 color: rgb(109, 121, 222);\
89 }\
90 .ace-crimson-editor .ace_keyword.ace_operator {\
91 color: rgb(49, 132, 149);\
92 }\
93 .ace-crimson-editor .ace_string {\
94 color: rgb(128, 0, 128);\
95 }\
96 .ace-crimson-editor .ace_comment {\
97 color: rgb(76, 136, 107);\
98 }\
99 .ace-crimson-editor .ace_comment.ace_doc {\
100 color: rgb(0, 102, 255);\
101 }\
102 .ace-crimson-editor .ace_comment.ace_doc.ace_tag {\
103 color: rgb(128, 159, 191);\
104 }\
105 .ace-crimson-editor .ace_constant.ace_numeric {\
106 color: rgb(0, 0, 64);\
107 }\
108 .ace-crimson-editor .ace_variable {\
109 color: rgb(0, 64, 128);\
110 }\
111 .ace-crimson-editor .ace_xml-pe {\
112 color: rgb(104, 104, 91);\
113 }\
114 .ace-crimson-editor .ace_marker-layer .ace_selection {\
115 background: rgb(181, 213, 255);\
116 }\
117 .ace-crimson-editor .ace_marker-layer .ace_step {\
118 background: rgb(252, 255, 0);\
119 }\
120 .ace-crimson-editor .ace_marker-layer .ace_stack {\
121 background: rgb(164, 229, 101);\
122 }\
123 .ace-crimson-editor .ace_marker-layer .ace_bracket {\
124 margin: -1px 0 0 -1px;\
125 border: 1px solid rgb(192, 192, 192);\
126 }\
127 .ace-crimson-editor .ace_marker-layer .ace_active-line {\
128 background: rgb(232, 242, 254);\
129 }\
130 .ace-crimson-editor .ace_gutter-active-line {\
131 background-color : #dcdcdc;\
132 }\
133 .ace-crimson-editor .ace_meta.ace_tag {\
134 color:rgb(28, 2, 255);\
135 }\
136 .ace-crimson-editor .ace_marker-layer .ace_selected-word {\
137 background: rgb(250, 250, 255);\
138 border: 1px solid rgb(200, 200, 250);\
139 }\
140 .ace-crimson-editor .ace_string.ace_regex {\
141 color: rgb(192, 0, 192);\
142 }\
143 .ace-crimson-editor .ace_indent-guide {\
144 background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
145 }";
146
147 exports.cssClass = "ace-crimson-editor";
148
149 var dom = require("../lib/dom");
150 dom.importCssString(exports.cssText, exports.cssClass);
151 });
+0
-144
try/ace/theme-dawn.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/dawn', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = false;
33 exports.cssClass = "ace-dawn";
34 exports.cssText = ".ace-dawn .ace_gutter {\
35 background: #ebebeb;\
36 color: #333\
37 }\
38 .ace-dawn .ace_print-margin {\
39 width: 1px;\
40 background: #e8e8e8\
41 }\
42 .ace-dawn {\
43 background-color: #F9F9F9;\
44 color: #080808\
45 }\
46 .ace-dawn .ace_cursor {\
47 border-left: 2px solid #000000\
48 }\
49 .ace-dawn .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #000000\
52 }\
53 .ace-dawn .ace_marker-layer .ace_selection {\
54 background: rgba(39, 95, 255, 0.30)\
55 }\
56 .ace-dawn.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #F9F9F9;\
58 border-radius: 2px\
59 }\
60 .ace-dawn .ace_marker-layer .ace_step {\
61 background: rgb(255, 255, 0)\
62 }\
63 .ace-dawn .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid rgba(75, 75, 126, 0.50)\
66 }\
67 .ace-dawn .ace_marker-layer .ace_active-line {\
68 background: rgba(36, 99, 180, 0.12)\
69 }\
70 .ace-dawn .ace_gutter-active-line {\
71 background-color : #dcdcdc\
72 }\
73 .ace-dawn .ace_marker-layer .ace_selected-word {\
74 border: 1px solid rgba(39, 95, 255, 0.30)\
75 }\
76 .ace-dawn .ace_invisible {\
77 color: rgba(75, 75, 126, 0.50)\
78 }\
79 .ace-dawn .ace_keyword,\
80 .ace-dawn .ace_meta {\
81 color: #794938\
82 }\
83 .ace-dawn .ace_constant,\
84 .ace-dawn .ace_constant.ace_character,\
85 .ace-dawn .ace_constant.ace_character.ace_escape,\
86 .ace-dawn .ace_constant.ace_other {\
87 color: #811F24\
88 }\
89 .ace-dawn .ace_invalid.ace_illegal {\
90 text-decoration: underline;\
91 font-style: italic;\
92 color: #F8F8F8;\
93 background-color: #B52A1D\
94 }\
95 .ace-dawn .ace_invalid.ace_deprecated {\
96 text-decoration: underline;\
97 font-style: italic;\
98 color: #B52A1D\
99 }\
100 .ace-dawn .ace_support {\
101 color: #691C97\
102 }\
103 .ace-dawn .ace_support.ace_constant {\
104 color: #B4371F\
105 }\
106 .ace-dawn .ace_fold {\
107 background-color: #794938;\
108 border-color: #080808\
109 }\
110 .ace-dawn .ace_markup.ace_list,\
111 .ace-dawn .ace_support.ace_function {\
112 color: #693A17\
113 }\
114 .ace-dawn .ace_storage {\
115 font-style: italic;\
116 color: #A71D5D\
117 }\
118 .ace-dawn .ace_string {\
119 color: #0B6125\
120 }\
121 .ace-dawn .ace_string.ace_regexp {\
122 color: #CF5628\
123 }\
124 .ace-dawn .ace_comment {\
125 font-style: italic;\
126 color: #5A525F\
127 }\
128 .ace-dawn .ace_variable {\
129 color: #234A97\
130 }\
131 .ace-dawn .ace_markup.ace_underline {\
132 text-decoration: underline\
133 }\
134 .ace-dawn .ace_markup.ace_heading {\
135 color: #19356D\
136 }\
137 .ace-dawn .ace_indent-guide {\
138 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYLh/5+x/AAizA4hxNNsZAAAAAElFTkSuQmCC) right repeat-y;\
139 }";
140
141 var dom = require("../lib/dom");
142 dom.importCssString(exports.cssText, exports.cssClass);
143 });
+0
-171
try/ace/theme-dreamweaver.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/dreamweaver', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31 exports.isDark = false;
32 exports.cssClass = "ace-dreamweaver";
33 exports.cssText = ".ace-dreamweaver .ace_gutter {\
34 background: #e8e8e8;\
35 color: #333;\
36 }\
37 .ace-dreamweaver .ace_print-margin {\
38 width: 1px;\
39 background: #e8e8e8;\
40 }\
41 .ace-dreamweaver {\
42 background-color: #FFFFFF;\
43 }\
44 .ace-dreamweaver .ace_fold {\
45 background-color: #757AD8;\
46 }\
47 .ace-dreamweaver .ace_cursor {\
48 border-left: 2px solid black;\
49 }\
50 .ace-dreamweaver .ace_overwrite-cursors .ace_cursor {\
51 border-left: 0px;\
52 border-bottom: 1px solid black;\
53 }\
54 .ace-dreamweaver .ace_invisible {\
55 color: rgb(191, 191, 191);\
56 }\
57 .ace-dreamweaver .ace_storage,\
58 .ace-dreamweaver .ace_keyword {\
59 color: blue;\
60 }\
61 .ace-dreamweaver .ace_constant.ace_buildin {\
62 color: rgb(88, 72, 246);\
63 }\
64 .ace-dreamweaver .ace_constant.ace_language {\
65 color: rgb(88, 92, 246);\
66 }\
67 .ace-dreamweaver .ace_constant.ace_library {\
68 color: rgb(6, 150, 14);\
69 }\
70 .ace-dreamweaver .ace_invalid {\
71 background-color: rgb(153, 0, 0);\
72 color: white;\
73 }\
74 .ace-dreamweaver .ace_support.ace_function {\
75 color: rgb(60, 76, 114);\
76 }\
77 .ace-dreamweaver .ace_support.ace_constant {\
78 color: rgb(6, 150, 14);\
79 }\
80 .ace-dreamweaver .ace_support.ace_type,\
81 .ace-dreamweaver .ace_support.ace_class {\
82 color: #009;\
83 }\
84 .ace-dreamweaver .ace_support.ace_php_tag {\
85 color: #f00;\
86 }\
87 .ace-dreamweaver .ace_keyword.ace_operator {\
88 color: rgb(104, 118, 135);\
89 }\
90 .ace-dreamweaver .ace_string {\
91 color: #00F;\
92 }\
93 .ace-dreamweaver .ace_comment {\
94 color: rgb(76, 136, 107);\
95 }\
96 .ace-dreamweaver .ace_comment.ace_doc {\
97 color: rgb(0, 102, 255);\
98 }\
99 .ace-dreamweaver .ace_comment.ace_doc.ace_tag {\
100 color: rgb(128, 159, 191);\
101 }\
102 .ace-dreamweaver .ace_constant.ace_numeric {\
103 color: rgb(0, 0, 205);\
104 }\
105 .ace-dreamweaver .ace_variable {\
106 color: #06F\
107 }\
108 .ace-dreamweaver .ace_xml-pe {\
109 color: rgb(104, 104, 91);\
110 }\
111 .ace-dreamweaver .ace_entity.ace_name.ace_function {\
112 color: #00F;\
113 }\
114 .ace-dreamweaver .ace_markup.ace_heading {\
115 color: rgb(12, 7, 255);\
116 }\
117 .ace-dreamweaver .ace_markup.ace_list {\
118 color:rgb(185, 6, 144);\
119 }\
120 .ace-dreamweaver .ace_marker-layer .ace_selection {\
121 background: rgb(181, 213, 255);\
122 }\
123 .ace-dreamweaver .ace_marker-layer .ace_step {\
124 background: rgb(252, 255, 0);\
125 }\
126 .ace-dreamweaver .ace_marker-layer .ace_stack {\
127 background: rgb(164, 229, 101);\
128 }\
129 .ace-dreamweaver .ace_marker-layer .ace_bracket {\
130 margin: -1px 0 0 -1px;\
131 border: 1px solid rgb(192, 192, 192);\
132 }\
133 .ace-dreamweaver .ace_marker-layer .ace_active-line {\
134 background: rgba(0, 0, 0, 0.07);\
135 }\
136 .ace-dreamweaver .ace_marker-layer .ace_selected-word {\
137 background: rgb(250, 250, 255);\
138 border: 1px solid rgb(200, 200, 250);\
139 }\
140 .ace-dreamweaver .ace_meta.ace_tag {\
141 color:#009;\
142 }\
143 .ace-dreamweaver .ace_meta.ace_tag.ace_anchor {\
144 color:#060;\
145 }\
146 .ace-dreamweaver .ace_meta.ace_tag.ace_form {\
147 color:#F90;\
148 }\
149 .ace-dreamweaver .ace_meta.ace_tag.ace_image {\
150 color:#909;\
151 }\
152 .ace-dreamweaver .ace_meta.ace_tag.ace_script {\
153 color:#900;\
154 }\
155 .ace-dreamweaver .ace_meta.ace_tag.ace_style {\
156 color:#909;\
157 }\
158 .ace-dreamweaver .ace_meta.ace_tag.ace_table {\
159 color:#099;\
160 }\
161 .ace-dreamweaver .ace_string.ace_regex {\
162 color: rgb(255, 0, 0)\
163 }\
164 .ace-dreamweaver .ace_indent-guide {\
165 background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
166 }";
167
168 var dom = require("../lib/dom");
169 dom.importCssString(exports.cssText, exports.cssClass);
170 });
+0
-124
try/ace/theme-eclipse.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/eclipse', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32
33 exports.isDark = false;
34 exports.cssText = ".ace-eclipse .ace_gutter {\
35 background: #ebebeb;\
36 border-right: 1px solid rgb(159, 159, 159);\
37 color: rgb(136, 136, 136);\
38 }\
39 .ace-eclipse .ace_print-margin {\
40 width: 1px;\
41 background: #ebebeb;\
42 }\
43 .ace-eclipse {\
44 background-color: #FFFFFF;\
45 }\
46 .ace-eclipse .ace_fold {\
47 background-color: rgb(60, 76, 114);\
48 }\
49 .ace-eclipse .ace_cursor {\
50 border-left: 2px solid black;\
51 }\
52 .ace-eclipse .ace_storage,\
53 .ace-eclipse .ace_keyword,\
54 .ace-eclipse .ace_variable {\
55 color: rgb(127, 0, 85);\
56 }\
57 .ace-eclipse .ace_constant.ace_buildin {\
58 color: rgb(88, 72, 246);\
59 }\
60 .ace-eclipse .ace_constant.ace_library {\
61 color: rgb(6, 150, 14);\
62 }\
63 .ace-eclipse .ace_function {\
64 color: rgb(60, 76, 114);\
65 }\
66 .ace-eclipse .ace_string {\
67 color: rgb(42, 0, 255);\
68 }\
69 .ace-eclipse .ace_comment {\
70 color: rgb(113, 150, 130);\
71 }\
72 .ace-eclipse .ace_comment.ace_doc {\
73 color: rgb(63, 95, 191);\
74 }\
75 .ace-eclipse .ace_comment.ace_doc.ace_tag {\
76 color: rgb(127, 159, 191);\
77 }\
78 .ace-eclipse .ace_constant.ace_numeric {\
79 color: darkblue;\
80 }\
81 .ace-eclipse .ace_tag {\
82 color: rgb(25, 118, 116);\
83 }\
84 .ace-eclipse .ace_type {\
85 color: rgb(127, 0, 127);\
86 }\
87 .ace-eclipse .ace_xml-pe {\
88 color: rgb(104, 104, 91);\
89 }\
90 .ace-eclipse .ace_marker-layer .ace_selection {\
91 background: rgb(181, 213, 255);\
92 }\
93 .ace-eclipse .ace_marker-layer .ace_bracket {\
94 margin: -1px 0 0 -1px;\
95 border: 1px solid rgb(192, 192, 192);\
96 }\
97 .ace-eclipse .ace_meta.ace_tag {\
98 color:rgb(25, 118, 116);\
99 }\
100 .ace-eclipse .ace_invisible {\
101 color: #ddd;\
102 }\
103 .ace-eclipse .ace_entity.ace_other.ace_attribute-name {\
104 color:rgb(127, 0, 127);\
105 }\
106 .ace-eclipse .ace_marker-layer .ace_step {\
107 background: rgb(255, 255, 0);\
108 }\
109 .ace-eclipse .ace_marker-layer .ace_active-line {\
110 background: rgb(232, 242, 254);\
111 }\
112 .ace-eclipse .ace_marker-layer .ace_selected-word {\
113 border: 1px solid rgb(181, 213, 255);\
114 }\
115 .ace-eclipse .ace_indent-guide {\
116 background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
117 }";
118
119 exports.cssClass = "ace-eclipse";
120
121 var dom = require("../lib/dom");
122 dom.importCssString(exports.cssText, exports.cssClass);
123 });
+0
-135
try/ace/theme-github.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/github', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = false;
33 exports.cssClass = "ace-github";
34 exports.cssText = "/* CSS style content from github's default pygments highlighter template.\
35 Cursor and selection styles from textmate.css. */\
36 .ace-github .ace_gutter {\
37 background: #e8e8e8;\
38 color: #AAA;\
39 }\
40 .ace-github {\
41 background: #fff;\
42 color: #000;\
43 }\
44 .ace-github .ace_keyword {\
45 font-weight: bold;\
46 }\
47 .ace-github .ace_string {\
48 color: #D14;\
49 }\
50 .ace-github .ace_variable.ace_class {\
51 color: teal;\
52 }\
53 .ace-github .ace_constant.ace_numeric {\
54 color: #099;\
55 }\
56 .ace-github .ace_constant.ace_buildin {\
57 color: #0086B3;\
58 }\
59 .ace-github .ace_support.ace_function {\
60 color: #0086B3;\
61 }\
62 .ace-github .ace_comment {\
63 color: #998;\
64 font-style: italic;\
65 }\
66 .ace-github .ace_variable.ace_language {\
67 color: #0086B3;\
68 }\
69 .ace-github .ace_paren {\
70 font-weight: bold;\
71 }\
72 .ace-github .ace_boolean {\
73 font-weight: bold;\
74 }\
75 .ace-github .ace_string.ace_regexp {\
76 color: #009926;\
77 font-weight: normal;\
78 }\
79 .ace-github .ace_variable.ace_instance {\
80 color: teal;\
81 }\
82 .ace-github .ace_constant.ace_language {\
83 font-weight: bold;\
84 }\
85 .ace-github .ace_cursor {\
86 border-left: 2px solid black;\
87 }\
88 .ace-github .ace_overwrite-cursors .ace_cursor {\
89 border-left: 0px;\
90 border-bottom: 1px solid black;\
91 }\
92 .ace-github .ace_marker-layer .ace_active-line {\
93 background: rgb(255, 255, 204);\
94 }\
95 .ace-github .ace_marker-layer .ace_selection {\
96 background: rgb(181, 213, 255);\
97 }\
98 .ace-github.ace_multiselect .ace_selection.ace_start {\
99 box-shadow: 0 0 3px 0px white;\
100 border-radius: 2px;\
101 }\
102 /* bold keywords cause cursor issues for some fonts */\
103 /* this disables bold style for editor and keeps for static highlighter */\
104 .ace-github.ace_nobold .ace_line > span {\
105 font-weight: normal !important;\
106 }\
107 .ace-github .ace_marker-layer .ace_step {\
108 background: rgb(252, 255, 0);\
109 }\
110 .ace-github .ace_marker-layer .ace_stack {\
111 background: rgb(164, 229, 101);\
112 }\
113 .ace-github .ace_marker-layer .ace_bracket {\
114 margin: -1px 0 0 -1px;\
115 border: 1px solid rgb(192, 192, 192);\
116 }\
117 .ace-github .ace_gutter-active-line {\
118 background-color : rgba(0, 0, 0, 0.07);\
119 }\
120 .ace-github .ace_marker-layer .ace_selected-word {\
121 background: rgb(250, 250, 255);\
122 border: 1px solid rgb(200, 200, 250);\
123 }\
124 .ace-github .ace_print-margin {\
125 width: 1px;\
126 background: #e8e8e8;\
127 }\
128 .ace-github .ace_indent-guide {\
129 background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
130 }";
131
132 var dom = require("../lib/dom");
133 dom.importCssString(exports.cssText, exports.cssClass);
134 });
+0
-137
try/ace/theme-idle_fingers.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/idle_fingers', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-idle-fingers";
34 exports.cssText = ".ace-idle-fingers .ace_gutter {\
35 background: #3b3b3b;\
36 color: #fff\
37 }\
38 .ace-idle-fingers .ace_print-margin {\
39 width: 1px;\
40 background: #3b3b3b\
41 }\
42 .ace-idle-fingers {\
43 background-color: #323232;\
44 color: #FFFFFF\
45 }\
46 .ace-idle-fingers .ace_text-layer {\
47 color: #FFFFFF\
48 }\
49 .ace-idle-fingers .ace_cursor {\
50 border-left: 2px solid #91FF00\
51 }\
52 .ace-idle-fingers .ace_overwrite-cursors .ace_cursor {\
53 border-left: 0px;\
54 border-bottom: 1px solid #91FF00\
55 }\
56 .ace-idle-fingers .ace_marker-layer .ace_selection {\
57 background: rgba(90, 100, 126, 0.88)\
58 }\
59 .ace-idle-fingers.ace_multiselect .ace_selection.ace_start {\
60 box-shadow: 0 0 3px 0px #323232;\
61 border-radius: 2px\
62 }\
63 .ace-idle-fingers .ace_marker-layer .ace_step {\
64 background: rgb(102, 82, 0)\
65 }\
66 .ace-idle-fingers .ace_marker-layer .ace_bracket {\
67 margin: -1px 0 0 -1px;\
68 border: 1px solid #404040\
69 }\
70 .ace-idle-fingers .ace_marker-layer .ace_active-line {\
71 background: #353637\
72 }\
73 .ace-idle-fingers .ace_gutter-active-line {\
74 background-color: #353637\
75 }\
76 .ace-idle-fingers .ace_marker-layer .ace_selected-word {\
77 border: 1px solid rgba(90, 100, 126, 0.88)\
78 }\
79 .ace-idle-fingers .ace_invisible {\
80 color: #404040\
81 }\
82 .ace-idle-fingers .ace_keyword,\
83 .ace-idle-fingers .ace_meta {\
84 color: #CC7833\
85 }\
86 .ace-idle-fingers .ace_constant,\
87 .ace-idle-fingers .ace_constant.ace_character,\
88 .ace-idle-fingers .ace_constant.ace_character.ace_escape,\
89 .ace-idle-fingers .ace_constant.ace_other,\
90 .ace-idle-fingers .ace_support.ace_constant {\
91 color: #6C99BB\
92 }\
93 .ace-idle-fingers .ace_invalid {\
94 color: #FFFFFF;\
95 background-color: #FF0000\
96 }\
97 .ace-idle-fingers .ace_fold {\
98 background-color: #CC7833;\
99 border-color: #FFFFFF\
100 }\
101 .ace-idle-fingers .ace_support.ace_function {\
102 color: #B83426\
103 }\
104 .ace-idle-fingers .ace_variable.ace_parameter {\
105 font-style: italic\
106 }\
107 .ace-idle-fingers .ace_string {\
108 color: #A5C261\
109 }\
110 .ace-idle-fingers .ace_string.ace_regexp {\
111 color: #CCCC33\
112 }\
113 .ace-idle-fingers .ace_comment {\
114 font-style: italic;\
115 color: #BC9458\
116 }\
117 .ace-idle-fingers .ace_meta.ace_tag {\
118 color: #FFE5BB\
119 }\
120 .ace-idle-fingers .ace_entity.ace_name {\
121 color: #FFC66D\
122 }\
123 .ace-idle-fingers .ace_markup.ace_underline {\
124 text-decoration: underline\
125 }\
126 .ace-idle-fingers .ace_collab.ace_user1 {\
127 color: #323232;\
128 background-color: #FFF980\
129 }\
130 .ace-idle-fingers .ace_indent-guide {\
131 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMwMjLyZYiPj/8PAAreAwAI1+g0AAAAAElFTkSuQmCC) right repeat-y;\
132 }";
133
134 var dom = require("../lib/dom");
135 dom.importCssString(exports.cssText, exports.cssClass);
136 });
+0
-141
try/ace/theme-kr.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/kr_theme', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-kr-theme";
34 exports.cssText = ".ace-kr-theme .ace_gutter {\
35 background: #1c1917;\
36 color: #FCFFE0\
37 }\
38 .ace-kr-theme .ace_print-margin {\
39 width: 1px;\
40 background: #1c1917\
41 }\
42 .ace-kr-theme {\
43 background-color: #0B0A09;\
44 color: #FCFFE0\
45 }\
46 .ace-kr-theme .ace_cursor {\
47 border-left: 2px solid #FF9900\
48 }\
49 .ace-kr-theme .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #FF9900\
52 }\
53 .ace-kr-theme .ace_marker-layer .ace_selection {\
54 background: rgba(170, 0, 255, 0.45)\
55 }\
56 .ace-kr-theme.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #0B0A09;\
58 border-radius: 2px\
59 }\
60 .ace-kr-theme .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-kr-theme .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid rgba(255, 177, 111, 0.32)\
66 }\
67 .ace-kr-theme .ace_marker-layer .ace_active-line {\
68 background: #38403D\
69 }\
70 .ace-kr-theme .ace_gutter-active-line {\
71 background-color : #38403D\
72 }\
73 .ace-kr-theme .ace_marker-layer .ace_selected-word {\
74 border: 1px solid rgba(170, 0, 255, 0.45)\
75 }\
76 .ace-kr-theme .ace_invisible {\
77 color: rgba(255, 177, 111, 0.32)\
78 }\
79 .ace-kr-theme .ace_keyword,\
80 .ace-kr-theme .ace_meta {\
81 color: #949C8B\
82 }\
83 .ace-kr-theme .ace_constant,\
84 .ace-kr-theme .ace_constant.ace_character,\
85 .ace-kr-theme .ace_constant.ace_character.ace_escape,\
86 .ace-kr-theme .ace_constant.ace_other {\
87 color: rgba(210, 117, 24, 0.76)\
88 }\
89 .ace-kr-theme .ace_invalid {\
90 color: #F8F8F8;\
91 background-color: #A41300\
92 }\
93 .ace-kr-theme .ace_support {\
94 color: #9FC28A\
95 }\
96 .ace-kr-theme .ace_support.ace_constant {\
97 color: #C27E66\
98 }\
99 .ace-kr-theme .ace_fold {\
100 background-color: #949C8B;\
101 border-color: #FCFFE0\
102 }\
103 .ace-kr-theme .ace_support.ace_function {\
104 color: #85873A\
105 }\
106 .ace-kr-theme .ace_storage {\
107 color: #FFEE80\
108 }\
109 .ace-kr-theme .ace_string {\
110 color: rgba(164, 161, 181, 0.8)\
111 }\
112 .ace-kr-theme .ace_string.ace_regexp {\
113 color: rgba(125, 255, 192, 0.65)\
114 }\
115 .ace-kr-theme .ace_comment {\
116 font-style: italic;\
117 color: #706D5B\
118 }\
119 .ace-kr-theme .ace_variable {\
120 color: #D1A796\
121 }\
122 .ace-kr-theme .ace_variable.ace_language {\
123 color: #FF80E1\
124 }\
125 .ace-kr-theme .ace_meta.ace_tag {\
126 color: #BABD9C\
127 }\
128 .ace-kr-theme .ace_markup.ace_underline {\
129 text-decoration: underline\
130 }\
131 .ace-kr-theme .ace_markup.ace_list {\
132 background-color: #0F0040\
133 }\
134 .ace-kr-theme .ace_indent-guide {\
135 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYFBXV/8PAAJoAXX4kT2EAAAAAElFTkSuQmCC) right repeat-y;\
136 }";
137
138 var dom = require("../lib/dom");
139 dom.importCssString(exports.cssText, exports.cssClass);
140 });
+0
-133
try/ace/theme-merbivore.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/merbivore', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-merbivore";
34 exports.cssText = ".ace-merbivore .ace_gutter {\
35 background: #202020;\
36 color: #E6E1DC\
37 }\
38 .ace-merbivore .ace_print-margin {\
39 width: 1px;\
40 background: #555651\
41 }\
42 .ace-merbivore {\
43 background-color: #161616;\
44 color: #E6E1DC\
45 }\
46 .ace-merbivore .ace_cursor {\
47 border-left: 2px solid #FFFFFF\
48 }\
49 .ace-merbivore .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #FFFFFF\
52 }\
53 .ace-merbivore .ace_marker-layer .ace_selection {\
54 background: #454545\
55 }\
56 .ace-merbivore.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #161616;\
58 border-radius: 2px\
59 }\
60 .ace-merbivore .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-merbivore .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid #404040\
66 }\
67 .ace-merbivore .ace_marker-layer .ace_active-line {\
68 background: #333435\
69 }\
70 .ace-merbivore .ace_gutter-active-line {\
71 background-color: #333435\
72 }\
73 .ace-merbivore .ace_marker-layer .ace_selected-word {\
74 border: 1px solid #454545\
75 }\
76 .ace-merbivore .ace_invisible {\
77 color: #404040\
78 }\
79 .ace-merbivore .ace_entity.ace_name.ace_tag,\
80 .ace-merbivore .ace_keyword,\
81 .ace-merbivore .ace_meta,\
82 .ace-merbivore .ace_meta.ace_tag,\
83 .ace-merbivore .ace_storage,\
84 .ace-merbivore .ace_support.ace_function {\
85 color: #FC6F09\
86 }\
87 .ace-merbivore .ace_constant,\
88 .ace-merbivore .ace_constant.ace_character,\
89 .ace-merbivore .ace_constant.ace_character.ace_escape,\
90 .ace-merbivore .ace_constant.ace_other,\
91 .ace-merbivore .ace_support.ace_type {\
92 color: #1EDAFB\
93 }\
94 .ace-merbivore .ace_constant.ace_character.ace_escape {\
95 color: #519F50\
96 }\
97 .ace-merbivore .ace_constant.ace_language {\
98 color: #FDC251\
99 }\
100 .ace-merbivore .ace_constant.ace_library,\
101 .ace-merbivore .ace_string,\
102 .ace-merbivore .ace_support.ace_constant {\
103 color: #8DFF0A\
104 }\
105 .ace-merbivore .ace_constant.ace_numeric {\
106 color: #58C554\
107 }\
108 .ace-merbivore .ace_invalid {\
109 color: #FFFFFF;\
110 background-color: #990000\
111 }\
112 .ace-merbivore .ace_fold {\
113 background-color: #FC6F09;\
114 border-color: #E6E1DC\
115 }\
116 .ace-merbivore .ace_comment {\
117 font-style: italic;\
118 color: #AD2EA4\
119 }\
120 .ace-merbivore .ace_entity.ace_other.ace_attribute-name {\
121 color: #FFFF89\
122 }\
123 .ace-merbivore .ace_markup.ace_underline {\
124 text-decoration: underline\
125 }\
126 .ace-merbivore .ace_indent-guide {\
127 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQFxf3ZXB1df0PAAdsAmERTkEHAAAAAElFTkSuQmCC) right repeat-y;\
128 }";
129
130 var dom = require("../lib/dom");
131 dom.importCssString(exports.cssText, exports.cssClass);
132 });
+0
-134
try/ace/theme-merbivore_soft.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/merbivore_soft', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-merbivore-soft";
34 exports.cssText = ".ace-merbivore-soft .ace_gutter {\
35 background: #262424;\
36 color: #E6E1DC\
37 }\
38 .ace-merbivore-soft .ace_print-margin {\
39 width: 1px;\
40 background: #262424\
41 }\
42 .ace-merbivore-soft {\
43 background-color: #1C1C1C;\
44 color: #E6E1DC\
45 }\
46 .ace-merbivore-soft .ace_cursor {\
47 border-left: 2px solid #FFFFFF\
48 }\
49 .ace-merbivore-soft .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #FFFFFF\
52 }\
53 .ace-merbivore-soft .ace_marker-layer .ace_selection {\
54 background: #494949\
55 }\
56 .ace-merbivore-soft.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #1C1C1C;\
58 border-radius: 2px\
59 }\
60 .ace-merbivore-soft .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-merbivore-soft .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid #404040\
66 }\
67 .ace-merbivore-soft .ace_marker-layer .ace_active-line {\
68 background: #333435\
69 }\
70 .ace-merbivore-soft .ace_gutter-active-line {\
71 background-color: #333435\
72 }\
73 .ace-merbivore-soft .ace_marker-layer .ace_selected-word {\
74 border: 1px solid #494949\
75 }\
76 .ace-merbivore-soft .ace_invisible {\
77 color: #404040\
78 }\
79 .ace-merbivore-soft .ace_entity.ace_name.ace_tag,\
80 .ace-merbivore-soft .ace_keyword,\
81 .ace-merbivore-soft .ace_meta,\
82 .ace-merbivore-soft .ace_meta.ace_tag,\
83 .ace-merbivore-soft .ace_storage {\
84 color: #FC803A\
85 }\
86 .ace-merbivore-soft .ace_constant,\
87 .ace-merbivore-soft .ace_constant.ace_character,\
88 .ace-merbivore-soft .ace_constant.ace_character.ace_escape,\
89 .ace-merbivore-soft .ace_constant.ace_other,\
90 .ace-merbivore-soft .ace_support.ace_type {\
91 color: #68C1D8\
92 }\
93 .ace-merbivore-soft .ace_constant.ace_character.ace_escape {\
94 color: #B3E5B4\
95 }\
96 .ace-merbivore-soft .ace_constant.ace_language {\
97 color: #E1C582\
98 }\
99 .ace-merbivore-soft .ace_constant.ace_library,\
100 .ace-merbivore-soft .ace_string,\
101 .ace-merbivore-soft .ace_support.ace_constant {\
102 color: #8EC65F\
103 }\
104 .ace-merbivore-soft .ace_constant.ace_numeric {\
105 color: #7FC578\
106 }\
107 .ace-merbivore-soft .ace_invalid,\
108 .ace-merbivore-soft .ace_invalid.ace_deprecated {\
109 color: #FFFFFF;\
110 background-color: #FE3838\
111 }\
112 .ace-merbivore-soft .ace_fold {\
113 background-color: #FC803A;\
114 border-color: #E6E1DC\
115 }\
116 .ace-merbivore-soft .ace_comment,\
117 .ace-merbivore-soft .ace_meta {\
118 font-style: italic;\
119 color: #AC4BB8\
120 }\
121 .ace-merbivore-soft .ace_entity.ace_other.ace_attribute-name {\
122 color: #EAF1A3\
123 }\
124 .ace-merbivore-soft .ace_markup.ace_underline {\
125 text-decoration: underline\
126 }\
127 .ace-merbivore-soft .ace_indent-guide {\
128 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWOQkpLyZfD09PwPAAfYAnaStpHRAAAAAElFTkSuQmCC) right repeat-y;\
129 }";
130
131 var dom = require("../lib/dom");
132 dom.importCssString(exports.cssText, exports.cssClass);
133 });
+0
-145
try/ace/theme-mono_industrial.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/mono_industrial', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-mono-industrial";
34 exports.cssText = ".ace-mono-industrial .ace_gutter {\
35 background: #1d2521;\
36 color: #C5C9C9\
37 }\
38 .ace-mono-industrial .ace_print-margin {\
39 width: 1px;\
40 background: #555651\
41 }\
42 .ace-mono-industrial {\
43 background-color: #222C28;\
44 color: #FFFFFF\
45 }\
46 .ace-mono-industrial .ace_cursor {\
47 border-left: 2px solid #FFFFFF\
48 }\
49 .ace-mono-industrial .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #FFFFFF\
52 }\
53 .ace-mono-industrial .ace_marker-layer .ace_selection {\
54 background: rgba(145, 153, 148, 0.40)\
55 }\
56 .ace-mono-industrial.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #222C28;\
58 border-radius: 2px\
59 }\
60 .ace-mono-industrial .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-mono-industrial .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid rgba(102, 108, 104, 0.50)\
66 }\
67 .ace-mono-industrial .ace_marker-layer .ace_active-line {\
68 background: rgba(12, 13, 12, 0.25)\
69 }\
70 .ace-mono-industrial .ace_gutter-active-line {\
71 background-color: rgba(12, 13, 12, 0.25)\
72 }\
73 .ace-mono-industrial .ace_marker-layer .ace_selected-word {\
74 border: 1px solid rgba(145, 153, 148, 0.40)\
75 }\
76 .ace-mono-industrial .ace_invisible {\
77 color: rgba(102, 108, 104, 0.50)\
78 }\
79 .ace-mono-industrial .ace_string {\
80 background-color: #151C19;\
81 color: #FFFFFF\
82 }\
83 .ace-mono-industrial .ace_keyword,\
84 .ace-mono-industrial .ace_meta {\
85 color: #A39E64\
86 }\
87 .ace-mono-industrial .ace_constant,\
88 .ace-mono-industrial .ace_constant.ace_character,\
89 .ace-mono-industrial .ace_constant.ace_character.ace_escape,\
90 .ace-mono-industrial .ace_constant.ace_numeric,\
91 .ace-mono-industrial .ace_constant.ace_other {\
92 color: #E98800\
93 }\
94 .ace-mono-industrial .ace_entity.ace_name.ace_function,\
95 .ace-mono-industrial .ace_keyword.ace_operator,\
96 .ace-mono-industrial .ace_variable {\
97 color: #A8B3AB\
98 }\
99 .ace-mono-industrial .ace_invalid {\
100 color: #FFFFFF;\
101 background-color: rgba(153, 0, 0, 0.68)\
102 }\
103 .ace-mono-industrial .ace_support.ace_constant {\
104 color: #C87500\
105 }\
106 .ace-mono-industrial .ace_fold {\
107 background-color: #A8B3AB;\
108 border-color: #FFFFFF\
109 }\
110 .ace-mono-industrial .ace_support.ace_function {\
111 color: #588E60\
112 }\
113 .ace-mono-industrial .ace_entity.ace_name,\
114 .ace-mono-industrial .ace_support.ace_class,\
115 .ace-mono-industrial .ace_support.ace_type {\
116 color: #5778B6\
117 }\
118 .ace-mono-industrial .ace_storage {\
119 color: #C23B00\
120 }\
121 .ace-mono-industrial .ace_variable.ace_language,\
122 .ace-mono-industrial .ace_variable.ace_parameter {\
123 color: #648BD2\
124 }\
125 .ace-mono-industrial .ace_comment {\
126 color: #666C68;\
127 background-color: #151C19\
128 }\
129 .ace-mono-industrial .ace_entity.ace_other.ace_attribute-name {\
130 color: #909993\
131 }\
132 .ace-mono-industrial .ace_markup.ace_underline {\
133 text-decoration: underline\
134 }\
135 .ace-mono-industrial .ace_entity.ace_name.ace_tag {\
136 color: #A65EFF\
137 }\
138 .ace-mono-industrial .ace_indent-guide {\
139 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNQ1NbwZfALD/4PAAlTArlEC4r/AAAAAElFTkSuQmCC) right repeat-y;\
140 }";
141
142 var dom = require("../lib/dom");
143 dom.importCssString(exports.cssText, exports.cssClass);
144 });
+0
-139
try/ace/theme-monokai.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/monokai', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-monokai";
34 exports.cssText = ".ace-monokai .ace_gutter {\
35 background: #2F3129;\
36 color: #8F908A\
37 }\
38 .ace-monokai .ace_print-margin {\
39 width: 1px;\
40 background: #555651\
41 }\
42 .ace-monokai {\
43 background-color: #272822;\
44 color: #F8F8F2\
45 }\
46 .ace-monokai .ace_cursor {\
47 border-left: 2px solid #F8F8F0\
48 }\
49 .ace-monokai .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #F8F8F0\
52 }\
53 .ace-monokai .ace_marker-layer .ace_selection {\
54 background: #49483E\
55 }\
56 .ace-monokai.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #272822;\
58 border-radius: 2px\
59 }\
60 .ace-monokai .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-monokai .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid #49483E\
66 }\
67 .ace-monokai .ace_marker-layer .ace_active-line {\
68 background: #202020\
69 }\
70 .ace-monokai .ace_gutter-active-line {\
71 background-color: #272727\
72 }\
73 .ace-monokai .ace_marker-layer .ace_selected-word {\
74 border: 1px solid #49483E\
75 }\
76 .ace-monokai .ace_invisible {\
77 color: #52524d\
78 }\
79 .ace-monokai .ace_entity.ace_name.ace_tag,\
80 .ace-monokai .ace_keyword,\
81 .ace-monokai .ace_meta.ace_tag,\
82 .ace-monokai .ace_storage {\
83 color: #F92672\
84 }\
85 .ace-monokai .ace_constant.ace_character,\
86 .ace-monokai .ace_constant.ace_language,\
87 .ace-monokai .ace_constant.ace_numeric,\
88 .ace-monokai .ace_constant.ace_other {\
89 color: #AE81FF\
90 }\
91 .ace-monokai .ace_invalid {\
92 color: #F8F8F0;\
93 background-color: #F92672\
94 }\
95 .ace-monokai .ace_invalid.ace_deprecated {\
96 color: #F8F8F0;\
97 background-color: #AE81FF\
98 }\
99 .ace-monokai .ace_support.ace_constant,\
100 .ace-monokai .ace_support.ace_function {\
101 color: #66D9EF\
102 }\
103 .ace-monokai .ace_fold {\
104 background-color: #A6E22E;\
105 border-color: #F8F8F2\
106 }\
107 .ace-monokai .ace_storage.ace_type,\
108 .ace-monokai .ace_support.ace_class,\
109 .ace-monokai .ace_support.ace_type {\
110 font-style: italic;\
111 color: #66D9EF\
112 }\
113 .ace-monokai .ace_entity.ace_name.ace_function,\
114 .ace-monokai .ace_entity.ace_other,\
115 .ace-monokai .ace_entity.ace_other.ace_attribute-name,\
116 .ace-monokai .ace_variable {\
117 color: #A6E22E\
118 }\
119 .ace-monokai .ace_variable.ace_parameter {\
120 font-style: italic;\
121 color: #FD971F\
122 }\
123 .ace-monokai .ace_string {\
124 color: #E6DB74\
125 }\
126 .ace-monokai .ace_comment {\
127 color: #75715E\
128 }\
129 .ace-monokai .ace_markup.ace_underline {\
130 text-decoration: underline\
131 }\
132 .ace-monokai .ace_indent-guide {\
133 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y;\
134 }";
135
136 var dom = require("../lib/dom");
137 dom.importCssString(exports.cssText, exports.cssClass);
138 });
+0
-146
try/ace/theme-pastel_on_dark.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/pastel_on_dark', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-pastel-on-dark";
34 exports.cssText = ".ace-pastel-on-dark .ace_gutter {\
35 background: #353030;\
36 color: #8F938F\
37 }\
38 .ace-pastel-on-dark .ace_print-margin {\
39 width: 1px;\
40 background: #353030\
41 }\
42 .ace-pastel-on-dark {\
43 background-color: #2C2828;\
44 color: #8F938F\
45 }\
46 .ace-pastel-on-dark .ace_cursor {\
47 border-left: 2px solid #A7A7A7\
48 }\
49 .ace-pastel-on-dark .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #A7A7A7\
52 }\
53 .ace-pastel-on-dark .ace_marker-layer .ace_selection {\
54 background: rgba(221, 240, 255, 0.20)\
55 }\
56 .ace-pastel-on-dark.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #2C2828;\
58 border-radius: 2px\
59 }\
60 .ace-pastel-on-dark .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-pastel-on-dark .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid rgba(255, 255, 255, 0.25)\
66 }\
67 .ace-pastel-on-dark .ace_marker-layer .ace_active-line {\
68 background: rgba(255, 255, 255, 0.031)\
69 }\
70 .ace-pastel-on-dark .ace_gutter-active-line {\
71 background-color: rgba(255, 255, 255, 0.031)\
72 }\
73 .ace-pastel-on-dark .ace_marker-layer .ace_selected-word {\
74 border: 1px solid rgba(221, 240, 255, 0.20)\
75 }\
76 .ace-pastel-on-dark .ace_invisible {\
77 color: rgba(255, 255, 255, 0.25)\
78 }\
79 .ace-pastel-on-dark .ace_keyword,\
80 .ace-pastel-on-dark .ace_meta {\
81 color: #757aD8\
82 }\
83 .ace-pastel-on-dark .ace_constant,\
84 .ace-pastel-on-dark .ace_constant.ace_character,\
85 .ace-pastel-on-dark .ace_constant.ace_character.ace_escape,\
86 .ace-pastel-on-dark .ace_constant.ace_other {\
87 color: #4FB7C5\
88 }\
89 .ace-pastel-on-dark .ace_keyword.ace_operator {\
90 color: #797878\
91 }\
92 .ace-pastel-on-dark .ace_constant.ace_character {\
93 color: #AFA472\
94 }\
95 .ace-pastel-on-dark .ace_constant.ace_language {\
96 color: #DE8E30\
97 }\
98 .ace-pastel-on-dark .ace_constant.ace_numeric {\
99 color: #CCCCCC\
100 }\
101 .ace-pastel-on-dark .ace_invalid,\
102 .ace-pastel-on-dark .ace_invalid.ace_illegal {\
103 color: #F8F8F8;\
104 background-color: rgba(86, 45, 86, 0.75)\
105 }\
106 .ace-pastel-on-dark .ace_invalid.ace_deprecated {\
107 text-decoration: underline;\
108 font-style: italic;\
109 color: #D2A8A1\
110 }\
111 .ace-pastel-on-dark .ace_fold {\
112 background-color: #757aD8;\
113 border-color: #8F938F\
114 }\
115 .ace-pastel-on-dark .ace_support.ace_function {\
116 color: #AEB2F8\
117 }\
118 .ace-pastel-on-dark .ace_string {\
119 color: #66A968\
120 }\
121 .ace-pastel-on-dark .ace_string.ace_regexp {\
122 color: #E9C062\
123 }\
124 .ace-pastel-on-dark .ace_comment {\
125 color: #A6C6FF\
126 }\
127 .ace-pastel-on-dark .ace_variable {\
128 color: #BEBF55\
129 }\
130 .ace-pastel-on-dark .ace_variable.ace_language {\
131 color: #C1C144\
132 }\
133 .ace-pastel-on-dark .ace_xml-pe {\
134 color: #494949\
135 }\
136 .ace-pastel-on-dark .ace_markup.ace_underline {\
137 text-decoration: underline\
138 }\
139 .ace-pastel-on-dark .ace_indent-guide {\
140 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYIiPj/8PAARgAh2NTMh8AAAAAElFTkSuQmCC) right repeat-y;\
141 }";
142
143 var dom = require("../lib/dom");
144 dom.importCssString(exports.cssText, exports.cssClass);
145 });
+0
-129
try/ace/theme-solarized_dark.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/solarized_dark', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-solarized-dark";
34 exports.cssText = ".ace-solarized-dark .ace_gutter {\
35 background: #01313f;\
36 color: #d0edf7\
37 }\
38 .ace-solarized-dark .ace_print-margin {\
39 width: 1px;\
40 background: #33555E\
41 }\
42 .ace-solarized-dark {\
43 background-color: #002B36;\
44 color: #93A1A1\
45 }\
46 .ace-solarized-dark .ace_entity.ace_other.ace_attribute-name,\
47 .ace-solarized-dark .ace_storage,\
48 .ace-solarized-dark .ace_text-layer {\
49 color: #93A1A1\
50 }\
51 .ace-solarized-dark .ace_cursor {\
52 border-left: 2px solid #D30102\
53 }\
54 .ace-solarized-dark .ace_overwrite-cursors .ace_cursor {\
55 border-left: 0px;\
56 border-bottom: 1px solid #D30102\
57 }\
58 .ace-solarized-dark .ace_marker-layer .ace_active-line,\
59 .ace-solarized-dark .ace_marker-layer .ace_selection {\
60 background: rgba(255, 255, 255, 0.1)\
61 }\
62 .ace-solarized-dark.ace_multiselect .ace_selection.ace_start {\
63 box-shadow: 0 0 3px 0px #002B36;\
64 border-radius: 2px\
65 }\
66 .ace-solarized-dark .ace_marker-layer .ace_step {\
67 background: rgb(102, 82, 0)\
68 }\
69 .ace-solarized-dark .ace_marker-layer .ace_bracket {\
70 margin: -1px 0 0 -1px;\
71 border: 1px solid rgba(147, 161, 161, 0.50)\
72 }\
73 .ace-solarized-dark .ace_gutter-active-line {\
74 background-color: #0d3440\
75 }\
76 .ace-solarized-dark .ace_marker-layer .ace_selected-word {\
77 border: 1px solid #073642\
78 }\
79 .ace-solarized-dark .ace_invisible {\
80 color: rgba(147, 161, 161, 0.50)\
81 }\
82 .ace-solarized-dark .ace_keyword,\
83 .ace-solarized-dark .ace_meta,\
84 .ace-solarized-dark .ace_support.ace_class,\
85 .ace-solarized-dark .ace_support.ace_type {\
86 color: #859900\
87 }\
88 .ace-solarized-dark .ace_constant.ace_character,\
89 .ace-solarized-dark .ace_constant.ace_other {\
90 color: #CB4B16\
91 }\
92 .ace-solarized-dark .ace_constant.ace_language {\
93 color: #B58900\
94 }\
95 .ace-solarized-dark .ace_constant.ace_numeric {\
96 color: #D33682\
97 }\
98 .ace-solarized-dark .ace_fold {\
99 background-color: #268BD2;\
100 border-color: #93A1A1\
101 }\
102 .ace-solarized-dark .ace_entity.ace_name.ace_function,\
103 .ace-solarized-dark .ace_entity.ace_name.ace_tag,\
104 .ace-solarized-dark .ace_support.ace_function,\
105 .ace-solarized-dark .ace_variable,\
106 .ace-solarized-dark .ace_variable.ace_language {\
107 color: #268BD2\
108 }\
109 .ace-solarized-dark .ace_string {\
110 color: #2AA198\
111 }\
112 .ace-solarized-dark .ace_string.ace_regexp {\
113 color: #D30102\
114 }\
115 .ace-solarized-dark .ace_comment {\
116 font-style: italic;\
117 color: #657B83\
118 }\
119 .ace-solarized-dark .ace_markup.ace_underline {\
120 text-decoration: underline\
121 }\
122 .ace-solarized-dark .ace_indent-guide {\
123 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNg0Db1ZVCxc/sPAAd4AlUHlLenAAAAAElFTkSuQmCC) right repeat-y;\
124 }";
125
126 var dom = require("../lib/dom");
127 dom.importCssString(exports.cssText, exports.cssClass);
128 });
+0
-129
try/ace/theme-solarized_light.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/solarized_light', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = false;
33 exports.cssClass = "ace-solarized-light";
34 exports.cssText = ".ace-solarized-light .ace_gutter {\
35 background: #fbf1d3;\
36 color: #333\
37 }\
38 .ace-solarized-light .ace_print-margin {\
39 width: 1px;\
40 background: #e8e8e8\
41 }\
42 .ace-solarized-light {\
43 background-color: #FDF6E3;\
44 color: #586E75\
45 }\
46 .ace-solarized-light .ace_cursor {\
47 border-left: 2px solid #000000\
48 }\
49 .ace-solarized-light .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #000000\
52 }\
53 .ace-solarized-light .ace_marker-layer .ace_selection {\
54 background: rgba(7, 54, 67, 0.09)\
55 }\
56 .ace-solarized-light.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #FDF6E3;\
58 border-radius: 2px\
59 }\
60 .ace-solarized-light .ace_marker-layer .ace_step {\
61 background: rgb(255, 255, 0)\
62 }\
63 .ace-solarized-light .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid rgba(147, 161, 161, 0.50)\
66 }\
67 .ace-solarized-light .ace_marker-layer .ace_active-line {\
68 background: #EEE8D5\
69 }\
70 .ace-solarized-light .ace_gutter-active-line {\
71 background-color : #EDE5C1\
72 }\
73 .ace-solarized-light .ace_marker-layer .ace_selected-word {\
74 border: 1px solid #073642\
75 }\
76 .ace-solarized-light .ace_invisible {\
77 color: rgba(147, 161, 161, 0.50)\
78 }\
79 .ace-solarized-light .ace_keyword,\
80 .ace-solarized-light .ace_meta,\
81 .ace-solarized-light .ace_support.ace_class,\
82 .ace-solarized-light .ace_support.ace_type {\
83 color: #859900\
84 }\
85 .ace-solarized-light .ace_constant.ace_character,\
86 .ace-solarized-light .ace_constant.ace_other {\
87 color: #CB4B16\
88 }\
89 .ace-solarized-light .ace_constant.ace_language {\
90 color: #B58900\
91 }\
92 .ace-solarized-light .ace_constant.ace_numeric {\
93 color: #D33682\
94 }\
95 .ace-solarized-light .ace_fold {\
96 background-color: #268BD2;\
97 border-color: #586E75\
98 }\
99 .ace-solarized-light .ace_entity.ace_name.ace_function,\
100 .ace-solarized-light .ace_entity.ace_name.ace_tag,\
101 .ace-solarized-light .ace_support.ace_function,\
102 .ace-solarized-light .ace_variable,\
103 .ace-solarized-light .ace_variable.ace_language {\
104 color: #268BD2\
105 }\
106 .ace-solarized-light .ace_storage {\
107 color: #073642\
108 }\
109 .ace-solarized-light .ace_string {\
110 color: #2AA198\
111 }\
112 .ace-solarized-light .ace_string.ace_regexp {\
113 color: #D30102\
114 }\
115 .ace-solarized-light .ace_comment,\
116 .ace-solarized-light .ace_entity.ace_other.ace_attribute-name {\
117 color: #93A1A1\
118 }\
119 .ace-solarized-light .ace_markup.ace_underline {\
120 text-decoration: underline\
121 }\
122 .ace-solarized-light .ace_indent-guide {\
123 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHjy8NJ/AAjgA5fzQUmBAAAAAElFTkSuQmCC) right repeat-y;\
124 }";
125
126 var dom = require("../lib/dom");
127 dom.importCssString(exports.cssText, exports.cssClass);
128 });
+0
-152
try/ace/theme-terminal.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/terminal', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-terminal-theme";
34 exports.cssText = ".ace-terminal-theme .ace_gutter {\
35 background: #1a0005;\
36 color: steelblue\
37 }\
38 .ace-terminal-theme .ace_print-margin {\
39 width: 1px;\
40 background: #1a1a1a\
41 }\
42 .ace-terminal-theme {\
43 background-color: black;\
44 color: #DEDEDE\
45 }\
46 .ace-terminal-theme .ace_cursor {\
47 border-left: 2px solid springgreen\
48 }\
49 .ace-terminal-theme .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #9F9F9F\
52 }\
53 .ace-terminal-theme .ace_marker-layer .ace_selection {\
54 background: #424242\
55 }\
56 .ace-terminal-theme.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px black;\
58 border-radius: 2px\
59 }\
60 .ace-terminal-theme .ace_marker-layer .ace_step {\
61 background: rgb(0, 0, 0)\
62 }\
63 .ace-terminal-theme .ace_marker-layer .ace_bracket {\
64 background: #090;\
65 }\
66 .ace-terminal-theme .ace_marker-layer .ace_bracket-start {\
67 background: #090;\
68 }\
69 .ace-terminal-theme .ace_marker-layer .ace_bracket-unmatched {\
70 margin: -1px 0 0 -1px;\
71 border: 1px solid #900\
72 }\
73 .ace-terminal-theme .ace_marker-layer .ace_active-line {\
74 background: #2A2A2A\
75 }\
76 .ace-terminal-theme .ace_gutter-active-line {\
77 background-color: #2A112A\
78 }\
79 .ace-terminal-theme .ace_marker-layer .ace_selected-word {\
80 border: 1px solid #424242\
81 }\
82 .ace-terminal-theme .ace_invisible {\
83 color: #343434\
84 }\
85 .ace-terminal-theme .ace_keyword,\
86 .ace-terminal-theme .ace_meta,\
87 .ace-terminal-theme .ace_storage,\
88 .ace-terminal-theme .ace_storage.ace_type,\
89 .ace-terminal-theme .ace_support.ace_type {\
90 color: tomato\
91 }\
92 .ace-terminal-theme .ace_keyword.ace_operator {\
93 color: deeppink\
94 }\
95 .ace-terminal-theme .ace_constant.ace_character,\
96 .ace-terminal-theme .ace_constant.ace_language,\
97 .ace-terminal-theme .ace_constant.ace_numeric,\
98 .ace-terminal-theme .ace_keyword.ace_other.ace_unit,\
99 .ace-terminal-theme .ace_support.ace_constant,\
100 .ace-terminal-theme .ace_variable.ace_parameter {\
101 color: #E78C45\
102 }\
103 .ace-terminal-theme .ace_constant.ace_other {\
104 color: gold\
105 }\
106 .ace-terminal-theme .ace_invalid {\
107 color: yellow;\
108 background-color: red\
109 }\
110 .ace-terminal-theme .ace_invalid.ace_deprecated {\
111 color: #CED2CF;\
112 background-color: #B798BF\
113 }\
114 .ace-terminal-theme .ace_fold {\
115 background-color: #7AA6DA;\
116 border-color: #DEDEDE\
117 }\
118 .ace-terminal-theme .ace_entity.ace_name.ace_function,\
119 .ace-terminal-theme .ace_support.ace_function,\
120 .ace-terminal-theme .ace_variable {\
121 color: #7AA6DA\
122 }\
123 .ace-terminal-theme .ace_support.ace_class,\
124 .ace-terminal-theme .ace_support.ace_type {\
125 color: #E7C547\
126 }\
127 .ace-terminal-theme .ace_markup.ace_heading,\
128 .ace-terminal-theme .ace_string {\
129 color: #B9CA4A\
130 }\
131 .ace-terminal-theme .ace_entity.ace_name.ace_tag,\
132 .ace-terminal-theme .ace_entity.ace_other.ace_attribute-name,\
133 .ace-terminal-theme .ace_meta.ace_tag,\
134 .ace-terminal-theme .ace_string.ace_regexp,\
135 .ace-terminal-theme .ace_variable {\
136 color: #D54E53\
137 }\
138 .ace-terminal-theme .ace_comment {\
139 color: orangered\
140 }\
141 .ace-terminal-theme .ace_markup.ace_underline {\
142 text-decoration: underline\
143 }\
144 .ace-terminal-theme .ace_indent-guide {\
145 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYLBWV/8PAAK4AYnhiq+xAAAAAElFTkSuQmCC) right repeat-y;\
146 }\
147 ";
148
149 var dom = require("../lib/dom");
150 dom.importCssString(exports.cssText, exports.cssClass);
151 });
+0
-0
try/ace/theme-textmate.js less more
(Empty file)
+0
-146
try/ace/theme-tomorrow.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/tomorrow', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = false;
33 exports.cssClass = "ace-tomorrow";
34 exports.cssText = ".ace-tomorrow .ace_gutter {\
35 background: #f6f6f6;\
36 color: #4D4D4C\
37 }\
38 .ace-tomorrow .ace_print-margin {\
39 width: 1px;\
40 background: #f6f6f6\
41 }\
42 .ace-tomorrow,\
43 .ace-tomorrow .ace_scroller {\
44 background-color: #FFFFFF;\
45 color: #4D4D4C\
46 }\
47 .ace-tomorrow .ace_cursor {\
48 border-left: 2px solid #AEAFAD\
49 }\
50 .ace-tomorrow .ace_overwrite-cursors .ace_cursor {\
51 border-left: 0px;\
52 border-bottom: 1px solid #AEAFAD\
53 }\
54 .ace-tomorrow .ace_marker-layer .ace_selection {\
55 background: #D6D6D6\
56 }\
57 .ace-tomorrow.ace_multiselect .ace_selection.ace_start {\
58 box-shadow: 0 0 3px 0px #FFFFFF;\
59 border-radius: 2px\
60 }\
61 .ace-tomorrow .ace_marker-layer .ace_step {\
62 background: rgb(255, 255, 0)\
63 }\
64 .ace-tomorrow .ace_marker-layer .ace_bracket {\
65 margin: -1px 0 0 -1px;\
66 border: 1px solid #D1D1D1\
67 }\
68 .ace-tomorrow .ace_marker-layer .ace_active-line {\
69 background: #EFEFEF\
70 }\
71 .ace-tomorrow .ace_gutter-active-line {\
72 background-color : #dcdcdc\
73 }\
74 .ace-tomorrow .ace_marker-layer .ace_selected-word {\
75 border: 1px solid #D6D6D6\
76 }\
77 .ace-tomorrow .ace_invisible {\
78 color: #D1D1D1\
79 }\
80 .ace-tomorrow .ace_keyword,\
81 .ace-tomorrow .ace_meta,\
82 .ace-tomorrow .ace_storage,\
83 .ace-tomorrow .ace_storage.ace_type,\
84 .ace-tomorrow .ace_support.ace_type {\
85 color: #8959A8\
86 }\
87 .ace-tomorrow .ace_keyword.ace_operator {\
88 color: #3E999F\
89 }\
90 .ace-tomorrow .ace_constant.ace_character,\
91 .ace-tomorrow .ace_constant.ace_language,\
92 .ace-tomorrow .ace_constant.ace_numeric,\
93 .ace-tomorrow .ace_keyword.ace_other.ace_unit,\
94 .ace-tomorrow .ace_support.ace_constant,\
95 .ace-tomorrow .ace_variable.ace_parameter {\
96 color: #F5871F\
97 }\
98 .ace-tomorrow .ace_constant.ace_other {\
99 color: #666969\
100 }\
101 .ace-tomorrow .ace_invalid {\
102 color: #FFFFFF;\
103 background-color: #C82829\
104 }\
105 .ace-tomorrow .ace_invalid.ace_deprecated {\
106 color: #FFFFFF;\
107 background-color: #8959A8\
108 }\
109 .ace-tomorrow .ace_fold {\
110 background-color: #4271AE;\
111 border-color: #4D4D4C\
112 }\
113 .ace-tomorrow .ace_entity.ace_name.ace_function,\
114 .ace-tomorrow .ace_support.ace_function,\
115 .ace-tomorrow .ace_variable {\
116 color: #4271AE\
117 }\
118 .ace-tomorrow .ace_support.ace_class,\
119 .ace-tomorrow .ace_support.ace_type {\
120 color: #C99E00\
121 }\
122 .ace-tomorrow .ace_markup.ace_heading,\
123 .ace-tomorrow .ace_string {\
124 color: #718C00\
125 }\
126 .ace-tomorrow .ace_entity.ace_name.ace_tag,\
127 .ace-tomorrow .ace_entity.ace_other.ace_attribute-name,\
128 .ace-tomorrow .ace_meta.ace_tag,\
129 .ace-tomorrow .ace_string.ace_regexp,\
130 .ace-tomorrow .ace_variable {\
131 color: #C82829\
132 }\
133 .ace-tomorrow .ace_comment {\
134 color: #8E908C\
135 }\
136 .ace-tomorrow .ace_markup.ace_underline {\
137 text-decoration: underline\
138 }\
139 .ace-tomorrow .ace_indent-guide {\
140 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bdu3f/BwAlfgctduB85QAAAABJRU5ErkJggg==) right repeat-y\
141 }";
142
143 var dom = require("../lib/dom");
144 dom.importCssString(exports.cssText, exports.cssClass);
145 });
+0
-145
try/ace/theme-tomorrow_night.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/tomorrow_night', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-tomorrow-night";
34 exports.cssText = ".ace-tomorrow-night .ace_gutter {\
35 background: #25282c;\
36 color: #C5C8C6\
37 }\
38 .ace-tomorrow-night .ace_print-margin {\
39 width: 1px;\
40 background: #25282c\
41 }\
42 .ace-tomorrow-night {\
43 background-color: #1D1F21;\
44 color: #C5C8C6\
45 }\
46 .ace-tomorrow-night .ace_cursor {\
47 border-left: 2px solid #AEAFAD\
48 }\
49 .ace-tomorrow-night .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #AEAFAD\
52 }\
53 .ace-tomorrow-night .ace_marker-layer .ace_selection {\
54 background: #373B41\
55 }\
56 .ace-tomorrow-night.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #1D1F21;\
58 border-radius: 2px\
59 }\
60 .ace-tomorrow-night .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-tomorrow-night .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid #4B4E55\
66 }\
67 .ace-tomorrow-night .ace_marker-layer .ace_active-line {\
68 background: #282A2E\
69 }\
70 .ace-tomorrow-night .ace_gutter-active-line {\
71 background-color: #282A2E\
72 }\
73 .ace-tomorrow-night .ace_marker-layer .ace_selected-word {\
74 border: 1px solid #373B41\
75 }\
76 .ace-tomorrow-night .ace_invisible {\
77 color: #4B4E55\
78 }\
79 .ace-tomorrow-night .ace_keyword,\
80 .ace-tomorrow-night .ace_meta,\
81 .ace-tomorrow-night .ace_storage,\
82 .ace-tomorrow-night .ace_storage.ace_type,\
83 .ace-tomorrow-night .ace_support.ace_type {\
84 color: #B294BB\
85 }\
86 .ace-tomorrow-night .ace_keyword.ace_operator {\
87 color: #8ABEB7\
88 }\
89 .ace-tomorrow-night .ace_constant.ace_character,\
90 .ace-tomorrow-night .ace_constant.ace_language,\
91 .ace-tomorrow-night .ace_constant.ace_numeric,\
92 .ace-tomorrow-night .ace_keyword.ace_other.ace_unit,\
93 .ace-tomorrow-night .ace_support.ace_constant,\
94 .ace-tomorrow-night .ace_variable.ace_parameter {\
95 color: #DE935F\
96 }\
97 .ace-tomorrow-night .ace_constant.ace_other {\
98 color: #CED1CF\
99 }\
100 .ace-tomorrow-night .ace_invalid {\
101 color: #CED2CF;\
102 background-color: #DF5F5F\
103 }\
104 .ace-tomorrow-night .ace_invalid.ace_deprecated {\
105 color: #CED2CF;\
106 background-color: #B798BF\
107 }\
108 .ace-tomorrow-night .ace_fold {\
109 background-color: #81A2BE;\
110 border-color: #C5C8C6\
111 }\
112 .ace-tomorrow-night .ace_entity.ace_name.ace_function,\
113 .ace-tomorrow-night .ace_support.ace_function,\
114 .ace-tomorrow-night .ace_variable {\
115 color: #81A2BE\
116 }\
117 .ace-tomorrow-night .ace_support.ace_class,\
118 .ace-tomorrow-night .ace_support.ace_type {\
119 color: #F0C674\
120 }\
121 .ace-tomorrow-night .ace_markup.ace_heading,\
122 .ace-tomorrow-night .ace_string {\
123 color: #B5BD68\
124 }\
125 .ace-tomorrow-night .ace_entity.ace_name.ace_tag,\
126 .ace-tomorrow-night .ace_entity.ace_other.ace_attribute-name,\
127 .ace-tomorrow-night .ace_meta.ace_tag,\
128 .ace-tomorrow-night .ace_string.ace_regexp,\
129 .ace-tomorrow-night .ace_variable {\
130 color: #CC6666\
131 }\
132 .ace-tomorrow-night .ace_comment {\
133 color: #969896\
134 }\
135 .ace-tomorrow-night .ace_markup.ace_underline {\
136 text-decoration: underline\
137 }\
138 .ace-tomorrow-night .ace_indent-guide {\
139 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHB3d/8PAAOIAdULw8qMAAAAAElFTkSuQmCC) right repeat-y;\
140 }";
141
142 var dom = require("../lib/dom");
143 dom.importCssString(exports.cssText, exports.cssClass);
144 });
+0
-145
try/ace/theme-tomorrow_night_blue.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/tomorrow_night_blue', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-tomorrow-night-blue";
34 exports.cssText = ".ace-tomorrow-night-blue .ace_gutter {\
35 background: #00204b;\
36 color: #7388b5\
37 }\
38 .ace-tomorrow-night-blue .ace_print-margin {\
39 width: 1px;\
40 background: #00204b\
41 }\
42 .ace-tomorrow-night-blue {\
43 background-color: #002451;\
44 color: #FFFFFF\
45 }\
46 .ace-tomorrow-night-blue .ace_constant.ace_other {\
47 color: #FFFFFF\
48 }\
49 .ace-tomorrow-night-blue .ace_cursor {\
50 border-left: 2px solid #FFFFFF\
51 }\
52 .ace-tomorrow-night-blue .ace_overwrite-cursors .ace_cursor {\
53 border-left: 0px;\
54 border-bottom: 1px solid #FFFFFF\
55 }\
56 .ace-tomorrow-night-blue .ace_marker-layer .ace_selection {\
57 background: #003F8E\
58 }\
59 .ace-tomorrow-night-blue.ace_multiselect .ace_selection.ace_start {\
60 box-shadow: 0 0 3px 0px #002451;\
61 border-radius: 2px\
62 }\
63 .ace-tomorrow-night-blue .ace_marker-layer .ace_step {\
64 background: rgb(127, 111, 19)\
65 }\
66 .ace-tomorrow-night-blue .ace_marker-layer .ace_bracket {\
67 margin: -1px 0 0 -1px;\
68 border: 1px solid #404F7D\
69 }\
70 .ace-tomorrow-night-blue .ace_marker-layer .ace_active-line {\
71 background: #00346E\
72 }\
73 .ace-tomorrow-night-blue .ace_gutter-active-line {\
74 background-color: #022040\
75 }\
76 .ace-tomorrow-night-blue .ace_marker-layer .ace_selected-word {\
77 border: 1px solid #003F8E\
78 }\
79 .ace-tomorrow-night-blue .ace_invisible {\
80 color: #404F7D\
81 }\
82 .ace-tomorrow-night-blue .ace_keyword,\
83 .ace-tomorrow-night-blue .ace_meta,\
84 .ace-tomorrow-night-blue .ace_storage,\
85 .ace-tomorrow-night-blue .ace_storage.ace_type,\
86 .ace-tomorrow-night-blue .ace_support.ace_type {\
87 color: #EBBBFF\
88 }\
89 .ace-tomorrow-night-blue .ace_keyword.ace_operator {\
90 color: #99FFFF\
91 }\
92 .ace-tomorrow-night-blue .ace_constant.ace_character,\
93 .ace-tomorrow-night-blue .ace_constant.ace_language,\
94 .ace-tomorrow-night-blue .ace_constant.ace_numeric,\
95 .ace-tomorrow-night-blue .ace_keyword.ace_other.ace_unit,\
96 .ace-tomorrow-night-blue .ace_support.ace_constant,\
97 .ace-tomorrow-night-blue .ace_variable.ace_parameter {\
98 color: #FFC58F\
99 }\
100 .ace-tomorrow-night-blue .ace_invalid {\
101 color: #FFFFFF;\
102 background-color: #F99DA5\
103 }\
104 .ace-tomorrow-night-blue .ace_invalid.ace_deprecated {\
105 color: #FFFFFF;\
106 background-color: #EBBBFF\
107 }\
108 .ace-tomorrow-night-blue .ace_fold {\
109 background-color: #BBDAFF;\
110 border-color: #FFFFFF\
111 }\
112 .ace-tomorrow-night-blue .ace_entity.ace_name.ace_function,\
113 .ace-tomorrow-night-blue .ace_support.ace_function,\
114 .ace-tomorrow-night-blue .ace_variable {\
115 color: #BBDAFF\
116 }\
117 .ace-tomorrow-night-blue .ace_support.ace_class,\
118 .ace-tomorrow-night-blue .ace_support.ace_type {\
119 color: #FFEEAD\
120 }\
121 .ace-tomorrow-night-blue .ace_markup.ace_heading,\
122 .ace-tomorrow-night-blue .ace_string {\
123 color: #D1F1A9\
124 }\
125 .ace-tomorrow-night-blue .ace_entity.ace_name.ace_tag,\
126 .ace-tomorrow-night-blue .ace_entity.ace_other.ace_attribute-name,\
127 .ace-tomorrow-night-blue .ace_meta.ace_tag,\
128 .ace-tomorrow-night-blue .ace_string.ace_regexp,\
129 .ace-tomorrow-night-blue .ace_variable {\
130 color: #FF9DA4\
131 }\
132 .ace-tomorrow-night-blue .ace_comment {\
133 color: #7285B7\
134 }\
135 .ace-tomorrow-night-blue .ace_markup.ace_underline {\
136 text-decoration: underline\
137 }\
138 .ace-tomorrow-night-blue .ace_indent-guide {\
139 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYJDzqfwPAANXAeNsiA+ZAAAAAElFTkSuQmCC) right repeat-y;\
140 }";
141
142 var dom = require("../lib/dom");
143 dom.importCssString(exports.cssText, exports.cssClass);
144 });
+0
-145
try/ace/theme-tomorrow_night_bright.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/tomorrow_night_bright', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-tomorrow-night-bright";
34 exports.cssText = ".ace-tomorrow-night-bright .ace_gutter {\
35 background: #1a1a1a;\
36 color: #DEDEDE\
37 }\
38 .ace-tomorrow-night-bright .ace_print-margin {\
39 width: 1px;\
40 background: #1a1a1a\
41 }\
42 .ace-tomorrow-night-bright {\
43 background-color: #000000;\
44 color: #DEDEDE\
45 }\
46 .ace-tomorrow-night-bright .ace_cursor {\
47 border-left: 2px solid #9F9F9F\
48 }\
49 .ace-tomorrow-night-bright .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #9F9F9F\
52 }\
53 .ace-tomorrow-night-bright .ace_marker-layer .ace_selection {\
54 background: #424242\
55 }\
56 .ace-tomorrow-night-bright.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #000000;\
58 border-radius: 2px\
59 }\
60 .ace-tomorrow-night-bright .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-tomorrow-night-bright .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid #343434\
66 }\
67 .ace-tomorrow-night-bright .ace_marker-layer .ace_active-line {\
68 background: #2A2A2A\
69 }\
70 .ace-tomorrow-night-bright .ace_gutter-active-line {\
71 background-color: #2A2A2A\
72 }\
73 .ace-tomorrow-night-bright .ace_marker-layer .ace_selected-word {\
74 border: 1px solid #424242\
75 }\
76 .ace-tomorrow-night-bright .ace_invisible {\
77 color: #343434\
78 }\
79 .ace-tomorrow-night-bright .ace_keyword,\
80 .ace-tomorrow-night-bright .ace_meta,\
81 .ace-tomorrow-night-bright .ace_storage,\
82 .ace-tomorrow-night-bright .ace_storage.ace_type,\
83 .ace-tomorrow-night-bright .ace_support.ace_type {\
84 color: #C397D8\
85 }\
86 .ace-tomorrow-night-bright .ace_keyword.ace_operator {\
87 color: #70C0B1\
88 }\
89 .ace-tomorrow-night-bright .ace_constant.ace_character,\
90 .ace-tomorrow-night-bright .ace_constant.ace_language,\
91 .ace-tomorrow-night-bright .ace_constant.ace_numeric,\
92 .ace-tomorrow-night-bright .ace_keyword.ace_other.ace_unit,\
93 .ace-tomorrow-night-bright .ace_support.ace_constant,\
94 .ace-tomorrow-night-bright .ace_variable.ace_parameter {\
95 color: #E78C45\
96 }\
97 .ace-tomorrow-night-bright .ace_constant.ace_other {\
98 color: #EEEEEE\
99 }\
100 .ace-tomorrow-night-bright .ace_invalid {\
101 color: #CED2CF;\
102 background-color: #DF5F5F\
103 }\
104 .ace-tomorrow-night-bright .ace_invalid.ace_deprecated {\
105 color: #CED2CF;\
106 background-color: #B798BF\
107 }\
108 .ace-tomorrow-night-bright .ace_fold {\
109 background-color: #7AA6DA;\
110 border-color: #DEDEDE\
111 }\
112 .ace-tomorrow-night-bright .ace_entity.ace_name.ace_function,\
113 .ace-tomorrow-night-bright .ace_support.ace_function,\
114 .ace-tomorrow-night-bright .ace_variable {\
115 color: #7AA6DA\
116 }\
117 .ace-tomorrow-night-bright .ace_support.ace_class,\
118 .ace-tomorrow-night-bright .ace_support.ace_type {\
119 color: #E7C547\
120 }\
121 .ace-tomorrow-night-bright .ace_markup.ace_heading,\
122 .ace-tomorrow-night-bright .ace_string {\
123 color: #B9CA4A\
124 }\
125 .ace-tomorrow-night-bright .ace_entity.ace_name.ace_tag,\
126 .ace-tomorrow-night-bright .ace_entity.ace_other.ace_attribute-name,\
127 .ace-tomorrow-night-bright .ace_meta.ace_tag,\
128 .ace-tomorrow-night-bright .ace_string.ace_regexp,\
129 .ace-tomorrow-night-bright .ace_variable {\
130 color: #D54E53\
131 }\
132 .ace-tomorrow-night-bright .ace_comment {\
133 color: #969896\
134 }\
135 .ace-tomorrow-night-bright .ace_markup.ace_underline {\
136 text-decoration: underline\
137 }\
138 .ace-tomorrow-night-bright .ace_indent-guide {\
139 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYFBXV/8PAAJoAXX4kT2EAAAAAElFTkSuQmCC) right repeat-y;\
140 }";
141
142 var dom = require("../lib/dom");
143 dom.importCssString(exports.cssText, exports.cssClass);
144 });
+0
-144
try/ace/theme-tomorrow_night_eighties.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/tomorrow_night_eighties', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-tomorrow-night-eighties";
34 exports.cssText = ".ace-tomorrow-night-eighties .ace_gutter {\
35 background: #272727;\
36 color: #CCC\
37 }\
38 .ace-tomorrow-night-eighties .ace_print-margin {\
39 width: 1px;\
40 background: #272727\
41 }\
42 .ace-tomorrow-night-eighties {\
43 background-color: #2D2D2D;\
44 color: #CCCCCC\
45 }\
46 .ace-tomorrow-night-eighties .ace_constant.ace_other {\
47 color: #CCCCCC\
48 }\
49 .ace-tomorrow-night-eighties .ace_cursor {\
50 border-left: 2px solid #CCCCCC\
51 }\
52 .ace-tomorrow-night-eighties .ace_overwrite-cursors .ace_cursor {\
53 border-left: 0px;\
54 border-bottom: 1px solid #CCCCCC\
55 }\
56 .ace-tomorrow-night-eighties .ace_marker-layer .ace_selection {\
57 background: #515151\
58 }\
59 .ace-tomorrow-night-eighties.ace_multiselect .ace_selection.ace_start {\
60 box-shadow: 0 0 3px 0px #2D2D2D;\
61 border-radius: 2px\
62 }\
63 .ace-tomorrow-night-eighties .ace_marker-layer .ace_step {\
64 background: rgb(102, 82, 0)\
65 }\
66 .ace-tomorrow-night-eighties .ace_marker-layer .ace_bracket {\
67 margin: -1px 0 0 -1px;\
68 border: 1px solid #6A6A6A\
69 }\
70 .ace-tomorrow-night-eighties .ace_marker-layer .ace_active-line {\
71 background: #393939\
72 }\
73 .ace-tomorrow-night-eighties .ace_gutter-active-line {\
74 background-color: #393939\
75 }\
76 .ace-tomorrow-night-eighties .ace_marker-layer .ace_selected-word {\
77 border: 1px solid #515151\
78 }\
79 .ace-tomorrow-night-eighties .ace_invisible {\
80 color: #6A6A6A\
81 }\
82 .ace-tomorrow-night-eighties .ace_keyword,\
83 .ace-tomorrow-night-eighties .ace_meta,\
84 .ace-tomorrow-night-eighties .ace_storage,\
85 .ace-tomorrow-night-eighties .ace_storage.ace_type,\
86 .ace-tomorrow-night-eighties .ace_support.ace_type {\
87 color: #CC99CC\
88 }\
89 .ace-tomorrow-night-eighties .ace_keyword.ace_operator {\
90 color: #66CCCC\
91 }\
92 .ace-tomorrow-night-eighties .ace_constant.ace_character,\
93 .ace-tomorrow-night-eighties .ace_constant.ace_language,\
94 .ace-tomorrow-night-eighties .ace_constant.ace_numeric,\
95 .ace-tomorrow-night-eighties .ace_keyword.ace_other.ace_unit,\
96 .ace-tomorrow-night-eighties .ace_support.ace_constant,\
97 .ace-tomorrow-night-eighties .ace_variable.ace_parameter {\
98 color: #F99157\
99 }\
100 .ace-tomorrow-night-eighties .ace_invalid {\
101 color: #CDCDCD;\
102 background-color: #F2777A\
103 }\
104 .ace-tomorrow-night-eighties .ace_invalid.ace_deprecated {\
105 color: #CDCDCD;\
106 background-color: #CC99CC\
107 }\
108 .ace-tomorrow-night-eighties .ace_fold {\
109 background-color: #6699CC;\
110 border-color: #CCCCCC\
111 }\
112 .ace-tomorrow-night-eighties .ace_entity.ace_name.ace_function,\
113 .ace-tomorrow-night-eighties .ace_support.ace_function,\
114 .ace-tomorrow-night-eighties .ace_variable {\
115 color: #6699CC\
116 }\
117 .ace-tomorrow-night-eighties .ace_support.ace_class,\
118 .ace-tomorrow-night-eighties .ace_support.ace_type {\
119 color: #FFCC66\
120 }\
121 .ace-tomorrow-night-eighties .ace_markup.ace_heading,\
122 .ace-tomorrow-night-eighties .ace_string {\
123 color: #99CC99\
124 }\
125 .ace-tomorrow-night-eighties .ace_comment {\
126 color: #999999\
127 }\
128 .ace-tomorrow-night-eighties .ace_entity.ace_name.ace_tag,\
129 .ace-tomorrow-night-eighties .ace_entity.ace_other.ace_attribute-name,\
130 .ace-tomorrow-night-eighties .ace_meta.ace_tag,\
131 .ace-tomorrow-night-eighties .ace_variable {\
132 color: #F2777A\
133 }\
134 .ace-tomorrow-night-eighties .ace_markup.ace_underline {\
135 text-decoration: underline\
136 }\
137 .ace-tomorrow-night-eighties .ace_indent-guide {\
138 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ09NrYAgMjP4PAAtGAwchHMyAAAAAAElFTkSuQmCC) right repeat-y\
139 }";
140
141 var dom = require("../lib/dom");
142 dom.importCssString(exports.cssText, exports.cssClass);
143 });
+0
-145
try/ace/theme-twilight.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/twilight', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-twilight";
34 exports.cssText = ".ace-twilight .ace_gutter {\
35 background: #232323;\
36 color: #E2E2E2\
37 }\
38 .ace-twilight .ace_print-margin {\
39 width: 1px;\
40 background: #232323\
41 }\
42 .ace-twilight {\
43 background-color: #141414;\
44 color: #F8F8F8\
45 }\
46 .ace-twilight .ace_cursor {\
47 border-left: 2px solid #A7A7A7\
48 }\
49 .ace-twilight .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #A7A7A7\
52 }\
53 .ace-twilight .ace_marker-layer .ace_selection {\
54 background: rgba(221, 240, 255, 0.20)\
55 }\
56 .ace-twilight.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #141414;\
58 border-radius: 2px\
59 }\
60 .ace-twilight .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-twilight .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid rgba(255, 255, 255, 0.25)\
66 }\
67 .ace-twilight .ace_marker-layer .ace_active-line {\
68 background: rgba(255, 255, 255, 0.031)\
69 }\
70 .ace-twilight .ace_gutter-active-line {\
71 background-color: rgba(255, 255, 255, 0.031)\
72 }\
73 .ace-twilight .ace_marker-layer .ace_selected-word {\
74 border: 1px solid rgba(221, 240, 255, 0.20)\
75 }\
76 .ace-twilight .ace_invisible {\
77 color: rgba(255, 255, 255, 0.25)\
78 }\
79 .ace-twilight .ace_keyword,\
80 .ace-twilight .ace_meta {\
81 color: #CDA869\
82 }\
83 .ace-twilight .ace_constant,\
84 .ace-twilight .ace_constant.ace_character,\
85 .ace-twilight .ace_constant.ace_character.ace_escape,\
86 .ace-twilight .ace_constant.ace_other,\
87 .ace-twilight .ace_markup.ace_heading,\
88 .ace-twilight .ace_support.ace_constant {\
89 color: #CF6A4C\
90 }\
91 .ace-twilight .ace_invalid.ace_illegal {\
92 color: #F8F8F8;\
93 background-color: rgba(86, 45, 86, 0.75)\
94 }\
95 .ace-twilight .ace_invalid.ace_deprecated {\
96 text-decoration: underline;\
97 font-style: italic;\
98 color: #D2A8A1\
99 }\
100 .ace-twilight .ace_support {\
101 color: #9B859D\
102 }\
103 .ace-twilight .ace_fold {\
104 background-color: #AC885B;\
105 border-color: #F8F8F8\
106 }\
107 .ace-twilight .ace_support.ace_function {\
108 color: #DAD085\
109 }\
110 .ace-twilight .ace_markup.ace_list,\
111 .ace-twilight .ace_storage {\
112 color: #F9EE98\
113 }\
114 .ace-twilight .ace_entity.ace_name.ace_function,\
115 .ace-twilight .ace_meta.ace_tag,\
116 .ace-twilight .ace_variable {\
117 color: #AC885B\
118 }\
119 .ace-twilight .ace_string {\
120 color: #8F9D6A\
121 }\
122 .ace-twilight .ace_string.ace_regexp {\
123 color: #E9C062\
124 }\
125 .ace-twilight .ace_comment {\
126 font-style: italic;\
127 color: #5F5A60\
128 }\
129 .ace-twilight .ace_variable {\
130 color: #7587A6\
131 }\
132 .ace-twilight .ace_xml-pe {\
133 color: #494949\
134 }\
135 .ace-twilight .ace_markup.ace_underline {\
136 text-decoration: underline\
137 }\
138 .ace-twilight .ace_indent-guide {\
139 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQERFpYLC1tf0PAAgOAnPnhxyiAAAAAElFTkSuQmCC) right repeat-y;\
140 }";
141
142 var dom = require("../lib/dom");
143 dom.importCssString(exports.cssText, exports.cssClass);
144 });
+0
-129
try/ace/theme-vibrant_ink.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/vibrant_ink', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = true;
33 exports.cssClass = "ace-vibrant-ink";
34 exports.cssText = ".ace-vibrant-ink .ace_gutter {\
35 background: #1a1a1a;\
36 color: #BEBEBE\
37 }\
38 .ace-vibrant-ink .ace_print-margin {\
39 width: 1px;\
40 background: #1a1a1a\
41 }\
42 .ace-vibrant-ink {\
43 background-color: #0F0F0F;\
44 color: #FFFFFF\
45 }\
46 .ace-vibrant-ink .ace_cursor {\
47 border-left: 2px solid #FFFFFF\
48 }\
49 .ace-vibrant-ink .ace_overwrite-cursors .ace_cursor {\
50 border-left: 0px;\
51 border-bottom: 1px solid #FFFFFF\
52 }\
53 .ace-vibrant-ink .ace_marker-layer .ace_selection {\
54 background: #6699CC\
55 }\
56 .ace-vibrant-ink.ace_multiselect .ace_selection.ace_start {\
57 box-shadow: 0 0 3px 0px #0F0F0F;\
58 border-radius: 2px\
59 }\
60 .ace-vibrant-ink .ace_marker-layer .ace_step {\
61 background: rgb(102, 82, 0)\
62 }\
63 .ace-vibrant-ink .ace_marker-layer .ace_bracket {\
64 margin: -1px 0 0 -1px;\
65 border: 1px solid #404040\
66 }\
67 .ace-vibrant-ink .ace_marker-layer .ace_active-line {\
68 background: #333333\
69 }\
70 .ace-vibrant-ink .ace_gutter-active-line {\
71 background-color: #333333\
72 }\
73 .ace-vibrant-ink .ace_marker-layer .ace_selected-word {\
74 border: 1px solid #6699CC\
75 }\
76 .ace-vibrant-ink .ace_invisible {\
77 color: #404040\
78 }\
79 .ace-vibrant-ink .ace_keyword,\
80 .ace-vibrant-ink .ace_meta {\
81 color: #FF6600\
82 }\
83 .ace-vibrant-ink .ace_constant,\
84 .ace-vibrant-ink .ace_constant.ace_character,\
85 .ace-vibrant-ink .ace_constant.ace_character.ace_escape,\
86 .ace-vibrant-ink .ace_constant.ace_other {\
87 color: #339999\
88 }\
89 .ace-vibrant-ink .ace_constant.ace_numeric {\
90 color: #99CC99\
91 }\
92 .ace-vibrant-ink .ace_invalid,\
93 .ace-vibrant-ink .ace_invalid.ace_deprecated {\
94 color: #CCFF33;\
95 background-color: #000000\
96 }\
97 .ace-vibrant-ink .ace_fold {\
98 background-color: #FFCC00;\
99 border-color: #FFFFFF\
100 }\
101 .ace-vibrant-ink .ace_entity.ace_name.ace_function,\
102 .ace-vibrant-ink .ace_support.ace_function,\
103 .ace-vibrant-ink .ace_variable {\
104 color: #FFCC00\
105 }\
106 .ace-vibrant-ink .ace_variable.ace_parameter {\
107 font-style: italic\
108 }\
109 .ace-vibrant-ink .ace_string {\
110 color: #66FF00\
111 }\
112 .ace-vibrant-ink .ace_string.ace_regexp {\
113 color: #44B4CC\
114 }\
115 .ace-vibrant-ink .ace_comment {\
116 color: #9933CC\
117 }\
118 .ace-vibrant-ink .ace_entity.ace_other.ace_attribute-name {\
119 font-style: italic;\
120 color: #99CC99\
121 }\
122 .ace-vibrant-ink .ace_indent-guide {\
123 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYNDTc/oPAALPAZ7hxlbYAAAAAElFTkSuQmCC) right repeat-y;\
124 }";
125
126 var dom = require("../lib/dom");
127 dom.importCssString(exports.cssText, exports.cssClass);
128 });
+0
-123
try/ace/theme-xcode.js less more
0 /* ***** BEGIN LICENSE BLOCK *****
1 * Distributed under the BSD license:
2 *
3 * Copyright (c) 2010, Ajax.org B.V.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Ajax.org B.V. nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * ***** END LICENSE BLOCK ***** */
29
30 define('ace/theme/xcode', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
31
32 exports.isDark = false;
33 exports.cssClass = "ace-xcode";
34 exports.cssText = "/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: EE3AD170-2B7F-4DE1-B724-C75F13FE0085) */\
35 .ace-xcode .ace_gutter {\
36 background: #e8e8e8;\
37 color: #333\
38 }\
39 .ace-xcode .ace_print-margin {\
40 width: 1px;\
41 background: #e8e8e8\
42 }\
43 .ace-xcode {\
44 background-color: #FFFFFF;\
45 color: #000000\
46 }\
47 .ace-xcode .ace_cursor {\
48 border-left: 2px solid #000000\
49 }\
50 .ace-xcode .ace_overwrite-cursors .ace_cursor {\
51 border-left: 0px;\
52 border-bottom: 1px solid #000000\
53 }\
54 .ace-xcode .ace_marker-layer .ace_selection {\
55 background: #B5D5FF\
56 }\
57 .ace-xcode.ace_multiselect .ace_selection.ace_start {\
58 box-shadow: 0 0 3px 0px #FFFFFF;\
59 border-radius: 2px\
60 }\
61 .ace-xcode .ace_marker-layer .ace_step {\
62 background: rgb(198, 219, 174)\
63 }\
64 .ace-xcode .ace_marker-layer .ace_bracket {\
65 margin: -1px 0 0 -1px;\
66 border: 1px solid #BFBFBF\
67 }\
68 .ace-xcode .ace_marker-layer .ace_active-line {\
69 background: rgba(0, 0, 0, 0.071)\
70 }\
71 .ace-xcode .ace_gutter-active-line {\
72 background-color: rgba(0, 0, 0, 0.071)\
73 }\
74 .ace-xcode .ace_marker-layer .ace_selected-word {\
75 border: 1px solid #B5D5FF\
76 }\
77 .ace-xcode .ace_constant.ace_language,\
78 .ace-xcode .ace_keyword,\
79 .ace-xcode .ace_meta,\
80 .ace-xcode .ace_variable.ace_language {\
81 color: #C800A4\
82 }\
83 .ace-xcode .ace_invisible {\
84 color: #BFBFBF\
85 }\
86 .ace-xcode .ace_constant.ace_character,\
87 .ace-xcode .ace_constant.ace_other {\
88 color: #275A5E\
89 }\
90 .ace-xcode .ace_constant.ace_numeric {\
91 color: #3A00DC\
92 }\
93 .ace-xcode .ace_entity.ace_other.ace_attribute-name,\
94 .ace-xcode .ace_support.ace_constant,\
95 .ace-xcode .ace_support.ace_function {\
96 color: #450084\
97 }\
98 .ace-xcode .ace_fold {\
99 background-color: #C800A4;\
100 border-color: #000000\
101 }\
102 .ace-xcode .ace_entity.ace_name.ace_tag,\
103 .ace-xcode .ace_support.ace_class,\
104 .ace-xcode .ace_support.ace_type {\
105 color: #790EAD\
106 }\
107 .ace-xcode .ace_storage {\
108 color: #C900A4\
109 }\
110 .ace-xcode .ace_string {\
111 color: #DF0002\
112 }\
113 .ace-xcode .ace_comment {\
114 color: #008E00\
115 }\
116 .ace-xcode .ace_indent-guide {\
117 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==) right repeat-y\
118 }";
119
120 var dom = require("../lib/dom");
121 dom.importCssString(exports.cssText, exports.cssClass);
122 });
+0
-7442
try/ace/worker-coffee.js less more
0 "no use strict";
1 ;(function(window) {
2 if (typeof window.window != "undefined" && window.document) {
3 return;
4 }
5
6 window.console = {
7 log: function() {
8 var msgs = Array.prototype.slice.call(arguments, 0);
9 postMessage({type: "log", data: msgs});
10 },
11 error: function() {
12 var msgs = Array.prototype.slice.call(arguments, 0);
13 postMessage({type: "log", data: msgs});
14 }
15 };
16 window.window = window;
17 window.ace = window;
18
19 window.normalizeModule = function(parentId, moduleName) {
20 if (moduleName.indexOf("!") !== -1) {
21 var chunks = moduleName.split("!");
22 return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
23 }
24 if (moduleName.charAt(0) == ".") {
25 var base = parentId.split("/").slice(0, -1).join("/");
26 moduleName = base + "/" + moduleName;
27
28 while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
29 var previous = moduleName;
30 moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
31 }
32 }
33
34 return moduleName;
35 };
36
37 window.require = function(parentId, id) {
38 if (!id) {
39 id = parentId
40 parentId = null;
41 }
42 if (!id.charAt)
43 throw new Error("worker.js require() accepts only (parentId, id) as arguments");
44
45 id = normalizeModule(parentId, id);
46
47 var module = require.modules[id];
48 if (module) {
49 if (!module.initialized) {
50 module.initialized = true;
51 module.exports = module.factory().exports;
52 }
53 return module.exports;
54 }
55
56 var chunks = id.split("/");
57 chunks[0] = require.tlns[chunks[0]] || chunks[0];
58 var path = chunks.join("/") + ".js";
59
60 require.id = id;
61 importScripts(path);
62 return require(parentId, id);
63 };
64
65 require.modules = {};
66 require.tlns = {};
67
68 window.define = function(id, deps, factory) {
69 if (arguments.length == 2) {
70 factory = deps;
71 if (typeof id != "string") {
72 deps = id;
73 id = require.id;
74 }
75 } else if (arguments.length == 1) {
76 factory = id;
77 id = require.id;
78 }
79
80 if (id.indexOf("text!") === 0)
81 return;
82
83 var req = function(deps, factory) {
84 return require(id, deps, factory);
85 };
86
87 require.modules[id] = {
88 factory: function() {
89 var module = {
90 exports: {}
91 };
92 var returnExports = factory(req, module.exports, module);
93 if (returnExports)
94 module.exports = returnExports;
95 return module;
96 }
97 };
98 };
99
100 window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
101 require.tlns = topLevelNamespaces;
102 }
103
104 window.initSender = function initSender() {
105
106 var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
107 var oop = require("ace/lib/oop");
108
109 var Sender = function() {};
110
111 (function() {
112
113 oop.implement(this, EventEmitter);
114
115 this.callback = function(data, callbackId) {
116 postMessage({
117 type: "call",
118 id: callbackId,
119 data: data
120 });
121 };
122
123 this.emit = function(name, data) {
124 postMessage({
125 type: "event",
126 name: name,
127 data: data
128 });
129 };
130
131 }).call(Sender.prototype);
132
133 return new Sender();
134 }
135
136 window.main = null;
137 window.sender = null;
138
139 window.onmessage = function(e) {
140 var msg = e.data;
141 if (msg.command) {
142 if (main[msg.command])
143 main[msg.command].apply(main, msg.args);
144 else
145 throw new Error("Unknown command:" + msg.command);
146 }
147 else if (msg.init) {
148 initBaseUrls(msg.tlns);
149 require("ace/lib/es5-shim");
150 sender = initSender();
151 var clazz = require(msg.module)[msg.classname];
152 main = new clazz(sender);
153 }
154 else if (msg.event && sender) {
155 sender._emit(msg.event, msg.data);
156 }
157 };
158 })(this);
159
160 define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
161
162
163 var EventEmitter = {};
164 var stopPropagation = function() { this.propagationStopped = true; };
165 var preventDefault = function() { this.defaultPrevented = true; };
166
167 EventEmitter._emit =
168 EventEmitter._dispatchEvent = function(eventName, e) {
169 this._eventRegistry || (this._eventRegistry = {});
170 this._defaultHandlers || (this._defaultHandlers = {});
171
172 var listeners = this._eventRegistry[eventName] || [];
173 var defaultHandler = this._defaultHandlers[eventName];
174 if (!listeners.length && !defaultHandler)
175 return;
176
177 if (typeof e != "object" || !e)
178 e = {};
179
180 if (!e.type)
181 e.type = eventName;
182 if (!e.stopPropagation)
183 e.stopPropagation = stopPropagation;
184 if (!e.preventDefault)
185 e.preventDefault = preventDefault;
186
187 for (var i=0; i<listeners.length; i++) {
188 listeners[i](e, this);
189 if (e.propagationStopped)
190 break;
191 }
192
193 if (defaultHandler && !e.defaultPrevented)
194 return defaultHandler(e, this);
195 };
196
197
198 EventEmitter._signal = function(eventName, e) {
199 var listeners = (this._eventRegistry || {})[eventName];
200 if (!listeners)
201 return;
202
203 for (var i=0; i<listeners.length; i++)
204 listeners[i](e, this);
205 };
206
207 EventEmitter.once = function(eventName, callback) {
208 var _self = this;
209 callback && this.addEventListener(eventName, function newCallback() {
210 _self.removeEventListener(eventName, newCallback);
211 callback.apply(null, arguments);
212 });
213 };
214
215
216 EventEmitter.setDefaultHandler = function(eventName, callback) {
217 var handlers = this._defaultHandlers
218 if (!handlers)
219 handlers = this._defaultHandlers = {_disabled_: {}};
220
221 if (handlers[eventName]) {
222 var old = handlers[eventName];
223 var disabled = handlers._disabled_[eventName];
224 if (!disabled)
225 handlers._disabled_[eventName] = disabled = [];
226 disabled.push(old);
227 var i = disabled.indexOf(callback);
228 if (i != -1)
229 disabled.splice(i, 1);
230 }
231 handlers[eventName] = callback;
232 };
233 EventEmitter.removeDefaultHandler = function(eventName, callback) {
234 var handlers = this._defaultHandlers
235 if (!handlers)
236 return;
237 var disabled = handlers._disabled_[eventName];
238
239 if (handlers[eventName] == callback) {
240 var old = handlers[eventName];
241 if (disabled)
242 this.setDefaultHandler(eventName, disabled.pop());
243 } else if (disabled) {
244 var i = disabled.indexOf(callback);
245 if (i != -1)
246 disabled.splice(i, 1);
247 }
248 };
249
250 EventEmitter.on =
251 EventEmitter.addEventListener = function(eventName, callback, capturing) {
252 this._eventRegistry = this._eventRegistry || {};
253
254 var listeners = this._eventRegistry[eventName];
255 if (!listeners)
256 listeners = this._eventRegistry[eventName] = [];
257
258 if (listeners.indexOf(callback) == -1)
259 listeners[capturing ? "unshift" : "push"](callback);
260 return callback;
261 };
262
263 EventEmitter.off =
264 EventEmitter.removeListener =
265 EventEmitter.removeEventListener = function(eventName, callback) {
266 this._eventRegistry = this._eventRegistry || {};
267
268 var listeners = this._eventRegistry[eventName];
269 if (!listeners)
270 return;
271
272 var index = listeners.indexOf(callback);
273 if (index !== -1)
274 listeners.splice(index, 1);
275 };
276
277 EventEmitter.removeAllListeners = function(eventName) {
278 if (this._eventRegistry) this._eventRegistry[eventName] = [];
279 };
280
281 exports.EventEmitter = EventEmitter;
282
283 });
284
285 define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
286
287
288 exports.inherits = (function() {
289 var tempCtor = function() {};
290 return function(ctor, superCtor) {
291 tempCtor.prototype = superCtor.prototype;
292 ctor.super_ = superCtor.prototype;
293 ctor.prototype = new tempCtor();
294 ctor.prototype.constructor = ctor;
295 };
296 }());
297
298 exports.mixin = function(obj, mixin) {
299 for (var key in mixin) {
300 obj[key] = mixin[key];
301 }
302 return obj;
303 };
304
305 exports.implement = function(proto, mixin) {
306 exports.mixin(proto, mixin);
307 };
308
309 });
310
311 define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) {
312
313 function Empty() {}
314
315 if (!Function.prototype.bind) {
316 Function.prototype.bind = function bind(that) { // .length is 1
317 var target = this;
318 if (typeof target != "function") {
319 throw new TypeError("Function.prototype.bind called on incompatible " + target);
320 }
321 var args = slice.call(arguments, 1); // for normal call
322 var bound = function () {
323
324 if (this instanceof bound) {
325
326 var result = target.apply(
327 this,
328 args.concat(slice.call(arguments))
329 );
330 if (Object(result) === result) {
331 return result;
332 }
333 return this;
334
335 } else {
336 return target.apply(
337 that,
338 args.concat(slice.call(arguments))
339 );
340
341 }
342
343 };
344 if(target.prototype) {
345 Empty.prototype = target.prototype;
346 bound.prototype = new Empty();
347 Empty.prototype = null;
348 }
349 return bound;
350 };
351 }
352 var call = Function.prototype.call;
353 var prototypeOfArray = Array.prototype;
354 var prototypeOfObject = Object.prototype;
355 var slice = prototypeOfArray.slice;
356 var _toString = call.bind(prototypeOfObject.toString);
357 var owns = call.bind(prototypeOfObject.hasOwnProperty);
358 var defineGetter;
359 var defineSetter;
360 var lookupGetter;
361 var lookupSetter;
362 var supportsAccessors;
363 if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
364 defineGetter = call.bind(prototypeOfObject.__defineGetter__);
365 defineSetter = call.bind(prototypeOfObject.__defineSetter__);
366 lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
367 lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
368 }
369 if ([1,2].splice(0).length != 2) {
370 if(function() { // test IE < 9 to splice bug - see issue #138
371 function makeArray(l) {
372 var a = new Array(l+2);
373 a[0] = a[1] = 0;
374 return a;
375 }
376 var array = [], lengthBefore;
377
378 array.splice.apply(array, makeArray(20));
379 array.splice.apply(array, makeArray(26));
380
381 lengthBefore = array.length; //46
382 array.splice(5, 0, "XXX"); // add one element
383
384 lengthBefore + 1 == array.length
385
386 if (lengthBefore + 1 == array.length) {
387 return true;// has right splice implementation without bugs
388 }
389 }()) {//IE 6/7
390 var array_splice = Array.prototype.splice;
391 Array.prototype.splice = function(start, deleteCount) {
392 if (!arguments.length) {
393 return [];
394 } else {
395 return array_splice.apply(this, [
396 start === void 0 ? 0 : start,
397 deleteCount === void 0 ? (this.length - start) : deleteCount
398 ].concat(slice.call(arguments, 2)))
399 }
400 };
401 } else {//IE8
402 Array.prototype.splice = function(pos, removeCount){
403 var length = this.length;
404 if (pos > 0) {
405 if (pos > length)
406 pos = length;
407 } else if (pos == void 0) {
408 pos = 0;
409 } else if (pos < 0) {
410 pos = Math.max(length + pos, 0);
411 }
412
413 if (!(pos+removeCount < length))
414 removeCount = length - pos;
415
416 var removed = this.slice(pos, pos+removeCount);
417 var insert = slice.call(arguments, 2);
418 var add = insert.length;
419 if (pos === length) {
420 if (add) {
421 this.push.apply(this, insert);
422 }
423 } else {
424 var remove = Math.min(removeCount, length - pos);
425 var tailOldPos = pos + remove;
426 var tailNewPos = tailOldPos + add - remove;
427 var tailCount = length - tailOldPos;
428 var lengthAfterRemove = length - remove;
429
430 if (tailNewPos < tailOldPos) { // case A
431 for (var i = 0; i < tailCount; ++i) {
432 this[tailNewPos+i] = this[tailOldPos+i];
433 }
434 } else if (tailNewPos > tailOldPos) { // case B
435 for (i = tailCount; i--; ) {
436 this[tailNewPos+i] = this[tailOldPos+i];
437 }
438 } // else, add == remove (nothing to do)
439
440 if (add && pos === lengthAfterRemove) {
441 this.length = lengthAfterRemove; // truncate array
442 this.push.apply(this, insert);
443 } else {
444 this.length = lengthAfterRemove + add; // reserves space
445 for (i = 0; i < add; ++i) {
446 this[pos+i] = insert[i];
447 }
448 }
449 }
450 return removed;
451 };
452 }
453 }
454 if (!Array.isArray) {
455 Array.isArray = function isArray(obj) {
456 return _toString(obj) == "[object Array]";
457 };
458 }
459 var boxedString = Object("a"),
460 splitString = boxedString[0] != "a" || !(0 in boxedString);
461
462 if (!Array.prototype.forEach) {
463 Array.prototype.forEach = function forEach(fun /*, thisp*/) {
464 var object = toObject(this),
465 self = splitString && _toString(this) == "[object String]" ?
466 this.split("") :
467 object,
468 thisp = arguments[1],
469 i = -1,
470 length = self.length >>> 0;
471 if (_toString(fun) != "[object Function]") {
472 throw new TypeError(); // TODO message
473 }
474
475 while (++i < length) {
476 if (i in self) {
477 fun.call(thisp, self[i], i, object);
478 }
479 }
480 };
481 }
482 if (!Array.prototype.map) {
483 Array.prototype.map = function map(fun /*, thisp*/) {
484 var object = toObject(this),
485 self = splitString && _toString(this) == "[object String]" ?
486 this.split("") :
487 object,
488 length = self.length >>> 0,
489 result = Array(length),
490 thisp = arguments[1];
491 if (_toString(fun) != "[object Function]") {
492 throw new TypeError(fun + " is not a function");
493 }
494
495 for (var i = 0; i < length; i++) {
496 if (i in self)
497 result[i] = fun.call(thisp, self[i], i, object);
498 }
499 return result;
500 };
501 }
502 if (!Array.prototype.filter) {
503 Array.prototype.filter = function filter(fun /*, thisp */) {
504 var object = toObject(this),
505 self = splitString && _toString(this) == "[object String]" ?
506 this.split("") :
507 object,
508 length = self.length >>> 0,
509 result = [],
510 value,
511 thisp = arguments[1];
512 if (_toString(fun) != "[object Function]") {
513 throw new TypeError(fun + " is not a function");
514 }
515
516 for (var i = 0; i < length; i++) {
517 if (i in self) {
518 value = self[i];
519 if (fun.call(thisp, value, i, object)) {
520 result.push(value);
521 }
522 }
523 }
524 return result;
525 };
526 }
527 if (!Array.prototype.every) {
528 Array.prototype.every = function every(fun /*, thisp */) {
529 var object = toObject(this),
530 self = splitString && _toString(this) == "[object String]" ?
531 this.split("") :
532 object,
533 length = self.length >>> 0,
534 thisp = arguments[1];
535 if (_toString(fun) != "[object Function]") {
536 throw new TypeError(fun + " is not a function");
537 }
538
539 for (var i = 0; i < length; i++) {
540 if (i in self && !fun.call(thisp, self[i], i, object)) {
541 return false;
542 }
543 }
544 return true;
545 };
546 }
547 if (!Array.prototype.some) {
548 Array.prototype.some = function some(fun /*, thisp */) {
549 var object = toObject(this),
550 self = splitString && _toString(this) == "[object String]" ?
551 this.split("") :
552 object,
553 length = self.length >>> 0,
554 thisp = arguments[1];
555 if (_toString(fun) != "[object Function]") {
556 throw new TypeError(fun + " is not a function");
557 }
558
559 for (var i = 0; i < length; i++) {
560 if (i in self && fun.call(thisp, self[i], i, object)) {
561 return true;
562 }
563 }
564 return false;
565 };
566 }
567 if (!Array.prototype.reduce) {
568 Array.prototype.reduce = function reduce(fun /*, initial*/) {
569 var object = toObject(this),
570 self = splitString && _toString(this) == "[object String]" ?
571 this.split("") :
572 object,
573 length = self.length >>> 0;
574 if (_toString(fun) != "[object Function]") {
575 throw new TypeError(fun + " is not a function");
576 }
577 if (!length && arguments.length == 1) {
578 throw new TypeError("reduce of empty array with no initial value");
579 }
580
581 var i = 0;
582 var result;
583 if (arguments.length >= 2) {
584 result = arguments[1];
585 } else {
586 do {
587 if (i in self) {
588 result = self[i++];
589 break;
590 }
591 if (++i >= length) {
592 throw new TypeError("reduce of empty array with no initial value");
593 }
594 } while (true);
595 }
596
597 for (; i < length; i++) {
598 if (i in self) {
599 result = fun.call(void 0, result, self[i], i, object);
600 }
601 }
602
603 return result;
604 };
605 }
606 if (!Array.prototype.reduceRight) {
607 Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
608 var object = toObject(this),
609 self = splitString && _toString(this) == "[object String]" ?
610 this.split("") :
611 object,
612 length = self.length >>> 0;
613 if (_toString(fun) != "[object Function]") {
614 throw new TypeError(fun + " is not a function");
615 }
616 if (!length && arguments.length == 1) {
617 throw new TypeError("reduceRight of empty array with no initial value");
618 }
619
620 var result, i = length - 1;
621 if (arguments.length >= 2) {
622 result = arguments[1];
623 } else {
624 do {
625 if (i in self) {
626 result = self[i--];
627 break;
628 }
629 if (--i < 0) {
630 throw new TypeError("reduceRight of empty array with no initial value");
631 }
632 } while (true);
633 }
634
635 do {
636 if (i in this) {
637 result = fun.call(void 0, result, self[i], i, object);
638 }
639 } while (i--);
640
641 return result;
642 };
643 }
644 if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
645 Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
646 var self = splitString && _toString(this) == "[object String]" ?
647 this.split("") :
648 toObject(this),
649 length = self.length >>> 0;
650
651 if (!length) {
652 return -1;
653 }
654
655 var i = 0;
656 if (arguments.length > 1) {
657 i = toInteger(arguments[1]);
658 }
659 i = i >= 0 ? i : Math.max(0, length + i);
660 for (; i < length; i++) {
661 if (i in self && self[i] === sought) {
662 return i;
663 }
664 }
665 return -1;
666 };
667 }
668 if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
669 Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
670 var self = splitString && _toString(this) == "[object String]" ?
671 this.split("") :
672 toObject(this),
673 length = self.length >>> 0;
674
675 if (!length) {
676 return -1;
677 }
678 var i = length - 1;
679 if (arguments.length > 1) {
680 i = Math.min(i, toInteger(arguments[1]));
681 }
682 i = i >= 0 ? i : length - Math.abs(i);
683 for (; i >= 0; i--) {
684 if (i in self && sought === self[i]) {
685 return i;
686 }
687 }
688 return -1;
689 };
690 }
691 if (!Object.getPrototypeOf) {
692 Object.getPrototypeOf = function getPrototypeOf(object) {
693 return object.__proto__ || (
694 object.constructor ?
695 object.constructor.prototype :
696 prototypeOfObject
697 );
698 };
699 }
700 if (!Object.getOwnPropertyDescriptor) {
701 var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
702 "non-object: ";
703 Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
704 if ((typeof object != "object" && typeof object != "function") || object === null)
705 throw new TypeError(ERR_NON_OBJECT + object);
706 if (!owns(object, property))
707 return;
708
709 var descriptor, getter, setter;
710 descriptor = { enumerable: true, configurable: true };
711 if (supportsAccessors) {
712 var prototype = object.__proto__;
713 object.__proto__ = prototypeOfObject;
714
715 var getter = lookupGetter(object, property);
716 var setter = lookupSetter(object, property);
717 object.__proto__ = prototype;
718
719 if (getter || setter) {
720 if (getter) descriptor.get = getter;
721 if (setter) descriptor.set = setter;
722 return descriptor;
723 }
724 }
725 descriptor.value = object[property];
726 return descriptor;
727 };
728 }
729 if (!Object.getOwnPropertyNames) {
730 Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
731 return Object.keys(object);
732 };
733 }
734 if (!Object.create) {
735 var createEmpty;
736 if (Object.prototype.__proto__ === null) {
737 createEmpty = function () {
738 return { "__proto__": null };
739 };
740 } else {
741 createEmpty = function () {
742 var empty = {};
743 for (var i in empty)
744 empty[i] = null;
745 empty.constructor =
746 empty.hasOwnProperty =
747 empty.propertyIsEnumerable =
748 empty.isPrototypeOf =
749 empty.toLocaleString =
750 empty.toString =
751 empty.valueOf =
752 empty.__proto__ = null;
753 return empty;
754 }
755 }
756
757 Object.create = function create(prototype, properties) {
758 var object;
759 if (prototype === null) {
760 object = createEmpty();
761 } else {
762 if (typeof prototype != "object")
763 throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
764 var Type = function () {};
765 Type.prototype = prototype;
766 object = new Type();
767 object.__proto__ = prototype;
768 }
769 if (properties !== void 0)
770 Object.defineProperties(object, properties);
771 return object;
772 };
773 }
774
775 function doesDefinePropertyWork(object) {
776 try {
777 Object.defineProperty(object, "sentinel", {});
778 return "sentinel" in object;
779 } catch (exception) {
780 }
781 }
782 if (Object.defineProperty) {
783 var definePropertyWorksOnObject = doesDefinePropertyWork({});
784 var definePropertyWorksOnDom = typeof document == "undefined" ||
785 doesDefinePropertyWork(document.createElement("div"));
786 if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
787 var definePropertyFallback = Object.defineProperty;
788 }
789 }
790
791 if (!Object.defineProperty || definePropertyFallback) {
792 var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
793 var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
794 var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
795 "on this javascript engine";
796
797 Object.defineProperty = function defineProperty(object, property, descriptor) {
798 if ((typeof object != "object" && typeof object != "function") || object === null)
799 throw new TypeError(ERR_NON_OBJECT_TARGET + object);
800 if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
801 throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
802 if (definePropertyFallback) {
803 try {
804 return definePropertyFallback.call(Object, object, property, descriptor);
805 } catch (exception) {
806 }
807 }
808 if (owns(descriptor, "value")) {
809
810 if (supportsAccessors && (lookupGetter(object, property) ||
811 lookupSetter(object, property)))
812 {
813 var prototype = object.__proto__;
814 object.__proto__ = prototypeOfObject;
815 delete object[property];
816 object[property] = descriptor.value;
817 object.__proto__ = prototype;
818 } else {
819 object[property] = descriptor.value;
820 }
821 } else {
822 if (!supportsAccessors)
823 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
824 if (owns(descriptor, "get"))
825 defineGetter(object, property, descriptor.get);
826 if (owns(descriptor, "set"))
827 defineSetter(object, property, descriptor.set);
828 }
829
830 return object;
831 };
832 }
833 if (!Object.defineProperties) {
834 Object.defineProperties = function defineProperties(object, properties) {
835 for (var property in properties) {
836 if (owns(properties, property))
837 Object.defineProperty(object, property, properties[property]);
838 }
839 return object;
840 };
841 }
842 if (!Object.seal) {
843 Object.seal = function seal(object) {
844 return object;
845 };
846 }
847 if (!Object.freeze) {
848 Object.freeze = function freeze(object) {
849 return object;
850 };
851 }
852 try {
853 Object.freeze(function () {});
854 } catch (exception) {
855 Object.freeze = (function freeze(freezeObject) {
856 return function freeze(object) {
857 if (typeof object == "function") {
858 return object;
859 } else {
860 return freezeObject(object);
861 }
862 };
863 })(Object.freeze);
864 }
865 if (!Object.preventExtensions) {
866 Object.preventExtensions = function preventExtensions(object) {
867 return object;
868 };
869 }
870 if (!Object.isSealed) {
871 Object.isSealed = function isSealed(object) {
872 return false;
873 };
874 }
875 if (!Object.isFrozen) {
876 Object.isFrozen = function isFrozen(object) {
877 return false;
878 };
879 }
880 if (!Object.isExtensible) {
881 Object.isExtensible = function isExtensible(object) {
882 if (Object(object) === object) {
883 throw new TypeError(); // TODO message
884 }
885 var name = '';
886 while (owns(object, name)) {
887 name += '?';
888 }
889 object[name] = true;
890 var returnValue = owns(object, name);
891 delete object[name];
892 return returnValue;
893 };
894 }
895 if (!Object.keys) {
896 var hasDontEnumBug = true,
897 dontEnums = [
898 "toString",
899 "toLocaleString",
900 "valueOf",
901 "hasOwnProperty",
902 "isPrototypeOf",
903 "propertyIsEnumerable",
904 "constructor"
905 ],
906 dontEnumsLength = dontEnums.length;
907
908 for (var key in {"toString": null}) {
909 hasDontEnumBug = false;
910 }
911
912 Object.keys = function keys(object) {
913
914 if (
915 (typeof object != "object" && typeof object != "function") ||
916 object === null
917 ) {
918 throw new TypeError("Object.keys called on a non-object");
919 }
920
921 var keys = [];
922 for (var name in object) {
923 if (owns(object, name)) {
924 keys.push(name);
925 }
926 }
927
928 if (hasDontEnumBug) {
929 for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
930 var dontEnum = dontEnums[i];
931 if (owns(object, dontEnum)) {
932 keys.push(dontEnum);
933 }
934 }
935 }
936 return keys;
937 };
938
939 }
940 if (!Date.now) {
941 Date.now = function now() {
942 return new Date().getTime();
943 };
944 }
945 var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
946 "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
947 "\u2029\uFEFF";
948 if (!String.prototype.trim || ws.trim()) {
949 ws = "[" + ws + "]";
950 var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
951 trimEndRegexp = new RegExp(ws + ws + "*$");
952 String.prototype.trim = function trim() {
953 return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
954 };
955 }
956
957 function toInteger(n) {
958 n = +n;
959 if (n !== n) { // isNaN
960 n = 0;
961 } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
962 n = (n > 0 || -1) * Math.floor(Math.abs(n));
963 }
964 return n;
965 }
966
967 function isPrimitive(input) {
968 var type = typeof input;
969 return (
970 input === null ||
971 type === "undefined" ||
972 type === "boolean" ||
973 type === "number" ||
974 type === "string"
975 );
976 }
977
978 function toPrimitive(input) {
979 var val, valueOf, toString;
980 if (isPrimitive(input)) {
981 return input;
982 }
983 valueOf = input.valueOf;
984 if (typeof valueOf === "function") {
985 val = valueOf.call(input);
986 if (isPrimitive(val)) {
987 return val;
988 }
989 }
990 toString = input.toString;
991 if (typeof toString === "function") {
992 val = toString.call(input);
993 if (isPrimitive(val)) {
994 return val;
995 }
996 }
997 throw new TypeError();
998 }
999 var toObject = function (o) {
1000 if (o == null) { // this matches both null and undefined
1001 throw new TypeError("can't convert "+o+" to object");
1002 }
1003 return Object(o);
1004 };
1005
1006 });
1007
1008 define('ace/mode/coffee_worker', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/worker/mirror', 'ace/mode/coffee/coffee-script'], function(require, exports, module) {
1009
1010
1011 var oop = require("../lib/oop");
1012 var Mirror = require("../worker/mirror").Mirror;
1013 var coffee = require("../mode/coffee/coffee-script");
1014
1015 window.addEventListener = function() {};
1016
1017
1018 var Worker = exports.Worker = function(sender) {
1019 Mirror.call(this, sender);
1020 this.setTimeout(250);
1021 };
1022
1023 oop.inherits(Worker, Mirror);
1024
1025 (function() {
1026
1027 this.onUpdate = function() {
1028 var value = this.doc.getValue();
1029
1030 try {
1031 coffee.parse(value).compile();
1032 } catch(e) {
1033 var loc = e.location;
1034 if (loc) {
1035 this.sender.emit("error", {
1036 row: loc.first_line,
1037 column: loc.first_column,
1038 endRow: loc.last_line,
1039 endColumn: loc.last_column,
1040 text: e.message,
1041 type: "error"
1042 });
1043 }
1044 return;
1045 }
1046 this.sender.emit("ok");
1047 };
1048
1049 }).call(Worker.prototype);
1050
1051 });
1052 define('ace/worker/mirror', ['require', 'exports', 'module' , 'ace/document', 'ace/lib/lang'], function(require, exports, module) {
1053
1054
1055 var Document = require("../document").Document;
1056 var lang = require("../lib/lang");
1057
1058 var Mirror = exports.Mirror = function(sender) {
1059 this.sender = sender;
1060 var doc = this.doc = new Document("");
1061
1062 var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1063
1064 var _self = this;
1065 sender.on("change", function(e) {
1066 doc.applyDeltas(e.data);
1067 deferredUpdate.schedule(_self.$timeout);
1068 });
1069 };
1070
1071 (function() {
1072
1073 this.$timeout = 500;
1074
1075 this.setTimeout = function(timeout) {
1076 this.$timeout = timeout;
1077 };
1078
1079 this.setValue = function(value) {
1080 this.doc.setValue(value);
1081 this.deferredUpdate.schedule(this.$timeout);
1082 };
1083
1084 this.getValue = function(callbackId) {
1085 this.sender.callback(this.doc.getValue(), callbackId);
1086 };
1087
1088 this.onUpdate = function() {
1089 };
1090
1091 }).call(Mirror.prototype);
1092
1093 });
1094
1095 define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
1096
1097
1098 var oop = require("./lib/oop");
1099 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1100 var Range = require("./range").Range;
1101 var Anchor = require("./anchor").Anchor;
1102
1103 var Document = function(text) {
1104 this.$lines = [];
1105 if (text.length == 0) {
1106 this.$lines = [""];
1107 } else if (Array.isArray(text)) {
1108 this._insertLines(0, text);
1109 } else {
1110 this.insert({row: 0, column:0}, text);
1111 }
1112 };
1113
1114 (function() {
1115
1116 oop.implement(this, EventEmitter);
1117 this.setValue = function(text) {
1118 var len = this.getLength();
1119 this.remove(new Range(0, 0, len, this.getLine(len-1).length));
1120 this.insert({row: 0, column:0}, text);
1121 };
1122 this.getValue = function() {
1123 return this.getAllLines().join(this.getNewLineCharacter());
1124 };
1125 this.createAnchor = function(row, column) {
1126 return new Anchor(this, row, column);
1127 };
1128 if ("aaa".split(/a/).length == 0)
1129 this.$split = function(text) {
1130 return text.replace(/\r\n|\r/g, "\n").split("\n");
1131 }
1132 else
1133 this.$split = function(text) {
1134 return text.split(/\r\n|\r|\n/);
1135 };
1136
1137
1138 this.$detectNewLine = function(text) {
1139 var match = text.match(/^.*?(\r\n|\r|\n)/m);
1140 this.$autoNewLine = match ? match[1] : "\n";
1141 };
1142 this.getNewLineCharacter = function() {
1143 switch (this.$newLineMode) {
1144 case "windows":
1145 return "\r\n";
1146 case "unix":
1147 return "\n";
1148 default:
1149 return this.$autoNewLine;
1150 }
1151 };
1152
1153 this.$autoNewLine = "\n";
1154 this.$newLineMode = "auto";
1155 this.setNewLineMode = function(newLineMode) {
1156 if (this.$newLineMode === newLineMode)
1157 return;
1158
1159 this.$newLineMode = newLineMode;
1160 };
1161 this.getNewLineMode = function() {
1162 return this.$newLineMode;
1163 };
1164 this.isNewLine = function(text) {
1165 return (text == "\r\n" || text == "\r" || text == "\n");
1166 };
1167 this.getLine = function(row) {
1168 return this.$lines[row] || "";
1169 };
1170 this.getLines = function(firstRow, lastRow) {
1171 return this.$lines.slice(firstRow, lastRow + 1);
1172 };
1173 this.getAllLines = function() {
1174 return this.getLines(0, this.getLength());
1175 };
1176 this.getLength = function() {
1177 return this.$lines.length;
1178 };
1179 this.getTextRange = function(range) {
1180 if (range.start.row == range.end.row) {
1181 return this.$lines[range.start.row]
1182 .substring(range.start.column, range.end.column);
1183 }
1184 var lines = this.getLines(range.start.row, range.end.row);
1185 lines[0] = (lines[0] || "").substring(range.start.column);
1186 var l = lines.length - 1;
1187 if (range.end.row - range.start.row == l)
1188 lines[l] = lines[l].substring(0, range.end.column);
1189 return lines.join(this.getNewLineCharacter());
1190 };
1191
1192 this.$clipPosition = function(position) {
1193 var length = this.getLength();
1194 if (position.row >= length) {
1195 position.row = Math.max(0, length - 1);
1196 position.column = this.getLine(length-1).length;
1197 } else if (position.row < 0)
1198 position.row = 0;
1199 return position;
1200 };
1201 this.insert = function(position, text) {
1202 if (!text || text.length === 0)
1203 return position;
1204
1205 position = this.$clipPosition(position);
1206 if (this.getLength() <= 1)
1207 this.$detectNewLine(text);
1208
1209 var lines = this.$split(text);
1210 var firstLine = lines.splice(0, 1)[0];
1211 var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
1212
1213 position = this.insertInLine(position, firstLine);
1214 if (lastLine !== null) {
1215 position = this.insertNewLine(position); // terminate first line
1216 position = this._insertLines(position.row, lines);
1217 position = this.insertInLine(position, lastLine || "");
1218 }
1219 return position;
1220 };
1221 this.insertLines = function(row, lines) {
1222 if (row >= this.getLength())
1223 return this.insert({row: row, column: 0}, "\n" + lines.join("\n"));
1224 return this._insertLines(Math.max(row, 0), lines);
1225 };
1226 this._insertLines = function(row, lines) {
1227 if (lines.length == 0)
1228 return {row: row, column: 0};
1229 if (lines.length > 0xFFFF) {
1230 var end = this._insertLines(row, lines.slice(0xFFFF));
1231 lines = lines.slice(0, 0xFFFF);
1232 }
1233
1234 var args = [row, 0];
1235 args.push.apply(args, lines);
1236 this.$lines.splice.apply(this.$lines, args);
1237
1238 var range = new Range(row, 0, row + lines.length, 0);
1239 var delta = {
1240 action: "insertLines",
1241 range: range,
1242 lines: lines
1243 };
1244 this._emit("change", { data: delta });
1245 return end || range.end;
1246 };
1247 this.insertNewLine = function(position) {
1248 position = this.$clipPosition(position);
1249 var line = this.$lines[position.row] || "";
1250
1251 this.$lines[position.row] = line.substring(0, position.column);
1252 this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
1253
1254 var end = {
1255 row : position.row + 1,
1256 column : 0
1257 };
1258
1259 var delta = {
1260 action: "insertText",
1261 range: Range.fromPoints(position, end),
1262 text: this.getNewLineCharacter()
1263 };
1264 this._emit("change", { data: delta });
1265
1266 return end;
1267 };
1268 this.insertInLine = function(position, text) {
1269 if (text.length == 0)
1270 return position;
1271
1272 var line = this.$lines[position.row] || "";
1273
1274 this.$lines[position.row] = line.substring(0, position.column) + text
1275 + line.substring(position.column);
1276
1277 var end = {
1278 row : position.row,
1279 column : position.column + text.length
1280 };
1281
1282 var delta = {
1283 action: "insertText",
1284 range: Range.fromPoints(position, end),
1285 text: text
1286 };
1287 this._emit("change", { data: delta });
1288
1289 return end;
1290 };
1291 this.remove = function(range) {
1292 range.start = this.$clipPosition(range.start);
1293 range.end = this.$clipPosition(range.end);
1294
1295 if (range.isEmpty())
1296 return range.start;
1297
1298 var firstRow = range.start.row;
1299 var lastRow = range.end.row;
1300
1301 if (range.isMultiLine()) {
1302 var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
1303 var lastFullRow = lastRow - 1;
1304
1305 if (range.end.column > 0)
1306 this.removeInLine(lastRow, 0, range.end.column);
1307
1308 if (lastFullRow >= firstFullRow)
1309 this._removeLines(firstFullRow, lastFullRow);
1310
1311 if (firstFullRow != firstRow) {
1312 this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
1313 this.removeNewLine(range.start.row);
1314 }
1315 }
1316 else {
1317 this.removeInLine(firstRow, range.start.column, range.end.column);
1318 }
1319 return range.start;
1320 };
1321 this.removeInLine = function(row, startColumn, endColumn) {
1322 if (startColumn == endColumn)
1323 return;
1324
1325 var range = new Range(row, startColumn, row, endColumn);
1326 var line = this.getLine(row);
1327 var removed = line.substring(startColumn, endColumn);
1328 var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
1329 this.$lines.splice(row, 1, newLine);
1330
1331 var delta = {
1332 action: "removeText",
1333 range: range,
1334 text: removed
1335 };
1336 this._emit("change", { data: delta });
1337 return range.start;
1338 };
1339 this.removeLines = function(firstRow, lastRow) {
1340 if (firstRow < 0 || lastRow >= this.getLength())
1341 return this.remove(new Range(firstRow, 0, lastRow + 1, 0));
1342 return this._removeLines(firstRow, lastRow);
1343 };
1344
1345 this._removeLines = function(firstRow, lastRow) {
1346 var range = new Range(firstRow, 0, lastRow + 1, 0);
1347 var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
1348
1349 var delta = {
1350 action: "removeLines",
1351 range: range,
1352 nl: this.getNewLineCharacter(),
1353 lines: removed
1354 };
1355 this._emit("change", { data: delta });
1356 return removed;
1357 };
1358 this.removeNewLine = function(row) {
1359 var firstLine = this.getLine(row);
1360 var secondLine = this.getLine(row+1);
1361
1362 var range = new Range(row, firstLine.length, row+1, 0);
1363 var line = firstLine + secondLine;
1364
1365 this.$lines.splice(row, 2, line);
1366
1367 var delta = {
1368 action: "removeText",
1369 range: range,
1370 text: this.getNewLineCharacter()
1371 };
1372 this._emit("change", { data: delta });
1373 };
1374 this.replace = function(range, text) {
1375 if (text.length == 0 && range.isEmpty())
1376 return range.start;
1377 if (text == this.getTextRange(range))
1378 return range.end;
1379
1380 this.remove(range);
1381 if (text) {
1382 var end = this.insert(range.start, text);
1383 }
1384 else {
1385 end = range.start;
1386 }
1387
1388 return end;
1389 };
1390 this.applyDeltas = function(deltas) {
1391 for (var i=0; i<deltas.length; i++) {
1392 var delta = deltas[i];
1393 var range = Range.fromPoints(delta.range.start, delta.range.end);
1394
1395 if (delta.action == "insertLines")
1396 this.insertLines(range.start.row, delta.lines);
1397 else if (delta.action == "insertText")
1398 this.insert(range.start, delta.text);
1399 else if (delta.action == "removeLines")
1400 this._removeLines(range.start.row, range.end.row - 1);
1401 else if (delta.action == "removeText")
1402 this.remove(range);
1403 }
1404 };
1405 this.revertDeltas = function(deltas) {
1406 for (var i=deltas.length-1; i>=0; i--) {
1407 var delta = deltas[i];
1408
1409 var range = Range.fromPoints(delta.range.start, delta.range.end);
1410
1411 if (delta.action == "insertLines")
1412 this._removeLines(range.start.row, range.end.row - 1);
1413 else if (delta.action == "insertText")
1414 this.remove(range);
1415 else if (delta.action == "removeLines")
1416 this._insertLines(range.start.row, delta.lines);
1417 else if (delta.action == "removeText")
1418 this.insert(range.start, delta.text);
1419 }
1420 };
1421 this.indexToPosition = function(index, startRow) {
1422 var lines = this.$lines || this.getAllLines();
1423 var newlineLength = this.getNewLineCharacter().length;
1424 for (var i = startRow || 0, l = lines.length; i < l; i++) {
1425 index -= lines[i].length + newlineLength;
1426 if (index < 0)
1427 return {row: i, column: index + lines[i].length + newlineLength};
1428 }
1429 return {row: l-1, column: lines[l-1].length};
1430 };
1431 this.positionToIndex = function(pos, startRow) {
1432 var lines = this.$lines || this.getAllLines();
1433 var newlineLength = this.getNewLineCharacter().length;
1434 var index = 0;
1435 var row = Math.min(pos.row, lines.length);
1436 for (var i = startRow || 0; i < row; ++i)
1437 index += lines[i].length + newlineLength;
1438
1439 return index + pos.column;
1440 };
1441
1442 }).call(Document.prototype);
1443
1444 exports.Document = Document;
1445 });
1446
1447 define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
1448
1449 var comparePoints = function(p1, p2) {
1450 return p1.row - p2.row || p1.column - p2.column;
1451 };
1452 var Range = function(startRow, startColumn, endRow, endColumn) {
1453 this.start = {
1454 row: startRow,
1455 column: startColumn
1456 };
1457
1458 this.end = {
1459 row: endRow,
1460 column: endColumn
1461 };
1462 };
1463
1464 (function() {
1465 this.isEqual = function(range) {
1466 return this.start.row === range.start.row &&
1467 this.end.row === range.end.row &&
1468 this.start.column === range.start.column &&
1469 this.end.column === range.end.column;
1470 };
1471 this.toString = function() {
1472 return ("Range: [" + this.start.row + "/" + this.start.column +
1473 "] -> [" + this.end.row + "/" + this.end.column + "]");
1474 };
1475
1476 this.contains = function(row, column) {
1477 return this.compare(row, column) == 0;
1478 };
1479 this.compareRange = function(range) {
1480 var cmp,
1481 end = range.end,
1482 start = range.start;
1483
1484 cmp = this.compare(end.row, end.column);
1485 if (cmp == 1) {
1486 cmp = this.compare(start.row, start.column);
1487 if (cmp == 1) {
1488 return 2;
1489 } else if (cmp == 0) {
1490 return 1;
1491 } else {
1492 return 0;
1493 }
1494 } else if (cmp == -1) {
1495 return -2;
1496 } else {
1497 cmp = this.compare(start.row, start.column);
1498 if (cmp == -1) {
1499 return -1;
1500 } else if (cmp == 1) {
1501 return 42;
1502 } else {
1503 return 0;
1504 }
1505 }
1506 };
1507 this.comparePoint = function(p) {
1508 return this.compare(p.row, p.column);
1509 };
1510 this.containsRange = function(range) {
1511 return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
1512 };
1513 this.intersects = function(range) {
1514 var cmp = this.compareRange(range);
1515 return (cmp == -1 || cmp == 0 || cmp == 1);
1516 };
1517 this.isEnd = function(row, column) {
1518 return this.end.row == row && this.end.column == column;
1519 };
1520 this.isStart = function(row, column) {
1521 return this.start.row == row && this.start.column == column;
1522 };
1523 this.setStart = function(row, column) {
1524 if (typeof row == "object") {
1525 this.start.column = row.column;
1526 this.start.row = row.row;
1527 } else {
1528 this.start.row = row;
1529 this.start.column = column;
1530 }
1531 };
1532 this.setEnd = function(row, column) {
1533 if (typeof row == "object") {
1534 this.end.column = row.column;
1535 this.end.row = row.row;
1536 } else {
1537 this.end.row = row;
1538 this.end.column = column;
1539 }
1540 };
1541 this.inside = function(row, column) {
1542 if (this.compare(row, column) == 0) {
1543 if (this.isEnd(row, column) || this.isStart(row, column)) {
1544 return false;
1545 } else {
1546 return true;
1547 }
1548 }
1549 return false;
1550 };
1551 this.insideStart = function(row, column) {
1552 if (this.compare(row, column) == 0) {
1553 if (this.isEnd(row, column)) {
1554 return false;
1555 } else {
1556 return true;
1557 }
1558 }
1559 return false;
1560 };
1561 this.insideEnd = function(row, column) {
1562 if (this.compare(row, column) == 0) {
1563 if (this.isStart(row, column)) {
1564 return false;
1565 } else {
1566 return true;
1567 }
1568 }
1569 return false;
1570 };
1571 this.compare = function(row, column) {
1572 if (!this.isMultiLine()) {
1573 if (row === this.start.row) {
1574 return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
1575 };
1576 }
1577
1578 if (row < this.start.row)
1579 return -1;
1580
1581 if (row > this.end.row)
1582 return 1;
1583
1584 if (this.start.row === row)
1585 return column >= this.start.column ? 0 : -1;
1586
1587 if (this.end.row === row)
1588 return column <= this.end.column ? 0 : 1;
1589
1590 return 0;
1591 };
1592 this.compareStart = function(row, column) {
1593 if (this.start.row == row && this.start.column == column) {
1594 return -1;
1595 } else {
1596 return this.compare(row, column);
1597 }
1598 };
1599 this.compareEnd = function(row, column) {
1600 if (this.end.row == row && this.end.column == column) {
1601 return 1;
1602 } else {
1603 return this.compare(row, column);
1604 }
1605 };
1606 this.compareInside = function(row, column) {
1607 if (this.end.row == row && this.end.column == column) {
1608 return 1;
1609 } else if (this.start.row == row && this.start.column == column) {
1610 return -1;
1611 } else {
1612 return this.compare(row, column);
1613 }
1614 };
1615 this.clipRows = function(firstRow, lastRow) {
1616 if (this.end.row > lastRow)
1617 var end = {row: lastRow + 1, column: 0};
1618 else if (this.end.row < firstRow)
1619 var end = {row: firstRow, column: 0};
1620
1621 if (this.start.row > lastRow)
1622 var start = {row: lastRow + 1, column: 0};
1623 else if (this.start.row < firstRow)
1624 var start = {row: firstRow, column: 0};
1625
1626 return Range.fromPoints(start || this.start, end || this.end);
1627 };
1628 this.extend = function(row, column) {
1629 var cmp = this.compare(row, column);
1630
1631 if (cmp == 0)
1632 return this;
1633 else if (cmp == -1)
1634 var start = {row: row, column: column};
1635 else
1636 var end = {row: row, column: column};
1637
1638 return Range.fromPoints(start || this.start, end || this.end);
1639 };
1640
1641 this.isEmpty = function() {
1642 return (this.start.row === this.end.row && this.start.column === this.end.column);
1643 };
1644 this.isMultiLine = function() {
1645 return (this.start.row !== this.end.row);
1646 };
1647 this.clone = function() {
1648 return Range.fromPoints(this.start, this.end);
1649 };
1650 this.collapseRows = function() {
1651 if (this.end.column == 0)
1652 return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
1653 else
1654 return new Range(this.start.row, 0, this.end.row, 0)
1655 };
1656 this.toScreenRange = function(session) {
1657 var screenPosStart = session.documentToScreenPosition(this.start);
1658 var screenPosEnd = session.documentToScreenPosition(this.end);
1659
1660 return new Range(
1661 screenPosStart.row, screenPosStart.column,
1662 screenPosEnd.row, screenPosEnd.column
1663 );
1664 };
1665 this.moveBy = function(row, column) {
1666 this.start.row += row;
1667 this.start.column += column;
1668 this.end.row += row;
1669 this.end.column += column;
1670 };
1671
1672 }).call(Range.prototype);
1673 Range.fromPoints = function(start, end) {
1674 return new Range(start.row, start.column, end.row, end.column);
1675 };
1676 Range.comparePoints = comparePoints;
1677
1678 Range.comparePoints = function(p1, p2) {
1679 return p1.row - p2.row || p1.column - p2.column;
1680 };
1681
1682
1683 exports.Range = Range;
1684 });
1685
1686 define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
1687
1688
1689 var oop = require("./lib/oop");
1690 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1691
1692 var Anchor = exports.Anchor = function(doc, row, column) {
1693 this.document = doc;
1694
1695 if (typeof column == "undefined")
1696 this.setPosition(row.row, row.column);
1697 else
1698 this.setPosition(row, column);
1699
1700 this.$onChange = this.onChange.bind(this);
1701 doc.on("change", this.$onChange);
1702 };
1703
1704 (function() {
1705
1706 oop.implement(this, EventEmitter);
1707
1708 this.getPosition = function() {
1709 return this.$clipPositionToDocument(this.row, this.column);
1710 };
1711
1712 this.getDocument = function() {
1713 return this.document;
1714 };
1715
1716 this.onChange = function(e) {
1717 var delta = e.data;
1718 var range = delta.range;
1719
1720 if (range.start.row == range.end.row && range.start.row != this.row)
1721 return;
1722
1723 if (range.start.row > this.row)
1724 return;
1725
1726 if (range.start.row == this.row && range.start.column > this.column)
1727 return;
1728
1729 var row = this.row;
1730 var column = this.column;
1731 var start = range.start;
1732 var end = range.end;
1733
1734 if (delta.action === "insertText") {
1735 if (start.row === row && start.column <= column) {
1736 if (start.row === end.row) {
1737 column += end.column - start.column;
1738 } else {
1739 column -= start.column;
1740 row += end.row - start.row;
1741 }
1742 } else if (start.row !== end.row && start.row < row) {
1743 row += end.row - start.row;
1744 }
1745 } else if (delta.action === "insertLines") {
1746 if (start.row <= row) {
1747 row += end.row - start.row;
1748 }
1749 } else if (delta.action === "removeText") {
1750 if (start.row === row && start.column < column) {
1751 if (end.column >= column)
1752 column = start.column;
1753 else
1754 column = Math.max(0, column - (end.column - start.column));
1755
1756 } else if (start.row !== end.row && start.row < row) {
1757 if (end.row === row)
1758 column = Math.max(0, column - end.column) + start.column;
1759 row -= (end.row - start.row);
1760 } else if (end.row === row) {
1761 row -= end.row - start.row;
1762 column = Math.max(0, column - end.column) + start.column;
1763 }
1764 } else if (delta.action == "removeLines") {
1765 if (start.row <= row) {
1766 if (end.row <= row)
1767 row -= end.row - start.row;
1768 else {
1769 row = start.row;
1770 column = 0;
1771 }
1772 }
1773 }
1774
1775 this.setPosition(row, column, true);
1776 };
1777
1778 this.setPosition = function(row, column, noClip) {
1779 var pos;
1780 if (noClip) {
1781 pos = {
1782 row: row,
1783 column: column
1784 };
1785 } else {
1786 pos = this.$clipPositionToDocument(row, column);
1787 }
1788
1789 if (this.row == pos.row && this.column == pos.column)
1790 return;
1791
1792 var old = {
1793 row: this.row,
1794 column: this.column
1795 };
1796
1797 this.row = pos.row;
1798 this.column = pos.column;
1799 this._emit("change", {
1800 old: old,
1801 value: pos
1802 });
1803 };
1804
1805 this.detach = function() {
1806 this.document.removeEventListener("change", this.$onChange);
1807 };
1808 this.$clipPositionToDocument = function(row, column) {
1809 var pos = {};
1810
1811 if (row >= this.document.getLength()) {
1812 pos.row = Math.max(0, this.document.getLength() - 1);
1813 pos.column = this.document.getLine(pos.row).length;
1814 }
1815 else if (row < 0) {
1816 pos.row = 0;
1817 pos.column = 0;
1818 }
1819 else {
1820 pos.row = row;
1821 pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
1822 }
1823
1824 if (column < 0)
1825 pos.column = 0;
1826
1827 return pos;
1828 };
1829
1830 }).call(Anchor.prototype);
1831
1832 });
1833
1834 define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
1835
1836
1837 exports.stringReverse = function(string) {
1838 return string.split("").reverse().join("");
1839 };
1840
1841 exports.stringRepeat = function (string, count) {
1842 var result = '';
1843 while (count > 0) {
1844 if (count & 1)
1845 result += string;
1846
1847 if (count >>= 1)
1848 string += string;
1849 }
1850 return result;
1851 };
1852
1853 var trimBeginRegexp = /^\s\s*/;
1854 var trimEndRegexp = /\s\s*$/;
1855
1856 exports.stringTrimLeft = function (string) {
1857 return string.replace(trimBeginRegexp, '');
1858 };
1859
1860 exports.stringTrimRight = function (string) {
1861 return string.replace(trimEndRegexp, '');
1862 };
1863
1864 exports.copyObject = function(obj) {
1865 var copy = {};
1866 for (var key in obj) {
1867 copy[key] = obj[key];
1868 }
1869 return copy;
1870 };
1871
1872 exports.copyArray = function(array){
1873 var copy = [];
1874 for (var i=0, l=array.length; i<l; i++) {
1875 if (array[i] && typeof array[i] == "object")
1876 copy[i] = this.copyObject( array[i] );
1877 else
1878 copy[i] = array[i];
1879 }
1880 return copy;
1881 };
1882
1883 exports.deepCopy = function (obj) {
1884 if (typeof obj != "object") {
1885 return obj;
1886 }
1887
1888 var copy = obj.constructor();
1889 for (var key in obj) {
1890 if (typeof obj[key] == "object") {
1891 copy[key] = this.deepCopy(obj[key]);
1892 } else {
1893 copy[key] = obj[key];
1894 }
1895 }
1896 return copy;
1897 };
1898
1899 exports.arrayToMap = function(arr) {
1900 var map = {};
1901 for (var i=0; i<arr.length; i++) {
1902 map[arr[i]] = 1;
1903 }
1904 return map;
1905
1906 };
1907
1908 exports.createMap = function(props) {
1909 var map = Object.create(null);
1910 for (var i in props) {
1911 map[i] = props[i];
1912 }
1913 return map;
1914 };
1915 exports.arrayRemove = function(array, value) {
1916 for (var i = 0; i <= array.length; i++) {
1917 if (value === array[i]) {
1918 array.splice(i, 1);
1919 }
1920 }
1921 };
1922
1923 exports.escapeRegExp = function(str) {
1924 return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
1925 };
1926
1927 exports.escapeHTML = function(str) {
1928 return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
1929 };
1930
1931 exports.getMatchOffsets = function(string, regExp) {
1932 var matches = [];
1933
1934 string.replace(regExp, function(str) {
1935 matches.push({
1936 offset: arguments[arguments.length-2],
1937 length: str.length
1938 });
1939 });
1940
1941 return matches;
1942 };
1943 exports.deferredCall = function(fcn) {
1944
1945 var timer = null;
1946 var callback = function() {
1947 timer = null;
1948 fcn();
1949 };
1950
1951 var deferred = function(timeout) {
1952 deferred.cancel();
1953 timer = setTimeout(callback, timeout || 0);
1954 return deferred;
1955 };
1956
1957 deferred.schedule = deferred;
1958
1959 deferred.call = function() {
1960 this.cancel();
1961 fcn();
1962 return deferred;
1963 };
1964
1965 deferred.cancel = function() {
1966 clearTimeout(timer);
1967 timer = null;
1968 return deferred;
1969 };
1970
1971 return deferred;
1972 };
1973
1974
1975 exports.delayedCall = function(fcn, defaultTimeout) {
1976 var timer = null;
1977 var callback = function() {
1978 timer = null;
1979 fcn();
1980 };
1981
1982 var _self = function(timeout) {
1983 timer && clearTimeout(timer);
1984 timer = setTimeout(callback, timeout || defaultTimeout);
1985 };
1986
1987 _self.delay = _self;
1988 _self.schedule = function(timeout) {
1989 if (timer == null)
1990 timer = setTimeout(callback, timeout || 0);
1991 };
1992
1993 _self.call = function() {
1994 this.cancel();
1995 fcn();
1996 };
1997
1998 _self.cancel = function() {
1999 timer && clearTimeout(timer);
2000 timer = null;
2001 };
2002
2003 _self.isPending = function() {
2004 return timer;
2005 };
2006
2007 return _self;
2008 };
2009 });
2010
2011 define('ace/mode/coffee/coffee-script', ['require', 'exports', 'module' , 'ace/mode/coffee/lexer', 'ace/mode/coffee/parser', 'ace/mode/coffee/nodes'], function(require, exports, module) {
2012
2013 var Lexer = require("./lexer").Lexer;
2014 var parser = require("./parser");
2015
2016 var lexer = new Lexer();
2017 parser.lexer = {
2018 lex: function() {
2019 var tag, token;
2020 token = this.tokens[this.pos++];
2021 if (token) {
2022 tag = token[0], this.yytext = token[1], this.yylloc = token[2];
2023 this.yylineno = this.yylloc.first_line;
2024 } else {
2025 tag = '';
2026 }
2027 return tag;
2028 },
2029 setInput: function(tokens) {
2030 this.tokens = tokens;
2031 return this.pos = 0;
2032 },
2033 upcomingInput: function() {
2034 return "";
2035 }
2036 };
2037 parser.yy = require('./nodes');
2038
2039 exports.parse = function(code) {
2040 return parser.parse(lexer.tokenize(code));
2041 };
2042 });
2043
2044 define('ace/mode/coffee/lexer', ['require', 'exports', 'module' , 'ace/mode/coffee/rewriter', 'ace/mode/coffee/helpers'], function(require, exports, module) {
2045
2046 var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, invertLiterate, key, last, locationDataToString, starts, throwSyntaxError, _ref, _ref1,
2047 __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
2048
2049 _ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES;
2050
2051 _ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last, invertLiterate = _ref1.invertLiterate, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError;
2052
2053 exports.Lexer = Lexer = (function() {
2054 function Lexer() {}
2055
2056 Lexer.prototype.tokenize = function(code, opts) {
2057 var consumed, i, tag, _ref2;
2058 if (opts == null) {
2059 opts = {};
2060 }
2061 this.literate = opts.literate;
2062 this.indent = 0;
2063 this.indebt = 0;
2064 this.outdebt = 0;
2065 this.indents = [];
2066 this.ends = [];
2067 this.tokens = [];
2068 this.chunkLine = opts.line || 0;
2069 this.chunkColumn = opts.column || 0;
2070 code = this.clean(code);
2071 i = 0;
2072 while (this.chunk = code.slice(i)) {
2073 consumed = this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken();
2074 _ref2 = this.getLineAndColumnFromChunk(consumed), this.chunkLine = _ref2[0], this.chunkColumn = _ref2[1];
2075 i += consumed;
2076 }
2077 this.closeIndentation();
2078 if (tag = this.ends.pop()) {
2079 this.error("missing " + tag);
2080 }
2081 if (opts.rewrite === false) {
2082 return this.tokens;
2083 }
2084 return (new Rewriter).rewrite(this.tokens);
2085 };
2086
2087 Lexer.prototype.clean = function(code) {
2088 if (code.charCodeAt(0) === BOM) {
2089 code = code.slice(1);
2090 }
2091 code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
2092 if (WHITESPACE.test(code)) {
2093 code = "\n" + code;
2094 this.chunkLine--;
2095 }
2096 if (this.literate) {
2097 code = invertLiterate(code);
2098 }
2099 return code;
2100 };
2101
2102 Lexer.prototype.identifierToken = function() {
2103 var colon, colonOffset, forcedIdentifier, id, idLength, input, match, poppedToken, prev, tag, tagToken, _ref2, _ref3, _ref4;
2104 if (!(match = IDENTIFIER.exec(this.chunk))) {
2105 return 0;
2106 }
2107 input = match[0], id = match[1], colon = match[2];
2108 idLength = id.length;
2109 poppedToken = void 0;
2110 if (id === 'own' && this.tag() === 'FOR') {
2111 this.token('OWN', id);
2112 return id.length;
2113 }
2114 forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::' || _ref2 === '?::') || !prev.spaced && prev[0] === '@');
2115 tag = 'IDENTIFIER';
2116 if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) {
2117 tag = id.toUpperCase();
2118 if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) {
2119 tag = 'LEADING_WHEN';
2120 } else if (tag === 'FOR') {
2121 this.seenFor = true;
2122 } else if (tag === 'UNLESS') {
2123 tag = 'IF';
2124 } else if (__indexOf.call(UNARY, tag) >= 0) {
2125 tag = 'UNARY';
2126 } else if (__indexOf.call(RELATION, tag) >= 0) {
2127 if (tag !== 'INSTANCEOF' && this.seenFor) {
2128 tag = 'FOR' + tag;
2129 this.seenFor = false;
2130 } else {
2131 tag = 'RELATION';
2132 if (this.value() === '!') {
2133 poppedToken = this.tokens.pop();
2134 id = '!' + id;
2135 }
2136 }
2137 }
2138 }
2139 if (__indexOf.call(JS_FORBIDDEN, id) >= 0) {
2140 if (forcedIdentifier) {
2141 tag = 'IDENTIFIER';
2142 id = new String(id);
2143 id.reserved = true;
2144 } else if (__indexOf.call(RESERVED, id) >= 0) {
2145 this.error("reserved word \"" + id + "\"");
2146 }
2147 }
2148 if (!forcedIdentifier) {
2149 if (__indexOf.call(COFFEE_ALIASES, id) >= 0) {
2150 id = COFFEE_ALIAS_MAP[id];
2151 }
2152 tag = (function() {
2153 switch (id) {
2154 case '!':
2155 return 'UNARY';
2156 case '==':
2157 case '!=':
2158 return 'COMPARE';
2159 case '&&':
2160 case '||':
2161 return 'LOGIC';
2162 case 'true':
2163 case 'false':
2164 return 'BOOL';
2165 case 'break':
2166 case 'continue':
2167 return 'STATEMENT';
2168 default:
2169 return tag;
2170 }
2171 })();
2172 }
2173 tagToken = this.token(tag, id, 0, idLength);
2174 if (poppedToken) {
2175 _ref4 = [poppedToken[2].first_line, poppedToken[2].first_column], tagToken[2].first_line = _ref4[0], tagToken[2].first_column = _ref4[1];
2176 }
2177 if (colon) {
2178 colonOffset = input.lastIndexOf(':');
2179 this.token(':', ':', colonOffset, colon.length);
2180 }
2181 return input.length;
2182 };
2183
2184 Lexer.prototype.numberToken = function() {
2185 var binaryLiteral, lexedLength, match, number, octalLiteral;
2186 if (!(match = NUMBER.exec(this.chunk))) {
2187 return 0;
2188 }
2189 number = match[0];
2190 if (/^0[BOX]/.test(number)) {
2191 this.error("radix prefix '" + number + "' must be lowercase");
2192 } else if (/E/.test(number) && !/^0x/.test(number)) {
2193 this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'");
2194 } else if (/^0\d*[89]/.test(number)) {
2195 this.error("decimal literal '" + number + "' must not be prefixed with '0'");
2196 } else if (/^0\d+/.test(number)) {
2197 this.error("octal literal '" + number + "' must be prefixed with '0o'");
2198 }
2199 lexedLength = number.length;
2200 if (octalLiteral = /^0o([0-7]+)/.exec(number)) {
2201 number = '0x' + (parseInt(octalLiteral[1], 8)).toString(16);
2202 }
2203 if (binaryLiteral = /^0b([01]+)/.exec(number)) {
2204 number = '0x' + (parseInt(binaryLiteral[1], 2)).toString(16);
2205 }
2206 this.token('NUMBER', number, 0, lexedLength);
2207 return lexedLength;
2208 };
2209
2210 Lexer.prototype.stringToken = function() {
2211 var match, octalEsc, string;
2212 switch (this.chunk.charAt(0)) {
2213 case "'":
2214 if (!(match = SIMPLESTR.exec(this.chunk))) {
2215 return 0;
2216 }
2217 string = match[0];
2218 this.token('STRING', string.replace(MULTILINER, '\\\n'), 0, string.length);
2219 break;
2220 case '"':
2221 if (!(string = this.balancedString(this.chunk, '"'))) {
2222 return 0;
2223 }
2224 if (0 < string.indexOf('#{', 1)) {
2225 this.interpolateString(string.slice(1, -1), {
2226 strOffset: 1,
2227 lexedLength: string.length
2228 });
2229 } else {
2230 this.token('STRING', this.escapeLines(string, 0, string.length));
2231 }
2232 break;
2233 default:
2234 return 0;
2235 }
2236 if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) {
2237 this.error("octal escape sequences " + string + " are not allowed");
2238 }
2239 return string.length;
2240 };
2241
2242 Lexer.prototype.heredocToken = function() {
2243 var doc, heredoc, match, quote;
2244 if (!(match = HEREDOC.exec(this.chunk))) {
2245 return 0;
2246 }
2247 heredoc = match[0];
2248 quote = heredoc.charAt(0);
2249 doc = this.sanitizeHeredoc(match[2], {
2250 quote: quote,
2251 indent: null
2252 });
2253 if (quote === '"' && 0 <= doc.indexOf('#{')) {
2254 this.interpolateString(doc, {
2255 heredoc: true,
2256 strOffset: 3,
2257 lexedLength: heredoc.length
2258 });
2259 } else {
2260 this.token('STRING', this.makeString(doc, quote, true), 0, heredoc.length);
2261 }
2262 return heredoc.length;
2263 };
2264
2265 Lexer.prototype.commentToken = function() {
2266 var comment, here, match;
2267 if (!(match = this.chunk.match(COMMENT))) {
2268 return 0;
2269 }
2270 comment = match[0], here = match[1];
2271 if (here) {
2272 this.token('HERECOMMENT', this.sanitizeHeredoc(here, {
2273 herecomment: true,
2274 indent: Array(this.indent + 1).join(' ')
2275 }), 0, comment.length);
2276 }
2277 return comment.length;
2278 };
2279
2280 Lexer.prototype.jsToken = function() {
2281 var match, script;
2282 if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) {
2283 return 0;
2284 }
2285 this.token('JS', (script = match[0]).slice(1, -1), 0, script.length);
2286 return script.length;
2287 };
2288
2289 Lexer.prototype.regexToken = function() {
2290 var flags, length, match, prev, regex, _ref2, _ref3;
2291 if (this.chunk.charAt(0) !== '/') {
2292 return 0;
2293 }
2294 if (match = HEREGEX.exec(this.chunk)) {
2295 length = this.heregexToken(match);
2296 return length;
2297 }
2298 prev = last(this.tokens);
2299 if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) {
2300 return 0;
2301 }
2302 if (!(match = REGEX.exec(this.chunk))) {
2303 return 0;
2304 }
2305 _ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2];
2306 if (regex.slice(0, 2) === '/*') {
2307 this.error('regular expressions cannot begin with `*`');
2308 }
2309 if (regex === '//') {
2310 regex = '/(?:)/';
2311 }
2312 this.token('REGEX', "" + regex + flags, 0, match.length);
2313 return match.length;
2314 };
2315
2316 Lexer.prototype.heregexToken = function(match) {
2317 var body, flags, flagsOffset, heregex, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
2318 heregex = match[0], body = match[1], flags = match[2];
2319 if (0 > body.indexOf('#{')) {
2320 re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/');
2321 if (re.match(/^\*/)) {
2322 this.error('regular expressions cannot begin with `*`');
2323 }
2324 this.token('REGEX', "/" + (re || '(?:)') + "/" + flags, 0, heregex.length);
2325 return heregex.length;
2326 }
2327 this.token('IDENTIFIER', 'RegExp', 0, 0);
2328 this.token('CALL_START', '(', 0, 0);
2329 tokens = [];
2330 _ref2 = this.interpolateString(body, {
2331 regex: true
2332 });
2333 for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
2334 token = _ref2[_i];
2335 tag = token[0], value = token[1];
2336 if (tag === 'TOKENS') {
2337 tokens.push.apply(tokens, value);
2338 } else if (tag === 'NEOSTRING') {
2339 if (!(value = value.replace(HEREGEX_OMIT, ''))) {
2340 continue;
2341 }
2342 value = value.replace(/\\/g, '\\\\');
2343 token[0] = 'STRING';
2344 token[1] = this.makeString(value, '"', true);
2345 tokens.push(token);
2346 } else {
2347 this.error("Unexpected " + tag);
2348 }
2349 prev = last(this.tokens);
2350 plusToken = ['+', '+'];
2351 plusToken[2] = prev[2];
2352 tokens.push(plusToken);
2353 }
2354 tokens.pop();
2355 if (((_ref3 = tokens[0]) != null ? _ref3[0] : void 0) !== 'STRING') {
2356 this.token('STRING', '""', 0, 0);
2357 this.token('+', '+', 0, 0);
2358 }
2359 (_ref4 = this.tokens).push.apply(_ref4, tokens);
2360 if (flags) {
2361 flagsOffset = heregex.lastIndexOf(flags);
2362 this.token(',', ',', flagsOffset, 0);
2363 this.token('STRING', '"' + flags + '"', flagsOffset, flags.length);
2364 }
2365 this.token(')', ')', heregex.length - 1, 0);
2366 return heregex.length;
2367 };
2368
2369 Lexer.prototype.lineToken = function() {
2370 var diff, indent, match, noNewlines, size;
2371 if (!(match = MULTI_DENT.exec(this.chunk))) {
2372 return 0;
2373 }
2374 indent = match[0];
2375 this.seenFor = false;
2376 size = indent.length - 1 - indent.lastIndexOf('\n');
2377 noNewlines = this.unfinished();
2378 if (size - this.indebt === this.indent) {
2379 if (noNewlines) {
2380 this.suppressNewlines();
2381 } else {
2382 this.newlineToken(0);
2383 }
2384 return indent.length;
2385 }
2386 if (size > this.indent) {
2387 if (noNewlines) {
2388 this.indebt = size - this.indent;
2389 this.suppressNewlines();
2390 return indent.length;
2391 }
2392 diff = size - this.indent + this.outdebt;
2393 this.token('INDENT', diff, indent.length - size, size);
2394 this.indents.push(diff);
2395 this.ends.push('OUTDENT');
2396 this.outdebt = this.indebt = 0;
2397 } else {
2398 this.indebt = 0;
2399 this.outdentToken(this.indent - size, noNewlines, indent.length);
2400 }
2401 this.indent = size;
2402 return indent.length;
2403 };
2404
2405 Lexer.prototype.outdentToken = function(moveOut, noNewlines, outdentLength) {
2406 var dent, len;
2407 while (moveOut > 0) {
2408 len = this.indents.length - 1;
2409 if (this.indents[len] === void 0) {
2410 moveOut = 0;
2411 } else if (this.indents[len] === this.outdebt) {
2412 moveOut -= this.outdebt;
2413 this.outdebt = 0;
2414 } else if (this.indents[len] < this.outdebt) {
2415 this.outdebt -= this.indents[len];
2416 moveOut -= this.indents[len];
2417 } else {
2418 dent = this.indents.pop() + this.outdebt;
2419 moveOut -= dent;
2420 this.outdebt = 0;
2421 this.pair('OUTDENT');
2422 this.token('OUTDENT', dent, 0, outdentLength);
2423 }
2424 }
2425 if (dent) {
2426 this.outdebt -= moveOut;
2427 }
2428 while (this.value() === ';') {
2429 this.tokens.pop();
2430 }
2431 if (!(this.tag() === 'TERMINATOR' || noNewlines)) {
2432 this.token('TERMINATOR', '\n', outdentLength, 0);
2433 }
2434 return this;
2435 };
2436
2437 Lexer.prototype.whitespaceToken = function() {
2438 var match, nline, prev;
2439 if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) {
2440 return 0;
2441 }
2442 prev = last(this.tokens);
2443 if (prev) {
2444 prev[match ? 'spaced' : 'newLine'] = true;
2445 }
2446 if (match) {
2447 return match[0].length;
2448 } else {
2449 return 0;
2450 }
2451 };
2452
2453 Lexer.prototype.newlineToken = function(offset) {
2454 while (this.value() === ';') {
2455 this.tokens.pop();
2456 }
2457 if (this.tag() !== 'TERMINATOR') {
2458 this.token('TERMINATOR', '\n', offset, 0);
2459 }
2460 return this;
2461 };
2462
2463 Lexer.prototype.suppressNewlines = function() {
2464 if (this.value() === '\\') {
2465 this.tokens.pop();
2466 }
2467 return this;
2468 };
2469
2470 Lexer.prototype.literalToken = function() {
2471 var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
2472 if (match = OPERATOR.exec(this.chunk)) {
2473 value = match[0];
2474 if (CODE.test(value)) {
2475 this.tagParameters();
2476 }
2477 } else {
2478 value = this.chunk.charAt(0);
2479 }
2480 tag = value;
2481 prev = last(this.tokens);
2482 if (value === '=' && prev) {
2483 if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) {
2484 this.error("reserved word \"" + (this.value()) + "\" can't be assigned");
2485 }
2486 if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') {
2487 prev[0] = 'COMPOUND_ASSIGN';
2488 prev[1] += '=';
2489 return value.length;
2490 }
2491 }
2492 if (value === ';') {
2493 this.seenFor = false;
2494 tag = 'TERMINATOR';
2495 } else if (__indexOf.call(MATH, value) >= 0) {
2496 tag = 'MATH';
2497 } else if (__indexOf.call(COMPARE, value) >= 0) {
2498 tag = 'COMPARE';
2499 } else if (__indexOf.call(COMPOUND_ASSIGN, value) >= 0) {
2500 tag = 'COMPOUND_ASSIGN';
2501 } else if (__indexOf.call(UNARY, value) >= 0) {
2502 tag = 'UNARY';
2503 } else if (__indexOf.call(SHIFT, value) >= 0) {
2504 tag = 'SHIFT';
2505 } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) {
2506 tag = 'LOGIC';
2507 } else if (prev && !prev.spaced) {
2508 if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) {
2509 if (prev[0] === '?') {
2510 prev[0] = 'FUNC_EXIST';
2511 }
2512 tag = 'CALL_START';
2513 } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) {
2514 tag = 'INDEX_START';
2515 switch (prev[0]) {
2516 case '?':
2517 prev[0] = 'INDEX_SOAK';
2518 }
2519 }
2520 }
2521 switch (value) {
2522 case '(':
2523 case '{':
2524 case '[':
2525 this.ends.push(INVERSES[value]);
2526 break;
2527 case ')':
2528 case '}':
2529 case ']':
2530 this.pair(value);
2531 }
2532 this.token(tag, value);
2533 return value.length;
2534 };
2535
2536 Lexer.prototype.sanitizeHeredoc = function(doc, options) {
2537 var attempt, herecomment, indent, match, _ref2;
2538 indent = options.indent, herecomment = options.herecomment;
2539 if (herecomment) {
2540 if (HEREDOC_ILLEGAL.test(doc)) {
2541 this.error("block comment cannot contain \"*/\", starting");
2542 }
2543 if (doc.indexOf('\n') < 0) {
2544 return doc;
2545 }
2546 } else {
2547 while (match = HEREDOC_INDENT.exec(doc)) {
2548 attempt = match[1];
2549 if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) {
2550 indent = attempt;
2551 }
2552 }
2553 }
2554 if (indent) {
2555 doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
2556 }
2557 if (!herecomment) {
2558 doc = doc.replace(/^\n/, '');
2559 }
2560 return doc;
2561 };
2562
2563 Lexer.prototype.tagParameters = function() {
2564 var i, stack, tok, tokens;
2565 if (this.tag() !== ')') {
2566 return this;
2567 }
2568 stack = [];
2569 tokens = this.tokens;
2570 i = tokens.length;
2571 tokens[--i][0] = 'PARAM_END';
2572 while (tok = tokens[--i]) {
2573 switch (tok[0]) {
2574 case ')':
2575 stack.push(tok);
2576 break;
2577 case '(':
2578 case 'CALL_START':
2579 if (stack.length) {
2580 stack.pop();
2581 } else if (tok[0] === '(') {
2582 tok[0] = 'PARAM_START';
2583 return this;
2584 } else {
2585 return this;
2586 }
2587 }
2588 }
2589 return this;
2590 };
2591
2592 Lexer.prototype.closeIndentation = function() {
2593 return this.outdentToken(this.indent);
2594 };
2595
2596 Lexer.prototype.balancedString = function(str, end) {
2597 var continueCount, i, letter, match, prev, stack, _i, _ref2;
2598 continueCount = 0;
2599 stack = [end];
2600 for (i = _i = 1, _ref2 = str.length; 1 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 1 <= _ref2 ? ++_i : --_i) {
2601 if (continueCount) {
2602 --continueCount;
2603 continue;
2604 }
2605 switch (letter = str.charAt(i)) {
2606 case '\\':
2607 ++continueCount;
2608 continue;
2609 case end:
2610 stack.pop();
2611 if (!stack.length) {
2612 return str.slice(0, +i + 1 || 9e9);
2613 }
2614 end = stack[stack.length - 1];
2615 continue;
2616 }
2617 if (end === '}' && (letter === '"' || letter === "'")) {
2618 stack.push(end = letter);
2619 } else if (end === '}' && letter === '/' && (match = HEREGEX.exec(str.slice(i)) || REGEX.exec(str.slice(i)))) {
2620 continueCount += match[0].length - 1;
2621 } else if (end === '}' && letter === '{') {
2622 stack.push(end = '}');
2623 } else if (end === '"' && prev === '#' && letter === '{') {
2624 stack.push(end = '}');
2625 }
2626 prev = letter;
2627 }
2628 return this.error("missing " + (stack.pop()) + ", starting");
2629 };
2630
2631 Lexer.prototype.interpolateString = function(str, options) {
2632 var column, expr, heredoc, i, inner, interpolated, len, letter, lexedLength, line, locationToken, nested, offsetInChunk, pi, plusToken, popped, regex, rparen, strOffset, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
2633 if (options == null) {
2634 options = {};
2635 }
2636 heredoc = options.heredoc, regex = options.regex, offsetInChunk = options.offsetInChunk, strOffset = options.strOffset, lexedLength = options.lexedLength;
2637 offsetInChunk = offsetInChunk || 0;
2638 strOffset = strOffset || 0;
2639 lexedLength = lexedLength || str.length;
2640 if (heredoc && str.length > 0 && str[0] === '\n') {
2641 str = str.slice(1);
2642 strOffset++;
2643 }
2644 tokens = [];
2645 pi = 0;
2646 i = -1;
2647 while (letter = str.charAt(i += 1)) {
2648 if (letter === '\\') {
2649 i += 1;
2650 continue;
2651 }
2652 if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) {
2653 continue;
2654 }
2655 if (pi < i) {
2656 tokens.push(this.makeToken('NEOSTRING', str.slice(pi, i), strOffset + pi));
2657 }
2658 inner = expr.slice(1, -1);
2659 if (inner.length) {
2660 _ref2 = this.getLineAndColumnFromChunk(strOffset + i + 1), line = _ref2[0], column = _ref2[1];
2661 nested = new Lexer().tokenize(inner, {
2662 line: line,
2663 column: column,
2664 rewrite: false
2665 });
2666 popped = nested.pop();
2667 if (((_ref3 = nested[0]) != null ? _ref3[0] : void 0) === 'TERMINATOR') {
2668 popped = nested.shift();
2669 }
2670 if (len = nested.length) {
2671 if (len > 1) {
2672 nested.unshift(this.makeToken('(', '(', strOffset + i + 1, 0));
2673 nested.push(this.makeToken(')', ')', strOffset + i + 1 + inner.length, 0));
2674 }
2675 tokens.push(['TOKENS', nested]);
2676 }
2677 }
2678 i += expr.length;
2679 pi = i + 1;
2680 }
2681 if ((i > pi && pi < str.length)) {
2682 tokens.push(this.makeToken('NEOSTRING', str.slice(pi), strOffset + pi));
2683 }
2684 if (regex) {
2685 return tokens;
2686 }
2687 if (!tokens.length) {
2688 return this.token('STRING', '""', offsetInChunk, lexedLength);
2689 }
2690 if (tokens[0][0] !== 'NEOSTRING') {
2691 tokens.unshift(this.makeToken('NEOSTRING', '', offsetInChunk));
2692 }
2693 if (interpolated = tokens.length > 1) {
2694 this.token('(', '(', offsetInChunk, 0);
2695 }
2696 for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) {
2697 token = tokens[i];
2698 tag = token[0], value = token[1];
2699 if (i) {
2700 if (i) {
2701 plusToken = this.token('+', '+');
2702 }
2703 locationToken = tag === 'TOKENS' ? value[0] : token;
2704 plusToken[2] = {
2705 first_line: locationToken[2].first_line,
2706 first_column: locationToken[2].first_column,
2707 last_line: locationToken[2].first_line,
2708 last_column: locationToken[2].first_column
2709 };
2710 }
2711 if (tag === 'TOKENS') {
2712 (_ref4 = this.tokens).push.apply(_ref4, value);
2713 } else if (tag === 'NEOSTRING') {
2714 token[0] = 'STRING';
2715 token[1] = this.makeString(value, '"', heredoc);
2716 this.tokens.push(token);
2717 } else {
2718 this.error("Unexpected " + tag);
2719 }
2720 }
2721 if (interpolated) {
2722 rparen = this.makeToken(')', ')', offsetInChunk + lexedLength, 0);
2723 rparen.stringEnd = true;
2724 this.tokens.push(rparen);
2725 }
2726 return tokens;
2727 };
2728
2729 Lexer.prototype.pair = function(tag) {
2730 var size, wanted;
2731 if (tag !== (wanted = last(this.ends))) {
2732 if ('OUTDENT' !== wanted) {
2733 this.error("unmatched " + tag);
2734 }
2735 this.indent -= size = last(this.indents);
2736 this.outdentToken(size, true);
2737 return this.pair(tag);
2738 }
2739 return this.ends.pop();
2740 };
2741
2742 Lexer.prototype.getLineAndColumnFromChunk = function(offset) {
2743 var column, lineCount, lines, string;
2744 if (offset === 0) {
2745 return [this.chunkLine, this.chunkColumn];
2746 }
2747 if (offset >= this.chunk.length) {
2748 string = this.chunk;
2749 } else {
2750 string = this.chunk.slice(0, +(offset - 1) + 1 || 9e9);
2751 }
2752 lineCount = count(string, '\n');
2753 column = this.chunkColumn;
2754 if (lineCount > 0) {
2755 lines = string.split('\n');
2756 column = (last(lines)).length;
2757 } else {
2758 column += string.length;
2759 }
2760 return [this.chunkLine + lineCount, column];
2761 };
2762
2763 Lexer.prototype.makeToken = function(tag, value, offsetInChunk, length) {
2764 var lastCharacter, locationData, token, _ref2, _ref3;
2765 if (offsetInChunk == null) {
2766 offsetInChunk = 0;
2767 }
2768 if (length == null) {
2769 length = value.length;
2770 }
2771 locationData = {};
2772 _ref2 = this.getLineAndColumnFromChunk(offsetInChunk), locationData.first_line = _ref2[0], locationData.first_column = _ref2[1];
2773 lastCharacter = Math.max(0, length - 1);
2774 _ref3 = this.getLineAndColumnFromChunk(offsetInChunk + lastCharacter), locationData.last_line = _ref3[0], locationData.last_column = _ref3[1];
2775 token = [tag, value, locationData];
2776 return token;
2777 };
2778
2779 Lexer.prototype.token = function(tag, value, offsetInChunk, length) {
2780 var token;
2781 token = this.makeToken(tag, value, offsetInChunk, length);
2782 this.tokens.push(token);
2783 return token;
2784 };
2785
2786 Lexer.prototype.tag = function(index, tag) {
2787 var tok;
2788 return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]);
2789 };
2790
2791 Lexer.prototype.value = function(index, val) {
2792 var tok;
2793 return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]);
2794 };
2795
2796 Lexer.prototype.unfinished = function() {
2797 var _ref2;
2798 return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === '?::' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS');
2799 };
2800
2801 Lexer.prototype.escapeLines = function(str, heredoc) {
2802 return str.replace(MULTILINER, heredoc ? '\\n' : '');
2803 };
2804
2805 Lexer.prototype.makeString = function(body, quote, heredoc) {
2806 if (!body) {
2807 return quote + quote;
2808 }
2809 body = body.replace(/\\([\s\S])/g, function(match, contents) {
2810 if (contents === '\n' || contents === quote) {
2811 return contents;
2812 } else {
2813 return match;
2814 }
2815 });
2816 body = body.replace(RegExp("" + quote, "g"), '\\$&');
2817 return quote + this.escapeLines(body, heredoc) + quote;
2818 };
2819
2820 Lexer.prototype.error = function(message) {
2821 return throwSyntaxError(message, {
2822 first_line: this.chunkLine,
2823 first_column: this.chunkColumn
2824 });
2825 };
2826
2827 return Lexer;
2828
2829 })();
2830
2831 JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super'];
2832
2833 COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when'];
2834
2835 COFFEE_ALIAS_MAP = {
2836 and: '&&',
2837 or: '||',
2838 is: '==',
2839 isnt: '!=',
2840 not: '!',
2841 yes: 'true',
2842 no: 'false',
2843 on: 'true',
2844 off: 'false'
2845 };
2846
2847 COFFEE_ALIASES = (function() {
2848 var _results;
2849 _results = [];
2850 for (key in COFFEE_ALIAS_MAP) {
2851 _results.push(key);
2852 }
2853 return _results;
2854 })();
2855
2856 COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES);
2857
2858 RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield'];
2859
2860 STRICT_PROSCRIBED = ['arguments', 'eval'];
2861
2862 JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED).concat(STRICT_PROSCRIBED);
2863
2864 exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS).concat(STRICT_PROSCRIBED);
2865
2866 exports.STRICT_PROSCRIBED = STRICT_PROSCRIBED;
2867
2868 BOM = 65279;
2869
2870 IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/;
2871
2872 NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i;
2873
2874 HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/;
2875
2876 OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?(\.|::)|\.{2,3})/;
2877
2878 WHITESPACE = /^[^\n\S]+/;
2879
2880 COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)$)|^(?:\s*#(?!##[^#]).*)+/;
2881
2882 CODE = /^[-=]>/;
2883
2884 MULTI_DENT = /^(?:\n[^\n\S]*)+/;
2885
2886 SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/;
2887
2888 JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/;
2889
2890 REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/;
2891
2892 HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/;
2893
2894 HEREGEX_OMIT = /\s+(?:#.*)?/g;
2895
2896 MULTILINER = /\n/g;
2897
2898 HEREDOC_INDENT = /\n+([^\n\S]*)/g;
2899
2900 HEREDOC_ILLEGAL = /\*\//;
2901
2902 LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/;
2903
2904 TRAILING_SPACES = /\s+$/;
2905
2906 COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|='];
2907
2908 UNARY = ['!', '~', 'NEW', 'TYPEOF', 'DELETE', 'DO'];
2909
2910 LOGIC = ['&&', '||', '&', '|', '^'];
2911
2912 SHIFT = ['<<', '>>', '>>>'];
2913
2914 COMPARE = ['==', '!=', '<', '>', '<=', '>='];
2915
2916 MATH = ['*', '/', '%'];
2917
2918 RELATION = ['IN', 'OF', 'INSTANCEOF'];
2919
2920 BOOL = ['TRUE', 'FALSE'];
2921
2922 NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--', ']'];
2923
2924 NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING');
2925
2926 CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER'];
2927
2928 INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL', 'NULL', 'UNDEFINED');
2929
2930 LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR'];
2931
2932
2933 });
2934
2935 define('ace/mode/coffee/rewriter', ['require', 'exports', 'module' ], function(require, exports, module) {
2936
2937 var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, left, rite, _i, _len, _ref,
2938 __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
2939 __slice = [].slice;
2940
2941 generate = function(tag, value) {
2942 var tok;
2943 tok = [tag, value];
2944 tok.generated = true;
2945 return tok;
2946 };
2947
2948 exports.Rewriter = (function() {
2949 function Rewriter() {}
2950
2951 Rewriter.prototype.rewrite = function(tokens) {
2952 this.tokens = tokens;
2953 this.removeLeadingNewlines();
2954 this.removeMidExpressionNewlines();
2955 this.closeOpenCalls();
2956 this.closeOpenIndexes();
2957 this.addImplicitIndentation();
2958 this.tagPostfixConditionals();
2959 this.addImplicitBracesAndParens();
2960 this.addLocationDataToGeneratedTokens();
2961 return this.tokens;
2962 };
2963
2964 Rewriter.prototype.scanTokens = function(block) {
2965 var i, token, tokens;
2966 tokens = this.tokens;
2967 i = 0;
2968 while (token = tokens[i]) {
2969 i += block.call(this, token, i, tokens);
2970 }
2971 return true;
2972 };
2973
2974 Rewriter.prototype.detectEnd = function(i, condition, action) {
2975 var levels, token, tokens, _ref, _ref1;
2976 tokens = this.tokens;
2977 levels = 0;
2978 while (token = tokens[i]) {
2979 if (levels === 0 && condition.call(this, token, i)) {
2980 return action.call(this, token, i);
2981 }
2982 if (!token || levels < 0) {
2983 return action.call(this, token, i - 1);
2984 }
2985 if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) {
2986 levels += 1;
2987 } else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) {
2988 levels -= 1;
2989 }
2990 i += 1;
2991 }
2992 return i - 1;
2993 };
2994
2995 Rewriter.prototype.removeLeadingNewlines = function() {
2996 var i, tag, _i, _len, _ref;
2997 _ref = this.tokens;
2998 for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
2999 tag = _ref[i][0];
3000 if (tag !== 'TERMINATOR') {
3001 break;
3002 }
3003 }
3004 if (i) {
3005 return this.tokens.splice(0, i);
3006 }
3007 };
3008
3009 Rewriter.prototype.removeMidExpressionNewlines = function() {
3010 return this.scanTokens(function(token, i, tokens) {
3011 var _ref;
3012 if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) {
3013 return 1;
3014 }
3015 tokens.splice(i, 1);
3016 return 0;
3017 });
3018 };
3019
3020 Rewriter.prototype.closeOpenCalls = function() {
3021 var action, condition;
3022 condition = function(token, i) {
3023 var _ref;
3024 return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')';
3025 };
3026 action = function(token, i) {
3027 return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END';
3028 };
3029 return this.scanTokens(function(token, i) {
3030 if (token[0] === 'CALL_START') {
3031 this.detectEnd(i + 1, condition, action);
3032 }
3033 return 1;
3034 });
3035 };
3036
3037 Rewriter.prototype.closeOpenIndexes = function() {
3038 var action, condition;
3039 condition = function(token, i) {
3040 var _ref;
3041 return (_ref = token[0]) === ']' || _ref === 'INDEX_END';
3042 };
3043 action = function(token, i) {
3044 return token[0] = 'INDEX_END';
3045 };
3046 return this.scanTokens(function(token, i) {
3047 if (token[0] === 'INDEX_START') {
3048 this.detectEnd(i + 1, condition, action);
3049 }
3050 return 1;
3051 });
3052 };
3053
3054 Rewriter.prototype.matchTags = function() {
3055 var fuzz, i, j, pattern, _i, _ref, _ref1;
3056 i = arguments[0], pattern = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
3057 fuzz = 0;
3058 for (j = _i = 0, _ref = pattern.length; 0 <= _ref ? _i < _ref : _i > _ref; j = 0 <= _ref ? ++_i : --_i) {
3059 while (this.tag(i + j + fuzz) === 'HERECOMMENT') {
3060 fuzz += 2;
3061 }
3062 if (pattern[j] == null) {
3063 continue;
3064 }
3065 if (typeof pattern[j] === 'string') {
3066 pattern[j] = [pattern[j]];
3067 }
3068 if (_ref1 = this.tag(i + j + fuzz), __indexOf.call(pattern[j], _ref1) < 0) {
3069 return false;
3070 }
3071 }
3072 return true;
3073 };
3074
3075 Rewriter.prototype.looksObjectish = function(j) {
3076 return this.matchTags(j, '@', null, ':') || this.matchTags(j, null, ':');
3077 };
3078
3079 Rewriter.prototype.findTagsBackwards = function(i, tags) {
3080 var backStack, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
3081 backStack = [];
3082 while (i >= 0 && (backStack.length || (_ref2 = this.tag(i), __indexOf.call(tags, _ref2) < 0) && ((_ref3 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref3) < 0) || this.tokens[i].generated) && (_ref4 = this.tag(i), __indexOf.call(LINEBREAKS, _ref4) < 0))) {
3083 if (_ref = this.tag(i), __indexOf.call(EXPRESSION_END, _ref) >= 0) {
3084 backStack.push(this.tag(i));
3085 }
3086 if ((_ref1 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref1) >= 0) && backStack.length) {
3087 backStack.pop();
3088 }
3089 i -= 1;
3090 }
3091 return _ref5 = this.tag(i), __indexOf.call(tags, _ref5) >= 0;
3092 };
3093
3094 Rewriter.prototype.addImplicitBracesAndParens = function() {
3095 var stack;
3096 stack = [];
3097 return this.scanTokens(function(token, i, tokens) {
3098 var endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, nextTag, offset, prevTag, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
3099 tag = token[0];
3100 prevTag = (i > 0 ? tokens[i - 1] : [])[0];
3101 nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0];
3102 stackTop = function() {
3103 return stack[stack.length - 1];
3104 };
3105 startIdx = i;
3106 forward = function(n) {
3107 return i - startIdx + n;
3108 };
3109 inImplicit = function() {
3110 var _ref, _ref1;
3111 return (_ref = stackTop()) != null ? (_ref1 = _ref[2]) != null ? _ref1.ours : void 0 : void 0;
3112 };
3113 inImplicitCall = function() {
3114 var _ref;
3115 return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '(';
3116 };
3117 inImplicitObject = function() {
3118 var _ref;
3119 return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '{';
3120 };
3121 inImplicitControl = function() {
3122 var _ref;
3123 return inImplicit && ((_ref = stackTop()) != null ? _ref[0] : void 0) === 'CONTROL';
3124 };
3125 startImplicitCall = function(j) {
3126 var idx;
3127 idx = j != null ? j : i;
3128 stack.push([
3129 '(', idx, {
3130 ours: true
3131 }
3132 ]);
3133 tokens.splice(idx, 0, generate('CALL_START', '('));
3134 if (j == null) {
3135 return i += 1;
3136 }
3137 };
3138 endImplicitCall = function() {
3139 stack.pop();
3140 tokens.splice(i, 0, generate('CALL_END', ')'));
3141 return i += 1;
3142 };
3143 startImplicitObject = function(j, startsLine) {
3144 var idx;
3145 if (startsLine == null) {
3146 startsLine = true;
3147 }
3148 idx = j != null ? j : i;
3149 stack.push([
3150 '{', idx, {
3151 sameLine: true,
3152 startsLine: startsLine,
3153 ours: true
3154 }
3155 ]);
3156 tokens.splice(idx, 0, generate('{', generate(new String('{'))));
3157 if (j == null) {
3158 return i += 1;
3159 }
3160 };
3161 endImplicitObject = function(j) {
3162 j = j != null ? j : i;
3163 stack.pop();
3164 tokens.splice(j, 0, generate('}', '}'));
3165 return i += 1;
3166 };
3167 if (inImplicitCall() && (tag === 'IF' || tag === 'TRY' || tag === 'FINALLY' || tag === 'CATCH' || tag === 'CLASS' || tag === 'SWITCH')) {
3168 stack.push([
3169 'CONTROL', i, {
3170 ours: true
3171 }
3172 ]);
3173 return forward(1);
3174 }
3175 if (tag === 'INDENT' && inImplicit()) {
3176 if (prevTag !== '=>' && prevTag !== '->' && prevTag !== '[' && prevTag !== '(' && prevTag !== ',' && prevTag !== '{' && prevTag !== 'TRY' && prevTag !== 'ELSE' && prevTag !== '=') {
3177 while (inImplicitCall()) {
3178 endImplicitCall();
3179 }
3180 }
3181 if (inImplicitControl()) {
3182 stack.pop();
3183 }
3184 stack.push([tag, i]);
3185 return forward(1);
3186 }
3187 if (__indexOf.call(EXPRESSION_START, tag) >= 0) {
3188 stack.push([tag, i]);
3189 return forward(1);
3190 }
3191 if (__indexOf.call(EXPRESSION_END, tag) >= 0) {
3192 while (inImplicit()) {
3193 if (inImplicitCall()) {
3194 endImplicitCall();
3195 } else if (inImplicitObject()) {
3196 endImplicitObject();
3197 } else {
3198 stack.pop();
3199 }
3200 }
3201 stack.pop();
3202 }
3203 if ((__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced && !token.stringEnd || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (__indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || __indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !((_ref = tokens[i + 1]) != null ? _ref.spaced : void 0) && !((_ref1 = tokens[i + 1]) != null ? _ref1.newLine : void 0))) {
3204 if (tag === '?') {
3205 tag = token[0] = 'FUNC_EXIST';
3206 }
3207 startImplicitCall(i + 1);
3208 return forward(2);
3209 }
3210 if (this.matchTags(i, IMPLICIT_FUNC, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) {
3211 startImplicitCall(i + 1);
3212 stack.push(['INDENT', i + 2]);
3213 return forward(3);
3214 }
3215 if (tag === ':') {
3216 if (this.tag(i - 2) === '@') {
3217 s = i - 2;
3218 } else {
3219 s = i - 1;
3220 }
3221 while (this.tag(s - 2) === 'HERECOMMENT') {
3222 s -= 2;
3223 }
3224 startsLine = s === 0 || (_ref2 = this.tag(s - 1), __indexOf.call(LINEBREAKS, _ref2) >= 0) || tokens[s - 1].newLine;
3225 if (stackTop()) {
3226 _ref3 = stackTop(), stackTag = _ref3[0], stackIdx = _ref3[1];
3227 if ((stackTag === '{' || stackTag === 'INDENT' && this.tag(stackIdx - 1) === '{') && (startsLine || this.tag(s - 1) === ',' || this.tag(s - 1) === '{')) {
3228 return forward(1);
3229 }
3230 }
3231 startImplicitObject(s, !!startsLine);
3232 return forward(2);
3233 }
3234 if (prevTag === 'OUTDENT' && inImplicitCall() && (tag === '.' || tag === '?.' || tag === '::' || tag === '?::')) {
3235 endImplicitCall();
3236 return forward(1);
3237 }
3238 if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) {
3239 stackTop()[2].sameLine = false;
3240 }
3241 if (__indexOf.call(IMPLICIT_END, tag) >= 0) {
3242 while (inImplicit()) {
3243 _ref4 = stackTop(), stackTag = _ref4[0], stackIdx = _ref4[1], (_ref5 = _ref4[2], sameLine = _ref5.sameLine, startsLine = _ref5.startsLine);
3244 if (inImplicitCall() && prevTag !== ',') {
3245 endImplicitCall();
3246 } else if (inImplicitObject() && sameLine && !startsLine) {
3247 endImplicitObject();
3248 } else if (inImplicitObject() && tag === 'TERMINATOR' && prevTag !== ',' && !(startsLine && this.looksObjectish(i + 1))) {
3249 endImplicitObject();
3250 } else {
3251 break;
3252 }
3253 }
3254 }
3255 if (tag === ',' && !this.looksObjectish(i + 1) && inImplicitObject() && (nextTag !== 'TERMINATOR' || !this.looksObjectish(i + 2))) {
3256 offset = nextTag === 'OUTDENT' ? 1 : 0;
3257 while (inImplicitObject()) {
3258 endImplicitObject(i + offset);
3259 }
3260 }
3261 return forward(1);
3262 });
3263 };
3264
3265 Rewriter.prototype.addLocationDataToGeneratedTokens = function() {
3266 return this.scanTokens(function(token, i, tokens) {
3267 var column, line, nextLocation, prevLocation, _ref, _ref1;
3268 if (token[2]) {
3269 return 1;
3270 }
3271 if (!(token.generated || token.explicit)) {
3272 return 1;
3273 }
3274 if (token[0] === '{' && (nextLocation = (_ref = tokens[i + 1]) != null ? _ref[2] : void 0)) {
3275 line = nextLocation.first_line, column = nextLocation.first_column;
3276 } else if (prevLocation = (_ref1 = tokens[i - 1]) != null ? _ref1[2] : void 0) {
3277 line = prevLocation.last_line, column = prevLocation.last_column;
3278 } else {
3279 line = column = 0;
3280 }
3281 token[2] = {
3282 first_line: line,
3283 first_column: column,
3284 last_line: line,
3285 last_column: column
3286 };
3287 return 1;
3288 });
3289 };
3290
3291 Rewriter.prototype.addImplicitIndentation = function() {
3292 var action, condition, indent, outdent, starter;
3293 starter = indent = outdent = null;
3294 condition = function(token, i) {
3295 var _ref;
3296 return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN'));
3297 };
3298 action = function(token, i) {
3299 return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
3300 };
3301 return this.scanTokens(function(token, i, tokens) {
3302 var j, tag, _i, _ref, _ref1;
3303 tag = token[0];
3304 if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') {
3305 tokens.splice(i, 1);
3306 return 0;
3307 }
3308 if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
3309 tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation())));
3310 return 2;
3311 }
3312 if (tag === 'CATCH') {
3313 for (j = _i = 1; _i <= 2; j = ++_i) {
3314 if (!((_ref = this.tag(i + j)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) {
3315 continue;
3316 }
3317 tokens.splice.apply(tokens, [i + j, 0].concat(__slice.call(this.indentation())));
3318 return 2 + j;
3319 }
3320 }
3321 if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
3322 starter = tag;
3323 _ref1 = this.indentation(true), indent = _ref1[0], outdent = _ref1[1];
3324 if (starter === 'THEN') {
3325 indent.fromThen = true;
3326 }
3327 tokens.splice(i + 1, 0, indent);
3328 this.detectEnd(i + 2, condition, action);
3329 if (tag === 'THEN') {
3330 tokens.splice(i, 1);
3331 }
3332 return 1;
3333 }
3334 return 1;
3335 });
3336 };
3337
3338 Rewriter.prototype.tagPostfixConditionals = function() {
3339 var action, condition, original;
3340 original = null;
3341 condition = function(token, i) {
3342 var prevTag, tag;
3343 tag = token[0];
3344 prevTag = this.tokens[i - 1][0];
3345 return tag === 'TERMINATOR' || (tag === 'INDENT' && __indexOf.call(SINGLE_LINERS, prevTag) < 0);
3346 };
3347 action = function(token, i) {
3348 if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) {
3349 return original[0] = 'POST_' + original[0];
3350 }
3351 };
3352 return this.scanTokens(function(token, i) {
3353 if (token[0] !== 'IF') {
3354 return 1;
3355 }
3356 original = token;
3357 this.detectEnd(i + 1, condition, action);
3358 return 1;
3359 });
3360 };
3361
3362 Rewriter.prototype.indentation = function(implicit) {
3363 var indent, outdent;
3364 if (implicit == null) {
3365 implicit = false;
3366 }
3367 indent = ['INDENT', 2];
3368 outdent = ['OUTDENT', 2];
3369 if (implicit) {
3370 indent.generated = outdent.generated = true;
3371 }
3372 if (!implicit) {
3373 indent.explicit = outdent.explicit = true;
3374 }
3375 return [indent, outdent];
3376 };
3377
3378 Rewriter.prototype.generate = generate;
3379
3380 Rewriter.prototype.tag = function(i) {
3381 var _ref;
3382 return (_ref = this.tokens[i]) != null ? _ref[0] : void 0;
3383 };
3384
3385 return Rewriter;
3386
3387 })();
3388
3389 BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']];
3390
3391 exports.INVERSES = INVERSES = {};
3392
3393 EXPRESSION_START = [];
3394
3395 EXPRESSION_END = [];
3396
3397 for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) {
3398 _ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1];
3399 EXPRESSION_START.push(INVERSES[rite] = left);
3400 EXPRESSION_END.push(INVERSES[left] = rite);
3401 }
3402
3403 EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END);
3404
3405 IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
3406
3407 IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++'];
3408
3409 IMPLICIT_UNSPACED_CALL = ['+', '-'];
3410
3411 IMPLICIT_BLOCK = ['->', '=>', '{', '[', ','];
3412
3413 IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR'];
3414
3415 SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN'];
3416
3417 SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN'];
3418
3419 LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
3420
3421
3422 });
3423
3424 define('ace/mode/coffee/helpers', ['require', 'exports', 'module' ], function(require, exports, module) {
3425
3426 var buildLocationData, extend, flatten, last, repeat, _ref;
3427
3428 exports.starts = function(string, literal, start) {
3429 return literal === string.substr(start, literal.length);
3430 };
3431
3432 exports.ends = function(string, literal, back) {
3433 var len;
3434 len = literal.length;
3435 return literal === string.substr(string.length - len - (back || 0), len);
3436 };
3437
3438 exports.repeat = repeat = function(str, n) {
3439 var res;
3440 res = '';
3441 while (n > 0) {
3442 if (n & 1) {
3443 res += str;
3444 }
3445 n >>>= 1;
3446 str += str;
3447 }
3448 return res;
3449 };
3450
3451 exports.compact = function(array) {
3452 var item, _i, _len, _results;
3453 _results = [];
3454 for (_i = 0, _len = array.length; _i < _len; _i++) {
3455 item = array[_i];
3456 if (item) {
3457 _results.push(item);
3458 }
3459 }
3460 return _results;
3461 };
3462
3463 exports.count = function(string, substr) {
3464 var num, pos;
3465 num = pos = 0;
3466 if (!substr.length) {
3467 return 1 / 0;
3468 }
3469 while (pos = 1 + string.indexOf(substr, pos)) {
3470 num++;
3471 }
3472 return num;
3473 };
3474
3475 exports.merge = function(options, overrides) {
3476 return extend(extend({}, options), overrides);
3477 };
3478
3479 extend = exports.extend = function(object, properties) {
3480 var key, val;
3481 for (key in properties) {
3482 val = properties[key];
3483 object[key] = val;
3484 }
3485 return object;
3486 };
3487
3488 exports.flatten = flatten = function(array) {
3489 var element, flattened, _i, _len;
3490 flattened = [];
3491 for (_i = 0, _len = array.length; _i < _len; _i++) {
3492 element = array[_i];
3493 if (element instanceof Array) {
3494 flattened = flattened.concat(flatten(element));
3495 } else {
3496 flattened.push(element);
3497 }
3498 }
3499 return flattened;
3500 };
3501
3502 exports.del = function(obj, key) {
3503 var val;
3504 val = obj[key];
3505 delete obj[key];
3506 return val;
3507 };
3508
3509 exports.last = last = function(array, back) {
3510 return array[array.length - (back || 0) - 1];
3511 };
3512
3513 exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) {
3514 var e, _i, _len;
3515 for (_i = 0, _len = this.length; _i < _len; _i++) {
3516 e = this[_i];
3517 if (fn(e)) {
3518 return true;
3519 }
3520 }
3521 return false;
3522 };
3523
3524 exports.invertLiterate = function(code) {
3525 var line, lines, maybe_code;
3526 maybe_code = true;
3527 lines = (function() {
3528 var _i, _len, _ref1, _results;
3529 _ref1 = code.split('\n');
3530 _results = [];
3531 for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
3532 line = _ref1[_i];
3533 if (maybe_code && /^([ ]{4}|[ ]{0,3}\t)/.test(line)) {
3534 _results.push(line);
3535 } else if (maybe_code = /^\s*$/.test(line)) {
3536 _results.push(line);
3537 } else {
3538 _results.push('# ' + line);
3539 }
3540 }
3541 return _results;
3542 })();
3543 return lines.join('\n');
3544 };
3545
3546 buildLocationData = function(first, last) {
3547 if (!last) {
3548 return first;
3549 } else {
3550 return {
3551 first_line: first.first_line,
3552 first_column: first.first_column,
3553 last_line: last.last_line,
3554 last_column: last.last_column
3555 };
3556 }
3557 };
3558
3559 exports.addLocationDataFn = function(first, last) {
3560 return function(obj) {
3561 if (((typeof obj) === 'object') && (!!obj['updateLocationDataIfMissing'])) {
3562 obj.updateLocationDataIfMissing(buildLocationData(first, last));
3563 }
3564 return obj;
3565 };
3566 };
3567
3568 exports.locationDataToString = function(obj) {
3569 var locationData;
3570 if (("2" in obj) && ("first_line" in obj[2])) {
3571 locationData = obj[2];
3572 } else if ("first_line" in obj) {
3573 locationData = obj;
3574 }
3575 if (locationData) {
3576 return ("" + (locationData.first_line + 1) + ":" + (locationData.first_column + 1) + "-") + ("" + (locationData.last_line + 1) + ":" + (locationData.last_column + 1));
3577 } else {
3578 return "No location data";
3579 }
3580 };
3581
3582 exports.baseFileName = function(file, stripExt, useWinPathSep) {
3583 var parts, pathSep;
3584 if (stripExt == null) {
3585 stripExt = false;
3586 }
3587 if (useWinPathSep == null) {
3588 useWinPathSep = false;
3589 }
3590 pathSep = useWinPathSep ? /\\|\// : /\//;
3591 parts = file.split(pathSep);
3592 file = parts[parts.length - 1];
3593 if (!stripExt) {
3594 return file;
3595 }
3596 parts = file.split('.');
3597 parts.pop();
3598 if (parts[parts.length - 1] === 'coffee' && parts.length > 1) {
3599 parts.pop();
3600 }
3601 return parts.join('.');
3602 };
3603
3604 exports.isCoffee = function(file) {
3605 return /\.((lit)?coffee|coffee\.md)$/.test(file);
3606 };
3607
3608 exports.isLiterate = function(file) {
3609 return /\.(litcoffee|coffee\.md)$/.test(file);
3610 };
3611
3612 exports.throwSyntaxError = function(message, location) {
3613 var error, _ref1, _ref2;
3614 if ((_ref1 = location.last_line) == null) {
3615 location.last_line = location.first_line;
3616 }
3617 if ((_ref2 = location.last_column) == null) {
3618 location.last_column = location.first_column;
3619 }
3620 error = new SyntaxError(message);
3621 error.location = location;
3622 throw error;
3623 };
3624
3625 exports.prettyErrorMessage = function(error, fileName, code, useColors) {
3626 var codeLine, colorize, end, first_column, first_line, last_column, last_line, marker, message, start, _ref1;
3627 if (!error.location) {
3628 return error.stack || ("" + error);
3629 }
3630 _ref1 = error.location, first_line = _ref1.first_line, first_column = _ref1.first_column, last_line = _ref1.last_line, last_column = _ref1.last_column;
3631 codeLine = code.split('\n')[first_line];
3632 start = first_column;
3633 end = first_line === last_line ? last_column + 1 : codeLine.length;
3634 marker = repeat(' ', start) + repeat('^', end - start);
3635 if (useColors) {
3636 colorize = function(str) {
3637 return "\x1B[1;31m" + str + "\x1B[0m";
3638 };
3639 codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end);
3640 marker = colorize(marker);
3641 }
3642 message = "" + fileName + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + error.message + "\n" + codeLine + "\n" + marker;
3643 return message;
3644 };
3645
3646
3647 });
3648
3649 define('ace/mode/coffee/parser', ['require', 'exports', 'module' ], function(require, exports, module) {
3650
3651 var parser = {trace: function trace() { },
3652 yy: {},
3653 symbols_: {"error":2,"Root":3,"Body":4,"Block":5,"TERMINATOR":6,"Line":7,"Expression":8,"Statement":9,"Return":10,"Comment":11,"STATEMENT":12,"Value":13,"Invocation":14,"Code":15,"Operation":16,"Assign":17,"If":18,"Try":19,"While":20,"For":21,"Switch":22,"Class":23,"Throw":24,"INDENT":25,"OUTDENT":26,"Identifier":27,"IDENTIFIER":28,"AlphaNumeric":29,"NUMBER":30,"STRING":31,"Literal":32,"JS":33,"REGEX":34,"DEBUGGER":35,"UNDEFINED":36,"NULL":37,"BOOL":38,"Assignable":39,"=":40,"AssignObj":41,"ObjAssignable":42,":":43,"ThisProperty":44,"RETURN":45,"HERECOMMENT":46,"PARAM_START":47,"ParamList":48,"PARAM_END":49,"FuncGlyph":50,"->":51,"=>":52,"OptComma":53,",":54,"Param":55,"ParamVar":56,"...":57,"Array":58,"Object":59,"Splat":60,"SimpleAssignable":61,"Accessor":62,"Parenthetical":63,"Range":64,"This":65,".":66,"?.":67,"::":68,"?::":69,"Index":70,"INDEX_START":71,"IndexValue":72,"INDEX_END":73,"INDEX_SOAK":74,"Slice":75,"{":76,"AssignList":77,"}":78,"CLASS":79,"EXTENDS":80,"OptFuncExist":81,"Arguments":82,"SUPER":83,"FUNC_EXIST":84,"CALL_START":85,"CALL_END":86,"ArgList":87,"THIS":88,"@":89,"[":90,"]":91,"RangeDots":92,"..":93,"Arg":94,"SimpleArgs":95,"TRY":96,"Catch":97,"FINALLY":98,"CATCH":99,"THROW":100,"(":101,")":102,"WhileSource":103,"WHILE":104,"WHEN":105,"UNTIL":106,"Loop":107,"LOOP":108,"ForBody":109,"FOR":110,"ForStart":111,"ForSource":112,"ForVariables":113,"OWN":114,"ForValue":115,"FORIN":116,"FOROF":117,"BY":118,"SWITCH":119,"Whens":120,"ELSE":121,"When":122,"LEADING_WHEN":123,"IfBlock":124,"IF":125,"POST_IF":126,"UNARY":127,"-":128,"+":129,"--":130,"++":131,"?":132,"MATH":133,"SHIFT":134,"COMPARE":135,"LOGIC":136,"RELATION":137,"COMPOUND_ASSIGN":138,"$accept":0,"$end":1},
3654 terminals_: {2:"error",6:"TERMINATOR",12:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"DEBUGGER",36:"UNDEFINED",37:"NULL",38:"BOOL",40:"=",43:":",45:"RETURN",46:"HERECOMMENT",47:"PARAM_START",49:"PARAM_END",51:"->",52:"=>",54:",",57:"...",66:".",67:"?.",68:"::",69:"?::",71:"INDEX_START",73:"INDEX_END",74:"INDEX_SOAK",76:"{",78:"}",79:"CLASS",80:"EXTENDS",83:"SUPER",84:"FUNC_EXIST",85:"CALL_START",86:"CALL_END",88:"THIS",89:"@",90:"[",91:"]",93:"..",96:"TRY",98:"FINALLY",99:"CATCH",100:"THROW",101:"(",102:")",104:"WHILE",105:"WHEN",106:"UNTIL",108:"LOOP",110:"FOR",114:"OWN",116:"FORIN",117:"FOROF",118:"BY",119:"SWITCH",121:"ELSE",123:"LEADING_WHEN",125:"IF",126:"POST_IF",127:"UNARY",128:"-",129:"+",130:"--",131:"++",132:"?",133:"MATH",134:"SHIFT",135:"COMPARE",136:"LOGIC",137:"RELATION",138:"COMPOUND_ASSIGN"},
3655 productions_: [0,[3,0],[3,1],[3,2],[4,1],[4,3],[4,2],[7,1],[7,1],[9,1],[9,1],[9,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[5,2],[5,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[17,3],[17,4],[17,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[10,2],[10,1],[11,1],[15,5],[15,2],[50,1],[50,1],[53,0],[53,1],[48,0],[48,1],[48,3],[48,4],[48,6],[55,1],[55,2],[55,3],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[13,1],[13,1],[13,1],[13,1],[13,1],[62,2],[62,2],[62,2],[62,2],[62,1],[62,1],[70,3],[70,2],[72,1],[72,1],[59,4],[77,0],[77,1],[77,3],[77,4],[77,6],[23,1],[23,2],[23,3],[23,4],[23,2],[23,3],[23,4],[23,5],[14,3],[14,3],[14,1],[14,2],[81,0],[81,1],[82,2],[82,4],[65,1],[65,1],[44,2],[58,2],[58,4],[92,1],[92,1],[64,5],[75,3],[75,2],[75,2],[75,1],[87,1],[87,3],[87,4],[87,4],[87,6],[94,1],[94,1],[95,1],[95,3],[19,2],[19,3],[19,4],[19,5],[97,3],[97,3],[97,2],[24,2],[63,3],[63,5],[103,2],[103,4],[103,2],[103,4],[20,2],[20,2],[20,2],[20,1],[107,2],[107,2],[21,2],[21,2],[21,2],[109,2],[109,2],[111,2],[111,3],[115,1],[115,1],[115,1],[115,1],[113,1],[113,3],[112,2],[112,2],[112,4],[112,4],[112,4],[112,6],[112,6],[22,5],[22,7],[22,4],[22,6],[120,1],[120,2],[122,3],[122,4],[124,3],[124,5],[18,1],[18,3],[18,3],[18,3],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,5],[16,4],[16,3]],
3656 performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
3657
3658 var $0 = $$.length - 1;
3659 switch (yystate) {
3660 case 1:return this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Block);
3661 break;
3662 case 2:return this.$ = $$[$0];
3663 break;
3664 case 3:return this.$ = $$[$0-1];
3665 break;
3666 case 4:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Block.wrap([$$[$0]]));
3667 break;
3668 case 5:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].push($$[$0]));
3669 break;
3670 case 6:this.$ = $$[$0-1];
3671 break;
3672 case 7:this.$ = $$[$0];
3673 break;
3674 case 8:this.$ = $$[$0];
3675 break;
3676 case 9:this.$ = $$[$0];
3677 break;
3678 case 10:this.$ = $$[$0];
3679 break;
3680 case 11:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
3681 break;
3682 case 12:this.$ = $$[$0];
3683 break;
3684 case 13:this.$ = $$[$0];
3685 break;
3686 case 14:this.$ = $$[$0];
3687 break;
3688 case 15:this.$ = $$[$0];
3689 break;
3690 case 16:this.$ = $$[$0];
3691 break;
3692 case 17:this.$ = $$[$0];
3693 break;
3694 case 18:this.$ = $$[$0];
3695 break;
3696 case 19:this.$ = $$[$0];
3697 break;
3698 case 20:this.$ = $$[$0];
3699 break;
3700 case 21:this.$ = $$[$0];
3701 break;
3702 case 22:this.$ = $$[$0];
3703 break;
3704 case 23:this.$ = $$[$0];
3705 break;
3706 case 24:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Block);
3707 break;
3708 case 25:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]);
3709 break;
3710 case 26:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
3711 break;
3712 case 27:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
3713 break;
3714 case 28:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
3715 break;
3716 case 29:this.$ = $$[$0];
3717 break;
3718 case 30:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
3719 break;
3720 case 31:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
3721 break;
3722 case 32:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
3723 break;
3724 case 33:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Undefined);
3725 break;
3726 case 34:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Null);
3727 break;
3728 case 35:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Bool($$[$0]));
3729 break;
3730 case 36:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0]));
3731 break;
3732 case 37:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0]));
3733 break;
3734 case 38:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1]));
3735 break;
3736 case 39:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
3737 break;
3738 case 40:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-2])(new yy.Value($$[$0-2])), $$[$0], 'object'));
3739 break;
3740 case 41:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-4])(new yy.Value($$[$0-4])), $$[$0-1], 'object'));
3741 break;
3742 case 42:this.$ = $$[$0];
3743 break;
3744 case 43:this.$ = $$[$0];
3745 break;
3746 case 44:this.$ = $$[$0];
3747 break;
3748 case 45:this.$ = $$[$0];
3749 break;
3750 case 46:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Return($$[$0]));
3751 break;
3752 case 47:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Return);
3753 break;
3754 case 48:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Comment($$[$0]));
3755 break;
3756 case 49:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Code($$[$0-3], $$[$0], $$[$0-1]));
3757 break;
3758 case 50:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Code([], $$[$0], $$[$0-1]));
3759 break;
3760 case 51:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('func');
3761 break;
3762 case 52:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('boundfunc');
3763 break;
3764 case 53:this.$ = $$[$0];
3765 break;
3766 case 54:this.$ = $$[$0];
3767 break;
3768 case 55:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]);
3769 break;
3770 case 56:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
3771 break;
3772 case 57:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0]));
3773 break;
3774 case 58:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0]));
3775 break;
3776 case 59:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2]));
3777 break;
3778 case 60:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Param($$[$0]));
3779 break;
3780 case 61:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Param($$[$0-1], null, true));
3781 break;
3782 case 62:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Param($$[$0-2], $$[$0]));
3783 break;
3784 case 63:this.$ = $$[$0];
3785 break;
3786 case 64:this.$ = $$[$0];
3787 break;
3788 case 65:this.$ = $$[$0];
3789 break;
3790 case 66:this.$ = $$[$0];
3791 break;
3792 case 67:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Splat($$[$0-1]));
3793 break;
3794 case 68:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
3795 break;
3796 case 69:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].add($$[$0]));
3797 break;
3798 case 70:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value($$[$0-1], [].concat($$[$0])));
3799 break;
3800 case 71:this.$ = $$[$0];
3801 break;
3802 case 72:this.$ = $$[$0];
3803 break;
3804 case 73:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
3805 break;
3806 case 74:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
3807 break;
3808 case 75:this.$ = $$[$0];
3809 break;
3810 case 76:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
3811 break;
3812 case 77:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
3813 break;
3814 case 78:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
3815 break;
3816 case 79:this.$ = $$[$0];
3817 break;
3818 case 80:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0]));
3819 break;
3820 case 81:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0], 'soak'));
3821 break;
3822 case 82:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'))), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]);
3823 break;
3824 case 83:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'), 'soak')), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]);
3825 break;
3826 case 84:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Access(new yy.Literal('prototype')));
3827 break;
3828 case 85:this.$ = $$[$0];
3829 break;
3830 case 86:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]);
3831 break;
3832 case 87:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.extend($$[$0], {
3833 soak: true
3834 }));
3835 break;
3836 case 88:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Index($$[$0]));
3837 break;
3838 case 89:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Slice($$[$0]));
3839 break;
3840 case 90:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Obj($$[$0-2], $$[$0-3].generated));
3841 break;
3842 case 91:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]);
3843 break;
3844 case 92:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
3845 break;
3846 case 93:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0]));
3847 break;
3848 case 94:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0]));
3849 break;
3850 case 95:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2]));
3851 break;
3852 case 96:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Class);
3853 break;
3854 case 97:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class(null, null, $$[$0]));
3855 break;
3856 case 98:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class(null, $$[$0]));
3857 break;
3858 case 99:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class(null, $$[$0-1], $$[$0]));
3859 break;
3860 case 100:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class($$[$0]));
3861 break;
3862 case 101:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class($$[$0-1], null, $$[$0]));
3863 break;
3864 case 102:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class($$[$0-2], $$[$0]));
3865 break;
3866 case 103:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Class($$[$0-3], $$[$0-1], $$[$0]));
3867 break;
3868 case 104:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1]));
3869 break;
3870 case 105:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1]));
3871 break;
3872 case 106:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))]));
3873 break;
3874 case 107:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Call('super', $$[$0]));
3875 break;
3876 case 108:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(false);
3877 break;
3878 case 109:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(true);
3879 break;
3880 case 110:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([]);
3881 break;
3882 case 111:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]);
3883 break;
3884 case 112:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this')));
3885 break;
3886 case 113:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this')));
3887 break;
3888 case 114:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('this')), [yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))], 'this'));
3889 break;
3890 case 115:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Arr([]));
3891 break;
3892 case 116:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Arr($$[$0-2]));
3893 break;
3894 case 117:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('inclusive');
3895 break;
3896 case 118:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('exclusive');
3897 break;
3898 case 119:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Range($$[$0-3], $$[$0-1], $$[$0-2]));
3899 break;
3900 case 120:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Range($$[$0-2], $$[$0], $$[$0-1]));
3901 break;
3902 case 121:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range($$[$0-1], null, $$[$0]));
3903 break;
3904 case 122:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range(null, $$[$0], $$[$0-1]));
3905 break;
3906 case 123:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Range(null, null, $$[$0]));
3907 break;
3908 case 124:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
3909 break;
3910 case 125:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0]));
3911 break;
3912 case 126:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0]));
3913 break;
3914 case 127:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]);
3915 break;
3916 case 128:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2]));
3917 break;
3918 case 129:this.$ = $$[$0];
3919 break;
3920 case 130:this.$ = $$[$0];
3921 break;
3922 case 131:this.$ = $$[$0];
3923 break;
3924 case 132:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([].concat($$[$0-2], $$[$0]));
3925 break;
3926 case 133:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Try($$[$0]));
3927 break;
3928 case 134:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Try($$[$0-1], $$[$0][0], $$[$0][1]));
3929 break;
3930 case 135:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Try($$[$0-2], null, null, $$[$0]));
3931 break;
3932 case 136:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]));
3933 break;
3934 case 137:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-1], $$[$0]]);
3935 break;
3936 case 138:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Value($$[$0-1])), $$[$0]]);
3937 break;
3938 case 139:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([null, $$[$0]]);
3939 break;
3940 case 140:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Throw($$[$0]));
3941 break;
3942 case 141:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Parens($$[$0-1]));
3943 break;
3944 case 142:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Parens($$[$0-2]));
3945 break;
3946 case 143:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0]));
3947 break;
3948 case 144:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], {
3949 guard: $$[$0]
3950 }));
3951 break;
3952 case 145:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0], {
3953 invert: true
3954 }));
3955 break;
3956 case 146:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], {
3957 invert: true,
3958 guard: $$[$0]
3959 }));
3960 break;
3961 case 147:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].addBody($$[$0]));
3962 break;
3963 case 148:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]]))));
3964 break;
3965 case 149:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]]))));
3966 break;
3967 case 150:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])($$[$0]);
3968 break;
3969 case 151:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody($$[$0]));
3970 break;
3971 case 152:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody(yy.addLocationDataFn(_$[$0])(yy.Block.wrap([$$[$0]]))));
3972 break;
3973 case 153:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0]));
3974 break;
3975 case 154:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0]));
3976 break;
3977 case 155:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0], $$[$0-1]));
3978 break;
3979 case 156:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({
3980 source: yy.addLocationDataFn(_$[$0])(new yy.Value($$[$0]))
3981 });
3982 break;
3983 case 157:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])((function () {
3984 $$[$0].own = $$[$0-1].own;
3985 $$[$0].name = $$[$0-1][0];
3986 $$[$0].index = $$[$0-1][1];
3987 return $$[$0];
3988 }()));
3989 break;
3990 case 158:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0]);
3991 break;
3992 case 159:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () {
3993 $$[$0].own = true;
3994 return $$[$0];
3995 }()));
3996 break;
3997 case 160:this.$ = $$[$0];
3998 break;
3999 case 161:this.$ = $$[$0];
4000 break;
4001 case 162:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
4002 break;
4003 case 163:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
4004 break;
4005 case 164:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
4006 break;
4007 case 165:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-2], $$[$0]]);
4008 break;
4009 case 166:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({
4010 source: $$[$0]
4011 });
4012 break;
4013 case 167:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({
4014 source: $$[$0],
4015 object: true
4016 });
4017 break;
4018 case 168:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({
4019 source: $$[$0-2],
4020 guard: $$[$0]
4021 });
4022 break;
4023 case 169:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({
4024 source: $$[$0-2],
4025 guard: $$[$0],
4026 object: true
4027 });
4028 break;
4029 case 170:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({
4030 source: $$[$0-2],
4031 step: $$[$0]
4032 });
4033 break;
4034 case 171:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({
4035 source: $$[$0-4],
4036 guard: $$[$0-2],
4037 step: $$[$0]
4038 });
4039 break;
4040 case 172:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({
4041 source: $$[$0-4],
4042 step: $$[$0-2],
4043 guard: $$[$0]
4044 });
4045 break;
4046 case 173:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Switch($$[$0-3], $$[$0-1]));
4047 break;
4048 case 174:this.$ = yy.addLocationDataFn(_$[$0-6], _$[$0])(new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1]));
4049 break;
4050 case 175:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Switch(null, $$[$0-1]));
4051 break;
4052 case 176:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])(new yy.Switch(null, $$[$0-3], $$[$0-1]));
4053 break;
4054 case 177:this.$ = $$[$0];
4055 break;
4056 case 178:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].concat($$[$0]));
4057 break;
4058 case 179:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([[$$[$0-1], $$[$0]]]);
4059 break;
4060 case 180:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])([[$$[$0-2], $$[$0-1]]]);
4061 break;
4062 case 181:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], {
4063 type: $$[$0-2]
4064 }));
4065 break;
4066 case 182:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])($$[$0-4].addElse(new yy.If($$[$0-1], $$[$0], {
4067 type: $$[$0-2]
4068 })));
4069 break;
4070 case 183:this.$ = $$[$0];
4071 break;
4072 case 184:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].addElse($$[$0]));
4073 break;
4074 case 185:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), {
4075 type: $$[$0-1],
4076 statement: true
4077 }));
4078 break;
4079 case 186:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), {
4080 type: $$[$0-1],
4081 statement: true
4082 }));
4083 break;
4084 case 187:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op($$[$0-1], $$[$0]));
4085 break;
4086 case 188:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('-', $$[$0]));
4087 break;
4088 case 189:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('+', $$[$0]));
4089 break;
4090 case 190:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0]));
4091 break;
4092 case 191:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0]));
4093 break;
4094 case 192:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0-1], null, true));
4095 break;
4096 case 193:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0-1], null, true));
4097 break;
4098 case 194:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Existence($$[$0-1]));
4099 break;
4100 case 195:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('+', $$[$0-2], $$[$0]));
4101 break;
4102 case 196:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('-', $$[$0-2], $$[$0]));
4103 break;
4104 case 197:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
4105 break;
4106 case 198:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
4107 break;
4108 case 199:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
4109 break;
4110 case 200:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
4111 break;
4112 case 201:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () {
4113 if ($$[$0-1].charAt(0) === '!') {
4114 return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert();
4115 } else {
4116 return new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
4117 }
4118 }()));
4119 break;
4120 case 202:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0], $$[$0-1]));
4121 break;
4122 case 203:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3]));
4123 break;
4124 case 204:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0], $$[$0-2]));
4125 break;
4126 case 205:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Extends($$[$0-2], $$[$0]));
4127 break;
4128 }
4129 },
4130 table: [{1:[2,1],3:1,4:2,5:3,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[3]},{1:[2,2],6:[1,74]},{6:[1,75]},{1:[2,4],6:[2,4],26:[2,4],102:[2,4]},{4:77,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[1,76],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,7],6:[2,7],26:[2,7],102:[2,7],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,8],6:[2,8],26:[2,8],102:[2,8],103:90,104:[1,65],106:[1,66],109:91,110:[1,68],111:69,126:[1,89]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:93,66:[1,95],67:[1,96],68:[1,97],69:[1,98],70:99,71:[1,100],73:[2,12],74:[1,101],78:[2,12],81:92,84:[1,94],85:[2,108],86:[2,12],91:[2,12],93:[2,12],102:[2,12],104:[2,12],105:[2,12],106:[2,12],110:[2,12],118:[2,12],126:[2,12],128:[2,12],129:[2,12],132:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12],137:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],62:103,66:[1,95],67:[1,96],68:[1,97],69:[1,98],70:99,71:[1,100],73:[2,13],74:[1,101],78:[2,13],81:102,84:[1,94],85:[2,108],86:[2,13],91:[2,13],93:[2,13],102:[2,13],104:[2,13],105:[2,13],106:[2,13],110:[2,13],118:[2,13],126:[2,13],128:[2,13],129:[2,13],132:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13],137:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],73:[2,14],78:[2,14],86:[2,14],91:[2,14],93:[2,14],102:[2,14],104:[2,14],105:[2,14],106:[2,14],110:[2,14],118:[2,14],126:[2,14],128:[2,14],129:[2,14],132:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14],137:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],73:[2,15],78:[2,15],86:[2,15],91:[2,15],93:[2,15],102:[2,15],104:[2,15],105:[2,15],106:[2,15],110:[2,15],118:[2,15],126:[2,15],128:[2,15],129:[2,15],132:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15],137:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],73:[2,16],78:[2,16],86:[2,16],91:[2,16],93:[2,16],102:[2,16],104:[2,16],105:[2,16],106:[2,16],110:[2,16],118:[2,16],126:[2,16],128:[2,16],129:[2,16],132:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16],137:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],73:[2,17],78:[2,17],86:[2,17],91:[2,17],93:[2,17],102:[2,17],104:[2,17],105:[2,17],106:[2,17],110:[2,17],118:[2,17],126:[2,17],128:[2,17],129:[2,17],132:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17],137:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],73:[2,18],78:[2,18],86:[2,18],91:[2,18],93:[2,18],102:[2,18],104:[2,18],105:[2,18],106:[2,18],110:[2,18],118:[2,18],126:[2,18],128:[2,18],129:[2,18],132:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18],137:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],73:[2,19],78:[2,19],86:[2,19],91:[2,19],93:[2,19],102:[2,19],104:[2,19],105:[2,19],106:[2,19],110:[2,19],118:[2,19],126:[2,19],128:[2,19],129:[2,19],132:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19],137:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],73:[2,20],78:[2,20],86:[2,20],91:[2,20],93:[2,20],102:[2,20],104:[2,20],105:[2,20],106:[2,20],110:[2,20],118:[2,20],126:[2,20],128:[2,20],129:[2,20],132:[2,20],133:[2,20],134:[2,20],135:[2,20],136:[2,20],137:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],49:[2,21],54:[2,21],57:[2,21],73:[2,21],78:[2,21],86:[2,21],91:[2,21],93:[2,21],102:[2,21],104:[2,21],105:[2,21],106:[2,21],110:[2,21],118:[2,21],126:[2,21],128:[2,21],129:[2,21],132:[2,21],133:[2,21],134:[2,21],135:[2,21],136:[2,21],137:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],49:[2,22],54:[2,22],57:[2,22],73:[2,22],78:[2,22],86:[2,22],91:[2,22],93:[2,22],102:[2,22],104:[2,22],105:[2,22],106:[2,22],110:[2,22],118:[2,22],126:[2,22],128:[2,22],129:[2,22],132:[2,22],133:[2,22],134:[2,22],135:[2,22],136:[2,22],137:[2,22]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],49:[2,23],54:[2,23],57:[2,23],73:[2,23],78:[2,23],86:[2,23],91:[2,23],93:[2,23],102:[2,23],104:[2,23],105:[2,23],106:[2,23],110:[2,23],118:[2,23],126:[2,23],128:[2,23],129:[2,23],132:[2,23],133:[2,23],134:[2,23],135:[2,23],136:[2,23],137:[2,23]},{1:[2,9],6:[2,9],26:[2,9],102:[2,9],104:[2,9],106:[2,9],110:[2,9],126:[2,9]},{1:[2,10],6:[2,10],26:[2,10],102:[2,10],104:[2,10],106:[2,10],110:[2,10],126:[2,10]},{1:[2,11],6:[2,11],26:[2,11],102:[2,11],104:[2,11],106:[2,11],110:[2,11],126:[2,11]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],40:[1,104],49:[2,75],54:[2,75],57:[2,75],66:[2,75],67:[2,75],68:[2,75],69:[2,75],71:[2,75],73:[2,75],74:[2,75],78:[2,75],84:[2,75],85:[2,75],86:[2,75],91:[2,75],93:[2,75],102:[2,75],104:[2,75],105:[2,75],106:[2,75],110:[2,75],118:[2,75],126:[2,75],128:[2,75],129:[2,75],132:[2,75],133:[2,75],134:[2,75],135:[2,75],136:[2,75],137:[2,75]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],49:[2,76],54:[2,76],57:[2,76],66:[2,76],67:[2,76],68:[2,76],69:[2,76],71:[2,76],73:[2,76],74:[2,76],78:[2,76],84:[2,76],85:[2,76],86:[2,76],91:[2,76],93:[2,76],102:[2,76],104:[2,76],105:[2,76],106:[2,76],110:[2,76],118:[2,76],126:[2,76],128:[2,76],129:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76],136:[2,76],137:[2,76]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],49:[2,77],54:[2,77],57:[2,77],66:[2,77],67:[2,77],68:[2,77],69:[2,77],71:[2,77],73:[2,77],74:[2,77],78:[2,77],84:[2,77],85:[2,77],86:[2,77],91:[2,77],93:[2,77],102:[2,77],104:[2,77],105:[2,77],106:[2,77],110:[2,77],118:[2,77],126:[2,77],128:[2,77],129:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77],136:[2,77],137:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],49:[2,78],54:[2,78],57:[2,78],66:[2,78],67:[2,78],68:[2,78],69:[2,78],71:[2,78],73:[2,78],74:[2,78],78:[2,78],84:[2,78],85:[2,78],86:[2,78],91:[2,78],93:[2,78],102:[2,78],104:[2,78],105:[2,78],106:[2,78],110:[2,78],118:[2,78],126:[2,78],128:[2,78],129:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78],136:[2,78],137:[2,78]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],49:[2,79],54:[2,79],57:[2,79],66:[2,79],67:[2,79],68:[2,79],69:[2,79],71:[2,79],73:[2,79],74:[2,79],78:[2,79],84:[2,79],85:[2,79],86:[2,79],91:[2,79],93:[2,79],102:[2,79],104:[2,79],105:[2,79],106:[2,79],110:[2,79],118:[2,79],126:[2,79],128:[2,79],129:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79],136:[2,79],137:[2,79]},{1:[2,106],6:[2,106],25:[2,106],26:[2,106],49:[2,106],54:[2,106],57:[2,106],66:[2,106],67:[2,106],68:[2,106],69:[2,106],71:[2,106],73:[2,106],74:[2,106],78:[2,106],82:105,84:[2,106],85:[1,106],86:[2,106],91:[2,106],93:[2,106],102:[2,106],104:[2,106],105:[2,106],106:[2,106],110:[2,106],118:[2,106],126:[2,106],128:[2,106],129:[2,106],132:[2,106],133:[2,106],134:[2,106],135:[2,106],136:[2,106],137:[2,106]},{6:[2,55],25:[2,55],27:110,28:[1,73],44:111,48:107,49:[2,55],54:[2,55],55:108,56:109,58:112,59:113,76:[1,70],89:[1,114],90:[1,115]},{5:116,25:[1,5]},{8:117,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:119,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:120,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{13:122,14:123,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:124,44:63,58:47,59:48,61:121,63:25,64:26,65:27,76:[1,70],83:[1,28],88:[1,58],89:[1,59],90:[1,57],101:[1,56]},{13:122,14:123,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:124,44:63,58:47,59:48,61:125,63:25,64:26,65:27,76:[1,70],83:[1,28],88:[1,58],89:[1,59],90:[1,57],101:[1,56]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],40:[2,72],49:[2,72],54:[2,72],57:[2,72],66:[2,72],67:[2,72],68:[2,72],69:[2,72],71:[2,72],73:[2,72],74:[2,72],78:[2,72],80:[1,129],84:[2,72],85:[2,72],86:[2,72],91:[2,72],93:[2,72],102:[2,72],104:[2,72],105:[2,72],106:[2,72],110:[2,72],118:[2,72],126:[2,72],128:[2,72],129:[2,72],130:[1,126],131:[1,127],132:[2,72],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[2,72],138:[1,128]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],49:[2,183],54:[2,183],57:[2,183],73:[2,183],78:[2,183],86:[2,183],91:[2,183],93:[2,183],102:[2,183],104:[2,183],105:[2,183],106:[2,183],110:[2,183],118:[2,183],121:[1,130],126:[2,183],128:[2,183],129:[2,183],132:[2,183],133:[2,183],134:[2,183],135:[2,183],136:[2,183],137:[2,183]},{5:131,25:[1,5]},{5:132,25:[1,5]},{1:[2,150],6:[2,150],25:[2,150],26:[2,150],49:[2,150],54:[2,150],57:[2,150],73:[2,150],78:[2,150],86:[2,150],91:[2,150],93:[2,150],102:[2,150],104:[2,150],105:[2,150],106:[2,150],110:[2,150],118:[2,150],126:[2,150],128:[2,150],129:[2,150],132:[2,150],133:[2,150],134:[2,150],135:[2,150],136:[2,150],137:[2,150]},{5:133,25:[1,5]},{8:134,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,135],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,96],5:136,6:[2,96],13:122,14:123,25:[1,5],26:[2,96],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:124,44:63,49:[2,96],54:[2,96],57:[2,96],58:47,59:48,61:138,63:25,64:26,65:27,73:[2,96],76:[1,70],78:[2,96],80:[1,137],83:[1,28],86:[2,96],88:[1,58],89:[1,59],90:[1,57],91:[2,96],93:[2,96],101:[1,56],102:[2,96],104:[2,96],105:[2,96],106:[2,96],110:[2,96],118:[2,96],126:[2,96],128:[2,96],129:[2,96],132:[2,96],133:[2,96],134:[2,96],135:[2,96],136:[2,96],137:[2,96]},{8:139,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,47],6:[2,47],8:140,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,47],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],102:[2,47],103:39,104:[2,47],106:[2,47],107:40,108:[1,67],109:41,110:[2,47],111:69,119:[1,42],124:37,125:[1,64],126:[2,47],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,48],6:[2,48],25:[2,48],26:[2,48],54:[2,48],78:[2,48],102:[2,48],104:[2,48],106:[2,48],110:[2,48],126:[2,48]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],40:[2,73],49:[2,73],54:[2,73],57:[2,73],66:[2,73],67:[2,73],68:[2,73],69:[2,73],71:[2,73],73:[2,73],74:[2,73],78:[2,73],84:[2,73],85:[2,73],86:[2,73],91:[2,73],93:[2,73],102:[2,73],104:[2,73],105:[2,73],106:[2,73],110:[2,73],118:[2,73],126:[2,73],128:[2,73],129:[2,73],132:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73],137:[2,73]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],40:[2,74],49:[2,74],54:[2,74],57:[2,74],66:[2,74],67:[2,74],68:[2,74],69:[2,74],71:[2,74],73:[2,74],74:[2,74],78:[2,74],84:[2,74],85:[2,74],86:[2,74],91:[2,74],93:[2,74],102:[2,74],104:[2,74],105:[2,74],106:[2,74],110:[2,74],118:[2,74],126:[2,74],128:[2,74],129:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74],137:[2,74]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],49:[2,29],54:[2,29],57:[2,29],66:[2,29],67:[2,29],68:[2,29],69:[2,29],71:[2,29],73:[2,29],74:[2,29],78:[2,29],84:[2,29],85:[2,29],86:[2,29],91:[2,29],93:[2,29],102:[2,29],104:[2,29],105:[2,29],106:[2,29],110:[2,29],118:[2,29],126:[2,29],128:[2,29],129:[2,29],132:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29],137:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],49:[2,30],54:[2,30],57:[2,30],66:[2,30],67:[2,30],68:[2,30],69:[2,30],71:[2,30],73:[2,30],74:[2,30],78:[2,30],84:[2,30],85:[2,30],86:[2,30],91:[2,30],93:[2,30],102:[2,30],104:[2,30],105:[2,30],106:[2,30],110:[2,30],118:[2,30],126:[2,30],128:[2,30],129:[2,30],132:[2,30],133:[2,30],134:[2,30],135:[2,30],136:[2,30],137:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],49:[2,31],54:[2,31],57:[2,31],66:[2,31],67:[2,31],68:[2,31],69:[2,31],71:[2,31],73:[2,31],74:[2,31],78:[2,31],84:[2,31],85:[2,31],86:[2,31],91:[2,31],93:[2,31],102:[2,31],104:[2,31],105:[2,31],106:[2,31],110:[2,31],118:[2,31],126:[2,31],128:[2,31],129:[2,31],132:[2,31],133:[2,31],134:[2,31],135:[2,31],136:[2,31],137:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],49:[2,32],54:[2,32],57:[2,32],66:[2,32],67:[2,32],68:[2,32],69:[2,32],71:[2,32],73:[2,32],74:[2,32],78:[2,32],84:[2,32],85:[2,32],86:[2,32],91:[2,32],93:[2,32],102:[2,32],104:[2,32],105:[2,32],106:[2,32],110:[2,32],118:[2,32],126:[2,32],128:[2,32],129:[2,32],132:[2,32],133:[2,32],134:[2,32],135:[2,32],136:[2,32],137:[2,32]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],49:[2,33],54:[2,33],57:[2,33],66:[2,33],67:[2,33],68:[2,33],69:[2,33],71:[2,33],73:[2,33],74:[2,33],78:[2,33],84:[2,33],85:[2,33],86:[2,33],91:[2,33],93:[2,33],102:[2,33],104:[2,33],105:[2,33],106:[2,33],110:[2,33],118:[2,33],126:[2,33],128:[2,33],129:[2,33],132:[2,33],133:[2,33],134:[2,33],135:[2,33],136:[2,33],137:[2,33]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],49:[2,34],54:[2,34],57:[2,34],66:[2,34],67:[2,34],68:[2,34],69:[2,34],71:[2,34],73:[2,34],74:[2,34],78:[2,34],84:[2,34],85:[2,34],86:[2,34],91:[2,34],93:[2,34],102:[2,34],104:[2,34],105:[2,34],106:[2,34],110:[2,34],118:[2,34],126:[2,34],128:[2,34],129:[2,34],132:[2,34],133:[2,34],134:[2,34],135:[2,34],136:[2,34],137:[2,34]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],49:[2,35],54:[2,35],57:[2,35],66:[2,35],67:[2,35],68:[2,35],69:[2,35],71:[2,35],73:[2,35],74:[2,35],78:[2,35],84:[2,35],85:[2,35],86:[2,35],91:[2,35],93:[2,35],102:[2,35],104:[2,35],105:[2,35],106:[2,35],110:[2,35],118:[2,35],126:[2,35],128:[2,35],129:[2,35],132:[2,35],133:[2,35],134:[2,35],135:[2,35],136:[2,35],137:[2,35]},{4:141,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,142],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:143,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,147],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:148,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],87:145,88:[1,58],89:[1,59],90:[1,57],91:[1,144],94:146,96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,112],6:[2,112],25:[2,112],26:[2,112],49:[2,112],54:[2,112],57:[2,112],66:[2,112],67:[2,112],68:[2,112],69:[2,112],71:[2,112],73:[2,112],74:[2,112],78:[2,112],84:[2,112],85:[2,112],86:[2,112],91:[2,112],93:[2,112],102:[2,112],104:[2,112],105:[2,112],106:[2,112],110:[2,112],118:[2,112],126:[2,112],128:[2,112],129:[2,112],132:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112],137:[2,112]},{1:[2,113],6:[2,113],25:[2,113],26:[2,113],27:149,28:[1,73],49:[2,113],54:[2,113],57:[2,113],66:[2,113],67:[2,113],68:[2,113],69:[2,113],71:[2,113],73:[2,113],74:[2,113],78:[2,113],84:[2,113],85:[2,113],86:[2,113],91:[2,113],93:[2,113],102:[2,113],104:[2,113],105:[2,113],106:[2,113],110:[2,113],118:[2,113],126:[2,113],128:[2,113],129:[2,113],132:[2,113],133:[2,113],134:[2,113],135:[2,113],136:[2,113],137:[2,113]},{25:[2,51]},{25:[2,52]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],40:[2,68],49:[2,68],54:[2,68],57:[2,68],66:[2,68],67:[2,68],68:[2,68],69:[2,68],71:[2,68],73:[2,68],74:[2,68],78:[2,68],80:[2,68],84:[2,68],85:[2,68],86:[2,68],91:[2,68],93:[2,68],102:[2,68],104:[2,68],105:[2,68],106:[2,68],110:[2,68],118:[2,68],126:[2,68],128:[2,68],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68],135:[2,68],136:[2,68],137:[2,68],138:[2,68]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],40:[2,71],49:[2,71],54:[2,71],57:[2,71],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,71],74:[2,71],78:[2,71],80:[2,71],84:[2,71],85:[2,71],86:[2,71],91:[2,71],93:[2,71],102:[2,71],104:[2,71],105:[2,71],106:[2,71],110:[2,71],118:[2,71],126:[2,71],128:[2,71],129:[2,71],130:[2,71],131:[2,71],132:[2,71],133:[2,71],134:[2,71],135:[2,71],136:[2,71],137:[2,71],138:[2,71]},{8:150,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:151,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:152,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{5:153,8:154,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{27:159,28:[1,73],44:160,58:161,59:162,64:155,76:[1,70],89:[1,114],90:[1,57],113:156,114:[1,157],115:158},{112:163,116:[1,164],117:[1,165]},{6:[2,91],11:169,25:[2,91],27:170,28:[1,73],29:171,30:[1,71],31:[1,72],41:167,42:168,44:172,46:[1,46],54:[2,91],77:166,78:[2,91],89:[1,114]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],43:[2,27],49:[2,27],54:[2,27],57:[2,27],66:[2,27],67:[2,27],68:[2,27],69:[2,27],71:[2,27],73:[2,27],74:[2,27],78:[2,27],84:[2,27],85:[2,27],86:[2,27],91:[2,27],93:[2,27],102:[2,27],104:[2,27],105:[2,27],106:[2,27],110:[2,27],118:[2,27],126:[2,27],128:[2,27],129:[2,27],132:[2,27],133:[2,27],134:[2,27],135:[2,27],136:[2,27],137:[2,27]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],43:[2,28],49:[2,28],54:[2,28],57:[2,28],66:[2,28],67:[2,28],68:[2,28],69:[2,28],71:[2,28],73:[2,28],74:[2,28],78:[2,28],84:[2,28],85:[2,28],86:[2,28],91:[2,28],93:[2,28],102:[2,28],104:[2,28],105:[2,28],106:[2,28],110:[2,28],118:[2,28],126:[2,28],128:[2,28],129:[2,28],132:[2,28],133:[2,28],134:[2,28],135:[2,28],136:[2,28],137:[2,28]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],40:[2,26],43:[2,26],49:[2,26],54:[2,26],57:[2,26],66:[2,26],67:[2,26],68:[2,26],69:[2,26],71:[2,26],73:[2,26],74:[2,26],78:[2,26],80:[2,26],84:[2,26],85:[2,26],86:[2,26],91:[2,26],93:[2,26],102:[2,26],104:[2,26],105:[2,26],106:[2,26],110:[2,26],116:[2,26],117:[2,26],118:[2,26],126:[2,26],128:[2,26],129:[2,26],130:[2,26],131:[2,26],132:[2,26],133:[2,26],134:[2,26],135:[2,26],136:[2,26],137:[2,26],138:[2,26]},{1:[2,6],6:[2,6],7:173,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,6],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],102:[2,6],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,3]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],49:[2,24],54:[2,24],57:[2,24],73:[2,24],78:[2,24],86:[2,24],91:[2,24],93:[2,24],98:[2,24],99:[2,24],102:[2,24],104:[2,24],105:[2,24],106:[2,24],110:[2,24],118:[2,24],121:[2,24],123:[2,24],126:[2,24],128:[2,24],129:[2,24],132:[2,24],133:[2,24],134:[2,24],135:[2,24],136:[2,24],137:[2,24]},{6:[1,74],26:[1,174]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],49:[2,194],54:[2,194],57:[2,194],73:[2,194],78:[2,194],86:[2,194],91:[2,194],93:[2,194],102:[2,194],104:[2,194],105:[2,194],106:[2,194],110:[2,194],118:[2,194],126:[2,194],128:[2,194],129:[2,194],132:[2,194],133:[2,194],134:[2,194],135:[2,194],136:[2,194],137:[2,194]},{8:175,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:176,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:177,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:178,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:179,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:180,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:181,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:182,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,149],6:[2,149],25:[2,149],26:[2,149],49:[2,149],54:[2,149],57:[2,149],73:[2,149],78:[2,149],86:[2,149],91:[2,149],93:[2,149],102:[2,149],104:[2,149],105:[2,149],106:[2,149],110:[2,149],118:[2,149],126:[2,149],128:[2,149],129:[2,149],132:[2,149],133:[2,149],134:[2,149],135:[2,149],136:[2,149],137:[2,149]},{1:[2,154],6:[2,154],25:[2,154],26:[2,154],49:[2,154],54:[2,154],57:[2,154],73:[2,154],78:[2,154],86:[2,154],91:[2,154],93:[2,154],102:[2,154],104:[2,154],105:[2,154],106:[2,154],110:[2,154],118:[2,154],126:[2,154],128:[2,154],129:[2,154],132:[2,154],133:[2,154],134:[2,154],135:[2,154],136:[2,154],137:[2,154]},{8:183,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],49:[2,148],54:[2,148],57:[2,148],73:[2,148],78:[2,148],86:[2,148],91:[2,148],93:[2,148],102:[2,148],104:[2,148],105:[2,148],106:[2,148],110:[2,148],118:[2,148],126:[2,148],128:[2,148],129:[2,148],132:[2,148],133:[2,148],134:[2,148],135:[2,148],136:[2,148],137:[2,148]},{1:[2,153],6:[2,153],25:[2,153],26:[2,153],49:[2,153],54:[2,153],57:[2,153],73:[2,153],78:[2,153],86:[2,153],91:[2,153],93:[2,153],102:[2,153],104:[2,153],105:[2,153],106:[2,153],110:[2,153],118:[2,153],126:[2,153],128:[2,153],129:[2,153],132:[2,153],133:[2,153],134:[2,153],135:[2,153],136:[2,153],137:[2,153]},{82:184,85:[1,106]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],40:[2,69],49:[2,69],54:[2,69],57:[2,69],66:[2,69],67:[2,69],68:[2,69],69:[2,69],71:[2,69],73:[2,69],74:[2,69],78:[2,69],80:[2,69],84:[2,69],85:[2,69],86:[2,69],91:[2,69],93:[2,69],102:[2,69],104:[2,69],105:[2,69],106:[2,69],110:[2,69],118:[2,69],126:[2,69],128:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69],135:[2,69],136:[2,69],137:[2,69],138:[2,69]},{85:[2,109]},{27:185,28:[1,73]},{27:186,28:[1,73]},{1:[2,84],6:[2,84],25:[2,84],26:[2,84],27:187,28:[1,73],40:[2,84],49:[2,84],54:[2,84],57:[2,84],66:[2,84],67:[2,84],68:[2,84],69:[2,84],71:[2,84],73:[2,84],74:[2,84],78:[2,84],80:[2,84],84:[2,84],85:[2,84],86:[2,84],91:[2,84],93:[2,84],102:[2,84],104:[2,84],105:[2,84],106:[2,84],110:[2,84],118:[2,84],126:[2,84],128:[2,84],129:[2,84],130:[2,84],131:[2,84],132:[2,84],133:[2,84],134:[2,84],135:[2,84],136:[2,84],137:[2,84],138:[2,84]},{27:188,28:[1,73]},{1:[2,85],6:[2,85],25:[2,85],26:[2,85],40:[2,85],49:[2,85],54:[2,85],57:[2,85],66:[2,85],67:[2,85],68:[2,85],69:[2,85],71:[2,85],73:[2,85],74:[2,85],78:[2,85],80:[2,85],84:[2,85],85:[2,85],86:[2,85],91:[2,85],93:[2,85],102:[2,85],104:[2,85],105:[2,85],106:[2,85],110:[2,85],118:[2,85],126:[2,85],128:[2,85],129:[2,85],130:[2,85],131:[2,85],132:[2,85],133:[2,85],134:[2,85],135:[2,85],136:[2,85],137:[2,85],138:[2,85]},{8:190,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],57:[1,194],58:47,59:48,61:36,63:25,64:26,65:27,72:189,75:191,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],92:192,93:[1,193],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{70:195,71:[1,100],74:[1,101]},{82:196,85:[1,106]},{1:[2,70],6:[2,70],25:[2,70],26:[2,70],40:[2,70],49:[2,70],54:[2,70],57:[2,70],66:[2,70],67:[2,70],68:[2,70],69:[2,70],71:[2,70],73:[2,70],74:[2,70],78:[2,70],80:[2,70],84:[2,70],85:[2,70],86:[2,70],91:[2,70],93:[2,70],102:[2,70],104:[2,70],105:[2,70],106:[2,70],110:[2,70],118:[2,70],126:[2,70],128:[2,70],129:[2,70],130:[2,70],131:[2,70],132:[2,70],133:[2,70],134:[2,70],135:[2,70],136:[2,70],137:[2,70],138:[2,70]},{6:[1,198],8:197,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,199],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,107],6:[2,107],25:[2,107],26:[2,107],49:[2,107],54:[2,107],57:[2,107],66:[2,107],67:[2,107],68:[2,107],69:[2,107],71:[2,107],73:[2,107],74:[2,107],78:[2,107],84:[2,107],85:[2,107],86:[2,107],91:[2,107],93:[2,107],102:[2,107],104:[2,107],105:[2,107],106:[2,107],110:[2,107],118:[2,107],126:[2,107],128:[2,107],129:[2,107],132:[2,107],133:[2,107],134:[2,107],135:[2,107],136:[2,107],137:[2,107]},{8:202,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,147],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:148,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],86:[1,200],87:201,88:[1,58],89:[1,59],90:[1,57],94:146,96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{6:[2,53],25:[2,53],49:[1,203],53:205,54:[1,204]},{6:[2,56],25:[2,56],26:[2,56],49:[2,56],54:[2,56]},{6:[2,60],25:[2,60],26:[2,60],40:[1,207],49:[2,60],54:[2,60],57:[1,206]},{6:[2,63],25:[2,63],26:[2,63],40:[2,63],49:[2,63],54:[2,63],57:[2,63]},{6:[2,64],25:[2,64],26:[2,64],40:[2,64],49:[2,64],54:[2,64],57:[2,64]},{6:[2,65],25:[2,65],26:[2,65],40:[2,65],49:[2,65],54:[2,65],57:[2,65]},{6:[2,66],25:[2,66],26:[2,66],40:[2,66],49:[2,66],54:[2,66],57:[2,66]},{27:149,28:[1,73]},{8:202,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,147],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:148,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],87:145,88:[1,58],89:[1,59],90:[1,57],91:[1,144],94:146,96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,50],6:[2,50],25:[2,50],26:[2,50],49:[2,50],54:[2,50],57:[2,50],73:[2,50],78:[2,50],86:[2,50],91:[2,50],93:[2,50],102:[2,50],104:[2,50],105:[2,50],106:[2,50],110:[2,50],118:[2,50],126:[2,50],128:[2,50],129:[2,50],132:[2,50],133:[2,50],134:[2,50],135:[2,50],136:[2,50],137:[2,50]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],49:[2,187],54:[2,187],57:[2,187],73:[2,187],78:[2,187],86:[2,187],91:[2,187],93:[2,187],102:[2,187],103:87,104:[2,187],105:[2,187],106:[2,187],109:88,110:[2,187],111:69,118:[2,187],126:[2,187],128:[2,187],129:[2,187],132:[1,78],133:[2,187],134:[2,187],135:[2,187],136:[2,187],137:[2,187]},{103:90,104:[1,65],106:[1,66],109:91,110:[1,68],111:69,126:[1,89]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],49:[2,188],54:[2,188],57:[2,188],73:[2,188],78:[2,188],86:[2,188],91:[2,188],93:[2,188],102:[2,188],103:87,104:[2,188],105:[2,188],106:[2,188],109:88,110:[2,188],111:69,118:[2,188],126:[2,188],128:[2,188],129:[2,188],132:[1,78],133:[2,188],134:[2,188],135:[2,188],136:[2,188],137:[2,188]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],49:[2,189],54:[2,189],57:[2,189],73:[2,189],78:[2,189],86:[2,189],91:[2,189],93:[2,189],102:[2,189],103:87,104:[2,189],105:[2,189],106:[2,189],109:88,110:[2,189],111:69,118:[2,189],126:[2,189],128:[2,189],129:[2,189],132:[1,78],133:[2,189],134:[2,189],135:[2,189],136:[2,189],137:[2,189]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],49:[2,190],54:[2,190],57:[2,190],66:[2,72],67:[2,72],68:[2,72],69:[2,72],71:[2,72],73:[2,190],74:[2,72],78:[2,190],84:[2,72],85:[2,72],86:[2,190],91:[2,190],93:[2,190],102:[2,190],104:[2,190],105:[2,190],106:[2,190],110:[2,190],118:[2,190],126:[2,190],128:[2,190],129:[2,190],132:[2,190],133:[2,190],134:[2,190],135:[2,190],136:[2,190],137:[2,190]},{62:93,66:[1,95],67:[1,96],68:[1,97],69:[1,98],70:99,71:[1,100],74:[1,101],81:92,84:[1,94],85:[2,108]},{62:103,66:[1,95],67:[1,96],68:[1,97],69:[1,98],70:99,71:[1,100],74:[1,101],81:102,84:[1,94],85:[2,108]},{66:[2,75],67:[2,75],68:[2,75],69:[2,75],71:[2,75],74:[2,75],84:[2,75],85:[2,75]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],49:[2,191],54:[2,191],57:[2,191],66:[2,72],67:[2,72],68:[2,72],69:[2,72],71:[2,72],73:[2,191],74:[2,72],78:[2,191],84:[2,72],85:[2,72],86:[2,191],91:[2,191],93:[2,191],102:[2,191],104:[2,191],105:[2,191],106:[2,191],110:[2,191],118:[2,191],126:[2,191],128:[2,191],129:[2,191],132:[2,191],133:[2,191],134:[2,191],135:[2,191],136:[2,191],137:[2,191]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],49:[2,192],54:[2,192],57:[2,192],73:[2,192],78:[2,192],86:[2,192],91:[2,192],93:[2,192],102:[2,192],104:[2,192],105:[2,192],106:[2,192],110:[2,192],118:[2,192],126:[2,192],128:[2,192],129:[2,192],132:[2,192],133:[2,192],134:[2,192],135:[2,192],136:[2,192],137:[2,192]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],49:[2,193],54:[2,193],57:[2,193],73:[2,193],78:[2,193],86:[2,193],91:[2,193],93:[2,193],102:[2,193],104:[2,193],105:[2,193],106:[2,193],110:[2,193],118:[2,193],126:[2,193],128:[2,193],129:[2,193],132:[2,193],133:[2,193],134:[2,193],135:[2,193],136:[2,193],137:[2,193]},{6:[1,210],8:208,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,209],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:211,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{5:212,25:[1,5],125:[1,213]},{1:[2,133],6:[2,133],25:[2,133],26:[2,133],49:[2,133],54:[2,133],57:[2,133],73:[2,133],78:[2,133],86:[2,133],91:[2,133],93:[2,133],97:214,98:[1,215],99:[1,216],102:[2,133],104:[2,133],105:[2,133],106:[2,133],110:[2,133],118:[2,133],126:[2,133],128:[2,133],129:[2,133],132:[2,133],133:[2,133],134:[2,133],135:[2,133],136:[2,133],137:[2,133]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],49:[2,147],54:[2,147],57:[2,147],73:[2,147],78:[2,147],86:[2,147],91:[2,147],93:[2,147],102:[2,147],104:[2,147],105:[2,147],106:[2,147],110:[2,147],118:[2,147],126:[2,147],128:[2,147],129:[2,147],132:[2,147],133:[2,147],134:[2,147],135:[2,147],136:[2,147],137:[2,147]},{1:[2,155],6:[2,155],25:[2,155],26:[2,155],49:[2,155],54:[2,155],57:[2,155],73:[2,155],78:[2,155],86:[2,155],91:[2,155],93:[2,155],102:[2,155],104:[2,155],105:[2,155],106:[2,155],110:[2,155],118:[2,155],126:[2,155],128:[2,155],129:[2,155],132:[2,155],133:[2,155],134:[2,155],135:[2,155],136:[2,155],137:[2,155]},{25:[1,217],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{120:218,122:219,123:[1,220]},{1:[2,97],6:[2,97],25:[2,97],26:[2,97],49:[2,97],54:[2,97],57:[2,97],73:[2,97],78:[2,97],86:[2,97],91:[2,97],93:[2,97],102:[2,97],104:[2,97],105:[2,97],106:[2,97],110:[2,97],118:[2,97],126:[2,97],128:[2,97],129:[2,97],132:[2,97],133:[2,97],134:[2,97],135:[2,97],136:[2,97],137:[2,97]},{8:221,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,100],5:222,6:[2,100],25:[1,5],26:[2,100],49:[2,100],54:[2,100],57:[2,100],66:[2,72],67:[2,72],68:[2,72],69:[2,72],71:[2,72],73:[2,100],74:[2,72],78:[2,100],80:[1,223],84:[2,72],85:[2,72],86:[2,100],91:[2,100],93:[2,100],102:[2,100],104:[2,100],105:[2,100],106:[2,100],110:[2,100],118:[2,100],126:[2,100],128:[2,100],129:[2,100],132:[2,100],133:[2,100],134:[2,100],135:[2,100],136:[2,100],137:[2,100]},{1:[2,140],6:[2,140],25:[2,140],26:[2,140],49:[2,140],54:[2,140],57:[2,140],73:[2,140],78:[2,140],86:[2,140],91:[2,140],93:[2,140],102:[2,140],103:87,104:[2,140],105:[2,140],106:[2,140],109:88,110:[2,140],111:69,118:[2,140],126:[2,140],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,46],6:[2,46],26:[2,46],102:[2,46],103:87,104:[2,46],106:[2,46],109:88,110:[2,46],111:69,126:[2,46],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{6:[1,74],102:[1,224]},{4:225,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{6:[2,129],25:[2,129],54:[2,129],57:[1,227],91:[2,129],92:226,93:[1,193],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,115],6:[2,115],25:[2,115],26:[2,115],40:[2,115],49:[2,115],54:[2,115],57:[2,115],66:[2,115],67:[2,115],68:[2,115],69:[2,115],71:[2,115],73:[2,115],74:[2,115],78:[2,115],84:[2,115],85:[2,115],86:[2,115],91:[2,115],93:[2,115],102:[2,115],104:[2,115],105:[2,115],106:[2,115],110:[2,115],116:[2,115],117:[2,115],118:[2,115],126:[2,115],128:[2,115],129:[2,115],132:[2,115],133:[2,115],134:[2,115],135:[2,115],136:[2,115],137:[2,115]},{6:[2,53],25:[2,53],53:228,54:[1,229],91:[2,53]},{6:[2,124],25:[2,124],26:[2,124],54:[2,124],86:[2,124],91:[2,124]},{8:202,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,147],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:148,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],87:230,88:[1,58],89:[1,59],90:[1,57],94:146,96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{6:[2,130],25:[2,130],26:[2,130],54:[2,130],86:[2,130],91:[2,130]},{1:[2,114],6:[2,114],25:[2,114],26:[2,114],40:[2,114],43:[2,114],49:[2,114],54:[2,114],57:[2,114],66:[2,114],67:[2,114],68:[2,114],69:[2,114],71:[2,114],73:[2,114],74:[2,114],78:[2,114],80:[2,114],84:[2,114],85:[2,114],86:[2,114],91:[2,114],93:[2,114],102:[2,114],104:[2,114],105:[2,114],106:[2,114],110:[2,114],116:[2,114],117:[2,114],118:[2,114],126:[2,114],128:[2,114],129:[2,114],130:[2,114],131:[2,114],132:[2,114],133:[2,114],134:[2,114],135:[2,114],136:[2,114],137:[2,114],138:[2,114]},{5:231,25:[1,5],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,143],6:[2,143],25:[2,143],26:[2,143],49:[2,143],54:[2,143],57:[2,143],73:[2,143],78:[2,143],86:[2,143],91:[2,143],93:[2,143],102:[2,143],103:87,104:[1,65],105:[1,232],106:[1,66],109:88,110:[1,68],111:69,118:[2,143],126:[2,143],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,145],6:[2,145],25:[2,145],26:[2,145],49:[2,145],54:[2,145],57:[2,145],73:[2,145],78:[2,145],86:[2,145],91:[2,145],93:[2,145],102:[2,145],103:87,104:[1,65],105:[1,233],106:[1,66],109:88,110:[1,68],111:69,118:[2,145],126:[2,145],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,151],6:[2,151],25:[2,151],26:[2,151],49:[2,151],54:[2,151],57:[2,151],73:[2,151],78:[2,151],86:[2,151],91:[2,151],93:[2,151],102:[2,151],104:[2,151],105:[2,151],106:[2,151],110:[2,151],118:[2,151],126:[2,151],128:[2,151],129:[2,151],132:[2,151],133:[2,151],134:[2,151],135:[2,151],136:[2,151],137:[2,151]},{1:[2,152],6:[2,152],25:[2,152],26:[2,152],49:[2,152],54:[2,152],57:[2,152],73:[2,152],78:[2,152],86:[2,152],91:[2,152],93:[2,152],102:[2,152],103:87,104:[1,65],105:[2,152],106:[1,66],109:88,110:[1,68],111:69,118:[2,152],126:[2,152],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,156],6:[2,156],25:[2,156],26:[2,156],49:[2,156],54:[2,156],57:[2,156],73:[2,156],78:[2,156],86:[2,156],91:[2,156],93:[2,156],102:[2,156],104:[2,156],105:[2,156],106:[2,156],110:[2,156],118:[2,156],126:[2,156],128:[2,156],129:[2,156],132:[2,156],133:[2,156],134:[2,156],135:[2,156],136:[2,156],137:[2,156]},{116:[2,158],117:[2,158]},{27:159,28:[1,73],44:160,58:161,59:162,76:[1,70],89:[1,114],90:[1,115],113:234,115:158},{54:[1,235],116:[2,164],117:[2,164]},{54:[2,160],116:[2,160],117:[2,160]},{54:[2,161],116:[2,161],117:[2,161]},{54:[2,162],116:[2,162],117:[2,162]},{54:[2,163],116:[2,163],117:[2,163]},{1:[2,157],6:[2,157],25:[2,157],26:[2,157],49:[2,157],54:[2,157],57:[2,157],73:[2,157],78:[2,157],86:[2,157],91:[2,157],93:[2,157],102:[2,157],104:[2,157],105:[2,157],106:[2,157],110:[2,157],118:[2,157],126:[2,157],128:[2,157],129:[2,157],132:[2,157],133:[2,157],134:[2,157],135:[2,157],136:[2,157],137:[2,157]},{8:236,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:237,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{6:[2,53],25:[2,53],53:238,54:[1,239],78:[2,53]},{6:[2,92],25:[2,92],26:[2,92],54:[2,92],78:[2,92]},{6:[2,39],25:[2,39],26:[2,39],43:[1,240],54:[2,39],78:[2,39]},{6:[2,42],25:[2,42],26:[2,42],54:[2,42],78:[2,42]},{6:[2,43],25:[2,43],26:[2,43],43:[2,43],54:[2,43],78:[2,43]},{6:[2,44],25:[2,44],26:[2,44],43:[2,44],54:[2,44],78:[2,44]},{6:[2,45],25:[2,45],26:[2,45],43:[2,45],54:[2,45],78:[2,45]},{1:[2,5],6:[2,5],26:[2,5],102:[2,5]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],49:[2,25],54:[2,25],57:[2,25],73:[2,25],78:[2,25],86:[2,25],91:[2,25],93:[2,25],98:[2,25],99:[2,25],102:[2,25],104:[2,25],105:[2,25],106:[2,25],110:[2,25],118:[2,25],121:[2,25],123:[2,25],126:[2,25],128:[2,25],129:[2,25],132:[2,25],133:[2,25],134:[2,25],135:[2,25],136:[2,25],137:[2,25]},{1:[2,195],6:[2,195],25:[2,195],26:[2,195],49:[2,195],54:[2,195],57:[2,195],73:[2,195],78:[2,195],86:[2,195],91:[2,195],93:[2,195],102:[2,195],103:87,104:[2,195],105:[2,195],106:[2,195],109:88,110:[2,195],111:69,118:[2,195],126:[2,195],128:[2,195],129:[2,195],132:[1,78],133:[1,81],134:[2,195],135:[2,195],136:[2,195],137:[2,195]},{1:[2,196],6:[2,196],25:[2,196],26:[2,196],49:[2,196],54:[2,196],57:[2,196],73:[2,196],78:[2,196],86:[2,196],91:[2,196],93:[2,196],102:[2,196],103:87,104:[2,196],105:[2,196],106:[2,196],109:88,110:[2,196],111:69,118:[2,196],126:[2,196],128:[2,196],129:[2,196],132:[1,78],133:[1,81],134:[2,196],135:[2,196],136:[2,196],137:[2,196]},{1:[2,197],6:[2,197],25:[2,197],26:[2,197],49:[2,197],54:[2,197],57:[2,197],73:[2,197],78:[2,197],86:[2,197],91:[2,197],93:[2,197],102:[2,197],103:87,104:[2,197],105:[2,197],106:[2,197],109:88,110:[2,197],111:69,118:[2,197],126:[2,197],128:[2,197],129:[2,197],132:[1,78],133:[2,197],134:[2,197],135:[2,197],136:[2,197],137:[2,197]},{1:[2,198],6:[2,198],25:[2,198],26:[2,198],49:[2,198],54:[2,198],57:[2,198],73:[2,198],78:[2,198],86:[2,198],91:[2,198],93:[2,198],102:[2,198],103:87,104:[2,198],105:[2,198],106:[2,198],109:88,110:[2,198],111:69,118:[2,198],126:[2,198],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[2,198],135:[2,198],136:[2,198],137:[2,198]},{1:[2,199],6:[2,199],25:[2,199],26:[2,199],49:[2,199],54:[2,199],57:[2,199],73:[2,199],78:[2,199],86:[2,199],91:[2,199],93:[2,199],102:[2,199],103:87,104:[2,199],105:[2,199],106:[2,199],109:88,110:[2,199],111:69,118:[2,199],126:[2,199],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[2,199],136:[2,199],137:[1,85]},{1:[2,200],6:[2,200],25:[2,200],26:[2,200],49:[2,200],54:[2,200],57:[2,200],73:[2,200],78:[2,200],86:[2,200],91:[2,200],93:[2,200],102:[2,200],103:87,104:[2,200],105:[2,200],106:[2,200],109:88,110:[2,200],111:69,118:[2,200],126:[2,200],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[2,200],137:[1,85]},{1:[2,201],6:[2,201],25:[2,201],26:[2,201],49:[2,201],54:[2,201],57:[2,201],73:[2,201],78:[2,201],86:[2,201],91:[2,201],93:[2,201],102:[2,201],103:87,104:[2,201],105:[2,201],106:[2,201],109:88,110:[2,201],111:69,118:[2,201],126:[2,201],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[2,201],136:[2,201],137:[2,201]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],49:[2,186],54:[2,186],57:[2,186],73:[2,186],78:[2,186],86:[2,186],91:[2,186],93:[2,186],102:[2,186],103:87,104:[1,65],105:[2,186],106:[1,66],109:88,110:[1,68],111:69,118:[2,186],126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],49:[2,185],54:[2,185],57:[2,185],73:[2,185],78:[2,185],86:[2,185],91:[2,185],93:[2,185],102:[2,185],103:87,104:[1,65],105:[2,185],106:[1,66],109:88,110:[1,68],111:69,118:[2,185],126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,104],6:[2,104],25:[2,104],26:[2,104],49:[2,104],54:[2,104],57:[2,104],66:[2,104],67:[2,104],68:[2,104],69:[2,104],71:[2,104],73:[2,104],74:[2,104],78:[2,104],84:[2,104],85:[2,104],86:[2,104],91:[2,104],93:[2,104],102:[2,104],104:[2,104],105:[2,104],106:[2,104],110:[2,104],118:[2,104],126:[2,104],128:[2,104],129:[2,104],132:[2,104],133:[2,104],134:[2,104],135:[2,104],136:[2,104],137:[2,104]},{1:[2,80],6:[2,80],25:[2,80],26:[2,80],40:[2,80],49:[2,80],54:[2,80],57:[2,80],66:[2,80],67:[2,80],68:[2,80],69:[2,80],71:[2,80],73:[2,80],74:[2,80],78:[2,80],80:[2,80],84:[2,80],85:[2,80],86:[2,80],91:[2,80],93:[2,80],102:[2,80],104:[2,80],105:[2,80],106:[2,80],110:[2,80],118:[2,80],126:[2,80],128:[2,80],129:[2,80],130:[2,80],131:[2,80],132:[2,80],133:[2,80],134:[2,80],135:[2,80],136:[2,80],137:[2,80],138:[2,80]},{1:[2,81],6:[2,81],25:[2,81],26:[2,81],40:[2,81],49:[2,81],54:[2,81],57:[2,81],66:[2,81],67:[2,81],68:[2,81],69:[2,81],71:[2,81],73:[2,81],74:[2,81],78:[2,81],80:[2,81],84:[2,81],85:[2,81],86:[2,81],91:[2,81],93:[2,81],102:[2,81],104:[2,81],105:[2,81],106:[2,81],110:[2,81],118:[2,81],126:[2,81],128:[2,81],129:[2,81],130:[2,81],131:[2,81],132:[2,81],133:[2,81],134:[2,81],135:[2,81],136:[2,81],137:[2,81],138:[2,81]},{1:[2,82],6:[2,82],25:[2,82],26:[2,82],40:[2,82],49:[2,82],54:[2,82],57:[2,82],66:[2,82],67:[2,82],68:[2,82],69:[2,82],71:[2,82],73:[2,82],74:[2,82],78:[2,82],80:[2,82],84:[2,82],85:[2,82],86:[2,82],91:[2,82],93:[2,82],102:[2,82],104:[2,82],105:[2,82],106:[2,82],110:[2,82],118:[2,82],126:[2,82],128:[2,82],129:[2,82],130:[2,82],131:[2,82],132:[2,82],133:[2,82],134:[2,82],135:[2,82],136:[2,82],137:[2,82],138:[2,82]},{1:[2,83],6:[2,83],25:[2,83],26:[2,83],40:[2,83],49:[2,83],54:[2,83],57:[2,83],66:[2,83],67:[2,83],68:[2,83],69:[2,83],71:[2,83],73:[2,83],74:[2,83],78:[2,83],80:[2,83],84:[2,83],85:[2,83],86:[2,83],91:[2,83],93:[2,83],102:[2,83],104:[2,83],105:[2,83],106:[2,83],110:[2,83],118:[2,83],126:[2,83],128:[2,83],129:[2,83],130:[2,83],131:[2,83],132:[2,83],133:[2,83],134:[2,83],135:[2,83],136:[2,83],137:[2,83],138:[2,83]},{73:[1,241]},{57:[1,194],73:[2,88],92:242,93:[1,193],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{73:[2,89]},{8:243,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,73:[2,123],76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{12:[2,117],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],73:[2,117],76:[2,117],79:[2,117],83:[2,117],88:[2,117],89:[2,117],90:[2,117],96:[2,117],100:[2,117],101:[2,117],104:[2,117],106:[2,117],108:[2,117],110:[2,117],119:[2,117],125:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117],131:[2,117]},{12:[2,118],28:[2,118],30:[2,118],31:[2,118],33:[2,118],34:[2,118],35:[2,118],36:[2,118],37:[2,118],38:[2,118],45:[2,118],46:[2,118],47:[2,118],51:[2,118],52:[2,118],73:[2,118],76:[2,118],79:[2,118],83:[2,118],88:[2,118],89:[2,118],90:[2,118],96:[2,118],100:[2,118],101:[2,118],104:[2,118],106:[2,118],108:[2,118],110:[2,118],119:[2,118],125:[2,118],127:[2,118],128:[2,118],129:[2,118],130:[2,118],131:[2,118]},{1:[2,87],6:[2,87],25:[2,87],26:[2,87],40:[2,87],49:[2,87],54:[2,87],57:[2,87],66:[2,87],67:[2,87],68:[2,87],69:[2,87],71:[2,87],73:[2,87],74:[2,87],78:[2,87],80:[2,87],84:[2,87],85:[2,87],86:[2,87],91:[2,87],93:[2,87],102:[2,87],104:[2,87],105:[2,87],106:[2,87],110:[2,87],118:[2,87],126:[2,87],128:[2,87],129:[2,87],130:[2,87],131:[2,87],132:[2,87],133:[2,87],134:[2,87],135:[2,87],136:[2,87],137:[2,87],138:[2,87]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],49:[2,105],54:[2,105],57:[2,105],66:[2,105],67:[2,105],68:[2,105],69:[2,105],71:[2,105],73:[2,105],74:[2,105],78:[2,105],84:[2,105],85:[2,105],86:[2,105],91:[2,105],93:[2,105],102:[2,105],104:[2,105],105:[2,105],106:[2,105],110:[2,105],118:[2,105],126:[2,105],128:[2,105],129:[2,105],132:[2,105],133:[2,105],134:[2,105],135:[2,105],136:[2,105],137:[2,105]},{1:[2,36],6:[2,36],25:[2,36],26:[2,36],49:[2,36],54:[2,36],57:[2,36],73:[2,36],78:[2,36],86:[2,36],91:[2,36],93:[2,36],102:[2,36],103:87,104:[2,36],105:[2,36],106:[2,36],109:88,110:[2,36],111:69,118:[2,36],126:[2,36],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{8:244,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:245,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,110],6:[2,110],25:[2,110],26:[2,110],49:[2,110],54:[2,110],57:[2,110],66:[2,110],67:[2,110],68:[2,110],69:[2,110],71:[2,110],73:[2,110],74:[2,110],78:[2,110],84:[2,110],85:[2,110],86:[2,110],91:[2,110],93:[2,110],102:[2,110],104:[2,110],105:[2,110],106:[2,110],110:[2,110],118:[2,110],126:[2,110],128:[2,110],129:[2,110],132:[2,110],133:[2,110],134:[2,110],135:[2,110],136:[2,110],137:[2,110]},{6:[2,53],25:[2,53],53:246,54:[1,229],86:[2,53]},{6:[2,129],25:[2,129],26:[2,129],54:[2,129],57:[1,247],86:[2,129],91:[2,129],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{50:248,51:[1,60],52:[1,61]},{6:[2,54],25:[2,54],26:[2,54],27:110,28:[1,73],44:111,55:249,56:109,58:112,59:113,76:[1,70],89:[1,114],90:[1,115]},{6:[1,250],25:[1,251]},{6:[2,61],25:[2,61],26:[2,61],49:[2,61],54:[2,61]},{8:252,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,202],6:[2,202],25:[2,202],26:[2,202],49:[2,202],54:[2,202],57:[2,202],73:[2,202],78:[2,202],86:[2,202],91:[2,202],93:[2,202],102:[2,202],103:87,104:[2,202],105:[2,202],106:[2,202],109:88,110:[2,202],111:69,118:[2,202],126:[2,202],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{8:253,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:254,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,205],6:[2,205],25:[2,205],26:[2,205],49:[2,205],54:[2,205],57:[2,205],73:[2,205],78:[2,205],86:[2,205],91:[2,205],93:[2,205],102:[2,205],103:87,104:[2,205],105:[2,205],106:[2,205],109:88,110:[2,205],111:69,118:[2,205],126:[2,205],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],49:[2,184],54:[2,184],57:[2,184],73:[2,184],78:[2,184],86:[2,184],91:[2,184],93:[2,184],102:[2,184],104:[2,184],105:[2,184],106:[2,184],110:[2,184],118:[2,184],126:[2,184],128:[2,184],129:[2,184],132:[2,184],133:[2,184],134:[2,184],135:[2,184],136:[2,184],137:[2,184]},{8:255,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,134],6:[2,134],25:[2,134],26:[2,134],49:[2,134],54:[2,134],57:[2,134],73:[2,134],78:[2,134],86:[2,134],91:[2,134],93:[2,134],98:[1,256],102:[2,134],104:[2,134],105:[2,134],106:[2,134],110:[2,134],118:[2,134],126:[2,134],128:[2,134],129:[2,134],132:[2,134],133:[2,134],134:[2,134],135:[2,134],136:[2,134],137:[2,134]},{5:257,25:[1,5]},{5:260,25:[1,5],27:258,28:[1,73],59:259,76:[1,70]},{120:261,122:219,123:[1,220]},{26:[1,262],121:[1,263],122:264,123:[1,220]},{26:[2,177],121:[2,177],123:[2,177]},{8:266,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],95:265,96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,98],5:267,6:[2,98],25:[1,5],26:[2,98],49:[2,98],54:[2,98],57:[2,98],73:[2,98],78:[2,98],86:[2,98],91:[2,98],93:[2,98],102:[2,98],103:87,104:[1,65],105:[2,98],106:[1,66],109:88,110:[1,68],111:69,118:[2,98],126:[2,98],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,101],6:[2,101],25:[2,101],26:[2,101],49:[2,101],54:[2,101],57:[2,101],73:[2,101],78:[2,101],86:[2,101],91:[2,101],93:[2,101],102:[2,101],104:[2,101],105:[2,101],106:[2,101],110:[2,101],118:[2,101],126:[2,101],128:[2,101],129:[2,101],132:[2,101],133:[2,101],134:[2,101],135:[2,101],136:[2,101],137:[2,101]},{8:268,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,141],6:[2,141],25:[2,141],26:[2,141],49:[2,141],54:[2,141],57:[2,141],66:[2,141],67:[2,141],68:[2,141],69:[2,141],71:[2,141],73:[2,141],74:[2,141],78:[2,141],84:[2,141],85:[2,141],86:[2,141],91:[2,141],93:[2,141],102:[2,141],104:[2,141],105:[2,141],106:[2,141],110:[2,141],118:[2,141],126:[2,141],128:[2,141],129:[2,141],132:[2,141],133:[2,141],134:[2,141],135:[2,141],136:[2,141],137:[2,141]},{6:[1,74],26:[1,269]},{8:270,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{6:[2,67],12:[2,118],25:[2,67],28:[2,118],30:[2,118],31:[2,118],33:[2,118],34:[2,118],35:[2,118],36:[2,118],37:[2,118],38:[2,118],45:[2,118],46:[2,118],47:[2,118],51:[2,118],52:[2,118],54:[2,67],76:[2,118],79:[2,118],83:[2,118],88:[2,118],89:[2,118],90:[2,118],91:[2,67],96:[2,118],100:[2,118],101:[2,118],104:[2,118],106:[2,118],108:[2,118],110:[2,118],119:[2,118],125:[2,118],127:[2,118],128:[2,118],129:[2,118],130:[2,118],131:[2,118]},{6:[1,272],25:[1,273],91:[1,271]},{6:[2,54],8:202,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[2,54],26:[2,54],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:148,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],86:[2,54],88:[1,58],89:[1,59],90:[1,57],91:[2,54],94:274,96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{6:[2,53],25:[2,53],26:[2,53],53:275,54:[1,229]},{1:[2,181],6:[2,181],25:[2,181],26:[2,181],49:[2,181],54:[2,181],57:[2,181],73:[2,181],78:[2,181],86:[2,181],91:[2,181],93:[2,181],102:[2,181],104:[2,181],105:[2,181],106:[2,181],110:[2,181],118:[2,181],121:[2,181],126:[2,181],128:[2,181],129:[2,181],132:[2,181],133:[2,181],134:[2,181],135:[2,181],136:[2,181],137:[2,181]},{8:276,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:277,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{116:[2,159],117:[2,159]},{27:159,28:[1,73],44:160,58:161,59:162,76:[1,70],89:[1,114],90:[1,115],115:278},{1:[2,166],6:[2,166],25:[2,166],26:[2,166],49:[2,166],54:[2,166],57:[2,166],73:[2,166],78:[2,166],86:[2,166],91:[2,166],93:[2,166],102:[2,166],103:87,104:[2,166],105:[1,279],106:[2,166],109:88,110:[2,166],111:69,118:[1,280],126:[2,166],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,167],6:[2,167],25:[2,167],26:[2,167],49:[2,167],54:[2,167],57:[2,167],73:[2,167],78:[2,167],86:[2,167],91:[2,167],93:[2,167],102:[2,167],103:87,104:[2,167],105:[1,281],106:[2,167],109:88,110:[2,167],111:69,118:[2,167],126:[2,167],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{6:[1,283],25:[1,284],78:[1,282]},{6:[2,54],11:169,25:[2,54],26:[2,54],27:170,28:[1,73],29:171,30:[1,71],31:[1,72],41:285,42:168,44:172,46:[1,46],78:[2,54],89:[1,114]},{8:286,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,287],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,86],6:[2,86],25:[2,86],26:[2,86],40:[2,86],49:[2,86],54:[2,86],57:[2,86],66:[2,86],67:[2,86],68:[2,86],69:[2,86],71:[2,86],73:[2,86],74:[2,86],78:[2,86],80:[2,86],84:[2,86],85:[2,86],86:[2,86],91:[2,86],93:[2,86],102:[2,86],104:[2,86],105:[2,86],106:[2,86],110:[2,86],118:[2,86],126:[2,86],128:[2,86],129:[2,86],130:[2,86],131:[2,86],132:[2,86],133:[2,86],134:[2,86],135:[2,86],136:[2,86],137:[2,86],138:[2,86]},{8:288,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,73:[2,121],76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{73:[2,122],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,37],6:[2,37],25:[2,37],26:[2,37],49:[2,37],54:[2,37],57:[2,37],73:[2,37],78:[2,37],86:[2,37],91:[2,37],93:[2,37],102:[2,37],103:87,104:[2,37],105:[2,37],106:[2,37],109:88,110:[2,37],111:69,118:[2,37],126:[2,37],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{26:[1,289],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{6:[1,272],25:[1,273],86:[1,290]},{6:[2,67],25:[2,67],26:[2,67],54:[2,67],86:[2,67],91:[2,67]},{5:291,25:[1,5]},{6:[2,57],25:[2,57],26:[2,57],49:[2,57],54:[2,57]},{27:110,28:[1,73],44:111,55:292,56:109,58:112,59:113,76:[1,70],89:[1,114],90:[1,115]},{6:[2,55],25:[2,55],26:[2,55],27:110,28:[1,73],44:111,48:293,54:[2,55],55:108,56:109,58:112,59:113,76:[1,70],89:[1,114],90:[1,115]},{6:[2,62],25:[2,62],26:[2,62],49:[2,62],54:[2,62],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{26:[1,294],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,204],6:[2,204],25:[2,204],26:[2,204],49:[2,204],54:[2,204],57:[2,204],73:[2,204],78:[2,204],86:[2,204],91:[2,204],93:[2,204],102:[2,204],103:87,104:[2,204],105:[2,204],106:[2,204],109:88,110:[2,204],111:69,118:[2,204],126:[2,204],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{5:295,25:[1,5],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{5:296,25:[1,5]},{1:[2,135],6:[2,135],25:[2,135],26:[2,135],49:[2,135],54:[2,135],57:[2,135],73:[2,135],78:[2,135],86:[2,135],91:[2,135],93:[2,135],102:[2,135],104:[2,135],105:[2,135],106:[2,135],110:[2,135],118:[2,135],126:[2,135],128:[2,135],129:[2,135],132:[2,135],133:[2,135],134:[2,135],135:[2,135],136:[2,135],137:[2,135]},{5:297,25:[1,5]},{5:298,25:[1,5]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],49:[2,139],54:[2,139],57:[2,139],73:[2,139],78:[2,139],86:[2,139],91:[2,139],93:[2,139],98:[2,139],102:[2,139],104:[2,139],105:[2,139],106:[2,139],110:[2,139],118:[2,139],126:[2,139],128:[2,139],129:[2,139],132:[2,139],133:[2,139],134:[2,139],135:[2,139],136:[2,139],137:[2,139]},{26:[1,299],121:[1,300],122:264,123:[1,220]},{1:[2,175],6:[2,175],25:[2,175],26:[2,175],49:[2,175],54:[2,175],57:[2,175],73:[2,175],78:[2,175],86:[2,175],91:[2,175],93:[2,175],102:[2,175],104:[2,175],105:[2,175],106:[2,175],110:[2,175],118:[2,175],126:[2,175],128:[2,175],129:[2,175],132:[2,175],133:[2,175],134:[2,175],135:[2,175],136:[2,175],137:[2,175]},{5:301,25:[1,5]},{26:[2,178],121:[2,178],123:[2,178]},{5:302,25:[1,5],54:[1,303]},{25:[2,131],54:[2,131],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,99],6:[2,99],25:[2,99],26:[2,99],49:[2,99],54:[2,99],57:[2,99],73:[2,99],78:[2,99],86:[2,99],91:[2,99],93:[2,99],102:[2,99],104:[2,99],105:[2,99],106:[2,99],110:[2,99],118:[2,99],126:[2,99],128:[2,99],129:[2,99],132:[2,99],133:[2,99],134:[2,99],135:[2,99],136:[2,99],137:[2,99]},{1:[2,102],5:304,6:[2,102],25:[1,5],26:[2,102],49:[2,102],54:[2,102],57:[2,102],73:[2,102],78:[2,102],86:[2,102],91:[2,102],93:[2,102],102:[2,102],103:87,104:[1,65],105:[2,102],106:[1,66],109:88,110:[1,68],111:69,118:[2,102],126:[2,102],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{102:[1,305]},{91:[1,306],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,116],6:[2,116],25:[2,116],26:[2,116],40:[2,116],49:[2,116],54:[2,116],57:[2,116],66:[2,116],67:[2,116],68:[2,116],69:[2,116],71:[2,116],73:[2,116],74:[2,116],78:[2,116],84:[2,116],85:[2,116],86:[2,116],91:[2,116],93:[2,116],102:[2,116],104:[2,116],105:[2,116],106:[2,116],110:[2,116],116:[2,116],117:[2,116],118:[2,116],126:[2,116],128:[2,116],129:[2,116],132:[2,116],133:[2,116],134:[2,116],135:[2,116],136:[2,116],137:[2,116]},{8:202,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:148,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],94:307,96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:202,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,147],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:148,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],87:308,88:[1,58],89:[1,59],90:[1,57],94:146,96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{6:[2,125],25:[2,125],26:[2,125],54:[2,125],86:[2,125],91:[2,125]},{6:[1,272],25:[1,273],26:[1,309]},{1:[2,144],6:[2,144],25:[2,144],26:[2,144],49:[2,144],54:[2,144],57:[2,144],73:[2,144],78:[2,144],86:[2,144],91:[2,144],93:[2,144],102:[2,144],103:87,104:[1,65],105:[2,144],106:[1,66],109:88,110:[1,68],111:69,118:[2,144],126:[2,144],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],49:[2,146],54:[2,146],57:[2,146],73:[2,146],78:[2,146],86:[2,146],91:[2,146],93:[2,146],102:[2,146],103:87,104:[1,65],105:[2,146],106:[1,66],109:88,110:[1,68],111:69,118:[2,146],126:[2,146],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{116:[2,165],117:[2,165]},{8:310,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:311,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:312,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,90],6:[2,90],25:[2,90],26:[2,90],40:[2,90],49:[2,90],54:[2,90],57:[2,90],66:[2,90],67:[2,90],68:[2,90],69:[2,90],71:[2,90],73:[2,90],74:[2,90],78:[2,90],84:[2,90],85:[2,90],86:[2,90],91:[2,90],93:[2,90],102:[2,90],104:[2,90],105:[2,90],106:[2,90],110:[2,90],116:[2,90],117:[2,90],118:[2,90],126:[2,90],128:[2,90],129:[2,90],132:[2,90],133:[2,90],134:[2,90],135:[2,90],136:[2,90],137:[2,90]},{11:169,27:170,28:[1,73],29:171,30:[1,71],31:[1,72],41:313,42:168,44:172,46:[1,46],89:[1,114]},{6:[2,91],11:169,25:[2,91],26:[2,91],27:170,28:[1,73],29:171,30:[1,71],31:[1,72],41:167,42:168,44:172,46:[1,46],54:[2,91],77:314,89:[1,114]},{6:[2,93],25:[2,93],26:[2,93],54:[2,93],78:[2,93]},{6:[2,40],25:[2,40],26:[2,40],54:[2,40],78:[2,40],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{8:315,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{73:[2,120],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,38],6:[2,38],25:[2,38],26:[2,38],49:[2,38],54:[2,38],57:[2,38],73:[2,38],78:[2,38],86:[2,38],91:[2,38],93:[2,38],102:[2,38],104:[2,38],105:[2,38],106:[2,38],110:[2,38],118:[2,38],126:[2,38],128:[2,38],129:[2,38],132:[2,38],133:[2,38],134:[2,38],135:[2,38],136:[2,38],137:[2,38]},{1:[2,111],6:[2,111],25:[2,111],26:[2,111],49:[2,111],54:[2,111],57:[2,111],66:[2,111],67:[2,111],68:[2,111],69:[2,111],71:[2,111],73:[2,111],74:[2,111],78:[2,111],84:[2,111],85:[2,111],86:[2,111],91:[2,111],93:[2,111],102:[2,111],104:[2,111],105:[2,111],106:[2,111],110:[2,111],118:[2,111],126:[2,111],128:[2,111],129:[2,111],132:[2,111],133:[2,111],134:[2,111],135:[2,111],136:[2,111],137:[2,111]},{1:[2,49],6:[2,49],25:[2,49],26:[2,49],49:[2,49],54:[2,49],57:[2,49],73:[2,49],78:[2,49],86:[2,49],91:[2,49],93:[2,49],102:[2,49],104:[2,49],105:[2,49],106:[2,49],110:[2,49],118:[2,49],126:[2,49],128:[2,49],129:[2,49],132:[2,49],133:[2,49],134:[2,49],135:[2,49],136:[2,49],137:[2,49]},{6:[2,58],25:[2,58],26:[2,58],49:[2,58],54:[2,58]},{6:[2,53],25:[2,53],26:[2,53],53:316,54:[1,204]},{1:[2,203],6:[2,203],25:[2,203],26:[2,203],49:[2,203],54:[2,203],57:[2,203],73:[2,203],78:[2,203],86:[2,203],91:[2,203],93:[2,203],102:[2,203],104:[2,203],105:[2,203],106:[2,203],110:[2,203],118:[2,203],126:[2,203],128:[2,203],129:[2,203],132:[2,203],133:[2,203],134:[2,203],135:[2,203],136:[2,203],137:[2,203]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],49:[2,182],54:[2,182],57:[2,182],73:[2,182],78:[2,182],86:[2,182],91:[2,182],93:[2,182],102:[2,182],104:[2,182],105:[2,182],106:[2,182],110:[2,182],118:[2,182],121:[2,182],126:[2,182],128:[2,182],129:[2,182],132:[2,182],133:[2,182],134:[2,182],135:[2,182],136:[2,182],137:[2,182]},{1:[2,136],6:[2,136],25:[2,136],26:[2,136],49:[2,136],54:[2,136],57:[2,136],73:[2,136],78:[2,136],86:[2,136],91:[2,136],93:[2,136],102:[2,136],104:[2,136],105:[2,136],106:[2,136],110:[2,136],118:[2,136],126:[2,136],128:[2,136],129:[2,136],132:[2,136],133:[2,136],134:[2,136],135:[2,136],136:[2,136],137:[2,136]},{1:[2,137],6:[2,137],25:[2,137],26:[2,137],49:[2,137],54:[2,137],57:[2,137],73:[2,137],78:[2,137],86:[2,137],91:[2,137],93:[2,137],98:[2,137],102:[2,137],104:[2,137],105:[2,137],106:[2,137],110:[2,137],118:[2,137],126:[2,137],128:[2,137],129:[2,137],132:[2,137],133:[2,137],134:[2,137],135:[2,137],136:[2,137],137:[2,137]},{1:[2,138],6:[2,138],25:[2,138],26:[2,138],49:[2,138],54:[2,138],57:[2,138],73:[2,138],78:[2,138],86:[2,138],91:[2,138],93:[2,138],98:[2,138],102:[2,138],104:[2,138],105:[2,138],106:[2,138],110:[2,138],118:[2,138],126:[2,138],128:[2,138],129:[2,138],132:[2,138],133:[2,138],134:[2,138],135:[2,138],136:[2,138],137:[2,138]},{1:[2,173],6:[2,173],25:[2,173],26:[2,173],49:[2,173],54:[2,173],57:[2,173],73:[2,173],78:[2,173],86:[2,173],91:[2,173],93:[2,173],102:[2,173],104:[2,173],105:[2,173],106:[2,173],110:[2,173],118:[2,173],126:[2,173],128:[2,173],129:[2,173],132:[2,173],133:[2,173],134:[2,173],135:[2,173],136:[2,173],137:[2,173]},{5:317,25:[1,5]},{26:[1,318]},{6:[1,319],26:[2,179],121:[2,179],123:[2,179]},{8:320,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{1:[2,103],6:[2,103],25:[2,103],26:[2,103],49:[2,103],54:[2,103],57:[2,103],73:[2,103],78:[2,103],86:[2,103],91:[2,103],93:[2,103],102:[2,103],104:[2,103],105:[2,103],106:[2,103],110:[2,103],118:[2,103],126:[2,103],128:[2,103],129:[2,103],132:[2,103],133:[2,103],134:[2,103],135:[2,103],136:[2,103],137:[2,103]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],49:[2,142],54:[2,142],57:[2,142],66:[2,142],67:[2,142],68:[2,142],69:[2,142],71:[2,142],73:[2,142],74:[2,142],78:[2,142],84:[2,142],85:[2,142],86:[2,142],91:[2,142],93:[2,142],102:[2,142],104:[2,142],105:[2,142],106:[2,142],110:[2,142],118:[2,142],126:[2,142],128:[2,142],129:[2,142],132:[2,142],133:[2,142],134:[2,142],135:[2,142],136:[2,142],137:[2,142]},{1:[2,119],6:[2,119],25:[2,119],26:[2,119],49:[2,119],54:[2,119],57:[2,119],66:[2,119],67:[2,119],68:[2,119],69:[2,119],71:[2,119],73:[2,119],74:[2,119],78:[2,119],84:[2,119],85:[2,119],86:[2,119],91:[2,119],93:[2,119],102:[2,119],104:[2,119],105:[2,119],106:[2,119],110:[2,119],118:[2,119],126:[2,119],128:[2,119],129:[2,119],132:[2,119],133:[2,119],134:[2,119],135:[2,119],136:[2,119],137:[2,119]},{6:[2,126],25:[2,126],26:[2,126],54:[2,126],86:[2,126],91:[2,126]},{6:[2,53],25:[2,53],26:[2,53],53:321,54:[1,229]},{6:[2,127],25:[2,127],26:[2,127],54:[2,127],86:[2,127],91:[2,127]},{1:[2,168],6:[2,168],25:[2,168],26:[2,168],49:[2,168],54:[2,168],57:[2,168],73:[2,168],78:[2,168],86:[2,168],91:[2,168],93:[2,168],102:[2,168],103:87,104:[2,168],105:[2,168],106:[2,168],109:88,110:[2,168],111:69,118:[1,322],126:[2,168],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,170],6:[2,170],25:[2,170],26:[2,170],49:[2,170],54:[2,170],57:[2,170],73:[2,170],78:[2,170],86:[2,170],91:[2,170],93:[2,170],102:[2,170],103:87,104:[2,170],105:[1,323],106:[2,170],109:88,110:[2,170],111:69,118:[2,170],126:[2,170],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,169],6:[2,169],25:[2,169],26:[2,169],49:[2,169],54:[2,169],57:[2,169],73:[2,169],78:[2,169],86:[2,169],91:[2,169],93:[2,169],102:[2,169],103:87,104:[2,169],105:[2,169],106:[2,169],109:88,110:[2,169],111:69,118:[2,169],126:[2,169],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{6:[2,94],25:[2,94],26:[2,94],54:[2,94],78:[2,94]},{6:[2,53],25:[2,53],26:[2,53],53:324,54:[1,239]},{26:[1,325],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{6:[1,250],25:[1,251],26:[1,326]},{26:[1,327]},{1:[2,176],6:[2,176],25:[2,176],26:[2,176],49:[2,176],54:[2,176],57:[2,176],73:[2,176],78:[2,176],86:[2,176],91:[2,176],93:[2,176],102:[2,176],104:[2,176],105:[2,176],106:[2,176],110:[2,176],118:[2,176],126:[2,176],128:[2,176],129:[2,176],132:[2,176],133:[2,176],134:[2,176],135:[2,176],136:[2,176],137:[2,176]},{26:[2,180],121:[2,180],123:[2,180]},{25:[2,132],54:[2,132],103:87,104:[1,65],106:[1,66],109:88,110:[1,68],111:69,126:[1,86],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{6:[1,272],25:[1,273],26:[1,328]},{8:329,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{8:330,9:118,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,76:[1,70],79:[1,43],83:[1,28],88:[1,58],89:[1,59],90:[1,57],96:[1,38],100:[1,44],101:[1,56],103:39,104:[1,65],106:[1,66],107:40,108:[1,67],109:41,110:[1,68],111:69,119:[1,42],124:37,125:[1,64],127:[1,31],128:[1,32],129:[1,33],130:[1,34],131:[1,35]},{6:[1,283],25:[1,284],26:[1,331]},{6:[2,41],25:[2,41],26:[2,41],54:[2,41],78:[2,41]},{6:[2,59],25:[2,59],26:[2,59],49:[2,59],54:[2,59]},{1:[2,174],6:[2,174],25:[2,174],26:[2,174],49:[2,174],54:[2,174],57:[2,174],73:[2,174],78:[2,174],86:[2,174],91:[2,174],93:[2,174],102:[2,174],104:[2,174],105:[2,174],106:[2,174],110:[2,174],118:[2,174],126:[2,174],128:[2,174],129:[2,174],132:[2,174],133:[2,174],134:[2,174],135:[2,174],136:[2,174],137:[2,174]},{6:[2,128],25:[2,128],26:[2,128],54:[2,128],86:[2,128],91:[2,128]},{1:[2,171],6:[2,171],25:[2,171],26:[2,171],49:[2,171],54:[2,171],57:[2,171],73:[2,171],78:[2,171],86:[2,171],91:[2,171],93:[2,171],102:[2,171],103:87,104:[2,171],105:[2,171],106:[2,171],109:88,110:[2,171],111:69,118:[2,171],126:[2,171],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{1:[2,172],6:[2,172],25:[2,172],26:[2,172],49:[2,172],54:[2,172],57:[2,172],73:[2,172],78:[2,172],86:[2,172],91:[2,172],93:[2,172],102:[2,172],103:87,104:[2,172],105:[2,172],106:[2,172],109:88,110:[2,172],111:69,118:[2,172],126:[2,172],128:[1,80],129:[1,79],132:[1,78],133:[1,81],134:[1,82],135:[1,83],136:[1,84],137:[1,85]},{6:[2,95],25:[2,95],26:[2,95],54:[2,95],78:[2,95]}],
4131 defaultActions: {60:[2,51],61:[2,52],75:[2,3],94:[2,109],191:[2,89]},
4132 parseError: function parseError(str, hash) {
4133 var e = new Error(str)
4134 e.location = hash.loc
4135 throw e;
4136 },
4137 parse: function parse(input) {
4138 var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
4139 this.lexer.setInput(input);
4140 this.lexer.yy = this.yy;
4141 this.yy.lexer = this.lexer;
4142 this.yy.parser = this;
4143 if (typeof this.lexer.yylloc == "undefined")
4144 this.lexer.yylloc = {};
4145 var yyloc = this.lexer.yylloc;
4146 lstack.push(yyloc);
4147 var ranges = this.lexer.options && this.lexer.options.ranges;
4148 if (typeof this.yy.parseError === "function")
4149 this.parseError = this.yy.parseError;
4150 function popStack(n) {
4151 stack.length = stack.length - 2 * n;
4152 vstack.length = vstack.length - n;
4153 lstack.length = lstack.length - n;
4154 }
4155 function lex() {
4156 var token;
4157 token = self.lexer.lex() || 1;
4158 if (typeof token !== "number") {
4159 token = self.symbols_[token] || token;
4160 }
4161 return token;
4162 }
4163 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
4164 while (true) {
4165 state = stack[stack.length - 1];
4166 if (this.defaultActions[state]) {
4167 action = this.defaultActions[state];
4168 } else {
4169 if (symbol === null || typeof symbol == "undefined") {
4170 symbol = lex();
4171 }
4172 action = table[state] && table[state][symbol];
4173 }
4174 if (typeof action === "undefined" || !action.length || !action[0]) {
4175 var errStr = "";
4176 if (!recovering) {
4177 expected = [];
4178 for (p in table[state])
4179 if (this.terminals_[p] && p > 2) {
4180 expected.push("'" + this.terminals_[p] + "'");
4181 }
4182 if (this.lexer.showPosition) {
4183 errStr = this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
4184 } else {
4185 errStr = "Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
4186 }
4187 this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
4188 }
4189 }
4190 if (action[0] instanceof Array && action.length > 1) {
4191 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
4192 }
4193 switch (action[0]) {
4194 case 1:
4195 stack.push(symbol);
4196 vstack.push(this.lexer.yytext);
4197 lstack.push(this.lexer.yylloc);
4198 stack.push(action[1]);
4199 symbol = null;
4200 if (!preErrorSymbol) {
4201 yyleng = this.lexer.yyleng;
4202 yytext = this.lexer.yytext;
4203 yylineno = this.lexer.yylineno;
4204 yyloc = this.lexer.yylloc;
4205 if (recovering > 0)
4206 recovering--;
4207 } else {
4208 symbol = preErrorSymbol;
4209 preErrorSymbol = null;
4210 }
4211 break;
4212 case 2:
4213 len = this.productions_[action[1]][1];
4214 yyval.$ = vstack[vstack.length - len];
4215 yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
4216 if (ranges) {
4217 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
4218 }
4219 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
4220 if (typeof r !== "undefined") {
4221 return r;
4222 }
4223 if (len) {
4224 stack = stack.slice(0, -1 * len * 2);
4225 vstack = vstack.slice(0, -1 * len);
4226 lstack = lstack.slice(0, -1 * len);
4227 }
4228 stack.push(this.productions_[action[1]][0]);
4229 vstack.push(yyval.$);
4230 lstack.push(yyval._$);
4231 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
4232 stack.push(newState);
4233 break;
4234 case 3:
4235 return true;
4236 }
4237 }
4238 return true;
4239 }
4240 };
4241 undefined
4242 function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
4243
4244 module.exports = new Parser;
4245
4246
4247 });
4248
4249 define('ace/mode/coffee/nodes', ['require', 'exports', 'module' , 'ace/mode/coffee/scope', 'ace/mode/coffee/lexer', 'ace/mode/coffee/helpers'], function(require, exports, module) {
4250
4251 var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, CodeFragment, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, last, locationDataToString, merge, multident, some, starts, throwSyntaxError, unfoldSoak, utility, _ref, _ref1, _ref2, _ref3,
4252 __hasProp = {}.hasOwnProperty,
4253 __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
4254 __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
4255 __slice = [].slice;
4256
4257 Error.stackTraceLimit = Infinity;
4258
4259 Scope = require('./scope').Scope;
4260
4261 _ref = require('./lexer'), RESERVED = _ref.RESERVED, STRICT_PROSCRIBED = _ref.STRICT_PROSCRIBED;
4262
4263 _ref1 = require('./helpers'), compact = _ref1.compact, flatten = _ref1.flatten, extend = _ref1.extend, merge = _ref1.merge, del = _ref1.del, starts = _ref1.starts, ends = _ref1.ends, last = _ref1.last, some = _ref1.some, addLocationDataFn = _ref1.addLocationDataFn, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError;
4264
4265 exports.extend = extend;
4266
4267 exports.addLocationDataFn = addLocationDataFn;
4268
4269 YES = function() {
4270 return true;
4271 };
4272
4273 NO = function() {
4274 return false;
4275 };
4276
4277 THIS = function() {
4278 return this;
4279 };
4280
4281 NEGATE = function() {
4282 this.negated = !this.negated;
4283 return this;
4284 };
4285
4286 exports.CodeFragment = CodeFragment = (function() {
4287 function CodeFragment(parent, code) {
4288 var _ref2;
4289 this.code = "" + code;
4290 this.locationData = parent != null ? parent.locationData : void 0;
4291 this.type = (parent != null ? (_ref2 = parent.constructor) != null ? _ref2.name : void 0 : void 0) || 'unknown';
4292 }
4293
4294 CodeFragment.prototype.toString = function() {
4295 return "" + this.code + [this.locationData ? ": " + locationDataToString(this.locationData) : void 0];
4296 };
4297
4298 return CodeFragment;
4299
4300 })();
4301
4302 fragmentsToText = function(fragments) {
4303 var fragment;
4304 return ((function() {
4305 var _i, _len, _results;
4306 _results = [];
4307 for (_i = 0, _len = fragments.length; _i < _len; _i++) {
4308 fragment = fragments[_i];
4309 _results.push(fragment.code);
4310 }
4311 return _results;
4312 })()).join('');
4313 };
4314
4315 exports.Base = Base = (function() {
4316 function Base() {}
4317
4318 Base.prototype.compile = function(o, lvl) {
4319 return fragmentsToText(this.compileToFragments(o, lvl));
4320 };
4321
4322 Base.prototype.compileToFragments = function(o, lvl) {
4323 var node;
4324 o = extend({}, o);
4325 if (lvl) {
4326 o.level = lvl;
4327 }
4328 node = this.unfoldSoak(o) || this;
4329 node.tab = o.indent;
4330 if (o.level === LEVEL_TOP || !node.isStatement(o)) {
4331 return node.compileNode(o);
4332 } else {
4333 return node.compileClosure(o);
4334 }
4335 };
4336
4337 Base.prototype.compileClosure = function(o) {
4338 var jumpNode;
4339 if (jumpNode = this.jumps()) {
4340 jumpNode.error('cannot use a pure statement in an expression');
4341 }
4342 o.sharedScope = true;
4343 return Closure.wrap(this).compileNode(o);
4344 };
4345
4346 Base.prototype.cache = function(o, level, reused) {
4347 var ref, sub;
4348 if (!this.isComplex()) {
4349 ref = level ? this.compileToFragments(o, level) : this;
4350 return [ref, ref];
4351 } else {
4352 ref = new Literal(reused || o.scope.freeVariable('ref'));
4353 sub = new Assign(ref, this);
4354 if (level) {
4355 return [sub.compileToFragments(o, level), [this.makeCode(ref.value)]];
4356 } else {
4357 return [sub, ref];
4358 }
4359 }
4360 };
4361
4362 Base.prototype.cacheToCodeFragments = function(cacheValues) {
4363 return [fragmentsToText(cacheValues[0]), fragmentsToText(cacheValues[1])];
4364 };
4365
4366 Base.prototype.makeReturn = function(res) {
4367 var me;
4368 me = this.unwrapAll();
4369 if (res) {
4370 return new Call(new Literal("" + res + ".push"), [me]);
4371 } else {
4372 return new Return(me);
4373 }
4374 };
4375
4376 Base.prototype.contains = function(pred) {
4377 var node;
4378 node = void 0;
4379 this.traverseChildren(false, function(n) {
4380 if (pred(n)) {
4381 node = n;
4382 return false;
4383 }
4384 });
4385 return node;
4386 };
4387
4388 Base.prototype.lastNonComment = function(list) {
4389 var i;
4390 i = list.length;
4391 while (i--) {
4392 if (!(list[i] instanceof Comment)) {
4393 return list[i];
4394 }
4395 }
4396 return null;
4397 };
4398
4399 Base.prototype.toString = function(idt, name) {
4400 var tree;
4401 if (idt == null) {
4402 idt = '';
4403 }
4404 if (name == null) {
4405 name = this.constructor.name;
4406 }
4407 tree = '\n' + idt + name;
4408 if (this.soak) {
4409 tree += '?';
4410 }
4411 this.eachChild(function(node) {
4412 return tree += node.toString(idt + TAB);
4413 });
4414 return tree;
4415 };
4416
4417 Base.prototype.eachChild = function(func) {
4418 var attr, child, _i, _j, _len, _len1, _ref2, _ref3;
4419 if (!this.children) {
4420 return this;
4421 }
4422 _ref2 = this.children;
4423 for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
4424 attr = _ref2[_i];
4425 if (this[attr]) {
4426 _ref3 = flatten([this[attr]]);
4427 for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
4428 child = _ref3[_j];
4429 if (func(child) === false) {
4430 return this;
4431 }
4432 }
4433 }
4434 }
4435 return this;
4436 };
4437
4438 Base.prototype.traverseChildren = function(crossScope, func) {
4439 return this.eachChild(function(child) {
4440 var recur;
4441 recur = func(child);
4442 if (recur !== false) {
4443 return child.traverseChildren(crossScope, func);
4444 }
4445 });
4446 };
4447
4448 Base.prototype.invert = function() {
4449 return new Op('!', this);
4450 };
4451
4452 Base.prototype.unwrapAll = function() {
4453 var node;
4454 node = this;
4455 while (node !== (node = node.unwrap())) {
4456 continue;
4457 }
4458 return node;
4459 };
4460
4461 Base.prototype.children = [];
4462
4463 Base.prototype.isStatement = NO;
4464
4465 Base.prototype.jumps = NO;
4466
4467 Base.prototype.isComplex = YES;
4468
4469 Base.prototype.isChainable = NO;
4470
4471 Base.prototype.isAssignable = NO;
4472
4473 Base.prototype.unwrap = THIS;
4474
4475 Base.prototype.unfoldSoak = NO;
4476
4477 Base.prototype.assigns = NO;
4478
4479 Base.prototype.updateLocationDataIfMissing = function(locationData) {
4480 this.locationData || (this.locationData = locationData);
4481 return this.eachChild(function(child) {
4482 return child.updateLocationDataIfMissing(locationData);
4483 });
4484 };
4485
4486 Base.prototype.error = function(message) {
4487 return throwSyntaxError(message, this.locationData);
4488 };
4489
4490 Base.prototype.makeCode = function(code) {
4491 return new CodeFragment(this, code);
4492 };
4493
4494 Base.prototype.wrapInBraces = function(fragments) {
4495 return [].concat(this.makeCode('('), fragments, this.makeCode(')'));
4496 };
4497
4498 Base.prototype.joinFragmentArrays = function(fragmentsList, joinStr) {
4499 var answer, fragments, i, _i, _len;
4500 answer = [];
4501 for (i = _i = 0, _len = fragmentsList.length; _i < _len; i = ++_i) {
4502 fragments = fragmentsList[i];
4503 if (i) {
4504 answer.push(this.makeCode(joinStr));
4505 }
4506 answer = answer.concat(fragments);
4507 }
4508 return answer;
4509 };
4510
4511 return Base;
4512
4513 })();
4514
4515 exports.Block = Block = (function(_super) {
4516 __extends(Block, _super);
4517
4518 function Block(nodes) {
4519 this.expressions = compact(flatten(nodes || []));
4520 }
4521
4522 Block.prototype.children = ['expressions'];
4523
4524 Block.prototype.push = function(node) {
4525 this.expressions.push(node);
4526 return this;
4527 };
4528
4529 Block.prototype.pop = function() {
4530 return this.expressions.pop();
4531 };
4532
4533 Block.prototype.unshift = function(node) {
4534 this.expressions.unshift(node);
4535 return this;
4536 };
4537
4538 Block.prototype.unwrap = function() {
4539 if (this.expressions.length === 1) {
4540 return this.expressions[0];
4541 } else {
4542 return this;
4543 }
4544 };
4545
4546 Block.prototype.isEmpty = function() {
4547 return !this.expressions.length;
4548 };
4549
4550 Block.prototype.isStatement = function(o) {
4551 var exp, _i, _len, _ref2;
4552 _ref2 = this.expressions;
4553 for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
4554 exp = _ref2[_i];
4555 if (exp.isStatement(o)) {
4556 return true;
4557 }
4558 }
4559 return false;
4560 };
4561
4562 Block.prototype.jumps = function(o) {
4563 var exp, _i, _len, _ref2;
4564 _ref2 = this.expressions;
4565 for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
4566 exp = _ref2[_i];
4567 if (exp.jumps(o)) {
4568 return exp;
4569 }
4570 }
4571 };
4572
4573 Block.prototype.makeReturn = function(res) {
4574 var expr, len;
4575 len = this.expressions.length;
4576 while (len--) {
4577 expr = this.expressions[len];
4578 if (!(expr instanceof Comment)) {
4579 this.expressions[len] = expr.makeReturn(res);
4580 if (expr instanceof Return && !expr.expression) {
4581 this.expressions.splice(len, 1);
4582 }
4583 break;
4584 }
4585 }
4586 return this;
4587 };
4588
4589 Block.prototype.compileToFragments = function(o, level) {
4590 if (o == null) {
4591 o = {};
4592 }
4593 if (o.scope) {
4594 return Block.__super__.compileToFragments.call(this, o, level);
4595 } else {
4596 return this.compileRoot(o);
4597 }
4598 };
4599
4600 Block.prototype.compileNode = function(o) {
4601 var answer, compiledNodes, fragments, index, node, top, _i, _len, _ref2;
4602 this.tab = o.indent;
4603 top = o.level === LEVEL_TOP;
4604 compiledNodes = [];
4605 _ref2 = this.expressions;
4606 for (index = _i = 0, _len = _ref2.length; _i < _len; index = ++_i) {
4607 node = _ref2[index];
4608 node = node.unwrapAll();
4609 node = node.unfoldSoak(o) || node;
4610 if (node instanceof Block) {
4611 compiledNodes.push(node.compileNode(o));
4612 } else if (top) {
4613 node.front = true;
4614 fragments = node.compileToFragments(o);
4615 if (!node.isStatement(o)) {
4616 fragments.unshift(this.makeCode("" + this.tab));
4617 fragments.push(this.makeCode(";"));
4618 }
4619 compiledNodes.push(fragments);
4620 } else {
4621 compiledNodes.push(node.compileToFragments(o, LEVEL_LIST));
4622 }
4623 }
4624 if (top) {
4625 if (this.spaced) {
4626 return [].concat(this.joinFragmentArrays(compiledNodes, '\n\n'), this.makeCode("\n"));
4627 } else {
4628 return this.joinFragmentArrays(compiledNodes, '\n');
4629 }
4630 }
4631 if (compiledNodes.length) {
4632 answer = this.joinFragmentArrays(compiledNodes, ', ');
4633 } else {
4634 answer = [this.makeCode("void 0")];
4635 }
4636 if (compiledNodes.length > 1 && o.level >= LEVEL_LIST) {
4637 return this.wrapInBraces(answer);
4638 } else {
4639 return answer;
4640 }
4641 };
4642
4643 Block.prototype.compileRoot = function(o) {
4644 var exp, fragments, i, name, prelude, preludeExps, rest, _i, _len, _ref2;
4645 o.indent = o.bare ? '' : TAB;
4646 o.level = LEVEL_TOP;
4647 this.spaced = true;
4648 o.scope = new Scope(null, this, null);
4649 _ref2 = o.locals || [];
4650 for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
4651 name = _ref2[_i];
4652 o.scope.parameter(name);
4653 }
4654 prelude = [];
4655 if (!o.bare) {
4656 preludeExps = (function() {
4657 var _j, _len1, _ref3, _results;
4658 _ref3 = this.expressions;
4659 _results = [];
4660 for (i = _j = 0, _len1 = _ref3.length; _j < _len1; i = ++_j) {
4661 exp = _ref3[i];
4662 if (!(exp.unwrap() instanceof Comment)) {
4663 break;
4664 }
4665 _results.push(exp);
4666 }
4667 return _results;
4668 }).call(this);
4669 rest = this.expressions.slice(preludeExps.length);
4670 this.expressions = preludeExps;
4671 if (preludeExps.length) {
4672 prelude = this.compileNode(merge(o, {
4673 indent: ''
4674 }));
4675 prelude.push(this.makeCode("\n"));
4676 }
4677 this.expressions = rest;
4678 }
4679 fragments = this.compileWithDeclarations(o);
4680 if (o.bare) {
4681 return fragments;
4682 }
4683 return [].concat(prelude, this.makeCode("(function() {\n"), fragments, this.makeCode("\n}).call(this);\n"));
4684 };
4685
4686 Block.prototype.compileWithDeclarations = function(o) {
4687 var assigns, declars, exp, fragments, i, post, rest, scope, spaced, _i, _len, _ref2, _ref3, _ref4;
4688 fragments = [];
4689 post = [];
4690 _ref2 = this.expressions;
4691 for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) {
4692 exp = _ref2[i];
4693 exp = exp.unwrap();
4694 if (!(exp instanceof Comment || exp instanceof Literal)) {
4695 break;
4696 }
4697 }
4698 o = merge(o, {
4699 level: LEVEL_TOP
4700 });
4701 if (i) {
4702 rest = this.expressions.splice(i, 9e9);
4703 _ref3 = [this.spaced, false], spaced = _ref3[0], this.spaced = _ref3[1];
4704 _ref4 = [this.compileNode(o), spaced], fragments = _ref4[0], this.spaced = _ref4[1];
4705 this.expressions = rest;
4706 }
4707 post = this.compileNode(o);
4708 scope = o.scope;
4709 if (scope.expressions === this) {
4710 declars = o.scope.hasDeclarations();
4711 assigns = scope.hasAssignments;
4712 if (declars || assigns) {
4713 if (i) {
4714 fragments.push(this.makeCode('\n'));
4715 }
4716 fragments.push(this.makeCode("" + this.tab + "var "));
4717 if (declars) {
4718 fragments.push(this.makeCode(scope.declaredVariables().join(', ')));
4719 }
4720 if (assigns) {
4721 if (declars) {
4722 fragments.push(this.makeCode(",\n" + (this.tab + TAB)));
4723 }
4724 fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB))));
4725 }
4726 fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : '')));
4727 }
4728 }
4729 return fragments.concat(post);
4730 };
4731
4732 Block.wrap = function(nodes) {
4733 if (nodes.length === 1 && nodes[0] instanceof Block) {
4734 return nodes[0];
4735 }
4736 return new Block(nodes);
4737 };
4738
4739 return Block;
4740
4741 })(Base);
4742
4743 exports.Literal = Literal = (function(_super) {
4744 __extends(Literal, _super);
4745
4746 function Literal(value) {
4747 this.value = value;
4748 }
4749
4750 Literal.prototype.makeReturn = function() {
4751 if (this.isStatement()) {
4752 return this;
4753 } else {
4754 return Literal.__super__.makeReturn.apply(this, arguments);
4755 }
4756 };
4757
4758 Literal.prototype.isAssignable = function() {
4759 return IDENTIFIER.test(this.value);
4760 };
4761
4762 Literal.prototype.isStatement = function() {
4763 var _ref2;
4764 return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger';
4765 };
4766
4767 Literal.prototype.isComplex = NO;
4768
4769 Literal.prototype.assigns = function(name) {
4770 return name === this.value;
4771 };
4772
4773 Literal.prototype.jumps = function(o) {
4774 if (this.value === 'break' && !((o != null ? o.loop : void 0) || (o != null ? o.block : void 0))) {
4775 return this;
4776 }
4777 if (this.value === 'continue' && !(o != null ? o.loop : void 0)) {
4778 return this;
4779 }
4780 };
4781
4782 Literal.prototype.compileNode = function(o) {
4783 var answer, code, _ref2;
4784 code = this.value === 'this' ? ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved ? "\"" + this.value + "\"" : this.value;
4785 answer = this.isStatement() ? "" + this.tab + code + ";" : code;
4786 return [this.makeCode(answer)];
4787 };
4788
4789 Literal.prototype.toString = function() {
4790 return ' "' + this.value + '"';
4791 };
4792
4793 return Literal;
4794
4795 })(Base);
4796
4797 exports.Undefined = (function(_super) {
4798 __extends(Undefined, _super);
4799
4800 function Undefined() {
4801 _ref2 = Undefined.__super__.constructor.apply(this, arguments);
4802 return _ref2;
4803 }
4804
4805 Undefined.prototype.isAssignable = NO;
4806
4807 Undefined.prototype.isComplex = NO;
4808
4809 Undefined.prototype.compileNode = function(o) {
4810 return [this.makeCode(o.level >= LEVEL_ACCESS ? '(void 0)' : 'void 0')];
4811 };
4812
4813 return Undefined;
4814
4815 })(Base);
4816
4817 exports.Null = (function(_super) {
4818 __extends(Null, _super);
4819
4820 function Null() {
4821 _ref3 = Null.__super__.constructor.apply(this, arguments);
4822 return _ref3;
4823 }
4824
4825 Null.prototype.isAssignable = NO;
4826
4827 Null.prototype.isComplex = NO;
4828
4829 Null.prototype.compileNode = function() {
4830 return [this.makeCode("null")];
4831 };
4832
4833 return Null;
4834
4835 })(Base);
4836
4837 exports.Bool = (function(_super) {
4838 __extends(Bool, _super);
4839
4840 Bool.prototype.isAssignable = NO;
4841
4842 Bool.prototype.isComplex = NO;
4843
4844 Bool.prototype.compileNode = function() {
4845 return [this.makeCode(this.val)];
4846 };
4847
4848 function Bool(val) {
4849 this.val = val;
4850 }
4851
4852 return Bool;
4853
4854 })(Base);
4855
4856 exports.Return = Return = (function(_super) {
4857 __extends(Return, _super);
4858
4859 function Return(expr) {
4860 if (expr && !expr.unwrap().isUndefined) {
4861 this.expression = expr;
4862 }
4863 }
4864
4865 Return.prototype.children = ['expression'];
4866
4867 Return.prototype.isStatement = YES;
4868
4869 Return.prototype.makeReturn = THIS;
4870
4871 Return.prototype.jumps = THIS;
4872
4873 Return.prototype.compileToFragments = function(o, level) {
4874 var expr, _ref4;
4875 expr = (_ref4 = this.expression) != null ? _ref4.makeReturn() : void 0;
4876 if (expr && !(expr instanceof Return)) {
4877 return expr.compileToFragments(o, level);
4878 } else {
4879 return Return.__super__.compileToFragments.call(this, o, level);
4880 }
4881 };
4882
4883 Return.prototype.compileNode = function(o) {
4884 var answer;
4885 answer = [];
4886 answer.push(this.makeCode(this.tab + ("return" + [this.expression ? " " : void 0])));
4887 if (this.expression) {
4888 answer = answer.concat(this.expression.compileToFragments(o, LEVEL_PAREN));
4889 }
4890 answer.push(this.makeCode(";"));
4891 return answer;
4892 };
4893
4894 return Return;
4895
4896 })(Base);
4897
4898 exports.Value = Value = (function(_super) {
4899 __extends(Value, _super);
4900
4901 function Value(base, props, tag) {
4902 if (!props && base instanceof Value) {
4903 return base;
4904 }
4905 this.base = base;
4906 this.properties = props || [];
4907 if (tag) {
4908 this[tag] = true;
4909 }
4910 return this;
4911 }
4912
4913 Value.prototype.children = ['base', 'properties'];
4914
4915 Value.prototype.add = function(props) {
4916 this.properties = this.properties.concat(props);
4917 return this;
4918 };
4919
4920 Value.prototype.hasProperties = function() {
4921 return !!this.properties.length;
4922 };
4923
4924 Value.prototype.isArray = function() {
4925 return !this.properties.length && this.base instanceof Arr;
4926 };
4927
4928 Value.prototype.isComplex = function() {
4929 return this.hasProperties() || this.base.isComplex();
4930 };
4931
4932 Value.prototype.isAssignable = function() {
4933 return this.hasProperties() || this.base.isAssignable();
4934 };
4935
4936 Value.prototype.isSimpleNumber = function() {
4937 return this.base instanceof Literal && SIMPLENUM.test(this.base.value);
4938 };
4939
4940 Value.prototype.isString = function() {
4941 return this.base instanceof Literal && IS_STRING.test(this.base.value);
4942 };
4943
4944 Value.prototype.isAtomic = function() {
4945 var node, _i, _len, _ref4;
4946 _ref4 = this.properties.concat(this.base);
4947 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
4948 node = _ref4[_i];
4949 if (node.soak || node instanceof Call) {
4950 return false;
4951 }
4952 }
4953 return true;
4954 };
4955
4956 Value.prototype.isStatement = function(o) {
4957 return !this.properties.length && this.base.isStatement(o);
4958 };
4959
4960 Value.prototype.assigns = function(name) {
4961 return !this.properties.length && this.base.assigns(name);
4962 };
4963
4964 Value.prototype.jumps = function(o) {
4965 return !this.properties.length && this.base.jumps(o);
4966 };
4967
4968 Value.prototype.isObject = function(onlyGenerated) {
4969 if (this.properties.length) {
4970 return false;
4971 }
4972 return (this.base instanceof Obj) && (!onlyGenerated || this.base.generated);
4973 };
4974
4975 Value.prototype.isSplice = function() {
4976 return last(this.properties) instanceof Slice;
4977 };
4978
4979 Value.prototype.unwrap = function() {
4980 if (this.properties.length) {
4981 return this;
4982 } else {
4983 return this.base;
4984 }
4985 };
4986
4987 Value.prototype.cacheReference = function(o) {
4988 var base, bref, name, nref;
4989 name = last(this.properties);
4990 if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) {
4991 return [this, this];
4992 }
4993 base = new Value(this.base, this.properties.slice(0, -1));
4994 if (base.isComplex()) {
4995 bref = new Literal(o.scope.freeVariable('base'));
4996 base = new Value(new Parens(new Assign(bref, base)));
4997 }
4998 if (!name) {
4999 return [base, bref];
5000 }
5001 if (name.isComplex()) {
5002 nref = new Literal(o.scope.freeVariable('name'));
5003 name = new Index(new Assign(nref, name.index));
5004 nref = new Index(nref);
5005 }
5006 return [base.add(name), new Value(bref || base.base, [nref || name])];
5007 };
5008
5009 Value.prototype.compileNode = function(o) {
5010 var fragments, prop, props, _i, _len;
5011 this.base.front = this.front;
5012 props = this.properties;
5013 fragments = this.base.compileToFragments(o, (props.length ? LEVEL_ACCESS : null));
5014 if ((this.base instanceof Parens || props.length) && SIMPLENUM.test(fragmentsToText(fragments))) {
5015 fragments.push(this.makeCode('.'));
5016 }
5017 for (_i = 0, _len = props.length; _i < _len; _i++) {
5018 prop = props[_i];
5019 fragments.push.apply(fragments, prop.compileToFragments(o));
5020 }
5021 return fragments;
5022 };
5023
5024 Value.prototype.unfoldSoak = function(o) {
5025 var _ref4,
5026 _this = this;
5027 return (_ref4 = this.unfoldedSoak) != null ? _ref4 : this.unfoldedSoak = (function() {
5028 var fst, i, ifn, prop, ref, snd, _i, _len, _ref5, _ref6;
5029 if (ifn = _this.base.unfoldSoak(o)) {
5030 (_ref5 = ifn.body.properties).push.apply(_ref5, _this.properties);
5031 return ifn;
5032 }
5033 _ref6 = _this.properties;
5034 for (i = _i = 0, _len = _ref6.length; _i < _len; i = ++_i) {
5035 prop = _ref6[i];
5036 if (!prop.soak) {
5037 continue;
5038 }
5039 prop.soak = false;
5040 fst = new Value(_this.base, _this.properties.slice(0, i));
5041 snd = new Value(_this.base, _this.properties.slice(i));
5042 if (fst.isComplex()) {
5043 ref = new Literal(o.scope.freeVariable('ref'));
5044 fst = new Parens(new Assign(ref, fst));
5045 snd.base = ref;
5046 }
5047 return new If(new Existence(fst), snd, {
5048 soak: true
5049 });
5050 }
5051 return false;
5052 })();
5053 };
5054
5055 return Value;
5056
5057 })(Base);
5058
5059 exports.Comment = Comment = (function(_super) {
5060 __extends(Comment, _super);
5061
5062 function Comment(comment) {
5063 this.comment = comment;
5064 }
5065
5066 Comment.prototype.isStatement = YES;
5067
5068 Comment.prototype.makeReturn = THIS;
5069
5070 Comment.prototype.compileNode = function(o, level) {
5071 var code;
5072 code = "/*" + (multident(this.comment, this.tab)) + (__indexOf.call(this.comment, '\n') >= 0 ? "\n" + this.tab : '') + "*/\n";
5073 if ((level || o.level) === LEVEL_TOP) {
5074 code = o.indent + code;
5075 }
5076 return [this.makeCode(code)];
5077 };
5078
5079 return Comment;
5080
5081 })(Base);
5082
5083 exports.Call = Call = (function(_super) {
5084 __extends(Call, _super);
5085
5086 function Call(variable, args, soak) {
5087 this.args = args != null ? args : [];
5088 this.soak = soak;
5089 this.isNew = false;
5090 this.isSuper = variable === 'super';
5091 this.variable = this.isSuper ? null : variable;
5092 }
5093
5094 Call.prototype.children = ['variable', 'args'];
5095
5096 Call.prototype.newInstance = function() {
5097 var base, _ref4;
5098 base = ((_ref4 = this.variable) != null ? _ref4.base : void 0) || this.variable;
5099 if (base instanceof Call && !base.isNew) {
5100 base.newInstance();
5101 } else {
5102 this.isNew = true;
5103 }
5104 return this;
5105 };
5106
5107 Call.prototype.superReference = function(o) {
5108 var accesses, method;
5109 method = o.scope.namedMethod();
5110 if (method != null ? method.klass : void 0) {
5111 accesses = [new Access(new Literal('__super__'))];
5112 if (method["static"]) {
5113 accesses.push(new Access(new Literal('constructor')));
5114 }
5115 accesses.push(new Access(new Literal(method.name)));
5116 return (new Value(new Literal(method.klass), accesses)).compile(o);
5117 } else if (method != null ? method.ctor : void 0) {
5118 return "" + method.name + ".__super__.constructor";
5119 } else {
5120 return this.error('cannot call super outside of an instance method.');
5121 }
5122 };
5123
5124 Call.prototype.superThis = function(o) {
5125 var method;
5126 method = o.scope.method;
5127 return (method && !method.klass && method.context) || "this";
5128 };
5129
5130 Call.prototype.unfoldSoak = function(o) {
5131 var call, ifn, left, list, rite, _i, _len, _ref4, _ref5;
5132 if (this.soak) {
5133 if (this.variable) {
5134 if (ifn = unfoldSoak(o, this, 'variable')) {
5135 return ifn;
5136 }
5137 _ref4 = new Value(this.variable).cacheReference(o), left = _ref4[0], rite = _ref4[1];
5138 } else {
5139 left = new Literal(this.superReference(o));
5140 rite = new Value(left);
5141 }
5142 rite = new Call(rite, this.args);
5143 rite.isNew = this.isNew;
5144 left = new Literal("typeof " + (left.compile(o)) + " === \"function\"");
5145 return new If(left, new Value(rite), {
5146 soak: true
5147 });
5148 }
5149 call = this;
5150 list = [];
5151 while (true) {
5152 if (call.variable instanceof Call) {
5153 list.push(call);
5154 call = call.variable;
5155 continue;
5156 }
5157 if (!(call.variable instanceof Value)) {
5158 break;
5159 }
5160 list.push(call);
5161 if (!((call = call.variable.base) instanceof Call)) {
5162 break;
5163 }
5164 }
5165 _ref5 = list.reverse();
5166 for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
5167 call = _ref5[_i];
5168 if (ifn) {
5169 if (call.variable instanceof Call) {
5170 call.variable = ifn;
5171 } else {
5172 call.variable.base = ifn;
5173 }
5174 }
5175 ifn = unfoldSoak(o, call, 'variable');
5176 }
5177 return ifn;
5178 };
5179
5180 Call.prototype.compileNode = function(o) {
5181 var arg, argIndex, compiledArgs, compiledArray, fragments, preface, _i, _len, _ref4, _ref5;
5182 if ((_ref4 = this.variable) != null) {
5183 _ref4.front = this.front;
5184 }
5185 compiledArray = Splat.compileSplattedArray(o, this.args, true);
5186 if (compiledArray.length) {
5187 return this.compileSplat(o, compiledArray);
5188 }
5189 compiledArgs = [];
5190 _ref5 = this.args;
5191 for (argIndex = _i = 0, _len = _ref5.length; _i < _len; argIndex = ++_i) {
5192 arg = _ref5[argIndex];
5193 if (argIndex) {
5194 compiledArgs.push(this.makeCode(", "));
5195 }
5196 compiledArgs.push.apply(compiledArgs, arg.compileToFragments(o, LEVEL_LIST));
5197 }
5198 fragments = [];
5199 if (this.isSuper) {
5200 preface = this.superReference(o) + (".call(" + (this.superThis(o)));
5201 if (compiledArgs.length) {
5202 preface += ", ";
5203 }
5204 fragments.push(this.makeCode(preface));
5205 } else {
5206 if (this.isNew) {
5207 fragments.push(this.makeCode('new '));
5208 }
5209 fragments.push.apply(fragments, this.variable.compileToFragments(o, LEVEL_ACCESS));
5210 fragments.push(this.makeCode("("));
5211 }
5212 fragments.push.apply(fragments, compiledArgs);
5213 fragments.push(this.makeCode(")"));
5214 return fragments;
5215 };
5216
5217 Call.prototype.compileSplat = function(o, splatArgs) {
5218 var answer, base, fun, idt, name, ref;
5219 if (this.isSuper) {
5220 return [].concat(this.makeCode("" + (this.superReference(o)) + ".apply(" + (this.superThis(o)) + ", "), splatArgs, this.makeCode(")"));
5221 }
5222 if (this.isNew) {
5223 idt = this.tab + TAB;
5224 return [].concat(this.makeCode("(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args);\n" + idt + "return Object(result) === result ? result : child;\n" + this.tab + "})("), this.variable.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), splatArgs, this.makeCode(", function(){})"));
5225 }
5226 answer = [];
5227 base = new Value(this.variable);
5228 if ((name = base.properties.pop()) && base.isComplex()) {
5229 ref = o.scope.freeVariable('ref');
5230 answer = answer.concat(this.makeCode("(" + ref + " = "), base.compileToFragments(o, LEVEL_LIST), this.makeCode(")"), name.compileToFragments(o));
5231 } else {
5232 fun = base.compileToFragments(o, LEVEL_ACCESS);
5233 if (SIMPLENUM.test(fragmentsToText(fun))) {
5234 fun = this.wrapInBraces(fun);
5235 }
5236 if (name) {
5237 ref = fragmentsToText(fun);
5238 fun.push.apply(fun, name.compileToFragments(o));
5239 } else {
5240 ref = 'null';
5241 }
5242 answer = answer.concat(fun);
5243 }
5244 return answer = answer.concat(this.makeCode(".apply(" + ref + ", "), splatArgs, this.makeCode(")"));
5245 };
5246
5247 return Call;
5248
5249 })(Base);
5250
5251 exports.Extends = Extends = (function(_super) {
5252 __extends(Extends, _super);
5253
5254 function Extends(child, parent) {
5255 this.child = child;
5256 this.parent = parent;
5257 }
5258
5259 Extends.prototype.children = ['child', 'parent'];
5260
5261 Extends.prototype.compileToFragments = function(o) {
5262 return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compileToFragments(o);
5263 };
5264
5265 return Extends;
5266
5267 })(Base);
5268
5269 exports.Access = Access = (function(_super) {
5270 __extends(Access, _super);
5271
5272 function Access(name, tag) {
5273 this.name = name;
5274 this.name.asKey = true;
5275 this.soak = tag === 'soak';
5276 }
5277
5278 Access.prototype.children = ['name'];
5279
5280 Access.prototype.compileToFragments = function(o) {
5281 var name;
5282 name = this.name.compileToFragments(o);
5283 if (IDENTIFIER.test(fragmentsToText(name))) {
5284 name.unshift(this.makeCode("."));
5285 } else {
5286 name.unshift(this.makeCode("["));
5287 name.push(this.makeCode("]"));
5288 }
5289 return name;
5290 };
5291
5292 Access.prototype.isComplex = NO;
5293
5294 return Access;
5295
5296 })(Base);
5297
5298 exports.Index = Index = (function(_super) {
5299 __extends(Index, _super);
5300
5301 function Index(index) {
5302 this.index = index;
5303 }
5304
5305 Index.prototype.children = ['index'];
5306
5307 Index.prototype.compileToFragments = function(o) {
5308 return [].concat(this.makeCode("["), this.index.compileToFragments(o, LEVEL_PAREN), this.makeCode("]"));
5309 };
5310
5311 Index.prototype.isComplex = function() {
5312 return this.index.isComplex();
5313 };
5314
5315 return Index;
5316
5317 })(Base);
5318
5319 exports.Range = Range = (function(_super) {
5320 __extends(Range, _super);
5321
5322 Range.prototype.children = ['from', 'to'];
5323
5324 function Range(from, to, tag) {
5325 this.from = from;
5326 this.to = to;
5327 this.exclusive = tag === 'exclusive';
5328 this.equals = this.exclusive ? '' : '=';
5329 }
5330
5331 Range.prototype.compileVariables = function(o) {
5332 var step, _ref4, _ref5, _ref6, _ref7;
5333 o = merge(o, {
5334 top: true
5335 });
5336 _ref4 = this.cacheToCodeFragments(this.from.cache(o, LEVEL_LIST)), this.fromC = _ref4[0], this.fromVar = _ref4[1];
5337 _ref5 = this.cacheToCodeFragments(this.to.cache(o, LEVEL_LIST)), this.toC = _ref5[0], this.toVar = _ref5[1];
5338 if (step = del(o, 'step')) {
5339 _ref6 = this.cacheToCodeFragments(step.cache(o, LEVEL_LIST)), this.step = _ref6[0], this.stepVar = _ref6[1];
5340 }
5341 _ref7 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref7[0], this.toNum = _ref7[1];
5342 if (this.stepVar) {
5343 return this.stepNum = this.stepVar.match(SIMPLENUM);
5344 }
5345 };
5346
5347 Range.prototype.compileNode = function(o) {
5348 var cond, condPart, from, gt, idx, idxName, known, lt, namedIndex, stepPart, to, varPart, _ref4, _ref5;
5349 if (!this.fromVar) {
5350 this.compileVariables(o);
5351 }
5352 if (!o.index) {
5353 return this.compileArray(o);
5354 }
5355 known = this.fromNum && this.toNum;
5356 idx = del(o, 'index');
5357 idxName = del(o, 'name');
5358 namedIndex = idxName && idxName !== idx;
5359 varPart = "" + idx + " = " + this.fromC;
5360 if (this.toC !== this.toVar) {
5361 varPart += ", " + this.toC;
5362 }
5363 if (this.step !== this.stepVar) {
5364 varPart += ", " + this.step;
5365 }
5366 _ref4 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref4[0], gt = _ref4[1];
5367 condPart = this.stepNum ? +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref5 = [+this.fromNum, +this.toNum], from = _ref5[0], to = _ref5[1], _ref5), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = this.stepVar ? "" + this.stepVar + " > 0" : "" + this.fromVar + " <= " + this.toVar, "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar);
5368 stepPart = this.stepVar ? "" + idx + " += " + this.stepVar : known ? namedIndex ? from <= to ? "++" + idx : "--" + idx : from <= to ? "" + idx + "++" : "" + idx + "--" : namedIndex ? "" + cond + " ? ++" + idx + " : --" + idx : "" + cond + " ? " + idx + "++ : " + idx + "--";
5369 if (namedIndex) {
5370 varPart = "" + idxName + " = " + varPart;
5371 }
5372 if (namedIndex) {
5373 stepPart = "" + idxName + " = " + stepPart;
5374 }
5375 return [this.makeCode("" + varPart + "; " + condPart + "; " + stepPart)];
5376 };
5377
5378 Range.prototype.compileArray = function(o) {
5379 var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref4, _ref5, _results;
5380 if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) {
5381 range = (function() {
5382 _results = [];
5383 for (var _i = _ref4 = +this.fromNum, _ref5 = +this.toNum; _ref4 <= _ref5 ? _i <= _ref5 : _i >= _ref5; _ref4 <= _ref5 ? _i++ : _i--){ _results.push(_i); }
5384 return _results;
5385 }).apply(this);
5386 if (this.exclusive) {
5387 range.pop();
5388 }
5389 return [this.makeCode("[" + (range.join(', ')) + "]")];
5390 }
5391 idt = this.tab + TAB;
5392 i = o.scope.freeVariable('i');
5393 result = o.scope.freeVariable('results');
5394 pre = "\n" + idt + result + " = [];";
5395 if (this.fromNum && this.toNum) {
5396 o.index = i;
5397 body = fragmentsToText(this.compileNode(o));
5398 } else {
5399 vars = ("" + i + " = " + this.fromC) + (this.toC !== this.toVar ? ", " + this.toC : '');
5400 cond = "" + this.fromVar + " <= " + this.toVar;
5401 body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--";
5402 }
5403 post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent;
5404 hasArgs = function(node) {
5405 return node != null ? node.contains(function(n) {
5406 return n instanceof Literal && n.value === 'arguments' && !n.asKey;
5407 }) : void 0;
5408 };
5409 if (hasArgs(this.from) || hasArgs(this.to)) {
5410 args = ', arguments';
5411 }
5412 return [this.makeCode("(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this" + (args != null ? args : '') + ")")];
5413 };
5414
5415 return Range;
5416
5417 })(Base);
5418
5419 exports.Slice = Slice = (function(_super) {
5420 __extends(Slice, _super);
5421
5422 Slice.prototype.children = ['range'];
5423
5424 function Slice(range) {
5425 this.range = range;
5426 Slice.__super__.constructor.call(this);
5427 }
5428
5429 Slice.prototype.compileNode = function(o) {
5430 var compiled, compiledText, from, fromCompiled, to, toStr, _ref4;
5431 _ref4 = this.range, to = _ref4.to, from = _ref4.from;
5432 fromCompiled = from && from.compileToFragments(o, LEVEL_PAREN) || [this.makeCode('0')];
5433 if (to) {
5434 compiled = to.compileToFragments(o, LEVEL_PAREN);
5435 compiledText = fragmentsToText(compiled);
5436 if (!(!this.range.exclusive && +compiledText === -1)) {
5437 toStr = ', ' + (this.range.exclusive ? compiledText : SIMPLENUM.test(compiledText) ? "" + (+compiledText + 1) : (compiled = to.compileToFragments(o, LEVEL_ACCESS), "+" + (fragmentsToText(compiled)) + " + 1 || 9e9"));
5438 }
5439 }
5440 return [this.makeCode(".slice(" + (fragmentsToText(fromCompiled)) + (toStr || '') + ")")];
5441 };
5442
5443 return Slice;
5444
5445 })(Base);
5446
5447 exports.Obj = Obj = (function(_super) {
5448 __extends(Obj, _super);
5449
5450 function Obj(props, generated) {
5451 this.generated = generated != null ? generated : false;
5452 this.objects = this.properties = props || [];
5453 }
5454
5455 Obj.prototype.children = ['properties'];
5456
5457 Obj.prototype.compileNode = function(o) {
5458 var answer, i, idt, indent, join, lastNoncom, node, prop, props, _i, _j, _len, _len1;
5459 props = this.properties;
5460 if (!props.length) {
5461 return [this.makeCode(this.front ? '({})' : '{}')];
5462 }
5463 if (this.generated) {
5464 for (_i = 0, _len = props.length; _i < _len; _i++) {
5465 node = props[_i];
5466 if (node instanceof Value) {
5467 node.error('cannot have an implicit value in an implicit object');
5468 }
5469 }
5470 }
5471 idt = o.indent += TAB;
5472 lastNoncom = this.lastNonComment(this.properties);
5473 answer = [];
5474 for (i = _j = 0, _len1 = props.length; _j < _len1; i = ++_j) {
5475 prop = props[i];
5476 join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n';
5477 indent = prop instanceof Comment ? '' : idt;
5478 if (prop instanceof Assign && prop.variable instanceof Value && prop.variable.hasProperties()) {
5479 prop.variable.error('Invalid object key');
5480 }
5481 if (prop instanceof Value && prop["this"]) {
5482 prop = new Assign(prop.properties[0].name, prop, 'object');
5483 }
5484 if (!(prop instanceof Comment)) {
5485 if (!(prop instanceof Assign)) {
5486 prop = new Assign(prop, prop, 'object');
5487 }
5488 (prop.variable.base || prop.variable).asKey = true;
5489 }
5490 if (indent) {
5491 answer.push(this.makeCode(indent));
5492 }
5493 answer.push.apply(answer, prop.compileToFragments(o, LEVEL_TOP));
5494 if (join) {
5495 answer.push(this.makeCode(join));
5496 }
5497 }
5498 answer.unshift(this.makeCode("{" + (props.length && '\n')));
5499 answer.push(this.makeCode("" + (props.length && '\n' + this.tab) + "}"));
5500 if (this.front) {
5501 return this.wrapInBraces(answer);
5502 } else {
5503 return answer;
5504 }
5505 };
5506
5507 Obj.prototype.assigns = function(name) {
5508 var prop, _i, _len, _ref4;
5509 _ref4 = this.properties;
5510 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
5511 prop = _ref4[_i];
5512 if (prop.assigns(name)) {
5513 return true;
5514 }
5515 }
5516 return false;
5517 };
5518
5519 return Obj;
5520
5521 })(Base);
5522
5523 exports.Arr = Arr = (function(_super) {
5524 __extends(Arr, _super);
5525
5526 function Arr(objs) {
5527 this.objects = objs || [];
5528 }
5529
5530 Arr.prototype.children = ['objects'];
5531
5532 Arr.prototype.compileNode = function(o) {
5533 var answer, compiledObjs, fragments, index, obj, _i, _len;
5534 if (!this.objects.length) {
5535 return [this.makeCode('[]')];
5536 }
5537 o.indent += TAB;
5538 answer = Splat.compileSplattedArray(o, this.objects);
5539 if (answer.length) {
5540 return answer;
5541 }
5542 answer = [];
5543 compiledObjs = (function() {
5544 var _i, _len, _ref4, _results;
5545 _ref4 = this.objects;
5546 _results = [];
5547 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
5548 obj = _ref4[_i];
5549 _results.push(obj.compileToFragments(o, LEVEL_LIST));
5550 }
5551 return _results;
5552 }).call(this);
5553 for (index = _i = 0, _len = compiledObjs.length; _i < _len; index = ++_i) {
5554 fragments = compiledObjs[index];
5555 if (index) {
5556 answer.push(this.makeCode(", "));
5557 }
5558 answer.push.apply(answer, fragments);
5559 }
5560 if ((fragmentsToText(answer)).indexOf('\n') >= 0) {
5561 answer.unshift(this.makeCode("[\n" + o.indent));
5562 answer.push(this.makeCode("\n" + this.tab + "]"));
5563 } else {
5564 answer.unshift(this.makeCode("["));
5565 answer.push(this.makeCode("]"));
5566 }
5567 return answer;
5568 };
5569
5570 Arr.prototype.assigns = function(name) {
5571 var obj, _i, _len, _ref4;
5572 _ref4 = this.objects;
5573 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
5574 obj = _ref4[_i];
5575 if (obj.assigns(name)) {
5576 return true;
5577 }
5578 }
5579 return false;
5580 };
5581
5582 return Arr;
5583
5584 })(Base);
5585
5586 exports.Class = Class = (function(_super) {
5587 __extends(Class, _super);
5588
5589 function Class(variable, parent, body) {
5590 this.variable = variable;
5591 this.parent = parent;
5592 this.body = body != null ? body : new Block;
5593 this.boundFuncs = [];
5594 this.body.classBody = true;
5595 }
5596
5597 Class.prototype.children = ['variable', 'parent', 'body'];
5598
5599 Class.prototype.determineName = function() {
5600 var decl, tail;
5601 if (!this.variable) {
5602 return null;
5603 }
5604 decl = (tail = last(this.variable.properties)) ? tail instanceof Access && tail.name.value : this.variable.base.value;
5605 if (__indexOf.call(STRICT_PROSCRIBED, decl) >= 0) {
5606 this.variable.error("class variable name may not be " + decl);
5607 }
5608 return decl && (decl = IDENTIFIER.test(decl) && decl);
5609 };
5610
5611 Class.prototype.setContext = function(name) {
5612 return this.body.traverseChildren(false, function(node) {
5613 if (node.classBody) {
5614 return false;
5615 }
5616 if (node instanceof Literal && node.value === 'this') {
5617 return node.value = name;
5618 } else if (node instanceof Code) {
5619 node.klass = name;
5620 if (node.bound) {
5621 return node.context = name;
5622 }
5623 }
5624 });
5625 };
5626
5627 Class.prototype.addBoundFunctions = function(o) {
5628 var bvar, lhs, _i, _len, _ref4;
5629 _ref4 = this.boundFuncs;
5630 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
5631 bvar = _ref4[_i];
5632 lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o);
5633 this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)"));
5634 }
5635 };
5636
5637 Class.prototype.addProperties = function(node, name, o) {
5638 var assign, base, exprs, func, props;
5639 props = node.base.properties.slice(0);
5640 exprs = (function() {
5641 var _results;
5642 _results = [];
5643 while (assign = props.shift()) {
5644 if (assign instanceof Assign) {
5645 base = assign.variable.base;
5646 delete assign.context;
5647 func = assign.value;
5648 if (base.value === 'constructor') {
5649 if (this.ctor) {
5650 assign.error('cannot define more than one constructor in a class');
5651 }
5652 if (func.bound) {
5653 assign.error('cannot define a constructor as a bound function');
5654 }
5655 if (func instanceof Code) {
5656 assign = this.ctor = func;
5657 } else {
5658 this.externalCtor = o.scope.freeVariable('class');
5659 assign = new Assign(new Literal(this.externalCtor), func);
5660 }
5661 } else {
5662 if (assign.variable["this"]) {
5663 func["static"] = true;
5664 if (func.bound) {
5665 func.context = name;
5666 }
5667 } else {
5668 assign.variable = new Value(new Literal(name), [new Access(new Literal('prototype')), new Access(base)]);
5669 if (func instanceof Code && func.bound) {
5670 this.boundFuncs.push(base);
5671 func.bound = false;
5672 }
5673 }
5674 }
5675 }
5676 _results.push(assign);
5677 }
5678 return _results;
5679 }).call(this);
5680 return compact(exprs);
5681 };
5682
5683 Class.prototype.walkBody = function(name, o) {
5684 var _this = this;
5685 return this.traverseChildren(false, function(child) {
5686 var cont, exps, i, node, _i, _len, _ref4;
5687 cont = true;
5688 if (child instanceof Class) {
5689 return false;
5690 }
5691 if (child instanceof Block) {
5692 _ref4 = exps = child.expressions;
5693 for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) {
5694 node = _ref4[i];
5695 if (node instanceof Value && node.isObject(true)) {
5696 cont = false;
5697 exps[i] = _this.addProperties(node, name, o);
5698 }
5699 }
5700 child.expressions = exps = flatten(exps);
5701 }
5702 return cont && !(child instanceof Class);
5703 });
5704 };
5705
5706 Class.prototype.hoistDirectivePrologue = function() {
5707 var expressions, index, node;
5708 index = 0;
5709 expressions = this.body.expressions;
5710 while ((node = expressions[index]) && node instanceof Comment || node instanceof Value && node.isString()) {
5711 ++index;
5712 }
5713 return this.directives = expressions.splice(0, index);
5714 };
5715
5716 Class.prototype.ensureConstructor = function(name, o) {
5717 var missing, ref, superCall;
5718 missing = !this.ctor;
5719 this.ctor || (this.ctor = new Code);
5720 this.ctor.ctor = this.ctor.name = name;
5721 this.ctor.klass = null;
5722 this.ctor.noReturn = true;
5723 if (missing) {
5724 if (this.parent) {
5725 superCall = new Literal("" + name + ".__super__.constructor.apply(this, arguments)");
5726 }
5727 if (this.externalCtor) {
5728 superCall = new Literal("" + this.externalCtor + ".apply(this, arguments)");
5729 }
5730 if (superCall) {
5731 ref = new Literal(o.scope.freeVariable('ref'));
5732 this.ctor.body.unshift(new Assign(ref, superCall));
5733 }
5734 this.addBoundFunctions(o);
5735 if (superCall) {
5736 this.ctor.body.push(ref);
5737 this.ctor.body.makeReturn();
5738 }
5739 return this.body.expressions.unshift(this.ctor);
5740 } else {
5741 return this.addBoundFunctions(o);
5742 }
5743 };
5744
5745 Class.prototype.compileNode = function(o) {
5746 var call, decl, klass, lname, name, params, _ref4;
5747 decl = this.determineName();
5748 name = decl || '_Class';
5749 if (name.reserved) {
5750 name = "_" + name;
5751 }
5752 lname = new Literal(name);
5753 this.hoistDirectivePrologue();
5754 this.setContext(name);
5755 this.walkBody(name, o);
5756 this.ensureConstructor(name, o);
5757 this.body.spaced = true;
5758 if (!(this.ctor instanceof Code)) {
5759 this.body.expressions.unshift(this.ctor);
5760 }
5761 this.body.expressions.push(lname);
5762 (_ref4 = this.body.expressions).unshift.apply(_ref4, this.directives);
5763 call = Closure.wrap(this.body);
5764 if (this.parent) {
5765 this.superClass = new Literal(o.scope.freeVariable('super', false));
5766 this.body.expressions.unshift(new Extends(lname, this.superClass));
5767 call.args.push(this.parent);
5768 params = call.variable.params || call.variable.base.params;
5769 params.push(new Param(this.superClass));
5770 }
5771 klass = new Parens(call, true);
5772 if (this.variable) {
5773 klass = new Assign(this.variable, klass);
5774 }
5775 return klass.compileToFragments(o);
5776 };
5777
5778 return Class;
5779
5780 })(Base);
5781
5782 exports.Assign = Assign = (function(_super) {
5783 __extends(Assign, _super);
5784
5785 function Assign(variable, value, context, options) {
5786 var forbidden, name, _ref4;
5787 this.variable = variable;
5788 this.value = value;
5789 this.context = context;
5790 this.param = options && options.param;
5791 this.subpattern = options && options.subpattern;
5792 forbidden = (_ref4 = (name = this.variable.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref4) >= 0);
5793 if (forbidden && this.context !== 'object') {
5794 this.variable.error("variable name may not be \"" + name + "\"");
5795 }
5796 }
5797
5798 Assign.prototype.children = ['variable', 'value'];
5799
5800 Assign.prototype.isStatement = function(o) {
5801 return (o != null ? o.level : void 0) === LEVEL_TOP && (this.context != null) && __indexOf.call(this.context, "?") >= 0;
5802 };
5803
5804 Assign.prototype.assigns = function(name) {
5805 return this[this.context === 'object' ? 'value' : 'variable'].assigns(name);
5806 };
5807
5808 Assign.prototype.unfoldSoak = function(o) {
5809 return unfoldSoak(o, this, 'variable');
5810 };
5811
5812 Assign.prototype.compileNode = function(o) {
5813 var answer, compiledName, isValue, match, name, val, varBase, _ref4, _ref5, _ref6, _ref7;
5814 if (isValue = this.variable instanceof Value) {
5815 if (this.variable.isArray() || this.variable.isObject()) {
5816 return this.compilePatternMatch(o);
5817 }
5818 if (this.variable.isSplice()) {
5819 return this.compileSplice(o);
5820 }
5821 if ((_ref4 = this.context) === '||=' || _ref4 === '&&=' || _ref4 === '?=') {
5822 return this.compileConditional(o);
5823 }
5824 }
5825 compiledName = this.variable.compileToFragments(o, LEVEL_LIST);
5826 name = fragmentsToText(compiledName);
5827 if (!this.context) {
5828 varBase = this.variable.unwrapAll();
5829 if (!varBase.isAssignable()) {
5830 this.variable.error("\"" + (this.variable.compile(o)) + "\" cannot be assigned");
5831 }
5832 if (!(typeof varBase.hasProperties === "function" ? varBase.hasProperties() : void 0)) {
5833 if (this.param) {
5834 o.scope.add(name, 'var');
5835 } else {
5836 o.scope.find(name);
5837 }
5838 }
5839 }
5840 if (this.value instanceof Code && (match = METHOD_DEF.exec(name))) {
5841 if (match[1]) {
5842 this.value.klass = match[1];
5843 }
5844 this.value.name = (_ref5 = (_ref6 = (_ref7 = match[2]) != null ? _ref7 : match[3]) != null ? _ref6 : match[4]) != null ? _ref5 : match[5];
5845 }
5846 val = this.value.compileToFragments(o, LEVEL_LIST);
5847 if (this.context === 'object') {
5848 return compiledName.concat(this.makeCode(": "), val);
5849 }
5850 answer = compiledName.concat(this.makeCode(" " + (this.context || '=') + " "), val);
5851 if (o.level <= LEVEL_LIST) {
5852 return answer;
5853 } else {
5854 return this.wrapInBraces(answer);
5855 }
5856 };
5857
5858 Assign.prototype.compilePatternMatch = function(o) {
5859 var acc, assigns, code, fragments, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, vvarText, _i, _len, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
5860 top = o.level === LEVEL_TOP;
5861 value = this.value;
5862 objects = this.variable.base.objects;
5863 if (!(olen = objects.length)) {
5864 code = value.compileToFragments(o);
5865 if (o.level >= LEVEL_OP) {
5866 return this.wrapInBraces(code);
5867 } else {
5868 return code;
5869 }
5870 }
5871 isObject = this.variable.isObject();
5872 if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) {
5873 if (obj instanceof Assign) {
5874 _ref4 = obj, (_ref5 = _ref4.variable, idx = _ref5.base), obj = _ref4.value;
5875 } else {
5876 idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0);
5877 }
5878 acc = IDENTIFIER.test(idx.unwrap().value || 0);
5879 value = new Value(value);
5880 value.properties.push(new (acc ? Access : Index)(idx));
5881 if (_ref6 = obj.unwrap().value, __indexOf.call(RESERVED, _ref6) >= 0) {
5882 obj.error("assignment to a reserved word: " + (obj.compile(o)));
5883 }
5884 return new Assign(obj, value, null, {
5885 param: this.param
5886 }).compileToFragments(o, LEVEL_TOP);
5887 }
5888 vvar = value.compileToFragments(o, LEVEL_LIST);
5889 vvarText = fragmentsToText(vvar);
5890 assigns = [];
5891 splat = false;
5892 if (!IDENTIFIER.test(vvarText) || this.variable.assigns(vvarText)) {
5893 assigns.push([this.makeCode("" + (ref = o.scope.freeVariable('ref')) + " = ")].concat(__slice.call(vvar)));
5894 vvar = [this.makeCode(ref)];
5895 vvarText = ref;
5896 }
5897 for (i = _i = 0, _len = objects.length; _i < _len; i = ++_i) {
5898 obj = objects[i];
5899 idx = i;
5900 if (isObject) {
5901 if (obj instanceof Assign) {
5902 _ref7 = obj, (_ref8 = _ref7.variable, idx = _ref8.base), obj = _ref7.value;
5903 } else {
5904 if (obj.base instanceof Parens) {
5905 _ref9 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref9[0], idx = _ref9[1];
5906 } else {
5907 idx = obj["this"] ? obj.properties[0].name : obj;
5908 }
5909 }
5910 }
5911 if (!splat && obj instanceof Splat) {
5912 name = obj.name.unwrap().value;
5913 obj = obj.unwrap();
5914 val = "" + olen + " <= " + vvarText + ".length ? " + (utility('slice')) + ".call(" + vvarText + ", " + i;
5915 if (rest = olen - i - 1) {
5916 ivar = o.scope.freeVariable('i');
5917 val += ", " + ivar + " = " + vvarText + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])";
5918 } else {
5919 val += ") : []";
5920 }
5921 val = new Literal(val);
5922 splat = "" + ivar + "++";
5923 } else {
5924 name = obj.unwrap().value;
5925 if (obj instanceof Splat) {
5926 obj.error("multiple splats are disallowed in an assignment");
5927 }
5928 if (typeof idx === 'number') {
5929 idx = new Literal(splat || idx);
5930 acc = false;
5931 } else {
5932 acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0);
5933 }
5934 val = new Value(new Literal(vvarText), [new (acc ? Access : Index)(idx)]);
5935 }
5936 if ((name != null) && __indexOf.call(RESERVED, name) >= 0) {
5937 obj.error("assignment to a reserved word: " + (obj.compile(o)));
5938 }
5939 assigns.push(new Assign(obj, val, null, {
5940 param: this.param,
5941 subpattern: true
5942 }).compileToFragments(o, LEVEL_LIST));
5943 }
5944 if (!(top || this.subpattern)) {
5945 assigns.push(vvar);
5946 }
5947 fragments = this.joinFragmentArrays(assigns, ', ');
5948 if (o.level < LEVEL_LIST) {
5949 return fragments;
5950 } else {
5951 return this.wrapInBraces(fragments);
5952 }
5953 };
5954
5955 Assign.prototype.compileConditional = function(o) {
5956 var left, right, _ref4;
5957 _ref4 = this.variable.cacheReference(o), left = _ref4[0], right = _ref4[1];
5958 if (!left.properties.length && left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) {
5959 this.variable.error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been declared before");
5960 }
5961 if (__indexOf.call(this.context, "?") >= 0) {
5962 o.isExistentialEquals = true;
5963 }
5964 return new Op(this.context.slice(0, -1), left, new Assign(right, this.value, '=')).compileToFragments(o);
5965 };
5966
5967 Assign.prototype.compileSplice = function(o) {
5968 var answer, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref4, _ref5, _ref6;
5969 _ref4 = this.variable.properties.pop().range, from = _ref4.from, to = _ref4.to, exclusive = _ref4.exclusive;
5970 name = this.variable.compile(o);
5971 if (from) {
5972 _ref5 = this.cacheToCodeFragments(from.cache(o, LEVEL_OP)), fromDecl = _ref5[0], fromRef = _ref5[1];
5973 } else {
5974 fromDecl = fromRef = '0';
5975 }
5976 if (to) {
5977 if ((from != null ? from.isSimpleNumber() : void 0) && to.isSimpleNumber()) {
5978 to = +to.compile(o) - +fromRef;
5979 if (!exclusive) {
5980 to += 1;
5981 }
5982 } else {
5983 to = to.compile(o, LEVEL_ACCESS) + ' - ' + fromRef;
5984 if (!exclusive) {
5985 to += ' + 1';
5986 }
5987 }
5988 } else {
5989 to = "9e9";
5990 }
5991 _ref6 = this.value.cache(o, LEVEL_LIST), valDef = _ref6[0], valRef = _ref6[1];
5992 answer = [].concat(this.makeCode("[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat("), valDef, this.makeCode(")), "), valRef);
5993 if (o.level > LEVEL_TOP) {
5994 return this.wrapInBraces(answer);
5995 } else {
5996 return answer;
5997 }
5998 };
5999
6000 return Assign;
6001
6002 })(Base);
6003
6004 exports.Code = Code = (function(_super) {
6005 __extends(Code, _super);
6006
6007 function Code(params, body, tag) {
6008 this.params = params || [];
6009 this.body = body || new Block;
6010 this.bound = tag === 'boundfunc';
6011 if (this.bound) {
6012 this.context = '_this';
6013 }
6014 }
6015
6016 Code.prototype.children = ['params', 'body'];
6017
6018 Code.prototype.isStatement = function() {
6019 return !!this.ctor;
6020 };
6021
6022 Code.prototype.jumps = NO;
6023
6024 Code.prototype.compileNode = function(o) {
6025 var answer, code, exprs, i, idt, lit, p, param, params, ref, splats, uniqs, val, wasEmpty, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref4, _ref5, _ref6, _ref7, _ref8;
6026 o.scope = new Scope(o.scope, this.body, this);
6027 o.scope.shared = del(o, 'sharedScope');
6028 o.indent += TAB;
6029 delete o.bare;
6030 delete o.isExistentialEquals;
6031 params = [];
6032 exprs = [];
6033 this.eachParamName(function(name) {
6034 if (!o.scope.check(name)) {
6035 return o.scope.parameter(name);
6036 }
6037 });
6038 _ref4 = this.params;
6039 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
6040 param = _ref4[_i];
6041 if (!param.splat) {
6042 continue;
6043 }
6044 _ref5 = this.params;
6045 for (_j = 0, _len1 = _ref5.length; _j < _len1; _j++) {
6046 p = _ref5[_j].name;
6047 if (p["this"]) {
6048 p = p.properties[0].name;
6049 }
6050 if (p.value) {
6051 o.scope.add(p.value, 'var', true);
6052 }
6053 }
6054 splats = new Assign(new Value(new Arr((function() {
6055 var _k, _len2, _ref6, _results;
6056 _ref6 = this.params;
6057 _results = [];
6058 for (_k = 0, _len2 = _ref6.length; _k < _len2; _k++) {
6059 p = _ref6[_k];
6060 _results.push(p.asReference(o));
6061 }
6062 return _results;
6063 }).call(this))), new Value(new Literal('arguments')));
6064 break;
6065 }
6066 _ref6 = this.params;
6067 for (_k = 0, _len2 = _ref6.length; _k < _len2; _k++) {
6068 param = _ref6[_k];
6069 if (param.isComplex()) {
6070 val = ref = param.asReference(o);
6071 if (param.value) {
6072 val = new Op('?', ref, param.value);
6073 }
6074 exprs.push(new Assign(new Value(param.name), val, '=', {
6075 param: true
6076 }));
6077 } else {
6078 ref = param;
6079 if (param.value) {
6080 lit = new Literal(ref.name.value + ' == null');
6081 val = new Assign(new Value(param.name), param.value, '=');
6082 exprs.push(new If(lit, val));
6083 }
6084 }
6085 if (!splats) {
6086 params.push(ref);
6087 }
6088 }
6089 wasEmpty = this.body.isEmpty();
6090 if (splats) {
6091 exprs.unshift(splats);
6092 }
6093 if (exprs.length) {
6094 (_ref7 = this.body.expressions).unshift.apply(_ref7, exprs);
6095 }
6096 for (i = _l = 0, _len3 = params.length; _l < _len3; i = ++_l) {
6097 p = params[i];
6098 params[i] = p.compileToFragments(o);
6099 o.scope.parameter(fragmentsToText(params[i]));
6100 }
6101 uniqs = [];
6102 this.eachParamName(function(name, node) {
6103 if (__indexOf.call(uniqs, name) >= 0) {
6104 node.error("multiple parameters named '" + name + "'");
6105 }
6106 return uniqs.push(name);
6107 });
6108 if (!(wasEmpty || this.noReturn)) {
6109 this.body.makeReturn();
6110 }
6111 if (this.bound) {
6112 if ((_ref8 = o.scope.parent.method) != null ? _ref8.bound : void 0) {
6113 this.bound = this.context = o.scope.parent.method.context;
6114 } else if (!this["static"]) {
6115 o.scope.parent.assign('_this', 'this');
6116 }
6117 }
6118 idt = o.indent;
6119 code = 'function';
6120 if (this.ctor) {
6121 code += ' ' + this.name;
6122 }
6123 code += '(';
6124 answer = [this.makeCode(code)];
6125 for (i = _m = 0, _len4 = params.length; _m < _len4; i = ++_m) {
6126 p = params[i];
6127 if (i) {
6128 answer.push(this.makeCode(", "));
6129 }
6130 answer.push.apply(answer, p);
6131 }
6132 answer.push(this.makeCode(') {'));
6133 if (!this.body.isEmpty()) {
6134 answer = answer.concat(this.makeCode("\n"), this.body.compileWithDeclarations(o), this.makeCode("\n" + this.tab));
6135 }
6136 answer.push(this.makeCode('}'));
6137 if (this.ctor) {
6138 return [this.makeCode(this.tab)].concat(__slice.call(answer));
6139 }
6140 if (this.front || (o.level >= LEVEL_ACCESS)) {
6141 return this.wrapInBraces(answer);
6142 } else {
6143 return answer;
6144 }
6145 };
6146
6147 Code.prototype.eachParamName = function(iterator) {
6148 var param, _i, _len, _ref4, _results;
6149 _ref4 = this.params;
6150 _results = [];
6151 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
6152 param = _ref4[_i];
6153 _results.push(param.eachName(iterator));
6154 }
6155 return _results;
6156 };
6157
6158 Code.prototype.traverseChildren = function(crossScope, func) {
6159 if (crossScope) {
6160 return Code.__super__.traverseChildren.call(this, crossScope, func);
6161 }
6162 };
6163
6164 return Code;
6165
6166 })(Base);
6167
6168 exports.Param = Param = (function(_super) {
6169 __extends(Param, _super);
6170
6171 function Param(name, value, splat) {
6172 var _ref4;
6173 this.name = name;
6174 this.value = value;
6175 this.splat = splat;
6176 if (_ref4 = (name = this.name.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref4) >= 0) {
6177 this.name.error("parameter name \"" + name + "\" is not allowed");
6178 }
6179 }
6180
6181 Param.prototype.children = ['name', 'value'];
6182
6183 Param.prototype.compileToFragments = function(o) {
6184 return this.name.compileToFragments(o, LEVEL_LIST);
6185 };
6186
6187 Param.prototype.asReference = function(o) {
6188 var node;
6189 if (this.reference) {
6190 return this.reference;
6191 }
6192 node = this.name;
6193 if (node["this"]) {
6194 node = node.properties[0].name;
6195 if (node.value.reserved) {
6196 node = new Literal(o.scope.freeVariable(node.value));
6197 }
6198 } else if (node.isComplex()) {
6199 node = new Literal(o.scope.freeVariable('arg'));
6200 }
6201 node = new Value(node);
6202 if (this.splat) {
6203 node = new Splat(node);
6204 }
6205 return this.reference = node;
6206 };
6207
6208 Param.prototype.isComplex = function() {
6209 return this.name.isComplex();
6210 };
6211
6212 Param.prototype.eachName = function(iterator, name) {
6213 var atParam, node, obj, _i, _len, _ref4;
6214 if (name == null) {
6215 name = this.name;
6216 }
6217 atParam = function(obj) {
6218 var node;
6219 node = obj.properties[0].name;
6220 if (!node.value.reserved) {
6221 return iterator(node.value, node);
6222 }
6223 };
6224 if (name instanceof Literal) {
6225 return iterator(name.value, name);
6226 }
6227 if (name instanceof Value) {
6228 return atParam(name);
6229 }
6230 _ref4 = name.objects;
6231 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
6232 obj = _ref4[_i];
6233 if (obj instanceof Assign) {
6234 this.eachName(iterator, obj.value.unwrap());
6235 } else if (obj instanceof Splat) {
6236 node = obj.name.unwrap();
6237 iterator(node.value, node);
6238 } else if (obj instanceof Value) {
6239 if (obj.isArray() || obj.isObject()) {
6240 this.eachName(iterator, obj.base);
6241 } else if (obj["this"]) {
6242 atParam(obj);
6243 } else {
6244 iterator(obj.base.value, obj.base);
6245 }
6246 } else {
6247 obj.error("illegal parameter " + (obj.compile()));
6248 }
6249 }
6250 };
6251
6252 return Param;
6253
6254 })(Base);
6255
6256 exports.Splat = Splat = (function(_super) {
6257 __extends(Splat, _super);
6258
6259 Splat.prototype.children = ['name'];
6260
6261 Splat.prototype.isAssignable = YES;
6262
6263 function Splat(name) {
6264 this.name = name.compile ? name : new Literal(name);
6265 }
6266
6267 Splat.prototype.assigns = function(name) {
6268 return this.name.assigns(name);
6269 };
6270
6271 Splat.prototype.compileToFragments = function(o) {
6272 return this.name.compileToFragments(o);
6273 };
6274
6275 Splat.prototype.unwrap = function() {
6276 return this.name;
6277 };
6278
6279 Splat.compileSplattedArray = function(o, list, apply) {
6280 var args, base, compiledNode, concatPart, fragments, i, index, node, _i, _len;
6281 index = -1;
6282 while ((node = list[++index]) && !(node instanceof Splat)) {
6283 continue;
6284 }
6285 if (index >= list.length) {
6286 return [];
6287 }
6288 if (list.length === 1) {
6289 node = list[0];
6290 fragments = node.compileToFragments(o, LEVEL_LIST);
6291 if (apply) {
6292 return fragments;
6293 }
6294 return [].concat(node.makeCode("" + (utility('slice')) + ".call("), fragments, node.makeCode(")"));
6295 }
6296 args = list.slice(index);
6297 for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) {
6298 node = args[i];
6299 compiledNode = node.compileToFragments(o, LEVEL_LIST);
6300 args[i] = node instanceof Splat ? [].concat(node.makeCode("" + (utility('slice')) + ".call("), compiledNode, node.makeCode(")")) : [].concat(node.makeCode("["), compiledNode, node.makeCode("]"));
6301 }
6302 if (index === 0) {
6303 node = list[0];
6304 concatPart = node.joinFragmentArrays(args.slice(1), ', ');
6305 return args[0].concat(node.makeCode(".concat("), concatPart, node.makeCode(")"));
6306 }
6307 base = (function() {
6308 var _j, _len1, _ref4, _results;
6309 _ref4 = list.slice(0, index);
6310 _results = [];
6311 for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
6312 node = _ref4[_j];
6313 _results.push(node.compileToFragments(o, LEVEL_LIST));
6314 }
6315 return _results;
6316 })();
6317 base = list[0].joinFragmentArrays(base, ', ');
6318 concatPart = list[index].joinFragmentArrays(args, ', ');
6319 return [].concat(list[0].makeCode("["), base, list[index].makeCode("].concat("), concatPart, (last(list)).makeCode(")"));
6320 };
6321
6322 return Splat;
6323
6324 })(Base);
6325
6326 exports.While = While = (function(_super) {
6327 __extends(While, _super);
6328
6329 function While(condition, options) {
6330 this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition;
6331 this.guard = options != null ? options.guard : void 0;
6332 }
6333
6334 While.prototype.children = ['condition', 'guard', 'body'];
6335
6336 While.prototype.isStatement = YES;
6337
6338 While.prototype.makeReturn = function(res) {
6339 if (res) {
6340 return While.__super__.makeReturn.apply(this, arguments);
6341 } else {
6342 this.returns = !this.jumps({
6343 loop: true
6344 });
6345 return this;
6346 }
6347 };
6348
6349 While.prototype.addBody = function(body) {
6350 this.body = body;
6351 return this;
6352 };
6353
6354 While.prototype.jumps = function() {
6355 var expressions, node, _i, _len;
6356 expressions = this.body.expressions;
6357 if (!expressions.length) {
6358 return false;
6359 }
6360 for (_i = 0, _len = expressions.length; _i < _len; _i++) {
6361 node = expressions[_i];
6362 if (node.jumps({
6363 loop: true
6364 })) {
6365 return node;
6366 }
6367 }
6368 return false;
6369 };
6370
6371 While.prototype.compileNode = function(o) {
6372 var answer, body, rvar, set;
6373 o.indent += TAB;
6374 set = '';
6375 body = this.body;
6376 if (body.isEmpty()) {
6377 body = this.makeCode('');
6378 } else {
6379 if (this.returns) {
6380 body.makeReturn(rvar = o.scope.freeVariable('results'));
6381 set = "" + this.tab + rvar + " = [];\n";
6382 }
6383 if (this.guard) {
6384 if (body.expressions.length > 1) {
6385 body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue")));
6386 } else {
6387 if (this.guard) {
6388 body = Block.wrap([new If(this.guard, body)]);
6389 }
6390 }
6391 }
6392 body = [].concat(this.makeCode("\n"), body.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab));
6393 }
6394 answer = [].concat(this.makeCode(set + this.tab + "while ("), this.condition.compileToFragments(o, LEVEL_PAREN), this.makeCode(") {"), body, this.makeCode("}"));
6395 if (this.returns) {
6396 answer.push(this.makeCode("\n" + this.tab + "return " + rvar + ";"));
6397 }
6398 return answer;
6399 };
6400
6401 return While;
6402
6403 })(Base);
6404
6405 exports.Op = Op = (function(_super) {
6406 var CONVERSIONS, INVERSIONS;
6407
6408 __extends(Op, _super);
6409
6410 function Op(op, first, second, flip) {
6411 if (op === 'in') {
6412 return new In(first, second);
6413 }
6414 if (op === 'do') {
6415 return this.generateDo(first);
6416 }
6417 if (op === 'new') {
6418 if (first instanceof Call && !first["do"] && !first.isNew) {
6419 return first.newInstance();
6420 }
6421 if (first instanceof Code && first.bound || first["do"]) {
6422 first = new Parens(first);
6423 }
6424 }
6425 this.operator = CONVERSIONS[op] || op;
6426 this.first = first;
6427 this.second = second;
6428 this.flip = !!flip;
6429 return this;
6430 }
6431
6432 CONVERSIONS = {
6433 '==': '===',
6434 '!=': '!==',
6435 'of': 'in'
6436 };
6437
6438 INVERSIONS = {
6439 '!==': '===',
6440 '===': '!=='
6441 };
6442
6443 Op.prototype.children = ['first', 'second'];
6444
6445 Op.prototype.isSimpleNumber = NO;
6446
6447 Op.prototype.isUnary = function() {
6448 return !this.second;
6449 };
6450
6451 Op.prototype.isComplex = function() {
6452 var _ref4;
6453 return !(this.isUnary() && ((_ref4 = this.operator) === '+' || _ref4 === '-')) || this.first.isComplex();
6454 };
6455
6456 Op.prototype.isChainable = function() {
6457 var _ref4;
6458 return (_ref4 = this.operator) === '<' || _ref4 === '>' || _ref4 === '>=' || _ref4 === '<=' || _ref4 === '===' || _ref4 === '!==';
6459 };
6460
6461 Op.prototype.invert = function() {
6462 var allInvertable, curr, fst, op, _ref4;
6463 if (this.isChainable() && this.first.isChainable()) {
6464 allInvertable = true;
6465 curr = this;
6466 while (curr && curr.operator) {
6467 allInvertable && (allInvertable = curr.operator in INVERSIONS);
6468 curr = curr.first;
6469 }
6470 if (!allInvertable) {
6471 return new Parens(this).invert();
6472 }
6473 curr = this;
6474 while (curr && curr.operator) {
6475 curr.invert = !curr.invert;
6476 curr.operator = INVERSIONS[curr.operator];
6477 curr = curr.first;
6478 }
6479 return this;
6480 } else if (op = INVERSIONS[this.operator]) {
6481 this.operator = op;
6482 if (this.first.unwrap() instanceof Op) {
6483 this.first.invert();
6484 }
6485 return this;
6486 } else if (this.second) {
6487 return new Parens(this).invert();
6488 } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref4 = fst.operator) === '!' || _ref4 === 'in' || _ref4 === 'instanceof')) {
6489 return fst;
6490 } else {
6491 return new Op('!', this);
6492 }
6493 };
6494
6495 Op.prototype.unfoldSoak = function(o) {
6496 var _ref4;
6497 return ((_ref4 = this.operator) === '++' || _ref4 === '--' || _ref4 === 'delete') && unfoldSoak(o, this, 'first');
6498 };
6499
6500 Op.prototype.generateDo = function(exp) {
6501 var call, func, param, passedParams, ref, _i, _len, _ref4;
6502 passedParams = [];
6503 func = exp instanceof Assign && (ref = exp.value.unwrap()) instanceof Code ? ref : exp;
6504 _ref4 = func.params || [];
6505 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
6506 param = _ref4[_i];
6507 if (param.value) {
6508 passedParams.push(param.value);
6509 delete param.value;
6510 } else {
6511 passedParams.push(param);
6512 }
6513 }
6514 call = new Call(exp, passedParams);
6515 call["do"] = true;
6516 return call;
6517 };
6518
6519 Op.prototype.compileNode = function(o) {
6520 var answer, isChain, _ref4, _ref5;
6521 isChain = this.isChainable() && this.first.isChainable();
6522 if (!isChain) {
6523 this.first.front = this.front;
6524 }
6525 if (this.operator === 'delete' && o.scope.check(this.first.unwrapAll().value)) {
6526 this.error('delete operand may not be argument or var');
6527 }
6528 if (((_ref4 = this.operator) === '--' || _ref4 === '++') && (_ref5 = this.first.unwrapAll().value, __indexOf.call(STRICT_PROSCRIBED, _ref5) >= 0)) {
6529 this.error("cannot increment/decrement \"" + (this.first.unwrapAll().value) + "\"");
6530 }
6531 if (this.isUnary()) {
6532 return this.compileUnary(o);
6533 }
6534 if (isChain) {
6535 return this.compileChain(o);
6536 }
6537 if (this.operator === '?') {
6538 return this.compileExistence(o);
6539 }
6540 answer = [].concat(this.first.compileToFragments(o, LEVEL_OP), this.makeCode(' ' + this.operator + ' '), this.second.compileToFragments(o, LEVEL_OP));
6541 if (o.level <= LEVEL_OP) {
6542 return answer;
6543 } else {
6544 return this.wrapInBraces(answer);
6545 }
6546 };
6547
6548 Op.prototype.compileChain = function(o) {
6549 var fragments, fst, shared, _ref4;
6550 _ref4 = this.first.second.cache(o), this.first.second = _ref4[0], shared = _ref4[1];
6551 fst = this.first.compileToFragments(o, LEVEL_OP);
6552 fragments = fst.concat(this.makeCode(" " + (this.invert ? '&&' : '||') + " "), shared.compileToFragments(o), this.makeCode(" " + this.operator + " "), this.second.compileToFragments(o, LEVEL_OP));
6553 return this.wrapInBraces(fragments);
6554 };
6555
6556 Op.prototype.compileExistence = function(o) {
6557 var fst, ref;
6558 if (this.first.isComplex()) {
6559 ref = new Literal(o.scope.freeVariable('ref'));
6560 fst = new Parens(new Assign(ref, this.first));
6561 } else {
6562 fst = this.first;
6563 ref = fst;
6564 }
6565 return new If(new Existence(fst), ref, {
6566 type: 'if'
6567 }).addElse(this.second).compileToFragments(o);
6568 };
6569
6570 Op.prototype.compileUnary = function(o) {
6571 var op, parts, plusMinus;
6572 parts = [];
6573 op = this.operator;
6574 parts.push([this.makeCode(op)]);
6575 if (op === '!' && this.first instanceof Existence) {
6576 this.first.negated = !this.first.negated;
6577 return this.first.compileToFragments(o);
6578 }
6579 if (o.level >= LEVEL_ACCESS) {
6580 return (new Parens(this)).compileToFragments(o);
6581 }
6582 plusMinus = op === '+' || op === '-';
6583 if ((op === 'new' || op === 'typeof' || op === 'delete') || plusMinus && this.first instanceof Op && this.first.operator === op) {
6584 parts.push([this.makeCode(' ')]);
6585 }
6586 if ((plusMinus && this.first instanceof Op) || (op === 'new' && this.first.isStatement(o))) {
6587 this.first = new Parens(this.first);
6588 }
6589 parts.push(this.first.compileToFragments(o, LEVEL_OP));
6590 if (this.flip) {
6591 parts.reverse();
6592 }
6593 return this.joinFragmentArrays(parts, '');
6594 };
6595
6596 Op.prototype.toString = function(idt) {
6597 return Op.__super__.toString.call(this, idt, this.constructor.name + ' ' + this.operator);
6598 };
6599
6600 return Op;
6601
6602 })(Base);
6603
6604 exports.In = In = (function(_super) {
6605 __extends(In, _super);
6606
6607 function In(object, array) {
6608 this.object = object;
6609 this.array = array;
6610 }
6611
6612 In.prototype.children = ['object', 'array'];
6613
6614 In.prototype.invert = NEGATE;
6615
6616 In.prototype.compileNode = function(o) {
6617 var hasSplat, obj, _i, _len, _ref4;
6618 if (this.array instanceof Value && this.array.isArray()) {
6619 _ref4 = this.array.base.objects;
6620 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
6621 obj = _ref4[_i];
6622 if (!(obj instanceof Splat)) {
6623 continue;
6624 }
6625 hasSplat = true;
6626 break;
6627 }
6628 if (!hasSplat) {
6629 return this.compileOrTest(o);
6630 }
6631 }
6632 return this.compileLoopTest(o);
6633 };
6634
6635 In.prototype.compileOrTest = function(o) {
6636 var cmp, cnj, i, item, ref, sub, tests, _i, _len, _ref4, _ref5, _ref6;
6637 if (this.array.base.objects.length === 0) {
6638 return [this.makeCode("" + (!!this.negated))];
6639 }
6640 _ref4 = this.object.cache(o, LEVEL_OP), sub = _ref4[0], ref = _ref4[1];
6641 _ref5 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref5[0], cnj = _ref5[1];
6642 tests = [];
6643 _ref6 = this.array.base.objects;
6644 for (i = _i = 0, _len = _ref6.length; _i < _len; i = ++_i) {
6645 item = _ref6[i];
6646 if (i) {
6647 tests.push(this.makeCode(cnj));
6648 }
6649 tests = tests.concat((i ? ref : sub), this.makeCode(cmp), item.compileToFragments(o, LEVEL_ACCESS));
6650 }
6651 if (o.level < LEVEL_OP) {
6652 return tests;
6653 } else {
6654 return this.wrapInBraces(tests);
6655 }
6656 };
6657
6658 In.prototype.compileLoopTest = function(o) {
6659 var fragments, ref, sub, _ref4;
6660 _ref4 = this.object.cache(o, LEVEL_LIST), sub = _ref4[0], ref = _ref4[1];
6661 fragments = [].concat(this.makeCode(utility('indexOf') + ".call("), this.array.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), ref, this.makeCode(") " + (this.negated ? '< 0' : '>= 0')));
6662 if ((fragmentsToText(sub)) === (fragmentsToText(ref))) {
6663 return fragments;
6664 }
6665 fragments = sub.concat(this.makeCode(', '), fragments);
6666 if (o.level < LEVEL_LIST) {
6667 return fragments;
6668 } else {
6669 return this.wrapInBraces(fragments);
6670 }
6671 };
6672
6673 In.prototype.toString = function(idt) {
6674 return In.__super__.toString.call(this, idt, this.constructor.name + (this.negated ? '!' : ''));
6675 };
6676
6677 return In;
6678
6679 })(Base);
6680
6681 exports.Try = Try = (function(_super) {
6682 __extends(Try, _super);
6683
6684 function Try(attempt, errorVariable, recovery, ensure) {
6685 this.attempt = attempt;
6686 this.errorVariable = errorVariable;
6687 this.recovery = recovery;
6688 this.ensure = ensure;
6689 }
6690
6691 Try.prototype.children = ['attempt', 'recovery', 'ensure'];
6692
6693 Try.prototype.isStatement = YES;
6694
6695 Try.prototype.jumps = function(o) {
6696 var _ref4;
6697 return this.attempt.jumps(o) || ((_ref4 = this.recovery) != null ? _ref4.jumps(o) : void 0);
6698 };
6699
6700 Try.prototype.makeReturn = function(res) {
6701 if (this.attempt) {
6702 this.attempt = this.attempt.makeReturn(res);
6703 }
6704 if (this.recovery) {
6705 this.recovery = this.recovery.makeReturn(res);
6706 }
6707 return this;
6708 };
6709
6710 Try.prototype.compileNode = function(o) {
6711 var catchPart, ensurePart, placeholder, tryPart;
6712 o.indent += TAB;
6713 tryPart = this.attempt.compileToFragments(o, LEVEL_TOP);
6714 catchPart = this.recovery ? (placeholder = new Literal('_error'), this.errorVariable ? this.recovery.unshift(new Assign(this.errorVariable, placeholder)) : void 0, [].concat(this.makeCode(" catch ("), placeholder.compileToFragments(o), this.makeCode(") {\n"), this.recovery.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}"))) : !(this.ensure || this.recovery) ? [this.makeCode(' catch (_error) {}')] : [];
6715 ensurePart = this.ensure ? [].concat(this.makeCode(" finally {\n"), this.ensure.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}")) : [];
6716 return [].concat(this.makeCode("" + this.tab + "try {\n"), tryPart, this.makeCode("\n" + this.tab + "}"), catchPart, ensurePart);
6717 };
6718
6719 return Try;
6720
6721 })(Base);
6722
6723 exports.Throw = Throw = (function(_super) {
6724 __extends(Throw, _super);
6725
6726 function Throw(expression) {
6727 this.expression = expression;
6728 }
6729
6730 Throw.prototype.children = ['expression'];
6731
6732 Throw.prototype.isStatement = YES;
6733
6734 Throw.prototype.jumps = NO;
6735
6736 Throw.prototype.makeReturn = THIS;
6737
6738 Throw.prototype.compileNode = function(o) {
6739 return [].concat(this.makeCode(this.tab + "throw "), this.expression.compileToFragments(o), this.makeCode(";"));
6740 };
6741
6742 return Throw;
6743
6744 })(Base);
6745
6746 exports.Existence = Existence = (function(_super) {
6747 __extends(Existence, _super);
6748
6749 function Existence(expression) {
6750 this.expression = expression;
6751 }
6752
6753 Existence.prototype.children = ['expression'];
6754
6755 Existence.prototype.invert = NEGATE;
6756
6757 Existence.prototype.compileNode = function(o) {
6758 var cmp, cnj, code, _ref4;
6759 this.expression.front = this.front;
6760 code = this.expression.compile(o, LEVEL_OP);
6761 if (IDENTIFIER.test(code) && !o.scope.check(code)) {
6762 _ref4 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref4[0], cnj = _ref4[1];
6763 code = "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null";
6764 } else {
6765 code = "" + code + " " + (this.negated ? '==' : '!=') + " null";
6766 }
6767 return [this.makeCode(o.level <= LEVEL_COND ? code : "(" + code + ")")];
6768 };
6769
6770 return Existence;
6771
6772 })(Base);
6773
6774 exports.Parens = Parens = (function(_super) {
6775 __extends(Parens, _super);
6776
6777 function Parens(body) {
6778 this.body = body;
6779 }
6780
6781 Parens.prototype.children = ['body'];
6782
6783 Parens.prototype.unwrap = function() {
6784 return this.body;
6785 };
6786
6787 Parens.prototype.isComplex = function() {
6788 return this.body.isComplex();
6789 };
6790
6791 Parens.prototype.compileNode = function(o) {
6792 var bare, expr, fragments;
6793 expr = this.body.unwrap();
6794 if (expr instanceof Value && expr.isAtomic()) {
6795 expr.front = this.front;
6796 return expr.compileToFragments(o);
6797 }
6798 fragments = expr.compileToFragments(o, LEVEL_PAREN);
6799 bare = o.level < LEVEL_OP && (expr instanceof Op || expr instanceof Call || (expr instanceof For && expr.returns));
6800 if (bare) {
6801 return fragments;
6802 } else {
6803 return this.wrapInBraces(fragments);
6804 }
6805 };
6806
6807 return Parens;
6808
6809 })(Base);
6810
6811 exports.For = For = (function(_super) {
6812 __extends(For, _super);
6813
6814 function For(body, source) {
6815 var _ref4;
6816 this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index;
6817 this.body = Block.wrap([body]);
6818 this.own = !!source.own;
6819 this.object = !!source.object;
6820 if (this.object) {
6821 _ref4 = [this.index, this.name], this.name = _ref4[0], this.index = _ref4[1];
6822 }
6823 if (this.index instanceof Value) {
6824 this.index.error('index cannot be a pattern matching expression');
6825 }
6826 this.range = this.source instanceof Value && this.source.base instanceof Range && !this.source.properties.length;
6827 this.pattern = this.name instanceof Value;
6828 if (this.range && this.index) {
6829 this.index.error('indexes do not apply to range loops');
6830 }
6831 if (this.range && this.pattern) {
6832 this.name.error('cannot pattern match over range loops');
6833 }
6834 this.returns = false;
6835 }
6836
6837 For.prototype.children = ['body', 'source', 'guard', 'step'];
6838
6839 For.prototype.compileNode = function(o) {
6840 var body, bodyFragments, compare, compareDown, declare, declareDown, defPart, defPartFragments, down, forPartFragments, guardPart, idt1, increment, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, step, stepNum, stepVar, svar, varPart, _ref4, _ref5;
6841 body = Block.wrap([this.body]);
6842 lastJumps = (_ref4 = last(body.expressions)) != null ? _ref4.jumps() : void 0;
6843 if (lastJumps && lastJumps instanceof Return) {
6844 this.returns = false;
6845 }
6846 source = this.range ? this.source.base : this.source;
6847 scope = o.scope;
6848 name = this.name && (this.name.compile(o, LEVEL_LIST));
6849 index = this.index && (this.index.compile(o, LEVEL_LIST));
6850 if (name && !this.pattern) {
6851 scope.find(name);
6852 }
6853 if (index) {
6854 scope.find(index);
6855 }
6856 if (this.returns) {
6857 rvar = scope.freeVariable('results');
6858 }
6859 ivar = (this.object && index) || scope.freeVariable('i');
6860 kvar = (this.range && name) || index || ivar;
6861 kvarAssign = kvar !== ivar ? "" + kvar + " = " : "";
6862 if (this.step && !this.range) {
6863 _ref5 = this.cacheToCodeFragments(this.step.cache(o, LEVEL_LIST)), step = _ref5[0], stepVar = _ref5[1];
6864 stepNum = stepVar.match(SIMPLENUM);
6865 }
6866 if (this.pattern) {
6867 name = ivar;
6868 }
6869 varPart = '';
6870 guardPart = '';
6871 defPart = '';
6872 idt1 = this.tab + TAB;
6873 if (this.range) {
6874 forPartFragments = source.compileToFragments(merge(o, {
6875 index: ivar,
6876 name: name,
6877 step: this.step
6878 }));
6879 } else {
6880 svar = this.source.compile(o, LEVEL_LIST);
6881 if ((name || this.own) && !IDENTIFIER.test(svar)) {
6882 defPart += "" + this.tab + (ref = scope.freeVariable('ref')) + " = " + svar + ";\n";
6883 svar = ref;
6884 }
6885 if (name && !this.pattern) {
6886 namePart = "" + name + " = " + svar + "[" + kvar + "]";
6887 }
6888 if (!this.object) {
6889 if (step !== stepVar) {
6890 defPart += "" + this.tab + step + ";\n";
6891 }
6892 if (!(this.step && stepNum && (down = +stepNum < 0))) {
6893 lvar = scope.freeVariable('len');
6894 }
6895 declare = "" + kvarAssign + ivar + " = 0, " + lvar + " = " + svar + ".length";
6896 declareDown = "" + kvarAssign + ivar + " = " + svar + ".length - 1";
6897 compare = "" + ivar + " < " + lvar;
6898 compareDown = "" + ivar + " >= 0";
6899 if (this.step) {
6900 if (stepNum) {
6901 if (down) {
6902 compare = compareDown;
6903 declare = declareDown;
6904 }
6905 } else {
6906 compare = "" + stepVar + " > 0 ? " + compare + " : " + compareDown;
6907 declare = "(" + stepVar + " > 0 ? (" + declare + ") : " + declareDown + ")";
6908 }
6909 increment = "" + ivar + " += " + stepVar;
6910 } else {
6911 increment = "" + (kvar !== ivar ? "++" + ivar : "" + ivar + "++");
6912 }
6913 forPartFragments = [this.makeCode("" + declare + "; " + compare + "; " + kvarAssign + increment)];
6914 }
6915 }
6916 if (this.returns) {
6917 resultPart = "" + this.tab + rvar + " = [];\n";
6918 returnResult = "\n" + this.tab + "return " + rvar + ";";
6919 body.makeReturn(rvar);
6920 }
6921 if (this.guard) {
6922 if (body.expressions.length > 1) {
6923 body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue")));
6924 } else {
6925 if (this.guard) {
6926 body = Block.wrap([new If(this.guard, body)]);
6927 }
6928 }
6929 }
6930 if (this.pattern) {
6931 body.expressions.unshift(new Assign(this.name, new Literal("" + svar + "[" + kvar + "]")));
6932 }
6933 defPartFragments = [].concat(this.makeCode(defPart), this.pluckDirectCall(o, body));
6934 if (namePart) {
6935 varPart = "\n" + idt1 + namePart + ";";
6936 }
6937 if (this.object) {
6938 forPartFragments = [this.makeCode("" + kvar + " in " + svar)];
6939 if (this.own) {
6940 guardPart = "\n" + idt1 + "if (!" + (utility('hasProp')) + ".call(" + svar + ", " + kvar + ")) continue;";
6941 }
6942 }
6943 bodyFragments = body.compileToFragments(merge(o, {
6944 indent: idt1
6945 }), LEVEL_TOP);
6946 if (bodyFragments && (bodyFragments.length > 0)) {
6947 bodyFragments = [].concat(this.makeCode("\n"), bodyFragments, this.makeCode("\n"));
6948 }
6949 return [].concat(defPartFragments, this.makeCode("" + (resultPart || '') + this.tab + "for ("), forPartFragments, this.makeCode(") {" + guardPart + varPart), bodyFragments, this.makeCode("" + this.tab + "}" + (returnResult || '')));
6950 };
6951
6952 For.prototype.pluckDirectCall = function(o, body) {
6953 var base, defs, expr, fn, idx, ref, val, _i, _len, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
6954 defs = [];
6955 _ref4 = body.expressions;
6956 for (idx = _i = 0, _len = _ref4.length; _i < _len; idx = ++_i) {
6957 expr = _ref4[idx];
6958 expr = expr.unwrapAll();
6959 if (!(expr instanceof Call)) {
6960 continue;
6961 }
6962 val = expr.variable.unwrapAll();
6963 if (!((val instanceof Code) || (val instanceof Value && ((_ref5 = val.base) != null ? _ref5.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref6 = (_ref7 = val.properties[0].name) != null ? _ref7.value : void 0) === 'call' || _ref6 === 'apply')))) {
6964 continue;
6965 }
6966 fn = ((_ref8 = val.base) != null ? _ref8.unwrapAll() : void 0) || val;
6967 ref = new Literal(o.scope.freeVariable('fn'));
6968 base = new Value(ref);
6969 if (val.base) {
6970 _ref9 = [base, val], val.base = _ref9[0], base = _ref9[1];
6971 }
6972 body.expressions[idx] = new Call(base, expr.args);
6973 defs = defs.concat(this.makeCode(this.tab), new Assign(ref, fn).compileToFragments(o, LEVEL_TOP), this.makeCode(';\n'));
6974 }
6975 return defs;
6976 };
6977
6978 return For;
6979
6980 })(While);
6981
6982 exports.Switch = Switch = (function(_super) {
6983 __extends(Switch, _super);
6984
6985 function Switch(subject, cases, otherwise) {
6986 this.subject = subject;
6987 this.cases = cases;
6988 this.otherwise = otherwise;
6989 }
6990
6991 Switch.prototype.children = ['subject', 'cases', 'otherwise'];
6992
6993 Switch.prototype.isStatement = YES;
6994
6995 Switch.prototype.jumps = function(o) {
6996 var block, conds, _i, _len, _ref4, _ref5, _ref6;
6997 if (o == null) {
6998 o = {
6999 block: true
7000 };
7001 }
7002 _ref4 = this.cases;
7003 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
7004 _ref5 = _ref4[_i], conds = _ref5[0], block = _ref5[1];
7005 if (block.jumps(o)) {
7006 return block;
7007 }
7008 }
7009 return (_ref6 = this.otherwise) != null ? _ref6.jumps(o) : void 0;
7010 };
7011
7012 Switch.prototype.makeReturn = function(res) {
7013 var pair, _i, _len, _ref4, _ref5;
7014 _ref4 = this.cases;
7015 for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
7016 pair = _ref4[_i];
7017 pair[1].makeReturn(res);
7018 }
7019 if (res) {
7020 this.otherwise || (this.otherwise = new Block([new Literal('void 0')]));
7021 }
7022 if ((_ref5 = this.otherwise) != null) {
7023 _ref5.makeReturn(res);
7024 }
7025 return this;
7026 };
7027
7028 Switch.prototype.compileNode = function(o) {
7029 var block, body, cond, conditions, expr, fragments, i, idt1, idt2, _i, _j, _len, _len1, _ref4, _ref5, _ref6;
7030 idt1 = o.indent + TAB;
7031 idt2 = o.indent = idt1 + TAB;
7032 fragments = [].concat(this.makeCode(this.tab + "switch ("), (this.subject ? this.subject.compileToFragments(o, LEVEL_PAREN) : this.makeCode("false")), this.makeCode(") {\n"));
7033 _ref4 = this.cases;
7034 for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) {
7035 _ref5 = _ref4[i], conditions = _ref5[0], block = _ref5[1];
7036 _ref6 = flatten([conditions]);
7037 for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
7038 cond = _ref6[_j];
7039 if (!this.subject) {
7040 cond = cond.invert();
7041 }
7042 fragments = fragments.concat(this.makeCode(idt1 + "case "), cond.compileToFragments(o, LEVEL_PAREN), this.makeCode(":\n"));
7043 }
7044 if ((body = block.compileToFragments(o, LEVEL_TOP)).length > 0) {
7045 fragments = fragments.concat(body, this.makeCode('\n'));
7046 }
7047 if (i === this.cases.length - 1 && !this.otherwise) {
7048 break;
7049 }
7050 expr = this.lastNonComment(block.expressions);
7051 if (expr instanceof Return || (expr instanceof Literal && expr.jumps() && expr.value !== 'debugger')) {
7052 continue;
7053 }
7054 fragments.push(cond.makeCode(idt2 + 'break;\n'));
7055 }
7056 if (this.otherwise && this.otherwise.expressions.length) {
7057 fragments.push.apply(fragments, [this.makeCode(idt1 + "default:\n")].concat(__slice.call(this.otherwise.compileToFragments(o, LEVEL_TOP)), [this.makeCode("\n")]));
7058 }
7059 fragments.push(this.makeCode(this.tab + '}'));
7060 return fragments;
7061 };
7062
7063 return Switch;
7064
7065 })(Base);
7066
7067 exports.If = If = (function(_super) {
7068 __extends(If, _super);
7069
7070 function If(condition, body, options) {
7071 this.body = body;
7072 if (options == null) {
7073 options = {};
7074 }
7075 this.condition = options.type === 'unless' ? condition.invert() : condition;
7076 this.elseBody = null;
7077 this.isChain = false;
7078 this.soak = options.soak;
7079 }
7080
7081 If.prototype.children = ['condition', 'body', 'elseBody'];
7082
7083 If.prototype.bodyNode = function() {
7084 var _ref4;
7085 return (_ref4 = this.body) != null ? _ref4.unwrap() : void 0;
7086 };
7087
7088 If.prototype.elseBodyNode = function() {
7089 var _ref4;
7090 return (_ref4 = this.elseBody) != null ? _ref4.unwrap() : void 0;
7091 };
7092
7093 If.prototype.addElse = function(elseBody) {
7094 if (this.isChain) {
7095 this.elseBodyNode().addElse(elseBody);
7096 } else {
7097 this.isChain = elseBody instanceof If;
7098 this.elseBody = this.ensureBlock(elseBody);
7099 }
7100 return this;
7101 };
7102
7103 If.prototype.isStatement = function(o) {
7104 var _ref4;
7105 return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref4 = this.elseBodyNode()) != null ? _ref4.isStatement(o) : void 0);
7106 };
7107
7108 If.prototype.jumps = function(o) {
7109 var _ref4;
7110 return this.body.jumps(o) || ((_ref4 = this.elseBody) != null ? _ref4.jumps(o) : void 0);
7111 };
7112
7113 If.prototype.compileNode = function(o) {
7114 if (this.isStatement(o)) {
7115 return this.compileStatement(o);
7116 } else {
7117 return this.compileExpression(o);
7118 }
7119 };
7120
7121 If.prototype.makeReturn = function(res) {
7122 if (res) {
7123 this.elseBody || (this.elseBody = new Block([new Literal('void 0')]));
7124 }
7125 this.body && (this.body = new Block([this.body.makeReturn(res)]));
7126 this.elseBody && (this.elseBody = new Block([this.elseBody.makeReturn(res)]));
7127 return this;
7128 };
7129
7130 If.prototype.ensureBlock = function(node) {
7131 if (node instanceof Block) {
7132 return node;
7133 } else {
7134 return new Block([node]);
7135 }
7136 };
7137
7138 If.prototype.compileStatement = function(o) {
7139 var answer, body, child, cond, exeq, ifPart, indent;
7140 child = del(o, 'chainChild');
7141 exeq = del(o, 'isExistentialEquals');
7142 if (exeq) {
7143 return new If(this.condition.invert(), this.elseBodyNode(), {
7144 type: 'if'
7145 }).compileToFragments(o);
7146 }
7147 indent = o.indent + TAB;
7148 cond = this.condition.compileToFragments(o, LEVEL_PAREN);
7149 body = this.ensureBlock(this.body).compileToFragments(merge(o, {
7150 indent: indent
7151 }));
7152 ifPart = [].concat(this.makeCode("if ("), cond, this.makeCode(") {\n"), body, this.makeCode("\n" + this.tab + "}"));
7153 if (!child) {
7154 ifPart.unshift(this.makeCode(this.tab));
7155 }
7156 if (!this.elseBody) {
7157 return ifPart;
7158 }
7159 answer = ifPart.concat(this.makeCode(' else '));
7160 if (this.isChain) {
7161 o.chainChild = true;
7162 answer = answer.concat(this.elseBody.unwrap().compileToFragments(o, LEVEL_TOP));
7163 } else {
7164 answer = answer.concat(this.makeCode("{\n"), this.elseBody.compileToFragments(merge(o, {
7165 indent: indent
7166 }), LEVEL_TOP), this.makeCode("\n" + this.tab + "}"));
7167 }
7168 return answer;
7169 };
7170
7171 If.prototype.compileExpression = function(o) {
7172 var alt, body, cond, fragments;
7173 cond = this.condition.compileToFragments(o, LEVEL_COND);
7174 body = this.bodyNode().compileToFragments(o, LEVEL_LIST);
7175 alt = this.elseBodyNode() ? this.elseBodyNode().compileToFragments(o, LEVEL_LIST) : [this.makeCode('void 0')];
7176 fragments = cond.concat(this.makeCode(" ? "), body, this.makeCode(" : "), alt);
7177 if (o.level >= LEVEL_COND) {
7178 return this.wrapInBraces(fragments);
7179 } else {
7180 return fragments;
7181 }
7182 };
7183
7184 If.prototype.unfoldSoak = function() {
7185 return this.soak && this;
7186 };
7187
7188 return If;
7189
7190 })(Base);
7191
7192 Closure = {
7193 wrap: function(expressions, statement, noReturn) {
7194 var args, argumentsNode, call, func, meth;
7195 if (expressions.jumps()) {
7196 return expressions;
7197 }
7198 func = new Code([], Block.wrap([expressions]));
7199 args = [];
7200 argumentsNode = expressions.contains(this.isLiteralArguments);
7201 if (argumentsNode && expressions.classBody) {
7202 argumentsNode.error("Class bodies shouldn't reference arguments");
7203 }
7204 if (argumentsNode || expressions.contains(this.isLiteralThis)) {
7205 meth = new Literal(argumentsNode ? 'apply' : 'call');
7206 args = [new Literal('this')];
7207 if (argumentsNode) {
7208 args.push(new Literal('arguments'));
7209 }
7210 func = new Value(func, [new Access(meth)]);
7211 }
7212 func.noReturn = noReturn;
7213 call = new Call(func, args);
7214 if (statement) {
7215 return Block.wrap([call]);
7216 } else {
7217 return call;
7218 }
7219 },
7220 isLiteralArguments: function(node) {
7221 return node instanceof Literal && node.value === 'arguments' && !node.asKey;
7222 },
7223 isLiteralThis: function(node) {
7224 return (node instanceof Literal && node.value === 'this' && !node.asKey) || (node instanceof Code && node.bound) || (node instanceof Call && node.isSuper);
7225 }
7226 };
7227
7228 unfoldSoak = function(o, parent, name) {
7229 var ifn;
7230 if (!(ifn = parent[name].unfoldSoak(o))) {
7231 return;
7232 }
7233 parent[name] = ifn.body;
7234 ifn.body = new Value(parent);
7235 return ifn;
7236 };
7237
7238 UTILITIES = {
7239 "extends": function() {
7240 return "function(child, parent) { for (var key in parent) { if (" + (utility('hasProp')) + ".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }";
7241 },
7242 bind: function() {
7243 return 'function(fn, me){ return function(){ return fn.apply(me, arguments); }; }';
7244 },
7245 indexOf: function() {
7246 return "[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }";
7247 },
7248 hasProp: function() {
7249 return '{}.hasOwnProperty';
7250 },
7251 slice: function() {
7252 return '[].slice';
7253 }
7254 };
7255
7256 LEVEL_TOP = 1;
7257
7258 LEVEL_PAREN = 2;
7259
7260 LEVEL_LIST = 3;
7261
7262 LEVEL_COND = 4;
7263
7264 LEVEL_OP = 5;
7265
7266 LEVEL_ACCESS = 6;
7267
7268 TAB = ' ';
7269
7270 IDENTIFIER_STR = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
7271
7272 IDENTIFIER = RegExp("^" + IDENTIFIER_STR + "$");
7273
7274 SIMPLENUM = /^[+-]?\d+$/;
7275
7276 METHOD_DEF = RegExp("^(?:(" + IDENTIFIER_STR + ")\\.prototype(?:\\.(" + IDENTIFIER_STR + ")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\]))|(" + IDENTIFIER_STR + ")$");
7277
7278 IS_STRING = /^['"]/;
7279
7280 utility = function(name) {
7281 var ref;
7282 ref = "__" + name;
7283 Scope.root.assign(ref, UTILITIES[name]());
7284 return ref;
7285 };
7286
7287 multident = function(code, tab) {
7288 code = code.replace(/\n/g, '$&' + tab);
7289 return code.replace(/\s+$/, '');
7290 };
7291
7292
7293 });
7294
7295 define('ace/mode/coffee/scope', ['require', 'exports', 'module' , 'ace/mode/coffee/helpers'], function(require, exports, module) {
7296
7297 var Scope, extend, last, _ref;
7298
7299 _ref = require('./helpers'), extend = _ref.extend, last = _ref.last;
7300
7301 exports.Scope = Scope = (function() {
7302 Scope.root = null;
7303
7304 function Scope(parent, expressions, method) {
7305 this.parent = parent;
7306 this.expressions = expressions;
7307 this.method = method;
7308 this.variables = [
7309 {
7310 name: 'arguments',
7311 type: 'arguments'
7312 }
7313 ];
7314 this.positions = {};
7315 if (!this.parent) {
7316 Scope.root = this;
7317 }
7318 }
7319
7320 Scope.prototype.add = function(name, type, immediate) {
7321 if (this.shared && !immediate) {
7322 return this.parent.add(name, type, immediate);
7323 }
7324 if (Object.prototype.hasOwnProperty.call(this.positions, name)) {
7325 return this.variables[this.positions[name]].type = type;
7326 } else {
7327 return this.positions[name] = this.variables.push({
7328 name: name,
7329 type: type
7330 }) - 1;
7331 }
7332 };
7333
7334 Scope.prototype.namedMethod = function() {
7335 var _ref1;
7336 if (((_ref1 = this.method) != null ? _ref1.name : void 0) || !this.parent) {
7337 return this.method;
7338 }
7339 return this.parent.namedMethod();
7340 };
7341
7342 Scope.prototype.find = function(name) {
7343 if (this.check(name)) {
7344 return true;
7345 }
7346 this.add(name, 'var');
7347 return false;
7348 };
7349
7350 Scope.prototype.parameter = function(name) {
7351 if (this.shared && this.parent.check(name, true)) {
7352 return;
7353 }
7354 return this.add(name, 'param');
7355 };
7356
7357 Scope.prototype.check = function(name) {
7358 var _ref1;
7359 return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0));
7360 };
7361
7362 Scope.prototype.temporary = function(name, index) {
7363 if (name.length > 1) {
7364 return '_' + name + (index > 1 ? index - 1 : '');
7365 } else {
7366 return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a');
7367 }
7368 };
7369
7370 Scope.prototype.type = function(name) {
7371 var v, _i, _len, _ref1;
7372 _ref1 = this.variables;
7373 for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
7374 v = _ref1[_i];
7375 if (v.name === name) {
7376 return v.type;
7377 }
7378 }
7379 return null;
7380 };
7381
7382 Scope.prototype.freeVariable = function(name, reserve) {
7383 var index, temp;
7384 if (reserve == null) {
7385 reserve = true;
7386 }
7387 index = 0;
7388 while (this.check((temp = this.temporary(name, index)))) {
7389 index++;
7390 }
7391 if (reserve) {
7392 this.add(temp, 'var', true);
7393 }
7394 return temp;
7395 };
7396
7397 Scope.prototype.assign = function(name, value) {
7398 this.add(name, {
7399 value: value,
7400 assigned: true
7401 }, true);
7402 return this.hasAssignments = true;
7403 };
7404
7405 Scope.prototype.hasDeclarations = function() {
7406 return !!this.declaredVariables().length;
7407 };
7408
7409 Scope.prototype.declaredVariables = function() {
7410 var realVars, tempVars, v, _i, _len, _ref1;
7411 realVars = [];
7412 tempVars = [];
7413 _ref1 = this.variables;
7414 for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
7415 v = _ref1[_i];
7416 if (v.type === 'var') {
7417 (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name);
7418 }
7419 }
7420 return realVars.sort().concat(tempVars.sort());
7421 };
7422
7423 Scope.prototype.assignedVariables = function() {
7424 var v, _i, _len, _ref1, _results;
7425 _ref1 = this.variables;
7426 _results = [];
7427 for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
7428 v = _ref1[_i];
7429 if (v.type.assigned) {
7430 _results.push("" + v.name + " = " + v.type.value);
7431 }
7432 }
7433 return _results;
7434 };
7435
7436 return Scope;
7437
7438 })();
7439
7440
7441 });
+0
-8240
try/ace/worker-css.js less more
0 "no use strict";
1 ;(function(window) {
2 if (typeof window.window != "undefined" && window.document) {
3 return;
4 }
5
6 window.console = {
7 log: function() {
8 var msgs = Array.prototype.slice.call(arguments, 0);
9 postMessage({type: "log", data: msgs});
10 },
11 error: function() {
12 var msgs = Array.prototype.slice.call(arguments, 0);
13 postMessage({type: "log", data: msgs});
14 }
15 };
16 window.window = window;
17 window.ace = window;
18
19 window.normalizeModule = function(parentId, moduleName) {
20 if (moduleName.indexOf("!") !== -1) {
21 var chunks = moduleName.split("!");
22 return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
23 }
24 if (moduleName.charAt(0) == ".") {
25 var base = parentId.split("/").slice(0, -1).join("/");
26 moduleName = base + "/" + moduleName;
27
28 while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
29 var previous = moduleName;
30 moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
31 }
32 }
33
34 return moduleName;
35 };
36
37 window.require = function(parentId, id) {
38 if (!id) {
39 id = parentId
40 parentId = null;
41 }
42 if (!id.charAt)
43 throw new Error("worker.js require() accepts only (parentId, id) as arguments");
44
45 id = normalizeModule(parentId, id);
46
47 var module = require.modules[id];
48 if (module) {
49 if (!module.initialized) {
50 module.initialized = true;
51 module.exports = module.factory().exports;
52 }
53 return module.exports;
54 }
55
56 var chunks = id.split("/");
57 chunks[0] = require.tlns[chunks[0]] || chunks[0];
58 var path = chunks.join("/") + ".js";
59
60 require.id = id;
61 importScripts(path);
62 return require(parentId, id);
63 };
64
65 require.modules = {};
66 require.tlns = {};
67
68 window.define = function(id, deps, factory) {
69 if (arguments.length == 2) {
70 factory = deps;
71 if (typeof id != "string") {
72 deps = id;
73 id = require.id;
74 }
75 } else if (arguments.length == 1) {
76 factory = id;
77 id = require.id;
78 }
79
80 if (id.indexOf("text!") === 0)
81 return;
82
83 var req = function(deps, factory) {
84 return require(id, deps, factory);
85 };
86
87 require.modules[id] = {
88 factory: function() {
89 var module = {
90 exports: {}
91 };
92 var returnExports = factory(req, module.exports, module);
93 if (returnExports)
94 module.exports = returnExports;
95 return module;
96 }
97 };
98 };
99
100 window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
101 require.tlns = topLevelNamespaces;
102 }
103
104 window.initSender = function initSender() {
105
106 var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
107 var oop = require("ace/lib/oop");
108
109 var Sender = function() {};
110
111 (function() {
112
113 oop.implement(this, EventEmitter);
114
115 this.callback = function(data, callbackId) {
116 postMessage({
117 type: "call",
118 id: callbackId,
119 data: data
120 });
121 };
122
123 this.emit = function(name, data) {
124 postMessage({
125 type: "event",
126 name: name,
127 data: data
128 });
129 };
130
131 }).call(Sender.prototype);
132
133 return new Sender();
134 }
135
136 window.main = null;
137 window.sender = null;
138
139 window.onmessage = function(e) {
140 var msg = e.data;
141 if (msg.command) {
142 if (main[msg.command])
143 main[msg.command].apply(main, msg.args);
144 else
145 throw new Error("Unknown command:" + msg.command);
146 }
147 else if (msg.init) {
148 initBaseUrls(msg.tlns);
149 require("ace/lib/es5-shim");
150 sender = initSender();
151 var clazz = require(msg.module)[msg.classname];
152 main = new clazz(sender);
153 }
154 else if (msg.event && sender) {
155 sender._emit(msg.event, msg.data);
156 }
157 };
158 })(this);
159
160 define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
161
162
163 var EventEmitter = {};
164 var stopPropagation = function() { this.propagationStopped = true; };
165 var preventDefault = function() { this.defaultPrevented = true; };
166
167 EventEmitter._emit =
168 EventEmitter._dispatchEvent = function(eventName, e) {
169 this._eventRegistry || (this._eventRegistry = {});
170 this._defaultHandlers || (this._defaultHandlers = {});
171
172 var listeners = this._eventRegistry[eventName] || [];
173 var defaultHandler = this._defaultHandlers[eventName];
174 if (!listeners.length && !defaultHandler)
175 return;
176
177 if (typeof e != "object" || !e)
178 e = {};
179
180 if (!e.type)
181 e.type = eventName;
182 if (!e.stopPropagation)
183 e.stopPropagation = stopPropagation;
184 if (!e.preventDefault)
185 e.preventDefault = preventDefault;
186
187 for (var i=0; i<listeners.length; i++) {
188 listeners[i](e, this);
189 if (e.propagationStopped)
190 break;
191 }
192
193 if (defaultHandler && !e.defaultPrevented)
194 return defaultHandler(e, this);
195 };
196
197
198 EventEmitter._signal = function(eventName, e) {
199 var listeners = (this._eventRegistry || {})[eventName];
200 if (!listeners)
201 return;
202
203 for (var i=0; i<listeners.length; i++)
204 listeners[i](e, this);
205 };
206
207 EventEmitter.once = function(eventName, callback) {
208 var _self = this;
209 callback && this.addEventListener(eventName, function newCallback() {
210 _self.removeEventListener(eventName, newCallback);
211 callback.apply(null, arguments);
212 });
213 };
214
215
216 EventEmitter.setDefaultHandler = function(eventName, callback) {
217 var handlers = this._defaultHandlers
218 if (!handlers)
219 handlers = this._defaultHandlers = {_disabled_: {}};
220
221 if (handlers[eventName]) {
222 var old = handlers[eventName];
223 var disabled = handlers._disabled_[eventName];
224 if (!disabled)
225 handlers._disabled_[eventName] = disabled = [];
226 disabled.push(old);
227 var i = disabled.indexOf(callback);
228 if (i != -1)
229 disabled.splice(i, 1);
230 }
231 handlers[eventName] = callback;
232 };
233 EventEmitter.removeDefaultHandler = function(eventName, callback) {
234 var handlers = this._defaultHandlers
235 if (!handlers)
236 return;
237 var disabled = handlers._disabled_[eventName];
238
239 if (handlers[eventName] == callback) {
240 var old = handlers[eventName];
241 if (disabled)
242 this.setDefaultHandler(eventName, disabled.pop());
243 } else if (disabled) {
244 var i = disabled.indexOf(callback);
245 if (i != -1)
246 disabled.splice(i, 1);
247 }
248 };
249
250 EventEmitter.on =
251 EventEmitter.addEventListener = function(eventName, callback, capturing) {
252 this._eventRegistry = this._eventRegistry || {};
253
254 var listeners = this._eventRegistry[eventName];
255 if (!listeners)
256 listeners = this._eventRegistry[eventName] = [];
257
258 if (listeners.indexOf(callback) == -1)
259 listeners[capturing ? "unshift" : "push"](callback);
260 return callback;
261 };
262
263 EventEmitter.off =
264 EventEmitter.removeListener =
265 EventEmitter.removeEventListener = function(eventName, callback) {
266 this._eventRegistry = this._eventRegistry || {};
267
268 var listeners = this._eventRegistry[eventName];
269 if (!listeners)
270 return;
271
272 var index = listeners.indexOf(callback);
273 if (index !== -1)
274 listeners.splice(index, 1);
275 };
276
277 EventEmitter.removeAllListeners = function(eventName) {
278 if (this._eventRegistry) this._eventRegistry[eventName] = [];
279 };
280
281 exports.EventEmitter = EventEmitter;
282
283 });
284
285 define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
286
287
288 exports.inherits = (function() {
289 var tempCtor = function() {};
290 return function(ctor, superCtor) {
291 tempCtor.prototype = superCtor.prototype;
292 ctor.super_ = superCtor.prototype;
293 ctor.prototype = new tempCtor();
294 ctor.prototype.constructor = ctor;
295 };
296 }());
297
298 exports.mixin = function(obj, mixin) {
299 for (var key in mixin) {
300 obj[key] = mixin[key];
301 }
302 return obj;
303 };
304
305 exports.implement = function(proto, mixin) {
306 exports.mixin(proto, mixin);
307 };
308
309 });
310
311 define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) {
312
313 function Empty() {}
314
315 if (!Function.prototype.bind) {
316 Function.prototype.bind = function bind(that) { // .length is 1
317 var target = this;
318 if (typeof target != "function") {
319 throw new TypeError("Function.prototype.bind called on incompatible " + target);
320 }
321 var args = slice.call(arguments, 1); // for normal call
322 var bound = function () {
323
324 if (this instanceof bound) {
325
326 var result = target.apply(
327 this,
328 args.concat(slice.call(arguments))
329 );
330 if (Object(result) === result) {
331 return result;
332 }
333 return this;
334
335 } else {
336 return target.apply(
337 that,
338 args.concat(slice.call(arguments))
339 );
340
341 }
342
343 };
344 if(target.prototype) {
345 Empty.prototype = target.prototype;
346 bound.prototype = new Empty();
347 Empty.prototype = null;
348 }
349 return bound;
350 };
351 }
352 var call = Function.prototype.call;
353 var prototypeOfArray = Array.prototype;
354 var prototypeOfObject = Object.prototype;
355 var slice = prototypeOfArray.slice;
356 var _toString = call.bind(prototypeOfObject.toString);
357 var owns = call.bind(prototypeOfObject.hasOwnProperty);
358 var defineGetter;
359 var defineSetter;
360 var lookupGetter;
361 var lookupSetter;
362 var supportsAccessors;
363 if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
364 defineGetter = call.bind(prototypeOfObject.__defineGetter__);
365 defineSetter = call.bind(prototypeOfObject.__defineSetter__);
366 lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
367 lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
368 }
369 if ([1,2].splice(0).length != 2) {
370 if(function() { // test IE < 9 to splice bug - see issue #138
371 function makeArray(l) {
372 var a = new Array(l+2);
373 a[0] = a[1] = 0;
374 return a;
375 }
376 var array = [], lengthBefore;
377
378 array.splice.apply(array, makeArray(20));
379 array.splice.apply(array, makeArray(26));
380
381 lengthBefore = array.length; //46
382 array.splice(5, 0, "XXX"); // add one element
383
384 lengthBefore + 1 == array.length
385
386 if (lengthBefore + 1 == array.length) {
387 return true;// has right splice implementation without bugs
388 }
389 }()) {//IE 6/7
390 var array_splice = Array.prototype.splice;
391 Array.prototype.splice = function(start, deleteCount) {
392 if (!arguments.length) {
393 return [];
394 } else {
395 return array_splice.apply(this, [
396 start === void 0 ? 0 : start,
397 deleteCount === void 0 ? (this.length - start) : deleteCount
398 ].concat(slice.call(arguments, 2)))
399 }
400 };
401 } else {//IE8
402 Array.prototype.splice = function(pos, removeCount){
403 var length = this.length;
404 if (pos > 0) {
405 if (pos > length)
406 pos = length;
407 } else if (pos == void 0) {
408 pos = 0;
409 } else if (pos < 0) {
410 pos = Math.max(length + pos, 0);
411 }
412
413 if (!(pos+removeCount < length))
414 removeCount = length - pos;
415
416 var removed = this.slice(pos, pos+removeCount);
417 var insert = slice.call(arguments, 2);
418 var add = insert.length;
419 if (pos === length) {
420 if (add) {
421 this.push.apply(this, insert);
422 }
423 } else {
424 var remove = Math.min(removeCount, length - pos);
425 var tailOldPos = pos + remove;
426 var tailNewPos = tailOldPos + add - remove;
427 var tailCount = length - tailOldPos;
428 var lengthAfterRemove = length - remove;
429
430 if (tailNewPos < tailOldPos) { // case A
431 for (var i = 0; i < tailCount; ++i) {
432 this[tailNewPos+i] = this[tailOldPos+i];
433 }
434 } else if (tailNewPos > tailOldPos) { // case B
435 for (i = tailCount; i--; ) {
436 this[tailNewPos+i] = this[tailOldPos+i];
437 }
438 } // else, add == remove (nothing to do)
439
440 if (add && pos === lengthAfterRemove) {
441 this.length = lengthAfterRemove; // truncate array
442 this.push.apply(this, insert);
443 } else {
444 this.length = lengthAfterRemove + add; // reserves space
445 for (i = 0; i < add; ++i) {
446 this[pos+i] = insert[i];
447 }
448 }
449 }
450 return removed;
451 };
452 }
453 }
454 if (!Array.isArray) {
455 Array.isArray = function isArray(obj) {
456 return _toString(obj) == "[object Array]";
457 };
458 }
459 var boxedString = Object("a"),
460 splitString = boxedString[0] != "a" || !(0 in boxedString);
461
462 if (!Array.prototype.forEach) {
463 Array.prototype.forEach = function forEach(fun /*, thisp*/) {
464 var object = toObject(this),
465 self = splitString && _toString(this) == "[object String]" ?
466 this.split("") :
467 object,
468 thisp = arguments[1],
469 i = -1,
470 length = self.length >>> 0;
471 if (_toString(fun) != "[object Function]") {
472 throw new TypeError(); // TODO message
473 }
474
475 while (++i < length) {
476 if (i in self) {
477 fun.call(thisp, self[i], i, object);
478 }
479 }
480 };
481 }
482 if (!Array.prototype.map) {
483 Array.prototype.map = function map(fun /*, thisp*/) {
484 var object = toObject(this),
485 self = splitString && _toString(this) == "[object String]" ?
486 this.split("") :
487 object,
488 length = self.length >>> 0,
489 result = Array(length),
490 thisp = arguments[1];
491 if (_toString(fun) != "[object Function]") {
492 throw new TypeError(fun + " is not a function");
493 }
494
495 for (var i = 0; i < length; i++) {
496 if (i in self)
497 result[i] = fun.call(thisp, self[i], i, object);
498 }
499 return result;
500 };
501 }
502 if (!Array.prototype.filter) {
503 Array.prototype.filter = function filter(fun /*, thisp */) {
504 var object = toObject(this),
505 self = splitString && _toString(this) == "[object String]" ?
506 this.split("") :
507 object,
508 length = self.length >>> 0,
509 result = [],
510 value,
511 thisp = arguments[1];
512 if (_toString(fun) != "[object Function]") {
513 throw new TypeError(fun + " is not a function");
514 }
515
516 for (var i = 0; i < length; i++) {
517 if (i in self) {
518 value = self[i];
519 if (fun.call(thisp, value, i, object)) {
520 result.push(value);
521 }
522 }
523 }
524 return result;
525 };
526 }
527 if (!Array.prototype.every) {
528 Array.prototype.every = function every(fun /*, thisp */) {
529 var object = toObject(this),
530 self = splitString && _toString(this) == "[object String]" ?
531 this.split("") :
532 object,
533 length = self.length >>> 0,
534 thisp = arguments[1];
535 if (_toString(fun) != "[object Function]") {
536 throw new TypeError(fun + " is not a function");
537 }
538
539 for (var i = 0; i < length; i++) {
540 if (i in self && !fun.call(thisp, self[i], i, object)) {
541 return false;
542 }
543 }
544 return true;
545 };
546 }
547 if (!Array.prototype.some) {
548 Array.prototype.some = function some(fun /*, thisp */) {
549 var object = toObject(this),
550 self = splitString && _toString(this) == "[object String]" ?
551 this.split("") :
552 object,
553 length = self.length >>> 0,
554 thisp = arguments[1];
555 if (_toString(fun) != "[object Function]") {
556 throw new TypeError(fun + " is not a function");
557 }
558
559 for (var i = 0; i < length; i++) {
560 if (i in self && fun.call(thisp, self[i], i, object)) {
561 return true;
562 }
563 }
564 return false;
565 };
566 }
567 if (!Array.prototype.reduce) {
568 Array.prototype.reduce = function reduce(fun /*, initial*/) {
569 var object = toObject(this),
570 self = splitString && _toString(this) == "[object String]" ?
571 this.split("") :
572 object,
573 length = self.length >>> 0;
574 if (_toString(fun) != "[object Function]") {
575 throw new TypeError(fun + " is not a function");
576 }
577 if (!length && arguments.length == 1) {
578 throw new TypeError("reduce of empty array with no initial value");
579 }
580
581 var i = 0;
582 var result;
583 if (arguments.length >= 2) {
584 result = arguments[1];
585 } else {
586 do {
587 if (i in self) {
588 result = self[i++];
589 break;
590 }
591 if (++i >= length) {
592 throw new TypeError("reduce of empty array with no initial value");
593 }
594 } while (true);
595 }
596
597 for (; i < length; i++) {
598 if (i in self) {
599 result = fun.call(void 0, result, self[i], i, object);
600 }
601 }
602
603 return result;
604 };
605 }
606 if (!Array.prototype.reduceRight) {
607 Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
608 var object = toObject(this),
609 self = splitString && _toString(this) == "[object String]" ?
610 this.split("") :
611 object,
612 length = self.length >>> 0;
613 if (_toString(fun) != "[object Function]") {
614 throw new TypeError(fun + " is not a function");
615 }
616 if (!length && arguments.length == 1) {
617 throw new TypeError("reduceRight of empty array with no initial value");
618 }
619
620 var result, i = length - 1;
621 if (arguments.length >= 2) {
622 result = arguments[1];
623 } else {
624 do {
625 if (i in self) {
626 result = self[i--];
627 break;
628 }
629 if (--i < 0) {
630 throw new TypeError("reduceRight of empty array with no initial value");
631 }
632 } while (true);
633 }
634
635 do {
636 if (i in this) {
637 result = fun.call(void 0, result, self[i], i, object);
638 }
639 } while (i--);
640
641 return result;
642 };
643 }
644 if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
645 Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
646 var self = splitString && _toString(this) == "[object String]" ?
647 this.split("") :
648 toObject(this),
649 length = self.length >>> 0;
650
651 if (!length) {
652 return -1;
653 }
654
655 var i = 0;
656 if (arguments.length > 1) {
657 i = toInteger(arguments[1]);
658 }
659 i = i >= 0 ? i : Math.max(0, length + i);
660 for (; i < length; i++) {
661 if (i in self && self[i] === sought) {
662 return i;
663 }
664 }
665 return -1;
666 };
667 }
668 if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
669 Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
670 var self = splitString && _toString(this) == "[object String]" ?
671 this.split("") :
672 toObject(this),
673 length = self.length >>> 0;
674
675 if (!length) {
676 return -1;
677 }
678 var i = length - 1;
679 if (arguments.length > 1) {
680 i = Math.min(i, toInteger(arguments[1]));
681 }
682 i = i >= 0 ? i : length - Math.abs(i);
683 for (; i >= 0; i--) {
684 if (i in self && sought === self[i]) {
685 return i;
686 }
687 }
688 return -1;
689 };
690 }
691 if (!Object.getPrototypeOf) {
692 Object.getPrototypeOf = function getPrototypeOf(object) {
693 return object.__proto__ || (
694 object.constructor ?
695 object.constructor.prototype :
696 prototypeOfObject
697 );
698 };
699 }
700 if (!Object.getOwnPropertyDescriptor) {
701 var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
702 "non-object: ";
703 Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
704 if ((typeof object != "object" && typeof object != "function") || object === null)
705 throw new TypeError(ERR_NON_OBJECT + object);
706 if (!owns(object, property))
707 return;
708
709 var descriptor, getter, setter;
710 descriptor = { enumerable: true, configurable: true };
711 if (supportsAccessors) {
712 var prototype = object.__proto__;
713 object.__proto__ = prototypeOfObject;
714
715 var getter = lookupGetter(object, property);
716 var setter = lookupSetter(object, property);
717 object.__proto__ = prototype;
718
719 if (getter || setter) {
720 if (getter) descriptor.get = getter;
721 if (setter) descriptor.set = setter;
722 return descriptor;
723 }
724 }
725 descriptor.value = object[property];
726 return descriptor;
727 };
728 }
729 if (!Object.getOwnPropertyNames) {
730 Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
731 return Object.keys(object);
732 };
733 }
734 if (!Object.create) {
735 var createEmpty;
736 if (Object.prototype.__proto__ === null) {
737 createEmpty = function () {
738 return { "__proto__": null };
739 };
740 } else {
741 createEmpty = function () {
742 var empty = {};
743 for (var i in empty)
744 empty[i] = null;
745 empty.constructor =
746 empty.hasOwnProperty =
747 empty.propertyIsEnumerable =
748 empty.isPrototypeOf =
749 empty.toLocaleString =
750 empty.toString =
751 empty.valueOf =
752 empty.__proto__ = null;
753 return empty;
754 }
755 }
756
757 Object.create = function create(prototype, properties) {
758 var object;
759 if (prototype === null) {
760 object = createEmpty();
761 } else {
762 if (typeof prototype != "object")
763 throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
764 var Type = function () {};
765 Type.prototype = prototype;
766 object = new Type();
767 object.__proto__ = prototype;
768 }
769 if (properties !== void 0)
770 Object.defineProperties(object, properties);
771 return object;
772 };
773 }
774
775 function doesDefinePropertyWork(object) {
776 try {
777 Object.defineProperty(object, "sentinel", {});
778 return "sentinel" in object;
779 } catch (exception) {
780 }
781 }
782 if (Object.defineProperty) {
783 var definePropertyWorksOnObject = doesDefinePropertyWork({});
784 var definePropertyWorksOnDom = typeof document == "undefined" ||
785 doesDefinePropertyWork(document.createElement("div"));
786 if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
787 var definePropertyFallback = Object.defineProperty;
788 }
789 }
790
791 if (!Object.defineProperty || definePropertyFallback) {
792 var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
793 var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
794 var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
795 "on this javascript engine";
796
797 Object.defineProperty = function defineProperty(object, property, descriptor) {
798 if ((typeof object != "object" && typeof object != "function") || object === null)
799 throw new TypeError(ERR_NON_OBJECT_TARGET + object);
800 if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
801 throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
802 if (definePropertyFallback) {
803 try {
804 return definePropertyFallback.call(Object, object, property, descriptor);
805 } catch (exception) {
806 }
807 }
808 if (owns(descriptor, "value")) {
809
810 if (supportsAccessors && (lookupGetter(object, property) ||
811 lookupSetter(object, property)))
812 {
813 var prototype = object.__proto__;
814 object.__proto__ = prototypeOfObject;
815 delete object[property];
816 object[property] = descriptor.value;
817 object.__proto__ = prototype;
818 } else {
819 object[property] = descriptor.value;
820 }
821 } else {
822 if (!supportsAccessors)
823 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
824 if (owns(descriptor, "get"))
825 defineGetter(object, property, descriptor.get);
826 if (owns(descriptor, "set"))
827 defineSetter(object, property, descriptor.set);
828 }
829
830 return object;
831 };
832 }
833 if (!Object.defineProperties) {
834 Object.defineProperties = function defineProperties(object, properties) {
835 for (var property in properties) {
836 if (owns(properties, property))
837 Object.defineProperty(object, property, properties[property]);
838 }
839 return object;
840 };
841 }
842 if (!Object.seal) {
843 Object.seal = function seal(object) {
844 return object;
845 };
846 }
847 if (!Object.freeze) {
848 Object.freeze = function freeze(object) {
849 return object;
850 };
851 }
852 try {
853 Object.freeze(function () {});
854 } catch (exception) {
855 Object.freeze = (function freeze(freezeObject) {
856 return function freeze(object) {
857 if (typeof object == "function") {
858 return object;
859 } else {
860 return freezeObject(object);
861 }
862 };
863 })(Object.freeze);
864 }
865 if (!Object.preventExtensions) {
866 Object.preventExtensions = function preventExtensions(object) {
867 return object;
868 };
869 }
870 if (!Object.isSealed) {
871 Object.isSealed = function isSealed(object) {
872 return false;
873 };
874 }
875 if (!Object.isFrozen) {
876 Object.isFrozen = function isFrozen(object) {
877 return false;
878 };
879 }
880 if (!Object.isExtensible) {
881 Object.isExtensible = function isExtensible(object) {
882 if (Object(object) === object) {
883 throw new TypeError(); // TODO message
884 }
885 var name = '';
886 while (owns(object, name)) {
887 name += '?';
888 }
889 object[name] = true;
890 var returnValue = owns(object, name);
891 delete object[name];
892 return returnValue;
893 };
894 }
895 if (!Object.keys) {
896 var hasDontEnumBug = true,
897 dontEnums = [
898 "toString",
899 "toLocaleString",
900 "valueOf",
901 "hasOwnProperty",
902 "isPrototypeOf",
903 "propertyIsEnumerable",
904 "constructor"
905 ],
906 dontEnumsLength = dontEnums.length;
907
908 for (var key in {"toString": null}) {
909 hasDontEnumBug = false;
910 }
911
912 Object.keys = function keys(object) {
913
914 if (
915 (typeof object != "object" && typeof object != "function") ||
916 object === null
917 ) {
918 throw new TypeError("Object.keys called on a non-object");
919 }
920
921 var keys = [];
922 for (var name in object) {
923 if (owns(object, name)) {
924 keys.push(name);
925 }
926 }
927
928 if (hasDontEnumBug) {
929 for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
930 var dontEnum = dontEnums[i];
931 if (owns(object, dontEnum)) {
932 keys.push(dontEnum);
933 }
934 }
935 }
936 return keys;
937 };
938
939 }
940 if (!Date.now) {
941 Date.now = function now() {
942 return new Date().getTime();
943 };
944 }
945 var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
946 "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
947 "\u2029\uFEFF";
948 if (!String.prototype.trim || ws.trim()) {
949 ws = "[" + ws + "]";
950 var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
951 trimEndRegexp = new RegExp(ws + ws + "*$");
952 String.prototype.trim = function trim() {
953 return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
954 };
955 }
956
957 function toInteger(n) {
958 n = +n;
959 if (n !== n) { // isNaN
960 n = 0;
961 } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
962 n = (n > 0 || -1) * Math.floor(Math.abs(n));
963 }
964 return n;
965 }
966
967 function isPrimitive(input) {
968 var type = typeof input;
969 return (
970 input === null ||
971 type === "undefined" ||
972 type === "boolean" ||
973 type === "number" ||
974 type === "string"
975 );
976 }
977
978 function toPrimitive(input) {
979 var val, valueOf, toString;
980 if (isPrimitive(input)) {
981 return input;
982 }
983 valueOf = input.valueOf;
984 if (typeof valueOf === "function") {
985 val = valueOf.call(input);
986 if (isPrimitive(val)) {
987 return val;
988 }
989 }
990 toString = input.toString;
991 if (typeof toString === "function") {
992 val = toString.call(input);
993 if (isPrimitive(val)) {
994 return val;
995 }
996 }
997 throw new TypeError();
998 }
999 var toObject = function (o) {
1000 if (o == null) { // this matches both null and undefined
1001 throw new TypeError("can't convert "+o+" to object");
1002 }
1003 return Object(o);
1004 };
1005
1006 });
1007
1008 define('ace/mode/css_worker', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/worker/mirror', 'ace/mode/css/csslint'], function(require, exports, module) {
1009
1010
1011 var oop = require("../lib/oop");
1012 var lang = require("../lib/lang");
1013 var Mirror = require("../worker/mirror").Mirror;
1014 var CSSLint = require("./css/csslint").CSSLint;
1015
1016 var Worker = exports.Worker = function(sender) {
1017 Mirror.call(this, sender);
1018 this.setTimeout(400);
1019 this.ruleset = null;
1020 this.setDisabledRules("ids");
1021 this.setInfoRules("adjoining-classes|qualified-headings|zero-units|gradients|import|outline-none");
1022 };
1023
1024 oop.inherits(Worker, Mirror);
1025
1026 (function() {
1027 this.setInfoRules = function(ruleNames) {
1028 if (typeof ruleNames == "string")
1029 ruleNames = ruleNames.split("|");
1030 this.infoRules = lang.arrayToMap(ruleNames);
1031 this.doc.getValue() && this.deferredUpdate.schedule(100);
1032 };
1033
1034 this.setDisabledRules = function(ruleNames) {
1035 if (!ruleNames) {
1036 this.ruleset = null;
1037 } else {
1038 if (typeof ruleNames == "string")
1039 ruleNames = ruleNames.split("|");
1040 var all = {};
1041
1042 CSSLint.getRules().forEach(function(x){
1043 all[x.id] = true;
1044 });
1045 ruleNames.forEach(function(x) {
1046 delete all[x];
1047 });
1048
1049 this.ruleset = all;
1050 }
1051 this.doc.getValue() && this.deferredUpdate.schedule(100);
1052 };
1053
1054 this.onUpdate = function() {
1055 var value = this.doc.getValue();
1056 var infoRules = this.infoRules;
1057
1058 var result = CSSLint.verify(value, this.ruleset);
1059 this.sender.emit("csslint", result.messages.map(function(msg) {
1060 return {
1061 row: msg.line - 1,
1062 column: msg.col - 1,
1063 text: msg.message,
1064 type: infoRules[msg.rule.id] ? "info" : msg.type
1065 }
1066 }));
1067 };
1068
1069 }).call(Worker.prototype);
1070
1071 });
1072
1073 define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
1074
1075
1076 exports.stringReverse = function(string) {
1077 return string.split("").reverse().join("");
1078 };
1079
1080 exports.stringRepeat = function (string, count) {
1081 var result = '';
1082 while (count > 0) {
1083 if (count & 1)
1084 result += string;
1085
1086 if (count >>= 1)
1087 string += string;
1088 }
1089 return result;
1090 };
1091
1092 var trimBeginRegexp = /^\s\s*/;
1093 var trimEndRegexp = /\s\s*$/;
1094
1095 exports.stringTrimLeft = function (string) {
1096 return string.replace(trimBeginRegexp, '');
1097 };
1098
1099 exports.stringTrimRight = function (string) {
1100 return string.replace(trimEndRegexp, '');
1101 };
1102
1103 exports.copyObject = function(obj) {
1104 var copy = {};
1105 for (var key in obj) {
1106 copy[key] = obj[key];
1107 }
1108 return copy;
1109 };
1110
1111 exports.copyArray = function(array){
1112 var copy = [];
1113 for (var i=0, l=array.length; i<l; i++) {
1114 if (array[i] && typeof array[i] == "object")
1115 copy[i] = this.copyObject( array[i] );
1116 else
1117 copy[i] = array[i];
1118 }
1119 return copy;
1120 };
1121
1122 exports.deepCopy = function (obj) {
1123 if (typeof obj != "object") {
1124 return obj;
1125 }
1126
1127 var copy = obj.constructor();
1128 for (var key in obj) {
1129 if (typeof obj[key] == "object") {
1130 copy[key] = this.deepCopy(obj[key]);
1131 } else {
1132 copy[key] = obj[key];
1133 }
1134 }
1135 return copy;
1136 };
1137
1138 exports.arrayToMap = function(arr) {
1139 var map = {};
1140 for (var i=0; i<arr.length; i++) {
1141 map[arr[i]] = 1;
1142 }
1143 return map;
1144
1145 };
1146
1147 exports.createMap = function(props) {
1148 var map = Object.create(null);
1149 for (var i in props) {
1150 map[i] = props[i];
1151 }
1152 return map;
1153 };
1154 exports.arrayRemove = function(array, value) {
1155 for (var i = 0; i <= array.length; i++) {
1156 if (value === array[i]) {
1157 array.splice(i, 1);
1158 }
1159 }
1160 };
1161
1162 exports.escapeRegExp = function(str) {
1163 return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
1164 };
1165
1166 exports.escapeHTML = function(str) {
1167 return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
1168 };
1169
1170 exports.getMatchOffsets = function(string, regExp) {
1171 var matches = [];
1172
1173 string.replace(regExp, function(str) {
1174 matches.push({
1175 offset: arguments[arguments.length-2],
1176 length: str.length
1177 });
1178 });
1179
1180 return matches;
1181 };
1182 exports.deferredCall = function(fcn) {
1183
1184 var timer = null;
1185 var callback = function() {
1186 timer = null;
1187 fcn();
1188 };
1189
1190 var deferred = function(timeout) {
1191 deferred.cancel();
1192 timer = setTimeout(callback, timeout || 0);
1193 return deferred;
1194 };
1195
1196 deferred.schedule = deferred;
1197
1198 deferred.call = function() {
1199 this.cancel();
1200 fcn();
1201 return deferred;
1202 };
1203
1204 deferred.cancel = function() {
1205 clearTimeout(timer);
1206 timer = null;
1207 return deferred;
1208 };
1209
1210 return deferred;
1211 };
1212
1213
1214 exports.delayedCall = function(fcn, defaultTimeout) {
1215 var timer = null;
1216 var callback = function() {
1217 timer = null;
1218 fcn();
1219 };
1220
1221 var _self = function(timeout) {
1222 timer && clearTimeout(timer);
1223 timer = setTimeout(callback, timeout || defaultTimeout);
1224 };
1225
1226 _self.delay = _self;
1227 _self.schedule = function(timeout) {
1228 if (timer == null)
1229 timer = setTimeout(callback, timeout || 0);
1230 };
1231
1232 _self.call = function() {
1233 this.cancel();
1234 fcn();
1235 };
1236
1237 _self.cancel = function() {
1238 timer && clearTimeout(timer);
1239 timer = null;
1240 };
1241
1242 _self.isPending = function() {
1243 return timer;
1244 };
1245
1246 return _self;
1247 };
1248 });
1249 define('ace/worker/mirror', ['require', 'exports', 'module' , 'ace/document', 'ace/lib/lang'], function(require, exports, module) {
1250
1251
1252 var Document = require("../document").Document;
1253 var lang = require("../lib/lang");
1254
1255 var Mirror = exports.Mirror = function(sender) {
1256 this.sender = sender;
1257 var doc = this.doc = new Document("");
1258
1259 var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1260
1261 var _self = this;
1262 sender.on("change", function(e) {
1263 doc.applyDeltas(e.data);
1264 deferredUpdate.schedule(_self.$timeout);
1265 });
1266 };
1267
1268 (function() {
1269
1270 this.$timeout = 500;
1271
1272 this.setTimeout = function(timeout) {
1273 this.$timeout = timeout;
1274 };
1275
1276 this.setValue = function(value) {
1277 this.doc.setValue(value);
1278 this.deferredUpdate.schedule(this.$timeout);
1279 };
1280
1281 this.getValue = function(callbackId) {
1282 this.sender.callback(this.doc.getValue(), callbackId);
1283 };
1284
1285 this.onUpdate = function() {
1286 };
1287
1288 }).call(Mirror.prototype);
1289
1290 });
1291
1292 define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
1293
1294
1295 var oop = require("./lib/oop");
1296 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1297 var Range = require("./range").Range;
1298 var Anchor = require("./anchor").Anchor;
1299
1300 var Document = function(text) {
1301 this.$lines = [];
1302 if (text.length == 0) {
1303 this.$lines = [""];
1304 } else if (Array.isArray(text)) {
1305 this._insertLines(0, text);
1306 } else {
1307 this.insert({row: 0, column:0}, text);
1308 }
1309 };
1310
1311 (function() {
1312
1313 oop.implement(this, EventEmitter);
1314 this.setValue = function(text) {
1315 var len = this.getLength();
1316 this.remove(new Range(0, 0, len, this.getLine(len-1).length));
1317 this.insert({row: 0, column:0}, text);
1318 };
1319 this.getValue = function() {
1320 return this.getAllLines().join(this.getNewLineCharacter());
1321 };
1322 this.createAnchor = function(row, column) {
1323 return new Anchor(this, row, column);
1324 };
1325 if ("aaa".split(/a/).length == 0)
1326 this.$split = function(text) {
1327 return text.replace(/\r\n|\r/g, "\n").split("\n");
1328 }
1329 else
1330 this.$split = function(text) {
1331 return text.split(/\r\n|\r|\n/);
1332 };
1333
1334
1335 this.$detectNewLine = function(text) {
1336 var match = text.match(/^.*?(\r\n|\r|\n)/m);
1337 this.$autoNewLine = match ? match[1] : "\n";
1338 };
1339 this.getNewLineCharacter = function() {
1340 switch (this.$newLineMode) {
1341 case "windows":
1342 return "\r\n";
1343 case "unix":
1344 return "\n";
1345 default:
1346 return this.$autoNewLine;
1347 }
1348 };
1349
1350 this.$autoNewLine = "\n";
1351 this.$newLineMode = "auto";
1352 this.setNewLineMode = function(newLineMode) {
1353 if (this.$newLineMode === newLineMode)
1354 return;
1355
1356 this.$newLineMode = newLineMode;
1357 };
1358 this.getNewLineMode = function() {
1359 return this.$newLineMode;
1360 };
1361 this.isNewLine = function(text) {
1362 return (text == "\r\n" || text == "\r" || text == "\n");
1363 };
1364 this.getLine = function(row) {
1365 return this.$lines[row] || "";
1366 };
1367 this.getLines = function(firstRow, lastRow) {
1368 return this.$lines.slice(firstRow, lastRow + 1);
1369 };
1370 this.getAllLines = function() {
1371 return this.getLines(0, this.getLength());
1372 };
1373 this.getLength = function() {
1374 return this.$lines.length;
1375 };
1376 this.getTextRange = function(range) {
1377 if (range.start.row == range.end.row) {
1378 return this.$lines[range.start.row]
1379 .substring(range.start.column, range.end.column);
1380 }
1381 var lines = this.getLines(range.start.row, range.end.row);
1382 lines[0] = (lines[0] || "").substring(range.start.column);
1383 var l = lines.length - 1;
1384 if (range.end.row - range.start.row == l)
1385 lines[l] = lines[l].substring(0, range.end.column);
1386 return lines.join(this.getNewLineCharacter());
1387 };
1388
1389 this.$clipPosition = function(position) {
1390 var length = this.getLength();
1391 if (position.row >= length) {
1392 position.row = Math.max(0, length - 1);
1393 position.column = this.getLine(length-1).length;
1394 } else if (position.row < 0)
1395 position.row = 0;
1396 return position;
1397 };
1398 this.insert = function(position, text) {
1399 if (!text || text.length === 0)
1400 return position;
1401
1402 position = this.$clipPosition(position);
1403 if (this.getLength() <= 1)
1404 this.$detectNewLine(text);
1405
1406 var lines = this.$split(text);
1407 var firstLine = lines.splice(0, 1)[0];
1408 var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
1409
1410 position = this.insertInLine(position, firstLine);
1411 if (lastLine !== null) {
1412 position = this.insertNewLine(position); // terminate first line
1413 position = this._insertLines(position.row, lines);
1414 position = this.insertInLine(position, lastLine || "");
1415 }
1416 return position;
1417 };
1418 this.insertLines = function(row, lines) {
1419 if (row >= this.getLength())
1420 return this.insert({row: row, column: 0}, "\n" + lines.join("\n"));
1421 return this._insertLines(Math.max(row, 0), lines);
1422 };
1423 this._insertLines = function(row, lines) {
1424 if (lines.length == 0)
1425 return {row: row, column: 0};
1426 if (lines.length > 0xFFFF) {
1427 var end = this._insertLines(row, lines.slice(0xFFFF));
1428 lines = lines.slice(0, 0xFFFF);
1429 }
1430
1431 var args = [row, 0];
1432 args.push.apply(args, lines);
1433 this.$lines.splice.apply(this.$lines, args);
1434
1435 var range = new Range(row, 0, row + lines.length, 0);
1436 var delta = {
1437 action: "insertLines",
1438 range: range,
1439 lines: lines
1440 };
1441 this._emit("change", { data: delta });
1442 return end || range.end;
1443 };
1444 this.insertNewLine = function(position) {
1445 position = this.$clipPosition(position);
1446 var line = this.$lines[position.row] || "";
1447
1448 this.$lines[position.row] = line.substring(0, position.column);
1449 this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
1450
1451 var end = {
1452 row : position.row + 1,
1453 column : 0
1454 };
1455
1456 var delta = {
1457 action: "insertText",
1458 range: Range.fromPoints(position, end),
1459 text: this.getNewLineCharacter()
1460 };
1461 this._emit("change", { data: delta });
1462
1463 return end;
1464 };
1465 this.insertInLine = function(position, text) {
1466 if (text.length == 0)
1467 return position;
1468
1469 var line = this.$lines[position.row] || "";
1470
1471 this.$lines[position.row] = line.substring(0, position.column) + text
1472 + line.substring(position.column);
1473
1474 var end = {
1475 row : position.row,
1476 column : position.column + text.length
1477 };
1478
1479 var delta = {
1480 action: "insertText",
1481 range: Range.fromPoints(position, end),
1482 text: text
1483 };
1484 this._emit("change", { data: delta });
1485
1486 return end;
1487 };
1488 this.remove = function(range) {
1489 range.start = this.$clipPosition(range.start);
1490 range.end = this.$clipPosition(range.end);
1491
1492 if (range.isEmpty())
1493 return range.start;
1494
1495 var firstRow = range.start.row;
1496 var lastRow = range.end.row;
1497
1498 if (range.isMultiLine()) {
1499 var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
1500 var lastFullRow = lastRow - 1;
1501
1502 if (range.end.column > 0)
1503 this.removeInLine(lastRow, 0, range.end.column);
1504
1505 if (lastFullRow >= firstFullRow)
1506 this._removeLines(firstFullRow, lastFullRow);
1507
1508 if (firstFullRow != firstRow) {
1509 this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
1510 this.removeNewLine(range.start.row);
1511 }
1512 }
1513 else {
1514 this.removeInLine(firstRow, range.start.column, range.end.column);
1515 }
1516 return range.start;
1517 };
1518 this.removeInLine = function(row, startColumn, endColumn) {
1519 if (startColumn == endColumn)
1520 return;
1521
1522 var range = new Range(row, startColumn, row, endColumn);
1523 var line = this.getLine(row);
1524 var removed = line.substring(startColumn, endColumn);
1525 var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
1526 this.$lines.splice(row, 1, newLine);
1527
1528 var delta = {
1529 action: "removeText",
1530 range: range,
1531 text: removed
1532 };
1533 this._emit("change", { data: delta });
1534 return range.start;
1535 };
1536 this.removeLines = function(firstRow, lastRow) {
1537 if (firstRow < 0 || lastRow >= this.getLength())
1538 return this.remove(new Range(firstRow, 0, lastRow + 1, 0));
1539 return this._removeLines(firstRow, lastRow);
1540 };
1541
1542 this._removeLines = function(firstRow, lastRow) {
1543 var range = new Range(firstRow, 0, lastRow + 1, 0);
1544 var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
1545
1546 var delta = {
1547 action: "removeLines",
1548 range: range,
1549 nl: this.getNewLineCharacter(),
1550 lines: removed
1551 };
1552 this._emit("change", { data: delta });
1553 return removed;
1554 };
1555 this.removeNewLine = function(row) {
1556 var firstLine = this.getLine(row);
1557 var secondLine = this.getLine(row+1);
1558
1559 var range = new Range(row, firstLine.length, row+1, 0);
1560 var line = firstLine + secondLine;
1561
1562 this.$lines.splice(row, 2, line);
1563
1564 var delta = {
1565 action: "removeText",
1566 range: range,
1567 text: this.getNewLineCharacter()
1568 };
1569 this._emit("change", { data: delta });
1570 };
1571 this.replace = function(range, text) {
1572 if (text.length == 0 && range.isEmpty())
1573 return range.start;
1574 if (text == this.getTextRange(range))
1575 return range.end;
1576
1577 this.remove(range);
1578 if (text) {
1579 var end = this.insert(range.start, text);
1580 }
1581 else {
1582 end = range.start;
1583 }
1584
1585 return end;
1586 };
1587 this.applyDeltas = function(deltas) {
1588 for (var i=0; i<deltas.length; i++) {
1589 var delta = deltas[i];
1590 var range = Range.fromPoints(delta.range.start, delta.range.end);
1591
1592 if (delta.action == "insertLines")
1593 this.insertLines(range.start.row, delta.lines);
1594 else if (delta.action == "insertText")
1595 this.insert(range.start, delta.text);
1596 else if (delta.action == "removeLines")
1597 this._removeLines(range.start.row, range.end.row - 1);
1598 else if (delta.action == "removeText")
1599 this.remove(range);
1600 }
1601 };
1602 this.revertDeltas = function(deltas) {
1603 for (var i=deltas.length-1; i>=0; i--) {
1604 var delta = deltas[i];
1605
1606 var range = Range.fromPoints(delta.range.start, delta.range.end);
1607
1608 if (delta.action == "insertLines")
1609 this._removeLines(range.start.row, range.end.row - 1);
1610 else if (delta.action == "insertText")
1611 this.remove(range);
1612 else if (delta.action == "removeLines")
1613 this._insertLines(range.start.row, delta.lines);
1614 else if (delta.action == "removeText")
1615 this.insert(range.start, delta.text);
1616 }
1617 };
1618 this.indexToPosition = function(index, startRow) {
1619 var lines = this.$lines || this.getAllLines();
1620 var newlineLength = this.getNewLineCharacter().length;
1621 for (var i = startRow || 0, l = lines.length; i < l; i++) {
1622 index -= lines[i].length + newlineLength;
1623 if (index < 0)
1624 return {row: i, column: index + lines[i].length + newlineLength};
1625 }
1626 return {row: l-1, column: lines[l-1].length};
1627 };
1628 this.positionToIndex = function(pos, startRow) {
1629 var lines = this.$lines || this.getAllLines();
1630 var newlineLength = this.getNewLineCharacter().length;
1631 var index = 0;
1632 var row = Math.min(pos.row, lines.length);
1633 for (var i = startRow || 0; i < row; ++i)
1634 index += lines[i].length + newlineLength;
1635
1636 return index + pos.column;
1637 };
1638
1639 }).call(Document.prototype);
1640
1641 exports.Document = Document;
1642 });
1643
1644 define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
1645
1646 var comparePoints = function(p1, p2) {
1647 return p1.row - p2.row || p1.column - p2.column;
1648 };
1649 var Range = function(startRow, startColumn, endRow, endColumn) {
1650 this.start = {
1651 row: startRow,
1652 column: startColumn
1653 };
1654
1655 this.end = {
1656 row: endRow,
1657 column: endColumn
1658 };
1659 };
1660
1661 (function() {
1662 this.isEqual = function(range) {
1663 return this.start.row === range.start.row &&
1664 this.end.row === range.end.row &&
1665 this.start.column === range.start.column &&
1666 this.end.column === range.end.column;
1667 };
1668 this.toString = function() {
1669 return ("Range: [" + this.start.row + "/" + this.start.column +
1670 "] -> [" + this.end.row + "/" + this.end.column + "]");
1671 };
1672
1673 this.contains = function(row, column) {
1674 return this.compare(row, column) == 0;
1675 };
1676 this.compareRange = function(range) {
1677 var cmp,
1678 end = range.end,
1679 start = range.start;
1680
1681 cmp = this.compare(end.row, end.column);
1682 if (cmp == 1) {
1683 cmp = this.compare(start.row, start.column);
1684 if (cmp == 1) {
1685 return 2;
1686 } else if (cmp == 0) {
1687 return 1;
1688 } else {
1689 return 0;
1690 }
1691 } else if (cmp == -1) {
1692 return -2;
1693 } else {
1694 cmp = this.compare(start.row, start.column);
1695 if (cmp == -1) {
1696 return -1;
1697 } else if (cmp == 1) {
1698 return 42;
1699 } else {
1700 return 0;
1701 }
1702 }
1703 };
1704 this.comparePoint = function(p) {
1705 return this.compare(p.row, p.column);
1706 };
1707 this.containsRange = function(range) {
1708 return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
1709 };
1710 this.intersects = function(range) {
1711 var cmp = this.compareRange(range);
1712 return (cmp == -1 || cmp == 0 || cmp == 1);
1713 };
1714 this.isEnd = function(row, column) {
1715 return this.end.row == row && this.end.column == column;
1716 };
1717 this.isStart = function(row, column) {
1718 return this.start.row == row && this.start.column == column;
1719 };
1720 this.setStart = function(row, column) {
1721 if (typeof row == "object") {
1722 this.start.column = row.column;
1723 this.start.row = row.row;
1724 } else {
1725 this.start.row = row;
1726 this.start.column = column;
1727 }
1728 };
1729 this.setEnd = function(row, column) {
1730 if (typeof row == "object") {
1731 this.end.column = row.column;
1732 this.end.row = row.row;
1733 } else {
1734 this.end.row = row;
1735 this.end.column = column;
1736 }
1737 };
1738 this.inside = function(row, column) {
1739 if (this.compare(row, column) == 0) {
1740 if (this.isEnd(row, column) || this.isStart(row, column)) {
1741 return false;
1742 } else {
1743 return true;
1744 }
1745 }
1746 return false;
1747 };
1748 this.insideStart = function(row, column) {
1749 if (this.compare(row, column) == 0) {
1750 if (this.isEnd(row, column)) {
1751 return false;
1752 } else {
1753 return true;
1754 }
1755 }
1756 return false;
1757 };
1758 this.insideEnd = function(row, column) {
1759 if (this.compare(row, column) == 0) {
1760 if (this.isStart(row, column)) {
1761 return false;
1762 } else {
1763 return true;
1764 }
1765 }
1766 return false;
1767 };
1768 this.compare = function(row, column) {
1769 if (!this.isMultiLine()) {
1770 if (row === this.start.row) {
1771 return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
1772 };
1773 }
1774
1775 if (row < this.start.row)
1776 return -1;
1777
1778 if (row > this.end.row)
1779 return 1;
1780
1781 if (this.start.row === row)
1782 return column >= this.start.column ? 0 : -1;
1783
1784 if (this.end.row === row)
1785 return column <= this.end.column ? 0 : 1;
1786
1787 return 0;
1788 };
1789 this.compareStart = function(row, column) {
1790 if (this.start.row == row && this.start.column == column) {
1791 return -1;
1792 } else {
1793 return this.compare(row, column);
1794 }
1795 };
1796 this.compareEnd = function(row, column) {
1797 if (this.end.row == row && this.end.column == column) {
1798 return 1;
1799 } else {
1800 return this.compare(row, column);
1801 }
1802 };
1803 this.compareInside = function(row, column) {
1804 if (this.end.row == row && this.end.column == column) {
1805 return 1;
1806 } else if (this.start.row == row && this.start.column == column) {
1807 return -1;
1808 } else {
1809 return this.compare(row, column);
1810 }
1811 };
1812 this.clipRows = function(firstRow, lastRow) {
1813 if (this.end.row > lastRow)
1814 var end = {row: lastRow + 1, column: 0};
1815 else if (this.end.row < firstRow)
1816 var end = {row: firstRow, column: 0};
1817
1818 if (this.start.row > lastRow)
1819 var start = {row: lastRow + 1, column: 0};
1820 else if (this.start.row < firstRow)
1821 var start = {row: firstRow, column: 0};
1822
1823 return Range.fromPoints(start || this.start, end || this.end);
1824 };
1825 this.extend = function(row, column) {
1826 var cmp = this.compare(row, column);
1827
1828 if (cmp == 0)
1829 return this;
1830 else if (cmp == -1)
1831 var start = {row: row, column: column};
1832 else
1833 var end = {row: row, column: column};
1834
1835 return Range.fromPoints(start || this.start, end || this.end);
1836 };
1837
1838 this.isEmpty = function() {
1839 return (this.start.row === this.end.row && this.start.column === this.end.column);
1840 };
1841 this.isMultiLine = function() {
1842 return (this.start.row !== this.end.row);
1843 };
1844 this.clone = function() {
1845 return Range.fromPoints(this.start, this.end);
1846 };
1847 this.collapseRows = function() {
1848 if (this.end.column == 0)
1849 return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
1850 else
1851 return new Range(this.start.row, 0, this.end.row, 0)
1852 };
1853 this.toScreenRange = function(session) {
1854 var screenPosStart = session.documentToScreenPosition(this.start);
1855 var screenPosEnd = session.documentToScreenPosition(this.end);
1856
1857 return new Range(
1858 screenPosStart.row, screenPosStart.column,
1859 screenPosEnd.row, screenPosEnd.column
1860 );
1861 };
1862 this.moveBy = function(row, column) {
1863 this.start.row += row;
1864 this.start.column += column;
1865 this.end.row += row;
1866 this.end.column += column;
1867 };
1868
1869 }).call(Range.prototype);
1870 Range.fromPoints = function(start, end) {
1871 return new Range(start.row, start.column, end.row, end.column);
1872 };
1873 Range.comparePoints = comparePoints;
1874
1875 Range.comparePoints = function(p1, p2) {
1876 return p1.row - p2.row || p1.column - p2.column;
1877 };
1878
1879
1880 exports.Range = Range;
1881 });
1882
1883 define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
1884
1885
1886 var oop = require("./lib/oop");
1887 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1888
1889 var Anchor = exports.Anchor = function(doc, row, column) {
1890 this.document = doc;
1891
1892 if (typeof column == "undefined")
1893 this.setPosition(row.row, row.column);
1894 else
1895 this.setPosition(row, column);
1896
1897 this.$onChange = this.onChange.bind(this);
1898 doc.on("change", this.$onChange);
1899 };
1900
1901 (function() {
1902
1903 oop.implement(this, EventEmitter);
1904
1905 this.getPosition = function() {
1906 return this.$clipPositionToDocument(this.row, this.column);
1907 };
1908
1909 this.getDocument = function() {
1910 return this.document;
1911 };
1912
1913 this.onChange = function(e) {
1914 var delta = e.data;
1915 var range = delta.range;
1916
1917 if (range.start.row == range.end.row && range.start.row != this.row)
1918 return;
1919
1920 if (range.start.row > this.row)
1921 return;
1922
1923 if (range.start.row == this.row && range.start.column > this.column)
1924 return;
1925
1926 var row = this.row;
1927 var column = this.column;
1928 var start = range.start;
1929 var end = range.end;
1930
1931 if (delta.action === "insertText") {
1932 if (start.row === row && start.column <= column) {
1933 if (start.row === end.row) {
1934 column += end.column - start.column;
1935 } else {
1936 column -= start.column;
1937 row += end.row - start.row;
1938 }
1939 } else if (start.row !== end.row && start.row < row) {
1940 row += end.row - start.row;
1941 }
1942 } else if (delta.action === "insertLines") {
1943 if (start.row <= row) {
1944 row += end.row - start.row;
1945 }
1946 } else if (delta.action === "removeText") {
1947 if (start.row === row && start.column < column) {
1948 if (end.column >= column)
1949 column = start.column;
1950 else
1951 column = Math.max(0, column - (end.column - start.column));
1952
1953 } else if (start.row !== end.row && start.row < row) {
1954 if (end.row === row)
1955 column = Math.max(0, column - end.column) + start.column;
1956 row -= (end.row - start.row);
1957 } else if (end.row === row) {
1958 row -= end.row - start.row;
1959 column = Math.max(0, column - end.column) + start.column;
1960 }
1961 } else if (delta.action == "removeLines") {
1962 if (start.row <= row) {
1963 if (end.row <= row)
1964 row -= end.row - start.row;
1965 else {
1966 row = start.row;
1967 column = 0;
1968 }
1969 }
1970 }
1971
1972 this.setPosition(row, column, true);
1973 };
1974
1975 this.setPosition = function(row, column, noClip) {
1976 var pos;
1977 if (noClip) {
1978 pos = {
1979 row: row,
1980 column: column
1981 };
1982 } else {
1983 pos = this.$clipPositionToDocument(row, column);
1984 }
1985
1986 if (this.row == pos.row && this.column == pos.column)
1987 return;
1988
1989 var old = {
1990 row: this.row,
1991 column: this.column
1992 };
1993
1994 this.row = pos.row;
1995 this.column = pos.column;
1996 this._emit("change", {
1997 old: old,
1998 value: pos
1999 });
2000 };
2001
2002 this.detach = function() {
2003 this.document.removeEventListener("change", this.$onChange);
2004 };
2005 this.$clipPositionToDocument = function(row, column) {
2006 var pos = {};
2007
2008 if (row >= this.document.getLength()) {
2009 pos.row = Math.max(0, this.document.getLength() - 1);
2010 pos.column = this.document.getLine(pos.row).length;
2011 }
2012 else if (row < 0) {
2013 pos.row = 0;
2014 pos.column = 0;
2015 }
2016 else {
2017 pos.row = row;
2018 pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
2019 }
2020
2021 if (column < 0)
2022 pos.column = 0;
2023
2024 return pos;
2025 };
2026
2027 }).call(Anchor.prototype);
2028
2029 });
2030 define('ace/mode/css/csslint', ['require', 'exports', 'module' ], function(require, exports, module) {
2031 var parserlib = {};
2032 (function(){
2033 function EventTarget(){
2034 this._listeners = {};
2035 }
2036
2037 EventTarget.prototype = {
2038 constructor: EventTarget,
2039 addListener: function(type, listener){
2040 if (!this._listeners[type]){
2041 this._listeners[type] = [];
2042 }
2043
2044 this._listeners[type].push(listener);
2045 },
2046 fire: function(event){
2047 if (typeof event == "string"){
2048 event = { type: event };
2049 }
2050 if (typeof event.target != "undefined"){
2051 event.target = this;
2052 }
2053
2054 if (typeof event.type == "undefined"){
2055 throw new Error("Event object missing 'type' property.");
2056 }
2057
2058 if (this._listeners[event.type]){
2059 var listeners = this._listeners[event.type].concat();
2060 for (var i=0, len=listeners.length; i < len; i++){
2061 listeners[i].call(this, event);
2062 }
2063 }
2064 },
2065 removeListener: function(type, listener){
2066 if (this._listeners[type]){
2067 var listeners = this._listeners[type];
2068 for (var i=0, len=listeners.length; i < len; i++){
2069 if (listeners[i] === listener){
2070 listeners.splice(i, 1);
2071 break;
2072 }
2073 }
2074
2075
2076 }
2077 }
2078 };
2079 function StringReader(text){
2080 this._input = text.replace(/\n\r?/g, "\n");
2081 this._line = 1;
2082 this._col = 1;
2083 this._cursor = 0;
2084 }
2085
2086 StringReader.prototype = {
2087 constructor: StringReader,
2088 getCol: function(){
2089 return this._col;
2090 },
2091 getLine: function(){
2092 return this._line ;
2093 },
2094 eof: function(){
2095 return (this._cursor == this._input.length);
2096 },
2097 peek: function(count){
2098 var c = null;
2099 count = (typeof count == "undefined" ? 1 : count);
2100 if (this._cursor < this._input.length){
2101 c = this._input.charAt(this._cursor + count - 1);
2102 }
2103
2104 return c;
2105 },
2106 read: function(){
2107 var c = null;
2108 if (this._cursor < this._input.length){
2109 if (this._input.charAt(this._cursor) == "\n"){
2110 this._line++;
2111 this._col=1;
2112 } else {
2113 this._col++;
2114 }
2115 c = this._input.charAt(this._cursor++);
2116 }
2117
2118 return c;
2119 },
2120 mark: function(){
2121 this._bookmark = {
2122 cursor: this._cursor,
2123 line: this._line,
2124 col: this._col
2125 };
2126 },
2127
2128 reset: function(){
2129 if (this._bookmark){
2130 this._cursor = this._bookmark.cursor;
2131 this._line = this._bookmark.line;
2132 this._col = this._bookmark.col;
2133 delete this._bookmark;
2134 }
2135 },
2136 readTo: function(pattern){
2137
2138 var buffer = "",
2139 c;
2140 while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) != buffer.length - pattern.length){
2141 c = this.read();
2142 if (c){
2143 buffer += c;
2144 } else {
2145 throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + ".");
2146 }
2147 }
2148
2149 return buffer;
2150
2151 },
2152 readWhile: function(filter){
2153
2154 var buffer = "",
2155 c = this.read();
2156
2157 while(c !== null && filter(c)){
2158 buffer += c;
2159 c = this.read();
2160 }
2161
2162 return buffer;
2163
2164 },
2165 readMatch: function(matcher){
2166
2167 var source = this._input.substring(this._cursor),
2168 value = null;
2169 if (typeof matcher == "string"){
2170 if (source.indexOf(matcher) === 0){
2171 value = this.readCount(matcher.length);
2172 }
2173 } else if (matcher instanceof RegExp){
2174 if (matcher.test(source)){
2175 value = this.readCount(RegExp.lastMatch.length);
2176 }
2177 }
2178
2179 return value;
2180 },
2181 readCount: function(count){
2182 var buffer = "";
2183
2184 while(count--){
2185 buffer += this.read();
2186 }
2187
2188 return buffer;
2189 }
2190
2191 };
2192 function SyntaxError(message, line, col){
2193 this.col = col;
2194 this.line = line;
2195 this.message = message;
2196
2197 }
2198 SyntaxError.prototype = new Error();
2199 function SyntaxUnit(text, line, col, type){
2200 this.col = col;
2201 this.line = line;
2202 this.text = text;
2203 this.type = type;
2204 }
2205 SyntaxUnit.fromToken = function(token){
2206 return new SyntaxUnit(token.value, token.startLine, token.startCol);
2207 };
2208
2209 SyntaxUnit.prototype = {
2210 constructor: SyntaxUnit,
2211 valueOf: function(){
2212 return this.toString();
2213 },
2214 toString: function(){
2215 return this.text;
2216 }
2217
2218 };
2219 function TokenStreamBase(input, tokenData){
2220 this._reader = input ? new StringReader(input.toString()) : null;
2221 this._token = null;
2222 this._tokenData = tokenData;
2223 this._lt = [];
2224 this._ltIndex = 0;
2225
2226 this._ltIndexCache = [];
2227 }
2228 TokenStreamBase.createTokenData = function(tokens){
2229
2230 var nameMap = [],
2231 typeMap = {},
2232 tokenData = tokens.concat([]),
2233 i = 0,
2234 len = tokenData.length+1;
2235
2236 tokenData.UNKNOWN = -1;
2237 tokenData.unshift({name:"EOF"});
2238
2239 for (; i < len; i++){
2240 nameMap.push(tokenData[i].name);
2241 tokenData[tokenData[i].name] = i;
2242 if (tokenData[i].text){
2243 typeMap[tokenData[i].text] = i;
2244 }
2245 }
2246
2247 tokenData.name = function(tt){
2248 return nameMap[tt];
2249 };
2250
2251 tokenData.type = function(c){
2252 return typeMap[c];
2253 };
2254
2255 return tokenData;
2256 };
2257
2258 TokenStreamBase.prototype = {
2259 constructor: TokenStreamBase,
2260 match: function(tokenTypes, channel){
2261 if (!(tokenTypes instanceof Array)){
2262 tokenTypes = [tokenTypes];
2263 }
2264
2265 var tt = this.get(channel),
2266 i = 0,
2267 len = tokenTypes.length;
2268
2269 while(i < len){
2270 if (tt == tokenTypes[i++]){
2271 return true;
2272 }
2273 }
2274 this.unget();
2275 return false;
2276 },
2277 mustMatch: function(tokenTypes, channel){
2278
2279 var token;
2280 if (!(tokenTypes instanceof Array)){
2281 tokenTypes = [tokenTypes];
2282 }
2283
2284 if (!this.match.apply(this, arguments)){
2285 token = this.LT(1);
2286 throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name +
2287 " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
2288 }
2289 },
2290 advance: function(tokenTypes, channel){
2291
2292 while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){
2293 this.get();
2294 }
2295
2296 return this.LA(0);
2297 },
2298 get: function(channel){
2299
2300 var tokenInfo = this._tokenData,
2301 reader = this._reader,
2302 value,
2303 i =0,
2304 len = tokenInfo.length,
2305 found = false,
2306 token,
2307 info;
2308 if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){
2309
2310 i++;
2311 this._token = this._lt[this._ltIndex++];
2312 info = tokenInfo[this._token.type];
2313 while((info.channel !== undefined && channel !== info.channel) &&
2314 this._ltIndex < this._lt.length){
2315 this._token = this._lt[this._ltIndex++];
2316 info = tokenInfo[this._token.type];
2317 i++;
2318 }
2319 if ((info.channel === undefined || channel === info.channel) &&
2320 this._ltIndex <= this._lt.length){
2321 this._ltIndexCache.push(i);
2322 return this._token.type;
2323 }
2324 }
2325 token = this._getToken();
2326 if (token.type > -1 && !tokenInfo[token.type].hide){
2327 token.channel = tokenInfo[token.type].channel;
2328 this._token = token;
2329 this._lt.push(token);
2330 this._ltIndexCache.push(this._lt.length - this._ltIndex + i);
2331 if (this._lt.length > 5){
2332 this._lt.shift();
2333 }
2334 if (this._ltIndexCache.length > 5){
2335 this._ltIndexCache.shift();
2336 }
2337 this._ltIndex = this._lt.length;
2338 }
2339 info = tokenInfo[token.type];
2340 if (info &&
2341 (info.hide ||
2342 (info.channel !== undefined && channel !== info.channel))){
2343 return this.get(channel);
2344 } else {
2345 return token.type;
2346 }
2347 },
2348 LA: function(index){
2349 var total = index,
2350 tt;
2351 if (index > 0){
2352 if (index > 5){
2353 throw new Error("Too much lookahead.");
2354 }
2355 while(total){
2356 tt = this.get();
2357 total--;
2358 }
2359 while(total < index){
2360 this.unget();
2361 total++;
2362 }
2363 } else if (index < 0){
2364
2365 if(this._lt[this._ltIndex+index]){
2366 tt = this._lt[this._ltIndex+index].type;
2367 } else {
2368 throw new Error("Too much lookbehind.");
2369 }
2370
2371 } else {
2372 tt = this._token.type;
2373 }
2374
2375 return tt;
2376
2377 },
2378 LT: function(index){
2379 this.LA(index);
2380 return this._lt[this._ltIndex+index-1];
2381 },
2382 peek: function(){
2383 return this.LA(1);
2384 },
2385 token: function(){
2386 return this._token;
2387 },
2388 tokenName: function(tokenType){
2389 if (tokenType < 0 || tokenType > this._tokenData.length){
2390 return "UNKNOWN_TOKEN";
2391 } else {
2392 return this._tokenData[tokenType].name;
2393 }
2394 },
2395 tokenType: function(tokenName){
2396 return this._tokenData[tokenName] || -1;
2397 },
2398 unget: function(){
2399 if (this._ltIndexCache.length){
2400 this._ltIndex -= this._ltIndexCache.pop();//--;
2401 this._token = this._lt[this._ltIndex - 1];
2402 } else {
2403 throw new Error("Too much lookahead.");
2404 }
2405 }
2406
2407 };
2408
2409
2410
2411
2412 parserlib.util = {
2413 StringReader: StringReader,
2414 SyntaxError : SyntaxError,
2415 SyntaxUnit : SyntaxUnit,
2416 EventTarget : EventTarget,
2417 TokenStreamBase : TokenStreamBase
2418 };
2419 })();
2420 (function(){
2421 var EventTarget = parserlib.util.EventTarget,
2422 TokenStreamBase = parserlib.util.TokenStreamBase,
2423 StringReader = parserlib.util.StringReader,
2424 SyntaxError = parserlib.util.SyntaxError,
2425 SyntaxUnit = parserlib.util.SyntaxUnit;
2426
2427
2428 var Colors = {
2429 aliceblue :"#f0f8ff",
2430 antiquewhite :"#faebd7",
2431 aqua :"#00ffff",
2432 aquamarine :"#7fffd4",
2433 azure :"#f0ffff",
2434 beige :"#f5f5dc",
2435 bisque :"#ffe4c4",
2436 black :"#000000",
2437 blanchedalmond :"#ffebcd",
2438 blue :"#0000ff",
2439 blueviolet :"#8a2be2",
2440 brown :"#a52a2a",
2441 burlywood :"#deb887",
2442 cadetblue :"#5f9ea0",
2443 chartreuse :"#7fff00",
2444 chocolate :"#d2691e",
2445 coral :"#ff7f50",
2446 cornflowerblue :"#6495ed",
2447 cornsilk :"#fff8dc",
2448 crimson :"#dc143c",
2449 cyan :"#00ffff",
2450 darkblue :"#00008b",
2451 darkcyan :"#008b8b",
2452 darkgoldenrod :"#b8860b",
2453 darkgray :"#a9a9a9",
2454 darkgreen :"#006400",
2455 darkkhaki :"#bdb76b",
2456 darkmagenta :"#8b008b",
2457 darkolivegreen :"#556b2f",
2458 darkorange :"#ff8c00",
2459 darkorchid :"#9932cc",
2460 darkred :"#8b0000",
2461 darksalmon :"#e9967a",
2462 darkseagreen :"#8fbc8f",
2463 darkslateblue :"#483d8b",
2464 darkslategray :"#2f4f4f",
2465 darkturquoise :"#00ced1",
2466 darkviolet :"#9400d3",
2467 deeppink :"#ff1493",
2468 deepskyblue :"#00bfff",
2469 dimgray :"#696969",
2470 dodgerblue :"#1e90ff",
2471 firebrick :"#b22222",
2472 floralwhite :"#fffaf0",
2473 forestgreen :"#228b22",
2474 fuchsia :"#ff00ff",
2475 gainsboro :"#dcdcdc",
2476 ghostwhite :"#f8f8ff",
2477 gold :"#ffd700",
2478 goldenrod :"#daa520",
2479 gray :"#808080",
2480 green :"#008000",
2481 greenyellow :"#adff2f",
2482 honeydew :"#f0fff0",
2483 hotpink :"#ff69b4",
2484 indianred :"#cd5c5c",
2485 indigo :"#4b0082",
2486 ivory :"#fffff0",
2487 khaki :"#f0e68c",
2488 lavender :"#e6e6fa",
2489 lavenderblush :"#fff0f5",
2490 lawngreen :"#7cfc00",
2491 lemonchiffon :"#fffacd",
2492 lightblue :"#add8e6",
2493 lightcoral :"#f08080",
2494 lightcyan :"#e0ffff",
2495 lightgoldenrodyellow :"#fafad2",
2496 lightgray :"#d3d3d3",
2497 lightgreen :"#90ee90",
2498 lightpink :"#ffb6c1",
2499 lightsalmon :"#ffa07a",
2500 lightseagreen :"#20b2aa",
2501 lightskyblue :"#87cefa",
2502 lightslategray :"#778899",
2503 lightsteelblue :"#b0c4de",
2504 lightyellow :"#ffffe0",
2505 lime :"#00ff00",
2506 limegreen :"#32cd32",
2507 linen :"#faf0e6",
2508 magenta :"#ff00ff",
2509 maroon :"#800000",
2510 mediumaquamarine:"#66cdaa",
2511 mediumblue :"#0000cd",
2512 mediumorchid :"#ba55d3",
2513 mediumpurple :"#9370d8",
2514 mediumseagreen :"#3cb371",
2515 mediumslateblue :"#7b68ee",
2516 mediumspringgreen :"#00fa9a",
2517 mediumturquoise :"#48d1cc",
2518 mediumvioletred :"#c71585",
2519 midnightblue :"#191970",
2520 mintcream :"#f5fffa",
2521 mistyrose :"#ffe4e1",
2522 moccasin :"#ffe4b5",
2523 navajowhite :"#ffdead",
2524 navy :"#000080",
2525 oldlace :"#fdf5e6",
2526 olive :"#808000",
2527 olivedrab :"#6b8e23",
2528 orange :"#ffa500",
2529 orangered :"#ff4500",
2530 orchid :"#da70d6",
2531 palegoldenrod :"#eee8aa",
2532 palegreen :"#98fb98",
2533 paleturquoise :"#afeeee",
2534 palevioletred :"#d87093",
2535 papayawhip :"#ffefd5",
2536 peachpuff :"#ffdab9",
2537 peru :"#cd853f",
2538 pink :"#ffc0cb",
2539 plum :"#dda0dd",
2540 powderblue :"#b0e0e6",
2541 purple :"#800080",
2542 red :"#ff0000",
2543 rosybrown :"#bc8f8f",
2544 royalblue :"#4169e1",
2545 saddlebrown :"#8b4513",
2546 salmon :"#fa8072",
2547 sandybrown :"#f4a460",
2548 seagreen :"#2e8b57",
2549 seashell :"#fff5ee",
2550 sienna :"#a0522d",
2551 silver :"#c0c0c0",
2552 skyblue :"#87ceeb",
2553 slateblue :"#6a5acd",
2554 slategray :"#708090",
2555 snow :"#fffafa",
2556 springgreen :"#00ff7f",
2557 steelblue :"#4682b4",
2558 tan :"#d2b48c",
2559 teal :"#008080",
2560 thistle :"#d8bfd8",
2561 tomato :"#ff6347",
2562 turquoise :"#40e0d0",
2563 violet :"#ee82ee",
2564 wheat :"#f5deb3",
2565 white :"#ffffff",
2566 whitesmoke :"#f5f5f5",
2567 yellow :"#ffff00",
2568 yellowgreen :"#9acd32",
2569 activeBorder :"Active window border.",
2570 activecaption :"Active window caption.",
2571 appworkspace :"Background color of multiple document interface.",
2572 background :"Desktop background.",
2573 buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",
2574 buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
2575 buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
2576 buttontext :"Text on push buttons.",
2577 captiontext :"Text in caption, size box, and scrollbar arrow box.",
2578 graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",
2579 highlight :"Item(s) selected in a control.",
2580 highlighttext :"Text of item(s) selected in a control.",
2581 inactiveborder :"Inactive window border.",
2582 inactivecaption :"Inactive window caption.",
2583 inactivecaptiontext :"Color of text in an inactive caption.",
2584 infobackground :"Background color for tooltip controls.",
2585 infotext :"Text color for tooltip controls.",
2586 menu :"Menu background.",
2587 menutext :"Text in menus.",
2588 scrollbar :"Scroll bar gray area.",
2589 threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
2590 threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
2591 threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
2592 threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
2593 threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
2594 window :"Window background.",
2595 windowframe :"Window frame.",
2596 windowtext :"Text in windows."
2597 };
2598 function Combinator(text, line, col){
2599
2600 SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE);
2601 this.type = "unknown";
2602 if (/^\s+$/.test(text)){
2603 this.type = "descendant";
2604 } else if (text == ">"){
2605 this.type = "child";
2606 } else if (text == "+"){
2607 this.type = "adjacent-sibling";
2608 } else if (text == "~"){
2609 this.type = "sibling";
2610 }
2611
2612 }
2613
2614 Combinator.prototype = new SyntaxUnit();
2615 Combinator.prototype.constructor = Combinator;
2616 function MediaFeature(name, value){
2617
2618 SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE);
2619 this.name = name;
2620 this.value = value;
2621 }
2622
2623 MediaFeature.prototype = new SyntaxUnit();
2624 MediaFeature.prototype.constructor = MediaFeature;
2625 function MediaQuery(modifier, mediaType, features, line, col){
2626
2627 SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
2628 this.modifier = modifier;
2629 this.mediaType = mediaType;
2630 this.features = features;
2631
2632 }
2633
2634 MediaQuery.prototype = new SyntaxUnit();
2635 MediaQuery.prototype.constructor = MediaQuery;
2636 function Parser(options){
2637 EventTarget.call(this);
2638
2639
2640 this.options = options || {};
2641
2642 this._tokenStream = null;
2643 }
2644 Parser.DEFAULT_TYPE = 0;
2645 Parser.COMBINATOR_TYPE = 1;
2646 Parser.MEDIA_FEATURE_TYPE = 2;
2647 Parser.MEDIA_QUERY_TYPE = 3;
2648 Parser.PROPERTY_NAME_TYPE = 4;
2649 Parser.PROPERTY_VALUE_TYPE = 5;
2650 Parser.PROPERTY_VALUE_PART_TYPE = 6;
2651 Parser.SELECTOR_TYPE = 7;
2652 Parser.SELECTOR_PART_TYPE = 8;
2653 Parser.SELECTOR_SUB_PART_TYPE = 9;
2654
2655 Parser.prototype = function(){
2656
2657 var proto = new EventTarget(), //new prototype
2658 prop,
2659 additions = {
2660 constructor: Parser,
2661 DEFAULT_TYPE : 0,
2662 COMBINATOR_TYPE : 1,
2663 MEDIA_FEATURE_TYPE : 2,
2664 MEDIA_QUERY_TYPE : 3,
2665 PROPERTY_NAME_TYPE : 4,
2666 PROPERTY_VALUE_TYPE : 5,
2667 PROPERTY_VALUE_PART_TYPE : 6,
2668 SELECTOR_TYPE : 7,
2669 SELECTOR_PART_TYPE : 8,
2670 SELECTOR_SUB_PART_TYPE : 9,
2671
2672 _stylesheet: function(){
2673
2674 var tokenStream = this._tokenStream,
2675 charset = null,
2676 count,
2677 token,
2678 tt;
2679
2680 this.fire("startstylesheet");
2681 this._charset();
2682
2683 this._skipCruft();
2684 while (tokenStream.peek() == Tokens.IMPORT_SYM){
2685 this._import();
2686 this._skipCruft();
2687 }
2688 while (tokenStream.peek() == Tokens.NAMESPACE_SYM){
2689 this._namespace();
2690 this._skipCruft();
2691 }
2692 tt = tokenStream.peek();
2693 while(tt > Tokens.EOF){
2694
2695 try {
2696
2697 switch(tt){
2698 case Tokens.MEDIA_SYM:
2699 this._media();
2700 this._skipCruft();
2701 break;
2702 case Tokens.PAGE_SYM:
2703 this._page();
2704 this._skipCruft();
2705 break;
2706 case Tokens.FONT_FACE_SYM:
2707 this._font_face();
2708 this._skipCruft();
2709 break;
2710 case Tokens.KEYFRAMES_SYM:
2711 this._keyframes();
2712 this._skipCruft();
2713 break;
2714 case Tokens.UNKNOWN_SYM: //unknown @ rule
2715 tokenStream.get();
2716 if (!this.options.strict){
2717 this.fire({
2718 type: "error",
2719 error: null,
2720 message: "Unknown @ rule: " + tokenStream.LT(0).value + ".",
2721 line: tokenStream.LT(0).startLine,
2722 col: tokenStream.LT(0).startCol
2723 });
2724 count=0;
2725 while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) == Tokens.LBRACE){
2726 count++; //keep track of nesting depth
2727 }
2728
2729 while(count){
2730 tokenStream.advance([Tokens.RBRACE]);
2731 count--;
2732 }
2733
2734 } else {
2735 throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol);
2736 }
2737 break;
2738 case Tokens.S:
2739 this._readWhitespace();
2740 break;
2741 default:
2742 if(!this._ruleset()){
2743 switch(tt){
2744 case Tokens.CHARSET_SYM:
2745 token = tokenStream.LT(1);
2746 this._charset(false);
2747 throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol);
2748 case Tokens.IMPORT_SYM:
2749 token = tokenStream.LT(1);
2750 this._import(false);
2751 throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol);
2752 case Tokens.NAMESPACE_SYM:
2753 token = tokenStream.LT(1);
2754 this._namespace(false);
2755 throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol);
2756 default:
2757 tokenStream.get(); //get the last token
2758 this._unexpectedToken(tokenStream.token());
2759 }
2760
2761 }
2762 }
2763 } catch(ex) {
2764 if (ex instanceof SyntaxError && !this.options.strict){
2765 this.fire({
2766 type: "error",
2767 error: ex,
2768 message: ex.message,
2769 line: ex.line,
2770 col: ex.col
2771 });
2772 } else {
2773 throw ex;
2774 }
2775 }
2776
2777 tt = tokenStream.peek();
2778 }
2779
2780 if (tt != Tokens.EOF){
2781 this._unexpectedToken(tokenStream.token());
2782 }
2783
2784 this.fire("endstylesheet");
2785 },
2786
2787 _charset: function(emit){
2788 var tokenStream = this._tokenStream,
2789 charset,
2790 token,
2791 line,
2792 col;
2793
2794 if (tokenStream.match(Tokens.CHARSET_SYM)){
2795 line = tokenStream.token().startLine;
2796 col = tokenStream.token().startCol;
2797
2798 this._readWhitespace();
2799 tokenStream.mustMatch(Tokens.STRING);
2800
2801 token = tokenStream.token();
2802 charset = token.value;
2803
2804 this._readWhitespace();
2805 tokenStream.mustMatch(Tokens.SEMICOLON);
2806
2807 if (emit !== false){
2808 this.fire({
2809 type: "charset",
2810 charset:charset,
2811 line: line,
2812 col: col
2813 });
2814 }
2815 }
2816 },
2817
2818 _import: function(emit){
2819
2820 var tokenStream = this._tokenStream,
2821 tt,
2822 uri,
2823 importToken,
2824 mediaList = [];
2825 tokenStream.mustMatch(Tokens.IMPORT_SYM);
2826 importToken = tokenStream.token();
2827 this._readWhitespace();
2828
2829 tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);
2830 uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1");
2831
2832 this._readWhitespace();
2833
2834 mediaList = this._media_query_list();
2835 tokenStream.mustMatch(Tokens.SEMICOLON);
2836 this._readWhitespace();
2837
2838 if (emit !== false){
2839 this.fire({
2840 type: "import",
2841 uri: uri,
2842 media: mediaList,
2843 line: importToken.startLine,
2844 col: importToken.startCol
2845 });
2846 }
2847
2848 },
2849
2850 _namespace: function(emit){
2851
2852 var tokenStream = this._tokenStream,
2853 line,
2854 col,
2855 prefix,
2856 uri;
2857 tokenStream.mustMatch(Tokens.NAMESPACE_SYM);
2858 line = tokenStream.token().startLine;
2859 col = tokenStream.token().startCol;
2860 this._readWhitespace();
2861 if (tokenStream.match(Tokens.IDENT)){
2862 prefix = tokenStream.token().value;
2863 this._readWhitespace();
2864 }
2865
2866 tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);
2867 uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1");
2868
2869 this._readWhitespace();
2870 tokenStream.mustMatch(Tokens.SEMICOLON);
2871 this._readWhitespace();
2872
2873 if (emit !== false){
2874 this.fire({
2875 type: "namespace",
2876 prefix: prefix,
2877 uri: uri,
2878 line: line,
2879 col: col
2880 });
2881 }
2882
2883 },
2884
2885 _media: function(){
2886 var tokenStream = this._tokenStream,
2887 line,
2888 col,
2889 mediaList;// = [];
2890 tokenStream.mustMatch(Tokens.MEDIA_SYM);
2891 line = tokenStream.token().startLine;
2892 col = tokenStream.token().startCol;
2893
2894 this._readWhitespace();
2895
2896 mediaList = this._media_query_list();
2897
2898 tokenStream.mustMatch(Tokens.LBRACE);
2899 this._readWhitespace();
2900
2901 this.fire({
2902 type: "startmedia",
2903 media: mediaList,
2904 line: line,
2905 col: col
2906 });
2907
2908 while(true) {
2909 if (tokenStream.peek() == Tokens.PAGE_SYM){
2910 this._page();
2911 } else if (!this._ruleset()){
2912 break;
2913 }
2914 }
2915
2916 tokenStream.mustMatch(Tokens.RBRACE);
2917 this._readWhitespace();
2918
2919 this.fire({
2920 type: "endmedia",
2921 media: mediaList,
2922 line: line,
2923 col: col
2924 });
2925 },
2926 _media_query_list: function(){
2927 var tokenStream = this._tokenStream,
2928 mediaList = [];
2929
2930
2931 this._readWhitespace();
2932
2933 if (tokenStream.peek() == Tokens.IDENT || tokenStream.peek() == Tokens.LPAREN){
2934 mediaList.push(this._media_query());
2935 }
2936
2937 while(tokenStream.match(Tokens.COMMA)){
2938 this._readWhitespace();
2939 mediaList.push(this._media_query());
2940 }
2941
2942 return mediaList;
2943 },
2944 _media_query: function(){
2945 var tokenStream = this._tokenStream,
2946 type = null,
2947 ident = null,
2948 token = null,
2949 expressions = [];
2950
2951 if (tokenStream.match(Tokens.IDENT)){
2952 ident = tokenStream.token().value.toLowerCase();
2953 if (ident != "only" && ident != "not"){
2954 tokenStream.unget();
2955 ident = null;
2956 } else {
2957 token = tokenStream.token();
2958 }
2959 }
2960
2961 this._readWhitespace();
2962
2963 if (tokenStream.peek() == Tokens.IDENT){
2964 type = this._media_type();
2965 if (token === null){
2966 token = tokenStream.token();
2967 }
2968 } else if (tokenStream.peek() == Tokens.LPAREN){
2969 if (token === null){
2970 token = tokenStream.LT(1);
2971 }
2972 expressions.push(this._media_expression());
2973 }
2974
2975 if (type === null && expressions.length === 0){
2976 return null;
2977 } else {
2978 this._readWhitespace();
2979 while (tokenStream.match(Tokens.IDENT)){
2980 if (tokenStream.token().value.toLowerCase() != "and"){
2981 this._unexpectedToken(tokenStream.token());
2982 }
2983
2984 this._readWhitespace();
2985 expressions.push(this._media_expression());
2986 }
2987 }
2988
2989 return new MediaQuery(ident, type, expressions, token.startLine, token.startCol);
2990 },
2991 _media_type: function(){
2992 return this._media_feature();
2993 },
2994 _media_expression: function(){
2995 var tokenStream = this._tokenStream,
2996 feature = null,
2997 token,
2998 expression = null;
2999
3000 tokenStream.mustMatch(Tokens.LPAREN);
3001
3002 feature = this._media_feature();
3003 this._readWhitespace();
3004
3005 if (tokenStream.match(Tokens.COLON)){
3006 this._readWhitespace();
3007 token = tokenStream.LT(1);
3008 expression = this._expression();
3009 }
3010
3011 tokenStream.mustMatch(Tokens.RPAREN);
3012 this._readWhitespace();
3013
3014 return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null));
3015 },
3016 _media_feature: function(){
3017 var tokenStream = this._tokenStream;
3018
3019 tokenStream.mustMatch(Tokens.IDENT);
3020
3021 return SyntaxUnit.fromToken(tokenStream.token());
3022 },
3023 _page: function(){
3024 var tokenStream = this._tokenStream,
3025 line,
3026 col,
3027 identifier = null,
3028 pseudoPage = null;
3029 tokenStream.mustMatch(Tokens.PAGE_SYM);
3030 line = tokenStream.token().startLine;
3031 col = tokenStream.token().startCol;
3032
3033 this._readWhitespace();
3034
3035 if (tokenStream.match(Tokens.IDENT)){
3036 identifier = tokenStream.token().value;
3037 if (identifier.toLowerCase() === "auto"){
3038 this._unexpectedToken(tokenStream.token());
3039 }
3040 }
3041 if (tokenStream.peek() == Tokens.COLON){
3042 pseudoPage = this._pseudo_page();
3043 }
3044
3045 this._readWhitespace();
3046
3047 this.fire({
3048 type: "startpage",
3049 id: identifier,
3050 pseudo: pseudoPage,
3051 line: line,
3052 col: col
3053 });
3054
3055 this._readDeclarations(true, true);
3056
3057 this.fire({
3058 type: "endpage",
3059 id: identifier,
3060 pseudo: pseudoPage,
3061 line: line,
3062 col: col
3063 });
3064
3065 },
3066 _margin: function(){
3067 var tokenStream = this._tokenStream,
3068 line,
3069 col,
3070 marginSym = this._margin_sym();
3071
3072 if (marginSym){
3073 line = tokenStream.token().startLine;
3074 col = tokenStream.token().startCol;
3075
3076 this.fire({
3077 type: "startpagemargin",
3078 margin: marginSym,
3079 line: line,
3080 col: col
3081 });
3082
3083 this._readDeclarations(true);
3084
3085 this.fire({
3086 type: "endpagemargin",
3087 margin: marginSym,
3088 line: line,
3089 col: col
3090 });
3091 return true;
3092 } else {
3093 return false;
3094 }
3095 },
3096 _margin_sym: function(){
3097
3098 var tokenStream = this._tokenStream;
3099
3100 if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM,
3101 Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM,
3102 Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM,
3103 Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM,
3104 Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM,
3105 Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM,
3106 Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM]))
3107 {
3108 return SyntaxUnit.fromToken(tokenStream.token());
3109 } else {
3110 return null;
3111 }
3112
3113 },
3114
3115 _pseudo_page: function(){
3116
3117 var tokenStream = this._tokenStream;
3118
3119 tokenStream.mustMatch(Tokens.COLON);
3120 tokenStream.mustMatch(Tokens.IDENT);
3121
3122 return tokenStream.token().value;
3123 },
3124
3125 _font_face: function(){
3126 var tokenStream = this._tokenStream,
3127 line,
3128 col;
3129 tokenStream.mustMatch(Tokens.FONT_FACE_SYM);
3130 line = tokenStream.token().startLine;
3131 col = tokenStream.token().startCol;
3132
3133 this._readWhitespace();
3134
3135 this.fire({
3136 type: "startfontface",
3137 line: line,
3138 col: col
3139 });
3140
3141 this._readDeclarations(true);
3142
3143 this.fire({
3144 type: "endfontface",
3145 line: line,
3146 col: col
3147 });
3148 },
3149
3150 _operator: function(inFunction){
3151
3152 var tokenStream = this._tokenStream,
3153 token = null;
3154
3155 if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) ||
3156 (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){
3157 token = tokenStream.token();
3158 this._readWhitespace();
3159 }
3160 return token ? PropertyValuePart.fromToken(token) : null;
3161
3162 },
3163
3164 _combinator: function(){
3165
3166 var tokenStream = this._tokenStream,
3167 value = null,
3168 token;
3169
3170 if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){
3171 token = tokenStream.token();
3172 value = new Combinator(token.value, token.startLine, token.startCol);
3173 this._readWhitespace();
3174 }
3175
3176 return value;
3177 },
3178
3179 _unary_operator: function(){
3180
3181 var tokenStream = this._tokenStream;
3182
3183 if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){
3184 return tokenStream.token().value;
3185 } else {
3186 return null;
3187 }
3188 },
3189
3190 _property: function(){
3191
3192 var tokenStream = this._tokenStream,
3193 value = null,
3194 hack = null,
3195 tokenValue,
3196 token,
3197 line,
3198 col;
3199 if (tokenStream.peek() == Tokens.STAR && this.options.starHack){
3200 tokenStream.get();
3201 token = tokenStream.token();
3202 hack = token.value;
3203 line = token.startLine;
3204 col = token.startCol;
3205 }
3206
3207 if(tokenStream.match(Tokens.IDENT)){
3208 token = tokenStream.token();
3209 tokenValue = token.value;
3210 if (tokenValue.charAt(0) == "_" && this.options.underscoreHack){
3211 hack = "_";
3212 tokenValue = tokenValue.substring(1);
3213 }
3214
3215 value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol));
3216 this._readWhitespace();
3217 }
3218
3219 return value;
3220 },
3221 _ruleset: function(){
3222
3223 var tokenStream = this._tokenStream,
3224 tt,
3225 selectors;
3226 try {
3227 selectors = this._selectors_group();
3228 } catch (ex){
3229 if (ex instanceof SyntaxError && !this.options.strict){
3230 this.fire({
3231 type: "error",
3232 error: ex,
3233 message: ex.message,
3234 line: ex.line,
3235 col: ex.col
3236 });
3237 tt = tokenStream.advance([Tokens.RBRACE]);
3238 if (tt == Tokens.RBRACE){
3239 } else {
3240 throw ex;
3241 }
3242
3243 } else {
3244 throw ex;
3245 }
3246 return true;
3247 }
3248 if (selectors){
3249
3250 this.fire({
3251 type: "startrule",
3252 selectors: selectors,
3253 line: selectors[0].line,
3254 col: selectors[0].col
3255 });
3256
3257 this._readDeclarations(true);
3258
3259 this.fire({
3260 type: "endrule",
3261 selectors: selectors,
3262 line: selectors[0].line,
3263 col: selectors[0].col
3264 });
3265
3266 }
3267
3268 return selectors;
3269
3270 },
3271 _selectors_group: function(){
3272 var tokenStream = this._tokenStream,
3273 selectors = [],
3274 selector;
3275
3276 selector = this._selector();
3277 if (selector !== null){
3278
3279 selectors.push(selector);
3280 while(tokenStream.match(Tokens.COMMA)){
3281 this._readWhitespace();
3282 selector = this._selector();
3283 if (selector !== null){
3284 selectors.push(selector);
3285 } else {
3286 this._unexpectedToken(tokenStream.LT(1));
3287 }
3288 }
3289 }
3290
3291 return selectors.length ? selectors : null;
3292 },
3293 _selector: function(){
3294
3295 var tokenStream = this._tokenStream,
3296 selector = [],
3297 nextSelector = null,
3298 combinator = null,
3299 ws = null;
3300 nextSelector = this._simple_selector_sequence();
3301 if (nextSelector === null){
3302 return null;
3303 }
3304
3305 selector.push(nextSelector);
3306
3307 do {
3308 combinator = this._combinator();
3309
3310 if (combinator !== null){
3311 selector.push(combinator);
3312 nextSelector = this._simple_selector_sequence();
3313 if (nextSelector === null){
3314 this._unexpectedToken(tokenStream.LT(1));
3315 } else {
3316 selector.push(nextSelector);
3317 }
3318 } else {
3319 if (this._readWhitespace()){
3320 ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol);
3321 combinator = this._combinator();
3322 nextSelector = this._simple_selector_sequence();
3323 if (nextSelector === null){
3324 if (combinator !== null){
3325 this._unexpectedToken(tokenStream.LT(1));
3326 }
3327 } else {
3328
3329 if (combinator !== null){
3330 selector.push(combinator);
3331 } else {
3332 selector.push(ws);
3333 }
3334
3335 selector.push(nextSelector);
3336 }
3337 } else {
3338 break;
3339 }
3340
3341 }
3342 } while(true);
3343
3344 return new Selector(selector, selector[0].line, selector[0].col);
3345 },
3346 _simple_selector_sequence: function(){
3347
3348 var tokenStream = this._tokenStream,
3349 elementName = null,
3350 modifiers = [],
3351 selectorText= "",
3352 components = [
3353 function(){
3354 return tokenStream.match(Tokens.HASH) ?
3355 new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) :
3356 null;
3357 },
3358 this._class,
3359 this._attrib,
3360 this._pseudo,
3361 this._negation
3362 ],
3363 i = 0,
3364 len = components.length,
3365 component = null,
3366 found = false,
3367 line,
3368 col;
3369 line = tokenStream.LT(1).startLine;
3370 col = tokenStream.LT(1).startCol;
3371
3372 elementName = this._type_selector();
3373 if (!elementName){
3374 elementName = this._universal();
3375 }
3376
3377 if (elementName !== null){
3378 selectorText += elementName;
3379 }
3380
3381 while(true){
3382 if (tokenStream.peek() === Tokens.S){
3383 break;
3384 }
3385 while(i < len && component === null){
3386 component = components[i++].call(this);
3387 }
3388
3389 if (component === null){
3390 if (selectorText === ""){
3391 return null;
3392 } else {
3393 break;
3394 }
3395 } else {
3396 i = 0;
3397 modifiers.push(component);
3398 selectorText += component.toString();
3399 component = null;
3400 }
3401 }
3402
3403
3404 return selectorText !== "" ?
3405 new SelectorPart(elementName, modifiers, selectorText, line, col) :
3406 null;
3407 },
3408 _type_selector: function(){
3409
3410 var tokenStream = this._tokenStream,
3411 ns = this._namespace_prefix(),
3412 elementName = this._element_name();
3413
3414 if (!elementName){
3415 if (ns){
3416 tokenStream.unget();
3417 if (ns.length > 1){
3418 tokenStream.unget();
3419 }
3420 }
3421
3422 return null;
3423 } else {
3424 if (ns){
3425 elementName.text = ns + elementName.text;
3426 elementName.col -= ns.length;
3427 }
3428 return elementName;
3429 }
3430 },
3431 _class: function(){
3432
3433 var tokenStream = this._tokenStream,
3434 token;
3435
3436 if (tokenStream.match(Tokens.DOT)){
3437 tokenStream.mustMatch(Tokens.IDENT);
3438 token = tokenStream.token();
3439 return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1);
3440 } else {
3441 return null;
3442 }
3443
3444 },
3445 _element_name: function(){
3446
3447 var tokenStream = this._tokenStream,
3448 token;
3449
3450 if (tokenStream.match(Tokens.IDENT)){
3451 token = tokenStream.token();
3452 return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol);
3453
3454 } else {
3455 return null;
3456 }
3457 },
3458 _namespace_prefix: function(){
3459 var tokenStream = this._tokenStream,
3460 value = "";
3461 if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){
3462
3463 if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){
3464 value += tokenStream.token().value;
3465 }
3466
3467 tokenStream.mustMatch(Tokens.PIPE);
3468 value += "|";
3469
3470 }
3471
3472 return value.length ? value : null;
3473 },
3474 _universal: function(){
3475 var tokenStream = this._tokenStream,
3476 value = "",
3477 ns;
3478
3479 ns = this._namespace_prefix();
3480 if(ns){
3481 value += ns;
3482 }
3483
3484 if(tokenStream.match(Tokens.STAR)){
3485 value += "*";
3486 }
3487
3488 return value.length ? value : null;
3489
3490 },
3491 _attrib: function(){
3492
3493 var tokenStream = this._tokenStream,
3494 value = null,
3495 ns,
3496 token;
3497
3498 if (tokenStream.match(Tokens.LBRACKET)){
3499 token = tokenStream.token();
3500 value = token.value;
3501 value += this._readWhitespace();
3502
3503 ns = this._namespace_prefix();
3504
3505 if (ns){
3506 value += ns;
3507 }
3508
3509 tokenStream.mustMatch(Tokens.IDENT);
3510 value += tokenStream.token().value;
3511 value += this._readWhitespace();
3512
3513 if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH,
3514 Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){
3515
3516 value += tokenStream.token().value;
3517 value += this._readWhitespace();
3518
3519 tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);
3520 value += tokenStream.token().value;
3521 value += this._readWhitespace();
3522 }
3523
3524 tokenStream.mustMatch(Tokens.RBRACKET);
3525
3526 return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol);
3527 } else {
3528 return null;
3529 }
3530 },
3531 _pseudo: function(){
3532
3533 var tokenStream = this._tokenStream,
3534 pseudo = null,
3535 colons = ":",
3536 line,
3537 col;
3538
3539 if (tokenStream.match(Tokens.COLON)){
3540
3541 if (tokenStream.match(Tokens.COLON)){
3542 colons += ":";
3543 }
3544
3545 if (tokenStream.match(Tokens.IDENT)){
3546 pseudo = tokenStream.token().value;
3547 line = tokenStream.token().startLine;
3548 col = tokenStream.token().startCol - colons.length;
3549 } else if (tokenStream.peek() == Tokens.FUNCTION){
3550 line = tokenStream.LT(1).startLine;
3551 col = tokenStream.LT(1).startCol - colons.length;
3552 pseudo = this._functional_pseudo();
3553 }
3554
3555 if (pseudo){
3556 pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col);
3557 }
3558 }
3559
3560 return pseudo;
3561 },
3562 _functional_pseudo: function(){
3563
3564 var tokenStream = this._tokenStream,
3565 value = null;
3566
3567 if(tokenStream.match(Tokens.FUNCTION)){
3568 value = tokenStream.token().value;
3569 value += this._readWhitespace();
3570 value += this._expression();
3571 tokenStream.mustMatch(Tokens.RPAREN);
3572 value += ")";
3573 }
3574
3575 return value;
3576 },
3577 _expression: function(){
3578
3579 var tokenStream = this._tokenStream,
3580 value = "";
3581
3582 while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION,
3583 Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH,
3584 Tokens.FREQ, Tokens.ANGLE, Tokens.TIME,
3585 Tokens.RESOLUTION, Tokens.SLASH])){
3586
3587 value += tokenStream.token().value;
3588 value += this._readWhitespace();
3589 }
3590
3591 return value.length ? value : null;
3592
3593 },
3594 _negation: function(){
3595
3596 var tokenStream = this._tokenStream,
3597 line,
3598 col,
3599 value = "",
3600 arg,
3601 subpart = null;
3602
3603 if (tokenStream.match(Tokens.NOT)){
3604 value = tokenStream.token().value;
3605 line = tokenStream.token().startLine;
3606 col = tokenStream.token().startCol;
3607 value += this._readWhitespace();
3608 arg = this._negation_arg();
3609 value += arg;
3610 value += this._readWhitespace();
3611 tokenStream.match(Tokens.RPAREN);
3612 value += tokenStream.token().value;
3613
3614 subpart = new SelectorSubPart(value, "not", line, col);
3615 subpart.args.push(arg);
3616 }
3617
3618 return subpart;
3619 },
3620 _negation_arg: function(){
3621
3622 var tokenStream = this._tokenStream,
3623 args = [
3624 this._type_selector,
3625 this._universal,
3626 function(){
3627 return tokenStream.match(Tokens.HASH) ?
3628 new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) :
3629 null;
3630 },
3631 this._class,
3632 this._attrib,
3633 this._pseudo
3634 ],
3635 arg = null,
3636 i = 0,
3637 len = args.length,
3638 elementName,
3639 line,
3640 col,
3641 part;
3642
3643 line = tokenStream.LT(1).startLine;
3644 col = tokenStream.LT(1).startCol;
3645
3646 while(i < len && arg === null){
3647
3648 arg = args[i].call(this);
3649 i++;
3650 }
3651 if (arg === null){
3652 this._unexpectedToken(tokenStream.LT(1));
3653 }
3654 if (arg.type == "elementName"){
3655 part = new SelectorPart(arg, [], arg.toString(), line, col);
3656 } else {
3657 part = new SelectorPart(null, [arg], arg.toString(), line, col);
3658 }
3659
3660 return part;
3661 },
3662
3663 _declaration: function(){
3664
3665 var tokenStream = this._tokenStream,
3666 property = null,
3667 expr = null,
3668 prio = null,
3669 error = null,
3670 invalid = null,
3671 propertyName= "";
3672
3673 property = this._property();
3674 if (property !== null){
3675
3676 tokenStream.mustMatch(Tokens.COLON);
3677 this._readWhitespace();
3678
3679 expr = this._expr();
3680 if (!expr || expr.length === 0){
3681 this._unexpectedToken(tokenStream.LT(1));
3682 }
3683
3684 prio = this._prio();
3685 propertyName = property.toString();
3686 if (this.options.starHack && property.hack == "*" ||
3687 this.options.underscoreHack && property.hack == "_") {
3688
3689 propertyName = property.text;
3690 }
3691
3692 try {
3693 this._validateProperty(propertyName, expr);
3694 } catch (ex) {
3695 invalid = ex;
3696 }
3697
3698 this.fire({
3699 type: "property",
3700 property: property,
3701 value: expr,
3702 important: prio,
3703 line: property.line,
3704 col: property.col,
3705 invalid: invalid
3706 });
3707
3708 return true;
3709 } else {
3710 return false;
3711 }
3712 },
3713
3714 _prio: function(){
3715
3716 var tokenStream = this._tokenStream,
3717 result = tokenStream.match(Tokens.IMPORTANT_SYM);
3718
3719 this._readWhitespace();
3720 return result;
3721 },
3722
3723 _expr: function(inFunction){
3724
3725 var tokenStream = this._tokenStream,
3726 values = [],
3727 value = null,
3728 operator = null;
3729
3730 value = this._term();
3731 if (value !== null){
3732
3733 values.push(value);
3734
3735 do {
3736 operator = this._operator(inFunction);
3737 if (operator){
3738 values.push(operator);
3739 } /*else {
3740 values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col));
3741 valueParts = [];
3742 }*/
3743
3744 value = this._term();
3745
3746 if (value === null){
3747 break;
3748 } else {
3749 values.push(value);
3750 }
3751 } while(true);
3752 }
3753
3754 return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null;
3755 },
3756
3757 _term: function(){
3758
3759 var tokenStream = this._tokenStream,
3760 unary = null,
3761 value = null,
3762 token,
3763 line,
3764 col;
3765 unary = this._unary_operator();
3766 if (unary !== null){
3767 line = tokenStream.token().startLine;
3768 col = tokenStream.token().startCol;
3769 }
3770 if (tokenStream.peek() == Tokens.IE_FUNCTION && this.options.ieFilters){
3771
3772 value = this._ie_function();
3773 if (unary === null){
3774 line = tokenStream.token().startLine;
3775 col = tokenStream.token().startCol;
3776 }
3777 } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH,
3778 Tokens.ANGLE, Tokens.TIME,
3779 Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){
3780
3781 value = tokenStream.token().value;
3782 if (unary === null){
3783 line = tokenStream.token().startLine;
3784 col = tokenStream.token().startCol;
3785 }
3786 this._readWhitespace();
3787 } else {
3788 token = this._hexcolor();
3789 if (token === null){
3790 if (unary === null){
3791 line = tokenStream.LT(1).startLine;
3792 col = tokenStream.LT(1).startCol;
3793 }
3794 if (value === null){
3795 if (tokenStream.LA(3) == Tokens.EQUALS && this.options.ieFilters){
3796 value = this._ie_function();
3797 } else {
3798 value = this._function();
3799 }
3800 }
3801
3802 } else {
3803 value = token.value;
3804 if (unary === null){
3805 line = token.startLine;
3806 col = token.startCol;
3807 }
3808 }
3809
3810 }
3811
3812 return value !== null ?
3813 new PropertyValuePart(unary !== null ? unary + value : value, line, col) :
3814 null;
3815
3816 },
3817
3818 _function: function(){
3819
3820 var tokenStream = this._tokenStream,
3821 functionText = null,
3822 expr = null,
3823 lt;
3824
3825 if (tokenStream.match(Tokens.FUNCTION)){
3826 functionText = tokenStream.token().value;
3827 this._readWhitespace();
3828 expr = this._expr(true);
3829 functionText += expr;
3830 if (this.options.ieFilters && tokenStream.peek() == Tokens.EQUALS){
3831 do {
3832
3833 if (this._readWhitespace()){
3834 functionText += tokenStream.token().value;
3835 }
3836 if (tokenStream.LA(0) == Tokens.COMMA){
3837 functionText += tokenStream.token().value;
3838 }
3839
3840 tokenStream.match(Tokens.IDENT);
3841 functionText += tokenStream.token().value;
3842
3843 tokenStream.match(Tokens.EQUALS);
3844 functionText += tokenStream.token().value;
3845 lt = tokenStream.peek();
3846 while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){
3847 tokenStream.get();
3848 functionText += tokenStream.token().value;
3849 lt = tokenStream.peek();
3850 }
3851 } while(tokenStream.match([Tokens.COMMA, Tokens.S]));
3852 }
3853
3854 tokenStream.match(Tokens.RPAREN);
3855 functionText += ")";
3856 this._readWhitespace();
3857 }
3858
3859 return functionText;
3860 },
3861
3862 _ie_function: function(){
3863
3864 var tokenStream = this._tokenStream,
3865 functionText = null,
3866 expr = null,
3867 lt;
3868 if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){
3869 functionText = tokenStream.token().value;
3870
3871 do {
3872
3873 if (this._readWhitespace()){
3874 functionText += tokenStream.token().value;
3875 }
3876 if (tokenStream.LA(0) == Tokens.COMMA){
3877 functionText += tokenStream.token().value;
3878 }
3879
3880 tokenStream.match(Tokens.IDENT);
3881 functionText += tokenStream.token().value;
3882
3883 tokenStream.match(Tokens.EQUALS);
3884 functionText += tokenStream.token().value;
3885 lt = tokenStream.peek();
3886 while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){
3887 tokenStream.get();
3888 functionText += tokenStream.token().value;
3889 lt = tokenStream.peek();
3890 }
3891 } while(tokenStream.match([Tokens.COMMA, Tokens.S]));
3892
3893 tokenStream.match(Tokens.RPAREN);
3894 functionText += ")";
3895 this._readWhitespace();
3896 }
3897
3898 return functionText;
3899 },
3900
3901 _hexcolor: function(){
3902
3903 var tokenStream = this._tokenStream,
3904 token = null,
3905 color;
3906
3907 if(tokenStream.match(Tokens.HASH)){
3908
3909 token = tokenStream.token();
3910 color = token.value;
3911 if (!/#[a-f0-9]{3,6}/i.test(color)){
3912 throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
3913 }
3914 this._readWhitespace();
3915 }
3916
3917 return token;
3918 },
3919
3920 _keyframes: function(){
3921 var tokenStream = this._tokenStream,
3922 token,
3923 tt,
3924 name,
3925 prefix = "";
3926
3927 tokenStream.mustMatch(Tokens.KEYFRAMES_SYM);
3928 token = tokenStream.token();
3929 if (/^@\-([^\-]+)\-/.test(token.value)) {
3930 prefix = RegExp.$1;
3931 }
3932
3933 this._readWhitespace();
3934 name = this._keyframe_name();
3935
3936 this._readWhitespace();
3937 tokenStream.mustMatch(Tokens.LBRACE);
3938
3939 this.fire({
3940 type: "startkeyframes",
3941 name: name,
3942 prefix: prefix,
3943 line: token.startLine,
3944 col: token.startCol
3945 });
3946
3947 this._readWhitespace();
3948 tt = tokenStream.peek();
3949 while(tt == Tokens.IDENT || tt == Tokens.PERCENTAGE) {
3950 this._keyframe_rule();
3951 this._readWhitespace();
3952 tt = tokenStream.peek();
3953 }
3954
3955 this.fire({
3956 type: "endkeyframes",
3957 name: name,
3958 prefix: prefix,
3959 line: token.startLine,
3960 col: token.startCol
3961 });
3962
3963 this._readWhitespace();
3964 tokenStream.mustMatch(Tokens.RBRACE);
3965
3966 },
3967
3968 _keyframe_name: function(){
3969 var tokenStream = this._tokenStream,
3970 token;
3971
3972 tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);
3973 return SyntaxUnit.fromToken(tokenStream.token());
3974 },
3975
3976 _keyframe_rule: function(){
3977 var tokenStream = this._tokenStream,
3978 token,
3979 keyList = this._key_list();
3980
3981 this.fire({
3982 type: "startkeyframerule",
3983 keys: keyList,
3984 line: keyList[0].line,
3985 col: keyList[0].col
3986 });
3987
3988 this._readDeclarations(true);
3989
3990 this.fire({
3991 type: "endkeyframerule",
3992 keys: keyList,
3993 line: keyList[0].line,
3994 col: keyList[0].col
3995 });
3996
3997 },
3998
3999 _key_list: function(){
4000 var tokenStream = this._tokenStream,
4001 token,
4002 key,
4003 keyList = [];
4004 keyList.push(this._key());
4005
4006 this._readWhitespace();
4007
4008 while(tokenStream.match(Tokens.COMMA)){
4009 this._readWhitespace();
4010 keyList.push(this._key());
4011 this._readWhitespace();
4012 }
4013
4014 return keyList;
4015 },
4016
4017 _key: function(){
4018
4019 var tokenStream = this._tokenStream,
4020 token;
4021
4022 if (tokenStream.match(Tokens.PERCENTAGE)){
4023 return SyntaxUnit.fromToken(tokenStream.token());
4024 } else if (tokenStream.match(Tokens.IDENT)){
4025 token = tokenStream.token();
4026
4027 if (/from|to/i.test(token.value)){
4028 return SyntaxUnit.fromToken(token);
4029 }
4030
4031 tokenStream.unget();
4032 }
4033 this._unexpectedToken(tokenStream.LT(1));
4034 },
4035 _skipCruft: function(){
4036 while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){
4037 }
4038 },
4039 _readDeclarations: function(checkStart, readMargins){
4040 var tokenStream = this._tokenStream,
4041 tt;
4042
4043
4044 this._readWhitespace();
4045
4046 if (checkStart){
4047 tokenStream.mustMatch(Tokens.LBRACE);
4048 }
4049
4050 this._readWhitespace();
4051
4052 try {
4053
4054 while(true){
4055
4056 if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){
4057 } else if (this._declaration()){
4058 if (!tokenStream.match(Tokens.SEMICOLON)){
4059 break;
4060 }
4061 } else {
4062 break;
4063 }
4064 this._readWhitespace();
4065 }
4066
4067 tokenStream.mustMatch(Tokens.RBRACE);
4068 this._readWhitespace();
4069
4070 } catch (ex) {
4071 if (ex instanceof SyntaxError && !this.options.strict){
4072 this.fire({
4073 type: "error",
4074 error: ex,
4075 message: ex.message,
4076 line: ex.line,
4077 col: ex.col
4078 });
4079 tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);
4080 if (tt == Tokens.SEMICOLON){
4081 this._readDeclarations(false, readMargins);
4082 } else if (tt != Tokens.RBRACE){
4083 throw ex;
4084 }
4085
4086 } else {
4087 throw ex;
4088 }
4089 }
4090
4091 },
4092 _readWhitespace: function(){
4093
4094 var tokenStream = this._tokenStream,
4095 ws = "";
4096
4097 while(tokenStream.match(Tokens.S)){
4098 ws += tokenStream.token().value;
4099 }
4100
4101 return ws;
4102 },
4103 _unexpectedToken: function(token){
4104 throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
4105 },
4106 _verifyEnd: function(){
4107 if (this._tokenStream.LA(1) != Tokens.EOF){
4108 this._unexpectedToken(this._tokenStream.LT(1));
4109 }
4110 },
4111 _validateProperty: function(property, value){
4112 Validation.validate(property, value);
4113 },
4114
4115 parse: function(input){
4116 this._tokenStream = new TokenStream(input, Tokens);
4117 this._stylesheet();
4118 },
4119
4120 parseStyleSheet: function(input){
4121 return this.parse(input);
4122 },
4123
4124 parseMediaQuery: function(input){
4125 this._tokenStream = new TokenStream(input, Tokens);
4126 var result = this._media_query();
4127 this._verifyEnd();
4128 return result;
4129 },
4130 parsePropertyValue: function(input){
4131
4132 this._tokenStream = new TokenStream(input, Tokens);
4133 this._readWhitespace();
4134
4135 var result = this._expr();
4136 this._readWhitespace();
4137 this._verifyEnd();
4138 return result;
4139 },
4140 parseRule: function(input){
4141 this._tokenStream = new TokenStream(input, Tokens);
4142 this._readWhitespace();
4143
4144 var result = this._ruleset();
4145 this._readWhitespace();
4146 this._verifyEnd();
4147 return result;
4148 },
4149 parseSelector: function(input){
4150
4151 this._tokenStream = new TokenStream(input, Tokens);
4152 this._readWhitespace();
4153
4154 var result = this._selector();
4155 this._readWhitespace();
4156 this._verifyEnd();
4157 return result;
4158 },
4159 parseStyleAttribute: function(input){
4160 input += "}"; // for error recovery in _readDeclarations()
4161 this._tokenStream = new TokenStream(input, Tokens);
4162 this._readDeclarations();
4163 }
4164 };
4165 for (prop in additions){
4166 if (additions.hasOwnProperty(prop)){
4167 proto[prop] = additions[prop];
4168 }
4169 }
4170
4171 return proto;
4172 }();
4173 var Properties = {
4174 "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>",
4175 "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
4176 "animation" : 1,
4177 "animation-delay" : { multi: "<time>", comma: true },
4178 "animation-direction" : { multi: "normal | alternate", comma: true },
4179 "animation-duration" : { multi: "<time>", comma: true },
4180 "animation-iteration-count" : { multi: "<number> | infinite", comma: true },
4181 "animation-name" : { multi: "none | <ident>", comma: true },
4182 "animation-play-state" : { multi: "running | paused", comma: true },
4183 "animation-timing-function" : 1,
4184 "-moz-animation-delay" : { multi: "<time>", comma: true },
4185 "-moz-animation-direction" : { multi: "normal | alternate", comma: true },
4186 "-moz-animation-duration" : { multi: "<time>", comma: true },
4187 "-moz-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
4188 "-moz-animation-name" : { multi: "none | <ident>", comma: true },
4189 "-moz-animation-play-state" : { multi: "running | paused", comma: true },
4190
4191 "-ms-animation-delay" : { multi: "<time>", comma: true },
4192 "-ms-animation-direction" : { multi: "normal | alternate", comma: true },
4193 "-ms-animation-duration" : { multi: "<time>", comma: true },
4194 "-ms-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
4195 "-ms-animation-name" : { multi: "none | <ident>", comma: true },
4196 "-ms-animation-play-state" : { multi: "running | paused", comma: true },
4197
4198 "-webkit-animation-delay" : { multi: "<time>", comma: true },
4199 "-webkit-animation-direction" : { multi: "normal | alternate", comma: true },
4200 "-webkit-animation-duration" : { multi: "<time>", comma: true },
4201 "-webkit-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
4202 "-webkit-animation-name" : { multi: "none | <ident>", comma: true },
4203 "-webkit-animation-play-state" : { multi: "running | paused", comma: true },
4204
4205 "-o-animation-delay" : { multi: "<time>", comma: true },
4206 "-o-animation-direction" : { multi: "normal | alternate", comma: true },
4207 "-o-animation-duration" : { multi: "<time>", comma: true },
4208 "-o-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
4209 "-o-animation-name" : { multi: "none | <ident>", comma: true },
4210 "-o-animation-play-state" : { multi: "running | paused", comma: true },
4211
4212 "appearance" : "icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit",
4213 "azimuth" : function (expression) {
4214 var simple = "<angle> | leftwards | rightwards | inherit",
4215 direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side",
4216 behind = false,
4217 valid = false,
4218 part;
4219
4220 if (!ValidationTypes.isAny(expression, simple)) {
4221 if (ValidationTypes.isAny(expression, "behind")) {
4222 behind = true;
4223 valid = true;
4224 }
4225
4226 if (ValidationTypes.isAny(expression, direction)) {
4227 valid = true;
4228 if (!behind) {
4229 ValidationTypes.isAny(expression, "behind");
4230 }
4231 }
4232 }
4233
4234 if (expression.hasNext()) {
4235 part = expression.next();
4236 if (valid) {
4237 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
4238 } else {
4239 throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col);
4240 }
4241 }
4242 },
4243 "backface-visibility" : "visible | hidden",
4244 "background" : 1,
4245 "background-attachment" : { multi: "<attachment>", comma: true },
4246 "background-clip" : { multi: "<box>", comma: true },
4247 "background-color" : "<color> | inherit",
4248 "background-image" : { multi: "<bg-image>", comma: true },
4249 "background-origin" : { multi: "<box>", comma: true },
4250 "background-position" : { multi: "<bg-position>", comma: true },
4251 "background-repeat" : { multi: "<repeat-style>" },
4252 "background-size" : { multi: "<bg-size>", comma: true },
4253 "baseline-shift" : "baseline | sub | super | <percentage> | <length>",
4254 "behavior" : 1,
4255 "binding" : 1,
4256 "bleed" : "<length>",
4257 "bookmark-label" : "<content> | <attr> | <string>",
4258 "bookmark-level" : "none | <integer>",
4259 "bookmark-state" : "open | closed",
4260 "bookmark-target" : "none | <uri> | <attr>",
4261 "border" : "<border-width> || <border-style> || <color>",
4262 "border-bottom" : "<border-width> || <border-style> || <color>",
4263 "border-bottom-color" : "<color>",
4264 "border-bottom-left-radius" : "<x-one-radius>",
4265 "border-bottom-right-radius" : "<x-one-radius>",
4266 "border-bottom-style" : "<border-style>",
4267 "border-bottom-width" : "<border-width>",
4268 "border-collapse" : "collapse | separate | inherit",
4269 "border-color" : { multi: "<color> | inherit", max: 4 },
4270 "border-image" : 1,
4271 "border-image-outset" : { multi: "<length> | <number>", max: 4 },
4272 "border-image-repeat" : { multi: "stretch | repeat | round", max: 2 },
4273 "border-image-slice" : function(expression) {
4274
4275 var valid = false,
4276 numeric = "<number> | <percentage>",
4277 fill = false,
4278 count = 0,
4279 max = 4,
4280 part;
4281
4282 if (ValidationTypes.isAny(expression, "fill")) {
4283 fill = true;
4284 valid = true;
4285 }
4286
4287 while (expression.hasNext() && count < max) {
4288 valid = ValidationTypes.isAny(expression, numeric);
4289 if (!valid) {
4290 break;
4291 }
4292 count++;
4293 }
4294
4295
4296 if (!fill) {
4297 ValidationTypes.isAny(expression, "fill");
4298 } else {
4299 valid = true;
4300 }
4301
4302 if (expression.hasNext()) {
4303 part = expression.next();
4304 if (valid) {
4305 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
4306 } else {
4307 throw new ValidationError("Expected ([<number> | <percentage>]{1,4} && fill?) but found '" + part + "'.", part.line, part.col);
4308 }
4309 }
4310 },
4311 "border-image-source" : "<image> | none",
4312 "border-image-width" : { multi: "<length> | <percentage> | <number> | auto", max: 4 },
4313 "border-left" : "<border-width> || <border-style> || <color>",
4314 "border-left-color" : "<color> | inherit",
4315 "border-left-style" : "<border-style>",
4316 "border-left-width" : "<border-width>",
4317 "border-radius" : function(expression) {
4318
4319 var valid = false,
4320 numeric = "<length> | <percentage>",
4321 slash = false,
4322 fill = false,
4323 count = 0,
4324 max = 8,
4325 part;
4326
4327 while (expression.hasNext() && count < max) {
4328 valid = ValidationTypes.isAny(expression, numeric);
4329 if (!valid) {
4330
4331 if (expression.peek() == "/" && count > 0 && !slash) {
4332 slash = true;
4333 max = count + 5;
4334 expression.next();
4335 } else {
4336 break;
4337 }
4338 }
4339 count++;
4340 }
4341
4342 if (expression.hasNext()) {
4343 part = expression.next();
4344 if (valid) {
4345 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
4346 } else {
4347 throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col);
4348 }
4349 }
4350 },
4351 "border-right" : "<border-width> || <border-style> || <color>",
4352 "border-right-color" : "<color> | inherit",
4353 "border-right-style" : "<border-style>",
4354 "border-right-width" : "<border-width>",
4355 "border-spacing" : { multi: "<length> | inherit", max: 2 },
4356 "border-style" : { multi: "<border-style>", max: 4 },
4357 "border-top" : "<border-width> || <border-style> || <color>",
4358 "border-top-color" : "<color> | inherit",
4359 "border-top-left-radius" : "<x-one-radius>",
4360 "border-top-right-radius" : "<x-one-radius>",
4361 "border-top-style" : "<border-style>",
4362 "border-top-width" : "<border-width>",
4363 "border-width" : { multi: "<border-width>", max: 4 },
4364 "bottom" : "<margin-width> | inherit",
4365 "box-align" : "start | end | center | baseline | stretch", //http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/
4366 "box-decoration-break" : "slice |clone",
4367 "box-direction" : "normal | reverse | inherit",
4368 "box-flex" : "<number>",
4369 "box-flex-group" : "<integer>",
4370 "box-lines" : "single | multiple",
4371 "box-ordinal-group" : "<integer>",
4372 "box-orient" : "horizontal | vertical | inline-axis | block-axis | inherit",
4373 "box-pack" : "start | end | center | justify",
4374 "box-shadow" : function (expression) {
4375 var result = false,
4376 part;
4377
4378 if (!ValidationTypes.isAny(expression, "none")) {
4379 Validation.multiProperty("<shadow>", expression, true, Infinity);
4380 } else {
4381 if (expression.hasNext()) {
4382 part = expression.next();
4383 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
4384 }
4385 }
4386 },
4387 "box-sizing" : "content-box | border-box | inherit",
4388 "break-after" : "auto | always | avoid | left | right | page | column | avoid-page | avoid-column",
4389 "break-before" : "auto | always | avoid | left | right | page | column | avoid-page | avoid-column",
4390 "break-inside" : "auto | avoid | avoid-page | avoid-column",
4391 "caption-side" : "top | bottom | inherit",
4392 "clear" : "none | right | left | both | inherit",
4393 "clip" : 1,
4394 "color" : "<color> | inherit",
4395 "color-profile" : 1,
4396 "column-count" : "<integer> | auto", //http://www.w3.org/TR/css3-multicol/
4397 "column-fill" : "auto | balance",
4398 "column-gap" : "<length> | normal",
4399 "column-rule" : "<border-width> || <border-style> || <color>",
4400 "column-rule-color" : "<color>",
4401 "column-rule-style" : "<border-style>",
4402 "column-rule-width" : "<border-width>",
4403 "column-span" : "none | all",
4404 "column-width" : "<length> | auto",
4405 "columns" : 1,
4406 "content" : 1,
4407 "counter-increment" : 1,
4408 "counter-reset" : 1,
4409 "crop" : "<shape> | auto",
4410 "cue" : "cue-after | cue-before | inherit",
4411 "cue-after" : 1,
4412 "cue-before" : 1,
4413 "cursor" : 1,
4414 "direction" : "ltr | rtl | inherit",
4415 "display" : "inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | box | inline-box | grid | inline-grid | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker",
4416 "dominant-baseline" : 1,
4417 "drop-initial-after-adjust" : "central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>",
4418 "drop-initial-after-align" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
4419 "drop-initial-before-adjust" : "before-edge | text-before-edge | central | middle | hanging | mathematical | <percentage> | <length>",
4420 "drop-initial-before-align" : "caps-height | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
4421 "drop-initial-size" : "auto | line | <length> | <percentage>",
4422 "drop-initial-value" : "initial | <integer>",
4423 "elevation" : "<angle> | below | level | above | higher | lower | inherit",
4424 "empty-cells" : "show | hide | inherit",
4425 "filter" : 1,
4426 "fit" : "fill | hidden | meet | slice",
4427 "fit-position" : 1,
4428 "float" : "left | right | none | inherit",
4429 "float-offset" : 1,
4430 "font" : 1,
4431 "font-family" : 1,
4432 "font-size" : "<absolute-size> | <relative-size> | <length> | <percentage> | inherit",
4433 "font-size-adjust" : "<number> | none | inherit",
4434 "font-stretch" : "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | inherit",
4435 "font-style" : "normal | italic | oblique | inherit",
4436 "font-variant" : "normal | small-caps | inherit",
4437 "font-weight" : "normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit",
4438 "grid-cell-stacking" : "columns | rows | layer",
4439 "grid-column" : 1,
4440 "grid-columns" : 1,
4441 "grid-column-align" : "start | end | center | stretch",
4442 "grid-column-sizing" : 1,
4443 "grid-column-span" : "<integer>",
4444 "grid-flow" : "none | rows | columns",
4445 "grid-layer" : "<integer>",
4446 "grid-row" : 1,
4447 "grid-rows" : 1,
4448 "grid-row-align" : "start | end | center | stretch",
4449 "grid-row-span" : "<integer>",
4450 "grid-row-sizing" : 1,
4451 "hanging-punctuation" : 1,
4452 "height" : "<margin-width> | inherit",
4453 "hyphenate-after" : "<integer> | auto",
4454 "hyphenate-before" : "<integer> | auto",
4455 "hyphenate-character" : "<string> | auto",
4456 "hyphenate-lines" : "no-limit | <integer>",
4457 "hyphenate-resource" : 1,
4458 "hyphens" : "none | manual | auto",
4459 "icon" : 1,
4460 "image-orientation" : "angle | auto",
4461 "image-rendering" : 1,
4462 "image-resolution" : 1,
4463 "inline-box-align" : "initial | last | <integer>",
4464 "left" : "<margin-width> | inherit",
4465 "letter-spacing" : "<length> | normal | inherit",
4466 "line-height" : "<number> | <length> | <percentage> | normal | inherit",
4467 "line-break" : "auto | loose | normal | strict",
4468 "line-stacking" : 1,
4469 "line-stacking-ruby" : "exclude-ruby | include-ruby",
4470 "line-stacking-shift" : "consider-shifts | disregard-shifts",
4471 "line-stacking-strategy" : "inline-line-height | block-line-height | max-height | grid-height",
4472 "list-style" : 1,
4473 "list-style-image" : "<uri> | none | inherit",
4474 "list-style-position" : "inside | outside | inherit",
4475 "list-style-type" : "disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit",
4476 "margin" : { multi: "<margin-width> | inherit", max: 4 },
4477 "margin-bottom" : "<margin-width> | inherit",
4478 "margin-left" : "<margin-width> | inherit",
4479 "margin-right" : "<margin-width> | inherit",
4480 "margin-top" : "<margin-width> | inherit",
4481 "mark" : 1,
4482 "mark-after" : 1,
4483 "mark-before" : 1,
4484 "marks" : 1,
4485 "marquee-direction" : 1,
4486 "marquee-play-count" : 1,
4487 "marquee-speed" : 1,
4488 "marquee-style" : 1,
4489 "max-height" : "<length> | <percentage> | none | inherit",
4490 "max-width" : "<length> | <percentage> | none | inherit",
4491 "min-height" : "<length> | <percentage> | inherit",
4492 "min-width" : "<length> | <percentage> | inherit",
4493 "move-to" : 1,
4494 "nav-down" : 1,
4495 "nav-index" : 1,
4496 "nav-left" : 1,
4497 "nav-right" : 1,
4498 "nav-up" : 1,
4499 "opacity" : "<number> | inherit",
4500 "orphans" : "<integer> | inherit",
4501 "outline" : 1,
4502 "outline-color" : "<color> | invert | inherit",
4503 "outline-offset" : 1,
4504 "outline-style" : "<border-style> | inherit",
4505 "outline-width" : "<border-width> | inherit",
4506 "overflow" : "visible | hidden | scroll | auto | inherit",
4507 "overflow-style" : 1,
4508 "overflow-x" : 1,
4509 "overflow-y" : 1,
4510 "padding" : { multi: "<padding-width> | inherit", max: 4 },
4511 "padding-bottom" : "<padding-width> | inherit",
4512 "padding-left" : "<padding-width> | inherit",
4513 "padding-right" : "<padding-width> | inherit",
4514 "padding-top" : "<padding-width> | inherit",
4515 "page" : 1,
4516 "page-break-after" : "auto | always | avoid | left | right | inherit",
4517 "page-break-before" : "auto | always | avoid | left | right | inherit",
4518 "page-break-inside" : "auto | avoid | inherit",
4519 "page-policy" : 1,
4520 "pause" : 1,
4521 "pause-after" : 1,
4522 "pause-before" : 1,
4523 "perspective" : 1,
4524 "perspective-origin" : 1,
4525 "phonemes" : 1,
4526 "pitch" : 1,
4527 "pitch-range" : 1,
4528 "play-during" : 1,
4529 "pointer-events" : "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",
4530 "position" : "static | relative | absolute | fixed | inherit",
4531 "presentation-level" : 1,
4532 "punctuation-trim" : 1,
4533 "quotes" : 1,
4534 "rendering-intent" : 1,
4535 "resize" : 1,
4536 "rest" : 1,
4537 "rest-after" : 1,
4538 "rest-before" : 1,
4539 "richness" : 1,
4540 "right" : "<margin-width> | inherit",
4541 "rotation" : 1,
4542 "rotation-point" : 1,
4543 "ruby-align" : 1,
4544 "ruby-overhang" : 1,
4545 "ruby-position" : 1,
4546 "ruby-span" : 1,
4547 "size" : 1,
4548 "speak" : "normal | none | spell-out | inherit",
4549 "speak-header" : "once | always | inherit",
4550 "speak-numeral" : "digits | continuous | inherit",
4551 "speak-punctuation" : "code | none | inherit",
4552 "speech-rate" : 1,
4553 "src" : 1,
4554 "stress" : 1,
4555 "string-set" : 1,
4556
4557 "table-layout" : "auto | fixed | inherit",
4558 "tab-size" : "<integer> | <length>",
4559 "target" : 1,
4560 "target-name" : 1,
4561 "target-new" : 1,
4562 "target-position" : 1,
4563 "text-align" : "left | right | center | justify | inherit" ,
4564 "text-align-last" : 1,
4565 "text-decoration" : 1,
4566 "text-emphasis" : 1,
4567 "text-height" : 1,
4568 "text-indent" : "<length> | <percentage> | inherit",
4569 "text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
4570 "text-outline" : 1,
4571 "text-overflow" : 1,
4572 "text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
4573 "text-shadow" : 1,
4574 "text-transform" : "capitalize | uppercase | lowercase | none | inherit",
4575 "text-wrap" : "normal | none | avoid",
4576 "top" : "<margin-width> | inherit",
4577 "transform" : 1,
4578 "transform-origin" : 1,
4579 "transform-style" : 1,
4580 "transition" : 1,
4581 "transition-delay" : 1,
4582 "transition-duration" : 1,
4583 "transition-property" : 1,
4584 "transition-timing-function" : 1,
4585 "unicode-bidi" : "normal | embed | bidi-override | inherit",
4586 "user-modify" : "read-only | read-write | write-only | inherit",
4587 "user-select" : "none | text | toggle | element | elements | all | inherit",
4588 "vertical-align" : "auto | use-script | baseline | sub | super | top | text-top | central | middle | bottom | text-bottom | <percentage> | <length>",
4589 "visibility" : "visible | hidden | collapse | inherit",
4590 "voice-balance" : 1,
4591 "voice-duration" : 1,
4592 "voice-family" : 1,
4593 "voice-pitch" : 1,
4594 "voice-pitch-range" : 1,
4595 "voice-rate" : 1,
4596 "voice-stress" : 1,
4597 "voice-volume" : 1,
4598 "volume" : 1,
4599 "white-space" : "normal | pre | nowrap | pre-wrap | pre-line | inherit | -pre-wrap | -o-pre-wrap | -moz-pre-wrap | -hp-pre-wrap", //http://perishablepress.com/wrapping-content/
4600 "white-space-collapse" : 1,
4601 "widows" : "<integer> | inherit",
4602 "width" : "<length> | <percentage> | auto | inherit" ,
4603 "word-break" : "normal | keep-all | break-all",
4604 "word-spacing" : "<length> | normal | inherit",
4605 "word-wrap" : 1,
4606 "z-index" : "<integer> | auto | inherit",
4607 "zoom" : "<number> | <percentage> | normal"
4608 };
4609 function PropertyName(text, hack, line, col){
4610
4611 SyntaxUnit.call(this, text, line, col, Parser.PROPERTY_NAME_TYPE);
4612 this.hack = hack;
4613
4614 }
4615
4616 PropertyName.prototype = new SyntaxUnit();
4617 PropertyName.prototype.constructor = PropertyName;
4618 PropertyName.prototype.toString = function(){
4619 return (this.hack ? this.hack : "") + this.text;
4620 };
4621 function PropertyValue(parts, line, col){
4622
4623 SyntaxUnit.call(this, parts.join(" "), line, col, Parser.PROPERTY_VALUE_TYPE);
4624 this.parts = parts;
4625
4626 }
4627
4628 PropertyValue.prototype = new SyntaxUnit();
4629 PropertyValue.prototype.constructor = PropertyValue;
4630 function PropertyValueIterator(value){
4631 this._i = 0;
4632 this._parts = value.parts;
4633 this._marks = [];
4634 this.value = value;
4635
4636 }
4637 PropertyValueIterator.prototype.count = function(){
4638 return this._parts.length;
4639 };
4640 PropertyValueIterator.prototype.isFirst = function(){
4641 return this._i === 0;
4642 };
4643 PropertyValueIterator.prototype.hasNext = function(){
4644 return (this._i < this._parts.length);
4645 };
4646 PropertyValueIterator.prototype.mark = function(){
4647 this._marks.push(this._i);
4648 };
4649 PropertyValueIterator.prototype.peek = function(count){
4650 return this.hasNext() ? this._parts[this._i + (count || 0)] : null;
4651 };
4652 PropertyValueIterator.prototype.next = function(){
4653 return this.hasNext() ? this._parts[this._i++] : null;
4654 };
4655 PropertyValueIterator.prototype.previous = function(){
4656 return this._i > 0 ? this._parts[--this._i] : null;
4657 };
4658 PropertyValueIterator.prototype.restore = function(){
4659 if (this._marks.length){
4660 this._i = this._marks.pop();
4661 }
4662 };
4663 function PropertyValuePart(text, line, col){
4664
4665 SyntaxUnit.call(this, text, line, col, Parser.PROPERTY_VALUE_PART_TYPE);
4666 this.type = "unknown";
4667
4668 var temp;
4669 if (/^([+\-]?[\d\.]+)([a-z]+)$/i.test(text)){ //dimension
4670 this.type = "dimension";
4671 this.value = +RegExp.$1;
4672 this.units = RegExp.$2;
4673 switch(this.units.toLowerCase()){
4674
4675 case "em":
4676 case "rem":
4677 case "ex":
4678 case "px":
4679 case "cm":
4680 case "mm":
4681 case "in":
4682 case "pt":
4683 case "pc":
4684 case "ch":
4685 this.type = "length";
4686 break;
4687
4688 case "deg":
4689 case "rad":
4690 case "grad":
4691 this.type = "angle";
4692 break;
4693
4694 case "ms":
4695 case "s":
4696 this.type = "time";
4697 break;
4698
4699 case "hz":
4700 case "khz":
4701 this.type = "frequency";
4702 break;
4703
4704 case "dpi":
4705 case "dpcm":
4706 this.type = "resolution";
4707 break;
4708
4709 }
4710
4711 } else if (/^([+\-]?[\d\.]+)%$/i.test(text)){ //percentage
4712 this.type = "percentage";
4713 this.value = +RegExp.$1;
4714 } else if (/^([+\-]?[\d\.]+)%$/i.test(text)){ //percentage
4715 this.type = "percentage";
4716 this.value = +RegExp.$1;
4717 } else if (/^([+\-]?\d+)$/i.test(text)){ //integer
4718 this.type = "integer";
4719 this.value = +RegExp.$1;
4720 } else if (/^([+\-]?[\d\.]+)$/i.test(text)){ //number
4721 this.type = "number";
4722 this.value = +RegExp.$1;
4723
4724 } else if (/^#([a-f0-9]{3,6})/i.test(text)){ //hexcolor
4725 this.type = "color";
4726 temp = RegExp.$1;
4727 if (temp.length == 3){
4728 this.red = parseInt(temp.charAt(0)+temp.charAt(0),16);
4729 this.green = parseInt(temp.charAt(1)+temp.charAt(1),16);
4730 this.blue = parseInt(temp.charAt(2)+temp.charAt(2),16);
4731 } else {
4732 this.red = parseInt(temp.substring(0,2),16);
4733 this.green = parseInt(temp.substring(2,4),16);
4734 this.blue = parseInt(temp.substring(4,6),16);
4735 }
4736 } else if (/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i.test(text)){ //rgb() color with absolute numbers
4737 this.type = "color";
4738 this.red = +RegExp.$1;
4739 this.green = +RegExp.$2;
4740 this.blue = +RegExp.$3;
4741 } else if (/^rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)){ //rgb() color with percentages
4742 this.type = "color";
4743 this.red = +RegExp.$1 * 255 / 100;
4744 this.green = +RegExp.$2 * 255 / 100;
4745 this.blue = +RegExp.$3 * 255 / 100;
4746 } else if (/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/i.test(text)){ //rgba() color with absolute numbers
4747 this.type = "color";
4748 this.red = +RegExp.$1;
4749 this.green = +RegExp.$2;
4750 this.blue = +RegExp.$3;
4751 this.alpha = +RegExp.$4;
4752 } else if (/^rgba\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)){ //rgba() color with percentages
4753 this.type = "color";
4754 this.red = +RegExp.$1 * 255 / 100;
4755 this.green = +RegExp.$2 * 255 / 100;
4756 this.blue = +RegExp.$3 * 255 / 100;
4757 this.alpha = +RegExp.$4;
4758 } else if (/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)){ //hsl()
4759 this.type = "color";
4760 this.hue = +RegExp.$1;
4761 this.saturation = +RegExp.$2 / 100;
4762 this.lightness = +RegExp.$3 / 100;
4763 } else if (/^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)){ //hsla() color with percentages
4764 this.type = "color";
4765 this.hue = +RegExp.$1;
4766 this.saturation = +RegExp.$2 / 100;
4767 this.lightness = +RegExp.$3 / 100;
4768 this.alpha = +RegExp.$4;
4769 } else if (/^url\(["']?([^\)"']+)["']?\)/i.test(text)){ //URI
4770 this.type = "uri";
4771 this.uri = RegExp.$1;
4772 } else if (/^([^\(]+)\(/i.test(text)){
4773 this.type = "function";
4774 this.name = RegExp.$1;
4775 this.value = text;
4776 } else if (/^["'][^"']*["']/.test(text)){ //string
4777 this.type = "string";
4778 this.value = eval(text);
4779 } else if (Colors[text.toLowerCase()]){ //named color
4780 this.type = "color";
4781 temp = Colors[text.toLowerCase()].substring(1);
4782 this.red = parseInt(temp.substring(0,2),16);
4783 this.green = parseInt(temp.substring(2,4),16);
4784 this.blue = parseInt(temp.substring(4,6),16);
4785 } else if (/^[\,\/]$/.test(text)){
4786 this.type = "operator";
4787 this.value = text;
4788 } else if (/^[a-z\-\u0080-\uFFFF][a-z0-9\-\u0080-\uFFFF]*$/i.test(text)){
4789 this.type = "identifier";
4790 this.value = text;
4791 }
4792
4793 }
4794
4795 PropertyValuePart.prototype = new SyntaxUnit();
4796 PropertyValuePart.prototype.constructor = PropertyValuePart;
4797 PropertyValuePart.fromToken = function(token){
4798 return new PropertyValuePart(token.value, token.startLine, token.startCol);
4799 };
4800 var Pseudos = {
4801 ":first-letter": 1,
4802 ":first-line": 1,
4803 ":before": 1,
4804 ":after": 1
4805 };
4806
4807 Pseudos.ELEMENT = 1;
4808 Pseudos.CLASS = 2;
4809
4810 Pseudos.isElement = function(pseudo){
4811 return pseudo.indexOf("::") === 0 || Pseudos[pseudo.toLowerCase()] == Pseudos.ELEMENT;
4812 };
4813 function Selector(parts, line, col){
4814
4815 SyntaxUnit.call(this, parts.join(" "), line, col, Parser.SELECTOR_TYPE);
4816 this.parts = parts;
4817 this.specificity = Specificity.calculate(this);
4818
4819 }
4820
4821 Selector.prototype = new SyntaxUnit();
4822 Selector.prototype.constructor = Selector;
4823 function SelectorPart(elementName, modifiers, text, line, col){
4824
4825 SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_PART_TYPE);
4826 this.elementName = elementName;
4827 this.modifiers = modifiers;
4828
4829 }
4830
4831 SelectorPart.prototype = new SyntaxUnit();
4832 SelectorPart.prototype.constructor = SelectorPart;
4833 function SelectorSubPart(text, type, line, col){
4834
4835 SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_SUB_PART_TYPE);
4836 this.type = type;
4837 this.args = [];
4838
4839 }
4840
4841 SelectorSubPart.prototype = new SyntaxUnit();
4842 SelectorSubPart.prototype.constructor = SelectorSubPart;
4843 function Specificity(a, b, c, d){
4844 this.a = a;
4845 this.b = b;
4846 this.c = c;
4847 this.d = d;
4848 }
4849
4850 Specificity.prototype = {
4851 constructor: Specificity,
4852 compare: function(other){
4853 var comps = ["a", "b", "c", "d"],
4854 i, len;
4855
4856 for (i=0, len=comps.length; i < len; i++){
4857 if (this[comps[i]] < other[comps[i]]){
4858 return -1;
4859 } else if (this[comps[i]] > other[comps[i]]){
4860 return 1;
4861 }
4862 }
4863
4864 return 0;
4865 },
4866 valueOf: function(){
4867 return (this.a * 1000) + (this.b * 100) + (this.c * 10) + this.d;
4868 },
4869 toString: function(){
4870 return this.a + "," + this.b + "," + this.c + "," + this.d;
4871 }
4872
4873 };
4874 Specificity.calculate = function(selector){
4875
4876 var i, len,
4877 part,
4878 b=0, c=0, d=0;
4879
4880 function updateValues(part){
4881
4882 var i, j, len, num,
4883 elementName = part.elementName ? part.elementName.text : "",
4884 modifier;
4885
4886 if (elementName && elementName.charAt(elementName.length-1) != "*") {
4887 d++;
4888 }
4889
4890 for (i=0, len=part.modifiers.length; i < len; i++){
4891 modifier = part.modifiers[i];
4892 switch(modifier.type){
4893 case "class":
4894 case "attribute":
4895 c++;
4896 break;
4897
4898 case "id":
4899 b++;
4900 break;
4901
4902 case "pseudo":
4903 if (Pseudos.isElement(modifier.text)){
4904 d++;
4905 } else {
4906 c++;
4907 }
4908 break;
4909
4910 case "not":
4911 for (j=0, num=modifier.args.length; j < num; j++){
4912 updateValues(modifier.args[j]);
4913 }
4914 }
4915 }
4916 }
4917
4918 for (i=0, len=selector.parts.length; i < len; i++){
4919 part = selector.parts[i];
4920
4921 if (part instanceof SelectorPart){
4922 updateValues(part);
4923 }
4924 }
4925
4926 return new Specificity(0, b, c, d);
4927 };
4928
4929 var h = /^[0-9a-fA-F]$/,
4930 nonascii = /^[\u0080-\uFFFF]$/,
4931 nl = /\n|\r\n|\r|\f/;
4932
4933
4934 function isHexDigit(c){
4935 return c !== null && h.test(c);
4936 }
4937
4938 function isDigit(c){
4939 return c !== null && /\d/.test(c);
4940 }
4941
4942 function isWhitespace(c){
4943 return c !== null && /\s/.test(c);
4944 }
4945
4946 function isNewLine(c){
4947 return c !== null && nl.test(c);
4948 }
4949
4950 function isNameStart(c){
4951 return c !== null && (/[a-z_\u0080-\uFFFF\\]/i.test(c));
4952 }
4953
4954 function isNameChar(c){
4955 return c !== null && (isNameStart(c) || /[0-9\-\\]/.test(c));
4956 }
4957
4958 function isIdentStart(c){
4959 return c !== null && (isNameStart(c) || /\-\\/.test(c));
4960 }
4961
4962 function mix(receiver, supplier){
4963 for (var prop in supplier){
4964 if (supplier.hasOwnProperty(prop)){
4965 receiver[prop] = supplier[prop];
4966 }
4967 }
4968 return receiver;
4969 }
4970 function TokenStream(input){
4971 TokenStreamBase.call(this, input, Tokens);
4972 }
4973
4974 TokenStream.prototype = mix(new TokenStreamBase(), {
4975 _getToken: function(channel){
4976
4977 var c,
4978 reader = this._reader,
4979 token = null,
4980 startLine = reader.getLine(),
4981 startCol = reader.getCol();
4982
4983 c = reader.read();
4984
4985
4986 while(c){
4987 switch(c){
4988 case "/":
4989
4990 if(reader.peek() == "*"){
4991 token = this.commentToken(c, startLine, startCol);
4992 } else {
4993 token = this.charToken(c, startLine, startCol);
4994 }
4995 break;
4996 case "|":
4997 case "~":
4998 case "^":
4999 case "$":
5000 case "*":
5001 if(reader.peek() == "="){
5002 token = this.comparisonToken(c, startLine, startCol);
5003 } else {
5004 token = this.charToken(c, startLine, startCol);
5005 }
5006 break;
5007 case "\"":
5008 case "'":
5009 token = this.stringToken(c, startLine, startCol);
5010 break;
5011 case "#":
5012 if (isNameChar(reader.peek())){
5013 token = this.hashToken(c, startLine, startCol);
5014 } else {
5015 token = this.charToken(c, startLine, startCol);
5016 }
5017 break;
5018 case ".":
5019 if (isDigit(reader.peek())){
5020 token = this.numberToken(c, startLine, startCol);
5021 } else {
5022 token = this.charToken(c, startLine, startCol);
5023 }
5024 break;
5025 case "-":
5026 if (reader.peek() == "-"){ //could be closing HTML-style comment
5027 token = this.htmlCommentEndToken(c, startLine, startCol);
5028 } else if (isNameStart(reader.peek())){
5029 token = this.identOrFunctionToken(c, startLine, startCol);
5030 } else {
5031 token = this.charToken(c, startLine, startCol);
5032 }
5033 break;
5034 case "!":
5035 token = this.importantToken(c, startLine, startCol);
5036 break;
5037 case "@":
5038 token = this.atRuleToken(c, startLine, startCol);
5039 break;
5040 case ":":
5041 token = this.notToken(c, startLine, startCol);
5042 break;
5043 case "<":
5044 token = this.htmlCommentStartToken(c, startLine, startCol);
5045 break;
5046 case "U":
5047 case "u":
5048 if (reader.peek() == "+"){
5049 token = this.unicodeRangeToken(c, startLine, startCol);
5050 break;
5051 }
5052 default:
5053 if (isDigit(c)){
5054 token = this.numberToken(c, startLine, startCol);
5055 } else
5056 if (isWhitespace(c)){
5057 token = this.whitespaceToken(c, startLine, startCol);
5058 } else
5059 if (isIdentStart(c)){
5060 token = this.identOrFunctionToken(c, startLine, startCol);
5061 } else
5062 {
5063 token = this.charToken(c, startLine, startCol);
5064 }
5065
5066
5067
5068
5069
5070
5071 }
5072 break;
5073 }
5074
5075 if (!token && c === null){
5076 token = this.createToken(Tokens.EOF,null,startLine,startCol);
5077 }
5078
5079 return token;
5080 },
5081 createToken: function(tt, value, startLine, startCol, options){
5082 var reader = this._reader;
5083 options = options || {};
5084
5085 return {
5086 value: value,
5087 type: tt,
5088 channel: options.channel,
5089 hide: options.hide || false,
5090 startLine: startLine,
5091 startCol: startCol,
5092 endLine: reader.getLine(),
5093 endCol: reader.getCol()
5094 };
5095 },
5096 atRuleToken: function(first, startLine, startCol){
5097 var rule = first,
5098 reader = this._reader,
5099 tt = Tokens.CHAR,
5100 valid = false,
5101 ident,
5102 c;
5103 reader.mark();
5104 ident = this.readName();
5105 rule = first + ident;
5106 tt = Tokens.type(rule.toLowerCase());
5107 if (tt == Tokens.CHAR || tt == Tokens.UNKNOWN){
5108 if (rule.length > 1){
5109 tt = Tokens.UNKNOWN_SYM;
5110 } else {
5111 tt = Tokens.CHAR;
5112 rule = first;
5113 reader.reset();
5114 }
5115 }
5116
5117 return this.createToken(tt, rule, startLine, startCol);
5118 },
5119 charToken: function(c, startLine, startCol){
5120 var tt = Tokens.type(c);
5121
5122 if (tt == -1){
5123 tt = Tokens.CHAR;
5124 }
5125
5126 return this.createToken(tt, c, startLine, startCol);
5127 },
5128 commentToken: function(first, startLine, startCol){
5129 var reader = this._reader,
5130 comment = this.readComment(first);
5131
5132 return this.createToken(Tokens.COMMENT, comment, startLine, startCol);
5133 },
5134 comparisonToken: function(c, startLine, startCol){
5135 var reader = this._reader,
5136 comparison = c + reader.read(),
5137 tt = Tokens.type(comparison) || Tokens.CHAR;
5138
5139 return this.createToken(tt, comparison, startLine, startCol);
5140 },
5141 hashToken: function(first, startLine, startCol){
5142 var reader = this._reader,
5143 name = this.readName(first);
5144
5145 return this.createToken(Tokens.HASH, name, startLine, startCol);
5146 },
5147 htmlCommentStartToken: function(first, startLine, startCol){
5148 var reader = this._reader,
5149 text = first;
5150
5151 reader.mark();
5152 text += reader.readCount(3);
5153
5154 if (text == "<!--"){
5155 return this.createToken(Tokens.CDO, text, startLine, startCol);
5156 } else {
5157 reader.reset();
5158 return this.charToken(first, startLine, startCol);
5159 }
5160 },
5161 htmlCommentEndToken: function(first, startLine, startCol){
5162 var reader = this._reader,
5163 text = first;
5164
5165 reader.mark();
5166 text += reader.readCount(2);
5167
5168 if (text == "-->"){
5169 return this.createToken(Tokens.CDC, text, startLine, startCol);
5170 } else {
5171 reader.reset();
5172 return this.charToken(first, startLine, startCol);
5173 }
5174 },
5175 identOrFunctionToken: function(first, startLine, startCol){
5176 var reader = this._reader,
5177 ident = this.readName(first),
5178 tt = Tokens.IDENT;
5179 if (reader.peek() == "("){
5180 ident += reader.read();
5181 if (ident.toLowerCase() == "url("){
5182 tt = Tokens.URI;
5183 ident = this.readURI(ident);
5184 if (ident.toLowerCase() == "url("){
5185 tt = Tokens.FUNCTION;
5186 }
5187 } else {
5188 tt = Tokens.FUNCTION;
5189 }
5190 } else if (reader.peek() == ":"){ //might be an IE function
5191 if (ident.toLowerCase() == "progid"){
5192 ident += reader.readTo("(");
5193 tt = Tokens.IE_FUNCTION;
5194 }
5195 }
5196
5197 return this.createToken(tt, ident, startLine, startCol);
5198 },
5199 importantToken: function(first, startLine, startCol){
5200 var reader = this._reader,
5201 important = first,
5202 tt = Tokens.CHAR,
5203 temp,
5204 c;
5205
5206 reader.mark();
5207 c = reader.read();
5208
5209 while(c){
5210 if (c == "/"){
5211 if (reader.peek() != "*"){
5212 break;
5213 } else {
5214 temp = this.readComment(c);
5215 if (temp === ""){ //broken!
5216 break;
5217 }
5218 }
5219 } else if (isWhitespace(c)){
5220 important += c + this.readWhitespace();
5221 } else if (/i/i.test(c)){
5222 temp = reader.readCount(8);
5223 if (/mportant/i.test(temp)){
5224 important += c + temp;
5225 tt = Tokens.IMPORTANT_SYM;
5226
5227 }
5228 break; //we're done
5229 } else {
5230 break;
5231 }
5232
5233 c = reader.read();
5234 }
5235
5236 if (tt == Tokens.CHAR){
5237 reader.reset();
5238 return this.charToken(first, startLine, startCol);
5239 } else {
5240 return this.createToken(tt, important, startLine, startCol);
5241 }
5242
5243
5244 },
5245 notToken: function(first, startLine, startCol){
5246 var reader = this._reader,
5247 text = first;
5248
5249 reader.mark();
5250 text += reader.readCount(4);
5251
5252 if (text.toLowerCase() == ":not("){
5253 return this.createToken(Tokens.NOT, text, startLine, startCol);
5254 } else {
5255 reader.reset();
5256 return this.charToken(first, startLine, startCol);
5257 }
5258 },
5259 numberToken: function(first, startLine, startCol){
5260 var reader = this._reader,
5261 value = this.readNumber(first),
5262 ident,
5263 tt = Tokens.NUMBER,
5264 c = reader.peek();
5265
5266 if (isIdentStart(c)){
5267 ident = this.readName(reader.read());
5268 value += ident;
5269
5270 if (/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vm$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(ident)){
5271 tt = Tokens.LENGTH;
5272 } else if (/^deg|^rad$|^grad$/i.test(ident)){
5273 tt = Tokens.ANGLE;
5274 } else if (/^ms$|^s$/i.test(ident)){
5275 tt = Tokens.TIME;
5276 } else if (/^hz$|^khz$/i.test(ident)){
5277 tt = Tokens.FREQ;
5278 } else if (/^dpi$|^dpcm$/i.test(ident)){
5279 tt = Tokens.RESOLUTION;
5280 } else {
5281 tt = Tokens.DIMENSION;
5282 }
5283
5284 } else if (c == "%"){
5285 value += reader.read();
5286 tt = Tokens.PERCENTAGE;
5287 }
5288
5289 return this.createToken(tt, value, startLine, startCol);
5290 },
5291 stringToken: function(first, startLine, startCol){
5292 var delim = first,
5293 string = first,
5294 reader = this._reader,
5295 prev = first,
5296 tt = Tokens.STRING,
5297 c = reader.read();
5298
5299 while(c){
5300 string += c;
5301 if (c == delim && prev != "\\"){
5302 break;
5303 }
5304 if (isNewLine(reader.peek()) && c != "\\"){
5305 tt = Tokens.INVALID;
5306 break;
5307 }
5308 prev = c;
5309 c = reader.read();
5310 }
5311 if (c === null){
5312 tt = Tokens.INVALID;
5313 }
5314
5315 return this.createToken(tt, string, startLine, startCol);
5316 },
5317
5318 unicodeRangeToken: function(first, startLine, startCol){
5319 var reader = this._reader,
5320 value = first,
5321 temp,
5322 tt = Tokens.CHAR;
5323 if (reader.peek() == "+"){
5324 reader.mark();
5325 value += reader.read();
5326 value += this.readUnicodeRangePart(true);
5327 if (value.length == 2){
5328 reader.reset();
5329 } else {
5330
5331 tt = Tokens.UNICODE_RANGE;
5332 if (value.indexOf("?") == -1){
5333
5334 if (reader.peek() == "-"){
5335 reader.mark();
5336 temp = reader.read();
5337 temp += this.readUnicodeRangePart(false);
5338 if (temp.length == 1){
5339 reader.reset();
5340 } else {
5341 value += temp;
5342 }
5343 }
5344
5345 }
5346 }
5347 }
5348
5349 return this.createToken(tt, value, startLine, startCol);
5350 },
5351 whitespaceToken: function(first, startLine, startCol){
5352 var reader = this._reader,
5353 value = first + this.readWhitespace();
5354 return this.createToken(Tokens.S, value, startLine, startCol);
5355 },
5356
5357 readUnicodeRangePart: function(allowQuestionMark){
5358 var reader = this._reader,
5359 part = "",
5360 c = reader.peek();
5361 while(isHexDigit(c) && part.length < 6){
5362 reader.read();
5363 part += c;
5364 c = reader.peek();
5365 }
5366 if (allowQuestionMark){
5367 while(c == "?" && part.length < 6){
5368 reader.read();
5369 part += c;
5370 c = reader.peek();
5371 }
5372 }
5373
5374 return part;
5375 },
5376
5377 readWhitespace: function(){
5378 var reader = this._reader,
5379 whitespace = "",
5380 c = reader.peek();
5381
5382 while(isWhitespace(c)){
5383 reader.read();
5384 whitespace += c;
5385 c = reader.peek();
5386 }
5387
5388 return whitespace;
5389 },
5390 readNumber: function(first){
5391 var reader = this._reader,
5392 number = first,
5393 hasDot = (first == "."),
5394 c = reader.peek();
5395
5396
5397 while(c){
5398 if (isDigit(c)){
5399 number += reader.read();
5400 } else if (c == "."){
5401 if (hasDot){
5402 break;
5403 } else {
5404 hasDot = true;
5405 number += reader.read();
5406 }
5407 } else {
5408 break;
5409 }
5410
5411 c = reader.peek();
5412 }
5413
5414 return number;
5415 },
5416 readString: function(){
5417 var reader = this._reader,
5418 delim = reader.read(),
5419 string = delim,
5420 prev = delim,
5421 c = reader.peek();
5422
5423 while(c){
5424 c = reader.read();
5425 string += c;
5426 if (c == delim && prev != "\\"){
5427 break;
5428 }
5429 if (isNewLine(reader.peek()) && c != "\\"){
5430 string = "";
5431 break;
5432 }
5433 prev = c;
5434 c = reader.peek();
5435 }
5436 if (c === null){
5437 string = "";
5438 }
5439
5440 return string;
5441 },
5442 readURI: function(first){
5443 var reader = this._reader,
5444 uri = first,
5445 inner = "",
5446 c = reader.peek();
5447
5448 reader.mark();
5449 while(c && isWhitespace(c)){
5450 reader.read();
5451 c = reader.peek();
5452 }
5453 if (c == "'" || c == "\""){
5454 inner = this.readString();
5455 } else {
5456 inner = this.readURL();
5457 }
5458
5459 c = reader.peek();
5460 while(c && isWhitespace(c)){
5461 reader.read();
5462 c = reader.peek();
5463 }
5464 if (inner === "" || c != ")"){
5465 uri = first;
5466 reader.reset();
5467 } else {
5468 uri += inner + reader.read();
5469 }
5470
5471 return uri;
5472 },
5473 readURL: function(){
5474 var reader = this._reader,
5475 url = "",
5476 c = reader.peek();
5477 while (/^[!#$%&\\*-~]$/.test(c)){
5478 url += reader.read();
5479 c = reader.peek();
5480 }
5481
5482 return url;
5483
5484 },
5485 readName: function(first){
5486 var reader = this._reader,
5487 ident = first || "",
5488 c = reader.peek();
5489
5490 while(true){
5491 if (c == "\\"){
5492 ident += this.readEscape(reader.read());
5493 c = reader.peek();
5494 } else if(c && isNameChar(c)){
5495 ident += reader.read();
5496 c = reader.peek();
5497 } else {
5498 break;
5499 }
5500 }
5501
5502 return ident;
5503 },
5504
5505 readEscape: function(first){
5506 var reader = this._reader,
5507 cssEscape = first || "",
5508 i = 0,
5509 c = reader.peek();
5510
5511 if (isHexDigit(c)){
5512 do {
5513 cssEscape += reader.read();
5514 c = reader.peek();
5515 } while(c && isHexDigit(c) && ++i < 6);
5516 }
5517
5518 if (cssEscape.length == 3 && /\s/.test(c) ||
5519 cssEscape.length == 7 || cssEscape.length == 1){
5520 reader.read();
5521 } else {
5522 c = "";
5523 }
5524
5525 return cssEscape + c;
5526 },
5527
5528 readComment: function(first){
5529 var reader = this._reader,
5530 comment = first || "",
5531 c = reader.read();
5532
5533 if (c == "*"){
5534 while(c){
5535 comment += c;
5536 if (comment.length > 2 && c == "*" && reader.peek() == "/"){
5537 comment += reader.read();
5538 break;
5539 }
5540
5541 c = reader.read();
5542 }
5543
5544 return comment;
5545 } else {
5546 return "";
5547 }
5548
5549 }
5550 });
5551
5552
5553 var Tokens = [
5554 { name: "CDO"},
5555 { name: "CDC"},
5556 { name: "S", whitespace: true/*, channel: "ws"*/},
5557 { name: "COMMENT", comment: true, hide: true, channel: "comment" },
5558 { name: "INCLUDES", text: "~="},
5559 { name: "DASHMATCH", text: "|="},
5560 { name: "PREFIXMATCH", text: "^="},
5561 { name: "SUFFIXMATCH", text: "$="},
5562 { name: "SUBSTRINGMATCH", text: "*="},
5563 { name: "STRING"},
5564 { name: "IDENT"},
5565 { name: "HASH"},
5566 { name: "IMPORT_SYM", text: "@import"},
5567 { name: "PAGE_SYM", text: "@page"},
5568 { name: "MEDIA_SYM", text: "@media"},
5569 { name: "FONT_FACE_SYM", text: "@font-face"},
5570 { name: "CHARSET_SYM", text: "@charset"},
5571 { name: "NAMESPACE_SYM", text: "@namespace"},
5572 { name: "UNKNOWN_SYM" },
5573 { name: "KEYFRAMES_SYM", text: [ "@keyframes", "@-webkit-keyframes", "@-moz-keyframes", "@-o-keyframes" ] },
5574 { name: "IMPORTANT_SYM"},
5575 { name: "LENGTH"},
5576 { name: "ANGLE"},
5577 { name: "TIME"},
5578 { name: "FREQ"},
5579 { name: "DIMENSION"},
5580 { name: "PERCENTAGE"},
5581 { name: "NUMBER"},
5582 { name: "URI"},
5583 { name: "FUNCTION"},
5584 { name: "UNICODE_RANGE"},
5585 { name: "INVALID"},
5586 { name: "PLUS", text: "+" },
5587 { name: "GREATER", text: ">"},
5588 { name: "COMMA", text: ","},
5589 { name: "TILDE", text: "~"},
5590 { name: "NOT"},
5591 { name: "TOPLEFTCORNER_SYM", text: "@top-left-corner"},
5592 { name: "TOPLEFT_SYM", text: "@top-left"},
5593 { name: "TOPCENTER_SYM", text: "@top-center"},
5594 { name: "TOPRIGHT_SYM", text: "@top-right"},
5595 { name: "TOPRIGHTCORNER_SYM", text: "@top-right-corner"},
5596 { name: "BOTTOMLEFTCORNER_SYM", text: "@bottom-left-corner"},
5597 { name: "BOTTOMLEFT_SYM", text: "@bottom-left"},
5598 { name: "BOTTOMCENTER_SYM", text: "@bottom-center"},
5599 { name: "BOTTOMRIGHT_SYM", text: "@bottom-right"},
5600 { name: "BOTTOMRIGHTCORNER_SYM", text: "@bottom-right-corner"},
5601 { name: "LEFTTOP_SYM", text: "@left-top"},
5602 { name: "LEFTMIDDLE_SYM", text: "@left-middle"},
5603 { name: "LEFTBOTTOM_SYM", text: "@left-bottom"},
5604 { name: "RIGHTTOP_SYM", text: "@right-top"},
5605 { name: "RIGHTMIDDLE_SYM", text: "@right-middle"},
5606 { name: "RIGHTBOTTOM_SYM", text: "@right-bottom"},
5607 { name: "RESOLUTION", state: "media"},
5608 { name: "IE_FUNCTION" },
5609 { name: "CHAR" },
5610 {
5611 name: "PIPE",
5612 text: "|"
5613 },
5614 {
5615 name: "SLASH",
5616 text: "/"
5617 },
5618 {
5619 name: "MINUS",
5620 text: "-"
5621 },
5622 {
5623 name: "STAR",
5624 text: "*"
5625 },
5626
5627 {
5628 name: "LBRACE",
5629 text: "{"
5630 },
5631 {
5632 name: "RBRACE",
5633 text: "}"
5634 },
5635 {
5636 name: "LBRACKET",
5637 text: "["
5638 },
5639 {
5640 name: "RBRACKET",
5641 text: "]"
5642 },
5643 {
5644 name: "EQUALS",
5645 text: "="
5646 },
5647 {
5648 name: "COLON",
5649 text: ":"
5650 },
5651 {
5652 name: "SEMICOLON",
5653 text: ";"
5654 },
5655
5656 {
5657 name: "LPAREN",
5658 text: "("
5659 },
5660 {
5661 name: "RPAREN",
5662 text: ")"
5663 },
5664 {
5665 name: "DOT",
5666 text: "."
5667 }
5668 ];
5669
5670 (function(){
5671
5672 var nameMap = [],
5673 typeMap = {};
5674
5675 Tokens.UNKNOWN = -1;
5676 Tokens.unshift({name:"EOF"});
5677 for (var i=0, len = Tokens.length; i < len; i++){
5678 nameMap.push(Tokens[i].name);
5679 Tokens[Tokens[i].name] = i;
5680 if (Tokens[i].text){
5681 if (Tokens[i].text instanceof Array){
5682 for (var j=0; j < Tokens[i].text.length; j++){
5683 typeMap[Tokens[i].text[j]] = i;
5684 }
5685 } else {
5686 typeMap[Tokens[i].text] = i;
5687 }
5688 }
5689 }
5690
5691 Tokens.name = function(tt){
5692 return nameMap[tt];
5693 };
5694
5695 Tokens.type = function(c){
5696 return typeMap[c] || -1;
5697 };
5698
5699 })();
5700 var Validation = {
5701
5702 validate: function(property, value){
5703 var name = property.toString().toLowerCase(),
5704 parts = value.parts,
5705 expression = new PropertyValueIterator(value),
5706 spec = Properties[name],
5707 part,
5708 valid,
5709 j, count,
5710 msg,
5711 types,
5712 last,
5713 literals,
5714 max, multi, group;
5715
5716 if (!spec) {
5717 if (name.indexOf("-") !== 0){ //vendor prefixed are ok
5718 throw new ValidationError("Unknown property '" + property + "'.", property.line, property.col);
5719 }
5720 } else if (typeof spec != "number"){
5721 if (typeof spec == "string"){
5722 if (spec.indexOf("||") > -1) {
5723 this.groupProperty(spec, expression);
5724 } else {
5725 this.singleProperty(spec, expression, 1);
5726 }
5727
5728 } else if (spec.multi) {
5729 this.multiProperty(spec.multi, expression, spec.comma, spec.max || Infinity);
5730 } else if (typeof spec == "function") {
5731 spec(expression);
5732 }
5733
5734 }
5735
5736 },
5737
5738 singleProperty: function(types, expression, max, partial) {
5739
5740 var result = false,
5741 value = expression.value,
5742 count = 0,
5743 part;
5744
5745 while (expression.hasNext() && count < max) {
5746 result = ValidationTypes.isAny(expression, types);
5747 if (!result) {
5748 break;
5749 }
5750 count++;
5751 }
5752
5753 if (!result) {
5754 if (expression.hasNext() && !expression.isFirst()) {
5755 part = expression.peek();
5756 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
5757 } else {
5758 throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
5759 }
5760 } else if (expression.hasNext()) {
5761 part = expression.next();
5762 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
5763 }
5764
5765 },
5766
5767 multiProperty: function (types, expression, comma, max) {
5768
5769 var result = false,
5770 value = expression.value,
5771 count = 0,
5772 sep = false,
5773 part;
5774
5775 while(expression.hasNext() && !result && count < max) {
5776 if (ValidationTypes.isAny(expression, types)) {
5777 count++;
5778 if (!expression.hasNext()) {
5779 result = true;
5780
5781 } else if (comma) {
5782 if (expression.peek() == ",") {
5783 part = expression.next();
5784 } else {
5785 break;
5786 }
5787 }
5788 } else {
5789 break;
5790
5791 }
5792 }
5793
5794 if (!result) {
5795 if (expression.hasNext() && !expression.isFirst()) {
5796 part = expression.peek();
5797 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
5798 } else {
5799 part = expression.previous();
5800 if (comma && part == ",") {
5801 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
5802 } else {
5803 throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
5804 }
5805 }
5806
5807 } else if (expression.hasNext()) {
5808 part = expression.next();
5809 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
5810 }
5811
5812 },
5813
5814 groupProperty: function (types, expression, comma) {
5815
5816 var result = false,
5817 value = expression.value,
5818 typeCount = types.split("||").length,
5819 groups = { count: 0 },
5820 partial = false,
5821 name,
5822 part;
5823
5824 while(expression.hasNext() && !result) {
5825 name = ValidationTypes.isAnyOfGroup(expression, types);
5826 if (name) {
5827 if (groups[name]) {
5828 break;
5829 } else {
5830 groups[name] = 1;
5831 groups.count++;
5832 partial = true;
5833
5834 if (groups.count == typeCount || !expression.hasNext()) {
5835 result = true;
5836 }
5837 }
5838 } else {
5839 break;
5840 }
5841 }
5842
5843 if (!result) {
5844 if (partial && expression.hasNext()) {
5845 part = expression.peek();
5846 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
5847 } else {
5848 throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
5849 }
5850 } else if (expression.hasNext()) {
5851 part = expression.next();
5852 throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
5853 }
5854 }
5855
5856
5857
5858 };
5859 function ValidationError(message, line, col){
5860 this.col = col;
5861 this.line = line;
5862 this.message = message;
5863
5864 }
5865 ValidationError.prototype = new Error();
5866 var ValidationTypes = {
5867
5868 isLiteral: function (part, literals) {
5869 var text = part.text.toString().toLowerCase(),
5870 args = literals.split(" | "),
5871 i, len, found = false;
5872
5873 for (i=0,len=args.length; i < len && !found; i++){
5874 if (text == args[i].toLowerCase()){
5875 found = true;
5876 }
5877 }
5878
5879 return found;
5880 },
5881
5882 isSimple: function(type) {
5883 return !!this.simple[type];
5884 },
5885
5886 isComplex: function(type) {
5887 return !!this.complex[type];
5888 },
5889 isAny: function (expression, types) {
5890 var args = types.split(" | "),
5891 i, len, found = false;
5892
5893 for (i=0,len=args.length; i < len && !found && expression.hasNext(); i++){
5894 found = this.isType(expression, args[i]);
5895 }
5896
5897 return found;
5898 },
5899 isAnyOfGroup: function(expression, types) {
5900 var args = types.split(" || "),
5901 i, len, found = false;
5902
5903 for (i=0,len=args.length; i < len && !found; i++){
5904 found = this.isType(expression, args[i]);
5905 }
5906
5907 return found ? args[i-1] : false;
5908 },
5909 isType: function (expression, type) {
5910 var part = expression.peek(),
5911 result = false;
5912
5913 if (type.charAt(0) != "<") {
5914 result = this.isLiteral(part, type);
5915 if (result) {
5916 expression.next();
5917 }
5918 } else if (this.simple[type]) {
5919 result = this.simple[type](part);
5920 if (result) {
5921 expression.next();
5922 }
5923 } else {
5924 result = this.complex[type](expression);
5925 }
5926
5927 return result;
5928 },
5929
5930
5931
5932 simple: {
5933
5934 "<absolute-size>": function(part){
5935 return ValidationTypes.isLiteral(part, "xx-small | x-small | small | medium | large | x-large | xx-large");
5936 },
5937
5938 "<attachment>": function(part){
5939 return ValidationTypes.isLiteral(part, "scroll | fixed | local");
5940 },
5941
5942 "<attr>": function(part){
5943 return part.type == "function" && part.name == "attr";
5944 },
5945
5946 "<bg-image>": function(part){
5947 return this["<image>"](part) || this["<gradient>"](part) || part == "none";
5948 },
5949
5950 "<gradient>": function(part) {
5951 return part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial\-|linear\-)?gradient/i.test(part);
5952 },
5953
5954 "<box>": function(part){
5955 return ValidationTypes.isLiteral(part, "padding-box | border-box | content-box");
5956 },
5957
5958 "<content>": function(part){
5959 return part.type == "function" && part.name == "content";
5960 },
5961
5962 "<relative-size>": function(part){
5963 return ValidationTypes.isLiteral(part, "smaller | larger");
5964 },
5965 "<ident>": function(part){
5966 return part.type == "identifier";
5967 },
5968
5969 "<length>": function(part){
5970 if (part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)){
5971 return true;
5972 }else{
5973 return part.type == "length" || part.type == "number" || part.type == "integer" || part == "0";
5974 }
5975 },
5976
5977 "<color>": function(part){
5978 return part.type == "color" || part == "transparent";
5979 },
5980
5981 "<number>": function(part){
5982 return part.type == "number" || this["<integer>"](part);
5983 },
5984
5985 "<integer>": function(part){
5986 return part.type == "integer";
5987 },
5988
5989 "<line>": function(part){
5990 return part.type == "integer";
5991 },
5992
5993 "<angle>": function(part){
5994 return part.type == "angle";
5995 },
5996
5997 "<uri>": function(part){
5998 return part.type == "uri";
5999 },
6000
6001 "<image>": function(part){
6002 return this["<uri>"](part);
6003 },
6004
6005 "<percentage>": function(part){
6006 return part.type == "percentage" || part == "0";
6007 },
6008
6009 "<border-width>": function(part){
6010 return this["<length>"](part) || ValidationTypes.isLiteral(part, "thin | medium | thick");
6011 },
6012
6013 "<border-style>": function(part){
6014 return ValidationTypes.isLiteral(part, "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset");
6015 },
6016
6017 "<margin-width>": function(part){
6018 return this["<length>"](part) || this["<percentage>"](part) || ValidationTypes.isLiteral(part, "auto");
6019 },
6020
6021 "<padding-width>": function(part){
6022 return this["<length>"](part) || this["<percentage>"](part);
6023 },
6024
6025 "<shape>": function(part){
6026 return part.type == "function" && (part.name == "rect" || part.name == "inset-rect");
6027 },
6028
6029 "<time>": function(part) {
6030 return part.type == "time";
6031 }
6032 },
6033
6034 complex: {
6035
6036 "<bg-position>": function(expression){
6037 var types = this,
6038 result = false,
6039 numeric = "<percentage> | <length>",
6040 xDir = "left | right",
6041 yDir = "top | bottom",
6042 count = 0,
6043 hasNext = function() {
6044 return expression.hasNext() && expression.peek() != ",";
6045 };
6046
6047 while (expression.peek(count) && expression.peek(count) != ",") {
6048 count++;
6049 }
6050
6051 if (count < 3) {
6052 if (ValidationTypes.isAny(expression, xDir + " | center | " + numeric)) {
6053 result = true;
6054 ValidationTypes.isAny(expression, yDir + " | center | " + numeric);
6055 } else if (ValidationTypes.isAny(expression, yDir)) {
6056 result = true;
6057 ValidationTypes.isAny(expression, xDir + " | center");
6058 }
6059 } else {
6060 if (ValidationTypes.isAny(expression, xDir)) {
6061 if (ValidationTypes.isAny(expression, yDir)) {
6062 result = true;
6063 ValidationTypes.isAny(expression, numeric);
6064 } else if (ValidationTypes.isAny(expression, numeric)) {
6065 if (ValidationTypes.isAny(expression, yDir)) {
6066 result = true;
6067 ValidationTypes.isAny(expression, numeric);
6068 } else if (ValidationTypes.isAny(expression, "center")) {
6069 result = true;
6070 }
6071 }
6072 } else if (ValidationTypes.isAny(expression, yDir)) {
6073 if (ValidationTypes.isAny(expression, xDir)) {
6074 result = true;
6075 ValidationTypes.isAny(expression, numeric);
6076 } else if (ValidationTypes.isAny(expression, numeric)) {
6077 if (ValidationTypes.isAny(expression, xDir)) {
6078 result = true;
6079 ValidationTypes.isAny(expression, numeric);
6080 } else if (ValidationTypes.isAny(expression, "center")) {
6081 result = true;
6082 }
6083 }
6084 } else if (ValidationTypes.isAny(expression, "center")) {
6085 if (ValidationTypes.isAny(expression, xDir + " | " + yDir)) {
6086 result = true;
6087 ValidationTypes.isAny(expression, numeric);
6088 }
6089 }
6090 }
6091
6092 return result;
6093 },
6094
6095 "<bg-size>": function(expression){
6096 var types = this,
6097 result = false,
6098 numeric = "<percentage> | <length> | auto",
6099 part,
6100 i, len;
6101
6102 if (ValidationTypes.isAny(expression, "cover | contain")) {
6103 result = true;
6104 } else if (ValidationTypes.isAny(expression, numeric)) {
6105 result = true;
6106 ValidationTypes.isAny(expression, numeric);
6107 }
6108
6109 return result;
6110 },
6111
6112 "<repeat-style>": function(expression){
6113 var result = false,
6114 values = "repeat | space | round | no-repeat",
6115 part;
6116
6117 if (expression.hasNext()){
6118 part = expression.next();
6119
6120 if (ValidationTypes.isLiteral(part, "repeat-x | repeat-y")) {
6121 result = true;
6122 } else if (ValidationTypes.isLiteral(part, values)) {
6123 result = true;
6124
6125 if (expression.hasNext() && ValidationTypes.isLiteral(expression.peek(), values)) {
6126 expression.next();
6127 }
6128 }
6129 }
6130
6131 return result;
6132
6133 },
6134
6135 "<shadow>": function(expression) {
6136 var result = false,
6137 count = 0,
6138 inset = false,
6139 color = false,
6140 part;
6141
6142 if (expression.hasNext()) {
6143
6144 if (ValidationTypes.isAny(expression, "inset")){
6145 inset = true;
6146 }
6147
6148 if (ValidationTypes.isAny(expression, "<color>")) {
6149 color = true;
6150 }
6151
6152 while (ValidationTypes.isAny(expression, "<length>") && count < 4) {
6153 count++;
6154 }
6155
6156
6157 if (expression.hasNext()) {
6158 if (!color) {
6159 ValidationTypes.isAny(expression, "<color>");
6160 }
6161
6162 if (!inset) {
6163 ValidationTypes.isAny(expression, "inset");
6164 }
6165
6166 }
6167
6168 result = (count >= 2 && count <= 4);
6169
6170 }
6171
6172 return result;
6173 },
6174
6175 "<x-one-radius>": function(expression) {
6176 var result = false,
6177 count = 0,
6178 numeric = "<length> | <percentage>",
6179 part;
6180
6181 if (ValidationTypes.isAny(expression, numeric)){
6182 result = true;
6183
6184 ValidationTypes.isAny(expression, numeric);
6185 }
6186
6187 return result;
6188 }
6189 }
6190 };
6191
6192
6193
6194 parserlib.css = {
6195 Colors :Colors,
6196 Combinator :Combinator,
6197 Parser :Parser,
6198 PropertyName :PropertyName,
6199 PropertyValue :PropertyValue,
6200 PropertyValuePart :PropertyValuePart,
6201 MediaFeature :MediaFeature,
6202 MediaQuery :MediaQuery,
6203 Selector :Selector,
6204 SelectorPart :SelectorPart,
6205 SelectorSubPart :SelectorSubPart,
6206 Specificity :Specificity,
6207 TokenStream :TokenStream,
6208 Tokens :Tokens,
6209 ValidationError :ValidationError
6210 };
6211 })();
6212 var CSSLint = (function(){
6213
6214 var rules = [],
6215 formatters = [],
6216 embeddedRuleset = /\/\*csslint([^\*]*)\*\//,
6217 api = new parserlib.util.EventTarget();
6218
6219 api.version = "0.9.10";
6220 api.addRule = function(rule){
6221 rules.push(rule);
6222 rules[rule.id] = rule;
6223 };
6224 api.clearRules = function(){
6225 rules = [];
6226 };
6227 api.getRules = function(){
6228 return [].concat(rules).sort(function(a,b){
6229 return a.id > b.id ? 1 : 0;
6230 });
6231 };
6232 api.getRuleset = function() {
6233 var ruleset = {},
6234 i = 0,
6235 len = rules.length;
6236
6237 while (i < len){
6238 ruleset[rules[i++].id] = 1; //by default, everything is a warning
6239 }
6240
6241 return ruleset;
6242 };
6243 function applyEmbeddedRuleset(text, ruleset){
6244 var valueMap,
6245 embedded = text && text.match(embeddedRuleset),
6246 rules = embedded && embedded[1];
6247
6248 if (rules) {
6249 valueMap = {
6250 "true": 2, // true is error
6251 "": 1, // blank is warning
6252 "false": 0, // false is ignore
6253
6254 "2": 2, // explicit error
6255 "1": 1, // explicit warning
6256 "0": 0 // explicit ignore
6257 };
6258
6259 rules.toLowerCase().split(",").forEach(function(rule){
6260 var pair = rule.split(":"),
6261 property = pair[0] || "",
6262 value = pair[1] || "";
6263
6264 ruleset[property.trim()] = valueMap[value.trim()];
6265 });
6266 }
6267
6268 return ruleset;
6269 }
6270 api.addFormatter = function(formatter) {
6271 formatters[formatter.id] = formatter;
6272 };
6273 api.getFormatter = function(formatId){
6274 return formatters[formatId];
6275 };
6276 api.format = function(results, filename, formatId, options) {
6277 var formatter = this.getFormatter(formatId),
6278 result = null;
6279
6280 if (formatter){
6281 result = formatter.startFormat();
6282 result += formatter.formatResults(results, filename, options || {});
6283 result += formatter.endFormat();
6284 }
6285
6286 return result;
6287 };
6288 api.hasFormat = function(formatId){
6289 return formatters.hasOwnProperty(formatId);
6290 };
6291 api.verify = function(text, ruleset){
6292
6293 var i = 0,
6294 len = rules.length,
6295 reporter,
6296 lines,
6297 report,
6298 parser = new parserlib.css.Parser({ starHack: true, ieFilters: true,
6299 underscoreHack: true, strict: false });
6300 lines = text.replace(/\n\r?/g, "$split$").split('$split$');
6301
6302 if (!ruleset){
6303 ruleset = this.getRuleset();
6304 }
6305
6306 if (embeddedRuleset.test(text)){
6307 ruleset = applyEmbeddedRuleset(text, ruleset);
6308 }
6309
6310 reporter = new Reporter(lines, ruleset);
6311
6312 ruleset.errors = 2; //always report parsing errors as errors
6313 for (i in ruleset){
6314 if(ruleset.hasOwnProperty(i) && ruleset[i]){
6315 if (rules[i]){
6316 rules[i].init(parser, reporter);
6317 }
6318 }
6319 }
6320 try {
6321 parser.parse(text);
6322 } catch (ex) {
6323 reporter.error("Fatal error, cannot continue: " + ex.message, ex.line, ex.col, {});
6324 }
6325
6326 report = {
6327 messages : reporter.messages,
6328 stats : reporter.stats,
6329 ruleset : reporter.ruleset
6330 };
6331 report.messages.sort(function (a, b){
6332 if (a.rollup && !b.rollup){
6333 return 1;
6334 } else if (!a.rollup && b.rollup){
6335 return -1;
6336 } else {
6337 return a.line - b.line;
6338 }
6339 });
6340
6341 return report;
6342 };
6343
6344 return api;
6345
6346 })();
6347 function Reporter(lines, ruleset){
6348 this.messages = [];
6349 this.stats = [];
6350 this.lines = lines;
6351 this.ruleset = ruleset;
6352 }
6353
6354 Reporter.prototype = {
6355 constructor: Reporter,
6356 error: function(message, line, col, rule){
6357 this.messages.push({
6358 type : "error",
6359 line : line,
6360 col : col,
6361 message : message,
6362 evidence: this.lines[line-1],
6363 rule : rule || {}
6364 });
6365 },
6366 warn: function(message, line, col, rule){
6367 this.report(message, line, col, rule);
6368 },
6369 report: function(message, line, col, rule){
6370 this.messages.push({
6371 type : this.ruleset[rule.id] == 2 ? "error" : "warning",
6372 line : line,
6373 col : col,
6374 message : message,
6375 evidence: this.lines[line-1],
6376 rule : rule
6377 });
6378 },
6379 info: function(message, line, col, rule){
6380 this.messages.push({
6381 type : "info",
6382 line : line,
6383 col : col,
6384 message : message,
6385 evidence: this.lines[line-1],
6386 rule : rule
6387 });
6388 },
6389 rollupError: function(message, rule){
6390 this.messages.push({
6391 type : "error",
6392 rollup : true,
6393 message : message,
6394 rule : rule
6395 });
6396 },
6397 rollupWarn: function(message, rule){
6398 this.messages.push({
6399 type : "warning",
6400 rollup : true,
6401 message : message,
6402 rule : rule
6403 });
6404 },
6405 stat: function(name, value){
6406 this.stats[name] = value;
6407 }
6408 };
6409 CSSLint._Reporter = Reporter;
6410 CSSLint.Util = {
6411 mix: function(receiver, supplier){
6412 var prop;
6413
6414 for (prop in supplier){
6415 if (supplier.hasOwnProperty(prop)){
6416 receiver[prop] = supplier[prop];
6417 }
6418 }
6419
6420 return prop;
6421 },
6422 indexOf: function(values, value){
6423 if (values.indexOf){
6424 return values.indexOf(value);
6425 } else {
6426 for (var i=0, len=values.length; i < len; i++){
6427 if (values[i] === value){
6428 return i;
6429 }
6430 }
6431 return -1;
6432 }
6433 },
6434 forEach: function(values, func) {
6435 if (values.forEach){
6436 return values.forEach(func);
6437 } else {
6438 for (var i=0, len=values.length; i < len; i++){
6439 func(values[i], i, values);
6440 }
6441 }
6442 }
6443 };
6444 CSSLint.addRule({
6445 id: "adjoining-classes",
6446 name: "Disallow adjoining classes",
6447 desc: "Don't use adjoining classes.",
6448 browsers: "IE6",
6449 init: function(parser, reporter){
6450 var rule = this;
6451 parser.addListener("startrule", function(event){
6452 var selectors = event.selectors,
6453 selector,
6454 part,
6455 modifier,
6456 classCount,
6457 i, j, k;
6458
6459 for (i=0; i < selectors.length; i++){
6460 selector = selectors[i];
6461 for (j=0; j < selector.parts.length; j++){
6462 part = selector.parts[j];
6463 if (part.type == parser.SELECTOR_PART_TYPE){
6464 classCount = 0;
6465 for (k=0; k < part.modifiers.length; k++){
6466 modifier = part.modifiers[k];
6467 if (modifier.type == "class"){
6468 classCount++;
6469 }
6470 if (classCount > 1){
6471 reporter.report("Don't use adjoining classes.", part.line, part.col, rule);
6472 }
6473 }
6474 }
6475 }
6476 }
6477 });
6478 }
6479
6480 });
6481 CSSLint.addRule({
6482 id: "box-model",
6483 name: "Beware of broken box size",
6484 desc: "Don't use width or height when using padding or border.",
6485 browsers: "All",
6486 init: function(parser, reporter){
6487 var rule = this,
6488 widthProperties = {
6489 border: 1,
6490 "border-left": 1,
6491 "border-right": 1,
6492 padding: 1,
6493 "padding-left": 1,
6494 "padding-right": 1
6495 },
6496 heightProperties = {
6497 border: 1,
6498 "border-bottom": 1,
6499 "border-top": 1,
6500 padding: 1,
6501 "padding-bottom": 1,
6502 "padding-top": 1
6503 },
6504 properties,
6505 boxSizing = false;
6506
6507 function startRule(){
6508 properties = {};
6509 boxSizing = false;
6510 }
6511
6512 function endRule(){
6513 var prop, value;
6514
6515 if (!boxSizing) {
6516 if (properties.height){
6517 for (prop in heightProperties){
6518 if (heightProperties.hasOwnProperty(prop) && properties[prop]){
6519 value = properties[prop].value;
6520 if (!(prop == "padding" && value.parts.length === 2 && value.parts[0].value === 0)){
6521 reporter.report("Using height with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule);
6522 }
6523 }
6524 }
6525 }
6526
6527 if (properties.width){
6528 for (prop in widthProperties){
6529 if (widthProperties.hasOwnProperty(prop) && properties[prop]){
6530 value = properties[prop].value;
6531
6532 if (!(prop == "padding" && value.parts.length === 2 && value.parts[1].value === 0)){
6533 reporter.report("Using width with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule);
6534 }
6535 }
6536 }
6537 }
6538 }
6539 }
6540
6541 parser.addListener("startrule", startRule);
6542 parser.addListener("startfontface", startRule);
6543 parser.addListener("startpage", startRule);
6544 parser.addListener("startpagemargin", startRule);
6545 parser.addListener("startkeyframerule", startRule);
6546
6547 parser.addListener("property", function(event){
6548 var name = event.property.text.toLowerCase();
6549
6550 if (heightProperties[name] || widthProperties[name]){
6551 if (!/^0\S*$/.test(event.value) && !(name == "border" && event.value == "none")){
6552 properties[name] = { line: event.property.line, col: event.property.col, value: event.value };
6553 }
6554 } else {
6555 if (/^(width|height)/i.test(name) && /^(length|percentage)/.test(event.value.parts[0].type)){
6556 properties[name] = 1;
6557 } else if (name == "box-sizing") {
6558 boxSizing = true;
6559 }
6560 }
6561
6562 });
6563
6564 parser.addListener("endrule", endRule);
6565 parser.addListener("endfontface", endRule);
6566 parser.addListener("endpage", endRule);
6567 parser.addListener("endpagemargin", endRule);
6568 parser.addListener("endkeyframerule", endRule);
6569 }
6570
6571 });
6572 CSSLint.addRule({
6573 id: "box-sizing",
6574 name: "Disallow use of box-sizing",
6575 desc: "The box-sizing properties isn't supported in IE6 and IE7.",
6576 browsers: "IE6, IE7",
6577 tags: ["Compatibility"],
6578 init: function(parser, reporter){
6579 var rule = this;
6580
6581 parser.addListener("property", function(event){
6582 var name = event.property.text.toLowerCase();
6583
6584 if (name == "box-sizing"){
6585 reporter.report("The box-sizing property isn't supported in IE6 and IE7.", event.line, event.col, rule);
6586 }
6587 });
6588 }
6589
6590 });
6591 CSSLint.addRule({
6592 id: "bulletproof-font-face",
6593 name: "Use the bulletproof @font-face syntax",
6594 desc: "Use the bulletproof @font-face syntax to avoid 404's in old IE (http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax).",
6595 browsers: "All",
6596 init: function(parser, reporter){
6597 var rule = this,
6598 count = 0,
6599 fontFaceRule = false,
6600 firstSrc = true,
6601 ruleFailed = false,
6602 line, col;
6603 parser.addListener("startfontface", function(event){
6604 fontFaceRule = true;
6605 });
6606
6607 parser.addListener("property", function(event){
6608 if (!fontFaceRule) {
6609 return;
6610 }
6611
6612 var propertyName = event.property.toString().toLowerCase(),
6613 value = event.value.toString();
6614 line = event.line;
6615 col = event.col;
6616 if (propertyName === 'src') {
6617 var regex = /^\s?url\(['"].+\.eot\?.*['"]\)\s*format\(['"]embedded-opentype['"]\).*$/i;
6618 if (!value.match(regex) && firstSrc) {
6619 ruleFailed = true;
6620 firstSrc = false;
6621 } else if (value.match(regex) && !firstSrc) {
6622 ruleFailed = false;
6623 }
6624 }
6625
6626
6627 });
6628 parser.addListener("endfontface", function(event){
6629 fontFaceRule = false;
6630
6631 if (ruleFailed) {
6632 reporter.report("@font-face declaration doesn't follow the fontspring bulletproof syntax.", line, col, rule);
6633 }
6634 });
6635 }
6636 });
6637 CSSLint.addRule({
6638 id: "compatible-vendor-prefixes",
6639 name: "Require compatible vendor prefixes",
6640 desc: "Include all compatible vendor prefixes to reach a wider range of users.",
6641 browsers: "All",
6642 init: function (parser, reporter) {
6643 var rule = this,
6644 compatiblePrefixes,
6645 properties,
6646 prop,
6647 variations,
6648 prefixed,
6649 i,
6650 len,
6651 inKeyFrame = false,
6652 arrayPush = Array.prototype.push,
6653 applyTo = [];
6654 compatiblePrefixes = {
6655 "animation" : "webkit moz",
6656 "animation-delay" : "webkit moz",
6657 "animation-direction" : "webkit moz",
6658 "animation-duration" : "webkit moz",
6659 "animation-fill-mode" : "webkit moz",
6660 "animation-iteration-count" : "webkit moz",
6661 "animation-name" : "webkit moz",
6662 "animation-play-state" : "webkit moz",
6663 "animation-timing-function" : "webkit moz",
6664 "appearance" : "webkit moz",
6665 "border-end" : "webkit moz",
6666 "border-end-color" : "webkit moz",
6667 "border-end-style" : "webkit moz",
6668 "border-end-width" : "webkit moz",
6669 "border-image" : "webkit moz o",
6670 "border-radius" : "webkit",
6671 "border-start" : "webkit moz",
6672 "border-start-color" : "webkit moz",
6673 "border-start-style" : "webkit moz",
6674 "border-start-width" : "webkit moz",
6675 "box-align" : "webkit moz ms",
6676 "box-direction" : "webkit moz ms",
6677 "box-flex" : "webkit moz ms",
6678 "box-lines" : "webkit ms",
6679 "box-ordinal-group" : "webkit moz ms",
6680 "box-orient" : "webkit moz ms",
6681 "box-pack" : "webkit moz ms",
6682 "box-sizing" : "webkit moz",
6683 "box-shadow" : "webkit moz",
6684 "column-count" : "webkit moz ms",
6685 "column-gap" : "webkit moz ms",
6686 "column-rule" : "webkit moz ms",
6687 "column-rule-color" : "webkit moz ms",
6688 "column-rule-style" : "webkit moz ms",
6689 "column-rule-width" : "webkit moz ms",
6690 "column-width" : "webkit moz ms",
6691 "hyphens" : "epub moz",
6692 "line-break" : "webkit ms",
6693 "margin-end" : "webkit moz",
6694 "margin-start" : "webkit moz",
6695 "marquee-speed" : "webkit wap",
6696 "marquee-style" : "webkit wap",
6697 "padding-end" : "webkit moz",
6698 "padding-start" : "webkit moz",
6699 "tab-size" : "moz o",
6700 "text-size-adjust" : "webkit ms",
6701 "transform" : "webkit moz ms o",
6702 "transform-origin" : "webkit moz ms o",
6703 "transition" : "webkit moz o",
6704 "transition-delay" : "webkit moz o",
6705 "transition-duration" : "webkit moz o",
6706 "transition-property" : "webkit moz o",
6707 "transition-timing-function" : "webkit moz o",
6708 "user-modify" : "webkit moz",
6709 "user-select" : "webkit moz ms",
6710 "word-break" : "epub ms",
6711 "writing-mode" : "epub ms"
6712 };
6713
6714
6715 for (prop in compatiblePrefixes) {
6716 if (compatiblePrefixes.hasOwnProperty(prop)) {
6717 variations = [];
6718 prefixed = compatiblePrefixes[prop].split(' ');
6719 for (i = 0, len = prefixed.length; i < len; i++) {
6720 variations.push('-' + prefixed[i] + '-' + prop);
6721 }
6722 compatiblePrefixes[prop] = variations;
6723 arrayPush.apply(applyTo, variations);
6724 }
6725 }
6726
6727 parser.addListener("startrule", function () {
6728 properties = [];
6729 });
6730
6731 parser.addListener("startkeyframes", function (event) {
6732 inKeyFrame = event.prefix || true;
6733 });
6734
6735 parser.addListener("endkeyframes", function (event) {
6736 inKeyFrame = false;
6737 });
6738
6739 parser.addListener("property", function (event) {
6740 var name = event.property;
6741 if (CSSLint.Util.indexOf(applyTo, name.text) > -1) {
6742 if (!inKeyFrame || typeof inKeyFrame != "string" ||
6743 name.text.indexOf("-" + inKeyFrame + "-") !== 0) {
6744 properties.push(name);
6745 }
6746 }
6747 });
6748
6749 parser.addListener("endrule", function (event) {
6750 if (!properties.length) {
6751 return;
6752 }
6753
6754 var propertyGroups = {},
6755 i,
6756 len,
6757 name,
6758 prop,
6759 variations,
6760 value,
6761 full,
6762 actual,
6763 item,
6764 propertiesSpecified;
6765
6766 for (i = 0, len = properties.length; i < len; i++) {
6767 name = properties[i];
6768
6769 for (prop in compatiblePrefixes) {
6770 if (compatiblePrefixes.hasOwnProperty(prop)) {
6771 variations = compatiblePrefixes[prop];
6772 if (CSSLint.Util.indexOf(variations, name.text) > -1) {
6773 if (!propertyGroups[prop]) {
6774 propertyGroups[prop] = {
6775 full : variations.slice(0),
6776 actual : [],
6777 actualNodes: []
6778 };
6779 }
6780 if (CSSLint.Util.indexOf(propertyGroups[prop].actual, name.text) === -1) {
6781 propertyGroups[prop].actual.push(name.text);
6782 propertyGroups[prop].actualNodes.push(name);
6783 }
6784 }
6785 }
6786 }
6787 }
6788
6789 for (prop in propertyGroups) {
6790 if (propertyGroups.hasOwnProperty(prop)) {
6791 value = propertyGroups[prop];
6792 full = value.full;
6793 actual = value.actual;
6794
6795 if (full.length > actual.length) {
6796 for (i = 0, len = full.length; i < len; i++) {
6797 item = full[i];
6798 if (CSSLint.Util.indexOf(actual, item) === -1) {
6799 propertiesSpecified = (actual.length === 1) ? actual[0] : (actual.length == 2) ? actual.join(" and ") : actual.join(", ");
6800 reporter.report("The property " + item + " is compatible with " + propertiesSpecified + " and should be included as well.", value.actualNodes[0].line, value.actualNodes[0].col, rule);
6801 }
6802 }
6803
6804 }
6805 }
6806 }
6807 });
6808 }
6809 });
6810 CSSLint.addRule({
6811 id: "display-property-grouping",
6812 name: "Require properties appropriate for display",
6813 desc: "Certain properties shouldn't be used with certain display property values.",
6814 browsers: "All",
6815 init: function(parser, reporter){
6816 var rule = this;
6817
6818 var propertiesToCheck = {
6819 display: 1,
6820 "float": "none",
6821 height: 1,
6822 width: 1,
6823 margin: 1,
6824 "margin-left": 1,
6825 "margin-right": 1,
6826 "margin-bottom": 1,
6827 "margin-top": 1,
6828 padding: 1,
6829 "padding-left": 1,
6830 "padding-right": 1,
6831 "padding-bottom": 1,
6832 "padding-top": 1,
6833 "vertical-align": 1
6834 },
6835 properties;
6836
6837 function reportProperty(name, display, msg){
6838 if (properties[name]){
6839 if (typeof propertiesToCheck[name] != "string" || properties[name].value.toLowerCase() != propertiesToCheck[name]){
6840 reporter.report(msg || name + " can't be used with display: " + display + ".", properties[name].line, properties[name].col, rule);
6841 }
6842 }
6843 }
6844
6845 function startRule(){
6846 properties = {};
6847 }
6848
6849 function endRule(){
6850
6851 var display = properties.display ? properties.display.value : null;
6852 if (display){
6853 switch(display){
6854
6855 case "inline":
6856 reportProperty("height", display);
6857 reportProperty("width", display);
6858 reportProperty("margin", display);
6859 reportProperty("margin-top", display);
6860 reportProperty("margin-bottom", display);
6861 reportProperty("float", display, "display:inline has no effect on floated elements (but may be used to fix the IE6 double-margin bug).");
6862 break;
6863
6864 case "block":
6865 reportProperty("vertical-align", display);
6866 break;
6867
6868 case "inline-block":
6869 reportProperty("float", display);
6870 break;
6871
6872 default:
6873 if (display.indexOf("table-") === 0){
6874 reportProperty("margin", display);
6875 reportProperty("margin-left", display);
6876 reportProperty("margin-right", display);
6877 reportProperty("margin-top", display);
6878 reportProperty("margin-bottom", display);
6879 reportProperty("float", display);
6880 }
6881 }
6882 }
6883
6884 }
6885
6886 parser.addListener("startrule", startRule);
6887 parser.addListener("startfontface", startRule);
6888 parser.addListener("startkeyframerule", startRule);
6889 parser.addListener("startpagemargin", startRule);
6890 parser.addListener("startpage", startRule);
6891
6892 parser.addListener("property", function(event){
6893 var name = event.property.text.toLowerCase();
6894
6895 if (propertiesToCheck[name]){
6896 properties[name] = { value: event.value.text, line: event.property.line, col: event.property.col };
6897 }
6898 });
6899
6900 parser.addListener("endrule", endRule);
6901 parser.addListener("endfontface", endRule);
6902 parser.addListener("endkeyframerule", endRule);
6903 parser.addListener("endpagemargin", endRule);
6904 parser.addListener("endpage", endRule);
6905
6906 }
6907
6908 });
6909 CSSLint.addRule({
6910 id: "duplicate-background-images",
6911 name: "Disallow duplicate background images",
6912 desc: "Every background-image should be unique. Use a common class for e.g. sprites.",
6913 browsers: "All",
6914 init: function(parser, reporter){
6915 var rule = this,
6916 stack = {};
6917
6918 parser.addListener("property", function(event){
6919 var name = event.property.text,
6920 value = event.value,
6921 i, len;
6922
6923 if (name.match(/background/i)) {
6924 for (i=0, len=value.parts.length; i < len; i++) {
6925 if (value.parts[i].type == 'uri') {
6926 if (typeof stack[value.parts[i].uri] === 'undefined') {
6927 stack[value.parts[i].uri] = event;
6928 }
6929 else {
6930 reporter.report("Background image '" + value.parts[i].uri + "' was used multiple times, first declared at line " + stack[value.parts[i].uri].line + ", col " + stack[value.parts[i].uri].col + ".", event.line, event.col, rule);
6931 }
6932 }
6933 }
6934 }
6935 });
6936 }
6937 });
6938 CSSLint.addRule({
6939 id: "duplicate-properties",
6940 name: "Disallow duplicate properties",
6941 desc: "Duplicate properties must appear one after the other.",
6942 browsers: "All",
6943 init: function(parser, reporter){
6944 var rule = this,
6945 properties,
6946 lastProperty;
6947
6948 function startRule(event){
6949 properties = {};
6950 }
6951
6952 parser.addListener("startrule", startRule);
6953 parser.addListener("startfontface", startRule);
6954 parser.addListener("startpage", startRule);
6955 parser.addListener("startpagemargin", startRule);
6956 parser.addListener("startkeyframerule", startRule);
6957
6958 parser.addListener("property", function(event){
6959 var property = event.property,
6960 name = property.text.toLowerCase();
6961
6962 if (properties[name] && (lastProperty != name || properties[name] == event.value.text)){
6963 reporter.report("Duplicate property '" + event.property + "' found.", event.line, event.col, rule);
6964 }
6965
6966 properties[name] = event.value.text;
6967 lastProperty = name;
6968
6969 });
6970
6971
6972 }
6973
6974 });
6975 CSSLint.addRule({
6976 id: "empty-rules",
6977 name: "Disallow empty rules",
6978 desc: "Rules without any properties specified should be removed.",
6979 browsers: "All",
6980 init: function(parser, reporter){
6981 var rule = this,
6982 count = 0;
6983
6984 parser.addListener("startrule", function(){
6985 count=0;
6986 });
6987
6988 parser.addListener("property", function(){
6989 count++;
6990 });
6991
6992 parser.addListener("endrule", function(event){
6993 var selectors = event.selectors;
6994 if (count === 0){
6995 reporter.report("Rule is empty.", selectors[0].line, selectors[0].col, rule);
6996 }
6997 });
6998 }
6999
7000 });
7001 CSSLint.addRule({
7002 id: "errors",
7003 name: "Parsing Errors",
7004 desc: "This rule looks for recoverable syntax errors.",
7005 browsers: "All",
7006 init: function(parser, reporter){
7007 var rule = this;
7008
7009 parser.addListener("error", function(event){
7010 reporter.error(event.message, event.line, event.col, rule);
7011 });
7012
7013 }
7014
7015 });
7016 CSSLint.addRule({
7017 id: "fallback-colors",
7018 name: "Require fallback colors",
7019 desc: "For older browsers that don't support RGBA, HSL, or HSLA, provide a fallback color.",
7020 browsers: "IE6,IE7,IE8",
7021 init: function(parser, reporter){
7022 var rule = this,
7023 lastProperty,
7024 propertiesToCheck = {
7025 color: 1,
7026 background: 1,
7027 "border-color": 1,
7028 "border-top-color": 1,
7029 "border-right-color": 1,
7030 "border-bottom-color": 1,
7031 "border-left-color": 1,
7032 border: 1,
7033 "border-top": 1,
7034 "border-right": 1,
7035 "border-bottom": 1,
7036 "border-left": 1,
7037 "background-color": 1
7038 },
7039 properties;
7040
7041 function startRule(event){
7042 properties = {};
7043 lastProperty = null;
7044 }
7045
7046 parser.addListener("startrule", startRule);
7047 parser.addListener("startfontface", startRule);
7048 parser.addListener("startpage", startRule);
7049 parser.addListener("startpagemargin", startRule);
7050 parser.addListener("startkeyframerule", startRule);
7051
7052 parser.addListener("property", function(event){
7053 var property = event.property,
7054 name = property.text.toLowerCase(),
7055 parts = event.value.parts,
7056 i = 0,
7057 colorType = "",
7058 len = parts.length;
7059
7060 if(propertiesToCheck[name]){
7061 while(i < len){
7062 if (parts[i].type == "color"){
7063 if ("alpha" in parts[i] || "hue" in parts[i]){
7064
7065 if (/([^\)]+)\(/.test(parts[i])){
7066 colorType = RegExp.$1.toUpperCase();
7067 }
7068
7069 if (!lastProperty || (lastProperty.property.text.toLowerCase() != name || lastProperty.colorType != "compat")){
7070 reporter.report("Fallback " + name + " (hex or RGB) should precede " + colorType + " " + name + ".", event.line, event.col, rule);
7071 }
7072 } else {
7073 event.colorType = "compat";
7074 }
7075 }
7076
7077 i++;
7078 }
7079 }
7080
7081 lastProperty = event;
7082 });
7083
7084 }
7085
7086 });
7087 CSSLint.addRule({
7088 id: "floats",
7089 name: "Disallow too many floats",
7090 desc: "This rule tests if the float property is used too many times",
7091 browsers: "All",
7092 init: function(parser, reporter){
7093 var rule = this;
7094 var count = 0;
7095 parser.addListener("property", function(event){
7096 if (event.property.text.toLowerCase() == "float" &&
7097 event.value.text.toLowerCase() != "none"){
7098 count++;
7099 }
7100 });
7101 parser.addListener("endstylesheet", function(){
7102 reporter.stat("floats", count);
7103 if (count >= 10){
7104 reporter.rollupWarn("Too many floats (" + count + "), you're probably using them for layout. Consider using a grid system instead.", rule);
7105 }
7106 });
7107 }
7108
7109 });
7110 CSSLint.addRule({
7111 id: "font-faces",
7112 name: "Don't use too many web fonts",
7113 desc: "Too many different web fonts in the same stylesheet.",
7114 browsers: "All",
7115 init: function(parser, reporter){
7116 var rule = this,
7117 count = 0;
7118
7119
7120 parser.addListener("startfontface", function(){
7121 count++;
7122 });
7123
7124 parser.addListener("endstylesheet", function(){
7125 if (count > 5){
7126 reporter.rollupWarn("Too many @font-face declarations (" + count + ").", rule);
7127 }
7128 });
7129 }
7130
7131 });
7132 CSSLint.addRule({
7133 id: "font-sizes",
7134 name: "Disallow too many font sizes",
7135 desc: "Checks the number of font-size declarations.",
7136 browsers: "All",
7137 init: function(parser, reporter){
7138 var rule = this,
7139 count = 0;
7140 parser.addListener("property", function(event){
7141 if (event.property == "font-size"){
7142 count++;
7143 }
7144 });
7145 parser.addListener("endstylesheet", function(){
7146 reporter.stat("font-sizes", count);
7147 if (count >= 10){
7148 reporter.rollupWarn("Too many font-size declarations (" + count + "), abstraction needed.", rule);
7149 }
7150 });
7151 }
7152
7153 });
7154 CSSLint.addRule({
7155 id: "gradients",
7156 name: "Require all gradient definitions",
7157 desc: "When using a vendor-prefixed gradient, make sure to use them all.",
7158 browsers: "All",
7159 init: function(parser, reporter){
7160 var rule = this,
7161 gradients;
7162
7163 parser.addListener("startrule", function(){
7164 gradients = {
7165 moz: 0,
7166 webkit: 0,
7167 oldWebkit: 0,
7168 o: 0
7169 };
7170 });
7171
7172 parser.addListener("property", function(event){
7173
7174 if (/\-(moz|o|webkit)(?:\-(?:linear|radial))\-gradient/i.test(event.value)){
7175 gradients[RegExp.$1] = 1;
7176 } else if (/\-webkit\-gradient/i.test(event.value)){
7177 gradients.oldWebkit = 1;
7178 }
7179
7180 });
7181
7182 parser.addListener("endrule", function(event){
7183 var missing = [];
7184
7185 if (!gradients.moz){
7186 missing.push("Firefox 3.6+");
7187 }
7188
7189 if (!gradients.webkit){
7190 missing.push("Webkit (Safari 5+, Chrome)");
7191 }
7192
7193 if (!gradients.oldWebkit){
7194 missing.push("Old Webkit (Safari 4+, Chrome)");
7195 }
7196
7197 if (!gradients.o){
7198 missing.push("Opera 11.1+");
7199 }
7200
7201 if (missing.length && missing.length < 4){
7202 reporter.report("Missing vendor-prefixed CSS gradients for " + missing.join(", ") + ".", event.selectors[0].line, event.selectors[0].col, rule);
7203 }
7204
7205 });
7206
7207 }
7208
7209 });
7210 CSSLint.addRule({
7211 id: "ids",
7212 name: "Disallow IDs in selectors",
7213 desc: "Selectors should not contain IDs.",
7214 browsers: "All",
7215 init: function(parser, reporter){
7216 var rule = this;
7217 parser.addListener("startrule", function(event){
7218 var selectors = event.selectors,
7219 selector,
7220 part,
7221 modifier,
7222 idCount,
7223 i, j, k;
7224
7225 for (i=0; i < selectors.length; i++){
7226 selector = selectors[i];
7227 idCount = 0;
7228
7229 for (j=0; j < selector.parts.length; j++){
7230 part = selector.parts[j];
7231 if (part.type == parser.SELECTOR_PART_TYPE){
7232 for (k=0; k < part.modifiers.length; k++){
7233 modifier = part.modifiers[k];
7234 if (modifier.type == "id"){
7235 idCount++;
7236 }
7237 }
7238 }
7239 }
7240
7241 if (idCount == 1){
7242 reporter.report("Don't use IDs in selectors.", selector.line, selector.col, rule);
7243 } else if (idCount > 1){
7244 reporter.report(idCount + " IDs in the selector, really?", selector.line, selector.col, rule);
7245 }
7246 }
7247
7248 });
7249 }
7250
7251 });
7252 CSSLint.addRule({
7253 id: "import",
7254 name: "Disallow @import",
7255 desc: "Don't use @import, use <link> instead.",
7256 browsers: "All",
7257 init: function(parser, reporter){
7258 var rule = this;
7259
7260 parser.addListener("import", function(event){
7261 reporter.report("@import prevents parallel downloads, use <link> instead.", event.line, event.col, rule);
7262 });
7263
7264 }
7265
7266 });
7267 CSSLint.addRule({
7268 id: "important",
7269 name: "Disallow !important",
7270 desc: "Be careful when using !important declaration",
7271 browsers: "All",
7272 init: function(parser, reporter){
7273 var rule = this,
7274 count = 0;
7275 parser.addListener("property", function(event){
7276 if (event.important === true){
7277 count++;
7278 reporter.report("Use of !important", event.line, event.col, rule);
7279 }
7280 });
7281 parser.addListener("endstylesheet", function(){
7282 reporter.stat("important", count);
7283 if (count >= 10){
7284 reporter.rollupWarn("Too many !important declarations (" + count + "), try to use less than 10 to avoid specificity issues.", rule);
7285 }
7286 });
7287 }
7288
7289 });
7290 CSSLint.addRule({
7291 id: "known-properties",
7292 name: "Require use of known properties",
7293 desc: "Properties should be known (listed in CSS3 specification) or be a vendor-prefixed property.",
7294 browsers: "All",
7295 init: function(parser, reporter){
7296 var rule = this;
7297
7298 parser.addListener("property", function(event){
7299 var name = event.property.text.toLowerCase();
7300 if (event.invalid) {
7301 reporter.report(event.invalid.message, event.line, event.col, rule);
7302 }
7303
7304 });
7305 }
7306
7307 });
7308 CSSLint.addRule({
7309 id: "outline-none",
7310 name: "Disallow outline: none",
7311 desc: "Use of outline: none or outline: 0 should be limited to :focus rules.",
7312 browsers: "All",
7313 tags: ["Accessibility"],
7314 init: function(parser, reporter){
7315 var rule = this,
7316 lastRule;
7317
7318 function startRule(event){
7319 if (event.selectors){
7320 lastRule = {
7321 line: event.line,
7322 col: event.col,
7323 selectors: event.selectors,
7324 propCount: 0,
7325 outline: false
7326 };
7327 } else {
7328 lastRule = null;
7329 }
7330 }
7331
7332 function endRule(event){
7333 if (lastRule){
7334 if (lastRule.outline){
7335 if (lastRule.selectors.toString().toLowerCase().indexOf(":focus") == -1){
7336 reporter.report("Outlines should only be modified using :focus.", lastRule.line, lastRule.col, rule);
7337 } else if (lastRule.propCount == 1) {
7338 reporter.report("Outlines shouldn't be hidden unless other visual changes are made.", lastRule.line, lastRule.col, rule);
7339 }
7340 }
7341 }
7342 }
7343
7344 parser.addListener("startrule", startRule);
7345 parser.addListener("startfontface", startRule);
7346 parser.addListener("startpage", startRule);
7347 parser.addListener("startpagemargin", startRule);
7348 parser.addListener("startkeyframerule", startRule);
7349
7350 parser.addListener("property", function(event){
7351 var name = event.property.text.toLowerCase(),
7352 value = event.value;
7353
7354 if (lastRule){
7355 lastRule.propCount++;
7356 if (name == "outline" && (value == "none" || value == "0")){
7357 lastRule.outline = true;
7358 }
7359 }
7360
7361 });
7362
7363 parser.addListener("endrule", endRule);
7364 parser.addListener("endfontface", endRule);
7365 parser.addListener("endpage", endRule);
7366 parser.addListener("endpagemargin", endRule);
7367 parser.addListener("endkeyframerule", endRule);
7368
7369 }
7370
7371 });
7372 CSSLint.addRule({
7373 id: "overqualified-elements",
7374 name: "Disallow overqualified elements",
7375 desc: "Don't use classes or IDs with elements (a.foo or a#foo).",
7376 browsers: "All",
7377 init: function(parser, reporter){
7378 var rule = this,
7379 classes = {};
7380
7381 parser.addListener("startrule", function(event){
7382 var selectors = event.selectors,
7383 selector,
7384 part,
7385 modifier,
7386 i, j, k;
7387
7388 for (i=0; i < selectors.length; i++){
7389 selector = selectors[i];
7390
7391 for (j=0; j < selector.parts.length; j++){
7392 part = selector.parts[j];
7393 if (part.type == parser.SELECTOR_PART_TYPE){
7394 for (k=0; k < part.modifiers.length; k++){
7395 modifier = part.modifiers[k];
7396 if (part.elementName && modifier.type == "id"){
7397 reporter.report("Element (" + part + ") is overqualified, just use " + modifier + " without element name.", part.line, part.col, rule);
7398 } else if (modifier.type == "class"){
7399
7400 if (!classes[modifier]){
7401 classes[modifier] = [];
7402 }
7403 classes[modifier].push({ modifier: modifier, part: part });
7404 }
7405 }
7406 }
7407 }
7408 }
7409 });
7410
7411 parser.addListener("endstylesheet", function(){
7412
7413 var prop;
7414 for (prop in classes){
7415 if (classes.hasOwnProperty(prop)){
7416 if (classes[prop].length == 1 && classes[prop][0].part.elementName){
7417 reporter.report("Element (" + classes[prop][0].part + ") is overqualified, just use " + classes[prop][0].modifier + " without element name.", classes[prop][0].part.line, classes[prop][0].part.col, rule);
7418 }
7419 }
7420 }
7421 });
7422 }
7423
7424 });
7425 CSSLint.addRule({
7426 id: "qualified-headings",
7427 name: "Disallow qualified headings",
7428 desc: "Headings should not be qualified (namespaced).",
7429 browsers: "All",
7430 init: function(parser, reporter){
7431 var rule = this;
7432
7433 parser.addListener("startrule", function(event){
7434 var selectors = event.selectors,
7435 selector,
7436 part,
7437 i, j;
7438
7439 for (i=0; i < selectors.length; i++){
7440 selector = selectors[i];
7441
7442 for (j=0; j < selector.parts.length; j++){
7443 part = selector.parts[j];
7444 if (part.type == parser.SELECTOR_PART_TYPE){
7445 if (part.elementName && /h[1-6]/.test(part.elementName.toString()) && j > 0){
7446 reporter.report("Heading (" + part.elementName + ") should not be qualified.", part.line, part.col, rule);
7447 }
7448 }
7449 }
7450 }
7451 });
7452 }
7453
7454 });
7455 CSSLint.addRule({
7456 id: "regex-selectors",
7457 name: "Disallow selectors that look like regexs",
7458 desc: "Selectors that look like regular expressions are slow and should be avoided.",
7459 browsers: "All",
7460 init: function(parser, reporter){
7461 var rule = this;
7462
7463 parser.addListener("startrule", function(event){
7464 var selectors = event.selectors,
7465 selector,
7466 part,
7467 modifier,
7468 i, j, k;
7469
7470 for (i=0; i < selectors.length; i++){
7471 selector = selectors[i];
7472 for (j=0; j < selector.parts.length; j++){
7473 part = selector.parts[j];
7474 if (part.type == parser.SELECTOR_PART_TYPE){
7475 for (k=0; k < part.modifiers.length; k++){
7476 modifier = part.modifiers[k];
7477 if (modifier.type == "attribute"){
7478 if (/([\~\|\^\$\*]=)/.test(modifier)){
7479 reporter.report("Attribute selectors with " + RegExp.$1 + " are slow!", modifier.line, modifier.col, rule);
7480 }
7481 }
7482
7483 }
7484 }
7485 }
7486 }
7487 });
7488 }
7489
7490 });
7491 CSSLint.addRule({
7492 id: "rules-count",
7493 name: "Rules Count",
7494 desc: "Track how many rules there are.",
7495 browsers: "All",
7496 init: function(parser, reporter){
7497 var rule = this,
7498 count = 0;
7499 parser.addListener("startrule", function(){
7500 count++;
7501 });
7502
7503 parser.addListener("endstylesheet", function(){
7504 reporter.stat("rule-count", count);
7505 });
7506 }
7507
7508 });
7509 CSSLint.addRule({
7510 id: "selector-max-approaching",
7511 name: "Warn when approaching the 4095 selector limit for IE",
7512 desc: "Will warn when selector count is >= 3800 selectors.",
7513 browsers: "IE",
7514 init: function(parser, reporter) {
7515 var rule = this, count = 0;
7516
7517 parser.addListener('startrule', function(event) {
7518 count += event.selectors.length;
7519 });
7520
7521 parser.addListener("endstylesheet", function() {
7522 if (count >= 3800) {
7523 reporter.report("You have " + count + " selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,rule);
7524 }
7525 });
7526 }
7527
7528 });
7529 CSSLint.addRule({
7530 id: "selector-max",
7531 name: "Error when past the 4095 selector limit for IE",
7532 desc: "Will error when selector count is > 4095.",
7533 browsers: "IE",
7534 init: function(parser, reporter){
7535 var rule = this, count = 0;
7536
7537 parser.addListener('startrule',function(event) {
7538 count += event.selectors.length;
7539 });
7540
7541 parser.addListener("endstylesheet", function() {
7542 if (count > 4095) {
7543 reporter.report("You have " + count + " selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,rule);
7544 }
7545 });
7546 }
7547
7548 });
7549 CSSLint.addRule({
7550 id: "shorthand",
7551 name: "Require shorthand properties",
7552 desc: "Use shorthand properties where possible.",
7553 browsers: "All",
7554 init: function(parser, reporter){
7555 var rule = this,
7556 prop, i, len,
7557 propertiesToCheck = {},
7558 properties,
7559 mapping = {
7560 "margin": [
7561 "margin-top",
7562 "margin-bottom",
7563 "margin-left",
7564 "margin-right"
7565 ],
7566 "padding": [
7567 "padding-top",
7568 "padding-bottom",
7569 "padding-left",
7570 "padding-right"
7571 ]
7572 };
7573 for (prop in mapping){
7574 if (mapping.hasOwnProperty(prop)){
7575 for (i=0, len=mapping[prop].length; i < len; i++){
7576 propertiesToCheck[mapping[prop][i]] = prop;
7577 }
7578 }
7579 }
7580
7581 function startRule(event){
7582 properties = {};
7583 }
7584 function endRule(event){
7585
7586 var prop, i, len, total;
7587 for (prop in mapping){
7588 if (mapping.hasOwnProperty(prop)){
7589 total=0;
7590
7591 for (i=0, len=mapping[prop].length; i < len; i++){
7592 total += properties[mapping[prop][i]] ? 1 : 0;
7593 }
7594
7595 if (total == mapping[prop].length){
7596 reporter.report("The properties " + mapping[prop].join(", ") + " can be replaced by " + prop + ".", event.line, event.col, rule);
7597 }
7598 }
7599 }
7600 }
7601
7602 parser.addListener("startrule", startRule);
7603 parser.addListener("startfontface", startRule);
7604 parser.addListener("property", function(event){
7605 var name = event.property.toString().toLowerCase(),
7606 value = event.value.parts[0].value;
7607
7608 if (propertiesToCheck[name]){
7609 properties[name] = 1;
7610 }
7611 });
7612
7613 parser.addListener("endrule", endRule);
7614 parser.addListener("endfontface", endRule);
7615
7616 }
7617
7618 });
7619 CSSLint.addRule({
7620 id: "star-property-hack",
7621 name: "Disallow properties with a star prefix",
7622 desc: "Checks for the star property hack (targets IE6/7)",
7623 browsers: "All",
7624 init: function(parser, reporter){
7625 var rule = this;
7626 parser.addListener("property", function(event){
7627 var property = event.property;
7628
7629 if (property.hack == "*") {
7630 reporter.report("Property with star prefix found.", event.property.line, event.property.col, rule);
7631 }
7632 });
7633 }
7634 });
7635 CSSLint.addRule({
7636 id: "text-indent",
7637 name: "Disallow negative text-indent",
7638 desc: "Checks for text indent less than -99px",
7639 browsers: "All",
7640 init: function(parser, reporter){
7641 var rule = this,
7642 textIndent,
7643 direction;
7644
7645
7646 function startRule(event){
7647 textIndent = false;
7648 direction = "inherit";
7649 }
7650 function endRule(event){
7651 if (textIndent && direction != "ltr"){
7652 reporter.report("Negative text-indent doesn't work well with RTL. If you use text-indent for image replacement explicitly set direction for that item to ltr.", textIndent.line, textIndent.col, rule);
7653 }
7654 }
7655
7656 parser.addListener("startrule", startRule);
7657 parser.addListener("startfontface", startRule);
7658 parser.addListener("property", function(event){
7659 var name = event.property.toString().toLowerCase(),
7660 value = event.value;
7661
7662 if (name == "text-indent" && value.parts[0].value < -99){
7663 textIndent = event.property;
7664 } else if (name == "direction" && value == "ltr"){
7665 direction = "ltr";
7666 }
7667 });
7668
7669 parser.addListener("endrule", endRule);
7670 parser.addListener("endfontface", endRule);
7671
7672 }
7673
7674 });
7675 CSSLint.addRule({
7676 id: "underscore-property-hack",
7677 name: "Disallow properties with an underscore prefix",
7678 desc: "Checks for the underscore property hack (targets IE6)",
7679 browsers: "All",
7680 init: function(parser, reporter){
7681 var rule = this;
7682 parser.addListener("property", function(event){
7683 var property = event.property;
7684
7685 if (property.hack == "_") {
7686 reporter.report("Property with underscore prefix found.", event.property.line, event.property.col, rule);
7687 }
7688 });
7689 }
7690 });
7691 CSSLint.addRule({
7692 id: "unique-headings",
7693 name: "Headings should only be defined once",
7694 desc: "Headings should be defined only once.",
7695 browsers: "All",
7696 init: function(parser, reporter){
7697 var rule = this;
7698
7699 var headings = {
7700 h1: 0,
7701 h2: 0,
7702 h3: 0,
7703 h4: 0,
7704 h5: 0,
7705 h6: 0
7706 };
7707
7708 parser.addListener("startrule", function(event){
7709 var selectors = event.selectors,
7710 selector,
7711 part,
7712 pseudo,
7713 i, j;
7714
7715 for (i=0; i < selectors.length; i++){
7716 selector = selectors[i];
7717 part = selector.parts[selector.parts.length-1];
7718
7719 if (part.elementName && /(h[1-6])/i.test(part.elementName.toString())){
7720
7721 for (j=0; j < part.modifiers.length; j++){
7722 if (part.modifiers[j].type == "pseudo"){
7723 pseudo = true;
7724 break;
7725 }
7726 }
7727
7728 if (!pseudo){
7729 headings[RegExp.$1]++;
7730 if (headings[RegExp.$1] > 1) {
7731 reporter.report("Heading (" + part.elementName + ") has already been defined.", part.line, part.col, rule);
7732 }
7733 }
7734 }
7735 }
7736 });
7737
7738 parser.addListener("endstylesheet", function(event){
7739 var prop,
7740 messages = [];
7741
7742 for (prop in headings){
7743 if (headings.hasOwnProperty(prop)){
7744 if (headings[prop] > 1){
7745 messages.push(headings[prop] + " " + prop + "s");
7746 }
7747 }
7748 }
7749
7750 if (messages.length){
7751 reporter.rollupWarn("You have " + messages.join(", ") + " defined in this stylesheet.", rule);
7752 }
7753 });
7754 }
7755
7756 });
7757 CSSLint.addRule({
7758 id: "universal-selector",
7759 name: "Disallow universal selector",
7760 desc: "The universal selector (*) is known to be slow.",
7761 browsers: "All",
7762 init: function(parser, reporter){
7763 var rule = this;
7764
7765 parser.addListener("startrule", function(event){
7766 var selectors = event.selectors,
7767 selector,
7768 part,
7769 modifier,
7770 i, j, k;
7771
7772 for (i=0; i < selectors.length; i++){
7773 selector = selectors[i];
7774
7775 part = selector.parts[selector.parts.length-1];
7776 if (part.elementName == "*"){
7777 reporter.report(rule.desc, part.line, part.col, rule);
7778 }
7779 }
7780 });
7781 }
7782
7783 });
7784 CSSLint.addRule({
7785 id: "unqualified-attributes",
7786 name: "Disallow unqualified attribute selectors",
7787 desc: "Unqualified attribute selectors are known to be slow.",
7788 browsers: "All",
7789 init: function(parser, reporter){
7790 var rule = this;
7791
7792 parser.addListener("startrule", function(event){
7793
7794 var selectors = event.selectors,
7795 selector,
7796 part,
7797 modifier,
7798 i, j, k;
7799
7800 for (i=0; i < selectors.length; i++){
7801 selector = selectors[i];
7802
7803 part = selector.parts[selector.parts.length-1];
7804 if (part.type == parser.SELECTOR_PART_TYPE){
7805 for (k=0; k < part.modifiers.length; k++){
7806 modifier = part.modifiers[k];
7807 if (modifier.type == "attribute" && (!part.elementName || part.elementName == "*")){
7808 reporter.report(rule.desc, part.line, part.col, rule);
7809 }
7810 }
7811 }
7812
7813 }
7814 });
7815 }
7816
7817 });
7818 CSSLint.addRule({
7819 id: "vendor-prefix",
7820 name: "Require standard property with vendor prefix",
7821 desc: "When using a vendor-prefixed property, make sure to include the standard one.",
7822 browsers: "All",
7823 init: function(parser, reporter){
7824 var rule = this,
7825 properties,
7826 num,
7827 propertiesToCheck = {
7828 "-webkit-border-radius": "border-radius",
7829 "-webkit-border-top-left-radius": "border-top-left-radius",
7830 "-webkit-border-top-right-radius": "border-top-right-radius",
7831 "-webkit-border-bottom-left-radius": "border-bottom-left-radius",
7832 "-webkit-border-bottom-right-radius": "border-bottom-right-radius",
7833
7834 "-o-border-radius": "border-radius",
7835 "-o-border-top-left-radius": "border-top-left-radius",
7836 "-o-border-top-right-radius": "border-top-right-radius",
7837 "-o-border-bottom-left-radius": "border-bottom-left-radius",
7838 "-o-border-bottom-right-radius": "border-bottom-right-radius",
7839
7840 "-moz-border-radius": "border-radius",
7841 "-moz-border-radius-topleft": "border-top-left-radius",
7842 "-moz-border-radius-topright": "border-top-right-radius",
7843 "-moz-border-radius-bottomleft": "border-bottom-left-radius",
7844 "-moz-border-radius-bottomright": "border-bottom-right-radius",
7845
7846 "-moz-column-count": "column-count",
7847 "-webkit-column-count": "column-count",
7848
7849 "-moz-column-gap": "column-gap",
7850 "-webkit-column-gap": "column-gap",
7851
7852 "-moz-column-rule": "column-rule",
7853 "-webkit-column-rule": "column-rule",
7854
7855 "-moz-column-rule-style": "column-rule-style",
7856 "-webkit-column-rule-style": "column-rule-style",
7857
7858 "-moz-column-rule-color": "column-rule-color",
7859 "-webkit-column-rule-color": "column-rule-color",
7860
7861 "-moz-column-rule-width": "column-rule-width",
7862 "-webkit-column-rule-width": "column-rule-width",
7863
7864 "-moz-column-width": "column-width",
7865 "-webkit-column-width": "column-width",
7866
7867 "-webkit-column-span": "column-span",
7868 "-webkit-columns": "columns",
7869
7870 "-moz-box-shadow": "box-shadow",
7871 "-webkit-box-shadow": "box-shadow",
7872
7873 "-moz-transform" : "transform",
7874 "-webkit-transform" : "transform",
7875 "-o-transform" : "transform",
7876 "-ms-transform" : "transform",
7877
7878 "-moz-transform-origin" : "transform-origin",
7879 "-webkit-transform-origin" : "transform-origin",
7880 "-o-transform-origin" : "transform-origin",
7881 "-ms-transform-origin" : "transform-origin",
7882
7883 "-moz-box-sizing" : "box-sizing",
7884 "-webkit-box-sizing" : "box-sizing",
7885
7886 "-moz-user-select" : "user-select",
7887 "-khtml-user-select" : "user-select",
7888 "-webkit-user-select" : "user-select"
7889 };
7890 function startRule(){
7891 properties = {};
7892 num=1;
7893 }
7894 function endRule(event){
7895 var prop,
7896 i, len,
7897 standard,
7898 needed,
7899 actual,
7900 needsStandard = [];
7901
7902 for (prop in properties){
7903 if (propertiesToCheck[prop]){
7904 needsStandard.push({ actual: prop, needed: propertiesToCheck[prop]});
7905 }
7906 }
7907
7908 for (i=0, len=needsStandard.length; i < len; i++){
7909 needed = needsStandard[i].needed;
7910 actual = needsStandard[i].actual;
7911
7912 if (!properties[needed]){
7913 reporter.report("Missing standard property '" + needed + "' to go along with '" + actual + "'.", properties[actual][0].name.line, properties[actual][0].name.col, rule);
7914 } else {
7915 if (properties[needed][0].pos < properties[actual][0].pos){
7916 reporter.report("Standard property '" + needed + "' should come after vendor-prefixed property '" + actual + "'.", properties[actual][0].name.line, properties[actual][0].name.col, rule);
7917 }
7918 }
7919 }
7920
7921 }
7922
7923 parser.addListener("startrule", startRule);
7924 parser.addListener("startfontface", startRule);
7925 parser.addListener("startpage", startRule);
7926 parser.addListener("startpagemargin", startRule);
7927 parser.addListener("startkeyframerule", startRule);
7928
7929 parser.addListener("property", function(event){
7930 var name = event.property.text.toLowerCase();
7931
7932 if (!properties[name]){
7933 properties[name] = [];
7934 }
7935
7936 properties[name].push({ name: event.property, value : event.value, pos:num++ });
7937 });
7938
7939 parser.addListener("endrule", endRule);
7940 parser.addListener("endfontface", endRule);
7941 parser.addListener("endpage", endRule);
7942 parser.addListener("endpagemargin", endRule);
7943 parser.addListener("endkeyframerule", endRule);
7944 }
7945
7946 });
7947 CSSLint.addRule({
7948 id: "zero-units",
7949 name: "Disallow units for 0 values",
7950 desc: "You don't need to specify units when a value is 0.",
7951 browsers: "All",
7952 init: function(parser, reporter){
7953 var rule = this;
7954 parser.addListener("property", function(event){
7955 var parts = event.value.parts,
7956 i = 0,
7957 len = parts.length;
7958
7959 while(i < len){
7960 if ((parts[i].units || parts[i].type == "percentage") && parts[i].value === 0 && parts[i].type != "time"){
7961 reporter.report("Values of 0 shouldn't have units specified.", parts[i].line, parts[i].col, rule);
7962 }
7963 i++;
7964 }
7965
7966 });
7967
7968 }
7969
7970 });
7971 (function() {
7972 var xmlEscape = function(str) {
7973 if (!str || str.constructor !== String) {
7974 return "";
7975 }
7976
7977 return str.replace(/[\"&><]/g, function(match) {
7978 switch (match) {
7979 case "\"":
7980 return "&quot;";
7981 case "&":
7982 return "&amp;";
7983 case "<":
7984 return "&lt;";
7985 case ">":
7986 return "&gt;";
7987 }
7988 });
7989 };
7990
7991 CSSLint.addFormatter({
7992 id: "checkstyle-xml",
7993 name: "Checkstyle XML format",
7994 startFormat: function(){
7995 return "<?xml version=\"1.0\" encoding=\"utf-8\"?><checkstyle>";
7996 },
7997 endFormat: function(){
7998 return "</checkstyle>";
7999 },
8000 readError: function(filename, message) {
8001 return "<file name=\"" + xmlEscape(filename) + "\"><error line=\"0\" column=\"0\" severty=\"error\" message=\"" + xmlEscape(message) + "\"></error></file>";
8002 },
8003 formatResults: function(results, filename, options) {
8004 var messages = results.messages,
8005 output = [];
8006 var generateSource = function(rule) {
8007 if (!rule || !('name' in rule)) {
8008 return "";
8009 }
8010 return 'net.csslint.' + rule.name.replace(/\s/g,'');
8011 };
8012
8013
8014
8015 if (messages.length > 0) {
8016 output.push("<file name=\""+filename+"\">");
8017 CSSLint.Util.forEach(messages, function (message, i) {
8018 if (!message.rollup) {
8019 output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" +
8020 " message=\"" + xmlEscape(message.message) + "\" source=\"" + generateSource(message.rule) +"\"/>");
8021 }
8022 });
8023 output.push("</file>");
8024 }
8025
8026 return output.join("");
8027 }
8028 });
8029
8030 }());
8031 CSSLint.addFormatter({
8032 id: "compact",
8033 name: "Compact, 'porcelain' format",
8034 startFormat: function() {
8035 return "";
8036 },
8037 endFormat: function() {
8038 return "";
8039 },
8040 formatResults: function(results, filename, options) {
8041 var messages = results.messages,
8042 output = "";
8043 options = options || {};
8044 var capitalize = function(str) {
8045 return str.charAt(0).toUpperCase() + str.slice(1);
8046 };
8047
8048 if (messages.length === 0) {
8049 return options.quiet ? "" : filename + ": Lint Free!";
8050 }
8051
8052 CSSLint.Util.forEach(messages, function(message, i) {
8053 if (message.rollup) {
8054 output += filename + ": " + capitalize(message.type) + " - " + message.message + "\n";
8055 } else {
8056 output += filename + ": " + "line " + message.line +
8057 ", col " + message.col + ", " + capitalize(message.type) + " - " + message.message + "\n";
8058 }
8059 });
8060
8061 return output;
8062 }
8063 });
8064 CSSLint.addFormatter({
8065 id: "csslint-xml",
8066 name: "CSSLint XML format",
8067 startFormat: function(){
8068 return "<?xml version=\"1.0\" encoding=\"utf-8\"?><csslint>";
8069 },
8070 endFormat: function(){
8071 return "</csslint>";
8072 },
8073 formatResults: function(results, filename, options) {
8074 var messages = results.messages,
8075 output = [];
8076 var escapeSpecialCharacters = function(str) {
8077 if (!str || str.constructor !== String) {
8078 return "";
8079 }
8080 return str.replace(/\"/g, "'").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8081 };
8082
8083 if (messages.length > 0) {
8084 output.push("<file name=\""+filename+"\">");
8085 CSSLint.Util.forEach(messages, function (message, i) {
8086 if (message.rollup) {
8087 output.push("<issue severity=\"" + message.type + "\" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
8088 } else {
8089 output.push("<issue line=\"" + message.line + "\" char=\"" + message.col + "\" severity=\"" + message.type + "\"" +
8090 " reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
8091 }
8092 });
8093 output.push("</file>");
8094 }
8095
8096 return output.join("");
8097 }
8098 });
8099 CSSLint.addFormatter({
8100 id: "junit-xml",
8101 name: "JUNIT XML format",
8102 startFormat: function(){
8103 return "<?xml version=\"1.0\" encoding=\"utf-8\"?><testsuites>";
8104 },
8105 endFormat: function() {
8106 return "</testsuites>";
8107 },
8108 formatResults: function(results, filename, options) {
8109
8110 var messages = results.messages,
8111 output = [],
8112 tests = {
8113 'error': 0,
8114 'failure': 0
8115 };
8116 var generateSource = function(rule) {
8117 if (!rule || !('name' in rule)) {
8118 return "";
8119 }
8120 return 'net.csslint.' + rule.name.replace(/\s/g,'');
8121 };
8122 var escapeSpecialCharacters = function(str) {
8123
8124 if (!str || str.constructor !== String) {
8125 return "";
8126 }
8127
8128 return str.replace(/\"/g, "'").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8129
8130 };
8131
8132 if (messages.length > 0) {
8133
8134 messages.forEach(function (message, i) {
8135 var type = message.type === 'warning' ? 'error' : message.type;
8136 if (!message.rollup) {
8137 output.push("<testcase time=\"0\" name=\"" + generateSource(message.rule) + "\">");
8138 output.push("<" + type + " message=\"" + escapeSpecialCharacters(message.message) + "\"><![CDATA[" + message.line + ':' + message.col + ':' + escapeSpecialCharacters(message.evidence) + "]]></" + type + ">");
8139 output.push("</testcase>");
8140
8141 tests[type] += 1;
8142
8143 }
8144
8145 });
8146
8147 output.unshift("<testsuite time=\"0\" tests=\"" + messages.length + "\" skipped=\"0\" errors=\"" + tests.error + "\" failures=\"" + tests.failure + "\" package=\"net.csslint\" name=\"" + filename + "\">");
8148 output.push("</testsuite>");
8149
8150 }
8151
8152 return output.join("");
8153
8154 }
8155 });
8156 CSSLint.addFormatter({
8157 id: "lint-xml",
8158 name: "Lint XML format",
8159 startFormat: function(){
8160 return "<?xml version=\"1.0\" encoding=\"utf-8\"?><lint>";
8161 },
8162 endFormat: function(){
8163 return "</lint>";
8164 },
8165 formatResults: function(results, filename, options) {
8166 var messages = results.messages,
8167 output = [];
8168 var escapeSpecialCharacters = function(str) {
8169 if (!str || str.constructor !== String) {
8170 return "";
8171 }
8172 return str.replace(/\"/g, "'").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8173 };
8174
8175 if (messages.length > 0) {
8176
8177 output.push("<file name=\""+filename+"\">");
8178 CSSLint.Util.forEach(messages, function (message, i) {
8179 if (message.rollup) {
8180 output.push("<issue severity=\"" + message.type + "\" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
8181 } else {
8182 output.push("<issue line=\"" + message.line + "\" char=\"" + message.col + "\" severity=\"" + message.type + "\"" +
8183 " reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
8184 }
8185 });
8186 output.push("</file>");
8187 }
8188
8189 return output.join("");
8190 }
8191 });
8192 CSSLint.addFormatter({
8193 id: "text",
8194 name: "Plain Text",
8195 startFormat: function() {
8196 return "";
8197 },
8198 endFormat: function() {
8199 return "";
8200 },
8201 formatResults: function(results, filename, options) {
8202 var messages = results.messages,
8203 output = "";
8204 options = options || {};
8205
8206 if (messages.length === 0) {
8207 return options.quiet ? "" : "\n\ncsslint: No errors in " + filename + ".";
8208 }
8209
8210 output = "\n\ncsslint: There are " + messages.length + " problems in " + filename + ".";
8211 var pos = filename.lastIndexOf("/"),
8212 shortFilename = filename;
8213
8214 if (pos === -1){
8215 pos = filename.lastIndexOf("\\");
8216 }
8217 if (pos > -1){
8218 shortFilename = filename.substring(pos+1);
8219 }
8220
8221 CSSLint.Util.forEach(messages, function (message, i) {
8222 output = output + "\n\n" + shortFilename;
8223 if (message.rollup) {
8224 output += "\n" + (i+1) + ": " + message.type;
8225 output += "\n" + message.message;
8226 } else {
8227 output += "\n" + (i+1) + ": " + message.type + " at line " + message.line + ", col " + message.col;
8228 output += "\n" + message.message;
8229 output += "\n" + message.evidence;
8230 }
8231 });
8232
8233 return output;
8234 }
8235 });
8236
8237 exports.CSSLint = CSSLint;
8238
8239 });
+0
-6447
try/ace/worker-javascript.js less more
0 "no use strict";
1 ;(function(window) {
2 if (typeof window.window != "undefined" && window.document) {
3 return;
4 }
5
6 window.console = {
7 log: function() {
8 var msgs = Array.prototype.slice.call(arguments, 0);
9 postMessage({type: "log", data: msgs});
10 },
11 error: function() {
12 var msgs = Array.prototype.slice.call(arguments, 0);
13 postMessage({type: "log", data: msgs});
14 }
15 };
16 window.window = window;
17 window.ace = window;
18
19 window.normalizeModule = function(parentId, moduleName) {
20 if (moduleName.indexOf("!") !== -1) {
21 var chunks = moduleName.split("!");
22 return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
23 }
24 if (moduleName.charAt(0) == ".") {
25 var base = parentId.split("/").slice(0, -1).join("/");
26 moduleName = base + "/" + moduleName;
27
28 while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
29 var previous = moduleName;
30 moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
31 }
32 }
33
34 return moduleName;
35 };
36
37 window.require = function(parentId, id) {
38 if (!id) {
39 id = parentId
40 parentId = null;
41 }
42 if (!id.charAt)
43 throw new Error("worker.js require() accepts only (parentId, id) as arguments");
44
45 id = normalizeModule(parentId, id);
46
47 var module = require.modules[id];
48 if (module) {
49 if (!module.initialized) {
50 module.initialized = true;
51 module.exports = module.factory().exports;
52 }
53 return module.exports;
54 }
55
56 var chunks = id.split("/");
57 chunks[0] = require.tlns[chunks[0]] || chunks[0];
58 var path = chunks.join("/") + ".js";
59
60 require.id = id;
61 importScripts(path);
62 return require(parentId, id);
63 };
64
65 require.modules = {};
66 require.tlns = {};
67
68 window.define = function(id, deps, factory) {
69 if (arguments.length == 2) {
70 factory = deps;
71 if (typeof id != "string") {
72 deps = id;
73 id = require.id;
74 }
75 } else if (arguments.length == 1) {
76 factory = id;
77 id = require.id;
78 }
79
80 if (id.indexOf("text!") === 0)
81 return;
82
83 var req = function(deps, factory) {
84 return require(id, deps, factory);
85 };
86
87 require.modules[id] = {
88 factory: function() {
89 var module = {
90 exports: {}
91 };
92 var returnExports = factory(req, module.exports, module);
93 if (returnExports)
94 module.exports = returnExports;
95 return module;
96 }
97 };
98 };
99
100 window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
101 require.tlns = topLevelNamespaces;
102 }
103
104 window.initSender = function initSender() {
105
106 var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
107 var oop = require("ace/lib/oop");
108
109 var Sender = function() {};
110
111 (function() {
112
113 oop.implement(this, EventEmitter);
114
115 this.callback = function(data, callbackId) {
116 postMessage({
117 type: "call",
118 id: callbackId,
119 data: data
120 });
121 };
122
123 this.emit = function(name, data) {
124 postMessage({
125 type: "event",
126 name: name,
127 data: data
128 });
129 };
130
131 }).call(Sender.prototype);
132
133 return new Sender();
134 }
135
136 window.main = null;
137 window.sender = null;
138
139 window.onmessage = function(e) {
140 var msg = e.data;
141 if (msg.command) {
142 if (main[msg.command])
143 main[msg.command].apply(main, msg.args);
144 else
145 throw new Error("Unknown command:" + msg.command);
146 }
147 else if (msg.init) {
148 initBaseUrls(msg.tlns);
149 require("ace/lib/es5-shim");
150 sender = initSender();
151 var clazz = require(msg.module)[msg.classname];
152 main = new clazz(sender);
153 }
154 else if (msg.event && sender) {
155 sender._emit(msg.event, msg.data);
156 }
157 };
158 })(this);
159
160 define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
161
162
163 var EventEmitter = {};
164 var stopPropagation = function() { this.propagationStopped = true; };
165 var preventDefault = function() { this.defaultPrevented = true; };
166
167 EventEmitter._emit =
168 EventEmitter._dispatchEvent = function(eventName, e) {
169 this._eventRegistry || (this._eventRegistry = {});
170 this._defaultHandlers || (this._defaultHandlers = {});
171
172 var listeners = this._eventRegistry[eventName] || [];
173 var defaultHandler = this._defaultHandlers[eventName];
174 if (!listeners.length && !defaultHandler)
175 return;
176
177 if (typeof e != "object" || !e)
178 e = {};
179
180 if (!e.type)
181 e.type = eventName;
182 if (!e.stopPropagation)
183 e.stopPropagation = stopPropagation;
184 if (!e.preventDefault)
185 e.preventDefault = preventDefault;
186
187 for (var i=0; i<listeners.length; i++) {
188 listeners[i](e, this);
189 if (e.propagationStopped)
190 break;
191 }
192
193 if (defaultHandler && !e.defaultPrevented)
194 return defaultHandler(e, this);
195 };
196
197
198 EventEmitter._signal = function(eventName, e) {
199 var listeners = (this._eventRegistry || {})[eventName];
200 if (!listeners)
201 return;
202
203 for (var i=0; i<listeners.length; i++)
204 listeners[i](e, this);
205 };
206
207 EventEmitter.once = function(eventName, callback) {
208 var _self = this;
209 callback && this.addEventListener(eventName, function newCallback() {
210 _self.removeEventListener(eventName, newCallback);
211 callback.apply(null, arguments);
212 });
213 };
214
215
216 EventEmitter.setDefaultHandler = function(eventName, callback) {
217 var handlers = this._defaultHandlers
218 if (!handlers)
219 handlers = this._defaultHandlers = {_disabled_: {}};
220
221 if (handlers[eventName]) {
222 var old = handlers[eventName];
223 var disabled = handlers._disabled_[eventName];
224 if (!disabled)
225 handlers._disabled_[eventName] = disabled = [];
226 disabled.push(old);
227 var i = disabled.indexOf(callback);
228 if (i != -1)
229 disabled.splice(i, 1);
230 }
231 handlers[eventName] = callback;
232 };
233 EventEmitter.removeDefaultHandler = function(eventName, callback) {
234 var handlers = this._defaultHandlers
235 if (!handlers)
236 return;
237 var disabled = handlers._disabled_[eventName];
238
239 if (handlers[eventName] == callback) {
240 var old = handlers[eventName];
241 if (disabled)
242 this.setDefaultHandler(eventName, disabled.pop());
243 } else if (disabled) {
244 var i = disabled.indexOf(callback);
245 if (i != -1)
246 disabled.splice(i, 1);
247 }
248 };
249
250 EventEmitter.on =
251 EventEmitter.addEventListener = function(eventName, callback, capturing) {
252 this._eventRegistry = this._eventRegistry || {};
253
254 var listeners = this._eventRegistry[eventName];
255 if (!listeners)
256 listeners = this._eventRegistry[eventName] = [];
257
258 if (listeners.indexOf(callback) == -1)
259 listeners[capturing ? "unshift" : "push"](callback);
260 return callback;
261 };
262
263 EventEmitter.off =
264 EventEmitter.removeListener =
265 EventEmitter.removeEventListener = function(eventName, callback) {
266 this._eventRegistry = this._eventRegistry || {};
267
268 var listeners = this._eventRegistry[eventName];
269 if (!listeners)
270 return;
271
272 var index = listeners.indexOf(callback);
273 if (index !== -1)
274 listeners.splice(index, 1);
275 };
276
277 EventEmitter.removeAllListeners = function(eventName) {
278 if (this._eventRegistry) this._eventRegistry[eventName] = [];
279 };
280
281 exports.EventEmitter = EventEmitter;
282
283 });
284
285 define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
286
287
288 exports.inherits = (function() {
289 var tempCtor = function() {};
290 return function(ctor, superCtor) {
291 tempCtor.prototype = superCtor.prototype;
292 ctor.super_ = superCtor.prototype;
293 ctor.prototype = new tempCtor();
294 ctor.prototype.constructor = ctor;
295 };
296 }());
297
298 exports.mixin = function(obj, mixin) {
299 for (var key in mixin) {
300 obj[key] = mixin[key];
301 }
302 return obj;
303 };
304
305 exports.implement = function(proto, mixin) {
306 exports.mixin(proto, mixin);
307 };
308
309 });
310
311 define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) {
312
313 function Empty() {}
314
315 if (!Function.prototype.bind) {
316 Function.prototype.bind = function bind(that) { // .length is 1
317 var target = this;
318 if (typeof target != "function") {
319 throw new TypeError("Function.prototype.bind called on incompatible " + target);
320 }
321 var args = slice.call(arguments, 1); // for normal call
322 var bound = function () {
323
324 if (this instanceof bound) {
325
326 var result = target.apply(
327 this,
328 args.concat(slice.call(arguments))
329 );
330 if (Object(result) === result) {
331 return result;
332 }
333 return this;
334
335 } else {
336 return target.apply(
337 that,
338 args.concat(slice.call(arguments))
339 );
340
341 }
342
343 };
344 if(target.prototype) {
345 Empty.prototype = target.prototype;
346 bound.prototype = new Empty();
347 Empty.prototype = null;
348 }
349 return bound;
350 };
351 }
352 var call = Function.prototype.call;
353 var prototypeOfArray = Array.prototype;
354 var prototypeOfObject = Object.prototype;
355 var slice = prototypeOfArray.slice;
356 var _toString = call.bind(prototypeOfObject.toString);
357 var owns = call.bind(prototypeOfObject.hasOwnProperty);
358 var defineGetter;
359 var defineSetter;
360 var lookupGetter;
361 var lookupSetter;
362 var supportsAccessors;
363 if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
364 defineGetter = call.bind(prototypeOfObject.__defineGetter__);
365 defineSetter = call.bind(prototypeOfObject.__defineSetter__);
366 lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
367 lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
368 }
369 if ([1,2].splice(0).length != 2) {
370 if(function() { // test IE < 9 to splice bug - see issue #138
371 function makeArray(l) {
372 var a = new Array(l+2);
373 a[0] = a[1] = 0;
374 return a;
375 }
376 var array = [], lengthBefore;
377
378 array.splice.apply(array, makeArray(20));
379 array.splice.apply(array, makeArray(26));
380
381 lengthBefore = array.length; //46
382 array.splice(5, 0, "XXX"); // add one element
383
384 lengthBefore + 1 == array.length
385
386 if (lengthBefore + 1 == array.length) {
387 return true;// has right splice implementation without bugs
388 }
389 }()) {//IE 6/7
390 var array_splice = Array.prototype.splice;
391 Array.prototype.splice = function(start, deleteCount) {
392 if (!arguments.length) {
393 return [];
394 } else {
395 return array_splice.apply(this, [
396 start === void 0 ? 0 : start,
397 deleteCount === void 0 ? (this.length - start) : deleteCount
398 ].concat(slice.call(arguments, 2)))
399 }
400 };
401 } else {//IE8
402 Array.prototype.splice = function(pos, removeCount){
403 var length = this.length;
404 if (pos > 0) {
405 if (pos > length)
406 pos = length;
407 } else if (pos == void 0) {
408 pos = 0;
409 } else if (pos < 0) {
410 pos = Math.max(length + pos, 0);
411 }
412
413 if (!(pos+removeCount < length))
414 removeCount = length - pos;
415
416 var removed = this.slice(pos, pos+removeCount);
417 var insert = slice.call(arguments, 2);
418 var add = insert.length;
419 if (pos === length) {
420 if (add) {
421 this.push.apply(this, insert);
422 }
423 } else {
424 var remove = Math.min(removeCount, length - pos);
425 var tailOldPos = pos + remove;
426 var tailNewPos = tailOldPos + add - remove;
427 var tailCount = length - tailOldPos;
428 var lengthAfterRemove = length - remove;
429
430 if (tailNewPos < tailOldPos) { // case A
431 for (var i = 0; i < tailCount; ++i) {
432 this[tailNewPos+i] = this[tailOldPos+i];
433 }
434 } else if (tailNewPos > tailOldPos) { // case B
435 for (i = tailCount; i--; ) {
436 this[tailNewPos+i] = this[tailOldPos+i];
437 }
438 } // else, add == remove (nothing to do)
439
440 if (add && pos === lengthAfterRemove) {
441 this.length = lengthAfterRemove; // truncate array
442 this.push.apply(this, insert);
443 } else {
444 this.length = lengthAfterRemove + add; // reserves space
445 for (i = 0; i < add; ++i) {
446 this[pos+i] = insert[i];
447 }
448 }
449 }
450 return removed;
451 };
452 }
453 }
454 if (!Array.isArray) {
455 Array.isArray = function isArray(obj) {
456 return _toString(obj) == "[object Array]";
457 };
458 }
459 var boxedString = Object("a"),
460 splitString = boxedString[0] != "a" || !(0 in boxedString);
461
462 if (!Array.prototype.forEach) {
463 Array.prototype.forEach = function forEach(fun /*, thisp*/) {
464 var object = toObject(this),
465 self = splitString && _toString(this) == "[object String]" ?
466 this.split("") :
467 object,
468 thisp = arguments[1],
469 i = -1,
470 length = self.length >>> 0;
471 if (_toString(fun) != "[object Function]") {
472 throw new TypeError(); // TODO message
473 }
474
475 while (++i < length) {
476 if (i in self) {
477 fun.call(thisp, self[i], i, object);
478 }
479 }
480 };
481 }
482 if (!Array.prototype.map) {
483 Array.prototype.map = function map(fun /*, thisp*/) {
484 var object = toObject(this),
485 self = splitString && _toString(this) == "[object String]" ?
486 this.split("") :
487 object,
488 length = self.length >>> 0,
489 result = Array(length),
490 thisp = arguments[1];
491 if (_toString(fun) != "[object Function]") {
492 throw new TypeError(fun + " is not a function");
493 }
494
495 for (var i = 0; i < length; i++) {
496 if (i in self)
497 result[i] = fun.call(thisp, self[i], i, object);
498 }
499 return result;
500 };
501 }
502 if (!Array.prototype.filter) {
503 Array.prototype.filter = function filter(fun /*, thisp */) {
504 var object = toObject(this),
505 self = splitString && _toString(this) == "[object String]" ?
506 this.split("") :
507 object,
508 length = self.length >>> 0,
509 result = [],
510 value,
511 thisp = arguments[1];
512 if (_toString(fun) != "[object Function]") {
513 throw new TypeError(fun + " is not a function");
514 }
515
516 for (var i = 0; i < length; i++) {
517 if (i in self) {
518 value = self[i];
519 if (fun.call(thisp, value, i, object)) {
520 result.push(value);
521 }
522 }
523 }
524 return result;
525 };
526 }
527 if (!Array.prototype.every) {
528 Array.prototype.every = function every(fun /*, thisp */) {
529 var object = toObject(this),
530 self = splitString && _toString(this) == "[object String]" ?
531 this.split("") :
532 object,
533 length = self.length >>> 0,
534 thisp = arguments[1];
535 if (_toString(fun) != "[object Function]") {
536 throw new TypeError(fun + " is not a function");
537 }
538
539 for (var i = 0; i < length; i++) {
540 if (i in self && !fun.call(thisp, self[i], i, object)) {
541 return false;
542 }
543 }
544 return true;
545 };
546 }
547 if (!Array.prototype.some) {
548 Array.prototype.some = function some(fun /*, thisp */) {
549 var object = toObject(this),
550 self = splitString && _toString(this) == "[object String]" ?
551 this.split("") :
552 object,
553 length = self.length >>> 0,
554 thisp = arguments[1];
555 if (_toString(fun) != "[object Function]") {
556 throw new TypeError(fun + " is not a function");
557 }
558
559 for (var i = 0; i < length; i++) {
560 if (i in self && fun.call(thisp, self[i], i, object)) {
561 return true;
562 }
563 }
564 return false;
565 };
566 }
567 if (!Array.prototype.reduce) {
568 Array.prototype.reduce = function reduce(fun /*, initial*/) {
569 var object = toObject(this),
570 self = splitString && _toString(this) == "[object String]" ?
571 this.split("") :
572 object,
573 length = self.length >>> 0;
574 if (_toString(fun) != "[object Function]") {
575 throw new TypeError(fun + " is not a function");
576 }
577 if (!length && arguments.length == 1) {
578 throw new TypeError("reduce of empty array with no initial value");
579 }
580
581 var i = 0;
582 var result;
583 if (arguments.length >= 2) {
584 result = arguments[1];
585 } else {
586 do {
587 if (i in self) {
588 result = self[i++];
589 break;
590 }
591 if (++i >= length) {
592 throw new TypeError("reduce of empty array with no initial value");
593 }
594 } while (true);
595 }
596
597 for (; i < length; i++) {
598 if (i in self) {
599 result = fun.call(void 0, result, self[i], i, object);
600 }
601 }
602
603 return result;
604 };
605 }
606 if (!Array.prototype.reduceRight) {
607 Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
608 var object = toObject(this),
609 self = splitString && _toString(this) == "[object String]" ?
610 this.split("") :
611 object,
612 length = self.length >>> 0;
613 if (_toString(fun) != "[object Function]") {
614 throw new TypeError(fun + " is not a function");
615 }
616 if (!length && arguments.length == 1) {
617 throw new TypeError("reduceRight of empty array with no initial value");
618 }
619
620 var result, i = length - 1;
621 if (arguments.length >= 2) {
622 result = arguments[1];
623 } else {
624 do {
625 if (i in self) {
626 result = self[i--];
627 break;
628 }
629 if (--i < 0) {
630 throw new TypeError("reduceRight of empty array with no initial value");
631 }
632 } while (true);
633 }
634
635 do {
636 if (i in this) {
637 result = fun.call(void 0, result, self[i], i, object);
638 }
639 } while (i--);
640
641 return result;
642 };
643 }
644 if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
645 Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
646 var self = splitString && _toString(this) == "[object String]" ?
647 this.split("") :
648 toObject(this),
649 length = self.length >>> 0;
650
651 if (!length) {
652 return -1;
653 }
654
655 var i = 0;
656 if (arguments.length > 1) {
657 i = toInteger(arguments[1]);
658 }
659 i = i >= 0 ? i : Math.max(0, length + i);
660 for (; i < length; i++) {
661 if (i in self && self[i] === sought) {
662 return i;
663 }
664 }
665 return -1;
666 };
667 }
668 if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
669 Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
670 var self = splitString && _toString(this) == "[object String]" ?
671 this.split("") :
672 toObject(this),
673 length = self.length >>> 0;
674
675 if (!length) {
676 return -1;
677 }
678 var i = length - 1;
679 if (arguments.length > 1) {
680 i = Math.min(i, toInteger(arguments[1]));
681 }
682 i = i >= 0 ? i : length - Math.abs(i);
683 for (; i >= 0; i--) {
684 if (i in self && sought === self[i]) {
685 return i;
686 }
687 }
688 return -1;
689 };
690 }
691 if (!Object.getPrototypeOf) {
692 Object.getPrototypeOf = function getPrototypeOf(object) {
693 return object.__proto__ || (
694 object.constructor ?
695 object.constructor.prototype :
696 prototypeOfObject
697 );
698 };
699 }
700 if (!Object.getOwnPropertyDescriptor) {
701 var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
702 "non-object: ";
703 Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
704 if ((typeof object != "object" && typeof object != "function") || object === null)
705 throw new TypeError(ERR_NON_OBJECT + object);
706 if (!owns(object, property))
707 return;
708
709 var descriptor, getter, setter;
710 descriptor = { enumerable: true, configurable: true };
711 if (supportsAccessors) {
712 var prototype = object.__proto__;
713 object.__proto__ = prototypeOfObject;
714
715 var getter = lookupGetter(object, property);
716 var setter = lookupSetter(object, property);
717 object.__proto__ = prototype;
718
719 if (getter || setter) {
720 if (getter) descriptor.get = getter;
721 if (setter) descriptor.set = setter;
722 return descriptor;
723 }
724 }
725 descriptor.value = object[property];
726 return descriptor;
727 };
728 }
729 if (!Object.getOwnPropertyNames) {
730 Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
731 return Object.keys(object);
732 };
733 }
734 if (!Object.create) {
735 var createEmpty;
736 if (Object.prototype.__proto__ === null) {
737 createEmpty = function () {
738 return { "__proto__": null };
739 };
740 } else {
741 createEmpty = function () {
742 var empty = {};
743 for (var i in empty)
744 empty[i] = null;
745 empty.constructor =
746 empty.hasOwnProperty =
747 empty.propertyIsEnumerable =
748 empty.isPrototypeOf =
749 empty.toLocaleString =
750 empty.toString =
751 empty.valueOf =
752 empty.__proto__ = null;
753 return empty;
754 }
755 }
756
757 Object.create = function create(prototype, properties) {
758 var object;
759 if (prototype === null) {
760 object = createEmpty();
761 } else {
762 if (typeof prototype != "object")
763 throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
764 var Type = function () {};
765 Type.prototype = prototype;
766 object = new Type();
767 object.__proto__ = prototype;
768 }
769 if (properties !== void 0)
770 Object.defineProperties(object, properties);
771 return object;
772 };
773 }
774
775 function doesDefinePropertyWork(object) {
776 try {
777 Object.defineProperty(object, "sentinel", {});
778 return "sentinel" in object;
779 } catch (exception) {
780 }
781 }
782 if (Object.defineProperty) {
783 var definePropertyWorksOnObject = doesDefinePropertyWork({});
784 var definePropertyWorksOnDom = typeof document == "undefined" ||
785 doesDefinePropertyWork(document.createElement("div"));
786 if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
787 var definePropertyFallback = Object.defineProperty;
788 }
789 }
790
791 if (!Object.defineProperty || definePropertyFallback) {
792 var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
793 var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
794 var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
795 "on this javascript engine";
796
797 Object.defineProperty = function defineProperty(object, property, descriptor) {
798 if ((typeof object != "object" && typeof object != "function") || object === null)
799 throw new TypeError(ERR_NON_OBJECT_TARGET + object);
800 if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
801 throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
802 if (definePropertyFallback) {
803 try {
804 return definePropertyFallback.call(Object, object, property, descriptor);
805 } catch (exception) {
806 }
807 }
808 if (owns(descriptor, "value")) {
809
810 if (supportsAccessors && (lookupGetter(object, property) ||
811 lookupSetter(object, property)))
812 {
813 var prototype = object.__proto__;
814 object.__proto__ = prototypeOfObject;
815 delete object[property];
816 object[property] = descriptor.value;
817 object.__proto__ = prototype;
818 } else {
819 object[property] = descriptor.value;
820 }
821 } else {
822 if (!supportsAccessors)
823 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
824 if (owns(descriptor, "get"))
825 defineGetter(object, property, descriptor.get);
826 if (owns(descriptor, "set"))
827 defineSetter(object, property, descriptor.set);
828 }
829
830 return object;
831 };
832 }
833 if (!Object.defineProperties) {
834 Object.defineProperties = function defineProperties(object, properties) {
835 for (var property in properties) {
836 if (owns(properties, property))
837 Object.defineProperty(object, property, properties[property]);
838 }
839 return object;
840 };
841 }
842 if (!Object.seal) {
843 Object.seal = function seal(object) {
844 return object;
845 };
846 }
847 if (!Object.freeze) {
848 Object.freeze = function freeze(object) {
849 return object;
850 };
851 }
852 try {
853 Object.freeze(function () {});
854 } catch (exception) {
855 Object.freeze = (function freeze(freezeObject) {
856 return function freeze(object) {
857 if (typeof object == "function") {
858 return object;
859 } else {
860 return freezeObject(object);
861 }
862 };
863 })(Object.freeze);
864 }
865 if (!Object.preventExtensions) {
866 Object.preventExtensions = function preventExtensions(object) {
867 return object;
868 };
869 }
870 if (!Object.isSealed) {
871 Object.isSealed = function isSealed(object) {
872 return false;
873 };
874 }
875 if (!Object.isFrozen) {
876 Object.isFrozen = function isFrozen(object) {
877 return false;
878 };
879 }
880 if (!Object.isExtensible) {
881 Object.isExtensible = function isExtensible(object) {
882 if (Object(object) === object) {
883 throw new TypeError(); // TODO message
884 }
885 var name = '';
886 while (owns(object, name)) {
887 name += '?';
888 }
889 object[name] = true;
890 var returnValue = owns(object, name);
891 delete object[name];
892 return returnValue;
893 };
894 }
895 if (!Object.keys) {
896 var hasDontEnumBug = true,
897 dontEnums = [
898 "toString",
899 "toLocaleString",
900 "valueOf",
901 "hasOwnProperty",
902 "isPrototypeOf",
903 "propertyIsEnumerable",
904 "constructor"
905 ],
906 dontEnumsLength = dontEnums.length;
907
908 for (var key in {"toString": null}) {
909 hasDontEnumBug = false;
910 }
911
912 Object.keys = function keys(object) {
913
914 if (
915 (typeof object != "object" && typeof object != "function") ||
916 object === null
917 ) {
918 throw new TypeError("Object.keys called on a non-object");
919 }
920
921 var keys = [];
922 for (var name in object) {
923 if (owns(object, name)) {
924 keys.push(name);
925 }
926 }
927
928 if (hasDontEnumBug) {
929 for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
930 var dontEnum = dontEnums[i];
931 if (owns(object, dontEnum)) {
932 keys.push(dontEnum);
933 }
934 }
935 }
936 return keys;
937 };
938
939 }
940 if (!Date.now) {
941 Date.now = function now() {
942 return new Date().getTime();
943 };
944 }
945 var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
946 "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
947 "\u2029\uFEFF";
948 if (!String.prototype.trim || ws.trim()) {
949 ws = "[" + ws + "]";
950 var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
951 trimEndRegexp = new RegExp(ws + ws + "*$");
952 String.prototype.trim = function trim() {
953 return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
954 };
955 }
956
957 function toInteger(n) {
958 n = +n;
959 if (n !== n) { // isNaN
960 n = 0;
961 } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
962 n = (n > 0 || -1) * Math.floor(Math.abs(n));
963 }
964 return n;
965 }
966
967 function isPrimitive(input) {
968 var type = typeof input;
969 return (
970 input === null ||
971 type === "undefined" ||
972 type === "boolean" ||
973 type === "number" ||
974 type === "string"
975 );
976 }
977
978 function toPrimitive(input) {
979 var val, valueOf, toString;
980 if (isPrimitive(input)) {
981 return input;
982 }
983 valueOf = input.valueOf;
984 if (typeof valueOf === "function") {
985 val = valueOf.call(input);
986 if (isPrimitive(val)) {
987 return val;
988 }
989 }
990 toString = input.toString;
991 if (typeof toString === "function") {
992 val = toString.call(input);
993 if (isPrimitive(val)) {
994 return val;
995 }
996 }
997 throw new TypeError();
998 }
999 var toObject = function (o) {
1000 if (o == null) { // this matches both null and undefined
1001 throw new TypeError("can't convert "+o+" to object");
1002 }
1003 return Object(o);
1004 };
1005
1006 });
1007
1008 define('ace/mode/javascript_worker', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/worker/mirror', 'ace/mode/javascript/jshint'], function(require, exports, module) {
1009
1010
1011 var oop = require("../lib/oop");
1012 var Mirror = require("../worker/mirror").Mirror;
1013 var lint = require("./javascript/jshint").JSHINT;
1014
1015 function startRegex(arr) {
1016 return RegExp("^(" + arr.join("|") + ")");
1017 }
1018
1019 var disabledWarningsRe = startRegex([
1020 "Bad for in variable '(.+)'.",
1021 'Missing "use strict"'
1022 ]);
1023 var errorsRe = startRegex([
1024 "Unexpected",
1025 "Expected ",
1026 "Confusing (plus|minus)",
1027 "\\{a\\} unterminated regular expression",
1028 "Unclosed ",
1029 "Unmatched ",
1030 "Unbegun comment",
1031 "Bad invocation",
1032 "Missing space after",
1033 "Missing operator at"
1034 ]);
1035 var infoRe = startRegex([
1036 "Expected an assignment",
1037 "Bad escapement of EOL",
1038 "Unexpected comma",
1039 "Unexpected space",
1040 "Missing radix parameter.",
1041 "A leading decimal point can",
1042 "\\['{a}'\\] is better written in dot notation.",
1043 "'{a}' used out of scope"
1044 ]);
1045
1046 var JavaScriptWorker = exports.JavaScriptWorker = function(sender) {
1047 Mirror.call(this, sender);
1048 this.setTimeout(500);
1049 this.setOptions();
1050 };
1051
1052 oop.inherits(JavaScriptWorker, Mirror);
1053
1054 (function() {
1055 this.setOptions = function(options) {
1056 this.options = options || {
1057 es5: true,
1058 esnext: true,
1059 devel: true,
1060 browser: true,
1061 node: true,
1062 laxcomma: true,
1063 laxbreak: true,
1064 lastsemic: true,
1065 onevar: false,
1066 passfail: false,
1067 maxerr: 100,
1068 expr: true,
1069 multistr: true,
1070 globalstrict: true
1071 };
1072 this.doc.getValue() && this.deferredUpdate.schedule(100);
1073 };
1074
1075 this.changeOptions = function(newOptions) {
1076 oop.mixin(this.options, newOptions);
1077 this.doc.getValue() && this.deferredUpdate.schedule(100);
1078 };
1079
1080 this.isValidJS = function(str) {
1081 try {
1082 eval("throw 0;" + str);
1083 } catch(e) {
1084 if (e === 0)
1085 return true;
1086 }
1087 return false
1088 };
1089
1090 this.onUpdate = function() {
1091 var value = this.doc.getValue();
1092 value = value.replace(/^#!.*\n/, "\n");
1093 if (!value) {
1094 this.sender.emit("jslint", []);
1095 return;
1096 }
1097 var errors = [];
1098 var maxErrorLevel = this.isValidJS(value) ? "warning" : "error";
1099 lint(value, this.options);
1100 var results = lint.errors;
1101
1102 var errorAdded = false
1103 for (var i = 0; i < results.length; i++) {
1104 var error = results[i];
1105 if (!error)
1106 continue;
1107 var raw = error.raw;
1108 var type = "warning";
1109
1110 if (raw == "Missing semicolon.") {
1111 var str = error.evidence.substr(error.character);
1112 str = str.charAt(str.search(/\S/));
1113 if (maxErrorLevel == "error" && str && /[\w\d{(['"]/.test(str)) {
1114 error.reason = 'Missing ";" before statement';
1115 type = "error";
1116 } else {
1117 type = "info";
1118 }
1119 }
1120 else if (disabledWarningsRe.test(raw)) {
1121 continue;
1122 }
1123 else if (infoRe.test(raw)) {
1124 type = "info"
1125 }
1126 else if (errorsRe.test(raw)) {
1127 errorAdded = true;
1128 type = maxErrorLevel;
1129 }
1130 else if (raw == "'{a}' is not defined.") {
1131 type = "warning";
1132 }
1133 else if (raw == "'{a}' is defined but never used.") {
1134 type = "info";
1135 }
1136
1137 errors.push({
1138 row: error.line-1,
1139 column: error.character-1,
1140 text: error.reason,
1141 type: type,
1142 raw: raw
1143 });
1144
1145 if (errorAdded) {
1146 }
1147 }
1148
1149 this.sender.emit("jslint", errors);
1150 };
1151
1152 }).call(JavaScriptWorker.prototype);
1153
1154 });
1155 define('ace/worker/mirror', ['require', 'exports', 'module' , 'ace/document', 'ace/lib/lang'], function(require, exports, module) {
1156
1157
1158 var Document = require("../document").Document;
1159 var lang = require("../lib/lang");
1160
1161 var Mirror = exports.Mirror = function(sender) {
1162 this.sender = sender;
1163 var doc = this.doc = new Document("");
1164
1165 var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1166
1167 var _self = this;
1168 sender.on("change", function(e) {
1169 doc.applyDeltas(e.data);
1170 deferredUpdate.schedule(_self.$timeout);
1171 });
1172 };
1173
1174 (function() {
1175
1176 this.$timeout = 500;
1177
1178 this.setTimeout = function(timeout) {
1179 this.$timeout = timeout;
1180 };
1181
1182 this.setValue = function(value) {
1183 this.doc.setValue(value);
1184 this.deferredUpdate.schedule(this.$timeout);
1185 };
1186
1187 this.getValue = function(callbackId) {
1188 this.sender.callback(this.doc.getValue(), callbackId);
1189 };
1190
1191 this.onUpdate = function() {
1192 };
1193
1194 }).call(Mirror.prototype);
1195
1196 });
1197
1198 define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
1199
1200
1201 var oop = require("./lib/oop");
1202 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1203 var Range = require("./range").Range;
1204 var Anchor = require("./anchor").Anchor;
1205
1206 var Document = function(text) {
1207 this.$lines = [];
1208 if (text.length == 0) {
1209 this.$lines = [""];
1210 } else if (Array.isArray(text)) {
1211 this._insertLines(0, text);
1212 } else {
1213 this.insert({row: 0, column:0}, text);
1214 }
1215 };
1216
1217 (function() {
1218
1219 oop.implement(this, EventEmitter);
1220 this.setValue = function(text) {
1221 var len = this.getLength();
1222 this.remove(new Range(0, 0, len, this.getLine(len-1).length));
1223 this.insert({row: 0, column:0}, text);
1224 };
1225 this.getValue = function() {
1226 return this.getAllLines().join(this.getNewLineCharacter());
1227 };
1228 this.createAnchor = function(row, column) {
1229 return new Anchor(this, row, column);
1230 };
1231 if ("aaa".split(/a/).length == 0)
1232 this.$split = function(text) {
1233 return text.replace(/\r\n|\r/g, "\n").split("\n");
1234 }
1235 else
1236 this.$split = function(text) {
1237 return text.split(/\r\n|\r|\n/);
1238 };
1239
1240
1241 this.$detectNewLine = function(text) {
1242 var match = text.match(/^.*?(\r\n|\r|\n)/m);
1243 this.$autoNewLine = match ? match[1] : "\n";
1244 };
1245 this.getNewLineCharacter = function() {
1246 switch (this.$newLineMode) {
1247 case "windows":
1248 return "\r\n";
1249 case "unix":
1250 return "\n";
1251 default:
1252 return this.$autoNewLine;
1253 }
1254 };
1255
1256 this.$autoNewLine = "\n";
1257 this.$newLineMode = "auto";
1258 this.setNewLineMode = function(newLineMode) {
1259 if (this.$newLineMode === newLineMode)
1260 return;
1261
1262 this.$newLineMode = newLineMode;
1263 };
1264 this.getNewLineMode = function() {
1265 return this.$newLineMode;
1266 };
1267 this.isNewLine = function(text) {
1268 return (text == "\r\n" || text == "\r" || text == "\n");
1269 };
1270 this.getLine = function(row) {
1271 return this.$lines[row] || "";
1272 };
1273 this.getLines = function(firstRow, lastRow) {
1274 return this.$lines.slice(firstRow, lastRow + 1);
1275 };
1276 this.getAllLines = function() {
1277 return this.getLines(0, this.getLength());
1278 };
1279 this.getLength = function() {
1280 return this.$lines.length;
1281 };
1282 this.getTextRange = function(range) {
1283 if (range.start.row == range.end.row) {
1284 return this.$lines[range.start.row]
1285 .substring(range.start.column, range.end.column);
1286 }
1287 var lines = this.getLines(range.start.row, range.end.row);
1288 lines[0] = (lines[0] || "").substring(range.start.column);
1289 var l = lines.length - 1;
1290 if (range.end.row - range.start.row == l)
1291 lines[l] = lines[l].substring(0, range.end.column);
1292 return lines.join(this.getNewLineCharacter());
1293 };
1294
1295 this.$clipPosition = function(position) {
1296 var length = this.getLength();
1297 if (position.row >= length) {
1298 position.row = Math.max(0, length - 1);
1299 position.column = this.getLine(length-1).length;
1300 } else if (position.row < 0)
1301 position.row = 0;
1302 return position;
1303 };
1304 this.insert = function(position, text) {
1305 if (!text || text.length === 0)
1306 return position;
1307
1308 position = this.$clipPosition(position);
1309 if (this.getLength() <= 1)
1310 this.$detectNewLine(text);
1311
1312 var lines = this.$split(text);
1313 var firstLine = lines.splice(0, 1)[0];
1314 var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
1315
1316 position = this.insertInLine(position, firstLine);
1317 if (lastLine !== null) {
1318 position = this.insertNewLine(position); // terminate first line
1319 position = this._insertLines(position.row, lines);
1320 position = this.insertInLine(position, lastLine || "");
1321 }
1322 return position;
1323 };
1324 this.insertLines = function(row, lines) {
1325 if (row >= this.getLength())
1326 return this.insert({row: row, column: 0}, "\n" + lines.join("\n"));
1327 return this._insertLines(Math.max(row, 0), lines);
1328 };
1329 this._insertLines = function(row, lines) {
1330 if (lines.length == 0)
1331 return {row: row, column: 0};
1332 if (lines.length > 0xFFFF) {
1333 var end = this._insertLines(row, lines.slice(0xFFFF));
1334 lines = lines.slice(0, 0xFFFF);
1335 }
1336
1337 var args = [row, 0];
1338 args.push.apply(args, lines);
1339 this.$lines.splice.apply(this.$lines, args);
1340
1341 var range = new Range(row, 0, row + lines.length, 0);
1342 var delta = {
1343 action: "insertLines",
1344 range: range,
1345 lines: lines
1346 };
1347 this._emit("change", { data: delta });
1348 return end || range.end;
1349 };
1350 this.insertNewLine = function(position) {
1351 position = this.$clipPosition(position);
1352 var line = this.$lines[position.row] || "";
1353
1354 this.$lines[position.row] = line.substring(0, position.column);
1355 this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
1356
1357 var end = {
1358 row : position.row + 1,
1359 column : 0
1360 };
1361
1362 var delta = {
1363 action: "insertText",
1364 range: Range.fromPoints(position, end),
1365 text: this.getNewLineCharacter()
1366 };
1367 this._emit("change", { data: delta });
1368
1369 return end;
1370 };
1371 this.insertInLine = function(position, text) {
1372 if (text.length == 0)
1373 return position;
1374
1375 var line = this.$lines[position.row] || "";
1376
1377 this.$lines[position.row] = line.substring(0, position.column) + text
1378 + line.substring(position.column);
1379
1380 var end = {
1381 row : position.row,
1382 column : position.column + text.length
1383 };
1384
1385 var delta = {
1386 action: "insertText",
1387 range: Range.fromPoints(position, end),
1388 text: text
1389 };
1390 this._emit("change", { data: delta });
1391
1392 return end;
1393 };
1394 this.remove = function(range) {
1395 range.start = this.$clipPosition(range.start);
1396 range.end = this.$clipPosition(range.end);
1397
1398 if (range.isEmpty())
1399 return range.start;
1400
1401 var firstRow = range.start.row;
1402 var lastRow = range.end.row;
1403
1404 if (range.isMultiLine()) {
1405 var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
1406 var lastFullRow = lastRow - 1;
1407
1408 if (range.end.column > 0)
1409 this.removeInLine(lastRow, 0, range.end.column);
1410
1411 if (lastFullRow >= firstFullRow)
1412 this._removeLines(firstFullRow, lastFullRow);
1413
1414 if (firstFullRow != firstRow) {
1415 this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
1416 this.removeNewLine(range.start.row);
1417 }
1418 }
1419 else {
1420 this.removeInLine(firstRow, range.start.column, range.end.column);
1421 }
1422 return range.start;
1423 };
1424 this.removeInLine = function(row, startColumn, endColumn) {
1425 if (startColumn == endColumn)
1426 return;
1427
1428 var range = new Range(row, startColumn, row, endColumn);
1429 var line = this.getLine(row);
1430 var removed = line.substring(startColumn, endColumn);
1431 var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
1432 this.$lines.splice(row, 1, newLine);
1433
1434 var delta = {
1435 action: "removeText",
1436 range: range,
1437 text: removed
1438 };
1439 this._emit("change", { data: delta });
1440 return range.start;
1441 };
1442 this.removeLines = function(firstRow, lastRow) {
1443 if (firstRow < 0 || lastRow >= this.getLength())
1444 return this.remove(new Range(firstRow, 0, lastRow + 1, 0));
1445 return this._removeLines(firstRow, lastRow);
1446 };
1447
1448 this._removeLines = function(firstRow, lastRow) {
1449 var range = new Range(firstRow, 0, lastRow + 1, 0);
1450 var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
1451
1452 var delta = {
1453 action: "removeLines",
1454 range: range,
1455 nl: this.getNewLineCharacter(),
1456 lines: removed
1457 };
1458 this._emit("change", { data: delta });
1459 return removed;
1460 };
1461 this.removeNewLine = function(row) {
1462 var firstLine = this.getLine(row);
1463 var secondLine = this.getLine(row+1);
1464
1465 var range = new Range(row, firstLine.length, row+1, 0);
1466 var line = firstLine + secondLine;
1467
1468 this.$lines.splice(row, 2, line);
1469
1470 var delta = {
1471 action: "removeText",
1472 range: range,
1473 text: this.getNewLineCharacter()
1474 };
1475 this._emit("change", { data: delta });
1476 };
1477 this.replace = function(range, text) {
1478 if (text.length == 0 && range.isEmpty())
1479 return range.start;
1480 if (text == this.getTextRange(range))
1481 return range.end;
1482
1483 this.remove(range);
1484 if (text) {
1485 var end = this.insert(range.start, text);
1486 }
1487 else {
1488 end = range.start;
1489 }
1490
1491 return end;
1492 };
1493 this.applyDeltas = function(deltas) {
1494 for (var i=0; i<deltas.length; i++) {
1495 var delta = deltas[i];
1496 var range = Range.fromPoints(delta.range.start, delta.range.end);
1497
1498 if (delta.action == "insertLines")
1499 this.insertLines(range.start.row, delta.lines);
1500 else if (delta.action == "insertText")
1501 this.insert(range.start, delta.text);
1502 else if (delta.action == "removeLines")
1503 this._removeLines(range.start.row, range.end.row - 1);
1504 else if (delta.action == "removeText")
1505 this.remove(range);
1506 }
1507 };
1508 this.revertDeltas = function(deltas) {
1509 for (var i=deltas.length-1; i>=0; i--) {
1510 var delta = deltas[i];
1511
1512 var range = Range.fromPoints(delta.range.start, delta.range.end);
1513
1514 if (delta.action == "insertLines")
1515 this._removeLines(range.start.row, range.end.row - 1);
1516 else if (delta.action == "insertText")
1517 this.remove(range);
1518 else if (delta.action == "removeLines")
1519 this._insertLines(range.start.row, delta.lines);
1520 else if (delta.action == "removeText")
1521 this.insert(range.start, delta.text);
1522 }
1523 };
1524 this.indexToPosition = function(index, startRow) {
1525 var lines = this.$lines || this.getAllLines();
1526 var newlineLength = this.getNewLineCharacter().length;
1527 for (var i = startRow || 0, l = lines.length; i < l; i++) {
1528 index -= lines[i].length + newlineLength;
1529 if (index < 0)
1530 return {row: i, column: index + lines[i].length + newlineLength};
1531 }
1532 return {row: l-1, column: lines[l-1].length};
1533 };
1534 this.positionToIndex = function(pos, startRow) {
1535 var lines = this.$lines || this.getAllLines();
1536 var newlineLength = this.getNewLineCharacter().length;
1537 var index = 0;
1538 var row = Math.min(pos.row, lines.length);
1539 for (var i = startRow || 0; i < row; ++i)
1540 index += lines[i].length + newlineLength;
1541
1542 return index + pos.column;
1543 };
1544
1545 }).call(Document.prototype);
1546
1547 exports.Document = Document;
1548 });
1549
1550 define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
1551
1552 var comparePoints = function(p1, p2) {
1553 return p1.row - p2.row || p1.column - p2.column;
1554 };
1555 var Range = function(startRow, startColumn, endRow, endColumn) {
1556 this.start = {
1557 row: startRow,
1558 column: startColumn
1559 };
1560
1561 this.end = {
1562 row: endRow,
1563 column: endColumn
1564 };
1565 };
1566
1567 (function() {
1568 this.isEqual = function(range) {
1569 return this.start.row === range.start.row &&
1570 this.end.row === range.end.row &&
1571 this.start.column === range.start.column &&
1572 this.end.column === range.end.column;
1573 };
1574 this.toString = function() {
1575 return ("Range: [" + this.start.row + "/" + this.start.column +
1576 "] -> [" + this.end.row + "/" + this.end.column + "]");
1577 };
1578
1579 this.contains = function(row, column) {
1580 return this.compare(row, column) == 0;
1581 };
1582 this.compareRange = function(range) {
1583 var cmp,
1584 end = range.end,
1585 start = range.start;
1586
1587 cmp = this.compare(end.row, end.column);
1588 if (cmp == 1) {
1589 cmp = this.compare(start.row, start.column);
1590 if (cmp == 1) {
1591 return 2;
1592 } else if (cmp == 0) {
1593 return 1;
1594 } else {
1595 return 0;
1596 }
1597 } else if (cmp == -1) {
1598 return -2;
1599 } else {
1600 cmp = this.compare(start.row, start.column);
1601 if (cmp == -1) {
1602 return -1;
1603 } else if (cmp == 1) {
1604 return 42;
1605 } else {
1606 return 0;
1607 }
1608 }
1609 };
1610 this.comparePoint = function(p) {
1611 return this.compare(p.row, p.column);
1612 };
1613 this.containsRange = function(range) {
1614 return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
1615 };
1616 this.intersects = function(range) {
1617 var cmp = this.compareRange(range);
1618 return (cmp == -1 || cmp == 0 || cmp == 1);
1619 };
1620 this.isEnd = function(row, column) {
1621 return this.end.row == row && this.end.column == column;
1622 };
1623 this.isStart = function(row, column) {
1624 return this.start.row == row && this.start.column == column;
1625 };
1626 this.setStart = function(row, column) {
1627 if (typeof row == "object") {
1628 this.start.column = row.column;
1629 this.start.row = row.row;
1630 } else {
1631 this.start.row = row;
1632 this.start.column = column;
1633 }
1634 };
1635 this.setEnd = function(row, column) {
1636 if (typeof row == "object") {
1637 this.end.column = row.column;
1638 this.end.row = row.row;
1639 } else {
1640 this.end.row = row;
1641 this.end.column = column;
1642 }
1643 };
1644 this.inside = function(row, column) {
1645 if (this.compare(row, column) == 0) {
1646 if (this.isEnd(row, column) || this.isStart(row, column)) {
1647 return false;
1648 } else {
1649 return true;
1650 }
1651 }
1652 return false;
1653 };
1654 this.insideStart = function(row, column) {
1655 if (this.compare(row, column) == 0) {
1656 if (this.isEnd(row, column)) {
1657 return false;
1658 } else {
1659 return true;
1660 }
1661 }
1662 return false;
1663 };
1664 this.insideEnd = function(row, column) {
1665 if (this.compare(row, column) == 0) {
1666 if (this.isStart(row, column)) {
1667 return false;
1668 } else {
1669 return true;
1670 }
1671 }
1672 return false;
1673 };
1674 this.compare = function(row, column) {
1675 if (!this.isMultiLine()) {
1676 if (row === this.start.row) {
1677 return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
1678 };
1679 }
1680
1681 if (row < this.start.row)
1682 return -1;
1683
1684 if (row > this.end.row)
1685 return 1;
1686
1687 if (this.start.row === row)
1688 return column >= this.start.column ? 0 : -1;
1689
1690 if (this.end.row === row)
1691 return column <= this.end.column ? 0 : 1;
1692
1693 return 0;
1694 };
1695 this.compareStart = function(row, column) {
1696 if (this.start.row == row && this.start.column == column) {
1697 return -1;
1698 } else {
1699 return this.compare(row, column);
1700 }
1701 };
1702 this.compareEnd = function(row, column) {
1703 if (this.end.row == row && this.end.column == column) {
1704 return 1;
1705 } else {
1706 return this.compare(row, column);
1707 }
1708 };
1709 this.compareInside = function(row, column) {
1710 if (this.end.row == row && this.end.column == column) {
1711 return 1;
1712 } else if (this.start.row == row && this.start.column == column) {
1713 return -1;
1714 } else {
1715 return this.compare(row, column);
1716 }
1717 };
1718 this.clipRows = function(firstRow, lastRow) {
1719 if (this.end.row > lastRow)
1720 var end = {row: lastRow + 1, column: 0};
1721 else if (this.end.row < firstRow)
1722 var end = {row: firstRow, column: 0};
1723
1724 if (this.start.row > lastRow)
1725 var start = {row: lastRow + 1, column: 0};
1726 else if (this.start.row < firstRow)
1727 var start = {row: firstRow, column: 0};
1728
1729 return Range.fromPoints(start || this.start, end || this.end);
1730 };
1731 this.extend = function(row, column) {
1732 var cmp = this.compare(row, column);
1733
1734 if (cmp == 0)
1735 return this;
1736 else if (cmp == -1)
1737 var start = {row: row, column: column};
1738 else
1739 var end = {row: row, column: column};
1740
1741 return Range.fromPoints(start || this.start, end || this.end);
1742 };
1743
1744 this.isEmpty = function() {
1745 return (this.start.row === this.end.row && this.start.column === this.end.column);
1746 };
1747 this.isMultiLine = function() {
1748 return (this.start.row !== this.end.row);
1749 };
1750 this.clone = function() {
1751 return Range.fromPoints(this.start, this.end);
1752 };
1753 this.collapseRows = function() {
1754 if (this.end.column == 0)
1755 return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
1756 else
1757 return new Range(this.start.row, 0, this.end.row, 0)
1758 };
1759 this.toScreenRange = function(session) {
1760 var screenPosStart = session.documentToScreenPosition(this.start);
1761 var screenPosEnd = session.documentToScreenPosition(this.end);
1762
1763 return new Range(
1764 screenPosStart.row, screenPosStart.column,
1765 screenPosEnd.row, screenPosEnd.column
1766 );
1767 };
1768 this.moveBy = function(row, column) {
1769 this.start.row += row;
1770 this.start.column += column;
1771 this.end.row += row;
1772 this.end.column += column;
1773 };
1774
1775 }).call(Range.prototype);
1776 Range.fromPoints = function(start, end) {
1777 return new Range(start.row, start.column, end.row, end.column);
1778 };
1779 Range.comparePoints = comparePoints;
1780
1781 Range.comparePoints = function(p1, p2) {
1782 return p1.row - p2.row || p1.column - p2.column;
1783 };
1784
1785
1786 exports.Range = Range;
1787 });
1788
1789 define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
1790
1791
1792 var oop = require("./lib/oop");
1793 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1794
1795 var Anchor = exports.Anchor = function(doc, row, column) {
1796 this.document = doc;
1797
1798 if (typeof column == "undefined")
1799 this.setPosition(row.row, row.column);
1800 else
1801 this.setPosition(row, column);
1802
1803 this.$onChange = this.onChange.bind(this);
1804 doc.on("change", this.$onChange);
1805 };
1806
1807 (function() {
1808
1809 oop.implement(this, EventEmitter);
1810
1811 this.getPosition = function() {
1812 return this.$clipPositionToDocument(this.row, this.column);
1813 };
1814
1815 this.getDocument = function() {
1816 return this.document;
1817 };
1818
1819 this.onChange = function(e) {
1820 var delta = e.data;
1821 var range = delta.range;
1822
1823 if (range.start.row == range.end.row && range.start.row != this.row)
1824 return;
1825
1826 if (range.start.row > this.row)
1827 return;
1828
1829 if (range.start.row == this.row && range.start.column > this.column)
1830 return;
1831
1832 var row = this.row;
1833 var column = this.column;
1834 var start = range.start;
1835 var end = range.end;
1836
1837 if (delta.action === "insertText") {
1838 if (start.row === row && start.column <= column) {
1839 if (start.row === end.row) {
1840 column += end.column - start.column;
1841 } else {
1842 column -= start.column;
1843 row += end.row - start.row;
1844 }
1845 } else if (start.row !== end.row && start.row < row) {
1846 row += end.row - start.row;
1847 }
1848 } else if (delta.action === "insertLines") {
1849 if (start.row <= row) {
1850 row += end.row - start.row;
1851 }
1852 } else if (delta.action === "removeText") {
1853 if (start.row === row && start.column < column) {
1854 if (end.column >= column)
1855 column = start.column;
1856 else
1857 column = Math.max(0, column - (end.column - start.column));
1858
1859 } else if (start.row !== end.row && start.row < row) {
1860 if (end.row === row)
1861 column = Math.max(0, column - end.column) + start.column;
1862 row -= (end.row - start.row);
1863 } else if (end.row === row) {
1864 row -= end.row - start.row;
1865 column = Math.max(0, column - end.column) + start.column;
1866 }
1867 } else if (delta.action == "removeLines") {
1868 if (start.row <= row) {
1869 if (end.row <= row)
1870 row -= end.row - start.row;
1871 else {
1872 row = start.row;
1873 column = 0;
1874 }
1875 }
1876 }
1877
1878 this.setPosition(row, column, true);
1879 };
1880
1881 this.setPosition = function(row, column, noClip) {
1882 var pos;
1883 if (noClip) {
1884 pos = {
1885 row: row,
1886 column: column
1887 };
1888 } else {
1889 pos = this.$clipPositionToDocument(row, column);
1890 }
1891
1892 if (this.row == pos.row && this.column == pos.column)
1893 return;
1894
1895 var old = {
1896 row: this.row,
1897 column: this.column
1898 };
1899
1900 this.row = pos.row;
1901 this.column = pos.column;
1902 this._emit("change", {
1903 old: old,
1904 value: pos
1905 });
1906 };
1907
1908 this.detach = function() {
1909 this.document.removeEventListener("change", this.$onChange);
1910 };
1911 this.$clipPositionToDocument = function(row, column) {
1912 var pos = {};
1913
1914 if (row >= this.document.getLength()) {
1915 pos.row = Math.max(0, this.document.getLength() - 1);
1916 pos.column = this.document.getLine(pos.row).length;
1917 }
1918 else if (row < 0) {
1919 pos.row = 0;
1920 pos.column = 0;
1921 }
1922 else {
1923 pos.row = row;
1924 pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
1925 }
1926
1927 if (column < 0)
1928 pos.column = 0;
1929
1930 return pos;
1931 };
1932
1933 }).call(Anchor.prototype);
1934
1935 });
1936
1937 define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
1938
1939
1940 exports.stringReverse = function(string) {
1941 return string.split("").reverse().join("");
1942 };
1943
1944 exports.stringRepeat = function (string, count) {
1945 var result = '';
1946 while (count > 0) {
1947 if (count & 1)
1948 result += string;
1949
1950 if (count >>= 1)
1951 string += string;
1952 }
1953 return result;
1954 };
1955
1956 var trimBeginRegexp = /^\s\s*/;
1957 var trimEndRegexp = /\s\s*$/;
1958
1959 exports.stringTrimLeft = function (string) {
1960 return string.replace(trimBeginRegexp, '');
1961 };
1962
1963 exports.stringTrimRight = function (string) {
1964 return string.replace(trimEndRegexp, '');
1965 };
1966
1967 exports.copyObject = function(obj) {
1968 var copy = {};
1969 for (var key in obj) {
1970 copy[key] = obj[key];
1971 }
1972 return copy;
1973 };
1974
1975 exports.copyArray = function(array){
1976 var copy = [];
1977 for (var i=0, l=array.length; i<l; i++) {
1978 if (array[i] && typeof array[i] == "object")
1979 copy[i] = this.copyObject( array[i] );
1980 else
1981 copy[i] = array[i];
1982 }
1983 return copy;
1984 };
1985
1986 exports.deepCopy = function (obj) {
1987 if (typeof obj != "object") {
1988 return obj;
1989 }
1990
1991 var copy = obj.constructor();
1992 for (var key in obj) {
1993 if (typeof obj[key] == "object") {
1994 copy[key] = this.deepCopy(obj[key]);
1995 } else {
1996 copy[key] = obj[key];
1997 }
1998 }
1999 return copy;
2000 };
2001
2002 exports.arrayToMap = function(arr) {
2003 var map = {};
2004 for (var i=0; i<arr.length; i++) {
2005 map[arr[i]] = 1;
2006 }
2007 return map;
2008
2009 };
2010
2011 exports.createMap = function(props) {
2012 var map = Object.create(null);
2013 for (var i in props) {
2014 map[i] = props[i];
2015 }
2016 return map;
2017 };
2018 exports.arrayRemove = function(array, value) {
2019 for (var i = 0; i <= array.length; i++) {
2020 if (value === array[i]) {
2021 array.splice(i, 1);
2022 }
2023 }
2024 };
2025
2026 exports.escapeRegExp = function(str) {
2027 return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
2028 };
2029
2030 exports.escapeHTML = function(str) {
2031 return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
2032 };
2033
2034 exports.getMatchOffsets = function(string, regExp) {
2035 var matches = [];
2036
2037 string.replace(regExp, function(str) {
2038 matches.push({
2039 offset: arguments[arguments.length-2],
2040 length: str.length
2041 });
2042 });
2043
2044 return matches;
2045 };
2046 exports.deferredCall = function(fcn) {
2047
2048 var timer = null;
2049 var callback = function() {
2050 timer = null;
2051 fcn();
2052 };
2053
2054 var deferred = function(timeout) {
2055 deferred.cancel();
2056 timer = setTimeout(callback, timeout || 0);
2057 return deferred;
2058 };
2059
2060 deferred.schedule = deferred;
2061
2062 deferred.call = function() {
2063 this.cancel();
2064 fcn();
2065 return deferred;
2066 };
2067
2068 deferred.cancel = function() {
2069 clearTimeout(timer);
2070 timer = null;
2071 return deferred;
2072 };
2073
2074 return deferred;
2075 };
2076
2077
2078 exports.delayedCall = function(fcn, defaultTimeout) {
2079 var timer = null;
2080 var callback = function() {
2081 timer = null;
2082 fcn();
2083 };
2084
2085 var _self = function(timeout) {
2086 timer && clearTimeout(timer);
2087 timer = setTimeout(callback, timeout || defaultTimeout);
2088 };
2089
2090 _self.delay = _self;
2091 _self.schedule = function(timeout) {
2092 if (timer == null)
2093 timer = setTimeout(callback, timeout || 0);
2094 };
2095
2096 _self.call = function() {
2097 this.cancel();
2098 fcn();
2099 };
2100
2101 _self.cancel = function() {
2102 timer && clearTimeout(timer);
2103 timer = null;
2104 };
2105
2106 _self.isPending = function() {
2107 return timer;
2108 };
2109
2110 return _self;
2111 };
2112 });
2113 define('ace/mode/javascript/jshint', ['require', 'exports', 'module' ], function(require, exports, module) {
2114
2115 var JSHINT = (function () {
2116
2117
2118 var anonname, // The guessed name for anonymous functions.
2119
2120 bang = {
2121 "<" : true,
2122 "<=" : true,
2123 "==" : true,
2124 "===": true,
2125 "!==": true,
2126 "!=" : true,
2127 ">" : true,
2128 ">=" : true,
2129 "+" : true,
2130 "-" : true,
2131 "*" : true,
2132 "/" : true,
2133 "%" : true
2134 },
2135 boolOptions = {
2136 asi : true, // if automatic semicolon insertion should be tolerated
2137 bitwise : true, // if bitwise operators should not be allowed
2138 boss : true, // if advanced usage of assignments should be allowed
2139 browser : true, // if the standard browser globals should be predefined
2140 camelcase : true, // if identifiers should be required in camel case
2141 couch : true, // if CouchDB globals should be predefined
2142 curly : true, // if curly braces around all blocks should be required
2143 debug : true, // if debugger statements should be allowed
2144 devel : true, // if logging globals should be predefined (console,
2145 dojo : true, // if Dojo Toolkit globals should be predefined
2146 eqeqeq : true, // if === should be required
2147 eqnull : true, // if == null comparisons should be tolerated
2148 es5 : true, // if ES5 syntax should be allowed
2149 esnext : true, // if es.next specific syntax should be allowed
2150 evil : true, // if eval should be allowed
2151 expr : true, // if ExpressionStatement should be allowed as Programs
2152 forin : true, // if for in statements must filter
2153 funcscope : true, // if only function scope should be used for scope tests
2154 globalstrict: true, // if global should be allowed (also
2155 immed : true, // if immediate invocations must be wrapped in parens
2156 iterator : true, // if the `__iterator__` property should be allowed
2157 jquery : true, // if jQuery globals should be predefined
2158 lastsemic : true, // if semicolons may be ommitted for the trailing
2159 latedef : true, // if the use before definition should not be tolerated
2160 laxbreak : true, // if line breaks should not be checked
2161 laxcomma : true, // if line breaks should not be checked around commas
2162 loopfunc : true, // if functions should be allowed to be defined within
2163 mootools : true, // if MooTools globals should be predefined
2164 multistr : true, // allow multiline strings
2165 newcap : true, // if constructor names must be capitalized
2166 noarg : true, // if arguments.caller and arguments.callee should be
2167 node : true, // if the Node.js environment globals should be
2168 noempty : true, // if empty blocks should be disallowed
2169 nonew : true, // if using `new` for side-effects should be disallowed
2170 nonstandard : true, // if non-standard (but widely adopted) globals should
2171 nomen : true, // if names should be checked
2172 onevar : true, // if only one var statement per function should be
2173 onecase : true, // if one case switch statements should be allowed
2174 passfail : true, // if the scan should stop on first error
2175 plusplus : true, // if increment/decrement should not be allowed
2176 proto : true, // if the `__proto__` property should be allowed
2177 prototypejs : true, // if Prototype and Scriptaculous globals should be
2178 regexdash : true, // if unescaped first/last dash (-) inside brackets
2179 regexp : true, // if the . should not be allowed in regexp literals
2180 rhino : true, // if the Rhino environment globals should be predefined
2181 undef : true, // if variables should be declared before used
2182 unused : true, // if variables should be always used
2183 scripturl : true, // if script-targeted URLs should be tolerated
2184 shadow : true, // if variable shadowing should be tolerated
2185 smarttabs : true, // if smarttabs should be tolerated
2186 strict : true, // require the pragma
2187 sub : true, // if all forms of subscript notation are tolerated
2188 supernew : true, // if `new function () { ... };` and `new Object;`
2189 trailing : true, // if trailing whitespace rules apply
2190 validthis : true, // if 'this' inside a non-constructor function is valid.
2191 withstmt : true, // if with statements should be allowed
2192 white : true, // if strict whitespace rules apply
2193 worker : true, // if Web Worker script symbols should be allowed
2194 wsh : true, // if the Windows Scripting Host environment globals
2195 yui : true // YUI variables should be predefined
2196 },
2197 valOptions = {
2198 maxlen : false,
2199 indent : false,
2200 maxerr : false,
2201 predef : false,
2202 quotmark : false, //'single'|'double'|true
2203 scope : false,
2204 maxstatements: false, // {int} max statements per function
2205 maxdepth : false, // {int} max nested block depth per function
2206 maxparams : false, // {int} max params per function
2207 maxcomplexity: false // {int} max cyclomatic complexity per function
2208 },
2209 invertedOptions = {
2210 bitwise : true,
2211 forin : true,
2212 newcap : true,
2213 nomen : true,
2214 plusplus : true,
2215 regexp : true,
2216 undef : true,
2217 white : true,
2218 eqeqeq : true,
2219 onevar : true
2220 },
2221 renamedOptions = {
2222 eqeq : "eqeqeq",
2223 vars : "onevar",
2224 windows : "wsh"
2225 },
2226 browser = {
2227 ArrayBuffer : false,
2228 ArrayBufferView : false,
2229 Audio : false,
2230 Blob : false,
2231 addEventListener : false,
2232 applicationCache : false,
2233 atob : false,
2234 blur : false,
2235 btoa : false,
2236 clearInterval : false,
2237 clearTimeout : false,
2238 close : false,
2239 closed : false,
2240 DataView : false,
2241 DOMParser : false,
2242 defaultStatus : false,
2243 document : false,
2244 event : false,
2245 FileReader : false,
2246 Float32Array : false,
2247 Float64Array : false,
2248 FormData : false,
2249 focus : false,
2250 frames : false,
2251 getComputedStyle : false,
2252 HTMLElement : false,
2253 HTMLAnchorElement : false,
2254 HTMLBaseElement : false,
2255 HTMLBlockquoteElement : false,
2256 HTMLBodyElement : false,
2257 HTMLBRElement : false,
2258 HTMLButtonElement : false,
2259 HTMLCanvasElement : false,
2260 HTMLDirectoryElement : false,
2261 HTMLDivElement : false,
2262 HTMLDListElement : false,
2263 HTMLFieldSetElement : false,
2264 HTMLFontElement : false,
2265 HTMLFormElement : false,
2266 HTMLFrameElement : false,
2267 HTMLFrameSetElement : false,
2268 HTMLHeadElement : false,
2269 HTMLHeadingElement : false,
2270 HTMLHRElement : false,
2271 HTMLHtmlElement : false,
2272 HTMLIFrameElement : false,
2273 HTMLImageElement : false,
2274 HTMLInputElement : false,
2275 HTMLIsIndexElement : false,
2276 HTMLLabelElement : false,
2277 HTMLLayerElement : false,
2278 HTMLLegendElement : false,
2279 HTMLLIElement : false,
2280 HTMLLinkElement : false,
2281 HTMLMapElement : false,
2282 HTMLMenuElement : false,
2283 HTMLMetaElement : false,
2284 HTMLModElement : false,
2285 HTMLObjectElement : false,
2286 HTMLOListElement : false,
2287 HTMLOptGroupElement : false,
2288 HTMLOptionElement : false,
2289 HTMLParagraphElement : false,
2290 HTMLParamElement : false,
2291 HTMLPreElement : false,
2292 HTMLQuoteElement : false,
2293 HTMLScriptElement : false,
2294 HTMLSelectElement : false,
2295 HTMLStyleElement : false,
2296 HTMLTableCaptionElement : false,
2297 HTMLTableCellElement : false,
2298 HTMLTableColElement : false,
2299 HTMLTableElement : false,
2300 HTMLTableRowElement : false,
2301 HTMLTableSectionElement : false,
2302 HTMLTextAreaElement : false,
2303 HTMLTitleElement : false,
2304 HTMLUListElement : false,
2305 HTMLVideoElement : false,
2306 history : false,
2307 Int16Array : false,
2308 Int32Array : false,
2309 Int8Array : false,
2310 Image : false,
2311 length : false,
2312 localStorage : false,
2313 location : false,
2314 MessageChannel : false,
2315 MessageEvent : false,
2316 MessagePort : false,
2317 moveBy : false,
2318 moveTo : false,
2319 MutationObserver : false,
2320 name : false,
2321 Node : false,
2322 NodeFilter : false,
2323 navigator : false,
2324 onbeforeunload : true,
2325 onblur : true,
2326 onerror : true,
2327 onfocus : true,
2328 onload : true,
2329 onresize : true,
2330 onunload : true,
2331 open : false,
2332 openDatabase : false,
2333 opener : false,
2334 Option : false,
2335 parent : false,
2336 print : false,
2337 removeEventListener : false,
2338 resizeBy : false,
2339 resizeTo : false,
2340 screen : false,
2341 scroll : false,
2342 scrollBy : false,
2343 scrollTo : false,
2344 sessionStorage : false,
2345 setInterval : false,
2346 setTimeout : false,
2347 SharedWorker : false,
2348 status : false,
2349 top : false,
2350 Uint16Array : false,
2351 Uint32Array : false,
2352 Uint8Array : false,
2353 WebSocket : false,
2354 window : false,
2355 Worker : false,
2356 XMLHttpRequest : false,
2357 XMLSerializer : false,
2358 XPathEvaluator : false,
2359 XPathException : false,
2360 XPathExpression : false,
2361 XPathNamespace : false,
2362 XPathNSResolver : false,
2363 XPathResult : false
2364 },
2365
2366 couch = {
2367 "require" : false,
2368 respond : false,
2369 getRow : false,
2370 emit : false,
2371 send : false,
2372 start : false,
2373 sum : false,
2374 log : false,
2375 exports : false,
2376 module : false,
2377 provides : false
2378 },
2379
2380 declared, // Globals that were declared using /*global ... */ syntax.
2381
2382 devel = {
2383 alert : false,
2384 confirm : false,
2385 console : false,
2386 Debug : false,
2387 opera : false,
2388 prompt : false
2389 },
2390
2391 dojo = {
2392 dojo : false,
2393 dijit : false,
2394 dojox : false,
2395 define : false,
2396 "require" : false
2397 },
2398
2399 funct, // The current function
2400
2401 functionicity = [
2402 "closure", "exception", "global", "label",
2403 "outer", "unused", "var"
2404 ],
2405
2406 functions, // All of the functions
2407
2408 global, // The global scope
2409 implied, // Implied globals
2410 inblock,
2411 indent,
2412 jsonmode,
2413
2414 jquery = {
2415 "$" : false,
2416 jQuery : false
2417 },
2418
2419 lines,
2420 lookahead,
2421 member,
2422 membersOnly,
2423
2424 mootools = {
2425 "$" : false,
2426 "$$" : false,
2427 Asset : false,
2428 Browser : false,
2429 Chain : false,
2430 Class : false,
2431 Color : false,
2432 Cookie : false,
2433 Core : false,
2434 Document : false,
2435 DomReady : false,
2436 DOMEvent : false,
2437 DOMReady : false,
2438 Drag : false,
2439 Element : false,
2440 Elements : false,
2441 Event : false,
2442 Events : false,
2443 Fx : false,
2444 Group : false,
2445 Hash : false,
2446 HtmlTable : false,
2447 Iframe : false,
2448 IframeShim : false,
2449 InputValidator : false,
2450 instanceOf : false,
2451 Keyboard : false,
2452 Locale : false,
2453 Mask : false,
2454 MooTools : false,
2455 Native : false,
2456 Options : false,
2457 OverText : false,
2458 Request : false,
2459 Scroller : false,
2460 Slick : false,
2461 Slider : false,
2462 Sortables : false,
2463 Spinner : false,
2464 Swiff : false,
2465 Tips : false,
2466 Type : false,
2467 typeOf : false,
2468 URI : false,
2469 Window : false
2470 },
2471
2472 nexttoken,
2473
2474 node = {
2475 __filename : false,
2476 __dirname : false,
2477 Buffer : false,
2478 console : false,
2479 exports : true, // In Node it is ok to exports = module.exports = foo();
2480 GLOBAL : false,
2481 global : false,
2482 module : false,
2483 process : false,
2484 require : false,
2485 setTimeout : false,
2486 clearTimeout : false,
2487 setInterval : false,
2488 clearInterval : false
2489 },
2490
2491 noreach,
2492 option,
2493 predefined, // Global variables defined by option
2494 prereg,
2495 prevtoken,
2496
2497 prototypejs = {
2498 "$" : false,
2499 "$$" : false,
2500 "$A" : false,
2501 "$F" : false,
2502 "$H" : false,
2503 "$R" : false,
2504 "$break" : false,
2505 "$continue" : false,
2506 "$w" : false,
2507 Abstract : false,
2508 Ajax : false,
2509 Class : false,
2510 Enumerable : false,
2511 Element : false,
2512 Event : false,
2513 Field : false,
2514 Form : false,
2515 Hash : false,
2516 Insertion : false,
2517 ObjectRange : false,
2518 PeriodicalExecuter: false,
2519 Position : false,
2520 Prototype : false,
2521 Selector : false,
2522 Template : false,
2523 Toggle : false,
2524 Try : false,
2525 Autocompleter : false,
2526 Builder : false,
2527 Control : false,
2528 Draggable : false,
2529 Draggables : false,
2530 Droppables : false,
2531 Effect : false,
2532 Sortable : false,
2533 SortableObserver : false,
2534 Sound : false,
2535 Scriptaculous : false
2536 },
2537
2538 quotmark,
2539
2540 rhino = {
2541 defineClass : false,
2542 deserialize : false,
2543 gc : false,
2544 help : false,
2545 importPackage: false,
2546 "java" : false,
2547 load : false,
2548 loadClass : false,
2549 print : false,
2550 quit : false,
2551 readFile : false,
2552 readUrl : false,
2553 runCommand : false,
2554 seal : false,
2555 serialize : false,
2556 spawn : false,
2557 sync : false,
2558 toint32 : false,
2559 version : false
2560 },
2561
2562 scope, // The current scope
2563 stack,
2564 standard = {
2565 Array : false,
2566 Boolean : false,
2567 Date : false,
2568 decodeURI : false,
2569 decodeURIComponent : false,
2570 encodeURI : false,
2571 encodeURIComponent : false,
2572 Error : false,
2573 "eval" : false,
2574 EvalError : false,
2575 Function : false,
2576 hasOwnProperty : false,
2577 isFinite : false,
2578 isNaN : false,
2579 JSON : false,
2580 Map : false,
2581 Math : false,
2582 NaN : false,
2583 Number : false,
2584 Object : false,
2585 parseInt : false,
2586 parseFloat : false,
2587 RangeError : false,
2588 ReferenceError : false,
2589 RegExp : false,
2590 Set : false,
2591 String : false,
2592 SyntaxError : false,
2593 TypeError : false,
2594 URIError : false,
2595 WeakMap : false
2596 },
2597 nonstandard = {
2598 escape : false,
2599 unescape : false
2600 },
2601
2602 directive,
2603 syntax = {},
2604 tab,
2605 token,
2606 unuseds,
2607 urls,
2608 useESNextSyntax,
2609 warnings,
2610
2611 worker = {
2612 importScripts : true,
2613 postMessage : true,
2614 self : true
2615 },
2616
2617 wsh = {
2618 ActiveXObject : true,
2619 Enumerator : true,
2620 GetObject : true,
2621 ScriptEngine : true,
2622 ScriptEngineBuildVersion : true,
2623 ScriptEngineMajorVersion : true,
2624 ScriptEngineMinorVersion : true,
2625 VBArray : true,
2626 WSH : true,
2627 WScript : true,
2628 XDomainRequest : true
2629 },
2630
2631 yui = {
2632 YUI : false,
2633 Y : false,
2634 YUI_config : false
2635 };
2636 var ax, cx, tx, nx, nxg, lx, ix, jx, ft;
2637 (function () {
2638 ax = /@cc|<\/?|script|\]\s*\]|<\s*!|&lt/i;
2639 cx = /[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
2640 tx = /^\s*([(){}\[.,:;'"~\?\]#@]|==?=?|\/=(?!(\S*\/[gim]?))|\/(\*(jshint|jslint|members?|global)?|\/)?|\*[\/=]?|\+(?:=|\++)?|-(?:=|-+)?|%=?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/;
2641 nx = /[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
2642 nxg = /[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
2643 lx = /\*\//;
2644 ix = /^([a-zA-Z_$][a-zA-Z0-9_$]*)$/;
2645 jx = /^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i;
2646 ft = /^\s*\/\*\s*falls\sthrough\s*\*\/\s*$/;
2647 }());
2648
2649 function F() {} // Used by Object.create
2650
2651 function is_own(object, name) {
2652 return Object.prototype.hasOwnProperty.call(object, name);
2653 }
2654
2655 function checkOption(name, t) {
2656 if (valOptions[name] === undefined && boolOptions[name] === undefined) {
2657 warning("Bad option: '" + name + "'.", t);
2658 }
2659 }
2660
2661 function isString(obj) {
2662 return Object.prototype.toString.call(obj) === "[object String]";
2663 }
2664
2665 if (typeof Array.isArray !== "function") {
2666 Array.isArray = function (o) {
2667 return Object.prototype.toString.apply(o) === "[object Array]";
2668 };
2669 }
2670
2671 if (!Array.prototype.forEach) {
2672 Array.prototype.forEach = function (fn, scope) {
2673 var len = this.length;
2674
2675 for (var i = 0; i < len; i++) {
2676 fn.call(scope || this, this[i], i, this);
2677 }
2678 };
2679 }
2680
2681 if (!Array.prototype.indexOf) {
2682 Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
2683 if (this === null || this === undefined) {
2684 throw new TypeError();
2685 }
2686
2687 var t = new Object(this);
2688 var len = t.length >>> 0;
2689
2690 if (len === 0) {
2691 return -1;
2692 }
2693
2694 var n = 0;
2695 if (arguments.length > 0) {
2696 n = Number(arguments[1]);
2697 if (n != n) { // shortcut for verifying if it's NaN
2698 n = 0;
2699 } else if (n !== 0 && n != Infinity && n != -Infinity) {
2700 n = (n > 0 || -1) * Math.floor(Math.abs(n));
2701 }
2702 }
2703
2704 if (n >= len) {
2705 return -1;
2706 }
2707
2708 var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
2709 for (; k < len; k++) {
2710 if (k in t && t[k] === searchElement) {
2711 return k;
2712 }
2713 }
2714
2715 return -1;
2716 };
2717 }
2718
2719 if (typeof Object.create !== "function") {
2720 Object.create = function (o) {
2721 F.prototype = o;
2722 return new F();
2723 };
2724 }
2725
2726 if (typeof Object.keys !== "function") {
2727 Object.keys = function (o) {
2728 var a = [], k;
2729 for (k in o) {
2730 if (is_own(o, k)) {
2731 a.push(k);
2732 }
2733 }
2734 return a;
2735 };
2736 }
2737
2738 function isAlpha(str) {
2739 return (str >= "a" && str <= "z\uffff") ||
2740 (str >= "A" && str <= "Z\uffff");
2741 }
2742
2743 function isDigit(str) {
2744 return (str >= "0" && str <= "9");
2745 }
2746
2747 function isIdentifier(token, value) {
2748 if (!token)
2749 return false;
2750
2751 if (!token.identifier || token.value !== value)
2752 return false;
2753
2754 return true;
2755 }
2756
2757 function supplant(str, data) {
2758 return str.replace(/\{([^{}]*)\}/g, function (a, b) {
2759 var r = data[b];
2760 return typeof r === "string" || typeof r === "number" ? r : a;
2761 });
2762 }
2763
2764 function combine(t, o) {
2765 var n;
2766 for (n in o) {
2767 if (is_own(o, n) && !is_own(JSHINT.blacklist, n)) {
2768 t[n] = o[n];
2769 }
2770 }
2771 }
2772
2773 function updatePredefined() {
2774 Object.keys(JSHINT.blacklist).forEach(function (key) {
2775 delete predefined[key];
2776 });
2777 }
2778
2779 function assume() {
2780 if (option.couch) {
2781 combine(predefined, couch);
2782 }
2783
2784 if (option.rhino) {
2785 combine(predefined, rhino);
2786 }
2787
2788 if (option.prototypejs) {
2789 combine(predefined, prototypejs);
2790 }
2791
2792 if (option.node) {
2793 combine(predefined, node);
2794 option.globalstrict = true;
2795 }
2796
2797 if (option.devel) {
2798 combine(predefined, devel);
2799 }
2800
2801 if (option.dojo) {
2802 combine(predefined, dojo);
2803 }
2804
2805 if (option.browser) {
2806 combine(predefined, browser);
2807 }
2808
2809 if (option.nonstandard) {
2810 combine(predefined, nonstandard);
2811 }
2812
2813 if (option.jquery) {
2814 combine(predefined, jquery);
2815 }
2816
2817 if (option.mootools) {
2818 combine(predefined, mootools);
2819 }
2820
2821 if (option.worker) {
2822 combine(predefined, worker);
2823 }
2824
2825 if (option.wsh) {
2826 combine(predefined, wsh);
2827 }
2828
2829 if (option.esnext) {
2830 useESNextSyntax();
2831 }
2832
2833 if (option.globalstrict && option.strict !== false) {
2834 option.strict = true;
2835 }
2836
2837 if (option.yui) {
2838 combine(predefined, yui);
2839 }
2840 }
2841 function quit(message, line, chr) {
2842 var percentage = Math.floor((line / lines.length) * 100);
2843
2844 throw {
2845 name: "JSHintError",
2846 line: line,
2847 character: chr,
2848 message: message + " (" + percentage + "% scanned).",
2849 raw: message
2850 };
2851 }
2852
2853 function isundef(scope, m, t, a) {
2854 return JSHINT.undefs.push([scope, m, t, a]);
2855 }
2856
2857 function warning(m, t, a, b, c, d) {
2858 var ch, l, w;
2859 t = t || nexttoken;
2860 if (t.id === "(end)") { // `~
2861 t = token;
2862 }
2863 l = t.line || 0;
2864 ch = t.from || 0;
2865 w = {
2866 id: "(error)",
2867 raw: m,
2868 evidence: lines[l - 1] || "",
2869 line: l,
2870 character: ch,
2871 scope: JSHINT.scope,
2872 a: a,
2873 b: b,
2874 c: c,
2875 d: d
2876 };
2877 w.reason = supplant(m, w);
2878 JSHINT.errors.push(w);
2879 if (option.passfail) {
2880 quit("Stopping. ", l, ch);
2881 }
2882 warnings += 1;
2883 if (warnings >= option.maxerr) {
2884 quit("Too many errors.", l, ch);
2885 }
2886 return w;
2887 }
2888
2889 function warningAt(m, l, ch, a, b, c, d) {
2890 return warning(m, {
2891 line: l,
2892 from: ch
2893 }, a, b, c, d);
2894 }
2895
2896 function error(m, t, a, b, c, d) {
2897 warning(m, t, a, b, c, d);
2898 }
2899
2900 function errorAt(m, l, ch, a, b, c, d) {
2901 return error(m, {
2902 line: l,
2903 from: ch
2904 }, a, b, c, d);
2905 }
2906 function addInternalSrc(elem, src) {
2907 var i;
2908 i = {
2909 id: "(internal)",
2910 elem: elem,
2911 value: src
2912 };
2913 JSHINT.internals.push(i);
2914 return i;
2915 }
2916
2917 var lex = (function lex() {
2918 var character, from, line, s;
2919
2920 function nextLine() {
2921 var at,
2922 match,
2923 tw; // trailing whitespace check
2924
2925 if (line >= lines.length)
2926 return false;
2927
2928 character = 1;
2929 s = lines[line];
2930 line += 1;
2931 if (option.smarttabs) {
2932 match = s.match(/(\/\/)? \t/);
2933 at = match && !match[1] ? 0 : -1;
2934 } else {
2935 at = s.search(/ \t|\t [^\*]/);
2936 }
2937
2938 if (at >= 0)
2939 warningAt("Mixed spaces and tabs.", line, at + 1);
2940
2941 s = s.replace(/\t/g, tab);
2942 at = s.search(cx);
2943
2944 if (at >= 0)
2945 warningAt("Unsafe character.", line, at);
2946
2947 if (option.maxlen && option.maxlen < s.length)
2948 warningAt("Line too long.", line, s.length);
2949 tw = option.trailing && s.match(/^(.*?)\s+$/);
2950 if (tw && !/^\s+$/.test(s)) {
2951 warningAt("Trailing whitespace.", line, tw[1].length + 1);
2952 }
2953 return true;
2954 }
2955
2956 function it(type, value) {
2957 var i, t;
2958
2959 function checkName(name) {
2960 if (!option.proto && name === "__proto__") {
2961 warningAt("The '{a}' property is deprecated.", line, from, name);
2962 return;
2963 }
2964
2965 if (!option.iterator && name === "__iterator__") {
2966 warningAt("'{a}' is only available in JavaScript 1.7.", line, from, name);
2967 return;
2968 }
2969
2970 var hasDangling = /^(_+.*|.*_+)$/.test(name);
2971
2972 if (option.nomen && hasDangling && name !== "_") {
2973 if (option.node && token.id !== "." && /^(__dirname|__filename)$/.test(name))
2974 return;
2975
2976 warningAt("Unexpected {a} in '{b}'.", line, from, "dangling '_'", name);
2977 return;
2978 }
2979
2980 if (option.camelcase) {
2981 if (name.replace(/^_+/, "").indexOf("_") > -1 && !name.match(/^[A-Z0-9_]*$/)) {
2982 warningAt("Identifier '{a}' is not in camel case.", line, from, value);
2983 }
2984 }
2985 }
2986
2987 if (type === "(color)" || type === "(range)") {
2988 t = {type: type};
2989 } else if (type === "(punctuator)" ||
2990 (type === "(identifier)" && is_own(syntax, value))) {
2991 t = syntax[value] || syntax["(error)"];
2992 } else {
2993 t = syntax[type];
2994 }
2995
2996 t = Object.create(t);
2997
2998 if (type === "(string)" || type === "(range)") {
2999 if (!option.scripturl && jx.test(value)) {
3000 warningAt("Script URL.", line, from);
3001 }
3002 }
3003
3004 if (type === "(identifier)") {
3005 t.identifier = true;
3006 checkName(value);
3007 }
3008
3009 t.value = value;
3010 t.line = line;
3011 t.character = character;
3012 t.from = from;
3013 i = t.id;
3014 if (i !== "(endline)") {
3015 prereg = i &&
3016 (("(,=:[!&|?{};".indexOf(i.charAt(i.length - 1)) >= 0) ||
3017 i === "return" ||
3018 i === "case");
3019 }
3020 return t;
3021 }
3022 return {
3023 init: function (source) {
3024 if (typeof source === "string") {
3025 lines = source
3026 .replace(/\r\n/g, "\n")
3027 .replace(/\r/g, "\n")
3028 .split("\n");
3029 } else {
3030 lines = source;
3031 }
3032 if (lines[0] && lines[0].substr(0, 2) === "#!")
3033 lines[0] = "";
3034
3035 line = 0;
3036 nextLine();
3037 from = 1;
3038 },
3039
3040 range: function (begin, end) {
3041 var c, value = "";
3042 from = character;
3043 if (s.charAt(0) !== begin) {
3044 errorAt("Expected '{a}' and instead saw '{b}'.",
3045 line, character, begin, s.charAt(0));
3046 }
3047 for (;;) {
3048 s = s.slice(1);
3049 character += 1;
3050 c = s.charAt(0);
3051 switch (c) {
3052 case "":
3053 errorAt("Missing '{a}'.", line, character, c);
3054 break;
3055 case end:
3056 s = s.slice(1);
3057 character += 1;
3058 return it("(range)", value);
3059 case "\\":
3060 warningAt("Unexpected '{a}'.", line, character, c);
3061 }
3062 value += c;
3063 }
3064
3065 },
3066 token: function () {
3067 var b, c, captures, d, depth, high, i, l, low, q, t, isLiteral, isInRange, n;
3068
3069 function match(x) {
3070 var r = x.exec(s), r1;
3071
3072 if (r) {
3073 l = r[0].length;
3074 r1 = r[1];
3075 c = r1.charAt(0);
3076 s = s.substr(l);
3077 from = character + l - r1.length;
3078 character += l;
3079 return r1;
3080 }
3081 }
3082
3083 function string(x) {
3084 var c, j, r = "", allowNewLine = false;
3085
3086 if (jsonmode && x !== "\"") {
3087 warningAt("Strings must use doublequote.",
3088 line, character);
3089 }
3090
3091 if (option.quotmark) {
3092 if (option.quotmark === "single" && x !== "'") {
3093 warningAt("Strings must use singlequote.",
3094 line, character);
3095 } else if (option.quotmark === "double" && x !== "\"") {
3096 warningAt("Strings must use doublequote.",
3097 line, character);
3098 } else if (option.quotmark === true) {
3099 quotmark = quotmark || x;
3100 if (quotmark !== x) {
3101 warningAt("Mixed double and single quotes.",
3102 line, character);
3103 }
3104 }
3105 }
3106
3107 function esc(n) {
3108 var i = parseInt(s.substr(j + 1, n), 16);
3109 j += n;
3110 if (i >= 32 && i <= 126 &&
3111 i !== 34 && i !== 92 && i !== 39) {
3112 warningAt("Unnecessary escapement.", line, character);
3113 }
3114 character += n;
3115 c = String.fromCharCode(i);
3116 }
3117
3118 j = 0;
3119
3120 unclosedString:
3121 for (;;) {
3122 while (j >= s.length) {
3123 j = 0;
3124
3125 var cl = line, cf = from;
3126 if (!nextLine()) {
3127 errorAt("Unclosed string.", cl, cf);
3128 break unclosedString;
3129 }
3130
3131 if (allowNewLine) {
3132 allowNewLine = false;
3133 } else {
3134 warningAt("Unclosed string.", cl, cf);
3135 }
3136 }
3137
3138 c = s.charAt(j);
3139 if (c === x) {
3140 character += 1;
3141 s = s.substr(j + 1);
3142 return it("(string)", r, x);
3143 }
3144
3145 if (c < " ") {
3146 if (c === "\n" || c === "\r") {
3147 break;
3148 }
3149 warningAt("Control character in string: {a}.",
3150 line, character + j, s.slice(0, j));
3151 } else if (c === "\\") {
3152 j += 1;
3153 character += 1;
3154 c = s.charAt(j);
3155 n = s.charAt(j + 1);
3156 switch (c) {
3157 case "\\":
3158 case "\"":
3159 case "/":
3160 break;
3161 case "\'":
3162 if (jsonmode) {
3163 warningAt("Avoid \\'.", line, character);
3164 }
3165 break;
3166 case "b":
3167 c = "\b";
3168 break;
3169 case "f":
3170 c = "\f";
3171 break;
3172 case "n":
3173 c = "\n";
3174 break;
3175 case "r":
3176 c = "\r";
3177 break;
3178 case "t":
3179 c = "\t";
3180 break;
3181 case "0":
3182 c = "\0";
3183 if (n >= 0 && n <= 7 && directive["use strict"]) {
3184 warningAt(
3185 "Octal literals are not allowed in strict mode.",
3186 line, character);
3187 }
3188 break;
3189 case "u":
3190 esc(4);
3191 break;
3192 case "v":
3193 if (jsonmode) {
3194 warningAt("Avoid \\v.", line, character);
3195 }
3196 c = "\v";
3197 break;
3198 case "x":
3199 if (jsonmode) {
3200 warningAt("Avoid \\x-.", line, character);
3201 }
3202 esc(2);
3203 break;
3204 case "":
3205 allowNewLine = true;
3206 if (option.multistr) {
3207 if (jsonmode) {
3208 warningAt("Avoid EOL escapement.", line, character);
3209 }
3210 c = "";
3211 character -= 1;
3212 break;
3213 }
3214 warningAt("Bad escapement of EOL. Use option multistr if needed.",
3215 line, character);
3216 break;
3217 case "!":
3218 if (s.charAt(j - 2) === "<")
3219 break;
3220 default:
3221 warningAt("Bad escapement.", line, character);
3222 }
3223 }
3224 r += c;
3225 character += 1;
3226 j += 1;
3227 }
3228 }
3229
3230 for (;;) {
3231 if (!s) {
3232 return it(nextLine() ? "(endline)" : "(end)", "");
3233 }
3234
3235 t = match(tx);
3236
3237 if (!t) {
3238 t = "";
3239 c = "";
3240 while (s && s < "!") {
3241 s = s.substr(1);
3242 }
3243 if (s) {
3244 errorAt("Unexpected '{a}'.", line, character, s.substr(0, 1));
3245 s = "";
3246 }
3247 } else {
3248
3249 if (isAlpha(c) || c === "_" || c === "$") {
3250 return it("(identifier)", t);
3251 }
3252
3253 if (isDigit(c)) {
3254 if (!isFinite(Number(t))) {
3255 warningAt("Bad number '{a}'.",
3256 line, character, t);
3257 }
3258 if (isAlpha(s.substr(0, 1))) {
3259 warningAt("Missing space after '{a}'.",
3260 line, character, t);
3261 }
3262 if (c === "0") {
3263 d = t.substr(1, 1);
3264 if (isDigit(d)) {
3265 if (token.id !== ".") {
3266 warningAt("Don't use extra leading zeros '{a}'.",
3267 line, character, t);
3268 }
3269 } else if (jsonmode && (d === "x" || d === "X")) {
3270 warningAt("Avoid 0x-. '{a}'.",
3271 line, character, t);
3272 }
3273 }
3274 if (t.substr(t.length - 1) === ".") {
3275 warningAt(
3276 "A trailing decimal point can be confused with a dot '{a}'.", line, character, t);
3277 }
3278 return it("(number)", t);
3279 }
3280 switch (t) {
3281
3282 case "\"":
3283 case "'":
3284 return string(t);
3285
3286 case "//":
3287 s = "";
3288 token.comment = true;
3289 break;
3290
3291 case "/*":
3292 for (;;) {
3293 i = s.search(lx);
3294 if (i >= 0) {
3295 break;
3296 }
3297 if (!nextLine()) {
3298 errorAt("Unclosed comment.", line, character);
3299 }
3300 }
3301 s = s.substr(i + 2);
3302 token.comment = true;
3303 break;
3304
3305 case "/*members":
3306 case "/*member":
3307 case "/*jshint":
3308 case "/*jslint":
3309 case "/*global":
3310 case "*/":
3311 return {
3312 value: t,
3313 type: "special",
3314 line: line,
3315 character: character,
3316 from: from
3317 };
3318
3319 case "":
3320 break;
3321 case "/":
3322 if (s.charAt(0) === "=") {
3323 errorAt("A regular expression literal can be confused with '/='.",
3324 line, from);
3325 }
3326
3327 if (prereg) {
3328 depth = 0;
3329 captures = 0;
3330 l = 0;
3331 for (;;) {
3332 b = true;
3333 c = s.charAt(l);
3334 l += 1;
3335 switch (c) {
3336 case "":
3337 errorAt("Unclosed regular expression.", line, from);
3338 return quit("Stopping.", line, from);
3339 case "/":
3340 if (depth > 0) {
3341 warningAt("{a} unterminated regular expression " +
3342 "group(s).", line, from + l, depth);
3343 }
3344 c = s.substr(0, l - 1);
3345 q = {
3346 g: true,
3347 i: true,
3348 m: true
3349 };
3350 while (q[s.charAt(l)] === true) {
3351 q[s.charAt(l)] = false;
3352 l += 1;
3353 }
3354 character += l;
3355 s = s.substr(l);
3356 q = s.charAt(0);
3357 if (q === "/" || q === "*") {
3358 errorAt("Confusing regular expression.",
3359 line, from);
3360 }
3361 return it("(regexp)", c);
3362 case "\\":
3363 c = s.charAt(l);
3364 if (c < " ") {
3365 warningAt(
3366 "Unexpected control character in regular expression.", line, from + l);
3367 } else if (c === "<") {
3368 warningAt(
3369 "Unexpected escaped character '{a}' in regular expression.", line, from + l, c);
3370 }
3371 l += 1;
3372 break;
3373 case "(":
3374 depth += 1;
3375 b = false;
3376 if (s.charAt(l) === "?") {
3377 l += 1;
3378 switch (s.charAt(l)) {
3379 case ":":
3380 case "=":
3381 case "!":
3382 l += 1;
3383 break;
3384 default:
3385 warningAt(
3386 "Expected '{a}' and instead saw '{b}'.", line, from + l, ":", s.charAt(l));
3387 }
3388 } else {
3389 captures += 1;
3390 }
3391 break;
3392 case "|":
3393 b = false;
3394 break;
3395 case ")":
3396 if (depth === 0) {
3397 warningAt("Unescaped '{a}'.",
3398 line, from + l, ")");
3399 } else {
3400 depth -= 1;
3401 }
3402 break;
3403 case " ":
3404 q = 1;
3405 while (s.charAt(l) === " ") {
3406 l += 1;
3407 q += 1;
3408 }
3409 if (q > 1) {
3410 warningAt(
3411 "Spaces are hard to count. Use {{a}}.", line, from + l, q);
3412 }
3413 break;
3414 case "[":
3415 c = s.charAt(l);
3416 if (c === "^") {
3417 l += 1;
3418 if (s.charAt(l) === "]") {
3419 errorAt("Unescaped '{a}'.",
3420 line, from + l, "^");
3421 }
3422 }
3423 if (c === "]") {
3424 warningAt("Empty class.", line,
3425 from + l - 1);
3426 }
3427 isLiteral = false;
3428 isInRange = false;
3429 klass:
3430 do {
3431 c = s.charAt(l);
3432 l += 1;
3433 switch (c) {
3434 case "[":
3435 case "^":
3436 warningAt("Unescaped '{a}'.",
3437 line, from + l, c);
3438 if (isInRange) {
3439 isInRange = false;
3440 } else {
3441 isLiteral = true;
3442 }
3443 break;
3444 case "-":
3445 if (isLiteral && !isInRange) {
3446 isLiteral = false;
3447 isInRange = true;
3448 } else if (isInRange) {
3449 isInRange = false;
3450 } else if (s.charAt(l) === "]") {
3451 isInRange = true;
3452 } else {
3453 if (option.regexdash !== (l === 2 || (l === 3 &&
3454 s.charAt(1) === "^"))) {
3455 warningAt("Unescaped '{a}'.",
3456 line, from + l - 1, "-");
3457 }
3458 isLiteral = true;
3459 }
3460 break;
3461 case "]":
3462 if (isInRange && !option.regexdash) {
3463 warningAt("Unescaped '{a}'.",
3464 line, from + l - 1, "-");
3465 }
3466 break klass;
3467 case "\\":
3468 c = s.charAt(l);
3469 if (c < " ") {
3470 warningAt(
3471 "Unexpected control character in regular expression.", line, from + l);
3472 } else if (c === "<") {
3473 warningAt(
3474 "Unexpected escaped character '{a}' in regular expression.", line, from + l, c);
3475 }
3476 l += 1;
3477 if (/[wsd]/i.test(c)) {
3478 if (isInRange) {
3479 warningAt("Unescaped '{a}'.",
3480 line, from + l, "-");
3481 isInRange = false;
3482 }
3483 isLiteral = false;
3484 } else if (isInRange) {
3485 isInRange = false;
3486 } else {
3487 isLiteral = true;
3488 }
3489 break;
3490 case "/":
3491 warningAt("Unescaped '{a}'.",
3492 line, from + l - 1, "/");
3493
3494 if (isInRange) {
3495 isInRange = false;
3496 } else {
3497 isLiteral = true;
3498 }
3499 break;
3500 case "<":
3501 if (isInRange) {
3502 isInRange = false;
3503 } else {
3504 isLiteral = true;
3505 }
3506 break;
3507 default:
3508 if (isInRange) {
3509 isInRange = false;
3510 } else {
3511 isLiteral = true;
3512 }
3513 }
3514 } while (c);
3515 break;
3516 case ".":
3517 if (option.regexp) {
3518 warningAt("Insecure '{a}'.", line,
3519 from + l, c);
3520 }
3521 break;
3522 case "]":
3523 case "?":
3524 case "{":
3525 case "}":
3526 case "+":
3527 case "*":
3528 warningAt("Unescaped '{a}'.", line,
3529 from + l, c);
3530 }
3531 if (b) {
3532 switch (s.charAt(l)) {
3533 case "?":
3534 case "+":
3535 case "*":
3536 l += 1;
3537 if (s.charAt(l) === "?") {
3538 l += 1;
3539 }
3540 break;
3541 case "{":
3542 l += 1;
3543 c = s.charAt(l);
3544 if (c < "0" || c > "9") {
3545 warningAt(
3546 "Expected a number and instead saw '{a}'.", line, from + l, c);
3547 break; // No reason to continue checking numbers.
3548 }
3549 l += 1;
3550 low = +c;
3551 for (;;) {
3552 c = s.charAt(l);
3553 if (c < "0" || c > "9") {
3554 break;
3555 }
3556 l += 1;
3557 low = +c + (low * 10);
3558 }
3559 high = low;
3560 if (c === ",") {
3561 l += 1;
3562 high = Infinity;
3563 c = s.charAt(l);
3564 if (c >= "0" && c <= "9") {
3565 l += 1;
3566 high = +c;
3567 for (;;) {
3568 c = s.charAt(l);
3569 if (c < "0" || c > "9") {
3570 break;
3571 }
3572 l += 1;
3573 high = +c + (high * 10);
3574 }
3575 }
3576 }
3577 if (s.charAt(l) !== "}") {
3578 warningAt(
3579 "Expected '{a}' and instead saw '{b}'.", line, from + l, "}", c);
3580 } else {
3581 l += 1;
3582 }
3583 if (s.charAt(l) === "?") {
3584 l += 1;
3585 }
3586 if (low > high) {
3587 warningAt(
3588 "'{a}' should not be greater than '{b}'.", line, from + l, low, high);
3589 }
3590 }
3591 }
3592 }
3593 c = s.substr(0, l - 1);
3594 character += l;
3595 s = s.substr(l);
3596 return it("(regexp)", c);
3597 }
3598 return it("(punctuator)", t);
3599
3600 case "#":
3601 return it("(punctuator)", t);
3602 default:
3603 return it("(punctuator)", t);
3604 }
3605 }
3606 }
3607 }
3608 };
3609 }());
3610
3611
3612 function addlabel(t, type, token) {
3613 if (t === "hasOwnProperty") {
3614 warning("'hasOwnProperty' is a really bad name.");
3615 }
3616 if (type === "exception") {
3617 if (is_own(funct["(context)"], t)) {
3618 if (funct[t] !== true && !option.node) {
3619 warning("Value of '{a}' may be overwritten in IE.", nexttoken, t);
3620 }
3621 }
3622 }
3623
3624 if (is_own(funct, t) && !funct["(global)"]) {
3625 if (funct[t] === true) {
3626 if (option.latedef)
3627 warning("'{a}' was used before it was defined.", nexttoken, t);
3628 } else {
3629 if (!option.shadow && type !== "exception") {
3630 warning("'{a}' is already defined.", nexttoken, t);
3631 }
3632 }
3633 }
3634
3635 funct[t] = type;
3636
3637 if (token) {
3638 funct["(tokens)"][t] = token;
3639 }
3640
3641 if (funct["(global)"]) {
3642 global[t] = funct;
3643 if (is_own(implied, t)) {
3644 if (option.latedef)
3645 warning("'{a}' was used before it was defined.", nexttoken, t);
3646 delete implied[t];
3647 }
3648 } else {
3649 scope[t] = funct;
3650 }
3651 }
3652
3653
3654 function doOption() {
3655 var nt = nexttoken;
3656 var o = nt.value;
3657 var quotmarkValue = option.quotmark;
3658 var predef = {};
3659 var b, obj, filter, t, tn, v, minus;
3660
3661 switch (o) {
3662 case "*/":
3663 error("Unbegun comment.");
3664 break;
3665 case "/*members":
3666 case "/*member":
3667 o = "/*members";
3668 if (!membersOnly) {
3669 membersOnly = {};
3670 }
3671 obj = membersOnly;
3672 option.quotmark = false;
3673 break;
3674 case "/*jshint":
3675 case "/*jslint":
3676 obj = option;
3677 filter = boolOptions;
3678 break;
3679 case "/*global":
3680 obj = predef;
3681 break;
3682 default:
3683 error("What?");
3684 }
3685
3686 t = lex.token();
3687
3688 for (;;) {
3689 minus = false;
3690 var breakOuterLoop;
3691 for (;;) {
3692 if (t.type === "special" && t.value === "*/") {
3693 breakOuterLoop = true;
3694 break;
3695 }
3696 if (t.id !== "(endline)" && t.id !== ",") {
3697 break;
3698 }
3699 t = lex.token();
3700 }
3701 if (breakOuterLoop)
3702 break;
3703
3704 if (o === "/*global" && t.value === "-") {
3705 minus = true;
3706 t = lex.token();
3707 }
3708
3709 if (t.type !== "(string)" && t.type !== "(identifier)" && o !== "/*members") {
3710 error("Bad option.", t);
3711 }
3712
3713 v = lex.token();
3714 if (v.id === ":") {
3715 v = lex.token();
3716
3717 if (obj === membersOnly) {
3718 error("Expected '{a}' and instead saw '{b}'.", t, "*/", ":");
3719 }
3720
3721 if (o === "/*jshint") {
3722 checkOption(t.value, t);
3723 }
3724
3725 var numericVals = [
3726 "maxstatements",
3727 "maxparams",
3728 "maxdepth",
3729 "maxcomplexity",
3730 "maxerr",
3731 "maxlen",
3732 "indent"
3733 ];
3734
3735 if (numericVals.indexOf(t.value) > -1 && (o === "/*jshint" || o === "/*jslint")) {
3736 b = +v.value;
3737
3738 if (typeof b !== "number" || !isFinite(b) || b <= 0 || Math.floor(b) !== b) {
3739 error("Expected a small integer and instead saw '{a}'.", v, v.value);
3740 }
3741
3742 if (t.value === "indent")
3743 obj.white = true;
3744
3745 obj[t.value] = b;
3746 } else if (t.value === "validthis") {
3747 if (funct["(global)"]) {
3748 error("Option 'validthis' can't be used in a global scope.");
3749 } else {
3750 if (v.value === "true" || v.value === "false")
3751 obj[t.value] = v.value === "true";
3752 else
3753 error("Bad option value.", v);
3754 }
3755 } else if (t.value === "quotmark" && (o === "/*jshint")) {
3756 switch (v.value) {
3757 case "true":
3758 obj.quotmark = true;
3759 break;
3760 case "false":
3761 obj.quotmark = false;
3762 break;
3763 case "double":
3764 case "single":
3765 obj.quotmark = v.value;
3766 break;
3767 default:
3768 error("Bad option value.", v);
3769 }
3770 } else if (v.value === "true" || v.value === "false") {
3771 if (o === "/*jslint") {
3772 tn = renamedOptions[t.value] || t.value;
3773 obj[tn] = v.value === "true";
3774 if (invertedOptions[tn] !== undefined) {
3775 obj[tn] = !obj[tn];
3776 }
3777 } else {
3778 obj[t.value] = v.value === "true";
3779 }
3780
3781 if (t.value === "newcap")
3782 obj["(explicitNewcap)"] = true;
3783 } else {
3784 error("Bad option value.", v);
3785 }
3786 t = lex.token();
3787 } else {
3788 if (o === "/*jshint" || o === "/*jslint") {
3789 error("Missing option value.", t);
3790 }
3791
3792 obj[t.value] = false;
3793
3794 if (o === "/*global" && minus === true) {
3795 JSHINT.blacklist[t.value] = t.value;
3796 updatePredefined();
3797 }
3798
3799 t = v;
3800 }
3801 }
3802
3803 if (o === "/*members") {
3804 option.quotmark = quotmarkValue;
3805 }
3806
3807 combine(predefined, predef);
3808
3809 for (var key in predef) {
3810 if (is_own(predef, key)) {
3811 declared[key] = nt;
3812 }
3813 }
3814
3815 if (filter) {
3816 assume();
3817 }
3818 }
3819
3820 function peek(p) {
3821 var i = p || 0, j = 0, t;
3822
3823 while (j <= i) {
3824 t = lookahead[j];
3825 if (!t) {
3826 t = lookahead[j] = lex.token();
3827 }
3828 j += 1;
3829 }
3830 return t;
3831 }
3832
3833 function advance(id, t) {
3834 switch (token.id) {
3835 case "(number)":
3836 if (nexttoken.id === ".") {
3837 warning("A dot following a number can be confused with a decimal point.", token);
3838 }
3839 break;
3840 case "-":
3841 if (nexttoken.id === "-" || nexttoken.id === "--") {
3842 warning("Confusing minusses.");
3843 }
3844 break;
3845 case "+":
3846 if (nexttoken.id === "+" || nexttoken.id === "++") {
3847 warning("Confusing plusses.");
3848 }
3849 break;
3850 }
3851
3852 if (token.type === "(string)" || token.identifier) {
3853 anonname = token.value;
3854 }
3855
3856 if (id && nexttoken.id !== id) {
3857 if (t) {
3858 if (nexttoken.id === "(end)") {
3859 warning("Unmatched '{a}'.", t, t.id);
3860 } else {
3861 warning("Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
3862 nexttoken, id, t.id, t.line, nexttoken.value);
3863 }
3864 } else if (nexttoken.type !== "(identifier)" ||
3865 nexttoken.value !== id) {
3866 warning("Expected '{a}' and instead saw '{b}'.",
3867 nexttoken, id, nexttoken.value);
3868 }
3869 }
3870
3871 prevtoken = token;
3872 token = nexttoken;
3873 for (;;) {
3874 nexttoken = lookahead.shift() || lex.token();
3875 if (nexttoken.id === "(end)" || nexttoken.id === "(error)") {
3876 return;
3877 }
3878 if (nexttoken.type === "special") {
3879 doOption();
3880 } else {
3881 if (nexttoken.id !== "(endline)") {
3882 break;
3883 }
3884 }
3885 }
3886 }
3887
3888 function expression(rbp, initial) {
3889 var left, isArray = false, isObject = false;
3890
3891 if (nexttoken.id === "(end)")
3892 error("Unexpected early end of program.", token);
3893
3894 advance();
3895 if (initial) {
3896 anonname = "anonymous";
3897 funct["(verb)"] = token.value;
3898 }
3899 if (initial === true && token.fud) {
3900 left = token.fud();
3901 } else {
3902 if (token.nud) {
3903 left = token.nud();
3904 } else {
3905 if (nexttoken.type === "(number)" && token.id === ".") {
3906 warning("A leading decimal point can be confused with a dot: '.{a}'.",
3907 token, nexttoken.value);
3908 advance();
3909 return token;
3910 } else {
3911 error("Expected an identifier and instead saw '{a}'.",
3912 token, token.id);
3913 }
3914 }
3915 while (rbp < nexttoken.lbp) {
3916 isArray = token.value === "Array";
3917 isObject = token.value === "Object";
3918 if (left && (left.value || (left.first && left.first.value))) {
3919 if (left.value !== "new" ||
3920 (left.first && left.first.value && left.first.value === ".")) {
3921 isArray = false;
3922 if (left.value !== token.value) {
3923 isObject = false;
3924 }
3925 }
3926 }
3927
3928 advance();
3929 if (isArray && token.id === "(" && nexttoken.id === ")")
3930 warning("Use the array literal notation [].", token);
3931 if (isObject && token.id === "(" && nexttoken.id === ")")
3932 warning("Use the object literal notation {}.", token);
3933 if (token.led) {
3934 left = token.led(left);
3935 } else {
3936 error("Expected an operator and instead saw '{a}'.",
3937 token, token.id);
3938 }
3939 }
3940 }
3941 return left;
3942 }
3943
3944 function adjacent(left, right) {
3945 left = left || token;
3946 right = right || nexttoken;
3947 if (option.white) {
3948 if (left.character !== right.from && left.line === right.line) {
3949 left.from += (left.character - left.from);
3950 warning("Unexpected space after '{a}'.", left, left.value);
3951 }
3952 }
3953 }
3954
3955 function nobreak(left, right) {
3956 left = left || token;
3957 right = right || nexttoken;
3958 if (option.white && (left.character !== right.from || left.line !== right.line)) {
3959 warning("Unexpected space before '{a}'.", right, right.value);
3960 }
3961 }
3962
3963 function nospace(left, right) {
3964 left = left || token;
3965 right = right || nexttoken;
3966 if (option.white && !left.comment) {
3967 if (left.line === right.line) {
3968 adjacent(left, right);
3969 }
3970 }
3971 }
3972
3973 function nonadjacent(left, right) {
3974 if (option.white) {
3975 left = left || token;
3976 right = right || nexttoken;
3977 if (left.value === ";" && right.value === ";") {
3978 return;
3979 }
3980 if (left.line === right.line && left.character === right.from) {
3981 left.from += (left.character - left.from);
3982 warning("Missing space after '{a}'.",
3983 left, left.value);
3984 }
3985 }
3986 }
3987
3988 function nobreaknonadjacent(left, right) {
3989 left = left || token;
3990 right = right || nexttoken;
3991 if (!option.laxbreak && left.line !== right.line) {
3992 warning("Bad line breaking before '{a}'.", right, right.id);
3993 } else if (option.white) {
3994 left = left || token;
3995 right = right || nexttoken;
3996 if (left.character === right.from) {
3997 left.from += (left.character - left.from);
3998 warning("Missing space after '{a}'.",
3999 left, left.value);
4000 }
4001 }
4002 }
4003
4004 function indentation(bias) {
4005 var i;
4006 if (option.white && nexttoken.id !== "(end)") {
4007 i = indent + (bias || 0);
4008 if (nexttoken.from !== i) {
4009 warning(
4010 "Expected '{a}' to have an indentation at {b} instead at {c}.",
4011 nexttoken, nexttoken.value, i, nexttoken.from);
4012 }
4013 }
4014 }
4015
4016 function nolinebreak(t) {
4017 t = t || token;
4018 if (t.line !== nexttoken.line) {
4019 warning("Line breaking error '{a}'.", t, t.value);
4020 }
4021 }
4022
4023
4024 function comma() {
4025 if (token.line !== nexttoken.line) {
4026 if (!option.laxcomma) {
4027 if (comma.first) {
4028 warning("Comma warnings can be turned off with 'laxcomma'");
4029 comma.first = false;
4030 }
4031 warning("Bad line breaking before '{a}'.", token, nexttoken.id);
4032 }
4033 } else if (!token.comment && token.character !== nexttoken.from && option.white) {
4034 token.from += (token.character - token.from);
4035 warning("Unexpected space after '{a}'.", token, token.value);
4036 }
4037 advance(",");
4038 nonadjacent(token, nexttoken);
4039 }
4040
4041 function symbol(s, p) {
4042 var x = syntax[s];
4043 if (!x || typeof x !== "object") {
4044 syntax[s] = x = {
4045 id: s,
4046 lbp: p,
4047 value: s
4048 };
4049 }
4050 return x;
4051 }
4052
4053
4054 function delim(s) {
4055 return symbol(s, 0);
4056 }
4057
4058
4059 function stmt(s, f) {
4060 var x = delim(s);
4061 x.identifier = x.reserved = true;
4062 x.fud = f;
4063 return x;
4064 }
4065
4066
4067 function blockstmt(s, f) {
4068 var x = stmt(s, f);
4069 x.block = true;
4070 return x;
4071 }
4072
4073
4074 function reserveName(x) {
4075 var c = x.id.charAt(0);
4076 if ((c >= "a" && c <= "z") || (c >= "A" && c <= "Z")) {
4077 x.identifier = x.reserved = true;
4078 }
4079 return x;
4080 }
4081
4082
4083 function prefix(s, f) {
4084 var x = symbol(s, 150);
4085 reserveName(x);
4086 x.nud = (typeof f === "function") ? f : function () {
4087 this.right = expression(150);
4088 this.arity = "unary";
4089 if (this.id === "++" || this.id === "--") {
4090 if (option.plusplus) {
4091 warning("Unexpected use of '{a}'.", this, this.id);
4092 } else if ((!this.right.identifier || this.right.reserved) &&
4093 this.right.id !== "." && this.right.id !== "[") {
4094 warning("Bad operand.", this);
4095 }
4096 }
4097 return this;
4098 };
4099 return x;
4100 }
4101
4102
4103 function type(s, f) {
4104 var x = delim(s);
4105 x.type = s;
4106 x.nud = f;
4107 return x;
4108 }
4109
4110
4111 function reserve(s, f) {
4112 var x = type(s, f);
4113 x.identifier = x.reserved = true;
4114 return x;
4115 }
4116
4117
4118 function reservevar(s, v) {
4119 return reserve(s, function () {
4120 if (typeof v === "function") {
4121 v(this);
4122 }
4123 return this;
4124 });
4125 }
4126
4127
4128 function infix(s, f, p, w) {
4129 var x = symbol(s, p);
4130 reserveName(x);
4131 x.led = function (left) {
4132 if (!w) {
4133 nobreaknonadjacent(prevtoken, token);
4134 nonadjacent(token, nexttoken);
4135 }
4136 if (s === "in" && left.id === "!") {
4137 warning("Confusing use of '{a}'.", left, "!");
4138 }
4139 if (typeof f === "function") {
4140 return f(left, this);
4141 } else {
4142 this.left = left;
4143 this.right = expression(p);
4144 return this;
4145 }
4146 };
4147 return x;
4148 }
4149
4150
4151 function relation(s, f) {
4152 var x = symbol(s, 100);
4153 x.led = function (left) {
4154 nobreaknonadjacent(prevtoken, token);
4155 nonadjacent(token, nexttoken);
4156 var right = expression(100);
4157
4158 if (isIdentifier(left, "NaN") || isIdentifier(right, "NaN")) {
4159 warning("Use the isNaN function to compare with NaN.", this);
4160 } else if (f) {
4161 f.apply(this, [left, right]);
4162 }
4163 if (left.id === "!") {
4164 warning("Confusing use of '{a}'.", left, "!");
4165 }
4166 if (right.id === "!") {
4167 warning("Confusing use of '{a}'.", right, "!");
4168 }
4169 this.left = left;
4170 this.right = right;
4171 return this;
4172 };
4173 return x;
4174 }
4175
4176
4177 function isPoorRelation(node) {
4178 return node &&
4179 ((node.type === "(number)" && +node.value === 0) ||
4180 (node.type === "(string)" && node.value === "") ||
4181 (node.type === "null" && !option.eqnull) ||
4182 node.type === "true" ||
4183 node.type === "false" ||
4184 node.type === "undefined");
4185 }
4186
4187
4188 function assignop(s) {
4189 symbol(s, 20).exps = true;
4190
4191 return infix(s, function (left, that) {
4192 that.left = left;
4193
4194 if (predefined[left.value] === false &&
4195 scope[left.value]["(global)"] === true) {
4196 warning("Read only.", left);
4197 } else if (left["function"]) {
4198 warning("'{a}' is a function.", left, left.value);
4199 }
4200
4201 if (left) {
4202 if (option.esnext && funct[left.value] === "const") {
4203 warning("Attempting to override '{a}' which is a constant", left, left.value);
4204 }
4205
4206 if (left.id === "." || left.id === "[") {
4207 if (!left.left || left.left.value === "arguments") {
4208 warning("Bad assignment.", that);
4209 }
4210 that.right = expression(19);
4211 return that;
4212 } else if (left.identifier && !left.reserved) {
4213 if (funct[left.value] === "exception") {
4214 warning("Do not assign to the exception parameter.", left);
4215 }
4216 that.right = expression(19);
4217 return that;
4218 }
4219
4220 if (left === syntax["function"]) {
4221 warning(
4222 "Expected an identifier in an assignment and instead saw a function invocation.",
4223 token);
4224 }
4225 }
4226
4227 error("Bad assignment.", that);
4228 }, 20);
4229 }
4230
4231
4232 function bitwise(s, f, p) {
4233 var x = symbol(s, p);
4234 reserveName(x);
4235 x.led = (typeof f === "function") ? f : function (left) {
4236 if (option.bitwise) {
4237 warning("Unexpected use of '{a}'.", this, this.id);
4238 }
4239 this.left = left;
4240 this.right = expression(p);
4241 return this;
4242 };
4243 return x;
4244 }
4245
4246
4247 function bitwiseassignop(s) {
4248 symbol(s, 20).exps = true;
4249 return infix(s, function (left, that) {
4250 if (option.bitwise) {
4251 warning("Unexpected use of '{a}'.", that, that.id);
4252 }
4253 nonadjacent(prevtoken, token);
4254 nonadjacent(token, nexttoken);
4255 if (left) {
4256 if (left.id === "." || left.id === "[" ||
4257 (left.identifier && !left.reserved)) {
4258 expression(19);
4259 return that;
4260 }
4261 if (left === syntax["function"]) {
4262 warning(
4263 "Expected an identifier in an assignment, and instead saw a function invocation.",
4264 token);
4265 }
4266 return that;
4267 }
4268 error("Bad assignment.", that);
4269 }, 20);
4270 }
4271
4272
4273 function suffix(s) {
4274 var x = symbol(s, 150);
4275 x.led = function (left) {
4276 if (option.plusplus) {
4277 warning("Unexpected use of '{a}'.", this, this.id);
4278 } else if ((!left.identifier || left.reserved) &&
4279 left.id !== "." && left.id !== "[") {
4280 warning("Bad operand.", this);
4281 }
4282 this.left = left;
4283 return this;
4284 };
4285 return x;
4286 }
4287 function optionalidentifier(fnparam) {
4288 if (nexttoken.identifier) {
4289 advance();
4290 if (token.reserved && !option.es5) {
4291 if (!fnparam || token.value !== "undefined") {
4292 warning("Expected an identifier and instead saw '{a}' (a reserved word).",
4293 token, token.id);
4294 }
4295 }
4296 return token.value;
4297 }
4298 }
4299 function identifier(fnparam) {
4300 var i = optionalidentifier(fnparam);
4301 if (i) {
4302 return i;
4303 }
4304 if (token.id === "function" && nexttoken.id === "(") {
4305 warning("Missing name in function declaration.");
4306 } else {
4307 error("Expected an identifier and instead saw '{a}'.",
4308 nexttoken, nexttoken.value);
4309 }
4310 }
4311
4312
4313 function reachable(s) {
4314 var i = 0, t;
4315 if (nexttoken.id !== ";" || noreach) {
4316 return;
4317 }
4318 for (;;) {
4319 t = peek(i);
4320 if (t.reach) {
4321 return;
4322 }
4323 if (t.id !== "(endline)") {
4324 if (t.id === "function") {
4325 if (!option.latedef) {
4326 break;
4327 }
4328 warning(
4329 "Inner functions should be listed at the top of the outer function.", t);
4330 break;
4331 }
4332 warning("Unreachable '{a}' after '{b}'.", t, t.value, s);
4333 break;
4334 }
4335 i += 1;
4336 }
4337 }
4338
4339
4340 function statement(noindent) {
4341 var i = indent, r, s = scope, t = nexttoken;
4342
4343 if (t.id === ";") {
4344 advance(";");
4345 return;
4346 }
4347
4348 if (t.identifier && !t.reserved && peek().id === ":") {
4349 advance();
4350 advance(":");
4351 scope = Object.create(s);
4352 addlabel(t.value, "label");
4353
4354 if (!nexttoken.labelled && nexttoken.value !== "{") {
4355 warning("Label '{a}' on {b} statement.", nexttoken, t.value, nexttoken.value);
4356 }
4357
4358 if (jx.test(t.value + ":")) {
4359 warning("Label '{a}' looks like a javascript url.", t, t.value);
4360 }
4361
4362 nexttoken.label = t.value;
4363 t = nexttoken;
4364 }
4365
4366 if (t.id === "{") {
4367 block(true, true);
4368 return;
4369 }
4370
4371 if (!noindent) {
4372 indentation();
4373 }
4374 r = expression(0, true);
4375
4376 if (!t.block) {
4377 if (!option.expr && (!r || !r.exps)) {
4378 warning("Expected an assignment or function call and instead saw an expression.",
4379 token);
4380 } else if (option.nonew && r.id === "(" && r.left.id === "new") {
4381 warning("Do not use 'new' for side effects.", t);
4382 }
4383
4384 if (nexttoken.id === ",") {
4385 return comma();
4386 }
4387
4388 if (nexttoken.id !== ";") {
4389 if (!option.asi) {
4390 if (!option.lastsemic || nexttoken.id !== "}" ||
4391 nexttoken.line !== token.line) {
4392 warningAt("Missing semicolon.", token.line, token.character);
4393 }
4394 }
4395 } else {
4396 adjacent(token, nexttoken);
4397 advance(";");
4398 nonadjacent(token, nexttoken);
4399 }
4400 }
4401
4402 indent = i;
4403 scope = s;
4404 return r;
4405 }
4406
4407
4408 function statements(startLine) {
4409 var a = [], p;
4410
4411 while (!nexttoken.reach && nexttoken.id !== "(end)") {
4412 if (nexttoken.id === ";") {
4413 p = peek();
4414 if (!p || p.id !== "(") {
4415 warning("Unnecessary semicolon.");
4416 }
4417 advance(";");
4418 } else {
4419 a.push(statement(startLine === nexttoken.line));
4420 }
4421 }
4422 return a;
4423 }
4424 function directives() {
4425 var i, p, pn;
4426
4427 for (;;) {
4428 if (nexttoken.id === "(string)") {
4429 p = peek(0);
4430 if (p.id === "(endline)") {
4431 i = 1;
4432 do {
4433 pn = peek(i);
4434 i = i + 1;
4435 } while (pn.id === "(endline)");
4436
4437 if (pn.id !== ";") {
4438 if (pn.id !== "(string)" && pn.id !== "(number)" &&
4439 pn.id !== "(regexp)" && pn.identifier !== true &&
4440 pn.id !== "}") {
4441 break;
4442 }
4443 warning("Missing semicolon.", nexttoken);
4444 } else {
4445 p = pn;
4446 }
4447 } else if (p.id === "}") {
4448 warning("Missing semicolon.", p);
4449 } else if (p.id !== ";") {
4450 break;
4451 }
4452
4453 indentation();
4454 advance();
4455 if (directive[token.value]) {
4456 warning("Unnecessary directive \"{a}\".", token, token.value);
4457 }
4458
4459 if (token.value === "use strict") {
4460 if (!option["(explicitNewcap)"])
4461 option.newcap = true;
4462 option.undef = true;
4463 }
4464 directive[token.value] = true;
4465
4466 if (p.id === ";") {
4467 advance(";");
4468 }
4469 continue;
4470 }
4471 break;
4472 }
4473 }
4474 function block(ordinary, stmt, isfunc) {
4475 var a,
4476 b = inblock,
4477 old_indent = indent,
4478 m,
4479 s = scope,
4480 t,
4481 line,
4482 d;
4483
4484 inblock = ordinary;
4485
4486 if (!ordinary || !option.funcscope)
4487 scope = Object.create(scope);
4488
4489 nonadjacent(token, nexttoken);
4490 t = nexttoken;
4491
4492 var metrics = funct["(metrics)"];
4493 metrics.nestedBlockDepth += 1;
4494 metrics.verifyMaxNestedBlockDepthPerFunction();
4495
4496 if (nexttoken.id === "{") {
4497 advance("{");
4498 line = token.line;
4499 if (nexttoken.id !== "}") {
4500 indent += option.indent;
4501 while (!ordinary && nexttoken.from > indent) {
4502 indent += option.indent;
4503 }
4504
4505 if (isfunc) {
4506 m = {};
4507 for (d in directive) {
4508 if (is_own(directive, d)) {
4509 m[d] = directive[d];
4510 }
4511 }
4512 directives();
4513
4514 if (option.strict && funct["(context)"]["(global)"]) {
4515 if (!m["use strict"] && !directive["use strict"]) {
4516 warning("Missing \"use strict\" statement.");
4517 }
4518 }
4519 }
4520
4521 a = statements(line);
4522
4523 metrics.statementCount += a.length;
4524
4525 if (isfunc) {
4526 directive = m;
4527 }
4528
4529 indent -= option.indent;
4530 if (line !== nexttoken.line) {
4531 indentation();
4532 }
4533 } else if (line !== nexttoken.line) {
4534 indentation();
4535 }
4536 advance("}", t);
4537 indent = old_indent;
4538 } else if (!ordinary) {
4539 error("Expected '{a}' and instead saw '{b}'.",
4540 nexttoken, "{", nexttoken.value);
4541 } else {
4542 if (!stmt || option.curly)
4543 warning("Expected '{a}' and instead saw '{b}'.",
4544 nexttoken, "{", nexttoken.value);
4545
4546 noreach = true;
4547 indent += option.indent;
4548 a = [statement(nexttoken.line === token.line)];
4549 indent -= option.indent;
4550 noreach = false;
4551 }
4552 funct["(verb)"] = null;
4553 if (!ordinary || !option.funcscope) scope = s;
4554 inblock = b;
4555 if (ordinary && option.noempty && (!a || a.length === 0)) {
4556 warning("Empty block.");
4557 }
4558 metrics.nestedBlockDepth -= 1;
4559 return a;
4560 }
4561
4562
4563 function countMember(m) {
4564 if (membersOnly && typeof membersOnly[m] !== "boolean") {
4565 warning("Unexpected /*member '{a}'.", token, m);
4566 }
4567 if (typeof member[m] === "number") {
4568 member[m] += 1;
4569 } else {
4570 member[m] = 1;
4571 }
4572 }
4573
4574
4575 function note_implied(token) {
4576 var name = token.value, line = token.line, a = implied[name];
4577 if (typeof a === "function") {
4578 a = false;
4579 }
4580
4581 if (!a) {
4582 a = [line];
4583 implied[name] = a;
4584 } else if (a[a.length - 1] !== line) {
4585 a.push(line);
4586 }
4587 }
4588
4589 type("(number)", function () {
4590 return this;
4591 });
4592
4593 type("(string)", function () {
4594 return this;
4595 });
4596
4597 syntax["(identifier)"] = {
4598 type: "(identifier)",
4599 lbp: 0,
4600 identifier: true,
4601 nud: function () {
4602 var v = this.value,
4603 s = scope[v],
4604 f;
4605
4606 if (typeof s === "function") {
4607 s = undefined;
4608 } else if (typeof s === "boolean") {
4609 f = funct;
4610 funct = functions[0];
4611 addlabel(v, "var");
4612 s = funct;
4613 funct = f;
4614 }
4615 if (funct === s) {
4616 switch (funct[v]) {
4617 case "unused":
4618 funct[v] = "var";
4619 break;
4620 case "unction":
4621 funct[v] = "function";
4622 this["function"] = true;
4623 break;
4624 case "function":
4625 this["function"] = true;
4626 break;
4627 case "label":
4628 warning("'{a}' is a statement label.", token, v);
4629 break;
4630 }
4631 } else if (funct["(global)"]) {
4632
4633 if (option.undef && typeof predefined[v] !== "boolean") {
4634 if (!(anonname === "typeof" || anonname === "delete") ||
4635 (nexttoken && (nexttoken.value === "." || nexttoken.value === "["))) {
4636
4637 isundef(funct, "'{a}' is not defined.", token, v);
4638 }
4639 }
4640
4641 note_implied(token);
4642 } else {
4643
4644 switch (funct[v]) {
4645 case "closure":
4646 case "function":
4647 case "var":
4648 case "unused":
4649 warning("'{a}' used out of scope.", token, v);
4650 break;
4651 case "label":
4652 warning("'{a}' is a statement label.", token, v);
4653 break;
4654 case "outer":
4655 case "global":
4656 break;
4657 default:
4658 if (s === true) {
4659 funct[v] = true;
4660 } else if (s === null) {
4661 warning("'{a}' is not allowed.", token, v);
4662 note_implied(token);
4663 } else if (typeof s !== "object") {
4664 if (option.undef) {
4665 if (!(anonname === "typeof" || anonname === "delete") ||
4666 (nexttoken &&
4667 (nexttoken.value === "." || nexttoken.value === "["))) {
4668
4669 isundef(funct, "'{a}' is not defined.", token, v);
4670 }
4671 }
4672 funct[v] = true;
4673 note_implied(token);
4674 } else {
4675 switch (s[v]) {
4676 case "function":
4677 case "unction":
4678 this["function"] = true;
4679 s[v] = "closure";
4680 funct[v] = s["(global)"] ? "global" : "outer";
4681 break;
4682 case "var":
4683 case "unused":
4684 s[v] = "closure";
4685 funct[v] = s["(global)"] ? "global" : "outer";
4686 break;
4687 case "closure":
4688 funct[v] = s["(global)"] ? "global" : "outer";
4689 break;
4690 case "label":
4691 warning("'{a}' is a statement label.", token, v);
4692 }
4693 }
4694 }
4695 }
4696 return this;
4697 },
4698 led: function () {
4699 error("Expected an operator and instead saw '{a}'.",
4700 nexttoken, nexttoken.value);
4701 }
4702 };
4703
4704 type("(regexp)", function () {
4705 return this;
4706 });
4707
4708 delim("(endline)");
4709 delim("(begin)");
4710 delim("(end)").reach = true;
4711 delim("</").reach = true;
4712 delim("<!");
4713 delim("<!--");
4714 delim("-->");
4715 delim("(error)").reach = true;
4716 delim("}").reach = true;
4717 delim(")");
4718 delim("]");
4719 delim("\"").reach = true;
4720 delim("'").reach = true;
4721 delim(";");
4722 delim(":").reach = true;
4723 delim(",");
4724 delim("#");
4725 delim("@");
4726 reserve("else");
4727 reserve("case").reach = true;
4728 reserve("catch");
4729 reserve("default").reach = true;
4730 reserve("finally");
4731 reservevar("arguments", function (x) {
4732 if (directive["use strict"] && funct["(global)"]) {
4733 warning("Strict violation.", x);
4734 }
4735 });
4736 reservevar("eval");
4737 reservevar("false");
4738 reservevar("Infinity");
4739 reservevar("null");
4740 reservevar("this", function (x) {
4741 if (directive["use strict"] && !option.validthis && ((funct["(statement)"] &&
4742 funct["(name)"].charAt(0) > "Z") || funct["(global)"])) {
4743 warning("Possible strict violation.", x);
4744 }
4745 });
4746 reservevar("true");
4747 reservevar("undefined");
4748 assignop("=", "assign", 20);
4749 assignop("+=", "assignadd", 20);
4750 assignop("-=", "assignsub", 20);
4751 assignop("*=", "assignmult", 20);
4752 assignop("/=", "assigndiv", 20).nud = function () {
4753 error("A regular expression literal can be confused with '/='.");
4754 };
4755 assignop("%=", "assignmod", 20);
4756 bitwiseassignop("&=", "assignbitand", 20);
4757 bitwiseassignop("|=", "assignbitor", 20);
4758 bitwiseassignop("^=", "assignbitxor", 20);
4759 bitwiseassignop("<<=", "assignshiftleft", 20);
4760 bitwiseassignop(">>=", "assignshiftright", 20);
4761 bitwiseassignop(">>>=", "assignshiftrightunsigned", 20);
4762 infix("?", function (left, that) {
4763 that.left = left;
4764 that.right = expression(10);
4765 advance(":");
4766 that["else"] = expression(10);
4767 return that;
4768 }, 30);
4769
4770 infix("||", "or", 40);
4771 infix("&&", "and", 50);
4772 bitwise("|", "bitor", 70);
4773 bitwise("^", "bitxor", 80);
4774 bitwise("&", "bitand", 90);
4775 relation("==", function (left, right) {
4776 var eqnull = option.eqnull && (left.value === "null" || right.value === "null");
4777
4778 if (!eqnull && option.eqeqeq)
4779 warning("Expected '{a}' and instead saw '{b}'.", this, "===", "==");
4780 else if (isPoorRelation(left))
4781 warning("Use '{a}' to compare with '{b}'.", this, "===", left.value);
4782 else if (isPoorRelation(right))
4783 warning("Use '{a}' to compare with '{b}'.", this, "===", right.value);
4784
4785 return this;
4786 });
4787 relation("===");
4788 relation("!=", function (left, right) {
4789 var eqnull = option.eqnull &&
4790 (left.value === "null" || right.value === "null");
4791
4792 if (!eqnull && option.eqeqeq) {
4793 warning("Expected '{a}' and instead saw '{b}'.",
4794 this, "!==", "!=");
4795 } else if (isPoorRelation(left)) {
4796 warning("Use '{a}' to compare with '{b}'.",
4797 this, "!==", left.value);
4798 } else if (isPoorRelation(right)) {
4799 warning("Use '{a}' to compare with '{b}'.",
4800 this, "!==", right.value);
4801 }
4802 return this;
4803 });
4804 relation("!==");
4805 relation("<");
4806 relation(">");
4807 relation("<=");
4808 relation(">=");
4809 bitwise("<<", "shiftleft", 120);
4810 bitwise(">>", "shiftright", 120);
4811 bitwise(">>>", "shiftrightunsigned", 120);
4812 infix("in", "in", 120);
4813 infix("instanceof", "instanceof", 120);
4814 infix("+", function (left, that) {
4815 var right = expression(130);
4816 if (left && right && left.id === "(string)" && right.id === "(string)") {
4817 left.value += right.value;
4818 left.character = right.character;
4819 if (!option.scripturl && jx.test(left.value)) {
4820 warning("JavaScript URL.", left);
4821 }
4822 return left;
4823 }
4824 that.left = left;
4825 that.right = right;
4826 return that;
4827 }, 130);
4828 prefix("+", "num");
4829 prefix("+++", function () {
4830 warning("Confusing pluses.");
4831 this.right = expression(150);
4832 this.arity = "unary";
4833 return this;
4834 });
4835 infix("+++", function (left) {
4836 warning("Confusing pluses.");
4837 this.left = left;
4838 this.right = expression(130);
4839 return this;
4840 }, 130);
4841 infix("-", "sub", 130);
4842 prefix("-", "neg");
4843 prefix("---", function () {
4844 warning("Confusing minuses.");
4845 this.right = expression(150);
4846 this.arity = "unary";
4847 return this;
4848 });
4849 infix("---", function (left) {
4850 warning("Confusing minuses.");
4851 this.left = left;
4852 this.right = expression(130);
4853 return this;
4854 }, 130);
4855 infix("*", "mult", 140);
4856 infix("/", "div", 140);
4857 infix("%", "mod", 140);
4858
4859 suffix("++", "postinc");
4860 prefix("++", "preinc");
4861 syntax["++"].exps = true;
4862
4863 suffix("--", "postdec");
4864 prefix("--", "predec");
4865 syntax["--"].exps = true;
4866 prefix("delete", function () {
4867 var p = expression(0);
4868 if (!p || (p.id !== "." && p.id !== "[")) {
4869 warning("Variables should not be deleted.");
4870 }
4871 this.first = p;
4872 return this;
4873 }).exps = true;
4874
4875 prefix("~", function () {
4876 if (option.bitwise) {
4877 warning("Unexpected '{a}'.", this, "~");
4878 }
4879 expression(150);
4880 return this;
4881 });
4882
4883 prefix("!", function () {
4884 this.right = expression(150);
4885 this.arity = "unary";
4886 if (bang[this.right.id] === true) {
4887 warning("Confusing use of '{a}'.", this, "!");
4888 }
4889 return this;
4890 });
4891 prefix("typeof", "typeof");
4892 prefix("new", function () {
4893 var c = expression(155), i;
4894 if (c && c.id !== "function") {
4895 if (c.identifier) {
4896 c["new"] = true;
4897 switch (c.value) {
4898 case "Number":
4899 case "String":
4900 case "Boolean":
4901 case "Math":
4902 case "JSON":
4903 warning("Do not use {a} as a constructor.", prevtoken, c.value);
4904 break;
4905 case "Function":
4906 if (!option.evil) {
4907 warning("The Function constructor is eval.");
4908 }
4909 break;
4910 case "Date":
4911 case "RegExp":
4912 break;
4913 default:
4914 if (c.id !== "function") {
4915 i = c.value.substr(0, 1);
4916 if (option.newcap && (i < "A" || i > "Z") && !is_own(global, c.value)) {
4917 warning("A constructor name should start with an uppercase letter.",
4918 token);
4919 }
4920 }
4921 }
4922 } else {
4923 if (c.id !== "." && c.id !== "[" && c.id !== "(") {
4924 warning("Bad constructor.", token);
4925 }
4926 }
4927 } else {
4928 if (!option.supernew)
4929 warning("Weird construction. Delete 'new'.", this);
4930 }
4931 adjacent(token, nexttoken);
4932 if (nexttoken.id !== "(" && !option.supernew) {
4933 warning("Missing '()' invoking a constructor.",
4934 token, token.value);
4935 }
4936 this.first = c;
4937 return this;
4938 });
4939 syntax["new"].exps = true;
4940
4941 prefix("void").exps = true;
4942
4943 infix(".", function (left, that) {
4944 adjacent(prevtoken, token);
4945 nobreak();
4946 var m = identifier();
4947 if (typeof m === "string") {
4948 countMember(m);
4949 }
4950 that.left = left;
4951 that.right = m;
4952 if (left && left.value === "arguments" && (m === "callee" || m === "caller")) {
4953 if (option.noarg)
4954 warning("Avoid arguments.{a}.", left, m);
4955 else if (directive["use strict"])
4956 error("Strict violation.");
4957 } else if (!option.evil && left && left.value === "document" &&
4958 (m === "write" || m === "writeln")) {
4959 warning("document.write can be a form of eval.", left);
4960 }
4961 if (!option.evil && (m === "eval" || m === "execScript")) {
4962 warning("eval is evil.");
4963 }
4964 return that;
4965 }, 160, true);
4966
4967 infix("(", function (left, that) {
4968 if (prevtoken.id !== "}" && prevtoken.id !== ")") {
4969 nobreak(prevtoken, token);
4970 }
4971 nospace();
4972 if (option.immed && !left.immed && left.id === "function") {
4973 warning("Wrap an immediate function invocation in parentheses " +
4974 "to assist the reader in understanding that the expression " +
4975 "is the result of a function, and not the function itself.");
4976 }
4977 var n = 0,
4978 p = [];
4979 if (left) {
4980 if (left.type === "(identifier)") {
4981 if (left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)) {
4982 if ("Number String Boolean Date Object".indexOf(left.value) === -1) {
4983 if (left.value === "Math") {
4984 warning("Math is not a function.", left);
4985 } else if (option.newcap) {
4986 warning("Missing 'new' prefix when invoking a constructor.", left);
4987 }
4988 }
4989 }
4990 }
4991 }
4992 if (nexttoken.id !== ")") {
4993 for (;;) {
4994 p[p.length] = expression(10);
4995 n += 1;
4996 if (nexttoken.id !== ",") {
4997 break;
4998 }
4999 comma();
5000 }
5001 }
5002 advance(")");
5003 nospace(prevtoken, token);
5004 if (typeof left === "object") {
5005 if (left.value === "parseInt" && n === 1) {
5006 warning("Missing radix parameter.", token);
5007 }
5008 if (!option.evil) {
5009 if (left.value === "eval" || left.value === "Function" ||
5010 left.value === "execScript") {
5011 warning("eval is evil.", left);
5012
5013 if (p[0] && [0].id === "(string)") {
5014 addInternalSrc(left, p[0].value);
5015 }
5016 } else if (p[0] && p[0].id === "(string)" &&
5017 (left.value === "setTimeout" ||
5018 left.value === "setInterval")) {
5019 warning(
5020 "Implied eval is evil. Pass a function instead of a string.", left);
5021 addInternalSrc(left, p[0].value);
5022 } else if (p[0] && p[0].id === "(string)" &&
5023 left.value === "." &&
5024 left.left.value === "window" &&
5025 (left.right === "setTimeout" ||
5026 left.right === "setInterval")) {
5027 warning(
5028 "Implied eval is evil. Pass a function instead of a string.", left);
5029 addInternalSrc(left, p[0].value);
5030 }
5031 }
5032 if (!left.identifier && left.id !== "." && left.id !== "[" &&
5033 left.id !== "(" && left.id !== "&&" && left.id !== "||" &&
5034 left.id !== "?") {
5035 warning("Bad invocation.", left);
5036 }
5037 }
5038 that.left = left;
5039 return that;
5040 }, 155, true).exps = true;
5041
5042 prefix("(", function () {
5043 nospace();
5044 if (nexttoken.id === "function") {
5045 nexttoken.immed = true;
5046 }
5047 var v = expression(0);
5048 advance(")", this);
5049 nospace(prevtoken, token);
5050 if (option.immed && v.id === "function") {
5051 if (nexttoken.id !== "(" &&
5052 (nexttoken.id !== "." || (peek().value !== "call" && peek().value !== "apply"))) {
5053 warning(
5054 "Do not wrap function literals in parens unless they are to be immediately invoked.",
5055 this);
5056 }
5057 }
5058
5059 return v;
5060 });
5061
5062 infix("[", function (left, that) {
5063 nobreak(prevtoken, token);
5064 nospace();
5065 var e = expression(0), s;
5066 if (e && e.type === "(string)") {
5067 if (!option.evil && (e.value === "eval" || e.value === "execScript")) {
5068 warning("eval is evil.", that);
5069 }
5070 countMember(e.value);
5071 if (!option.sub && ix.test(e.value)) {
5072 s = syntax[e.value];
5073 if (!s || !s.reserved) {
5074 warning("['{a}'] is better written in dot notation.",
5075 prevtoken, e.value);
5076 }
5077 }
5078 }
5079 advance("]", that);
5080 nospace(prevtoken, token);
5081 that.left = left;
5082 that.right = e;
5083 return that;
5084 }, 160, true);
5085
5086 prefix("[", function () {
5087 var b = token.line !== nexttoken.line;
5088 this.first = [];
5089 if (b) {
5090 indent += option.indent;
5091 if (nexttoken.from === indent + option.indent) {
5092 indent += option.indent;
5093 }
5094 }
5095 while (nexttoken.id !== "(end)") {
5096 while (nexttoken.id === ",") {
5097 if (!option.es5)
5098 warning("Extra comma.");
5099 advance(",");
5100 }
5101 if (nexttoken.id === "]") {
5102 break;
5103 }
5104 if (b && token.line !== nexttoken.line) {
5105 indentation();
5106 }
5107 this.first.push(expression(10));
5108 if (nexttoken.id === ",") {
5109 comma();
5110 if (nexttoken.id === "]" && !option.es5) {
5111 warning("Extra comma.", token);
5112 break;
5113 }
5114 } else {
5115 break;
5116 }
5117 }
5118 if (b) {
5119 indent -= option.indent;
5120 indentation();
5121 }
5122 advance("]", this);
5123 return this;
5124 }, 160);
5125
5126
5127 function property_name() {
5128 var id = optionalidentifier(true);
5129 if (!id) {
5130 if (nexttoken.id === "(string)") {
5131 id = nexttoken.value;
5132 advance();
5133 } else if (nexttoken.id === "(number)") {
5134 id = nexttoken.value.toString();
5135 advance();
5136 }
5137 }
5138 return id;
5139 }
5140
5141
5142 function functionparams() {
5143 var next = nexttoken;
5144 var params = [];
5145 var ident;
5146
5147 advance("(");
5148 nospace();
5149
5150 if (nexttoken.id === ")") {
5151 advance(")");
5152 return;
5153 }
5154
5155 for (;;) {
5156 ident = identifier(true);
5157 params.push(ident);
5158 addlabel(ident, "unused", token);
5159 if (nexttoken.id === ",") {
5160 comma();
5161 } else {
5162 advance(")", next);
5163 nospace(prevtoken, token);
5164 return params;
5165 }
5166 }
5167 }
5168
5169
5170 function doFunction(name, statement) {
5171 var f;
5172 var oldOption = option;
5173 var oldScope = scope;
5174
5175 option = Object.create(option);
5176 scope = Object.create(scope);
5177
5178 funct = {
5179 "(name)" : name || "\"" + anonname + "\"",
5180 "(line)" : nexttoken.line,
5181 "(character)": nexttoken.character,
5182 "(context)" : funct,
5183 "(breakage)" : 0,
5184 "(loopage)" : 0,
5185 "(metrics)" : createMetrics(nexttoken),
5186 "(scope)" : scope,
5187 "(statement)": statement,
5188 "(tokens)" : {}
5189 };
5190
5191 f = funct;
5192 token.funct = funct;
5193
5194 functions.push(funct);
5195
5196 if (name) {
5197 addlabel(name, "function");
5198 }
5199
5200 funct["(params)"] = functionparams();
5201 funct["(metrics)"].verifyMaxParametersPerFunction(funct["(params)"]);
5202
5203 block(false, false, true);
5204
5205 funct["(metrics)"].verifyMaxStatementsPerFunction();
5206 funct["(metrics)"].verifyMaxComplexityPerFunction();
5207
5208 scope = oldScope;
5209 option = oldOption;
5210 funct["(last)"] = token.line;
5211 funct["(lastcharacter)"] = token.character;
5212 funct = funct["(context)"];
5213
5214 return f;
5215 }
5216
5217 function createMetrics(functionStartToken) {
5218 return {
5219 statementCount: 0,
5220 nestedBlockDepth: -1,
5221 ComplexityCount: 1,
5222 verifyMaxStatementsPerFunction: function () {
5223 if (option.maxstatements &&
5224 this.statementCount > option.maxstatements) {
5225 var message = "Too many statements per function (" + this.statementCount + ").";
5226 warning(message, functionStartToken);
5227 }
5228 },
5229
5230 verifyMaxParametersPerFunction: function (params) {
5231 params = params || [];
5232
5233 if (option.maxparams && params.length > option.maxparams) {
5234 var message = "Too many parameters per function (" + params.length + ").";
5235 warning(message, functionStartToken);
5236 }
5237 },
5238
5239 verifyMaxNestedBlockDepthPerFunction: function () {
5240 if (option.maxdepth &&
5241 this.nestedBlockDepth > 0 &&
5242 this.nestedBlockDepth === option.maxdepth + 1) {
5243 var message = "Blocks are nested too deeply (" + this.nestedBlockDepth + ").";
5244 warning(message);
5245 }
5246 },
5247
5248 verifyMaxComplexityPerFunction: function () {
5249 var max = option.maxcomplexity;
5250 var cc = this.ComplexityCount;
5251 if (max && cc > max) {
5252 var message = "Cyclomatic complexity is too high per function (" + cc + ").";
5253 warning(message, functionStartToken);
5254 }
5255 }
5256 };
5257 }
5258
5259 function increaseComplexityCount() {
5260 funct["(metrics)"].ComplexityCount += 1;
5261 }
5262
5263
5264 (function (x) {
5265 x.nud = function () {
5266 var b, f, i, p, t;
5267 var props = {}; // All properties, including accessors
5268
5269 function saveProperty(name, token) {
5270 if (props[name] && is_own(props, name))
5271 warning("Duplicate member '{a}'.", nexttoken, i);
5272 else
5273 props[name] = {};
5274
5275 props[name].basic = true;
5276 props[name].basicToken = token;
5277 }
5278
5279 function saveSetter(name, token) {
5280 if (props[name] && is_own(props, name)) {
5281 if (props[name].basic || props[name].setter)
5282 warning("Duplicate member '{a}'.", nexttoken, i);
5283 } else {
5284 props[name] = {};
5285 }
5286
5287 props[name].setter = true;
5288 props[name].setterToken = token;
5289 }
5290
5291 function saveGetter(name) {
5292 if (props[name] && is_own(props, name)) {
5293 if (props[name].basic || props[name].getter)
5294 warning("Duplicate member '{a}'.", nexttoken, i);
5295 } else {
5296 props[name] = {};
5297 }
5298
5299 props[name].getter = true;
5300 props[name].getterToken = token;
5301 }
5302
5303 b = token.line !== nexttoken.line;
5304 if (b) {
5305 indent += option.indent;
5306 if (nexttoken.from === indent + option.indent) {
5307 indent += option.indent;
5308 }
5309 }
5310 for (;;) {
5311 if (nexttoken.id === "}") {
5312 break;
5313 }
5314 if (b) {
5315 indentation();
5316 }
5317 if (nexttoken.value === "get" && peek().id !== ":") {
5318 advance("get");
5319 if (!option.es5) {
5320 error("get/set are ES5 features.");
5321 }
5322 i = property_name();
5323 if (!i) {
5324 error("Missing property name.");
5325 }
5326 saveGetter(i);
5327 t = nexttoken;
5328 adjacent(token, nexttoken);
5329 f = doFunction();
5330 p = f["(params)"];
5331 if (p) {
5332 warning("Unexpected parameter '{a}' in get {b} function.", t, p[0], i);
5333 }
5334 adjacent(token, nexttoken);
5335 } else if (nexttoken.value === "set" && peek().id !== ":") {
5336 advance("set");
5337 if (!option.es5) {
5338 error("get/set are ES5 features.");
5339 }
5340 i = property_name();
5341 if (!i) {
5342 error("Missing property name.");
5343 }
5344 saveSetter(i, nexttoken);
5345 t = nexttoken;
5346 adjacent(token, nexttoken);
5347 f = doFunction();
5348 p = f["(params)"];
5349 if (!p || p.length !== 1) {
5350 warning("Expected a single parameter in set {a} function.", t, i);
5351 }
5352 } else {
5353 i = property_name();
5354 saveProperty(i, nexttoken);
5355 if (typeof i !== "string") {
5356 break;
5357 }
5358 advance(":");
5359 nonadjacent(token, nexttoken);
5360 expression(10);
5361 }
5362
5363 countMember(i);
5364 if (nexttoken.id === ",") {
5365 comma();
5366 if (nexttoken.id === ",") {
5367 warning("Extra comma.", token);
5368 } else if (nexttoken.id === "}" && !option.es5) {
5369 warning("Extra comma.", token);
5370 }
5371 } else {
5372 break;
5373 }
5374 }
5375 if (b) {
5376 indent -= option.indent;
5377 indentation();
5378 }
5379 advance("}", this);
5380 if (option.es5) {
5381 for (var name in props) {
5382 if (is_own(props, name) && props[name].setter && !props[name].getter) {
5383 warning("Setter is defined without getter.", props[name].setterToken);
5384 }
5385 }
5386 }
5387 return this;
5388 };
5389 x.fud = function () {
5390 error("Expected to see a statement and instead saw a block.", token);
5391 };
5392 }(delim("{")));
5393
5394 useESNextSyntax = function () {
5395 var conststatement = stmt("const", function (prefix) {
5396 var id, name, value;
5397
5398 this.first = [];
5399 for (;;) {
5400 nonadjacent(token, nexttoken);
5401 id = identifier();
5402 if (funct[id] === "const") {
5403 warning("const '" + id + "' has already been declared");
5404 }
5405 if (funct["(global)"] && predefined[id] === false) {
5406 warning("Redefinition of '{a}'.", token, id);
5407 }
5408 addlabel(id, "const");
5409 if (prefix) {
5410 break;
5411 }
5412 name = token;
5413 this.first.push(token);
5414
5415 if (nexttoken.id !== "=") {
5416 warning("const " +
5417 "'{a}' is initialized to 'undefined'.", token, id);
5418 }
5419
5420 if (nexttoken.id === "=") {
5421 nonadjacent(token, nexttoken);
5422 advance("=");
5423 nonadjacent(token, nexttoken);
5424 if (nexttoken.id === "undefined") {
5425 warning("It is not necessary to initialize " +
5426 "'{a}' to 'undefined'.", token, id);
5427 }
5428 if (peek(0).id === "=" && nexttoken.identifier) {
5429 error("Constant {a} was not declared correctly.",
5430 nexttoken, nexttoken.value);
5431 }
5432 value = expression(0);
5433 name.first = value;
5434 }
5435
5436 if (nexttoken.id !== ",") {
5437 break;
5438 }
5439 comma();
5440 }
5441 return this;
5442 });
5443 conststatement.exps = true;
5444 };
5445
5446 var varstatement = stmt("var", function (prefix) {
5447 var id, name, value;
5448
5449 if (funct["(onevar)"] && option.onevar) {
5450 warning("Too many var statements.");
5451 } else if (!funct["(global)"]) {
5452 funct["(onevar)"] = true;
5453 }
5454
5455 this.first = [];
5456
5457 for (;;) {
5458 nonadjacent(token, nexttoken);
5459 id = identifier();
5460
5461 if (option.esnext && funct[id] === "const") {
5462 warning("const '" + id + "' has already been declared");
5463 }
5464
5465 if (funct["(global)"] && predefined[id] === false) {
5466 warning("Redefinition of '{a}'.", token, id);
5467 }
5468
5469 addlabel(id, "unused", token);
5470
5471 if (prefix) {
5472 break;
5473 }
5474
5475 name = token;
5476 this.first.push(token);
5477
5478 if (nexttoken.id === "=") {
5479 nonadjacent(token, nexttoken);
5480 advance("=");
5481 nonadjacent(token, nexttoken);
5482 if (nexttoken.id === "undefined") {
5483 warning("It is not necessary to initialize '{a}' to 'undefined'.", token, id);
5484 }
5485 if (peek(0).id === "=" && nexttoken.identifier) {
5486 error("Variable {a} was not declared correctly.",
5487 nexttoken, nexttoken.value);
5488 }
5489 value = expression(0);
5490 name.first = value;
5491 }
5492 if (nexttoken.id !== ",") {
5493 break;
5494 }
5495 comma();
5496 }
5497 return this;
5498 });
5499 varstatement.exps = true;
5500
5501 blockstmt("function", function () {
5502 if (inblock) {
5503 warning("Function declarations should not be placed in blocks. " +
5504 "Use a function expression or move the statement to the top of " +
5505 "the outer function.", token);
5506
5507 }
5508 var i = identifier();
5509 if (option.esnext && funct[i] === "const") {
5510 warning("const '" + i + "' has already been declared");
5511 }
5512 adjacent(token, nexttoken);
5513 addlabel(i, "unction", token);
5514
5515 doFunction(i, { statement: true });
5516 if (nexttoken.id === "(" && nexttoken.line === token.line) {
5517 error(
5518 "Function declarations are not invocable. Wrap the whole function invocation in parens.");
5519 }
5520 return this;
5521 });
5522
5523 prefix("function", function () {
5524 var i = optionalidentifier();
5525 if (i) {
5526 adjacent(token, nexttoken);
5527 } else {
5528 nonadjacent(token, nexttoken);
5529 }
5530 doFunction(i);
5531 if (!option.loopfunc && funct["(loopage)"]) {
5532 warning("Don't make functions within a loop.");
5533 }
5534 return this;
5535 });
5536
5537 blockstmt("if", function () {
5538 var t = nexttoken;
5539 increaseComplexityCount();
5540 advance("(");
5541 nonadjacent(this, t);
5542 nospace();
5543 expression(20);
5544 if (nexttoken.id === "=") {
5545 if (!option.boss)
5546 warning("Assignment in conditional expression");
5547 advance("=");
5548 expression(20);
5549 }
5550 advance(")", t);
5551 nospace(prevtoken, token);
5552 block(true, true);
5553 if (nexttoken.id === "else") {
5554 nonadjacent(token, nexttoken);
5555 advance("else");
5556 if (nexttoken.id === "if" || nexttoken.id === "switch") {
5557 statement(true);
5558 } else {
5559 block(true, true);
5560 }
5561 }
5562 return this;
5563 });
5564
5565 blockstmt("try", function () {
5566 var b;
5567
5568 function doCatch() {
5569 var oldScope = scope;
5570 var e;
5571
5572 advance("catch");
5573 nonadjacent(token, nexttoken);
5574 advance("(");
5575
5576 scope = Object.create(oldScope);
5577
5578 e = nexttoken.value;
5579 if (nexttoken.type !== "(identifier)") {
5580 e = null;
5581 warning("Expected an identifier and instead saw '{a}'.", nexttoken, e);
5582 }
5583
5584 advance();
5585 advance(")");
5586
5587 funct = {
5588 "(name)" : "(catch)",
5589 "(line)" : nexttoken.line,
5590 "(character)": nexttoken.character,
5591 "(context)" : funct,
5592 "(breakage)" : funct["(breakage)"],
5593 "(loopage)" : funct["(loopage)"],
5594 "(scope)" : scope,
5595 "(statement)": false,
5596 "(metrics)" : createMetrics(nexttoken),
5597 "(catch)" : true,
5598 "(tokens)" : {}
5599 };
5600
5601 if (e) {
5602 addlabel(e, "exception");
5603 }
5604
5605 token.funct = funct;
5606 functions.push(funct);
5607
5608 block(false);
5609
5610 scope = oldScope;
5611
5612 funct["(last)"] = token.line;
5613 funct["(lastcharacter)"] = token.character;
5614 funct = funct["(context)"];
5615 }
5616
5617 block(false);
5618
5619 if (nexttoken.id === "catch") {
5620 increaseComplexityCount();
5621 doCatch();
5622 b = true;
5623 }
5624
5625 if (nexttoken.id === "finally") {
5626 advance("finally");
5627 block(false);
5628 return;
5629 } else if (!b) {
5630 error("Expected '{a}' and instead saw '{b}'.",
5631 nexttoken, "catch", nexttoken.value);
5632 }
5633
5634 return this;
5635 });
5636
5637 blockstmt("while", function () {
5638 var t = nexttoken;
5639 funct["(breakage)"] += 1;
5640 funct["(loopage)"] += 1;
5641 increaseComplexityCount();
5642 advance("(");
5643 nonadjacent(this, t);
5644 nospace();
5645 expression(20);
5646 if (nexttoken.id === "=") {
5647 if (!option.boss)
5648 warning("Assignment in conditional expression");
5649 advance("=");
5650 expression(20);
5651 }
5652 advance(")", t);
5653 nospace(prevtoken, token);
5654 block(true, true);
5655 funct["(breakage)"] -= 1;
5656 funct["(loopage)"] -= 1;
5657 return this;
5658 }).labelled = true;
5659
5660 blockstmt("with", function () {
5661 var t = nexttoken;
5662 if (directive["use strict"]) {
5663 error("'with' is not allowed in strict mode.", token);
5664 } else if (!option.withstmt) {
5665 warning("Don't use 'with'.", token);
5666 }
5667
5668 advance("(");
5669 nonadjacent(this, t);
5670 nospace();
5671 expression(0);
5672 advance(")", t);
5673 nospace(prevtoken, token);
5674 block(true, true);
5675
5676 return this;
5677 });
5678
5679 blockstmt("switch", function () {
5680 var t = nexttoken,
5681 g = false;
5682 funct["(breakage)"] += 1;
5683 advance("(");
5684 nonadjacent(this, t);
5685 nospace();
5686 this.condition = expression(20);
5687 advance(")", t);
5688 nospace(prevtoken, token);
5689 nonadjacent(token, nexttoken);
5690 t = nexttoken;
5691 advance("{");
5692 nonadjacent(token, nexttoken);
5693 indent += option.indent;
5694 this.cases = [];
5695 for (;;) {
5696 switch (nexttoken.id) {
5697 case "case":
5698 switch (funct["(verb)"]) {
5699 case "break":
5700 case "case":
5701 case "continue":
5702 case "return":
5703 case "switch":
5704 case "throw":
5705 break;
5706 default:
5707 if (!ft.test(lines[nexttoken.line - 2])) {
5708 warning(
5709 "Expected a 'break' statement before 'case'.",
5710 token);
5711 }
5712 }
5713 indentation(-option.indent);
5714 advance("case");
5715 this.cases.push(expression(20));
5716 increaseComplexityCount();
5717 g = true;
5718 advance(":");
5719 funct["(verb)"] = "case";
5720 break;
5721 case "default":
5722 switch (funct["(verb)"]) {
5723 case "break":
5724 case "continue":
5725 case "return":
5726 case "throw":
5727 break;
5728 default:
5729 if (!ft.test(lines[nexttoken.line - 2])) {
5730 warning(
5731 "Expected a 'break' statement before 'default'.",
5732 token);
5733 }
5734 }
5735 indentation(-option.indent);
5736 advance("default");
5737 g = true;
5738 advance(":");
5739 break;
5740 case "}":
5741 indent -= option.indent;
5742 indentation();
5743 advance("}", t);
5744 if (this.cases.length === 1 || this.condition.id === "true" ||
5745 this.condition.id === "false") {
5746 if (!option.onecase)
5747 warning("This 'switch' should be an 'if'.", this);
5748 }
5749 funct["(breakage)"] -= 1;
5750 funct["(verb)"] = undefined;
5751 return;
5752 case "(end)":
5753 error("Missing '{a}'.", nexttoken, "}");
5754 return;
5755 default:
5756 if (g) {
5757 switch (token.id) {
5758 case ",":
5759 error("Each value should have its own case label.");
5760 return;
5761 case ":":
5762 g = false;
5763 statements();
5764 break;
5765 default:
5766 error("Missing ':' on a case clause.", token);
5767 return;
5768 }
5769 } else {
5770 if (token.id === ":") {
5771 advance(":");
5772 error("Unexpected '{a}'.", token, ":");
5773 statements();
5774 } else {
5775 error("Expected '{a}' and instead saw '{b}'.",
5776 nexttoken, "case", nexttoken.value);
5777 return;
5778 }
5779 }
5780 }
5781 }
5782 }).labelled = true;
5783
5784 stmt("debugger", function () {
5785 if (!option.debug) {
5786 warning("All 'debugger' statements should be removed.");
5787 }
5788 return this;
5789 }).exps = true;
5790
5791 (function () {
5792 var x = stmt("do", function () {
5793 funct["(breakage)"] += 1;
5794 funct["(loopage)"] += 1;
5795 increaseComplexityCount();
5796
5797 this.first = block(true);
5798 advance("while");
5799 var t = nexttoken;
5800 nonadjacent(token, t);
5801 advance("(");
5802 nospace();
5803 expression(20);
5804 if (nexttoken.id === "=") {
5805 if (!option.boss)
5806 warning("Assignment in conditional expression");
5807 advance("=");
5808 expression(20);
5809 }
5810 advance(")", t);
5811 nospace(prevtoken, token);
5812 funct["(breakage)"] -= 1;
5813 funct["(loopage)"] -= 1;
5814 return this;
5815 });
5816 x.labelled = true;
5817 x.exps = true;
5818 }());
5819
5820 blockstmt("for", function () {
5821 var s, t = nexttoken;
5822 funct["(breakage)"] += 1;
5823 funct["(loopage)"] += 1;
5824 increaseComplexityCount();
5825 advance("(");
5826 nonadjacent(this, t);
5827 nospace();
5828 if (peek(nexttoken.id === "var" ? 1 : 0).id === "in") {
5829 if (nexttoken.id === "var") {
5830 advance("var");
5831 varstatement.fud.call(varstatement, true);
5832 } else {
5833 switch (funct[nexttoken.value]) {
5834 case "unused":
5835 funct[nexttoken.value] = "var";
5836 break;
5837 case "var":
5838 break;
5839 default:
5840 warning("Bad for in variable '{a}'.",
5841 nexttoken, nexttoken.value);
5842 }
5843 advance();
5844 }
5845 advance("in");
5846 expression(20);
5847 advance(")", t);
5848 s = block(true, true);
5849 if (option.forin && s && (s.length > 1 || typeof s[0] !== "object" ||
5850 s[0].value !== "if")) {
5851 warning("The body of a for in should be wrapped in an if statement to filter " +
5852 "unwanted properties from the prototype.", this);
5853 }
5854 funct["(breakage)"] -= 1;
5855 funct["(loopage)"] -= 1;
5856 return this;
5857 } else {
5858 if (nexttoken.id !== ";") {
5859 if (nexttoken.id === "var") {
5860 advance("var");
5861 varstatement.fud.call(varstatement);
5862 } else {
5863 for (;;) {
5864 expression(0, "for");
5865 if (nexttoken.id !== ",") {
5866 break;
5867 }
5868 comma();
5869 }
5870 }
5871 }
5872 nolinebreak(token);
5873 advance(";");
5874 if (nexttoken.id !== ";") {
5875 expression(20);
5876 if (nexttoken.id === "=") {
5877 if (!option.boss)
5878 warning("Assignment in conditional expression");
5879 advance("=");
5880 expression(20);
5881 }
5882 }
5883 nolinebreak(token);
5884 advance(";");
5885 if (nexttoken.id === ";") {
5886 error("Expected '{a}' and instead saw '{b}'.",
5887 nexttoken, ")", ";");
5888 }
5889 if (nexttoken.id !== ")") {
5890 for (;;) {
5891 expression(0, "for");
5892 if (nexttoken.id !== ",") {
5893 break;
5894 }
5895 comma();
5896 }
5897 }
5898 advance(")", t);
5899 nospace(prevtoken, token);
5900 block(true, true);
5901 funct["(breakage)"] -= 1;
5902 funct["(loopage)"] -= 1;
5903 return this;
5904 }
5905 }).labelled = true;
5906
5907
5908 stmt("break", function () {
5909 var v = nexttoken.value;
5910
5911 if (funct["(breakage)"] === 0)
5912 warning("Unexpected '{a}'.", nexttoken, this.value);
5913
5914 if (!option.asi)
5915 nolinebreak(this);
5916
5917 if (nexttoken.id !== ";") {
5918 if (token.line === nexttoken.line) {
5919 if (funct[v] !== "label") {
5920 warning("'{a}' is not a statement label.", nexttoken, v);
5921 } else if (scope[v] !== funct) {
5922 warning("'{a}' is out of scope.", nexttoken, v);
5923 }
5924 this.first = nexttoken;
5925 advance();
5926 }
5927 }
5928 reachable("break");
5929 return this;
5930 }).exps = true;
5931
5932
5933 stmt("continue", function () {
5934 var v = nexttoken.value;
5935
5936 if (funct["(breakage)"] === 0)
5937 warning("Unexpected '{a}'.", nexttoken, this.value);
5938
5939 if (!option.asi)
5940 nolinebreak(this);
5941
5942 if (nexttoken.id !== ";") {
5943 if (token.line === nexttoken.line) {
5944 if (funct[v] !== "label") {
5945 warning("'{a}' is not a statement label.", nexttoken, v);
5946 } else if (scope[v] !== funct) {
5947 warning("'{a}' is out of scope.", nexttoken, v);
5948 }
5949 this.first = nexttoken;
5950 advance();
5951 }
5952 } else if (!funct["(loopage)"]) {
5953 warning("Unexpected '{a}'.", nexttoken, this.value);
5954 }
5955 reachable("continue");
5956 return this;
5957 }).exps = true;
5958
5959
5960 stmt("return", function () {
5961 if (this.line === nexttoken.line) {
5962 if (nexttoken.id === "(regexp)")
5963 warning("Wrap the /regexp/ literal in parens to disambiguate the slash operator.");
5964
5965 if (nexttoken.id !== ";" && !nexttoken.reach) {
5966 nonadjacent(token, nexttoken);
5967 if (peek().value === "=" && !option.boss) {
5968 warningAt("Did you mean to return a conditional instead of an assignment?",
5969 token.line, token.character + 1);
5970 }
5971 this.first = expression(0);
5972 }
5973 } else if (!option.asi) {
5974 nolinebreak(this); // always warn (Line breaking error)
5975 }
5976 reachable("return");
5977 return this;
5978 }).exps = true;
5979
5980
5981 stmt("throw", function () {
5982 nolinebreak(this);
5983 nonadjacent(token, nexttoken);
5984 this.first = expression(20);
5985 reachable("throw");
5986 return this;
5987 }).exps = true;
5988
5989 reserve("class");
5990 reserve("const");
5991 reserve("enum");
5992 reserve("export");
5993 reserve("extends");
5994 reserve("import");
5995 reserve("super");
5996
5997 reserve("let");
5998 reserve("yield");
5999 reserve("implements");
6000 reserve("interface");
6001 reserve("package");
6002 reserve("private");
6003 reserve("protected");
6004 reserve("public");
6005 reserve("static");
6006
6007 function jsonValue() {
6008
6009 function jsonObject() {
6010 var o = {}, t = nexttoken;
6011 advance("{");
6012 if (nexttoken.id !== "}") {
6013 for (;;) {
6014 if (nexttoken.id === "(end)") {
6015 error("Missing '}' to match '{' from line {a}.",
6016 nexttoken, t.line);
6017 } else if (nexttoken.id === "}") {
6018 warning("Unexpected comma.", token);
6019 break;
6020 } else if (nexttoken.id === ",") {
6021 error("Unexpected comma.", nexttoken);
6022 } else if (nexttoken.id !== "(string)") {
6023 warning("Expected a string and instead saw {a}.",
6024 nexttoken, nexttoken.value);
6025 }
6026 if (o[nexttoken.value] === true) {
6027 warning("Duplicate key '{a}'.",
6028 nexttoken, nexttoken.value);
6029 } else if ((nexttoken.value === "__proto__" &&
6030 !option.proto) || (nexttoken.value === "__iterator__" &&
6031 !option.iterator)) {
6032 warning("The '{a}' key may produce unexpected results.",
6033 nexttoken, nexttoken.value);
6034 } else {
6035 o[nexttoken.value] = true;
6036 }
6037 advance();
6038 advance(":");
6039 jsonValue();
6040 if (nexttoken.id !== ",") {
6041 break;
6042 }
6043 advance(",");
6044 }
6045 }
6046 advance("}");
6047 }
6048
6049 function jsonArray() {
6050 var t = nexttoken;
6051 advance("[");
6052 if (nexttoken.id !== "]") {
6053 for (;;) {
6054 if (nexttoken.id === "(end)") {
6055 error("Missing ']' to match '[' from line {a}.",
6056 nexttoken, t.line);
6057 } else if (nexttoken.id === "]") {
6058 warning("Unexpected comma.", token);
6059 break;
6060 } else if (nexttoken.id === ",") {
6061 error("Unexpected comma.", nexttoken);
6062 }
6063 jsonValue();
6064 if (nexttoken.id !== ",") {
6065 break;
6066 }
6067 advance(",");
6068 }
6069 }
6070 advance("]");
6071 }
6072
6073 switch (nexttoken.id) {
6074 case "{":
6075 jsonObject();
6076 break;
6077 case "[":
6078 jsonArray();
6079 break;
6080 case "true":
6081 case "false":
6082 case "null":
6083 case "(number)":
6084 case "(string)":
6085 advance();
6086 break;
6087 case "-":
6088 advance("-");
6089 if (token.character !== nexttoken.from) {
6090 warning("Unexpected space after '-'.", token);
6091 }
6092 adjacent(token, nexttoken);
6093 advance("(number)");
6094 break;
6095 default:
6096 error("Expected a JSON value.", nexttoken);
6097 }
6098 }
6099 var itself = function (s, o, g) {
6100 var a, i, k, x;
6101 var optionKeys;
6102 var newOptionObj = {};
6103
6104 if (o && o.scope) {
6105 JSHINT.scope = o.scope;
6106 } else {
6107 JSHINT.errors = [];
6108 JSHINT.undefs = [];
6109 JSHINT.internals = [];
6110 JSHINT.blacklist = {};
6111 JSHINT.scope = "(main)";
6112 }
6113
6114 predefined = Object.create(standard);
6115 declared = Object.create(null);
6116 combine(predefined, g || {});
6117
6118 if (o) {
6119 a = o.predef;
6120 if (a) {
6121 if (!Array.isArray(a) && typeof a === "object") {
6122 a = Object.keys(a);
6123 }
6124 a.forEach(function (item) {
6125 var slice;
6126 if (item[0] === "-") {
6127 slice = item.slice(1);
6128 JSHINT.blacklist[slice] = slice;
6129 } else {
6130 predefined[item] = true;
6131 }
6132 });
6133 }
6134
6135 optionKeys = Object.keys(o);
6136 for (x = 0; x < optionKeys.length; x++) {
6137 newOptionObj[optionKeys[x]] = o[optionKeys[x]];
6138
6139 if (optionKeys[x] === "newcap" && o[optionKeys[x]] === false)
6140 newOptionObj["(explicitNewcap)"] = true;
6141
6142 if (optionKeys[x] === "indent")
6143 newOptionObj.white = true;
6144 }
6145 }
6146
6147 option = newOptionObj;
6148
6149 option.indent = option.indent || 4;
6150 option.maxerr = option.maxerr || 50;
6151
6152 tab = "";
6153 for (i = 0; i < option.indent; i += 1) {
6154 tab += " ";
6155 }
6156 indent = 1;
6157 global = Object.create(predefined);
6158 scope = global;
6159 funct = {
6160 "(global)": true,
6161 "(name)": "(global)",
6162 "(scope)": scope,
6163 "(breakage)": 0,
6164 "(loopage)": 0,
6165 "(tokens)": {},
6166 "(metrics)": createMetrics(nexttoken)
6167 };
6168 functions = [funct];
6169 urls = [];
6170 stack = null;
6171 member = {};
6172 membersOnly = null;
6173 implied = {};
6174 inblock = false;
6175 lookahead = [];
6176 jsonmode = false;
6177 warnings = 0;
6178 lines = [];
6179 unuseds = [];
6180
6181 if (!isString(s) && !Array.isArray(s)) {
6182 errorAt("Input is neither a string nor an array of strings.", 0);
6183 return false;
6184 }
6185
6186 if (isString(s) && /^\s*$/g.test(s)) {
6187 errorAt("Input is an empty string.", 0);
6188 return false;
6189 }
6190
6191 if (s.length === 0) {
6192 errorAt("Input is an empty array.", 0);
6193 return false;
6194 }
6195
6196 lex.init(s);
6197
6198 prereg = true;
6199 directive = {};
6200
6201 prevtoken = token = nexttoken = syntax["(begin)"];
6202 for (var name in o) {
6203 if (is_own(o, name)) {
6204 checkOption(name, token);
6205 }
6206 }
6207
6208 assume();
6209 combine(predefined, g || {});
6210 comma.first = true;
6211 quotmark = undefined;
6212
6213 try {
6214 advance();
6215 switch (nexttoken.id) {
6216 case "{":
6217 case "[":
6218 option.laxbreak = true;
6219 jsonmode = true;
6220 jsonValue();
6221 break;
6222 default:
6223 directives();
6224 if (directive["use strict"] && !option.globalstrict) {
6225 warning("Use the function form of \"use strict\".", prevtoken);
6226 }
6227
6228 statements();
6229 }
6230 advance((nexttoken && nexttoken.value !== ".") ? "(end)" : undefined);
6231
6232 var markDefined = function (name, context) {
6233 do {
6234 if (typeof context[name] === "string") {
6235
6236 if (context[name] === "unused")
6237 context[name] = "var";
6238 else if (context[name] === "unction")
6239 context[name] = "closure";
6240
6241 return true;
6242 }
6243
6244 context = context["(context)"];
6245 } while (context);
6246
6247 return false;
6248 };
6249
6250 var clearImplied = function (name, line) {
6251 if (!implied[name])
6252 return;
6253
6254 var newImplied = [];
6255 for (var i = 0; i < implied[name].length; i += 1) {
6256 if (implied[name][i] !== line)
6257 newImplied.push(implied[name][i]);
6258 }
6259
6260 if (newImplied.length === 0)
6261 delete implied[name];
6262 else
6263 implied[name] = newImplied;
6264 };
6265
6266 var warnUnused = function (name, token) {
6267 var line = token.line;
6268 var chr = token.character;
6269
6270 if (option.unused)
6271 warningAt("'{a}' is defined but never used.", line, chr, name);
6272
6273 unuseds.push({
6274 name: name,
6275 line: line,
6276 character: chr
6277 });
6278 };
6279
6280 var checkUnused = function (func, key) {
6281 var type = func[key];
6282 var token = func["(tokens)"][key];
6283
6284 if (key.charAt(0) === "(")
6285 return;
6286
6287 if (type !== "unused" && type !== "unction")
6288 return;
6289 if (func["(params)"] && func["(params)"].indexOf(key) !== -1)
6290 return;
6291
6292 warnUnused(key, token);
6293 };
6294 for (i = 0; i < JSHINT.undefs.length; i += 1) {
6295 k = JSHINT.undefs[i].slice(0);
6296
6297 if (markDefined(k[2].value, k[0])) {
6298 clearImplied(k[2].value, k[2].line);
6299 } else {
6300 warning.apply(warning, k.slice(1));
6301 }
6302 }
6303
6304 functions.forEach(function (func) {
6305 for (var key in func) {
6306 if (is_own(func, key)) {
6307 checkUnused(func, key);
6308 }
6309 }
6310
6311 if (!func["(params)"])
6312 return;
6313
6314 var params = func["(params)"].slice();
6315 var param = params.pop();
6316 var type;
6317
6318 while (param) {
6319 type = func[param];
6320
6321 if (param === "undefined")
6322 return;
6323
6324 if (type !== "unused" && type !== "unction")
6325 return;
6326
6327 warnUnused(param, func["(tokens)"][param]);
6328 param = params.pop();
6329 }
6330 });
6331
6332 for (var key in declared) {
6333 if (is_own(declared, key) && !is_own(global, key)) {
6334 warnUnused(key, declared[key]);
6335 }
6336 }
6337 } catch (e) {
6338 if (e) {
6339 var nt = nexttoken || {};
6340 JSHINT.errors.push({
6341 raw : e.raw,
6342 reason : e.message,
6343 line : e.line || nt.line,
6344 character : e.character || nt.from
6345 }, null);
6346 }
6347 }
6348
6349 if (JSHINT.scope === "(main)") {
6350 o = o || {};
6351
6352 for (i = 0; i < JSHINT.internals.length; i += 1) {
6353 k = JSHINT.internals[i];
6354 o.scope = k.elem;
6355 itself(k.value, o, g);
6356 }
6357 }
6358
6359 return JSHINT.errors.length === 0;
6360 };
6361 itself.data = function () {
6362 var data = {
6363 functions: [],
6364 options: option
6365 };
6366 var implieds = [];
6367 var members = [];
6368 var fu, f, i, j, n, globals;
6369
6370 if (itself.errors.length) {
6371 data.errors = itself.errors;
6372 }
6373
6374 if (jsonmode) {
6375 data.json = true;
6376 }
6377
6378 for (n in implied) {
6379 if (is_own(implied, n)) {
6380 implieds.push({
6381 name: n,
6382 line: implied[n]
6383 });
6384 }
6385 }
6386
6387 if (implieds.length > 0) {
6388 data.implieds = implieds;
6389 }
6390
6391 if (urls.length > 0) {
6392 data.urls = urls;
6393 }
6394
6395 globals = Object.keys(scope);
6396 if (globals.length > 0) {
6397 data.globals = globals;
6398 }
6399
6400 for (i = 1; i < functions.length; i += 1) {
6401 f = functions[i];
6402 fu = {};
6403
6404 for (j = 0; j < functionicity.length; j += 1) {
6405 fu[functionicity[j]] = [];
6406 }
6407
6408 for (j = 0; j < functionicity.length; j += 1) {
6409 if (fu[functionicity[j]].length === 0) {
6410 delete fu[functionicity[j]];
6411 }
6412 }
6413
6414 fu.name = f["(name)"];
6415 fu.param = f["(params)"];
6416 fu.line = f["(line)"];
6417 fu.character = f["(character)"];
6418 fu.last = f["(last)"];
6419 fu.lastcharacter = f["(lastcharacter)"];
6420 data.functions.push(fu);
6421 }
6422
6423 if (unuseds.length > 0) {
6424 data.unused = unuseds;
6425 }
6426
6427 members = [];
6428 for (n in member) {
6429 if (typeof member[n] === "number") {
6430 data.member = member;
6431 break;
6432 }
6433 }
6434
6435 return data;
6436 };
6437
6438 itself.jshint = itself;
6439
6440 return itself;
6441 }());
6442 if (typeof exports === "object" && exports) {
6443 exports.JSHINT = JSHINT;
6444 }
6445
6446 });
+0
-2256
try/ace/worker-json.js less more
0 "no use strict";
1 ;(function(window) {
2 if (typeof window.window != "undefined" && window.document) {
3 return;
4 }
5
6 window.console = {
7 log: function() {
8 var msgs = Array.prototype.slice.call(arguments, 0);
9 postMessage({type: "log", data: msgs});
10 },
11 error: function() {
12 var msgs = Array.prototype.slice.call(arguments, 0);
13 postMessage({type: "log", data: msgs});
14 }
15 };
16 window.window = window;
17 window.ace = window;
18
19 window.normalizeModule = function(parentId, moduleName) {
20 if (moduleName.indexOf("!") !== -1) {
21 var chunks = moduleName.split("!");
22 return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
23 }
24 if (moduleName.charAt(0) == ".") {
25 var base = parentId.split("/").slice(0, -1).join("/");
26 moduleName = base + "/" + moduleName;
27
28 while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
29 var previous = moduleName;
30 moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
31 }
32 }
33
34 return moduleName;
35 };
36
37 window.require = function(parentId, id) {
38 if (!id) {
39 id = parentId
40 parentId = null;
41 }
42 if (!id.charAt)
43 throw new Error("worker.js require() accepts only (parentId, id) as arguments");
44
45 id = normalizeModule(parentId, id);
46
47 var module = require.modules[id];
48 if (module) {
49 if (!module.initialized) {
50 module.initialized = true;
51 module.exports = module.factory().exports;
52 }
53 return module.exports;
54 }
55
56 var chunks = id.split("/");
57 chunks[0] = require.tlns[chunks[0]] || chunks[0];
58 var path = chunks.join("/") + ".js";
59
60 require.id = id;
61 importScripts(path);
62 return require(parentId, id);
63 };
64
65 require.modules = {};
66 require.tlns = {};
67
68 window.define = function(id, deps, factory) {
69 if (arguments.length == 2) {
70 factory = deps;
71 if (typeof id != "string") {
72 deps = id;
73 id = require.id;
74 }
75 } else if (arguments.length == 1) {
76 factory = id;
77 id = require.id;
78 }
79
80 if (id.indexOf("text!") === 0)
81 return;
82
83 var req = function(deps, factory) {
84 return require(id, deps, factory);
85 };
86
87 require.modules[id] = {
88 factory: function() {
89 var module = {
90 exports: {}
91 };
92 var returnExports = factory(req, module.exports, module);
93 if (returnExports)
94 module.exports = returnExports;
95 return module;
96 }
97 };
98 };
99
100 window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
101 require.tlns = topLevelNamespaces;
102 }
103
104 window.initSender = function initSender() {
105
106 var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
107 var oop = require("ace/lib/oop");
108
109 var Sender = function() {};
110
111 (function() {
112
113 oop.implement(this, EventEmitter);
114
115 this.callback = function(data, callbackId) {
116 postMessage({
117 type: "call",
118 id: callbackId,
119 data: data
120 });
121 };
122
123 this.emit = function(name, data) {
124 postMessage({
125 type: "event",
126 name: name,
127 data: data
128 });
129 };
130
131 }).call(Sender.prototype);
132
133 return new Sender();
134 }
135
136 window.main = null;
137 window.sender = null;
138
139 window.onmessage = function(e) {
140 var msg = e.data;
141 if (msg.command) {
142 if (main[msg.command])
143 main[msg.command].apply(main, msg.args);
144 else
145 throw new Error("Unknown command:" + msg.command);
146 }
147 else if (msg.init) {
148 initBaseUrls(msg.tlns);
149 require("ace/lib/es5-shim");
150 sender = initSender();
151 var clazz = require(msg.module)[msg.classname];
152 main = new clazz(sender);
153 }
154 else if (msg.event && sender) {
155 sender._emit(msg.event, msg.data);
156 }
157 };
158 })(this);
159
160 define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
161
162
163 var EventEmitter = {};
164 var stopPropagation = function() { this.propagationStopped = true; };
165 var preventDefault = function() { this.defaultPrevented = true; };
166
167 EventEmitter._emit =
168 EventEmitter._dispatchEvent = function(eventName, e) {
169 this._eventRegistry || (this._eventRegistry = {});
170 this._defaultHandlers || (this._defaultHandlers = {});
171
172 var listeners = this._eventRegistry[eventName] || [];
173 var defaultHandler = this._defaultHandlers[eventName];
174 if (!listeners.length && !defaultHandler)
175 return;
176
177 if (typeof e != "object" || !e)
178 e = {};
179
180 if (!e.type)
181 e.type = eventName;
182 if (!e.stopPropagation)
183 e.stopPropagation = stopPropagation;
184 if (!e.preventDefault)
185 e.preventDefault = preventDefault;
186
187 for (var i=0; i<listeners.length; i++) {
188 listeners[i](e, this);
189 if (e.propagationStopped)
190 break;
191 }
192
193 if (defaultHandler && !e.defaultPrevented)
194 return defaultHandler(e, this);
195 };
196
197
198 EventEmitter._signal = function(eventName, e) {
199 var listeners = (this._eventRegistry || {})[eventName];
200 if (!listeners)
201 return;
202
203 for (var i=0; i<listeners.length; i++)
204 listeners[i](e, this);
205 };
206
207 EventEmitter.once = function(eventName, callback) {
208 var _self = this;
209 callback && this.addEventListener(eventName, function newCallback() {
210 _self.removeEventListener(eventName, newCallback);
211 callback.apply(null, arguments);
212 });
213 };
214
215
216 EventEmitter.setDefaultHandler = function(eventName, callback) {
217 var handlers = this._defaultHandlers
218 if (!handlers)
219 handlers = this._defaultHandlers = {_disabled_: {}};
220
221 if (handlers[eventName]) {
222 var old = handlers[eventName];
223 var disabled = handlers._disabled_[eventName];
224 if (!disabled)
225 handlers._disabled_[eventName] = disabled = [];
226 disabled.push(old);
227 var i = disabled.indexOf(callback);
228 if (i != -1)
229 disabled.splice(i, 1);
230 }
231 handlers[eventName] = callback;
232 };
233 EventEmitter.removeDefaultHandler = function(eventName, callback) {
234 var handlers = this._defaultHandlers
235 if (!handlers)
236 return;
237 var disabled = handlers._disabled_[eventName];
238
239 if (handlers[eventName] == callback) {
240 var old = handlers[eventName];
241 if (disabled)
242 this.setDefaultHandler(eventName, disabled.pop());
243 } else if (disabled) {
244 var i = disabled.indexOf(callback);
245 if (i != -1)
246 disabled.splice(i, 1);
247 }
248 };
249
250 EventEmitter.on =
251 EventEmitter.addEventListener = function(eventName, callback, capturing) {
252 this._eventRegistry = this._eventRegistry || {};
253
254 var listeners = this._eventRegistry[eventName];
255 if (!listeners)
256 listeners = this._eventRegistry[eventName] = [];
257
258 if (listeners.indexOf(callback) == -1)
259 listeners[capturing ? "unshift" : "push"](callback);
260 return callback;
261 };
262
263 EventEmitter.off =
264 EventEmitter.removeListener =
265 EventEmitter.removeEventListener = function(eventName, callback) {
266 this._eventRegistry = this._eventRegistry || {};
267
268 var listeners = this._eventRegistry[eventName];
269 if (!listeners)
270 return;
271
272 var index = listeners.indexOf(callback);
273 if (index !== -1)
274 listeners.splice(index, 1);
275 };
276
277 EventEmitter.removeAllListeners = function(eventName) {
278 if (this._eventRegistry) this._eventRegistry[eventName] = [];
279 };
280
281 exports.EventEmitter = EventEmitter;
282
283 });
284
285 define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
286
287
288 exports.inherits = (function() {
289 var tempCtor = function() {};
290 return function(ctor, superCtor) {
291 tempCtor.prototype = superCtor.prototype;
292 ctor.super_ = superCtor.prototype;
293 ctor.prototype = new tempCtor();
294 ctor.prototype.constructor = ctor;
295 };
296 }());
297
298 exports.mixin = function(obj, mixin) {
299 for (var key in mixin) {
300 obj[key] = mixin[key];
301 }
302 return obj;
303 };
304
305 exports.implement = function(proto, mixin) {
306 exports.mixin(proto, mixin);
307 };
308
309 });
310
311 define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) {
312
313 function Empty() {}
314
315 if (!Function.prototype.bind) {
316 Function.prototype.bind = function bind(that) { // .length is 1
317 var target = this;
318 if (typeof target != "function") {
319 throw new TypeError("Function.prototype.bind called on incompatible " + target);
320 }
321 var args = slice.call(arguments, 1); // for normal call
322 var bound = function () {
323
324 if (this instanceof bound) {
325
326 var result = target.apply(
327 this,
328 args.concat(slice.call(arguments))
329 );
330 if (Object(result) === result) {
331 return result;
332 }
333 return this;
334
335 } else {
336 return target.apply(
337 that,
338 args.concat(slice.call(arguments))
339 );
340
341 }
342
343 };
344 if(target.prototype) {
345 Empty.prototype = target.prototype;
346 bound.prototype = new Empty();
347 Empty.prototype = null;
348 }
349 return bound;
350 };
351 }
352 var call = Function.prototype.call;
353 var prototypeOfArray = Array.prototype;
354 var prototypeOfObject = Object.prototype;
355 var slice = prototypeOfArray.slice;
356 var _toString = call.bind(prototypeOfObject.toString);
357 var owns = call.bind(prototypeOfObject.hasOwnProperty);
358 var defineGetter;
359 var defineSetter;
360 var lookupGetter;
361 var lookupSetter;
362 var supportsAccessors;
363 if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
364 defineGetter = call.bind(prototypeOfObject.__defineGetter__);
365 defineSetter = call.bind(prototypeOfObject.__defineSetter__);
366 lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
367 lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
368 }
369 if ([1,2].splice(0).length != 2) {
370 if(function() { // test IE < 9 to splice bug - see issue #138
371 function makeArray(l) {
372 var a = new Array(l+2);
373 a[0] = a[1] = 0;
374 return a;
375 }
376 var array = [], lengthBefore;
377
378 array.splice.apply(array, makeArray(20));
379 array.splice.apply(array, makeArray(26));
380
381 lengthBefore = array.length; //46
382 array.splice(5, 0, "XXX"); // add one element
383
384 lengthBefore + 1 == array.length
385
386 if (lengthBefore + 1 == array.length) {
387 return true;// has right splice implementation without bugs
388 }
389 }()) {//IE 6/7
390 var array_splice = Array.prototype.splice;
391 Array.prototype.splice = function(start, deleteCount) {
392 if (!arguments.length) {
393 return [];
394 } else {
395 return array_splice.apply(this, [
396 start === void 0 ? 0 : start,
397 deleteCount === void 0 ? (this.length - start) : deleteCount
398 ].concat(slice.call(arguments, 2)))
399 }
400 };
401 } else {//IE8
402 Array.prototype.splice = function(pos, removeCount){
403 var length = this.length;
404 if (pos > 0) {
405 if (pos > length)
406 pos = length;
407 } else if (pos == void 0) {
408 pos = 0;
409 } else if (pos < 0) {
410 pos = Math.max(length + pos, 0);
411 }
412
413 if (!(pos+removeCount < length))
414 removeCount = length - pos;
415
416 var removed = this.slice(pos, pos+removeCount);
417 var insert = slice.call(arguments, 2);
418 var add = insert.length;
419 if (pos === length) {
420 if (add) {
421 this.push.apply(this, insert);
422 }
423 } else {
424 var remove = Math.min(removeCount, length - pos);
425 var tailOldPos = pos + remove;
426 var tailNewPos = tailOldPos + add - remove;
427 var tailCount = length - tailOldPos;
428 var lengthAfterRemove = length - remove;
429
430 if (tailNewPos < tailOldPos) { // case A
431 for (var i = 0; i < tailCount; ++i) {
432 this[tailNewPos+i] = this[tailOldPos+i];
433 }
434 } else if (tailNewPos > tailOldPos) { // case B
435 for (i = tailCount; i--; ) {
436 this[tailNewPos+i] = this[tailOldPos+i];
437 }
438 } // else, add == remove (nothing to do)
439
440 if (add && pos === lengthAfterRemove) {
441 this.length = lengthAfterRemove; // truncate array
442 this.push.apply(this, insert);
443 } else {
444 this.length = lengthAfterRemove + add; // reserves space
445 for (i = 0; i < add; ++i) {
446 this[pos+i] = insert[i];
447 }
448 }
449 }
450 return removed;
451 };
452 }
453 }
454 if (!Array.isArray) {
455 Array.isArray = function isArray(obj) {
456 return _toString(obj) == "[object Array]";
457 };
458 }
459 var boxedString = Object("a"),
460 splitString = boxedString[0] != "a" || !(0 in boxedString);
461
462 if (!Array.prototype.forEach) {
463 Array.prototype.forEach = function forEach(fun /*, thisp*/) {
464 var object = toObject(this),
465 self = splitString && _toString(this) == "[object String]" ?
466 this.split("") :
467 object,
468 thisp = arguments[1],
469 i = -1,
470 length = self.length >>> 0;
471 if (_toString(fun) != "[object Function]") {
472 throw new TypeError(); // TODO message
473 }
474
475 while (++i < length) {
476 if (i in self) {
477 fun.call(thisp, self[i], i, object);
478 }
479 }
480 };
481 }
482 if (!Array.prototype.map) {
483 Array.prototype.map = function map(fun /*, thisp*/) {
484 var object = toObject(this),
485 self = splitString && _toString(this) == "[object String]" ?
486 this.split("") :
487 object,
488 length = self.length >>> 0,
489 result = Array(length),
490 thisp = arguments[1];
491 if (_toString(fun) != "[object Function]") {
492 throw new TypeError(fun + " is not a function");
493 }
494
495 for (var i = 0; i < length; i++) {
496 if (i in self)
497 result[i] = fun.call(thisp, self[i], i, object);
498 }
499 return result;
500 };
501 }
502 if (!Array.prototype.filter) {
503 Array.prototype.filter = function filter(fun /*, thisp */) {
504 var object = toObject(this),
505 self = splitString && _toString(this) == "[object String]" ?
506 this.split("") :
507 object,
508 length = self.length >>> 0,
509 result = [],
510 value,
511 thisp = arguments[1];
512 if (_toString(fun) != "[object Function]") {
513 throw new TypeError(fun + " is not a function");
514 }
515
516 for (var i = 0; i < length; i++) {
517 if (i in self) {
518 value = self[i];
519 if (fun.call(thisp, value, i, object)) {
520 result.push(value);
521 }
522 }
523 }
524 return result;
525 };
526 }
527 if (!Array.prototype.every) {
528 Array.prototype.every = function every(fun /*, thisp */) {
529 var object = toObject(this),
530 self = splitString && _toString(this) == "[object String]" ?
531 this.split("") :
532 object,
533 length = self.length >>> 0,
534 thisp = arguments[1];
535 if (_toString(fun) != "[object Function]") {
536 throw new TypeError(fun + " is not a function");
537 }
538
539 for (var i = 0; i < length; i++) {
540 if (i in self && !fun.call(thisp, self[i], i, object)) {
541 return false;
542 }
543 }
544 return true;
545 };
546 }
547 if (!Array.prototype.some) {
548 Array.prototype.some = function some(fun /*, thisp */) {
549 var object = toObject(this),
550 self = splitString && _toString(this) == "[object String]" ?
551 this.split("") :
552 object,
553 length = self.length >>> 0,
554 thisp = arguments[1];
555 if (_toString(fun) != "[object Function]") {
556 throw new TypeError(fun + " is not a function");
557 }
558
559 for (var i = 0; i < length; i++) {
560 if (i in self && fun.call(thisp, self[i], i, object)) {
561 return true;
562 }
563 }
564 return false;
565 };
566 }
567 if (!Array.prototype.reduce) {
568 Array.prototype.reduce = function reduce(fun /*, initial*/) {
569 var object = toObject(this),
570 self = splitString && _toString(this) == "[object String]" ?
571 this.split("") :
572 object,
573 length = self.length >>> 0;
574 if (_toString(fun) != "[object Function]") {
575 throw new TypeError(fun + " is not a function");
576 }
577 if (!length && arguments.length == 1) {
578 throw new TypeError("reduce of empty array with no initial value");
579 }
580
581 var i = 0;
582 var result;
583 if (arguments.length >= 2) {
584 result = arguments[1];
585 } else {
586 do {
587 if (i in self) {
588 result = self[i++];
589 break;
590 }
591 if (++i >= length) {
592 throw new TypeError("reduce of empty array with no initial value");
593 }
594 } while (true);
595 }
596
597 for (; i < length; i++) {
598 if (i in self) {
599 result = fun.call(void 0, result, self[i], i, object);
600 }
601 }
602
603 return result;
604 };
605 }
606 if (!Array.prototype.reduceRight) {
607 Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
608 var object = toObject(this),
609 self = splitString && _toString(this) == "[object String]" ?
610 this.split("") :
611 object,
612 length = self.length >>> 0;
613 if (_toString(fun) != "[object Function]") {
614 throw new TypeError(fun + " is not a function");
615 }
616 if (!length && arguments.length == 1) {
617 throw new TypeError("reduceRight of empty array with no initial value");
618 }
619
620 var result, i = length - 1;
621 if (arguments.length >= 2) {
622 result = arguments[1];
623 } else {
624 do {
625 if (i in self) {
626 result = self[i--];
627 break;
628 }
629 if (--i < 0) {
630 throw new TypeError("reduceRight of empty array with no initial value");
631 }
632 } while (true);
633 }
634
635 do {
636 if (i in this) {
637 result = fun.call(void 0, result, self[i], i, object);
638 }
639 } while (i--);
640
641 return result;
642 };
643 }
644 if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
645 Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
646 var self = splitString && _toString(this) == "[object String]" ?
647 this.split("") :
648 toObject(this),
649 length = self.length >>> 0;
650
651 if (!length) {
652 return -1;
653 }
654
655 var i = 0;
656 if (arguments.length > 1) {
657 i = toInteger(arguments[1]);
658 }
659 i = i >= 0 ? i : Math.max(0, length + i);
660 for (; i < length; i++) {
661 if (i in self && self[i] === sought) {
662 return i;
663 }
664 }
665 return -1;
666 };
667 }
668 if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
669 Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
670 var self = splitString && _toString(this) == "[object String]" ?
671 this.split("") :
672 toObject(this),
673 length = self.length >>> 0;
674
675 if (!length) {
676 return -1;
677 }
678 var i = length - 1;
679 if (arguments.length > 1) {
680 i = Math.min(i, toInteger(arguments[1]));
681 }
682 i = i >= 0 ? i : length - Math.abs(i);
683 for (; i >= 0; i--) {
684 if (i in self && sought === self[i]) {
685 return i;
686 }
687 }
688 return -1;
689 };
690 }
691 if (!Object.getPrototypeOf) {
692 Object.getPrototypeOf = function getPrototypeOf(object) {
693 return object.__proto__ || (
694 object.constructor ?
695 object.constructor.prototype :
696 prototypeOfObject
697 );
698 };
699 }
700 if (!Object.getOwnPropertyDescriptor) {
701 var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
702 "non-object: ";
703 Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
704 if ((typeof object != "object" && typeof object != "function") || object === null)
705 throw new TypeError(ERR_NON_OBJECT + object);
706 if (!owns(object, property))
707 return;
708
709 var descriptor, getter, setter;
710 descriptor = { enumerable: true, configurable: true };
711 if (supportsAccessors) {
712 var prototype = object.__proto__;
713 object.__proto__ = prototypeOfObject;
714
715 var getter = lookupGetter(object, property);
716 var setter = lookupSetter(object, property);
717 object.__proto__ = prototype;
718
719 if (getter || setter) {
720 if (getter) descriptor.get = getter;
721 if (setter) descriptor.set = setter;
722 return descriptor;
723 }
724 }
725 descriptor.value = object[property];
726 return descriptor;
727 };
728 }
729 if (!Object.getOwnPropertyNames) {
730 Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
731 return Object.keys(object);
732 };
733 }
734 if (!Object.create) {
735 var createEmpty;
736 if (Object.prototype.__proto__ === null) {
737 createEmpty = function () {
738 return { "__proto__": null };
739 };
740 } else {
741 createEmpty = function () {
742 var empty = {};
743 for (var i in empty)
744 empty[i] = null;
745 empty.constructor =
746 empty.hasOwnProperty =
747 empty.propertyIsEnumerable =
748 empty.isPrototypeOf =
749 empty.toLocaleString =
750 empty.toString =
751 empty.valueOf =
752 empty.__proto__ = null;
753 return empty;
754 }
755 }
756
757 Object.create = function create(prototype, properties) {
758 var object;
759 if (prototype === null) {
760 object = createEmpty();
761 } else {
762 if (typeof prototype != "object")
763 throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
764 var Type = function () {};
765 Type.prototype = prototype;
766 object = new Type();
767 object.__proto__ = prototype;
768 }
769 if (properties !== void 0)
770 Object.defineProperties(object, properties);
771 return object;
772 };
773 }
774
775 function doesDefinePropertyWork(object) {
776 try {
777 Object.defineProperty(object, "sentinel", {});
778 return "sentinel" in object;
779 } catch (exception) {
780 }
781 }
782 if (Object.defineProperty) {
783 var definePropertyWorksOnObject = doesDefinePropertyWork({});
784 var definePropertyWorksOnDom = typeof document == "undefined" ||
785 doesDefinePropertyWork(document.createElement("div"));
786 if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
787 var definePropertyFallback = Object.defineProperty;
788 }
789 }
790
791 if (!Object.defineProperty || definePropertyFallback) {
792 var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
793 var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
794 var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
795 "on this javascript engine";
796
797 Object.defineProperty = function defineProperty(object, property, descriptor) {
798 if ((typeof object != "object" && typeof object != "function") || object === null)
799 throw new TypeError(ERR_NON_OBJECT_TARGET + object);
800 if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
801 throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
802 if (definePropertyFallback) {
803 try {
804 return definePropertyFallback.call(Object, object, property, descriptor);
805 } catch (exception) {
806 }
807 }
808 if (owns(descriptor, "value")) {
809
810 if (supportsAccessors && (lookupGetter(object, property) ||
811 lookupSetter(object, property)))
812 {
813 var prototype = object.__proto__;
814 object.__proto__ = prototypeOfObject;
815 delete object[property];
816 object[property] = descriptor.value;
817 object.__proto__ = prototype;
818 } else {
819 object[property] = descriptor.value;
820 }
821 } else {
822 if (!supportsAccessors)
823 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
824 if (owns(descriptor, "get"))
825 defineGetter(object, property, descriptor.get);
826 if (owns(descriptor, "set"))
827 defineSetter(object, property, descriptor.set);
828 }
829
830 return object;
831 };
832 }
833 if (!Object.defineProperties) {
834 Object.defineProperties = function defineProperties(object, properties) {
835 for (var property in properties) {
836 if (owns(properties, property))
837 Object.defineProperty(object, property, properties[property]);
838 }
839 return object;
840 };
841 }
842 if (!Object.seal) {
843 Object.seal = function seal(object) {
844 return object;
845 };
846 }
847 if (!Object.freeze) {
848 Object.freeze = function freeze(object) {
849 return object;
850 };
851 }
852 try {
853 Object.freeze(function () {});
854 } catch (exception) {
855 Object.freeze = (function freeze(freezeObject) {
856 return function freeze(object) {
857 if (typeof object == "function") {
858 return object;
859 } else {
860 return freezeObject(object);
861 }
862 };
863 })(Object.freeze);
864 }
865 if (!Object.preventExtensions) {
866 Object.preventExtensions = function preventExtensions(object) {
867 return object;
868 };
869 }
870 if (!Object.isSealed) {
871 Object.isSealed = function isSealed(object) {
872 return false;
873 };
874 }
875 if (!Object.isFrozen) {
876 Object.isFrozen = function isFrozen(object) {
877 return false;
878 };
879 }
880 if (!Object.isExtensible) {
881 Object.isExtensible = function isExtensible(object) {
882 if (Object(object) === object) {
883 throw new TypeError(); // TODO message
884 }
885 var name = '';
886 while (owns(object, name)) {
887 name += '?';
888 }
889 object[name] = true;
890 var returnValue = owns(object, name);
891 delete object[name];
892 return returnValue;
893 };
894 }
895 if (!Object.keys) {
896 var hasDontEnumBug = true,
897 dontEnums = [
898 "toString",
899 "toLocaleString",
900 "valueOf",
901 "hasOwnProperty",
902 "isPrototypeOf",
903 "propertyIsEnumerable",
904 "constructor"
905 ],
906 dontEnumsLength = dontEnums.length;
907
908 for (var key in {"toString": null}) {
909 hasDontEnumBug = false;
910 }
911
912 Object.keys = function keys(object) {
913
914 if (
915 (typeof object != "object" && typeof object != "function") ||
916 object === null
917 ) {
918 throw new TypeError("Object.keys called on a non-object");
919 }
920
921 var keys = [];
922 for (var name in object) {
923 if (owns(object, name)) {
924 keys.push(name);
925 }
926 }
927
928 if (hasDontEnumBug) {
929 for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
930 var dontEnum = dontEnums[i];
931 if (owns(object, dontEnum)) {
932 keys.push(dontEnum);
933 }
934 }
935 }
936 return keys;
937 };
938
939 }
940 if (!Date.now) {
941 Date.now = function now() {
942 return new Date().getTime();
943 };
944 }
945 var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
946 "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
947 "\u2029\uFEFF";
948 if (!String.prototype.trim || ws.trim()) {
949 ws = "[" + ws + "]";
950 var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
951 trimEndRegexp = new RegExp(ws + ws + "*$");
952 String.prototype.trim = function trim() {
953 return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
954 };
955 }
956
957 function toInteger(n) {
958 n = +n;
959 if (n !== n) { // isNaN
960 n = 0;
961 } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
962 n = (n > 0 || -1) * Math.floor(Math.abs(n));
963 }
964 return n;
965 }
966
967 function isPrimitive(input) {
968 var type = typeof input;
969 return (
970 input === null ||
971 type === "undefined" ||
972 type === "boolean" ||
973 type === "number" ||
974 type === "string"
975 );
976 }
977
978 function toPrimitive(input) {
979 var val, valueOf, toString;
980 if (isPrimitive(input)) {
981 return input;
982 }
983 valueOf = input.valueOf;
984 if (typeof valueOf === "function") {
985 val = valueOf.call(input);
986 if (isPrimitive(val)) {
987 return val;
988 }
989 }
990 toString = input.toString;
991 if (typeof toString === "function") {
992 val = toString.call(input);
993 if (isPrimitive(val)) {
994 return val;
995 }
996 }
997 throw new TypeError();
998 }
999 var toObject = function (o) {
1000 if (o == null) { // this matches both null and undefined
1001 throw new TypeError("can't convert "+o+" to object");
1002 }
1003 return Object(o);
1004 };
1005
1006 });
1007
1008 define('ace/mode/json_worker', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/worker/mirror', 'ace/mode/json/json_parse'], function(require, exports, module) {
1009
1010
1011 var oop = require("../lib/oop");
1012 var Mirror = require("../worker/mirror").Mirror;
1013 var parse = require("./json/json_parse");
1014
1015 var JsonWorker = exports.JsonWorker = function(sender) {
1016 Mirror.call(this, sender);
1017 this.setTimeout(200);
1018 };
1019
1020 oop.inherits(JsonWorker, Mirror);
1021
1022 (function() {
1023
1024 this.onUpdate = function() {
1025 var value = this.doc.getValue();
1026
1027 try {
1028 var result = parse(value);
1029 } catch (e) {
1030 var pos = this.doc.indexToPosition(e.at-1);
1031 this.sender.emit("error", {
1032 row: pos.row,
1033 column: pos.column,
1034 text: e.message,
1035 type: "error"
1036 });
1037 return;
1038 }
1039 this.sender.emit("ok");
1040 };
1041
1042 }).call(JsonWorker.prototype);
1043
1044 });
1045 define('ace/worker/mirror', ['require', 'exports', 'module' , 'ace/document', 'ace/lib/lang'], function(require, exports, module) {
1046
1047
1048 var Document = require("../document").Document;
1049 var lang = require("../lib/lang");
1050
1051 var Mirror = exports.Mirror = function(sender) {
1052 this.sender = sender;
1053 var doc = this.doc = new Document("");
1054
1055 var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1056
1057 var _self = this;
1058 sender.on("change", function(e) {
1059 doc.applyDeltas(e.data);
1060 deferredUpdate.schedule(_self.$timeout);
1061 });
1062 };
1063
1064 (function() {
1065
1066 this.$timeout = 500;
1067
1068 this.setTimeout = function(timeout) {
1069 this.$timeout = timeout;
1070 };
1071
1072 this.setValue = function(value) {
1073 this.doc.setValue(value);
1074 this.deferredUpdate.schedule(this.$timeout);
1075 };
1076
1077 this.getValue = function(callbackId) {
1078 this.sender.callback(this.doc.getValue(), callbackId);
1079 };
1080
1081 this.onUpdate = function() {
1082 };
1083
1084 }).call(Mirror.prototype);
1085
1086 });
1087
1088 define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
1089
1090
1091 var oop = require("./lib/oop");
1092 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1093 var Range = require("./range").Range;
1094 var Anchor = require("./anchor").Anchor;
1095
1096 var Document = function(text) {
1097 this.$lines = [];
1098 if (text.length == 0) {
1099 this.$lines = [""];
1100 } else if (Array.isArray(text)) {
1101 this._insertLines(0, text);
1102 } else {
1103 this.insert({row: 0, column:0}, text);
1104 }
1105 };
1106
1107 (function() {
1108
1109 oop.implement(this, EventEmitter);
1110 this.setValue = function(text) {
1111 var len = this.getLength();
1112 this.remove(new Range(0, 0, len, this.getLine(len-1).length));
1113 this.insert({row: 0, column:0}, text);
1114 };
1115 this.getValue = function() {
1116 return this.getAllLines().join(this.getNewLineCharacter());
1117 };
1118 this.createAnchor = function(row, column) {
1119 return new Anchor(this, row, column);
1120 };
1121 if ("aaa".split(/a/).length == 0)
1122 this.$split = function(text) {
1123 return text.replace(/\r\n|\r/g, "\n").split("\n");
1124 }
1125 else
1126 this.$split = function(text) {
1127 return text.split(/\r\n|\r|\n/);
1128 };
1129
1130
1131 this.$detectNewLine = function(text) {
1132 var match = text.match(/^.*?(\r\n|\r|\n)/m);
1133 this.$autoNewLine = match ? match[1] : "\n";
1134 };
1135 this.getNewLineCharacter = function() {
1136 switch (this.$newLineMode) {
1137 case "windows":
1138 return "\r\n";
1139 case "unix":
1140 return "\n";
1141 default:
1142 return this.$autoNewLine;
1143 }
1144 };
1145
1146 this.$autoNewLine = "\n";
1147 this.$newLineMode = "auto";
1148 this.setNewLineMode = function(newLineMode) {
1149 if (this.$newLineMode === newLineMode)
1150 return;
1151
1152 this.$newLineMode = newLineMode;
1153 };
1154 this.getNewLineMode = function() {
1155 return this.$newLineMode;
1156 };
1157 this.isNewLine = function(text) {
1158 return (text == "\r\n" || text == "\r" || text == "\n");
1159 };
1160 this.getLine = function(row) {
1161 return this.$lines[row] || "";
1162 };
1163 this.getLines = function(firstRow, lastRow) {
1164 return this.$lines.slice(firstRow, lastRow + 1);
1165 };
1166 this.getAllLines = function() {
1167 return this.getLines(0, this.getLength());
1168 };
1169 this.getLength = function() {
1170 return this.$lines.length;
1171 };
1172 this.getTextRange = function(range) {
1173 if (range.start.row == range.end.row) {
1174 return this.$lines[range.start.row]
1175 .substring(range.start.column, range.end.column);
1176 }
1177 var lines = this.getLines(range.start.row, range.end.row);
1178 lines[0] = (lines[0] || "").substring(range.start.column);
1179 var l = lines.length - 1;
1180 if (range.end.row - range.start.row == l)
1181 lines[l] = lines[l].substring(0, range.end.column);
1182 return lines.join(this.getNewLineCharacter());
1183 };
1184
1185 this.$clipPosition = function(position) {
1186 var length = this.getLength();
1187 if (position.row >= length) {
1188 position.row = Math.max(0, length - 1);
1189 position.column = this.getLine(length-1).length;
1190 } else if (position.row < 0)
1191 position.row = 0;
1192 return position;
1193 };
1194 this.insert = function(position, text) {
1195 if (!text || text.length === 0)
1196 return position;
1197
1198 position = this.$clipPosition(position);
1199 if (this.getLength() <= 1)
1200 this.$detectNewLine(text);
1201
1202 var lines = this.$split(text);
1203 var firstLine = lines.splice(0, 1)[0];
1204 var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
1205
1206 position = this.insertInLine(position, firstLine);
1207 if (lastLine !== null) {
1208 position = this.insertNewLine(position); // terminate first line
1209 position = this._insertLines(position.row, lines);
1210 position = this.insertInLine(position, lastLine || "");
1211 }
1212 return position;
1213 };
1214 this.insertLines = function(row, lines) {
1215 if (row >= this.getLength())
1216 return this.insert({row: row, column: 0}, "\n" + lines.join("\n"));
1217 return this._insertLines(Math.max(row, 0), lines);
1218 };
1219 this._insertLines = function(row, lines) {
1220 if (lines.length == 0)
1221 return {row: row, column: 0};
1222 if (lines.length > 0xFFFF) {
1223 var end = this._insertLines(row, lines.slice(0xFFFF));
1224 lines = lines.slice(0, 0xFFFF);
1225 }
1226
1227 var args = [row, 0];
1228 args.push.apply(args, lines);
1229 this.$lines.splice.apply(this.$lines, args);
1230
1231 var range = new Range(row, 0, row + lines.length, 0);
1232 var delta = {
1233 action: "insertLines",
1234 range: range,
1235 lines: lines
1236 };
1237 this._emit("change", { data: delta });
1238 return end || range.end;
1239 };
1240 this.insertNewLine = function(position) {
1241 position = this.$clipPosition(position);
1242 var line = this.$lines[position.row] || "";
1243
1244 this.$lines[position.row] = line.substring(0, position.column);
1245 this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
1246
1247 var end = {
1248 row : position.row + 1,
1249 column : 0
1250 };
1251
1252 var delta = {
1253 action: "insertText",
1254 range: Range.fromPoints(position, end),
1255 text: this.getNewLineCharacter()
1256 };
1257 this._emit("change", { data: delta });
1258
1259 return end;
1260 };
1261 this.insertInLine = function(position, text) {
1262 if (text.length == 0)
1263 return position;
1264
1265 var line = this.$lines[position.row] || "";
1266
1267 this.$lines[position.row] = line.substring(0, position.column) + text
1268 + line.substring(position.column);
1269
1270 var end = {
1271 row : position.row,
1272 column : position.column + text.length
1273 };
1274
1275 var delta = {
1276 action: "insertText",
1277 range: Range.fromPoints(position, end),
1278 text: text
1279 };
1280 this._emit("change", { data: delta });
1281
1282 return end;
1283 };
1284 this.remove = function(range) {
1285 range.start = this.$clipPosition(range.start);
1286 range.end = this.$clipPosition(range.end);
1287
1288 if (range.isEmpty())
1289 return range.start;
1290
1291 var firstRow = range.start.row;
1292 var lastRow = range.end.row;
1293
1294 if (range.isMultiLine()) {
1295 var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
1296 var lastFullRow = lastRow - 1;
1297
1298 if (range.end.column > 0)
1299 this.removeInLine(lastRow, 0, range.end.column);
1300
1301 if (lastFullRow >= firstFullRow)
1302 this._removeLines(firstFullRow, lastFullRow);
1303
1304 if (firstFullRow != firstRow) {
1305 this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
1306 this.removeNewLine(range.start.row);
1307 }
1308 }
1309 else {
1310 this.removeInLine(firstRow, range.start.column, range.end.column);
1311 }
1312 return range.start;
1313 };
1314 this.removeInLine = function(row, startColumn, endColumn) {
1315 if (startColumn == endColumn)
1316 return;
1317
1318 var range = new Range(row, startColumn, row, endColumn);
1319 var line = this.getLine(row);
1320 var removed = line.substring(startColumn, endColumn);
1321 var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
1322 this.$lines.splice(row, 1, newLine);
1323
1324 var delta = {
1325 action: "removeText",
1326 range: range,
1327 text: removed
1328 };
1329 this._emit("change", { data: delta });
1330 return range.start;
1331 };
1332 this.removeLines = function(firstRow, lastRow) {
1333 if (firstRow < 0 || lastRow >= this.getLength())
1334 return this.remove(new Range(firstRow, 0, lastRow + 1, 0));
1335 return this._removeLines(firstRow, lastRow);
1336 };
1337
1338 this._removeLines = function(firstRow, lastRow) {
1339 var range = new Range(firstRow, 0, lastRow + 1, 0);
1340 var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
1341
1342 var delta = {
1343 action: "removeLines",
1344 range: range,
1345 nl: this.getNewLineCharacter(),
1346 lines: removed
1347 };
1348 this._emit("change", { data: delta });
1349 return removed;
1350 };
1351 this.removeNewLine = function(row) {
1352 var firstLine = this.getLine(row);
1353 var secondLine = this.getLine(row+1);
1354
1355 var range = new Range(row, firstLine.length, row+1, 0);
1356 var line = firstLine + secondLine;
1357
1358 this.$lines.splice(row, 2, line);
1359
1360 var delta = {
1361 action: "removeText",
1362 range: range,
1363 text: this.getNewLineCharacter()
1364 };
1365 this._emit("change", { data: delta });
1366 };
1367 this.replace = function(range, text) {
1368 if (text.length == 0 && range.isEmpty())
1369 return range.start;
1370 if (text == this.getTextRange(range))
1371 return range.end;
1372
1373 this.remove(range);
1374 if (text) {
1375 var end = this.insert(range.start, text);
1376 }
1377 else {
1378 end = range.start;
1379 }
1380
1381 return end;
1382 };
1383 this.applyDeltas = function(deltas) {
1384 for (var i=0; i<deltas.length; i++) {
1385 var delta = deltas[i];
1386 var range = Range.fromPoints(delta.range.start, delta.range.end);
1387
1388 if (delta.action == "insertLines")
1389 this.insertLines(range.start.row, delta.lines);
1390 else if (delta.action == "insertText")
1391 this.insert(range.start, delta.text);
1392 else if (delta.action == "removeLines")
1393 this._removeLines(range.start.row, range.end.row - 1);
1394 else if (delta.action == "removeText")
1395 this.remove(range);
1396 }
1397 };
1398 this.revertDeltas = function(deltas) {
1399 for (var i=deltas.length-1; i>=0; i--) {
1400 var delta = deltas[i];
1401
1402 var range = Range.fromPoints(delta.range.start, delta.range.end);
1403
1404 if (delta.action == "insertLines")
1405 this._removeLines(range.start.row, range.end.row - 1);
1406 else if (delta.action == "insertText")
1407 this.remove(range);
1408 else if (delta.action == "removeLines")
1409 this._insertLines(range.start.row, delta.lines);
1410 else if (delta.action == "removeText")
1411 this.insert(range.start, delta.text);
1412 }
1413 };
1414 this.indexToPosition = function(index, startRow) {
1415 var lines = this.$lines || this.getAllLines();
1416 var newlineLength = this.getNewLineCharacter().length;
1417 for (var i = startRow || 0, l = lines.length; i < l; i++) {
1418 index -= lines[i].length + newlineLength;
1419 if (index < 0)
1420 return {row: i, column: index + lines[i].length + newlineLength};
1421 }
1422 return {row: l-1, column: lines[l-1].length};
1423 };
1424 this.positionToIndex = function(pos, startRow) {
1425 var lines = this.$lines || this.getAllLines();
1426 var newlineLength = this.getNewLineCharacter().length;
1427 var index = 0;
1428 var row = Math.min(pos.row, lines.length);
1429 for (var i = startRow || 0; i < row; ++i)
1430 index += lines[i].length + newlineLength;
1431
1432 return index + pos.column;
1433 };
1434
1435 }).call(Document.prototype);
1436
1437 exports.Document = Document;
1438 });
1439
1440 define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
1441
1442 var comparePoints = function(p1, p2) {
1443 return p1.row - p2.row || p1.column - p2.column;
1444 };
1445 var Range = function(startRow, startColumn, endRow, endColumn) {
1446 this.start = {
1447 row: startRow,
1448 column: startColumn
1449 };
1450
1451 this.end = {
1452 row: endRow,
1453 column: endColumn
1454 };
1455 };
1456
1457 (function() {
1458 this.isEqual = function(range) {
1459 return this.start.row === range.start.row &&
1460 this.end.row === range.end.row &&
1461 this.start.column === range.start.column &&
1462 this.end.column === range.end.column;
1463 };
1464 this.toString = function() {
1465 return ("Range: [" + this.start.row + "/" + this.start.column +
1466 "] -> [" + this.end.row + "/" + this.end.column + "]");
1467 };
1468
1469 this.contains = function(row, column) {
1470 return this.compare(row, column) == 0;
1471 };
1472 this.compareRange = function(range) {
1473 var cmp,
1474 end = range.end,
1475 start = range.start;
1476
1477 cmp = this.compare(end.row, end.column);
1478 if (cmp == 1) {
1479 cmp = this.compare(start.row, start.column);
1480 if (cmp == 1) {
1481 return 2;
1482 } else if (cmp == 0) {
1483 return 1;
1484 } else {
1485 return 0;
1486 }
1487 } else if (cmp == -1) {
1488 return -2;
1489 } else {
1490 cmp = this.compare(start.row, start.column);
1491 if (cmp == -1) {
1492 return -1;
1493 } else if (cmp == 1) {
1494 return 42;
1495 } else {
1496 return 0;
1497 }
1498 }
1499 };
1500 this.comparePoint = function(p) {
1501 return this.compare(p.row, p.column);
1502 };
1503 this.containsRange = function(range) {
1504 return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
1505 };
1506 this.intersects = function(range) {
1507 var cmp = this.compareRange(range);
1508 return (cmp == -1 || cmp == 0 || cmp == 1);
1509 };
1510 this.isEnd = function(row, column) {
1511 return this.end.row == row && this.end.column == column;
1512 };
1513 this.isStart = function(row, column) {
1514 return this.start.row == row && this.start.column == column;
1515 };
1516 this.setStart = function(row, column) {
1517 if (typeof row == "object") {
1518 this.start.column = row.column;
1519 this.start.row = row.row;
1520 } else {
1521 this.start.row = row;
1522 this.start.column = column;
1523 }
1524 };
1525 this.setEnd = function(row, column) {
1526 if (typeof row == "object") {
1527 this.end.column = row.column;
1528 this.end.row = row.row;
1529 } else {
1530 this.end.row = row;
1531 this.end.column = column;
1532 }
1533 };
1534 this.inside = function(row, column) {
1535 if (this.compare(row, column) == 0) {
1536 if (this.isEnd(row, column) || this.isStart(row, column)) {
1537 return false;
1538 } else {
1539 return true;
1540 }
1541 }
1542 return false;
1543 };
1544 this.insideStart = function(row, column) {
1545 if (this.compare(row, column) == 0) {
1546 if (this.isEnd(row, column)) {
1547 return false;
1548 } else {
1549 return true;
1550 }
1551 }
1552 return false;
1553 };
1554 this.insideEnd = function(row, column) {
1555 if (this.compare(row, column) == 0) {
1556 if (this.isStart(row, column)) {
1557 return false;
1558 } else {
1559 return true;
1560 }
1561 }
1562 return false;
1563 };
1564 this.compare = function(row, column) {
1565 if (!this.isMultiLine()) {
1566 if (row === this.start.row) {
1567 return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
1568 };
1569 }
1570
1571 if (row < this.start.row)
1572 return -1;
1573
1574 if (row > this.end.row)
1575 return 1;
1576
1577 if (this.start.row === row)
1578 return column >= this.start.column ? 0 : -1;
1579
1580 if (this.end.row === row)
1581 return column <= this.end.column ? 0 : 1;
1582
1583 return 0;
1584 };
1585 this.compareStart = function(row, column) {
1586 if (this.start.row == row && this.start.column == column) {
1587 return -1;
1588 } else {
1589 return this.compare(row, column);
1590 }
1591 };
1592 this.compareEnd = function(row, column) {
1593 if (this.end.row == row && this.end.column == column) {
1594 return 1;
1595 } else {
1596 return this.compare(row, column);
1597 }
1598 };
1599 this.compareInside = function(row, column) {
1600 if (this.end.row == row && this.end.column == column) {
1601 return 1;
1602 } else if (this.start.row == row && this.start.column == column) {
1603 return -1;
1604 } else {
1605 return this.compare(row, column);
1606 }
1607 };
1608 this.clipRows = function(firstRow, lastRow) {
1609 if (this.end.row > lastRow)
1610 var end = {row: lastRow + 1, column: 0};
1611 else if (this.end.row < firstRow)
1612 var end = {row: firstRow, column: 0};
1613
1614 if (this.start.row > lastRow)
1615 var start = {row: lastRow + 1, column: 0};
1616 else if (this.start.row < firstRow)
1617 var start = {row: firstRow, column: 0};
1618
1619 return Range.fromPoints(start || this.start, end || this.end);
1620 };
1621 this.extend = function(row, column) {
1622 var cmp = this.compare(row, column);
1623
1624 if (cmp == 0)
1625 return this;
1626 else if (cmp == -1)
1627 var start = {row: row, column: column};
1628 else
1629 var end = {row: row, column: column};
1630
1631 return Range.fromPoints(start || this.start, end || this.end);
1632 };
1633
1634 this.isEmpty = function() {
1635 return (this.start.row === this.end.row && this.start.column === this.end.column);
1636 };
1637 this.isMultiLine = function() {
1638 return (this.start.row !== this.end.row);
1639 };
1640 this.clone = function() {
1641 return Range.fromPoints(this.start, this.end);
1642 };
1643 this.collapseRows = function() {
1644 if (this.end.column == 0)
1645 return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
1646 else
1647 return new Range(this.start.row, 0, this.end.row, 0)
1648 };
1649 this.toScreenRange = function(session) {
1650 var screenPosStart = session.documentToScreenPosition(this.start);
1651 var screenPosEnd = session.documentToScreenPosition(this.end);
1652
1653 return new Range(
1654 screenPosStart.row, screenPosStart.column,
1655 screenPosEnd.row, screenPosEnd.column
1656 );
1657 };
1658 this.moveBy = function(row, column) {
1659 this.start.row += row;
1660 this.start.column += column;
1661 this.end.row += row;
1662 this.end.column += column;
1663 };
1664
1665 }).call(Range.prototype);
1666 Range.fromPoints = function(start, end) {
1667 return new Range(start.row, start.column, end.row, end.column);
1668 };
1669 Range.comparePoints = comparePoints;
1670
1671 Range.comparePoints = function(p1, p2) {
1672 return p1.row - p2.row || p1.column - p2.column;
1673 };
1674
1675
1676 exports.Range = Range;
1677 });
1678
1679 define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
1680
1681
1682 var oop = require("./lib/oop");
1683 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1684
1685 var Anchor = exports.Anchor = function(doc, row, column) {
1686 this.document = doc;
1687
1688 if (typeof column == "undefined")
1689 this.setPosition(row.row, row.column);
1690 else
1691 this.setPosition(row, column);
1692
1693 this.$onChange = this.onChange.bind(this);
1694 doc.on("change", this.$onChange);
1695 };
1696
1697 (function() {
1698
1699 oop.implement(this, EventEmitter);
1700
1701 this.getPosition = function() {
1702 return this.$clipPositionToDocument(this.row, this.column);
1703 };
1704
1705 this.getDocument = function() {
1706 return this.document;
1707 };
1708
1709 this.onChange = function(e) {
1710 var delta = e.data;
1711 var range = delta.range;
1712
1713 if (range.start.row == range.end.row && range.start.row != this.row)
1714 return;
1715
1716 if (range.start.row > this.row)
1717 return;
1718
1719 if (range.start.row == this.row && range.start.column > this.column)
1720 return;
1721
1722 var row = this.row;
1723 var column = this.column;
1724 var start = range.start;
1725 var end = range.end;
1726
1727 if (delta.action === "insertText") {
1728 if (start.row === row && start.column <= column) {
1729 if (start.row === end.row) {
1730 column += end.column - start.column;
1731 } else {
1732 column -= start.column;
1733 row += end.row - start.row;
1734 }
1735 } else if (start.row !== end.row && start.row < row) {
1736 row += end.row - start.row;
1737 }
1738 } else if (delta.action === "insertLines") {
1739 if (start.row <= row) {
1740 row += end.row - start.row;
1741 }
1742 } else if (delta.action === "removeText") {
1743 if (start.row === row && start.column < column) {
1744 if (end.column >= column)
1745 column = start.column;
1746 else
1747 column = Math.max(0, column - (end.column - start.column));
1748
1749 } else if (start.row !== end.row && start.row < row) {
1750 if (end.row === row)
1751 column = Math.max(0, column - end.column) + start.column;
1752 row -= (end.row - start.row);
1753 } else if (end.row === row) {
1754 row -= end.row - start.row;
1755 column = Math.max(0, column - end.column) + start.column;
1756 }
1757 } else if (delta.action == "removeLines") {
1758 if (start.row <= row) {
1759 if (end.row <= row)
1760 row -= end.row - start.row;
1761 else {
1762 row = start.row;
1763 column = 0;
1764 }
1765 }
1766 }
1767
1768 this.setPosition(row, column, true);
1769 };
1770
1771 this.setPosition = function(row, column, noClip) {
1772 var pos;
1773 if (noClip) {
1774 pos = {
1775 row: row,
1776 column: column
1777 };
1778 } else {
1779 pos = this.$clipPositionToDocument(row, column);
1780 }
1781
1782 if (this.row == pos.row && this.column == pos.column)
1783 return;
1784
1785 var old = {
1786 row: this.row,
1787 column: this.column
1788 };
1789
1790 this.row = pos.row;
1791 this.column = pos.column;
1792 this._emit("change", {
1793 old: old,
1794 value: pos
1795 });
1796 };
1797
1798 this.detach = function() {
1799 this.document.removeEventListener("change", this.$onChange);
1800 };
1801 this.$clipPositionToDocument = function(row, column) {
1802 var pos = {};
1803
1804 if (row >= this.document.getLength()) {
1805 pos.row = Math.max(0, this.document.getLength() - 1);
1806 pos.column = this.document.getLine(pos.row).length;
1807 }
1808 else if (row < 0) {
1809 pos.row = 0;
1810 pos.column = 0;
1811 }
1812 else {
1813 pos.row = row;
1814 pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
1815 }
1816
1817 if (column < 0)
1818 pos.column = 0;
1819
1820 return pos;
1821 };
1822
1823 }).call(Anchor.prototype);
1824
1825 });
1826
1827 define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
1828
1829
1830 exports.stringReverse = function(string) {
1831 return string.split("").reverse().join("");
1832 };
1833
1834 exports.stringRepeat = function (string, count) {
1835 var result = '';
1836 while (count > 0) {
1837 if (count & 1)
1838 result += string;
1839
1840 if (count >>= 1)
1841 string += string;
1842 }
1843 return result;
1844 };
1845
1846 var trimBeginRegexp = /^\s\s*/;
1847 var trimEndRegexp = /\s\s*$/;
1848
1849 exports.stringTrimLeft = function (string) {
1850 return string.replace(trimBeginRegexp, '');
1851 };
1852
1853 exports.stringTrimRight = function (string) {
1854 return string.replace(trimEndRegexp, '');
1855 };
1856
1857 exports.copyObject = function(obj) {
1858 var copy = {};
1859 for (var key in obj) {
1860 copy[key] = obj[key];
1861 }
1862 return copy;
1863 };
1864
1865 exports.copyArray = function(array){
1866 var copy = [];
1867 for (var i=0, l=array.length; i<l; i++) {
1868 if (array[i] && typeof array[i] == "object")
1869 copy[i] = this.copyObject( array[i] );
1870 else
1871 copy[i] = array[i];
1872 }
1873 return copy;
1874 };
1875
1876 exports.deepCopy = function (obj) {
1877 if (typeof obj != "object") {
1878 return obj;
1879 }
1880
1881 var copy = obj.constructor();
1882 for (var key in obj) {
1883 if (typeof obj[key] == "object") {
1884 copy[key] = this.deepCopy(obj[key]);
1885 } else {
1886 copy[key] = obj[key];
1887 }
1888 }
1889 return copy;
1890 };
1891
1892 exports.arrayToMap = function(arr) {
1893 var map = {};
1894 for (var i=0; i<arr.length; i++) {
1895 map[arr[i]] = 1;
1896 }
1897 return map;
1898
1899 };
1900
1901 exports.createMap = function(props) {
1902 var map = Object.create(null);
1903 for (var i in props) {
1904 map[i] = props[i];
1905 }
1906 return map;
1907 };
1908 exports.arrayRemove = function(array, value) {
1909 for (var i = 0; i <= array.length; i++) {
1910 if (value === array[i]) {
1911 array.splice(i, 1);
1912 }
1913 }
1914 };
1915
1916 exports.escapeRegExp = function(str) {
1917 return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
1918 };
1919
1920 exports.escapeHTML = function(str) {
1921 return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
1922 };
1923
1924 exports.getMatchOffsets = function(string, regExp) {
1925 var matches = [];
1926
1927 string.replace(regExp, function(str) {
1928 matches.push({
1929 offset: arguments[arguments.length-2],
1930 length: str.length
1931 });
1932 });
1933
1934 return matches;
1935 };
1936 exports.deferredCall = function(fcn) {
1937
1938 var timer = null;
1939 var callback = function() {
1940 timer = null;
1941 fcn();
1942 };
1943
1944 var deferred = function(timeout) {
1945 deferred.cancel();
1946 timer = setTimeout(callback, timeout || 0);
1947 return deferred;
1948 };
1949
1950 deferred.schedule = deferred;
1951
1952 deferred.call = function() {
1953 this.cancel();
1954 fcn();
1955 return deferred;
1956 };
1957
1958 deferred.cancel = function() {
1959 clearTimeout(timer);
1960 timer = null;
1961 return deferred;
1962 };
1963
1964 return deferred;
1965 };
1966
1967
1968 exports.delayedCall = function(fcn, defaultTimeout) {
1969 var timer = null;
1970 var callback = function() {
1971 timer = null;
1972 fcn();
1973 };
1974
1975 var _self = function(timeout) {
1976 timer && clearTimeout(timer);
1977 timer = setTimeout(callback, timeout || defaultTimeout);
1978 };
1979
1980 _self.delay = _self;
1981 _self.schedule = function(timeout) {
1982 if (timer == null)
1983 timer = setTimeout(callback, timeout || 0);
1984 };
1985
1986 _self.call = function() {
1987 this.cancel();
1988 fcn();
1989 };
1990
1991 _self.cancel = function() {
1992 timer && clearTimeout(timer);
1993 timer = null;
1994 };
1995
1996 _self.isPending = function() {
1997 return timer;
1998 };
1999
2000 return _self;
2001 };
2002 });
2003
2004 define('ace/mode/json/json_parse', ['require', 'exports', 'module' ], function(require, exports, module) {
2005
2006 var at, // The index of the current character
2007 ch, // The current character
2008 escapee = {
2009 '"': '"',
2010 '\\': '\\',
2011 '/': '/',
2012 b: '\b',
2013 f: '\f',
2014 n: '\n',
2015 r: '\r',
2016 t: '\t'
2017 },
2018 text,
2019
2020 error = function (m) {
2021
2022 throw {
2023 name: 'SyntaxError',
2024 message: m,
2025 at: at,
2026 text: text
2027 };
2028 },
2029
2030 next = function (c) {
2031
2032 if (c && c !== ch) {
2033 error("Expected '" + c + "' instead of '" + ch + "'");
2034 }
2035
2036 ch = text.charAt(at);
2037 at += 1;
2038 return ch;
2039 },
2040
2041 number = function () {
2042
2043 var number,
2044 string = '';
2045
2046 if (ch === '-') {
2047 string = '-';
2048 next('-');
2049 }
2050 while (ch >= '0' && ch <= '9') {
2051 string += ch;
2052 next();
2053 }
2054 if (ch === '.') {
2055 string += '.';
2056 while (next() && ch >= '0' && ch <= '9') {
2057 string += ch;
2058 }
2059 }
2060 if (ch === 'e' || ch === 'E') {
2061 string += ch;
2062 next();
2063 if (ch === '-' || ch === '+') {
2064 string += ch;
2065 next();
2066 }
2067 while (ch >= '0' && ch <= '9') {
2068 string += ch;
2069 next();
2070 }
2071 }
2072 number = +string;
2073 if (isNaN(number)) {
2074 error("Bad number");
2075 } else {
2076 return number;
2077 }
2078 },
2079
2080 string = function () {
2081
2082 var hex,
2083 i,
2084 string = '',
2085 uffff;
2086
2087 if (ch === '"') {
2088 while (next()) {
2089 if (ch === '"') {
2090 next();
2091 return string;
2092 } else if (ch === '\\') {
2093 next();
2094 if (ch === 'u') {
2095 uffff = 0;
2096 for (i = 0; i < 4; i += 1) {
2097 hex = parseInt(next(), 16);
2098 if (!isFinite(hex)) {
2099 break;
2100 }
2101 uffff = uffff * 16 + hex;
2102 }
2103 string += String.fromCharCode(uffff);
2104 } else if (typeof escapee[ch] === 'string') {
2105 string += escapee[ch];
2106 } else {
2107 break;
2108 }
2109 } else {
2110 string += ch;
2111 }
2112 }
2113 }
2114 error("Bad string");
2115 },
2116
2117 white = function () {
2118
2119 while (ch && ch <= ' ') {
2120 next();
2121 }
2122 },
2123
2124 word = function () {
2125
2126 switch (ch) {
2127 case 't':
2128 next('t');
2129 next('r');
2130 next('u');
2131 next('e');
2132 return true;
2133 case 'f':
2134 next('f');
2135 next('a');
2136 next('l');
2137 next('s');
2138 next('e');
2139 return false;
2140 case 'n':
2141 next('n');
2142 next('u');
2143 next('l');
2144 next('l');
2145 return null;
2146 }
2147 error("Unexpected '" + ch + "'");
2148 },
2149
2150 value, // Place holder for the value function.
2151
2152 array = function () {
2153
2154 var array = [];
2155
2156 if (ch === '[') {
2157 next('[');
2158 white();
2159 if (ch === ']') {
2160 next(']');
2161 return array; // empty array
2162 }
2163 while (ch) {
2164 array.push(value());
2165 white();
2166 if (ch === ']') {
2167 next(']');
2168 return array;
2169 }
2170 next(',');
2171 white();
2172 }
2173 }
2174 error("Bad array");
2175 },
2176
2177 object = function () {
2178
2179 var key,
2180 object = {};
2181
2182 if (ch === '{') {
2183 next('{');
2184 white();
2185 if (ch === '}') {
2186 next('}');
2187 return object; // empty object
2188 }
2189 while (ch) {
2190 key = string();
2191 white();
2192 next(':');
2193 if (Object.hasOwnProperty.call(object, key)) {
2194 error('Duplicate key "' + key + '"');
2195 }
2196 object[key] = value();
2197 white();
2198 if (ch === '}') {
2199 next('}');
2200 return object;
2201 }
2202 next(',');
2203 white();
2204 }
2205 }
2206 error("Bad object");
2207 };
2208
2209 value = function () {
2210
2211 white();
2212 switch (ch) {
2213 case '{':
2214 return object();
2215 case '[':
2216 return array();
2217 case '"':
2218 return string();
2219 case '-':
2220 return number();
2221 default:
2222 return ch >= '0' && ch <= '9' ? number() : word();
2223 }
2224 };
2225
2226 return function (source, reviver) {
2227 var result;
2228
2229 text = source;
2230 at = 0;
2231 ch = ' ';
2232 result = value();
2233 white();
2234 if (ch) {
2235 error("Syntax error");
2236 }
2237
2238 return typeof reviver === 'function' ? function walk(holder, key) {
2239 var k, v, value = holder[key];
2240 if (value && typeof value === 'object') {
2241 for (k in value) {
2242 if (Object.hasOwnProperty.call(value, k)) {
2243 v = walk(value, k);
2244 if (v !== undefined) {
2245 value[k] = v;
2246 } else {
2247 delete value[k];
2248 }
2249 }
2250 }
2251 }
2252 return reviver.call(holder, key, value);
2253 }({'': result}, '') : result;
2254 };
2255 });
+0
-3364
try/ace/worker-lua.js less more
0 "no use strict";
1 ;(function(window) {
2 if (typeof window.window != "undefined" && window.document) {
3 return;
4 }
5
6 window.console = {
7 log: function() {
8 var msgs = Array.prototype.slice.call(arguments, 0);
9 postMessage({type: "log", data: msgs});
10 },
11 error: function() {
12 var msgs = Array.prototype.slice.call(arguments, 0);
13 postMessage({type: "log", data: msgs});
14 }
15 };
16 window.window = window;
17 window.ace = window;
18
19 window.normalizeModule = function(parentId, moduleName) {
20 if (moduleName.indexOf("!") !== -1) {
21 var chunks = moduleName.split("!");
22 return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
23 }
24 if (moduleName.charAt(0) == ".") {
25 var base = parentId.split("/").slice(0, -1).join("/");
26 moduleName = base + "/" + moduleName;
27
28 while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
29 var previous = moduleName;
30 moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
31 }
32 }
33
34 return moduleName;
35 };
36
37 window.require = function(parentId, id) {
38 if (!id) {
39 id = parentId
40 parentId = null;
41 }
42 if (!id.charAt)
43 throw new Error("worker.js require() accepts only (parentId, id) as arguments");
44
45 id = normalizeModule(parentId, id);
46
47 var module = require.modules[id];
48 if (module) {
49 if (!module.initialized) {
50 module.initialized = true;
51 module.exports = module.factory().exports;
52 }
53 return module.exports;
54 }
55
56 var chunks = id.split("/");
57 chunks[0] = require.tlns[chunks[0]] || chunks[0];
58 var path = chunks.join("/") + ".js";
59
60 require.id = id;
61 importScripts(path);
62 return require(parentId, id);
63 };
64
65 require.modules = {};
66 require.tlns = {};
67
68 window.define = function(id, deps, factory) {
69 if (arguments.length == 2) {
70 factory = deps;
71 if (typeof id != "string") {
72 deps = id;
73 id = require.id;
74 }
75 } else if (arguments.length == 1) {
76 factory = id;
77 id = require.id;
78 }
79
80 if (id.indexOf("text!") === 0)
81 return;
82
83 var req = function(deps, factory) {
84 return require(id, deps, factory);
85 };
86
87 require.modules[id] = {
88 factory: function() {
89 var module = {
90 exports: {}
91 };
92 var returnExports = factory(req, module.exports, module);
93 if (returnExports)
94 module.exports = returnExports;
95 return module;
96 }
97 };
98 };
99
100 window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
101 require.tlns = topLevelNamespaces;
102 }
103
104 window.initSender = function initSender() {
105
106 var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
107 var oop = require("ace/lib/oop");
108
109 var Sender = function() {};
110
111 (function() {
112
113 oop.implement(this, EventEmitter);
114
115 this.callback = function(data, callbackId) {
116 postMessage({
117 type: "call",
118 id: callbackId,
119 data: data
120 });
121 };
122
123 this.emit = function(name, data) {
124 postMessage({
125 type: "event",
126 name: name,
127 data: data
128 });
129 };
130
131 }).call(Sender.prototype);
132
133 return new Sender();
134 }
135
136 window.main = null;
137 window.sender = null;
138
139 window.onmessage = function(e) {
140 var msg = e.data;
141 if (msg.command) {
142 if (main[msg.command])
143 main[msg.command].apply(main, msg.args);
144 else
145 throw new Error("Unknown command:" + msg.command);
146 }
147 else if (msg.init) {
148 initBaseUrls(msg.tlns);
149 require("ace/lib/es5-shim");
150 sender = initSender();
151 var clazz = require(msg.module)[msg.classname];
152 main = new clazz(sender);
153 }
154 else if (msg.event && sender) {
155 sender._emit(msg.event, msg.data);
156 }
157 };
158 })(this);
159
160 define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
161
162
163 var EventEmitter = {};
164 var stopPropagation = function() { this.propagationStopped = true; };
165 var preventDefault = function() { this.defaultPrevented = true; };
166
167 EventEmitter._emit =
168 EventEmitter._dispatchEvent = function(eventName, e) {
169 this._eventRegistry || (this._eventRegistry = {});
170 this._defaultHandlers || (this._defaultHandlers = {});
171
172 var listeners = this._eventRegistry[eventName] || [];
173 var defaultHandler = this._defaultHandlers[eventName];
174 if (!listeners.length && !defaultHandler)
175 return;
176
177 if (typeof e != "object" || !e)
178 e = {};
179
180 if (!e.type)
181 e.type = eventName;
182 if (!e.stopPropagation)
183 e.stopPropagation = stopPropagation;
184 if (!e.preventDefault)
185 e.preventDefault = preventDefault;
186
187 for (var i=0; i<listeners.length; i++) {
188 listeners[i](e, this);
189 if (e.propagationStopped)
190 break;
191 }
192
193 if (defaultHandler && !e.defaultPrevented)
194 return defaultHandler(e, this);
195 };
196
197
198 EventEmitter._signal = function(eventName, e) {
199 var listeners = (this._eventRegistry || {})[eventName];
200 if (!listeners)
201 return;
202
203 for (var i=0; i<listeners.length; i++)
204 listeners[i](e, this);
205 };
206
207 EventEmitter.once = function(eventName, callback) {
208 var _self = this;
209 callback && this.addEventListener(eventName, function newCallback() {
210 _self.removeEventListener(eventName, newCallback);
211 callback.apply(null, arguments);
212 });
213 };
214
215
216 EventEmitter.setDefaultHandler = function(eventName, callback) {
217 var handlers = this._defaultHandlers
218 if (!handlers)
219 handlers = this._defaultHandlers = {_disabled_: {}};
220
221 if (handlers[eventName]) {
222 var old = handlers[eventName];
223 var disabled = handlers._disabled_[eventName];
224 if (!disabled)
225 handlers._disabled_[eventName] = disabled = [];
226 disabled.push(old);
227 var i = disabled.indexOf(callback);
228 if (i != -1)
229 disabled.splice(i, 1);
230 }
231 handlers[eventName] = callback;
232 };
233 EventEmitter.removeDefaultHandler = function(eventName, callback) {
234 var handlers = this._defaultHandlers
235 if (!handlers)
236 return;
237 var disabled = handlers._disabled_[eventName];
238
239 if (handlers[eventName] == callback) {
240 var old = handlers[eventName];
241 if (disabled)
242 this.setDefaultHandler(eventName, disabled.pop());
243 } else if (disabled) {
244 var i = disabled.indexOf(callback);
245 if (i != -1)
246 disabled.splice(i, 1);
247 }
248 };
249
250 EventEmitter.on =
251 EventEmitter.addEventListener = function(eventName, callback, capturing) {
252 this._eventRegistry = this._eventRegistry || {};
253
254 var listeners = this._eventRegistry[eventName];
255 if (!listeners)
256 listeners = this._eventRegistry[eventName] = [];
257
258 if (listeners.indexOf(callback) == -1)
259 listeners[capturing ? "unshift" : "push"](callback);
260 return callback;
261 };
262
263 EventEmitter.off =
264 EventEmitter.removeListener =
265 EventEmitter.removeEventListener = function(eventName, callback) {
266 this._eventRegistry = this._eventRegistry || {};
267
268 var listeners = this._eventRegistry[eventName];
269 if (!listeners)
270 return;
271
272 var index = listeners.indexOf(callback);
273 if (index !== -1)
274 listeners.splice(index, 1);
275 };
276
277 EventEmitter.removeAllListeners = function(eventName) {
278 if (this._eventRegistry) this._eventRegistry[eventName] = [];
279 };
280
281 exports.EventEmitter = EventEmitter;
282
283 });
284
285 define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
286
287
288 exports.inherits = (function() {
289 var tempCtor = function() {};
290 return function(ctor, superCtor) {
291 tempCtor.prototype = superCtor.prototype;
292 ctor.super_ = superCtor.prototype;
293 ctor.prototype = new tempCtor();
294 ctor.prototype.constructor = ctor;
295 };
296 }());
297
298 exports.mixin = function(obj, mixin) {
299 for (var key in mixin) {
300 obj[key] = mixin[key];
301 }
302 return obj;
303 };
304
305 exports.implement = function(proto, mixin) {
306 exports.mixin(proto, mixin);
307 };
308
309 });
310
311 define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) {
312
313 function Empty() {}
314
315 if (!Function.prototype.bind) {
316 Function.prototype.bind = function bind(that) { // .length is 1
317 var target = this;
318 if (typeof target != "function") {
319 throw new TypeError("Function.prototype.bind called on incompatible " + target);
320 }
321 var args = slice.call(arguments, 1); // for normal call
322 var bound = function () {
323
324 if (this instanceof bound) {
325
326 var result = target.apply(
327 this,
328 args.concat(slice.call(arguments))
329 );
330 if (Object(result) === result) {
331 return result;
332 }
333 return this;
334
335 } else {
336 return target.apply(
337 that,
338 args.concat(slice.call(arguments))
339 );
340
341 }
342
343 };
344 if(target.prototype) {
345 Empty.prototype = target.prototype;
346 bound.prototype = new Empty();
347 Empty.prototype = null;
348 }
349 return bound;
350 };
351 }
352 var call = Function.prototype.call;
353 var prototypeOfArray = Array.prototype;
354 var prototypeOfObject = Object.prototype;
355 var slice = prototypeOfArray.slice;
356 var _toString = call.bind(prototypeOfObject.toString);
357 var owns = call.bind(prototypeOfObject.hasOwnProperty);
358 var defineGetter;
359 var defineSetter;
360 var lookupGetter;
361 var lookupSetter;
362 var supportsAccessors;
363 if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
364 defineGetter = call.bind(prototypeOfObject.__defineGetter__);
365 defineSetter = call.bind(prototypeOfObject.__defineSetter__);
366 lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
367 lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
368 }
369 if ([1,2].splice(0).length != 2) {
370 if(function() { // test IE < 9 to splice bug - see issue #138
371 function makeArray(l) {
372 var a = new Array(l+2);
373 a[0] = a[1] = 0;
374 return a;
375 }
376 var array = [], lengthBefore;
377
378 array.splice.apply(array, makeArray(20));
379 array.splice.apply(array, makeArray(26));
380
381 lengthBefore = array.length; //46
382 array.splice(5, 0, "XXX"); // add one element
383
384 lengthBefore + 1 == array.length
385
386 if (lengthBefore + 1 == array.length) {
387 return true;// has right splice implementation without bugs
388 }
389 }()) {//IE 6/7
390 var array_splice = Array.prototype.splice;
391 Array.prototype.splice = function(start, deleteCount) {
392 if (!arguments.length) {
393 return [];
394 } else {
395 return array_splice.apply(this, [
396 start === void 0 ? 0 : start,
397 deleteCount === void 0 ? (this.length - start) : deleteCount
398 ].concat(slice.call(arguments, 2)))
399 }
400 };
401 } else {//IE8
402 Array.prototype.splice = function(pos, removeCount){
403 var length = this.length;
404 if (pos > 0) {
405 if (pos > length)
406 pos = length;
407 } else if (pos == void 0) {
408 pos = 0;
409 } else if (pos < 0) {
410 pos = Math.max(length + pos, 0);
411 }
412
413 if (!(pos+removeCount < length))
414 removeCount = length - pos;
415
416 var removed = this.slice(pos, pos+removeCount);
417 var insert = slice.call(arguments, 2);
418 var add = insert.length;
419 if (pos === length) {
420 if (add) {
421 this.push.apply(this, insert);
422 }
423 } else {
424 var remove = Math.min(removeCount, length - pos);
425 var tailOldPos = pos + remove;
426 var tailNewPos = tailOldPos + add - remove;
427 var tailCount = length - tailOldPos;
428 var lengthAfterRemove = length - remove;
429
430 if (tailNewPos < tailOldPos) { // case A
431 for (var i = 0; i < tailCount; ++i) {
432 this[tailNewPos+i] = this[tailOldPos+i];
433 }
434 } else if (tailNewPos > tailOldPos) { // case B
435 for (i = tailCount; i--; ) {
436 this[tailNewPos+i] = this[tailOldPos+i];
437 }
438 } // else, add == remove (nothing to do)
439
440 if (add && pos === lengthAfterRemove) {
441 this.length = lengthAfterRemove; // truncate array
442 this.push.apply(this, insert);
443 } else {
444 this.length = lengthAfterRemove + add; // reserves space
445 for (i = 0; i < add; ++i) {
446 this[pos+i] = insert[i];
447 }
448 }
449 }
450 return removed;
451 };
452 }
453 }
454 if (!Array.isArray) {
455 Array.isArray = function isArray(obj) {
456 return _toString(obj) == "[object Array]";
457 };
458 }
459 var boxedString = Object("a"),
460 splitString = boxedString[0] != "a" || !(0 in boxedString);
461
462 if (!Array.prototype.forEach) {
463 Array.prototype.forEach = function forEach(fun /*, thisp*/) {
464 var object = toObject(this),
465 self = splitString && _toString(this) == "[object String]" ?
466 this.split("") :
467 object,
468 thisp = arguments[1],
469 i = -1,
470 length = self.length >>> 0;
471 if (_toString(fun) != "[object Function]") {
472 throw new TypeError(); // TODO message
473 }
474
475 while (++i < length) {
476 if (i in self) {
477 fun.call(thisp, self[i], i, object);
478 }
479 }
480 };
481 }
482 if (!Array.prototype.map) {
483 Array.prototype.map = function map(fun /*, thisp*/) {
484 var object = toObject(this),
485 self = splitString && _toString(this) == "[object String]" ?
486 this.split("") :
487 object,
488 length = self.length >>> 0,
489 result = Array(length),
490 thisp = arguments[1];
491 if (_toString(fun) != "[object Function]") {
492 throw new TypeError(fun + " is not a function");
493 }
494
495 for (var i = 0; i < length; i++) {
496 if (i in self)
497 result[i] = fun.call(thisp, self[i], i, object);
498 }
499 return result;
500 };
501 }
502 if (!Array.prototype.filter) {
503 Array.prototype.filter = function filter(fun /*, thisp */) {
504 var object = toObject(this),
505 self = splitString && _toString(this) == "[object String]" ?
506 this.split("") :
507 object,
508 length = self.length >>> 0,
509 result = [],
510 value,
511 thisp = arguments[1];
512 if (_toString(fun) != "[object Function]") {
513 throw new TypeError(fun + " is not a function");
514 }
515
516 for (var i = 0; i < length; i++) {
517 if (i in self) {
518 value = self[i];
519 if (fun.call(thisp, value, i, object)) {
520 result.push(value);
521 }
522 }
523 }
524 return result;
525 };
526 }
527 if (!Array.prototype.every) {
528 Array.prototype.every = function every(fun /*, thisp */) {
529 var object = toObject(this),
530 self = splitString && _toString(this) == "[object String]" ?
531 this.split("") :
532 object,
533 length = self.length >>> 0,
534 thisp = arguments[1];
535 if (_toString(fun) != "[object Function]") {
536 throw new TypeError(fun + " is not a function");
537 }
538
539 for (var i = 0; i < length; i++) {
540 if (i in self && !fun.call(thisp, self[i], i, object)) {
541 return false;
542 }
543 }
544 return true;
545 };
546 }
547 if (!Array.prototype.some) {
548 Array.prototype.some = function some(fun /*, thisp */) {
549 var object = toObject(this),
550 self = splitString && _toString(this) == "[object String]" ?
551 this.split("") :
552 object,
553 length = self.length >>> 0,
554 thisp = arguments[1];
555 if (_toString(fun) != "[object Function]") {
556 throw new TypeError(fun + " is not a function");
557 }
558
559 for (var i = 0; i < length; i++) {
560 if (i in self && fun.call(thisp, self[i], i, object)) {
561 return true;
562 }
563 }
564 return false;
565 };
566 }
567 if (!Array.prototype.reduce) {
568 Array.prototype.reduce = function reduce(fun /*, initial*/) {
569 var object = toObject(this),
570 self = splitString && _toString(this) == "[object String]" ?
571 this.split("") :
572 object,
573 length = self.length >>> 0;
574 if (_toString(fun) != "[object Function]") {
575 throw new TypeError(fun + " is not a function");
576 }
577 if (!length && arguments.length == 1) {
578 throw new TypeError("reduce of empty array with no initial value");
579 }
580
581 var i = 0;
582 var result;
583 if (arguments.length >= 2) {
584 result = arguments[1];
585 } else {
586 do {
587 if (i in self) {
588 result = self[i++];
589 break;
590 }
591 if (++i >= length) {
592 throw new TypeError("reduce of empty array with no initial value");
593 }
594 } while (true);
595 }
596
597 for (; i < length; i++) {
598 if (i in self) {
599 result = fun.call(void 0, result, self[i], i, object);
600 }
601 }
602
603 return result;
604 };
605 }
606 if (!Array.prototype.reduceRight) {
607 Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
608 var object = toObject(this),
609 self = splitString && _toString(this) == "[object String]" ?
610 this.split("") :
611 object,
612 length = self.length >>> 0;
613 if (_toString(fun) != "[object Function]") {
614 throw new TypeError(fun + " is not a function");
615 }
616 if (!length && arguments.length == 1) {
617 throw new TypeError("reduceRight of empty array with no initial value");
618 }
619
620 var result, i = length - 1;
621 if (arguments.length >= 2) {
622 result = arguments[1];
623 } else {
624 do {
625 if (i in self) {
626 result = self[i--];
627 break;
628 }
629 if (--i < 0) {
630 throw new TypeError("reduceRight of empty array with no initial value");
631 }
632 } while (true);
633 }
634
635 do {
636 if (i in this) {
637 result = fun.call(void 0, result, self[i], i, object);
638 }
639 } while (i--);
640
641 return result;
642 };
643 }
644 if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
645 Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
646 var self = splitString && _toString(this) == "[object String]" ?
647 this.split("") :
648 toObject(this),
649 length = self.length >>> 0;
650
651 if (!length) {
652 return -1;
653 }
654
655 var i = 0;
656 if (arguments.length > 1) {
657 i = toInteger(arguments[1]);
658 }
659 i = i >= 0 ? i : Math.max(0, length + i);
660 for (; i < length; i++) {
661 if (i in self && self[i] === sought) {
662 return i;
663 }
664 }
665 return -1;
666 };
667 }
668 if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
669 Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
670 var self = splitString && _toString(this) == "[object String]" ?
671 this.split("") :
672 toObject(this),
673 length = self.length >>> 0;
674
675 if (!length) {
676 return -1;
677 }
678 var i = length - 1;
679 if (arguments.length > 1) {
680 i = Math.min(i, toInteger(arguments[1]));
681 }
682 i = i >= 0 ? i : length - Math.abs(i);
683 for (; i >= 0; i--) {
684 if (i in self && sought === self[i]) {
685 return i;
686 }
687 }
688 return -1;
689 };
690 }
691 if (!Object.getPrototypeOf) {
692 Object.getPrototypeOf = function getPrototypeOf(object) {
693 return object.__proto__ || (
694 object.constructor ?
695 object.constructor.prototype :
696 prototypeOfObject
697 );
698 };
699 }
700 if (!Object.getOwnPropertyDescriptor) {
701 var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
702 "non-object: ";
703 Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
704 if ((typeof object != "object" && typeof object != "function") || object === null)
705 throw new TypeError(ERR_NON_OBJECT + object);
706 if (!owns(object, property))
707 return;
708
709 var descriptor, getter, setter;
710 descriptor = { enumerable: true, configurable: true };
711 if (supportsAccessors) {
712 var prototype = object.__proto__;
713 object.__proto__ = prototypeOfObject;
714
715 var getter = lookupGetter(object, property);
716 var setter = lookupSetter(object, property);
717 object.__proto__ = prototype;
718
719 if (getter || setter) {
720 if (getter) descriptor.get = getter;
721 if (setter) descriptor.set = setter;
722 return descriptor;
723 }
724 }
725 descriptor.value = object[property];
726 return descriptor;
727 };
728 }
729 if (!Object.getOwnPropertyNames) {
730 Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
731 return Object.keys(object);
732 };
733 }
734 if (!Object.create) {
735 var createEmpty;
736 if (Object.prototype.__proto__ === null) {
737 createEmpty = function () {
738 return { "__proto__": null };
739 };
740 } else {
741 createEmpty = function () {
742 var empty = {};
743 for (var i in empty)
744 empty[i] = null;
745 empty.constructor =
746 empty.hasOwnProperty =
747 empty.propertyIsEnumerable =
748 empty.isPrototypeOf =
749 empty.toLocaleString =
750 empty.toString =
751 empty.valueOf =
752 empty.__proto__ = null;
753 return empty;
754 }
755 }
756
757 Object.create = function create(prototype, properties) {
758 var object;
759 if (prototype === null) {
760 object = createEmpty();
761 } else {
762 if (typeof prototype != "object")
763 throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
764 var Type = function () {};
765 Type.prototype = prototype;
766 object = new Type();
767 object.__proto__ = prototype;
768 }
769 if (properties !== void 0)
770 Object.defineProperties(object, properties);
771 return object;
772 };
773 }
774
775 function doesDefinePropertyWork(object) {
776 try {
777 Object.defineProperty(object, "sentinel", {});
778 return "sentinel" in object;
779 } catch (exception) {
780 }
781 }
782 if (Object.defineProperty) {
783 var definePropertyWorksOnObject = doesDefinePropertyWork({});
784 var definePropertyWorksOnDom = typeof document == "undefined" ||
785 doesDefinePropertyWork(document.createElement("div"));
786 if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
787 var definePropertyFallback = Object.defineProperty;
788 }
789 }
790
791 if (!Object.defineProperty || definePropertyFallback) {
792 var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
793 var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
794 var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
795 "on this javascript engine";
796
797 Object.defineProperty = function defineProperty(object, property, descriptor) {
798 if ((typeof object != "object" && typeof object != "function") || object === null)
799 throw new TypeError(ERR_NON_OBJECT_TARGET + object);
800 if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
801 throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
802 if (definePropertyFallback) {
803 try {
804 return definePropertyFallback.call(Object, object, property, descriptor);
805 } catch (exception) {
806 }
807 }
808 if (owns(descriptor, "value")) {
809
810 if (supportsAccessors && (lookupGetter(object, property) ||
811 lookupSetter(object, property)))
812 {
813 var prototype = object.__proto__;
814 object.__proto__ = prototypeOfObject;
815 delete object[property];
816 object[property] = descriptor.value;
817 object.__proto__ = prototype;
818 } else {
819 object[property] = descriptor.value;
820 }
821 } else {
822 if (!supportsAccessors)
823 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
824 if (owns(descriptor, "get"))
825 defineGetter(object, property, descriptor.get);
826 if (owns(descriptor, "set"))
827 defineSetter(object, property, descriptor.set);
828 }
829
830 return object;
831 };
832 }
833 if (!Object.defineProperties) {
834 Object.defineProperties = function defineProperties(object, properties) {
835 for (var property in properties) {
836 if (owns(properties, property))
837 Object.defineProperty(object, property, properties[property]);
838 }
839 return object;
840 };
841 }
842 if (!Object.seal) {
843 Object.seal = function seal(object) {
844 return object;
845 };
846 }
847 if (!Object.freeze) {
848 Object.freeze = function freeze(object) {
849 return object;
850 };
851 }
852 try {
853 Object.freeze(function () {});
854 } catch (exception) {
855 Object.freeze = (function freeze(freezeObject) {
856 return function freeze(object) {
857 if (typeof object == "function") {
858 return object;
859 } else {
860 return freezeObject(object);
861 }
862 };
863 })(Object.freeze);
864 }
865 if (!Object.preventExtensions) {
866 Object.preventExtensions = function preventExtensions(object) {
867 return object;
868 };
869 }
870 if (!Object.isSealed) {
871 Object.isSealed = function isSealed(object) {
872 return false;
873 };
874 }
875 if (!Object.isFrozen) {
876 Object.isFrozen = function isFrozen(object) {
877 return false;
878 };
879 }
880 if (!Object.isExtensible) {
881 Object.isExtensible = function isExtensible(object) {
882 if (Object(object) === object) {
883 throw new TypeError(); // TODO message
884 }
885 var name = '';
886 while (owns(object, name)) {
887 name += '?';
888 }
889 object[name] = true;
890 var returnValue = owns(object, name);
891 delete object[name];
892 return returnValue;
893 };
894 }
895 if (!Object.keys) {
896 var hasDontEnumBug = true,
897 dontEnums = [
898 "toString",
899 "toLocaleString",
900 "valueOf",
901 "hasOwnProperty",
902 "isPrototypeOf",
903 "propertyIsEnumerable",
904 "constructor"
905 ],
906 dontEnumsLength = dontEnums.length;
907
908 for (var key in {"toString": null}) {
909 hasDontEnumBug = false;
910 }
911
912 Object.keys = function keys(object) {
913
914 if (
915 (typeof object != "object" && typeof object != "function") ||
916 object === null
917 ) {
918 throw new TypeError("Object.keys called on a non-object");
919 }
920
921 var keys = [];
922 for (var name in object) {
923 if (owns(object, name)) {
924 keys.push(name);
925 }
926 }
927
928 if (hasDontEnumBug) {
929 for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
930 var dontEnum = dontEnums[i];
931 if (owns(object, dontEnum)) {
932 keys.push(dontEnum);
933 }
934 }
935 }
936 return keys;
937 };
938
939 }
940 if (!Date.now) {
941 Date.now = function now() {
942 return new Date().getTime();
943 };
944 }
945 var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
946 "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
947 "\u2029\uFEFF";
948 if (!String.prototype.trim || ws.trim()) {
949 ws = "[" + ws + "]";
950 var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
951 trimEndRegexp = new RegExp(ws + ws + "*$");
952 String.prototype.trim = function trim() {
953 return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
954 };
955 }
956
957 function toInteger(n) {
958 n = +n;
959 if (n !== n) { // isNaN
960 n = 0;
961 } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
962 n = (n > 0 || -1) * Math.floor(Math.abs(n));
963 }
964 return n;
965 }
966
967 function isPrimitive(input) {
968 var type = typeof input;
969 return (
970 input === null ||
971 type === "undefined" ||
972 type === "boolean" ||
973 type === "number" ||
974 type === "string"
975 );
976 }
977
978 function toPrimitive(input) {
979 var val, valueOf, toString;
980 if (isPrimitive(input)) {
981 return input;
982 }
983 valueOf = input.valueOf;
984 if (typeof valueOf === "function") {
985 val = valueOf.call(input);
986 if (isPrimitive(val)) {
987 return val;
988 }
989 }
990 toString = input.toString;
991 if (typeof toString === "function") {
992 val = toString.call(input);
993 if (isPrimitive(val)) {
994 return val;
995 }
996 }
997 throw new TypeError();
998 }
999 var toObject = function (o) {
1000 if (o == null) { // this matches both null and undefined
1001 throw new TypeError("can't convert "+o+" to object");
1002 }
1003 return Object(o);
1004 };
1005
1006 });
1007
1008 define('ace/mode/lua_worker', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/worker/mirror', 'ace/mode/lua/luaparse'], function(require, exports, module) {
1009
1010
1011 var oop = require("../lib/oop");
1012 var Mirror = require("../worker/mirror").Mirror;
1013 var luaparse = require("../mode/lua/luaparse");
1014
1015 var Worker = exports.Worker = function(sender) {
1016 Mirror.call(this, sender);
1017 this.setTimeout(500);
1018 };
1019
1020 oop.inherits(Worker, Mirror);
1021
1022 (function() {
1023
1024 this.onUpdate = function() {
1025 var value = this.doc.getValue();
1026 try {
1027 luaparse.parse(value);
1028 } catch(e) {
1029 if (e instanceof SyntaxError) {
1030 this.sender.emit("error", {
1031 row: e.line - 1,
1032 column: e.column,
1033 text: e.message,
1034 type: "error"
1035 });
1036 }
1037 return;
1038 }
1039 this.sender.emit("ok");
1040 };
1041
1042 }).call(Worker.prototype);
1043
1044 });
1045 define('ace/worker/mirror', ['require', 'exports', 'module' , 'ace/document', 'ace/lib/lang'], function(require, exports, module) {
1046
1047
1048 var Document = require("../document").Document;
1049 var lang = require("../lib/lang");
1050
1051 var Mirror = exports.Mirror = function(sender) {
1052 this.sender = sender;
1053 var doc = this.doc = new Document("");
1054
1055 var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1056
1057 var _self = this;
1058 sender.on("change", function(e) {
1059 doc.applyDeltas(e.data);
1060 deferredUpdate.schedule(_self.$timeout);
1061 });
1062 };
1063
1064 (function() {
1065
1066 this.$timeout = 500;
1067
1068 this.setTimeout = function(timeout) {
1069 this.$timeout = timeout;
1070 };
1071
1072 this.setValue = function(value) {
1073 this.doc.setValue(value);
1074 this.deferredUpdate.schedule(this.$timeout);
1075 };
1076
1077 this.getValue = function(callbackId) {
1078 this.sender.callback(this.doc.getValue(), callbackId);
1079 };
1080
1081 this.onUpdate = function() {
1082 };
1083
1084 }).call(Mirror.prototype);
1085
1086 });
1087
1088 define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
1089
1090
1091 var oop = require("./lib/oop");
1092 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1093 var Range = require("./range").Range;
1094 var Anchor = require("./anchor").Anchor;
1095
1096 var Document = function(text) {
1097 this.$lines = [];
1098 if (text.length == 0) {
1099 this.$lines = [""];
1100 } else if (Array.isArray(text)) {
1101 this._insertLines(0, text);
1102 } else {
1103 this.insert({row: 0, column:0}, text);
1104 }
1105 };
1106
1107 (function() {
1108
1109 oop.implement(this, EventEmitter);
1110 this.setValue = function(text) {
1111 var len = this.getLength();
1112 this.remove(new Range(0, 0, len, this.getLine(len-1).length));
1113 this.insert({row: 0, column:0}, text);
1114 };
1115 this.getValue = function() {
1116 return this.getAllLines().join(this.getNewLineCharacter());
1117 };
1118 this.createAnchor = function(row, column) {
1119 return new Anchor(this, row, column);
1120 };
1121 if ("aaa".split(/a/).length == 0)
1122 this.$split = function(text) {
1123 return text.replace(/\r\n|\r/g, "\n").split("\n");
1124 }
1125 else
1126 this.$split = function(text) {
1127 return text.split(/\r\n|\r|\n/);
1128 };
1129
1130
1131 this.$detectNewLine = function(text) {
1132 var match = text.match(/^.*?(\r\n|\r|\n)/m);
1133 this.$autoNewLine = match ? match[1] : "\n";
1134 };
1135 this.getNewLineCharacter = function() {
1136 switch (this.$newLineMode) {
1137 case "windows":
1138 return "\r\n";
1139 case "unix":
1140 return "\n";
1141 default:
1142 return this.$autoNewLine;
1143 }
1144 };
1145
1146 this.$autoNewLine = "\n";
1147 this.$newLineMode = "auto";
1148 this.setNewLineMode = function(newLineMode) {
1149 if (this.$newLineMode === newLineMode)
1150 return;
1151
1152 this.$newLineMode = newLineMode;
1153 };
1154 this.getNewLineMode = function() {
1155 return this.$newLineMode;
1156 };
1157 this.isNewLine = function(text) {
1158 return (text == "\r\n" || text == "\r" || text == "\n");
1159 };
1160 this.getLine = function(row) {
1161 return this.$lines[row] || "";
1162 };
1163 this.getLines = function(firstRow, lastRow) {
1164 return this.$lines.slice(firstRow, lastRow + 1);
1165 };
1166 this.getAllLines = function() {
1167 return this.getLines(0, this.getLength());
1168 };
1169 this.getLength = function() {
1170 return this.$lines.length;
1171 };
1172 this.getTextRange = function(range) {
1173 if (range.start.row == range.end.row) {
1174 return this.$lines[range.start.row]
1175 .substring(range.start.column, range.end.column);
1176 }
1177 var lines = this.getLines(range.start.row, range.end.row);
1178 lines[0] = (lines[0] || "").substring(range.start.column);
1179 var l = lines.length - 1;
1180 if (range.end.row - range.start.row == l)
1181 lines[l] = lines[l].substring(0, range.end.column);
1182 return lines.join(this.getNewLineCharacter());
1183 };
1184
1185 this.$clipPosition = function(position) {
1186 var length = this.getLength();
1187 if (position.row >= length) {
1188 position.row = Math.max(0, length - 1);
1189 position.column = this.getLine(length-1).length;
1190 } else if (position.row < 0)
1191 position.row = 0;
1192 return position;
1193 };
1194 this.insert = function(position, text) {
1195 if (!text || text.length === 0)
1196 return position;
1197
1198 position = this.$clipPosition(position);
1199 if (this.getLength() <= 1)
1200 this.$detectNewLine(text);
1201
1202 var lines = this.$split(text);
1203 var firstLine = lines.splice(0, 1)[0];
1204 var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
1205
1206 position = this.insertInLine(position, firstLine);
1207 if (lastLine !== null) {
1208 position = this.insertNewLine(position); // terminate first line
1209 position = this._insertLines(position.row, lines);
1210 position = this.insertInLine(position, lastLine || "");
1211 }
1212 return position;
1213 };
1214 this.insertLines = function(row, lines) {
1215 if (row >= this.getLength())
1216 return this.insert({row: row, column: 0}, "\n" + lines.join("\n"));
1217 return this._insertLines(Math.max(row, 0), lines);
1218 };
1219 this._insertLines = function(row, lines) {
1220 if (lines.length == 0)
1221 return {row: row, column: 0};
1222 if (lines.length > 0xFFFF) {
1223 var end = this._insertLines(row, lines.slice(0xFFFF));
1224 lines = lines.slice(0, 0xFFFF);
1225 }
1226
1227 var args = [row, 0];
1228 args.push.apply(args, lines);
1229 this.$lines.splice.apply(this.$lines, args);
1230
1231 var range = new Range(row, 0, row + lines.length, 0);
1232 var delta = {
1233 action: "insertLines",
1234 range: range,
1235 lines: lines
1236 };
1237 this._emit("change", { data: delta });
1238 return end || range.end;
1239 };
1240 this.insertNewLine = function(position) {
1241 position = this.$clipPosition(position);
1242 var line = this.$lines[position.row] || "";
1243
1244 this.$lines[position.row] = line.substring(0, position.column);
1245 this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
1246
1247 var end = {
1248 row : position.row + 1,
1249 column : 0
1250 };
1251
1252 var delta = {
1253 action: "insertText",
1254 range: Range.fromPoints(position, end),
1255 text: this.getNewLineCharacter()
1256 };
1257 this._emit("change", { data: delta });
1258
1259 return end;
1260 };
1261 this.insertInLine = function(position, text) {
1262 if (text.length == 0)
1263 return position;
1264
1265 var line = this.$lines[position.row] || "";
1266
1267 this.$lines[position.row] = line.substring(0, position.column) + text
1268 + line.substring(position.column);
1269
1270 var end = {
1271 row : position.row,
1272 column : position.column + text.length
1273 };
1274
1275 var delta = {
1276 action: "insertText",
1277 range: Range.fromPoints(position, end),
1278 text: text
1279 };
1280 this._emit("change", { data: delta });
1281
1282 return end;
1283 };
1284 this.remove = function(range) {
1285 range.start = this.$clipPosition(range.start);
1286 range.end = this.$clipPosition(range.end);
1287
1288 if (range.isEmpty())
1289 return range.start;
1290
1291 var firstRow = range.start.row;
1292 var lastRow = range.end.row;
1293
1294 if (range.isMultiLine()) {
1295 var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
1296 var lastFullRow = lastRow - 1;
1297
1298 if (range.end.column > 0)
1299 this.removeInLine(lastRow, 0, range.end.column);
1300
1301 if (lastFullRow >= firstFullRow)
1302 this._removeLines(firstFullRow, lastFullRow);
1303
1304 if (firstFullRow != firstRow) {
1305 this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
1306 this.removeNewLine(range.start.row);
1307 }
1308 }
1309 else {
1310 this.removeInLine(firstRow, range.start.column, range.end.column);
1311 }
1312 return range.start;
1313 };
1314 this.removeInLine = function(row, startColumn, endColumn) {
1315 if (startColumn == endColumn)
1316 return;
1317
1318 var range = new Range(row, startColumn, row, endColumn);
1319 var line = this.getLine(row);
1320 var removed = line.substring(startColumn, endColumn);
1321 var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
1322 this.$lines.splice(row, 1, newLine);
1323
1324 var delta = {
1325 action: "removeText",
1326 range: range,
1327 text: removed
1328 };
1329 this._emit("change", { data: delta });
1330 return range.start;
1331 };
1332 this.removeLines = function(firstRow, lastRow) {
1333 if (firstRow < 0 || lastRow >= this.getLength())
1334 return this.remove(new Range(firstRow, 0, lastRow + 1, 0));
1335 return this._removeLines(firstRow, lastRow);
1336 };
1337
1338 this._removeLines = function(firstRow, lastRow) {
1339 var range = new Range(firstRow, 0, lastRow + 1, 0);
1340 var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
1341
1342 var delta = {
1343 action: "removeLines",
1344 range: range,
1345 nl: this.getNewLineCharacter(),
1346 lines: removed
1347 };
1348 this._emit("change", { data: delta });
1349 return removed;
1350 };
1351 this.removeNewLine = function(row) {
1352 var firstLine = this.getLine(row);
1353 var secondLine = this.getLine(row+1);
1354
1355 var range = new Range(row, firstLine.length, row+1, 0);
1356 var line = firstLine + secondLine;
1357
1358 this.$lines.splice(row, 2, line);
1359
1360 var delta = {
1361 action: "removeText",
1362 range: range,
1363 text: this.getNewLineCharacter()
1364 };
1365 this._emit("change", { data: delta });
1366 };
1367 this.replace = function(range, text) {
1368 if (text.length == 0 && range.isEmpty())
1369 return range.start;
1370 if (text == this.getTextRange(range))
1371 return range.end;
1372
1373 this.remove(range);
1374 if (text) {
1375 var end = this.insert(range.start, text);
1376 }
1377 else {
1378 end = range.start;
1379 }
1380
1381 return end;
1382 };
1383 this.applyDeltas = function(deltas) {
1384 for (var i=0; i<deltas.length; i++) {
1385 var delta = deltas[i];
1386 var range = Range.fromPoints(delta.range.start, delta.range.end);
1387
1388 if (delta.action == "insertLines")
1389 this.insertLines(range.start.row, delta.lines);
1390 else if (delta.action == "insertText")
1391 this.insert(range.start, delta.text);
1392 else if (delta.action == "removeLines")
1393 this._removeLines(range.start.row, range.end.row - 1);
1394 else if (delta.action == "removeText")
1395 this.remove(range);
1396 }
1397 };
1398 this.revertDeltas = function(deltas) {
1399 for (var i=deltas.length-1; i>=0; i--) {
1400 var delta = deltas[i];
1401
1402 var range = Range.fromPoints(delta.range.start, delta.range.end);
1403
1404 if (delta.action == "insertLines")
1405 this._removeLines(range.start.row, range.end.row - 1);
1406 else if (delta.action == "insertText")
1407 this.remove(range);
1408 else if (delta.action == "removeLines")
1409 this._insertLines(range.start.row, delta.lines);
1410 else if (delta.action == "removeText")
1411 this.insert(range.start, delta.text);
1412 }
1413 };
1414 this.indexToPosition = function(index, startRow) {
1415 var lines = this.$lines || this.getAllLines();
1416 var newlineLength = this.getNewLineCharacter().length;
1417 for (var i = startRow || 0, l = lines.length; i < l; i++) {
1418 index -= lines[i].length + newlineLength;
1419 if (index < 0)
1420 return {row: i, column: index + lines[i].length + newlineLength};
1421 }
1422 return {row: l-1, column: lines[l-1].length};
1423 };
1424 this.positionToIndex = function(pos, startRow) {
1425 var lines = this.$lines || this.getAllLines();
1426 var newlineLength = this.getNewLineCharacter().length;
1427 var index = 0;
1428 var row = Math.min(pos.row, lines.length);
1429 for (var i = startRow || 0; i < row; ++i)
1430 index += lines[i].length + newlineLength;
1431
1432 return index + pos.column;
1433 };
1434
1435 }).call(Document.prototype);
1436
1437 exports.Document = Document;
1438 });
1439
1440 define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
1441
1442 var comparePoints = function(p1, p2) {
1443 return p1.row - p2.row || p1.column - p2.column;
1444 };
1445 var Range = function(startRow, startColumn, endRow, endColumn) {
1446 this.start = {
1447 row: startRow,
1448 column: startColumn
1449 };
1450
1451 this.end = {
1452 row: endRow,
1453 column: endColumn
1454 };
1455 };
1456
1457 (function() {
1458 this.isEqual = function(range) {
1459 return this.start.row === range.start.row &&
1460 this.end.row === range.end.row &&
1461 this.start.column === range.start.column &&
1462 this.end.column === range.end.column;
1463 };
1464 this.toString = function() {
1465 return ("Range: [" + this.start.row + "/" + this.start.column +
1466 "] -> [" + this.end.row + "/" + this.end.column + "]");
1467 };
1468
1469 this.contains = function(row, column) {
1470 return this.compare(row, column) == 0;
1471 };
1472 this.compareRange = function(range) {
1473 var cmp,
1474 end = range.end,
1475 start = range.start;
1476
1477 cmp = this.compare(end.row, end.column);
1478 if (cmp == 1) {
1479 cmp = this.compare(start.row, start.column);
1480 if (cmp == 1) {
1481 return 2;
1482 } else if (cmp == 0) {
1483 return 1;
1484 } else {
1485 return 0;
1486 }
1487 } else if (cmp == -1) {
1488 return -2;
1489 } else {
1490 cmp = this.compare(start.row, start.column);
1491 if (cmp == -1) {
1492 return -1;
1493 } else if (cmp == 1) {
1494 return 42;
1495 } else {
1496 return 0;
1497 }
1498 }
1499 };
1500 this.comparePoint = function(p) {
1501 return this.compare(p.row, p.column);
1502 };
1503 this.containsRange = function(range) {
1504 return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
1505 };
1506 this.intersects = function(range) {
1507 var cmp = this.compareRange(range);
1508 return (cmp == -1 || cmp == 0 || cmp == 1);
1509 };
1510 this.isEnd = function(row, column) {
1511 return this.end.row == row && this.end.column == column;
1512 };
1513 this.isStart = function(row, column) {
1514 return this.start.row == row && this.start.column == column;
1515 };
1516 this.setStart = function(row, column) {
1517 if (typeof row == "object") {
1518 this.start.column = row.column;
1519 this.start.row = row.row;
1520 } else {
1521 this.start.row = row;
1522 this.start.column = column;
1523 }
1524 };
1525 this.setEnd = function(row, column) {
1526 if (typeof row == "object") {
1527 this.end.column = row.column;
1528 this.end.row = row.row;
1529 } else {
1530 this.end.row = row;
1531 this.end.column = column;
1532 }
1533 };
1534 this.inside = function(row, column) {
1535 if (this.compare(row, column) == 0) {
1536 if (this.isEnd(row, column) || this.isStart(row, column)) {
1537 return false;
1538 } else {
1539 return true;
1540 }
1541 }
1542 return false;
1543 };
1544 this.insideStart = function(row, column) {
1545 if (this.compare(row, column) == 0) {
1546 if (this.isEnd(row, column)) {
1547 return false;
1548 } else {
1549 return true;
1550 }
1551 }
1552 return false;
1553 };
1554 this.insideEnd = function(row, column) {
1555 if (this.compare(row, column) == 0) {
1556 if (this.isStart(row, column)) {
1557 return false;
1558 } else {
1559 return true;
1560 }
1561 }
1562 return false;
1563 };
1564 this.compare = function(row, column) {
1565 if (!this.isMultiLine()) {
1566 if (row === this.start.row) {
1567 return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
1568 };
1569 }
1570
1571 if (row < this.start.row)
1572 return -1;
1573
1574 if (row > this.end.row)
1575 return 1;
1576
1577 if (this.start.row === row)
1578 return column >= this.start.column ? 0 : -1;
1579
1580 if (this.end.row === row)
1581 return column <= this.end.column ? 0 : 1;
1582
1583 return 0;
1584 };
1585 this.compareStart = function(row, column) {
1586 if (this.start.row == row && this.start.column == column) {
1587 return -1;
1588 } else {
1589 return this.compare(row, column);
1590 }
1591 };
1592 this.compareEnd = function(row, column) {
1593 if (this.end.row == row && this.end.column == column) {
1594 return 1;
1595 } else {
1596 return this.compare(row, column);
1597 }
1598 };
1599 this.compareInside = function(row, column) {
1600 if (this.end.row == row && this.end.column == column) {
1601 return 1;
1602 } else if (this.start.row == row && this.start.column == column) {
1603 return -1;
1604 } else {
1605 return this.compare(row, column);
1606 }
1607 };
1608 this.clipRows = function(firstRow, lastRow) {
1609 if (this.end.row > lastRow)
1610 var end = {row: lastRow + 1, column: 0};
1611 else if (this.end.row < firstRow)
1612 var end = {row: firstRow, column: 0};
1613
1614 if (this.start.row > lastRow)
1615 var start = {row: lastRow + 1, column: 0};
1616 else if (this.start.row < firstRow)
1617 var start = {row: firstRow, column: 0};
1618
1619 return Range.fromPoints(start || this.start, end || this.end);
1620 };
1621 this.extend = function(row, column) {
1622 var cmp = this.compare(row, column);
1623
1624 if (cmp == 0)
1625 return this;
1626 else if (cmp == -1)
1627 var start = {row: row, column: column};
1628 else
1629 var end = {row: row, column: column};
1630
1631 return Range.fromPoints(start || this.start, end || this.end);
1632 };
1633
1634 this.isEmpty = function() {
1635 return (this.start.row === this.end.row && this.start.column === this.end.column);
1636 };
1637 this.isMultiLine = function() {
1638 return (this.start.row !== this.end.row);
1639 };
1640 this.clone = function() {
1641 return Range.fromPoints(this.start, this.end);
1642 };
1643 this.collapseRows = function() {
1644 if (this.end.column == 0)
1645 return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
1646 else
1647 return new Range(this.start.row, 0, this.end.row, 0)
1648 };
1649 this.toScreenRange = function(session) {
1650 var screenPosStart = session.documentToScreenPosition(this.start);
1651 var screenPosEnd = session.documentToScreenPosition(this.end);
1652
1653 return new Range(
1654 screenPosStart.row, screenPosStart.column,
1655 screenPosEnd.row, screenPosEnd.column
1656 );
1657 };
1658 this.moveBy = function(row, column) {
1659 this.start.row += row;
1660 this.start.column += column;
1661 this.end.row += row;
1662 this.end.column += column;
1663 };
1664
1665 }).call(Range.prototype);
1666 Range.fromPoints = function(start, end) {
1667 return new Range(start.row, start.column, end.row, end.column);
1668 };
1669 Range.comparePoints = comparePoints;
1670
1671 Range.comparePoints = function(p1, p2) {
1672 return p1.row - p2.row || p1.column - p2.column;
1673 };
1674
1675
1676 exports.Range = Range;
1677 });
1678
1679 define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
1680
1681
1682 var oop = require("./lib/oop");
1683 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1684
1685 var Anchor = exports.Anchor = function(doc, row, column) {
1686 this.document = doc;
1687
1688 if (typeof column == "undefined")
1689 this.setPosition(row.row, row.column);
1690 else
1691 this.setPosition(row, column);
1692
1693 this.$onChange = this.onChange.bind(this);
1694 doc.on("change", this.$onChange);
1695 };
1696
1697 (function() {
1698
1699 oop.implement(this, EventEmitter);
1700
1701 this.getPosition = function() {
1702 return this.$clipPositionToDocument(this.row, this.column);
1703 };
1704
1705 this.getDocument = function() {
1706 return this.document;
1707 };
1708
1709 this.onChange = function(e) {
1710 var delta = e.data;
1711 var range = delta.range;
1712
1713 if (range.start.row == range.end.row && range.start.row != this.row)
1714 return;
1715
1716 if (range.start.row > this.row)
1717 return;
1718
1719 if (range.start.row == this.row && range.start.column > this.column)
1720 return;
1721
1722 var row = this.row;
1723 var column = this.column;
1724 var start = range.start;
1725 var end = range.end;
1726
1727 if (delta.action === "insertText") {
1728 if (start.row === row && start.column <= column) {
1729 if (start.row === end.row) {
1730 column += end.column - start.column;
1731 } else {
1732 column -= start.column;
1733 row += end.row - start.row;
1734 }
1735 } else if (start.row !== end.row && start.row < row) {
1736 row += end.row - start.row;
1737 }
1738 } else if (delta.action === "insertLines") {
1739 if (start.row <= row) {
1740 row += end.row - start.row;
1741 }
1742 } else if (delta.action === "removeText") {
1743 if (start.row === row && start.column < column) {
1744 if (end.column >= column)
1745 column = start.column;
1746 else
1747 column = Math.max(0, column - (end.column - start.column));
1748
1749 } else if (start.row !== end.row && start.row < row) {
1750 if (end.row === row)
1751 column = Math.max(0, column - end.column) + start.column;
1752 row -= (end.row - start.row);
1753 } else if (end.row === row) {
1754 row -= end.row - start.row;
1755 column = Math.max(0, column - end.column) + start.column;
1756 }
1757 } else if (delta.action == "removeLines") {
1758 if (start.row <= row) {
1759 if (end.row <= row)
1760 row -= end.row - start.row;
1761 else {
1762 row = start.row;
1763 column = 0;
1764 }
1765 }
1766 }
1767
1768 this.setPosition(row, column, true);
1769 };
1770
1771 this.setPosition = function(row, column, noClip) {
1772 var pos;
1773 if (noClip) {
1774 pos = {
1775 row: row,
1776 column: column
1777 };
1778 } else {
1779 pos = this.$clipPositionToDocument(row, column);
1780 }
1781
1782 if (this.row == pos.row && this.column == pos.column)
1783 return;
1784
1785 var old = {
1786 row: this.row,
1787 column: this.column
1788 };
1789
1790 this.row = pos.row;
1791 this.column = pos.column;
1792 this._emit("change", {
1793 old: old,
1794 value: pos
1795 });
1796 };
1797
1798 this.detach = function() {
1799 this.document.removeEventListener("change", this.$onChange);
1800 };
1801 this.$clipPositionToDocument = function(row, column) {
1802 var pos = {};
1803
1804 if (row >= this.document.getLength()) {
1805 pos.row = Math.max(0, this.document.getLength() - 1);
1806 pos.column = this.document.getLine(pos.row).length;
1807 }
1808 else if (row < 0) {
1809 pos.row = 0;
1810 pos.column = 0;
1811 }
1812 else {
1813 pos.row = row;
1814 pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
1815 }
1816
1817 if (column < 0)
1818 pos.column = 0;
1819
1820 return pos;
1821 };
1822
1823 }).call(Anchor.prototype);
1824
1825 });
1826
1827 define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
1828
1829
1830 exports.stringReverse = function(string) {
1831 return string.split("").reverse().join("");
1832 };
1833
1834 exports.stringRepeat = function (string, count) {
1835 var result = '';
1836 while (count > 0) {
1837 if (count & 1)
1838 result += string;
1839
1840 if (count >>= 1)
1841 string += string;
1842 }
1843 return result;
1844 };
1845
1846 var trimBeginRegexp = /^\s\s*/;
1847 var trimEndRegexp = /\s\s*$/;
1848
1849 exports.stringTrimLeft = function (string) {
1850 return string.replace(trimBeginRegexp, '');
1851 };
1852
1853 exports.stringTrimRight = function (string) {
1854 return string.replace(trimEndRegexp, '');
1855 };
1856
1857 exports.copyObject = function(obj) {
1858 var copy = {};
1859 for (var key in obj) {
1860 copy[key] = obj[key];
1861 }
1862 return copy;
1863 };
1864
1865 exports.copyArray = function(array){
1866 var copy = [];
1867 for (var i=0, l=array.length; i<l; i++) {
1868 if (array[i] && typeof array[i] == "object")
1869 copy[i] = this.copyObject( array[i] );
1870 else
1871 copy[i] = array[i];
1872 }
1873 return copy;
1874 };
1875
1876 exports.deepCopy = function (obj) {
1877 if (typeof obj != "object") {
1878 return obj;
1879 }
1880
1881 var copy = obj.constructor();
1882 for (var key in obj) {
1883 if (typeof obj[key] == "object") {
1884 copy[key] = this.deepCopy(obj[key]);
1885 } else {
1886 copy[key] = obj[key];
1887 }
1888 }
1889 return copy;
1890 };
1891
1892 exports.arrayToMap = function(arr) {
1893 var map = {};
1894 for (var i=0; i<arr.length; i++) {
1895 map[arr[i]] = 1;
1896 }
1897 return map;
1898
1899 };
1900
1901 exports.createMap = function(props) {
1902 var map = Object.create(null);
1903 for (var i in props) {
1904 map[i] = props[i];
1905 }
1906 return map;
1907 };
1908 exports.arrayRemove = function(array, value) {
1909 for (var i = 0; i <= array.length; i++) {
1910 if (value === array[i]) {
1911 array.splice(i, 1);
1912 }
1913 }
1914 };
1915
1916 exports.escapeRegExp = function(str) {
1917 return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
1918 };
1919
1920 exports.escapeHTML = function(str) {
1921 return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
1922 };
1923
1924 exports.getMatchOffsets = function(string, regExp) {
1925 var matches = [];
1926
1927 string.replace(regExp, function(str) {
1928 matches.push({
1929 offset: arguments[arguments.length-2],
1930 length: str.length
1931 });
1932 });
1933
1934 return matches;
1935 };
1936 exports.deferredCall = function(fcn) {
1937
1938 var timer = null;
1939 var callback = function() {
1940 timer = null;
1941 fcn();
1942 };
1943
1944 var deferred = function(timeout) {
1945 deferred.cancel();
1946 timer = setTimeout(callback, timeout || 0);
1947 return deferred;
1948 };
1949
1950 deferred.schedule = deferred;
1951
1952 deferred.call = function() {
1953 this.cancel();
1954 fcn();
1955 return deferred;
1956 };
1957
1958 deferred.cancel = function() {
1959 clearTimeout(timer);
1960 timer = null;
1961 return deferred;
1962 };
1963
1964 return deferred;
1965 };
1966
1967
1968 exports.delayedCall = function(fcn, defaultTimeout) {
1969 var timer = null;
1970 var callback = function() {
1971 timer = null;
1972 fcn();
1973 };
1974
1975 var _self = function(timeout) {
1976 timer && clearTimeout(timer);
1977 timer = setTimeout(callback, timeout || defaultTimeout);
1978 };
1979
1980 _self.delay = _self;
1981 _self.schedule = function(timeout) {
1982 if (timer == null)
1983 timer = setTimeout(callback, timeout || 0);
1984 };
1985
1986 _self.call = function() {
1987 this.cancel();
1988 fcn();
1989 };
1990
1991 _self.cancel = function() {
1992 timer && clearTimeout(timer);
1993 timer = null;
1994 };
1995
1996 _self.isPending = function() {
1997 return timer;
1998 };
1999
2000 return _self;
2001 };
2002 });
2003 define('ace/mode/lua/luaparse', ['require', 'exports', 'module' , 'exports'], function(require, exports, module) {
2004
2005 (function (root, name, factory) {
2006
2007
2008 if (typeof exports !== 'undefined') {
2009 factory(exports);
2010 } else if (typeof define === 'function' && define.amd) {
2011 define(['exports'], factory);
2012 } else {
2013 factory((root[name] = {}));
2014 }
2015 }(this, 'luaparse', function (exports) {
2016
2017
2018 exports.version = '0.0.11';
2019
2020 var input, options, length;
2021 var defaultOptions = exports.defaultOptions = {
2022 wait: false
2023 , comments: true
2024 , scope: false
2025 };
2026
2027 var EOF = 1, StringLiteral = 2, Keyword = 4, Identifier = 8
2028 , NumericLiteral = 16, Punctuator = 32, BooleanLiteral = 64
2029 , NilLiteral = 128, VarargLiteral = 256;
2030
2031 var errors = exports.errors = {
2032 unexpected: 'Unexpected %1 \'%2\' near \'%3\''
2033 , expected: '\'%1\' expected near \'%2\''
2034 , expectedToken: '%1 expected near \'%2\''
2035 , unfinishedString: 'unfinished string near \'%1\''
2036 , malformedNumber: 'malformed number near \'%1\''
2037 };
2038
2039 var ast = exports.ast = {
2040 labelStatement: function(label) {
2041 return {
2042 type: 'LabelStatement'
2043 , label: label
2044 };
2045 }
2046
2047 , breakStatement: function() {
2048 return {
2049 type: 'BreakStatement'
2050 };
2051 }
2052
2053 , gotoStatement: function(label) {
2054 return {
2055 type: 'GotoStatement'
2056 , label: label
2057 };
2058 }
2059
2060 , returnStatement: function(args) {
2061 return {
2062 type: 'ReturnStatement'
2063 , 'arguments': args
2064 };
2065 }
2066
2067 , ifStatement: function(clauses) {
2068 return {
2069 type: 'IfStatement'
2070 , clauses: clauses
2071 };
2072 }
2073 , ifClause: function(condition, body) {
2074 return {
2075 type: 'IfClause'
2076 , condition: condition
2077 , body: body
2078 };
2079 }
2080 , elseifClause: function(condition, body) {
2081 return {
2082 type: 'ElseifClause'
2083 , condition: condition
2084 , body: body
2085 };
2086 }
2087 , elseClause: function(body) {
2088 return {
2089 type: 'ElseClause'
2090 , body: body
2091 };
2092 }
2093
2094 , whileStatement: function(condition, body) {
2095 return {
2096 type: 'WhileStatement'
2097 , condition: condition
2098 , body: body
2099 };
2100 }
2101
2102 , doStatement: function(body) {
2103 return {
2104 type: 'DoStatement'
2105 , body: body
2106 };
2107 }
2108
2109 , repeatStatement: function(condition, body) {
2110 return {
2111 type: 'RepeatStatement'
2112 , condition: condition
2113 , body: body
2114 };
2115 }
2116
2117 , localStatement: function(variables, init) {
2118 return {
2119 type: 'LocalStatement'
2120 , variables: variables
2121 , init: init
2122 };
2123 }
2124
2125 , assignmentStatement: function(variables, init) {
2126 return {
2127 type: 'AssignmentStatement'
2128 , variables: variables
2129 , init: init
2130 };
2131 }
2132
2133 , callStatement: function(expression) {
2134 return {
2135 type: 'CallStatement'
2136 , expression: expression
2137 };
2138 }
2139
2140 , functionStatement: function(identifier, parameters, isLocal, body) {
2141 return {
2142 type: 'FunctionDeclaration'
2143 , identifier: identifier
2144 , isLocal: isLocal
2145 , parameters: parameters
2146 , body: body
2147 };
2148 }
2149
2150 , forNumericStatement: function(variable, start, end, step, body) {
2151 return {
2152 type: 'ForNumericStatement'
2153 , variable: variable
2154 , start: start
2155 , end: end
2156 , step: step
2157 , body: body
2158 };
2159 }
2160
2161 , forGenericStatement: function(variables, iterators, body) {
2162 return {
2163 type: 'ForGenericStatement'
2164 , variables: variables
2165 , iterators: iterators
2166 , body: body
2167 };
2168 }
2169
2170 , chunk: function(body) {
2171 return {
2172 type: 'Chunk'
2173 , body: body
2174 };
2175 }
2176
2177 , identifier: function(name) {
2178 return {
2179 type: 'Identifier'
2180 , name: name
2181 };
2182 }
2183
2184 , literal: function(type, value, raw) {
2185 type = (type === StringLiteral) ? 'StringLiteral'
2186 : (type === NumericLiteral) ? 'NumericLiteral'
2187 : (type === BooleanLiteral) ? 'BooleanLiteral'
2188 : (type === NilLiteral) ? 'NilLiteral'
2189 : 'VarargLiteral';
2190
2191 return {
2192 type: type
2193 , value: value
2194 , raw: raw
2195 };
2196 }
2197
2198 , tableKey: function(key, value) {
2199 return {
2200 type: 'TableKey'
2201 , key: key
2202 , value: value
2203 };
2204 }
2205 , tableKeyString: function(key, value) {
2206 return {
2207 type: 'TableKeyString'
2208 , key: key
2209 , value: value
2210 };
2211 }
2212 , tableValue: function(value) {
2213 return {
2214 type: 'TableValue'
2215 , value: value
2216 };
2217 }
2218
2219
2220 , tableConstructorExpression: function(fields) {
2221 return {
2222 type: 'TableConstructorExpression'
2223 , fields: fields
2224 };
2225 }
2226 , binaryExpression: function(operator, left, right) {
2227 var type = ('and' === operator || 'or' === operator) ?
2228 'LogicalExpression' :
2229 'BinaryExpression';
2230
2231 return {
2232 type: type
2233 , operator: operator
2234 , left: left
2235 , right: right
2236 };
2237 }
2238 , unaryExpression: function(operator, argument) {
2239 return {
2240 type: 'UnaryExpression'
2241 , operator: operator
2242 , argument: argument
2243 };
2244 }
2245 , memberExpression: function(base, indexer, identifier) {
2246 return {
2247 type: 'MemberExpression'
2248 , indexer: indexer
2249 , identifier: identifier
2250 , base: base
2251 };
2252 }
2253
2254 , indexExpression: function(base, index) {
2255 return {
2256 type: 'IndexExpression'
2257 , base: base
2258 , index: index
2259 };
2260 }
2261
2262 , callExpression: function(base, args) {
2263 return {
2264 type: 'CallExpression'
2265 , base: base
2266 , 'arguments': args
2267 };
2268 }
2269
2270 , tableCallExpression: function(base, args) {
2271 return {
2272 type: 'TableCallExpression'
2273 , base: base
2274 , 'arguments': args
2275 };
2276 }
2277
2278 , stringCallExpression: function(base, argument) {
2279 return {
2280 type: 'StringCallExpression'
2281 , base: base
2282 , argument: argument
2283 };
2284 }
2285 };
2286
2287 var slice = Array.prototype.slice
2288 , toString = Object.prototype.toString
2289 , indexOf = Array.prototype.indexOf || function indexOf(element) {
2290 for (var i = 0, length = this.length; i < length; i++) {
2291 if (this[i] === element) return i;
2292 }
2293 return -1;
2294 };
2295
2296 function sprintf(format) {
2297 var args = slice.call(arguments, 1);
2298 format = format.replace(/%(\d)/g, function (match, index) {
2299 return '' + args[index - 1] || '';
2300 });
2301 return format;
2302 }
2303
2304 function extend() {
2305 var args = slice.call(arguments)
2306 , dest = {}
2307 , src, prop;
2308
2309 for (var i = 0, l = args.length; i < l; i++) {
2310 src = args[i];
2311 for (prop in src) if (src.hasOwnProperty(prop)) {
2312 dest[prop] = src[prop];
2313 }
2314 }
2315 return dest;
2316 }
2317
2318 function raise(token) {
2319 var message = sprintf.apply(null, slice.call(arguments, 1))
2320 , error, col;
2321
2322 if ('undefined' !== typeof token.line) {
2323 col = token.range[0] - token.lineStart;
2324 error = new SyntaxError(sprintf('[%1:%2] %3', token.line, col, message));
2325 error.line = token.line;
2326 error.index = token.range[0];
2327 error.column = col;
2328 } else {
2329 col = index - lineStart + 1;
2330 error = new SyntaxError(sprintf('[%1:%2] %3', line, col, message));
2331 error.index = index;
2332 error.line = line;
2333 error.column = col;
2334 }
2335 throw error;
2336 }
2337
2338 function raiseUnexpectedToken(type, token) {
2339 raise(token, errors.expectedToken, type, token.value);
2340 }
2341
2342 function unexpected(found, near) {
2343 if ('undefined' === typeof near) near = lookahead.value;
2344 if ('undefined' !== typeof found.type) {
2345 var type;
2346 switch (found.type) {
2347 case StringLiteral: type = 'string'; break;
2348 case Keyword: type = 'keyword'; break;
2349 case Identifier: type = 'identifier'; break;
2350 case NumericLiteral: type = 'number'; break;
2351 case Punctuator: type = 'symbol'; break;
2352 case BooleanLiteral: type = 'boolean'; break;
2353 case NilLiteral:
2354 return raise(found, errors.unexpected, 'symbol', 'nil', near);
2355 }
2356 return raise(found, errors.unexpected, type, found.value, near);
2357 }
2358 return raise(found, errors.unexpected, 'symbol', found, near);
2359 }
2360
2361 var index
2362 , token
2363 , lookahead
2364 , comments
2365 , tokenStart
2366 , line
2367 , lineStart;
2368
2369 function readToken() {
2370 skipWhiteSpace();
2371 while (45 === input.charCodeAt(index) &&
2372 45 === input.charCodeAt(index + 1)) {
2373 scanComment();
2374 skipWhiteSpace();
2375 }
2376 if (index >= length) return {
2377 type : EOF
2378 , value: '<eof>'
2379 , line: line
2380 , lineStart: lineStart
2381 , range: [index, index]
2382 };
2383
2384 var character = input.charCodeAt(index)
2385 , next = input.charCodeAt(index + 1);
2386 tokenStart = index;
2387 if (isIdentifierStart(character)) return scanIdentifierOrKeyword();
2388
2389 switch (character) {
2390 case 39: case 34: // '"
2391 return scanStringLiteral();
2392 case 48: case 49: case 50: case 51: case 52: case 53:
2393 case 54: case 55: case 56: case 57:
2394 return scanNumericLiteral();
2395
2396 case 46: // .
2397 if (isDecDigit(next)) return scanNumericLiteral();
2398 if (46 === next) {
2399 if (46 === input.charCodeAt(index + 2)) return scanVarargLiteral();
2400 return scanPunctuator('..');
2401 }
2402 return scanPunctuator('.');
2403
2404 case 61: // =
2405 if (61 === next) return scanPunctuator('==');
2406 return scanPunctuator('=');
2407
2408 case 62: // >
2409 if (61 === next) return scanPunctuator('>=');
2410 return scanPunctuator('>');
2411
2412 case 60: // <
2413 if (61 === next) return scanPunctuator('<=');
2414 return scanPunctuator('<');
2415
2416 case 126: // ~
2417 if (61 === next) return scanPunctuator('~=');
2418 return raise({}, errors.expected, '=', '~');
2419
2420 case 58: // :
2421 if (58 === next) return scanPunctuator('::');
2422 return scanPunctuator(':');
2423
2424 case 91: // [
2425 if (91 === next || 61 === next) return scanLongStringLiteral();
2426 return scanPunctuator('[');
2427 case 42: case 47: case 94: case 37: case 44: case 123: case 125:
2428 case 93: case 40: case 41: case 59: case 35: case 45: case 43:
2429 return scanPunctuator(input.charAt(index));
2430 }
2431
2432 return unexpected(input.charAt(index));
2433 }
2434
2435 function skipWhiteSpace() {
2436 while (index < length) {
2437 var character = input.charCodeAt(index);
2438 if (isWhiteSpace(character)) {
2439 index++;
2440 } else if (isLineTerminator(character)) {
2441 line++;
2442 lineStart = ++index;
2443 } else {
2444 break;
2445 }
2446 }
2447 }
2448
2449 function scanIdentifierOrKeyword() {
2450 var value, type;
2451 while (isIdentifierPart(input.charCodeAt(++index)));
2452 value = input.slice(tokenStart, index);
2453 if (isKeyword(value)) {
2454 type = Keyword;
2455 } else if ('true' === value || 'false' === value) {
2456 type = BooleanLiteral;
2457 value = ('true' === value);
2458 } else if ('nil' === value) {
2459 type = NilLiteral;
2460 value = null;
2461 } else {
2462 type = Identifier;
2463 }
2464
2465 return {
2466 type: type
2467 , value: value
2468 , line: line
2469 , lineStart: lineStart
2470 , range: [tokenStart, index]
2471 };
2472 }
2473
2474 function scanPunctuator(value) {
2475 index += value.length;
2476 return {
2477 type: Punctuator
2478 , value: value
2479 , line: line
2480 , lineStart: lineStart
2481 , range: [tokenStart, index]
2482 };
2483 }
2484
2485 function scanVarargLiteral() {
2486 index += 3;
2487 return {
2488 type: VarargLiteral
2489 , value: '...'
2490 , line: line
2491 , lineStart: lineStart
2492 , range: [tokenStart, index]
2493 };
2494 }
2495
2496 function scanStringLiteral() {
2497 var delimiter = input.charCodeAt(index++)
2498 , stringStart = index
2499 , string = ''
2500 , character;
2501
2502 while (index < length) {
2503 character = input.charCodeAt(index++);
2504 if (delimiter === character) break;
2505 if (92 === character) { // \
2506 string += input.slice(stringStart, index - 1) + readEscapeSequence();
2507 stringStart = index;
2508 }
2509 else if (index >= length || isLineTerminator(character)) {
2510 string += input.slice(stringStart, index - 1);
2511 raise({}, errors.unfinishedString, string + String.fromCharCode(character));
2512 }
2513 }
2514 string += input.slice(stringStart, index - 1);
2515
2516 return {
2517 type: StringLiteral
2518 , value: string
2519 , line: line
2520 , lineStart: lineStart
2521 , range: [tokenStart, index]
2522 };
2523 }
2524
2525 function scanLongStringLiteral() {
2526 var string = readLongString();
2527 if (false === string) raise(token, errors.expected, '[', token.value);
2528
2529 return {
2530 type: StringLiteral
2531 , value: string
2532 , line: line
2533 , lineStart: lineStart
2534 , range: [tokenStart, index]
2535 };
2536 }
2537
2538 function scanNumericLiteral() {
2539 var character = input.charAt(index)
2540 , next = input.charAt(index + 1);
2541
2542 var value = ('0' === character && 'xX'.indexOf(next || null) >= 0) ?
2543 readHexLiteral() : readDecLiteral();
2544
2545 return {
2546 type: NumericLiteral
2547 , value: value
2548 , line: line
2549 , lineStart: lineStart
2550 , range: [tokenStart, index]
2551 };
2552 }
2553
2554 function readHexLiteral() {
2555 var fraction = 0 // defaults to 0 as it gets summed
2556 , binaryExponent = 1 // defaults to 1 as it gets multiplied
2557 , binarySign = 1 // positive
2558 , digit, fractionStart, exponentStart, digitStart;
2559
2560 digitStart = index += 2; // Skip 0x part
2561 if (!isHexDigit(input.charCodeAt(index)))
2562 raise({}, errors.malformedNumber, input.slice(tokenStart, index));
2563
2564 while (isHexDigit(input.charCodeAt(index))) index++;
2565 digit = parseInt(input.slice(digitStart, index), 16);
2566 if ('.' === input.charAt(index)) {
2567 fractionStart = ++index;
2568
2569 while (isHexDigit(input.charCodeAt(index))) index++;
2570 fraction = input.slice(fractionStart, index);
2571 fraction = (fractionStart === index) ? 0
2572 : parseInt(fraction, 16) / Math.pow(16, index - fractionStart);
2573 }
2574 if ('pP'.indexOf(input.charAt(index) || null) >= 0) {
2575 index++;
2576 if ('+-'.indexOf(input.charAt(index) || null) >= 0)
2577 binarySign = ('+' === input.charAt(index++)) ? 1 : -1;
2578
2579 exponentStart = index;
2580 if (!isDecDigit(input.charCodeAt(index)))
2581 raise({}, errors.malformedNumber, input.slice(tokenStart, index));
2582
2583 while (isDecDigit(input.charCodeAt(index))) index++;
2584 binaryExponent = input.slice(exponentStart, index);
2585 binaryExponent = Math.pow(2, binaryExponent * binarySign);
2586 }
2587
2588 return (digit + fraction) * binaryExponent;
2589 }
2590
2591 function readDecLiteral() {
2592 while (isDecDigit(input.charCodeAt(index))) index++;
2593 if ('.' === input.charAt(index)) {
2594 index++;
2595 while (isDecDigit(input.charCodeAt(index))) index++;
2596 }
2597 if ('eE'.indexOf(input.charAt(index) || null) >= 0) {
2598 index++;
2599 if ('+-'.indexOf(input.charAt(index) || null) >= 0) index++;
2600 if (!isDecDigit(input.charCodeAt(index)))
2601 raise({}, errors.malformedNumber, input.slice(tokenStart, index));
2602
2603 while (isDecDigit(input.charCodeAt(index))) index++;
2604 }
2605
2606 return parseFloat(input.slice(tokenStart, index));
2607 }
2608
2609 function readEscapeSequence() {
2610 var sequenceStart = index;
2611 switch (input.charAt(index)) {
2612 case 'n': index++; return '\n';
2613 case 'r': index++; return '\r';
2614 case 't': index++; return '\t';
2615 case 'v': index++; return '\x0B';
2616 case 'b': index++; return '\b';
2617 case 'f': index++; return '\f';
2618 case 'z': index++; skipWhiteSpace(); return '';
2619 case 'x':
2620 if (isHexDigit(input.charCodeAt(index + 1)) &&
2621 isHexDigit(input.charCodeAt(index + 2))) {
2622 index += 3;
2623 return '\\' + input.slice(sequenceStart, index);
2624 }
2625 return '\\' + input.charAt(index++);
2626 default:
2627 if (isDecDigit(input.charCodeAt(index))) {
2628 while (isDecDigit(input.charCodeAt(++index)));
2629 return '\\' + input.slice(sequenceStart, index);
2630 }
2631 return input.charAt(index++);
2632 }
2633 }
2634
2635 function scanComment() {
2636 tokenStart = index;
2637 index += 2; // --
2638
2639 var character = input.charAt(index)
2640 , content = ''
2641 , isLong = false
2642 , commentStart = index;
2643
2644 if ('[' === character) {
2645 content = readLongString();
2646 if (false === content) content = character;
2647 else isLong = true;
2648 }
2649 if (!isLong) {
2650 while (index < length) {
2651 if (isLineTerminator(input.charCodeAt(index))) break;
2652 index++;
2653 }
2654 content = input.slice(commentStart, index);
2655 }
2656
2657 if (options.comments) {
2658 comments.push({
2659 type: 'Comment'
2660 , value: content
2661 , raw: input.slice(tokenStart, index)
2662 });
2663 }
2664 }
2665
2666 function readLongString() {
2667 var level = 0
2668 , content = ''
2669 , terminator = false
2670 , character, stringStart;
2671
2672 index++; // [
2673 while ('=' === input.charAt(index + level)) level++;
2674 if ('[' !== input.charAt(index + level)) return false;
2675
2676 index += level + 1;
2677 if (isLineTerminator(input.charCodeAt(index))) {
2678 line++;
2679 lineStart = index++;
2680 }
2681
2682 stringStart = index;
2683 while (index < length) {
2684 character = input.charAt(index++);
2685 if (isLineTerminator(character.charCodeAt(0))) {
2686 line++;
2687 lineStart = index;
2688 }
2689
2690 if (']' === character) {
2691 terminator = true;
2692 for (var i = 0; i < level; i++) {
2693 if ('=' !== input.charAt(index + i)) terminator = false;
2694 }
2695 if (']' !== input.charAt(index + level)) terminator = false;
2696 }
2697 if (terminator) break;
2698 }
2699 content += input.slice(stringStart, index - 1);
2700 index += level + 1;
2701
2702 return content;
2703 }
2704
2705 function next() {
2706 token = lookahead;
2707 lookahead = readToken();
2708 }
2709
2710 function consume(value) {
2711 if (value === token.value) {
2712 next();
2713 return true;
2714 }
2715 return false;
2716 }
2717
2718 function expect(value) {
2719 if (value === token.value) next();
2720 else raise(token, errors.expected, value, token.value);
2721 }
2722
2723 function isWhiteSpace(character) {
2724 return 9 === character || 32 === character || 0xB === character || 0xC === character;
2725 }
2726
2727 function isLineTerminator(character) {
2728 return 10 === character || 13 === character;
2729 }
2730
2731 function isDecDigit(character) {
2732 return character >= 48 && character <= 57;
2733 }
2734
2735 function isHexDigit(character) {
2736 return (character >= 48 && character <= 57) || (character >= 97 && character <= 102) || (character >= 65 && character <= 70);
2737 }
2738
2739 function isIdentifierStart(character) {
2740 return (character >= 65 && character <= 90) || (character >= 97 && character <= 122) || 95 === character;
2741 }
2742
2743 function isIdentifierPart(character) {
2744 return (character >= 65 && character <= 90) || (character >= 97 && character <= 122) || 95 === character || (character >= 48 && character <= 57);
2745 }
2746
2747 function isKeyword(id) {
2748 switch (id.length) {
2749 case 2:
2750 return 'do' === id || 'if' === id || 'in' === id || 'or' === id;
2751 case 3:
2752 return 'and' === id || 'end' === id || 'for' === id || 'not' === id;
2753 case 4:
2754 return 'else' === id || 'goto' === id || 'then' === id;
2755 case 5:
2756 return 'break' === id || 'local' === id || 'until' === id || 'while' === id;
2757 case 6:
2758 return 'elseif' === id || 'repeat' === id || 'return' === id;
2759 case 8:
2760 return 'function' === id;
2761 }
2762 return false;
2763 }
2764
2765 function isUnary(token) {
2766 if (Punctuator === token.type) return '#-'.indexOf(token.value) >= 0;
2767 if (Keyword === token.type) return 'not' === token.value;
2768 return false;
2769 }
2770 function isCallExpression(expression) {
2771 switch (expression.type) {
2772 case 'CallExpression':
2773 case 'TableCallExpression':
2774 case 'StringCallExpression':
2775 return true;
2776 }
2777 return false;
2778 }
2779
2780 function isBlockFollow(token) {
2781 if (EOF === token.type) return true;
2782 if (Keyword !== token.type) return false;
2783 switch (token.value) {
2784 case 'else': case 'elseif':
2785 case 'end': case 'until':
2786 return true;
2787 default:
2788 return false;
2789 }
2790 }
2791 var scopes
2792 , scopeDepth
2793 , globals
2794 , globalNames;
2795 function createScope() {
2796 scopes.push(Array.apply(null, scopes[scopeDepth++]));
2797 }
2798 function exitScope() {
2799 scopes.pop();
2800 scopeDepth--;
2801 }
2802 function scopeIdentifierName(name) {
2803 if (-1 !== indexOf.call(scopes[scopeDepth], name)) return;
2804 scopes[scopeDepth].push(name);
2805 }
2806 function scopeIdentifier(node) {
2807 scopeIdentifierName(node.name);
2808 attachScope(node, true);
2809 }
2810 function attachScope(node, isLocal) {
2811 if (!isLocal && -1 === indexOf.call(globalNames, node.name)) {
2812 globalNames.push(node.name);
2813 globals.push(node);
2814 }
2815
2816 node.isLocal = isLocal;
2817 }
2818 function scopeHasName(name) {
2819 return (-1 !== indexOf.call(scopes[scopeDepth], name));
2820 }
2821
2822 function parseChunk() {
2823 next();
2824 var body = parseBlock();
2825 if (EOF !== token.type) unexpected(token);
2826 return ast.chunk(body);
2827 }
2828
2829 function parseBlock(terminator) {
2830 var block = []
2831 , statement;
2832 if (options.scope) createScope();
2833
2834 while (!isBlockFollow(token)) {
2835 if ('return' === token.value) {
2836 block.push(parseStatement());
2837 break;
2838 }
2839 statement = parseStatement();
2840 if (statement) block.push(statement);
2841 }
2842
2843 if (options.scope) exitScope();
2844 return block;
2845 }
2846
2847 function parseStatement() {
2848 if (Keyword === token.type) {
2849 switch (token.value) {
2850 case 'local': next(); return parseLocalStatement();
2851 case 'if': next(); return parseIfStatement();
2852 case 'return': next(); return parseReturnStatement();
2853 case 'function': next();
2854 var name = parseFunctionName();
2855 return parseFunctionDeclaration(name);
2856 case 'while': next(); return parseWhileStatement();
2857 case 'for': next(); return parseForStatement();
2858 case 'repeat': next(); return parseRepeatStatement();
2859 case 'break': next(); return parseBreakStatement();
2860 case 'do': next(); return parseDoStatement();
2861 case 'goto': next(); return parseGotoStatement();
2862 }
2863 }
2864
2865 if (Punctuator === token.type) {
2866 if (consume('::')) return parseLabelStatement();
2867 }
2868 if (consume(';')) return;
2869
2870 return parseAssignmentOrCallStatement();
2871 }
2872
2873 function parseLabelStatement() {
2874 var name = token.value
2875 , label = parseIdentifier();
2876
2877 if (options.scope) {
2878 scopeIdentifierName('::' + name + '::');
2879 attachScope(label, true);
2880 }
2881
2882 expect('::');
2883 return ast.labelStatement(label);
2884 }
2885
2886 function parseBreakStatement() {
2887 return ast.breakStatement();
2888 }
2889
2890 function parseGotoStatement() {
2891 var name = token.value
2892 , label = parseIdentifier();
2893
2894 if (options.scope) label.isLabel = scopeHasName('::' + name + '::');
2895 return ast.gotoStatement(label);
2896 }
2897
2898 function parseDoStatement() {
2899 var body = parseBlock();
2900 expect('end');
2901 return ast.doStatement(body);
2902 }
2903
2904 function parseWhileStatement() {
2905 var condition = parseExpectedExpression();
2906 expect('do');
2907 var body = parseBlock();
2908 expect('end');
2909 return ast.whileStatement(condition, body);
2910 }
2911
2912 function parseRepeatStatement() {
2913 var body = parseBlock();
2914 expect('until');
2915 var condition = parseExpectedExpression();
2916 return ast.repeatStatement(condition, body);
2917 }
2918
2919 function parseReturnStatement() {
2920 var expressions = [];
2921
2922 if ('end' !== token.value) {
2923 var expression = parseExpression();
2924 if (null != expression) expressions.push(expression);
2925 while (consume(',')) {
2926 expression = parseExpectedExpression();
2927 expressions.push(expression);
2928 }
2929 consume(';'); // grammar tells us ; is optional here.
2930 }
2931 return ast.returnStatement(expressions);
2932 }
2933
2934 function parseIfStatement() {
2935 var clauses = []
2936 , condition
2937 , body;
2938
2939 condition = parseExpectedExpression();
2940 expect('then');
2941 body = parseBlock();
2942 clauses.push(ast.ifClause(condition, body));
2943
2944 while (consume('elseif')) {
2945 condition = parseExpectedExpression();
2946 expect('then');
2947 body = parseBlock();
2948 clauses.push(ast.elseifClause(condition, body));
2949 }
2950
2951 if (consume('else')) {
2952 body = parseBlock();
2953 clauses.push(ast.elseClause(body));
2954 }
2955
2956 expect('end');
2957 return ast.ifStatement(clauses);
2958 }
2959
2960 function parseForStatement() {
2961 var variable = parseIdentifier()
2962 , body;
2963 if (options.scope) scopeIdentifier(variable);
2964 if (consume('=')) {
2965 var start = parseExpectedExpression();
2966 expect(',');
2967 var end = parseExpectedExpression();
2968 var step = consume(',') ? parseExpectedExpression() : null;
2969
2970 expect('do');
2971 body = parseBlock();
2972 expect('end');
2973
2974 return ast.forNumericStatement(variable, start, end, step, body);
2975 } else {
2976 var variables = [variable];
2977 while (consume(',')) {
2978 variable = parseIdentifier();
2979 if (options.scope) scopeIdentifier(variable);
2980 variables.push(variable);
2981 }
2982 expect('in');
2983 var iterators = [];
2984 do {
2985 var expression = parseExpectedExpression();
2986 iterators.push(expression);
2987 } while (consume(','));
2988
2989 expect('do');
2990 body = parseBlock();
2991 expect('end');
2992
2993 return ast.forGenericStatement(variables, iterators, body);
2994 }
2995 }
2996
2997 function parseLocalStatement() {
2998 var name;
2999
3000 if (Identifier === token.type) {
3001 var variables = []
3002 , init = [];
3003
3004 do {
3005 name = parseIdentifier();
3006
3007 variables.push(name);
3008 } while (consume(','));
3009
3010 if (consume('=')) {
3011 do {
3012 var expression = parseExpectedExpression();
3013 init.push(expression);
3014 } while (consume(','));
3015 }
3016 if (options.scope) {
3017 for (var i = 0, l = variables.length; i < l; i++) {
3018 scopeIdentifier(variables[i]);
3019 }
3020 }
3021
3022 return ast.localStatement(variables, init);
3023 }
3024 if (consume('function')) {
3025 name = parseIdentifier();
3026 if (options.scope) scopeIdentifier(name);
3027 return parseFunctionDeclaration(name, true);
3028 } else {
3029 raiseUnexpectedToken('<name>', token);
3030 }
3031 }
3032
3033 function parseAssignmentOrCallStatement() {
3034 var previous = token
3035 , expression = parsePrefixExpression();
3036
3037 if (null == expression) return unexpected(token);
3038 if (',='.indexOf(token.value) >= 0) {
3039 var variables = [expression]
3040 , init = []
3041 , exp;
3042
3043 while (consume(',')) {
3044 exp = parsePrefixExpression();
3045 if (null == exp) raiseUnexpectedToken('<expression>', token);
3046 variables.push(exp);
3047 }
3048 expect('=');
3049 do {
3050 exp = parseExpectedExpression();
3051 init.push(exp);
3052 } while (consume(','));
3053 return ast.assignmentStatement(variables, init);
3054 }
3055 if (isCallExpression(expression)) {
3056 return ast.callStatement(expression);
3057 }
3058 return unexpected(previous);
3059 }
3060
3061 function parseIdentifier() {
3062 var identifier = token.value;
3063 if (Identifier !== token.type) raiseUnexpectedToken('<name>', token);
3064 next();
3065 return ast.identifier(identifier);
3066 }
3067
3068 function parseFunctionDeclaration(name, isLocal) {
3069 var parameters = [];
3070 expect('(');
3071 if (!consume(')')) {
3072 while (true) {
3073 if (Identifier === token.type) {
3074 var parameter = parseIdentifier();
3075 if (options.scope) scopeIdentifier(parameter);
3076
3077 parameters.push(parameter);
3078
3079 if (consume(',')) continue;
3080 else if (consume(')')) break;
3081 } else if (VarargLiteral === token.type) {
3082 parameters.push(parsePrimaryExpression());
3083 expect(')');
3084 break;
3085 } else {
3086 raiseUnexpectedToken('<name> or \'...\'', token);
3087 }
3088 }
3089 }
3090
3091 var body = parseBlock();
3092 expect('end');
3093
3094 isLocal = isLocal || false;
3095 return ast.functionStatement(name, parameters, isLocal, body);
3096 }
3097
3098 function parseFunctionName() {
3099 var base = parseIdentifier()
3100 , name;
3101 if (options.scope) attachScope(base, false);
3102
3103 while (consume('.')) {
3104 name = parseIdentifier();
3105 if (options.scope) attachScope(name, false);
3106 base = ast.memberExpression(base, '.', name);
3107 }
3108
3109 if (consume(':')) {
3110 name = parseIdentifier();
3111 if (options.scope) attachScope(name, false);
3112 base = ast.memberExpression(base, ':', name);
3113 }
3114
3115 return base;
3116 }
3117
3118 function parseTableConstructor() {
3119 var fields = []
3120 , key, value;
3121
3122 while (true) {
3123 if (Punctuator === token.type && consume('[')) {
3124 key = parseExpectedExpression();
3125 expect(']');
3126 expect('=');
3127 value = parseExpectedExpression();
3128 fields.push(ast.tableKey(key, value));
3129 } else if (Identifier === token.type) {
3130 key = parseExpectedExpression();
3131 if (consume('=')) {
3132 value = parseExpectedExpression();
3133 fields.push(ast.tableKeyString(key, value));
3134 } else {
3135 fields.push(ast.tableValue(key));
3136 }
3137 } else {
3138 if (null == (value = parseExpression())) break;
3139 fields.push(ast.tableValue(value));
3140 }
3141 if (',;'.indexOf(token.value) >= 0) {
3142 next();
3143 continue;
3144 }
3145 if ('}' === token.value) break;
3146 }
3147 expect('}');
3148 return ast.tableConstructorExpression(fields);
3149 }
3150
3151 function parseExpression() {
3152 var expression = parseSubExpression(0);
3153 return expression;
3154 }
3155
3156 function parseExpectedExpression() {
3157 var expression = parseExpression();
3158 if (null == expression) raiseUnexpectedToken('<expression>', token);
3159 else return expression;
3160 }
3161
3162 function binaryPrecedence(operator) {
3163 var character = operator.charCodeAt(0)
3164 , length = operator.length;
3165
3166 if (1 === length) {
3167 switch (character) {
3168 case 94: return 10; // ^
3169 case 42: case 47: case 37: return 7; // * / %
3170 case 43: case 45: return 6; // + -
3171 case 60: case 62: return 3; // < >
3172 }
3173 } else if (2 === length) {
3174 switch (character) {
3175 case 46: return 5; // ..
3176 case 60: case 62: case 61: case 126: return 3; // <= >= == ~=
3177 case 111: return 1; // or
3178 }
3179 } else if (97 === character && 'and' === operator) return 2;
3180 return 0;
3181 }
3182
3183 function parseSubExpression(minPrecedence) {
3184 var operator = token.value;
3185 var expression;
3186 if (isUnary(token)) {
3187 next();
3188 var argument = parseSubExpression(8);
3189 if (argument == null) raiseUnexpectedToken('<expression>', token);
3190 expression = ast.unaryExpression(operator, argument);
3191 }
3192 if (null == expression) {
3193 expression = parsePrimaryExpression();
3194 if (null == expression) {
3195 expression = parsePrefixExpression();
3196 }
3197 }
3198 if (null == expression) return null;
3199
3200 var precedence;
3201 while (true) {
3202 operator = token.value;
3203
3204 precedence = (Punctuator === token.type || Keyword === token.type) ?
3205 binaryPrecedence(operator) : 0;
3206
3207 if (precedence === 0 || precedence <= minPrecedence) break;
3208 if ('^' === operator || '..' === operator) precedence--;
3209 next();
3210 var right = parseSubExpression(precedence);
3211 if (null == right) raiseUnexpectedToken('<expression>', token);
3212 expression = ast.binaryExpression(operator, expression, right);
3213 }
3214 return expression;
3215 }
3216
3217 function parsePrefixExpression() {
3218 var base, name
3219 , isLocal;
3220 if (Identifier === token.type) {
3221 name = token.value;
3222 base = parseIdentifier();
3223 if (options.scope) attachScope(base, isLocal = scopeHasName(name));
3224 } else if (consume('(')) {
3225 base = parseExpectedExpression();
3226 expect(')');
3227 if (options.scope) isLocal = base.isLocal;
3228 } else {
3229 return null;
3230 }
3231 var expression, identifier;
3232 while (true) {
3233 if (Punctuator === token.type) {
3234 switch (token.value) {
3235 case '[':
3236 next();
3237 expression = parseExpectedExpression();
3238 base = ast.indexExpression(base, expression);
3239 expect(']');
3240 break;
3241 case '.':
3242 next();
3243 identifier = parseIdentifier();
3244 if (options.scope) attachScope(identifier, isLocal);
3245 base = ast.memberExpression(base, '.', identifier);
3246 break;
3247 case ':':
3248 next();
3249 identifier = parseIdentifier();
3250 if (options.scope) attachScope(identifier, isLocal);
3251 base = ast.memberExpression(base, ':', identifier);
3252 base = parseCallExpression(base);
3253 break;
3254 case '(': case '{': // args
3255 base = parseCallExpression(base);
3256 break;
3257 default:
3258 return base;
3259 }
3260 } else if (StringLiteral === token.type) {
3261 base = parseCallExpression(base);
3262 } else {
3263 break;
3264 }
3265 }
3266
3267 return base;
3268 }
3269
3270 function parseCallExpression(base) {
3271 if (Punctuator === token.type) {
3272 switch (token.value) {
3273 case '(':
3274 next();
3275 var expressions = [];
3276 var expression = parseExpression();
3277 if (null != expression) expressions.push(expression);
3278 while (consume(',')) {
3279 expression = parseExpectedExpression();
3280 expressions.push(expression);
3281 }
3282
3283 expect(')');
3284 return ast.callExpression(base, expressions);
3285
3286 case '{':
3287 next();
3288 var table = parseTableConstructor();
3289 return ast.tableCallExpression(base, table);
3290 }
3291
3292 } else if (StringLiteral === token.type) {
3293 return ast.stringCallExpression(base, parsePrimaryExpression());
3294 }
3295
3296 raiseUnexpectedToken('function arguments', token);
3297 }
3298
3299 function parsePrimaryExpression() {
3300 var literals = StringLiteral | NumericLiteral | BooleanLiteral | NilLiteral | VarargLiteral
3301 , value = token.value
3302 , type = token.type;
3303
3304 if (type & literals) {
3305 var raw = input.slice(token.range[0], token.range[1]);
3306 next();
3307 return ast.literal(type, value, raw);
3308 } else if (Keyword === type && 'function' === value) {
3309 next();
3310 return parseFunctionDeclaration(null);
3311 } else if (consume('{'))
3312 return parseTableConstructor();
3313 }
3314
3315 exports.parse = parse;
3316
3317 function parse(_input, _options) {
3318 if ('undefined' === typeof _options && 'object' === typeof _input) {
3319 _options = _input;
3320 _input = undefined;
3321 }
3322 if (!_options) _options = {};
3323
3324 input = _input || '';
3325 options = extend(defaultOptions, _options);
3326 index = 0;
3327 line = 1;
3328 lineStart = 0;
3329 length = input.length;
3330 scopes = [[]];
3331 scopeDepth = 0;
3332 globals = [];
3333 globalNames = [];
3334
3335 if (options.comments) comments = [];
3336 if (!options.wait) return end();
3337 return exports;
3338 }
3339 exports.write = write;
3340
3341 function write(_input) {
3342 input += String(_input);
3343 length = input.length;
3344 return exports;
3345 }
3346 exports.end = end;
3347
3348 function end(_input) {
3349 if ('undefined' !== typeof _input) write(_input);
3350
3351 length = input.length;
3352 lookahead = readToken();
3353
3354 var chunk = parseChunk();
3355 if (options.comments) chunk.comments = comments;
3356 if (options.scope) chunk.globals = globals;
3357 return chunk;
3358 }
3359 exports.lex = readToken;
3360
3361 }));
3362
3363 });
+0
-6694
try/ace/worker-php.js less more
0 "no use strict";
1 ;(function(window) {
2 if (typeof window.window != "undefined" && window.document) {
3 return;
4 }
5
6 window.console = {
7 log: function() {
8 var msgs = Array.prototype.slice.call(arguments, 0);
9 postMessage({type: "log", data: msgs});
10 },
11 error: function() {
12 var msgs = Array.prototype.slice.call(arguments, 0);
13 postMessage({type: "log", data: msgs});
14 }
15 };
16 window.window = window;
17 window.ace = window;
18
19 window.normalizeModule = function(parentId, moduleName) {
20 if (moduleName.indexOf("!") !== -1) {
21 var chunks = moduleName.split("!");
22 return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
23 }
24 if (moduleName.charAt(0) == ".") {
25 var base = parentId.split("/").slice(0, -1).join("/");
26 moduleName = base + "/" + moduleName;
27
28 while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
29 var previous = moduleName;
30 moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
31 }
32 }
33
34 return moduleName;
35 };
36
37 window.require = function(parentId, id) {
38 if (!id) {
39 id = parentId
40 parentId = null;
41 }
42 if (!id.charAt)
43 throw new Error("worker.js require() accepts only (parentId, id) as arguments");
44
45 id = normalizeModule(parentId, id);
46
47 var module = require.modules[id];
48 if (module) {
49 if (!module.initialized) {
50 module.initialized = true;
51 module.exports = module.factory().exports;
52 }
53 return module.exports;
54 }
55
56 var chunks = id.split("/");
57 chunks[0] = require.tlns[chunks[0]] || chunks[0];
58 var path = chunks.join("/") + ".js";
59
60 require.id = id;
61 importScripts(path);
62 return require(parentId, id);
63 };
64
65 require.modules = {};
66 require.tlns = {};
67
68 window.define = function(id, deps, factory) {
69 if (arguments.length == 2) {
70 factory = deps;
71 if (typeof id != "string") {
72 deps = id;
73 id = require.id;
74 }
75 } else if (arguments.length == 1) {
76 factory = id;
77 id = require.id;
78 }
79
80 if (id.indexOf("text!") === 0)
81 return;
82
83 var req = function(deps, factory) {
84 return require(id, deps, factory);
85 };
86
87 require.modules[id] = {
88 factory: function() {
89 var module = {
90 exports: {}
91 };
92 var returnExports = factory(req, module.exports, module);
93 if (returnExports)
94 module.exports = returnExports;
95 return module;
96 }
97 };
98 };
99
100 window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
101 require.tlns = topLevelNamespaces;
102 }
103
104 window.initSender = function initSender() {
105
106 var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
107 var oop = require("ace/lib/oop");
108
109 var Sender = function() {};
110
111 (function() {
112
113 oop.implement(this, EventEmitter);
114
115 this.callback = function(data, callbackId) {
116 postMessage({
117 type: "call",
118 id: callbackId,
119 data: data
120 });
121 };
122
123 this.emit = function(name, data) {
124 postMessage({
125 type: "event",
126 name: name,
127 data: data
128 });
129 };
130
131 }).call(Sender.prototype);
132
133 return new Sender();
134 }
135
136 window.main = null;
137 window.sender = null;
138
139 window.onmessage = function(e) {
140 var msg = e.data;
141 if (msg.command) {
142 if (main[msg.command])
143 main[msg.command].apply(main, msg.args);
144 else
145 throw new Error("Unknown command:" + msg.command);
146 }
147 else if (msg.init) {
148 initBaseUrls(msg.tlns);
149 require("ace/lib/es5-shim");
150 sender = initSender();
151 var clazz = require(msg.module)[msg.classname];
152 main = new clazz(sender);
153 }
154 else if (msg.event && sender) {
155 sender._emit(msg.event, msg.data);
156 }
157 };
158 })(this);
159
160 define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
161
162
163 var EventEmitter = {};
164 var stopPropagation = function() { this.propagationStopped = true; };
165 var preventDefault = function() { this.defaultPrevented = true; };
166
167 EventEmitter._emit =
168 EventEmitter._dispatchEvent = function(eventName, e) {
169 this._eventRegistry || (this._eventRegistry = {});
170 this._defaultHandlers || (this._defaultHandlers = {});
171
172 var listeners = this._eventRegistry[eventName] || [];
173 var defaultHandler = this._defaultHandlers[eventName];
174 if (!listeners.length && !defaultHandler)
175 return;
176
177 if (typeof e != "object" || !e)
178 e = {};
179
180 if (!e.type)
181 e.type = eventName;
182 if (!e.stopPropagation)
183 e.stopPropagation = stopPropagation;
184 if (!e.preventDefault)
185 e.preventDefault = preventDefault;
186
187 for (var i=0; i<listeners.length; i++) {
188 listeners[i](e, this);
189 if (e.propagationStopped)
190 break;
191 }
192
193 if (defaultHandler && !e.defaultPrevented)
194 return defaultHandler(e, this);
195 };
196
197
198 EventEmitter._signal = function(eventName, e) {
199 var listeners = (this._eventRegistry || {})[eventName];
200 if (!listeners)
201 return;
202
203 for (var i=0; i<listeners.length; i++)
204 listeners[i](e, this);
205 };
206
207 EventEmitter.once = function(eventName, callback) {
208 var _self = this;
209 callback && this.addEventListener(eventName, function newCallback() {
210 _self.removeEventListener(eventName, newCallback);
211 callback.apply(null, arguments);
212 });
213 };
214
215
216 EventEmitter.setDefaultHandler = function(eventName, callback) {
217 var handlers = this._defaultHandlers
218 if (!handlers)
219 handlers = this._defaultHandlers = {_disabled_: {}};
220
221 if (handlers[eventName]) {
222 var old = handlers[eventName];
223 var disabled = handlers._disabled_[eventName];
224 if (!disabled)
225 handlers._disabled_[eventName] = disabled = [];
226 disabled.push(old);
227 var i = disabled.indexOf(callback);
228 if (i != -1)
229 disabled.splice(i, 1);
230 }
231 handlers[eventName] = callback;
232 };
233 EventEmitter.removeDefaultHandler = function(eventName, callback) {
234 var handlers = this._defaultHandlers
235 if (!handlers)
236 return;
237 var disabled = handlers._disabled_[eventName];
238
239 if (handlers[eventName] == callback) {
240 var old = handlers[eventName];
241 if (disabled)
242 this.setDefaultHandler(eventName, disabled.pop());
243 } else if (disabled) {
244 var i = disabled.indexOf(callback);
245 if (i != -1)
246 disabled.splice(i, 1);
247 }
248 };
249
250 EventEmitter.on =
251 EventEmitter.addEventListener = function(eventName, callback, capturing) {
252 this._eventRegistry = this._eventRegistry || {};
253
254 var listeners = this._eventRegistry[eventName];
255 if (!listeners)
256 listeners = this._eventRegistry[eventName] = [];
257
258 if (listeners.indexOf(callback) == -1)
259 listeners[capturing ? "unshift" : "push"](callback);
260 return callback;
261 };
262
263 EventEmitter.off =
264 EventEmitter.removeListener =
265 EventEmitter.removeEventListener = function(eventName, callback) {
266 this._eventRegistry = this._eventRegistry || {};
267
268 var listeners = this._eventRegistry[eventName];
269 if (!listeners)
270 return;
271
272 var index = listeners.indexOf(callback);
273 if (index !== -1)
274 listeners.splice(index, 1);
275 };
276
277 EventEmitter.removeAllListeners = function(eventName) {
278 if (this._eventRegistry) this._eventRegistry[eventName] = [];
279 };
280
281 exports.EventEmitter = EventEmitter;
282
283 });
284
285 define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
286
287
288 exports.inherits = (function() {
289 var tempCtor = function() {};
290 return function(ctor, superCtor) {
291 tempCtor.prototype = superCtor.prototype;
292 ctor.super_ = superCtor.prototype;
293 ctor.prototype = new tempCtor();
294 ctor.prototype.constructor = ctor;
295 };
296 }());
297
298 exports.mixin = function(obj, mixin) {
299 for (var key in mixin) {
300 obj[key] = mixin[key];
301 }
302 return obj;
303 };
304
305 exports.implement = function(proto, mixin) {
306 exports.mixin(proto, mixin);
307 };
308
309 });
310
311 define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) {
312
313 function Empty() {}
314
315 if (!Function.prototype.bind) {
316 Function.prototype.bind = function bind(that) { // .length is 1
317 var target = this;
318 if (typeof target != "function") {
319 throw new TypeError("Function.prototype.bind called on incompatible " + target);
320 }
321 var args = slice.call(arguments, 1); // for normal call
322 var bound = function () {
323
324 if (this instanceof bound) {
325
326 var result = target.apply(
327 this,
328 args.concat(slice.call(arguments))
329 );
330 if (Object(result) === result) {
331 return result;
332 }
333 return this;
334
335 } else {
336 return target.apply(
337 that,
338 args.concat(slice.call(arguments))
339 );
340
341 }
342
343 };
344 if(target.prototype) {
345 Empty.prototype = target.prototype;
346 bound.prototype = new Empty();
347 Empty.prototype = null;
348 }
349 return bound;
350 };
351 }
352 var call = Function.prototype.call;
353 var prototypeOfArray = Array.prototype;
354 var prototypeOfObject = Object.prototype;
355 var slice = prototypeOfArray.slice;
356 var _toString = call.bind(prototypeOfObject.toString);
357 var owns = call.bind(prototypeOfObject.hasOwnProperty);
358 var defineGetter;
359 var defineSetter;
360 var lookupGetter;
361 var lookupSetter;
362 var supportsAccessors;
363 if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
364 defineGetter = call.bind(prototypeOfObject.__defineGetter__);
365 defineSetter = call.bind(prototypeOfObject.__defineSetter__);
366 lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
367 lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
368 }
369 if ([1,2].splice(0).length != 2) {
370 if(function() { // test IE < 9 to splice bug - see issue #138
371 function makeArray(l) {
372 var a = new Array(l+2);
373 a[0] = a[1] = 0;
374 return a;
375 }
376 var array = [], lengthBefore;
377
378 array.splice.apply(array, makeArray(20));
379 array.splice.apply(array, makeArray(26));
380
381 lengthBefore = array.length; //46
382 array.splice(5, 0, "XXX"); // add one element
383
384 lengthBefore + 1 == array.length
385
386 if (lengthBefore + 1 == array.length) {
387 return true;// has right splice implementation without bugs
388 }
389 }()) {//IE 6/7
390 var array_splice = Array.prototype.splice;
391 Array.prototype.splice = function(start, deleteCount) {
392 if (!arguments.length) {
393 return [];
394 } else {
395 return array_splice.apply(this, [
396 start === void 0 ? 0 : start,
397 deleteCount === void 0 ? (this.length - start) : deleteCount
398 ].concat(slice.call(arguments, 2)))
399 }
400 };
401 } else {//IE8
402 Array.prototype.splice = function(pos, removeCount){
403 var length = this.length;
404 if (pos > 0) {
405 if (pos > length)
406 pos = length;
407 } else if (pos == void 0) {
408 pos = 0;
409 } else if (pos < 0) {
410 pos = Math.max(length + pos, 0);
411 }
412
413 if (!(pos+removeCount < length))
414 removeCount = length - pos;
415
416 var removed = this.slice(pos, pos+removeCount);
417 var insert = slice.call(arguments, 2);
418 var add = insert.length;
419 if (pos === length) {
420 if (add) {
421 this.push.apply(this, insert);
422 }
423 } else {
424 var remove = Math.min(removeCount, length - pos);
425 var tailOldPos = pos + remove;
426 var tailNewPos = tailOldPos + add - remove;
427 var tailCount = length - tailOldPos;
428 var lengthAfterRemove = length - remove;
429
430 if (tailNewPos < tailOldPos) { // case A
431 for (var i = 0; i < tailCount; ++i) {
432 this[tailNewPos+i] = this[tailOldPos+i];
433 }
434 } else if (tailNewPos > tailOldPos) { // case B
435 for (i = tailCount; i--; ) {
436 this[tailNewPos+i] = this[tailOldPos+i];
437 }
438 } // else, add == remove (nothing to do)
439
440 if (add && pos === lengthAfterRemove) {
441 this.length = lengthAfterRemove; // truncate array
442 this.push.apply(this, insert);
443 } else {
444 this.length = lengthAfterRemove + add; // reserves space
445 for (i = 0; i < add; ++i) {
446 this[pos+i] = insert[i];
447 }
448 }
449 }
450 return removed;
451 };
452 }
453 }
454 if (!Array.isArray) {
455 Array.isArray = function isArray(obj) {
456 return _toString(obj) == "[object Array]";
457 };
458 }
459 var boxedString = Object("a"),
460 splitString = boxedString[0] != "a" || !(0 in boxedString);
461
462 if (!Array.prototype.forEach) {
463 Array.prototype.forEach = function forEach(fun /*, thisp*/) {
464 var object = toObject(this),
465 self = splitString && _toString(this) == "[object String]" ?
466 this.split("") :
467 object,
468 thisp = arguments[1],
469 i = -1,
470 length = self.length >>> 0;
471 if (_toString(fun) != "[object Function]") {
472 throw new TypeError(); // TODO message
473 }
474
475 while (++i < length) {
476 if (i in self) {
477 fun.call(thisp, self[i], i, object);
478 }
479 }
480 };
481 }
482 if (!Array.prototype.map) {
483 Array.prototype.map = function map(fun /*, thisp*/) {
484 var object = toObject(this),
485 self = splitString && _toString(this) == "[object String]" ?
486 this.split("") :
487 object,
488 length = self.length >>> 0,
489 result = Array(length),
490 thisp = arguments[1];
491 if (_toString(fun) != "[object Function]") {
492 throw new TypeError(fun + " is not a function");
493 }
494
495 for (var i = 0; i < length; i++) {
496 if (i in self)
497 result[i] = fun.call(thisp, self[i], i, object);
498 }
499 return result;
500 };
501 }
502 if (!Array.prototype.filter) {
503 Array.prototype.filter = function filter(fun /*, thisp */) {
504 var object = toObject(this),
505 self = splitString && _toString(this) == "[object String]" ?
506 this.split("") :
507 object,
508 length = self.length >>> 0,
509 result = [],
510 value,
511 thisp = arguments[1];
512 if (_toString(fun) != "[object Function]") {
513 throw new TypeError(fun + " is not a function");
514 }
515
516 for (var i = 0; i < length; i++) {
517 if (i in self) {
518 value = self[i];
519 if (fun.call(thisp, value, i, object)) {
520 result.push(value);
521 }
522 }
523 }
524 return result;
525 };
526 }
527 if (!Array.prototype.every) {
528 Array.prototype.every = function every(fun /*, thisp */) {
529 var object = toObject(this),
530 self = splitString && _toString(this) == "[object String]" ?
531 this.split("") :
532 object,
533 length = self.length >>> 0,
534 thisp = arguments[1];
535 if (_toString(fun) != "[object Function]") {
536 throw new TypeError(fun + " is not a function");
537 }
538
539 for (var i = 0; i < length; i++) {
540 if (i in self && !fun.call(thisp, self[i], i, object)) {
541 return false;
542 }
543 }
544 return true;
545 };
546 }
547 if (!Array.prototype.some) {
548 Array.prototype.some = function some(fun /*, thisp */) {
549 var object = toObject(this),
550 self = splitString && _toString(this) == "[object String]" ?
551 this.split("") :
552 object,
553 length = self.length >>> 0,
554 thisp = arguments[1];
555 if (_toString(fun) != "[object Function]") {
556 throw new TypeError(fun + " is not a function");
557 }
558
559 for (var i = 0; i < length; i++) {
560 if (i in self && fun.call(thisp, self[i], i, object)) {
561 return true;
562 }
563 }
564 return false;
565 };
566 }
567 if (!Array.prototype.reduce) {
568 Array.prototype.reduce = function reduce(fun /*, initial*/) {
569 var object = toObject(this),
570 self = splitString && _toString(this) == "[object String]" ?
571 this.split("") :
572 object,
573 length = self.length >>> 0;
574 if (_toString(fun) != "[object Function]") {
575 throw new TypeError(fun + " is not a function");
576 }
577 if (!length && arguments.length == 1) {
578 throw new TypeError("reduce of empty array with no initial value");
579 }
580
581 var i = 0;
582 var result;
583 if (arguments.length >= 2) {
584 result = arguments[1];
585 } else {
586 do {
587 if (i in self) {
588 result = self[i++];
589 break;
590 }
591 if (++i >= length) {
592 throw new TypeError("reduce of empty array with no initial value");
593 }
594 } while (true);
595 }
596
597 for (; i < length; i++) {
598 if (i in self) {
599 result = fun.call(void 0, result, self[i], i, object);
600 }
601 }
602
603 return result;
604 };
605 }
606 if (!Array.prototype.reduceRight) {
607 Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
608 var object = toObject(this),
609 self = splitString && _toString(this) == "[object String]" ?
610 this.split("") :
611 object,
612 length = self.length >>> 0;
613 if (_toString(fun) != "[object Function]") {
614 throw new TypeError(fun + " is not a function");
615 }
616 if (!length && arguments.length == 1) {
617 throw new TypeError("reduceRight of empty array with no initial value");
618 }
619
620 var result, i = length - 1;
621 if (arguments.length >= 2) {
622 result = arguments[1];
623 } else {
624 do {
625 if (i in self) {
626 result = self[i--];
627 break;
628 }
629 if (--i < 0) {
630 throw new TypeError("reduceRight of empty array with no initial value");
631 }
632 } while (true);
633 }
634
635 do {
636 if (i in this) {
637 result = fun.call(void 0, result, self[i], i, object);
638 }
639 } while (i--);
640
641 return result;
642 };
643 }
644 if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
645 Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
646 var self = splitString && _toString(this) == "[object String]" ?
647 this.split("") :
648 toObject(this),
649 length = self.length >>> 0;
650
651 if (!length) {
652 return -1;
653 }
654
655 var i = 0;
656 if (arguments.length > 1) {
657 i = toInteger(arguments[1]);
658 }
659 i = i >= 0 ? i : Math.max(0, length + i);
660 for (; i < length; i++) {
661 if (i in self && self[i] === sought) {
662 return i;
663 }
664 }
665 return -1;
666 };
667 }
668 if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
669 Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
670 var self = splitString && _toString(this) == "[object String]" ?
671 this.split("") :
672 toObject(this),
673 length = self.length >>> 0;
674
675 if (!length) {
676 return -1;
677 }
678 var i = length - 1;
679 if (arguments.length > 1) {
680 i = Math.min(i, toInteger(arguments[1]));
681 }
682 i = i >= 0 ? i : length - Math.abs(i);
683 for (; i >= 0; i--) {
684 if (i in self && sought === self[i]) {
685 return i;
686 }
687 }
688 return -1;
689 };
690 }
691 if (!Object.getPrototypeOf) {
692 Object.getPrototypeOf = function getPrototypeOf(object) {
693 return object.__proto__ || (
694 object.constructor ?
695 object.constructor.prototype :
696 prototypeOfObject
697 );
698 };
699 }
700 if (!Object.getOwnPropertyDescriptor) {
701 var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
702 "non-object: ";
703 Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
704 if ((typeof object != "object" && typeof object != "function") || object === null)
705 throw new TypeError(ERR_NON_OBJECT + object);
706 if (!owns(object, property))
707 return;
708
709 var descriptor, getter, setter;
710 descriptor = { enumerable: true, configurable: true };
711 if (supportsAccessors) {
712 var prototype = object.__proto__;
713 object.__proto__ = prototypeOfObject;
714
715 var getter = lookupGetter(object, property);
716 var setter = lookupSetter(object, property);
717 object.__proto__ = prototype;
718
719 if (getter || setter) {
720 if (getter) descriptor.get = getter;
721 if (setter) descriptor.set = setter;
722 return descriptor;
723 }
724 }
725 descriptor.value = object[property];
726 return descriptor;
727 };
728 }
729 if (!Object.getOwnPropertyNames) {
730 Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
731 return Object.keys(object);
732 };
733 }
734 if (!Object.create) {
735 var createEmpty;
736 if (Object.prototype.__proto__ === null) {
737 createEmpty = function () {
738 return { "__proto__": null };
739 };
740 } else {
741 createEmpty = function () {
742 var empty = {};
743 for (var i in empty)
744 empty[i] = null;
745 empty.constructor =
746 empty.hasOwnProperty =
747 empty.propertyIsEnumerable =
748 empty.isPrototypeOf =
749 empty.toLocaleString =
750 empty.toString =
751 empty.valueOf =
752 empty.__proto__ = null;
753 return empty;
754 }
755 }
756
757 Object.create = function create(prototype, properties) {
758 var object;
759 if (prototype === null) {
760 object = createEmpty();
761 } else {
762 if (typeof prototype != "object")
763 throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
764 var Type = function () {};
765 Type.prototype = prototype;
766 object = new Type();
767 object.__proto__ = prototype;
768 }
769 if (properties !== void 0)
770 Object.defineProperties(object, properties);
771 return object;
772 };
773 }
774
775 function doesDefinePropertyWork(object) {
776 try {
777 Object.defineProperty(object, "sentinel", {});
778 return "sentinel" in object;
779 } catch (exception) {
780 }
781 }
782 if (Object.defineProperty) {
783 var definePropertyWorksOnObject = doesDefinePropertyWork({});
784 var definePropertyWorksOnDom = typeof document == "undefined" ||
785 doesDefinePropertyWork(document.createElement("div"));
786 if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
787 var definePropertyFallback = Object.defineProperty;
788 }
789 }
790
791 if (!Object.defineProperty || definePropertyFallback) {
792 var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
793 var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
794 var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
795 "on this javascript engine";
796
797 Object.defineProperty = function defineProperty(object, property, descriptor) {
798 if ((typeof object != "object" && typeof object != "function") || object === null)
799 throw new TypeError(ERR_NON_OBJECT_TARGET + object);
800 if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
801 throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
802 if (definePropertyFallback) {
803 try {
804 return definePropertyFallback.call(Object, object, property, descriptor);
805 } catch (exception) {
806 }
807 }
808 if (owns(descriptor, "value")) {
809
810 if (supportsAccessors && (lookupGetter(object, property) ||
811 lookupSetter(object, property)))
812 {
813 var prototype = object.__proto__;
814 object.__proto__ = prototypeOfObject;
815 delete object[property];
816 object[property] = descriptor.value;
817 object.__proto__ = prototype;
818 } else {
819 object[property] = descriptor.value;
820 }
821 } else {
822 if (!supportsAccessors)
823 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
824 if (owns(descriptor, "get"))
825 defineGetter(object, property, descriptor.get);
826 if (owns(descriptor, "set"))
827 defineSetter(object, property, descriptor.set);
828 }
829
830 return object;
831 };
832 }
833 if (!Object.defineProperties) {
834 Object.defineProperties = function defineProperties(object, properties) {
835 for (var property in properties) {
836 if (owns(properties, property))
837 Object.defineProperty(object, property, properties[property]);
838 }
839 return object;
840 };
841 }
842 if (!Object.seal) {
843 Object.seal = function seal(object) {
844 return object;
845 };
846 }
847 if (!Object.freeze) {
848 Object.freeze = function freeze(object) {
849 return object;
850 };
851 }
852 try {
853 Object.freeze(function () {});
854 } catch (exception) {
855 Object.freeze = (function freeze(freezeObject) {
856 return function freeze(object) {
857 if (typeof object == "function") {
858 return object;
859 } else {
860 return freezeObject(object);
861 }
862 };
863 })(Object.freeze);
864 }
865 if (!Object.preventExtensions) {
866 Object.preventExtensions = function preventExtensions(object) {
867 return object;
868 };
869 }
870 if (!Object.isSealed) {
871 Object.isSealed = function isSealed(object) {
872 return false;
873 };
874 }
875 if (!Object.isFrozen) {
876 Object.isFrozen = function isFrozen(object) {
877 return false;
878 };
879 }
880 if (!Object.isExtensible) {
881 Object.isExtensible = function isExtensible(object) {
882 if (Object(object) === object) {
883 throw new TypeError(); // TODO message
884 }
885 var name = '';
886 while (owns(object, name)) {
887 name += '?';
888 }
889 object[name] = true;
890 var returnValue = owns(object, name);
891 delete object[name];
892 return returnValue;
893 };
894 }
895 if (!Object.keys) {
896 var hasDontEnumBug = true,
897 dontEnums = [
898 "toString",
899 "toLocaleString",
900 "valueOf",
901 "hasOwnProperty",
902 "isPrototypeOf",
903 "propertyIsEnumerable",
904 "constructor"
905 ],
906 dontEnumsLength = dontEnums.length;
907
908 for (var key in {"toString": null}) {
909 hasDontEnumBug = false;
910 }
911
912 Object.keys = function keys(object) {
913
914 if (
915 (typeof object != "object" && typeof object != "function") ||
916 object === null
917 ) {
918 throw new TypeError("Object.keys called on a non-object");
919 }
920
921 var keys = [];
922 for (var name in object) {
923 if (owns(object, name)) {
924 keys.push(name);
925 }
926 }
927
928 if (hasDontEnumBug) {
929 for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
930 var dontEnum = dontEnums[i];
931 if (owns(object, dontEnum)) {
932 keys.push(dontEnum);
933 }
934 }
935 }
936 return keys;
937 };
938
939 }
940 if (!Date.now) {
941 Date.now = function now() {
942 return new Date().getTime();
943 };
944 }
945 var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
946 "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
947 "\u2029\uFEFF";
948 if (!String.prototype.trim || ws.trim()) {
949 ws = "[" + ws + "]";
950 var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
951 trimEndRegexp = new RegExp(ws + ws + "*$");
952 String.prototype.trim = function trim() {
953 return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
954 };
955 }
956
957 function toInteger(n) {
958 n = +n;
959 if (n !== n) { // isNaN
960 n = 0;
961 } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
962 n = (n > 0 || -1) * Math.floor(Math.abs(n));
963 }
964 return n;
965 }
966
967 function isPrimitive(input) {
968 var type = typeof input;
969 return (
970 input === null ||
971 type === "undefined" ||
972 type === "boolean" ||
973 type === "number" ||
974 type === "string"
975 );
976 }
977
978 function toPrimitive(input) {
979 var val, valueOf, toString;
980 if (isPrimitive(input)) {
981 return input;
982 }
983 valueOf = input.valueOf;
984 if (typeof valueOf === "function") {
985 val = valueOf.call(input);
986 if (isPrimitive(val)) {
987 return val;
988 }
989 }
990 toString = input.toString;
991 if (typeof toString === "function") {
992 val = toString.call(input);
993 if (isPrimitive(val)) {
994 return val;
995 }
996 }
997 throw new TypeError();
998 }
999 var toObject = function (o) {
1000 if (o == null) { // this matches both null and undefined
1001 throw new TypeError("can't convert "+o+" to object");
1002 }
1003 return Object(o);
1004 };
1005
1006 });
1007
1008 define('ace/mode/php_worker', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/worker/mirror', 'ace/mode/php/php'], function(require, exports, module) {
1009
1010
1011 var oop = require("../lib/oop");
1012 var Mirror = require("../worker/mirror").Mirror;
1013 var PHP = require("./php/php").PHP;
1014
1015 var PhpWorker = exports.PhpWorker = function(sender) {
1016 Mirror.call(this, sender);
1017 this.setTimeout(500);
1018 };
1019
1020 oop.inherits(PhpWorker, Mirror);
1021
1022 (function() {
1023
1024 this.onUpdate = function() {
1025 var value = this.doc.getValue();
1026 var errors = [];
1027
1028 var tokens = PHP.Lexer(value, {short_open_tag: 1});
1029 try {
1030 new PHP.Parser(tokens);
1031 } catch(e) {
1032 errors.push({
1033 row: e.line - 1,
1034 column: null,
1035 text: e.message.charAt(0).toUpperCase() + e.message.substring(1),
1036 type: "error"
1037 });
1038 }
1039
1040 if (errors.length) {
1041 this.sender.emit("error", errors);
1042 } else {
1043 this.sender.emit("ok");
1044 }
1045 };
1046
1047 }).call(PhpWorker.prototype);
1048
1049 });
1050 define('ace/worker/mirror', ['require', 'exports', 'module' , 'ace/document', 'ace/lib/lang'], function(require, exports, module) {
1051
1052
1053 var Document = require("../document").Document;
1054 var lang = require("../lib/lang");
1055
1056 var Mirror = exports.Mirror = function(sender) {
1057 this.sender = sender;
1058 var doc = this.doc = new Document("");
1059
1060 var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1061
1062 var _self = this;
1063 sender.on("change", function(e) {
1064 doc.applyDeltas(e.data);
1065 deferredUpdate.schedule(_self.$timeout);
1066 });
1067 };
1068
1069 (function() {
1070
1071 this.$timeout = 500;
1072
1073 this.setTimeout = function(timeout) {
1074 this.$timeout = timeout;
1075 };
1076
1077 this.setValue = function(value) {
1078 this.doc.setValue(value);
1079 this.deferredUpdate.schedule(this.$timeout);
1080 };
1081
1082 this.getValue = function(callbackId) {
1083 this.sender.callback(this.doc.getValue(), callbackId);
1084 };
1085
1086 this.onUpdate = function() {
1087 };
1088
1089 }).call(Mirror.prototype);
1090
1091 });
1092
1093 define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
1094
1095
1096 var oop = require("./lib/oop");
1097 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1098 var Range = require("./range").Range;
1099 var Anchor = require("./anchor").Anchor;
1100
1101 var Document = function(text) {
1102 this.$lines = [];
1103 if (text.length == 0) {
1104 this.$lines = [""];
1105 } else if (Array.isArray(text)) {
1106 this._insertLines(0, text);
1107 } else {
1108 this.insert({row: 0, column:0}, text);
1109 }
1110 };
1111
1112 (function() {
1113
1114 oop.implement(this, EventEmitter);
1115 this.setValue = function(text) {
1116 var len = this.getLength();
1117 this.remove(new Range(0, 0, len, this.getLine(len-1).length));
1118 this.insert({row: 0, column:0}, text);
1119 };
1120 this.getValue = function() {
1121 return this.getAllLines().join(this.getNewLineCharacter());
1122 };
1123 this.createAnchor = function(row, column) {
1124 return new Anchor(this, row, column);
1125 };
1126 if ("aaa".split(/a/).length == 0)
1127 this.$split = function(text) {
1128 return text.replace(/\r\n|\r/g, "\n").split("\n");
1129 }
1130 else
1131 this.$split = function(text) {
1132 return text.split(/\r\n|\r|\n/);
1133 };
1134
1135
1136 this.$detectNewLine = function(text) {
1137 var match = text.match(/^.*?(\r\n|\r|\n)/m);
1138 this.$autoNewLine = match ? match[1] : "\n";
1139 };
1140 this.getNewLineCharacter = function() {
1141 switch (this.$newLineMode) {
1142 case "windows":
1143 return "\r\n";
1144 case "unix":
1145 return "\n";
1146 default:
1147 return this.$autoNewLine;
1148 }
1149 };
1150
1151 this.$autoNewLine = "\n";
1152 this.$newLineMode = "auto";
1153 this.setNewLineMode = function(newLineMode) {
1154 if (this.$newLineMode === newLineMode)
1155 return;
1156
1157 this.$newLineMode = newLineMode;
1158 };
1159 this.getNewLineMode = function() {
1160 return this.$newLineMode;
1161 };
1162 this.isNewLine = function(text) {
1163 return (text == "\r\n" || text == "\r" || text == "\n");
1164 };
1165 this.getLine = function(row) {
1166 return this.$lines[row] || "";
1167 };
1168 this.getLines = function(firstRow, lastRow) {
1169 return this.$lines.slice(firstRow, lastRow + 1);
1170 };
1171 this.getAllLines = function() {
1172 return this.getLines(0, this.getLength());
1173 };
1174 this.getLength = function() {
1175 return this.$lines.length;
1176 };
1177 this.getTextRange = function(range) {
1178 if (range.start.row == range.end.row) {
1179 return this.$lines[range.start.row]
1180 .substring(range.start.column, range.end.column);
1181 }
1182 var lines = this.getLines(range.start.row, range.end.row);
1183 lines[0] = (lines[0] || "").substring(range.start.column);
1184 var l = lines.length - 1;
1185 if (range.end.row - range.start.row == l)
1186 lines[l] = lines[l].substring(0, range.end.column);
1187 return lines.join(this.getNewLineCharacter());
1188 };
1189
1190 this.$clipPosition = function(position) {
1191 var length = this.getLength();
1192 if (position.row >= length) {
1193 position.row = Math.max(0, length - 1);
1194 position.column = this.getLine(length-1).length;
1195 } else if (position.row < 0)
1196 position.row = 0;
1197 return position;
1198 };
1199 this.insert = function(position, text) {
1200 if (!text || text.length === 0)
1201 return position;
1202
1203 position = this.$clipPosition(position);
1204 if (this.getLength() <= 1)
1205 this.$detectNewLine(text);
1206
1207 var lines = this.$split(text);
1208 var firstLine = lines.splice(0, 1)[0];
1209 var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
1210
1211 position = this.insertInLine(position, firstLine);
1212 if (lastLine !== null) {
1213 position = this.insertNewLine(position); // terminate first line
1214 position = this._insertLines(position.row, lines);
1215 position = this.insertInLine(position, lastLine || "");
1216 }
1217 return position;
1218 };
1219 this.insertLines = function(row, lines) {
1220 if (row >= this.getLength())
1221 return this.insert({row: row, column: 0}, "\n" + lines.join("\n"));
1222 return this._insertLines(Math.max(row, 0), lines);
1223 };
1224 this._insertLines = function(row, lines) {
1225 if (lines.length == 0)
1226 return {row: row, column: 0};
1227 if (lines.length > 0xFFFF) {
1228 var end = this._insertLines(row, lines.slice(0xFFFF));
1229 lines = lines.slice(0, 0xFFFF);
1230 }
1231
1232 var args = [row, 0];
1233 args.push.apply(args, lines);
1234 this.$lines.splice.apply(this.$lines, args);
1235
1236 var range = new Range(row, 0, row + lines.length, 0);
1237 var delta = {
1238 action: "insertLines",
1239 range: range,
1240 lines: lines
1241 };
1242 this._emit("change", { data: delta });
1243 return end || range.end;
1244 };
1245 this.insertNewLine = function(position) {
1246 position = this.$clipPosition(position);
1247 var line = this.$lines[position.row] || "";
1248
1249 this.$lines[position.row] = line.substring(0, position.column);
1250 this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
1251
1252 var end = {
1253 row : position.row + 1,
1254 column : 0
1255 };
1256
1257 var delta = {
1258 action: "insertText",
1259 range: Range.fromPoints(position, end),
1260 text: this.getNewLineCharacter()
1261 };
1262 this._emit("change", { data: delta });
1263
1264 return end;
1265 };
1266 this.insertInLine = function(position, text) {
1267 if (text.length == 0)
1268 return position;
1269
1270 var line = this.$lines[position.row] || "";
1271
1272 this.$lines[position.row] = line.substring(0, position.column) + text
1273 + line.substring(position.column);
1274
1275 var end = {
1276 row : position.row,
1277 column : position.column + text.length
1278 };
1279
1280 var delta = {
1281 action: "insertText",
1282 range: Range.fromPoints(position, end),
1283 text: text
1284 };
1285 this._emit("change", { data: delta });
1286
1287 return end;
1288 };
1289 this.remove = function(range) {
1290 range.start = this.$clipPosition(range.start);
1291 range.end = this.$clipPosition(range.end);
1292
1293 if (range.isEmpty())
1294 return range.start;
1295
1296 var firstRow = range.start.row;
1297 var lastRow = range.end.row;
1298
1299 if (range.isMultiLine()) {
1300 var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
1301 var lastFullRow = lastRow - 1;
1302
1303 if (range.end.column > 0)
1304 this.removeInLine(lastRow, 0, range.end.column);
1305
1306 if (lastFullRow >= firstFullRow)
1307 this._removeLines(firstFullRow, lastFullRow);
1308
1309 if (firstFullRow != firstRow) {
1310 this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
1311 this.removeNewLine(range.start.row);
1312 }
1313 }
1314 else {
1315 this.removeInLine(firstRow, range.start.column, range.end.column);
1316 }
1317 return range.start;
1318 };
1319 this.removeInLine = function(row, startColumn, endColumn) {
1320 if (startColumn == endColumn)
1321 return;
1322
1323 var range = new Range(row, startColumn, row, endColumn);
1324 var line = this.getLine(row);
1325 var removed = line.substring(startColumn, endColumn);
1326 var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
1327 this.$lines.splice(row, 1, newLine);
1328
1329 var delta = {
1330 action: "removeText",
1331 range: range,
1332 text: removed
1333 };
1334 this._emit("change", { data: delta });
1335 return range.start;
1336 };
1337 this.removeLines = function(firstRow, lastRow) {
1338 if (firstRow < 0 || lastRow >= this.getLength())
1339 return this.remove(new Range(firstRow, 0, lastRow + 1, 0));
1340 return this._removeLines(firstRow, lastRow);
1341 };
1342
1343 this._removeLines = function(firstRow, lastRow) {
1344 var range = new Range(firstRow, 0, lastRow + 1, 0);
1345 var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
1346
1347 var delta = {
1348 action: "removeLines",
1349 range: range,
1350 nl: this.getNewLineCharacter(),
1351 lines: removed
1352 };
1353 this._emit("change", { data: delta });
1354 return removed;
1355 };
1356 this.removeNewLine = function(row) {
1357 var firstLine = this.getLine(row);
1358 var secondLine = this.getLine(row+1);
1359
1360 var range = new Range(row, firstLine.length, row+1, 0);
1361 var line = firstLine + secondLine;
1362
1363 this.$lines.splice(row, 2, line);
1364
1365 var delta = {
1366 action: "removeText",
1367 range: range,
1368 text: this.getNewLineCharacter()
1369 };
1370 this._emit("change", { data: delta });
1371 };
1372 this.replace = function(range, text) {
1373 if (text.length == 0 && range.isEmpty())
1374 return range.start;
1375 if (text == this.getTextRange(range))
1376 return range.end;
1377
1378 this.remove(range);
1379 if (text) {
1380 var end = this.insert(range.start, text);
1381 }
1382 else {
1383 end = range.start;
1384 }
1385
1386 return end;
1387 };
1388 this.applyDeltas = function(deltas) {
1389 for (var i=0; i<deltas.length; i++) {
1390 var delta = deltas[i];
1391 var range = Range.fromPoints(delta.range.start, delta.range.end);
1392
1393 if (delta.action == "insertLines")
1394 this.insertLines(range.start.row, delta.lines);
1395 else if (delta.action == "insertText")
1396 this.insert(range.start, delta.text);
1397 else if (delta.action == "removeLines")
1398 this._removeLines(range.start.row, range.end.row - 1);
1399 else if (delta.action == "removeText")
1400 this.remove(range);
1401 }
1402 };
1403 this.revertDeltas = function(deltas) {
1404 for (var i=deltas.length-1; i>=0; i--) {
1405 var delta = deltas[i];
1406
1407 var range = Range.fromPoints(delta.range.start, delta.range.end);
1408
1409 if (delta.action == "insertLines")
1410 this._removeLines(range.start.row, range.end.row - 1);
1411 else if (delta.action == "insertText")
1412 this.remove(range);
1413 else if (delta.action == "removeLines")
1414 this._insertLines(range.start.row, delta.lines);
1415 else if (delta.action == "removeText")
1416 this.insert(range.start, delta.text);
1417 }
1418 };
1419 this.indexToPosition = function(index, startRow) {
1420 var lines = this.$lines || this.getAllLines();
1421 var newlineLength = this.getNewLineCharacter().length;
1422 for (var i = startRow || 0, l = lines.length; i < l; i++) {
1423 index -= lines[i].length + newlineLength;
1424 if (index < 0)
1425 return {row: i, column: index + lines[i].length + newlineLength};
1426 }
1427 return {row: l-1, column: lines[l-1].length};
1428 };
1429 this.positionToIndex = function(pos, startRow) {
1430 var lines = this.$lines || this.getAllLines();
1431 var newlineLength = this.getNewLineCharacter().length;
1432 var index = 0;
1433 var row = Math.min(pos.row, lines.length);
1434 for (var i = startRow || 0; i < row; ++i)
1435 index += lines[i].length + newlineLength;
1436
1437 return index + pos.column;
1438 };
1439
1440 }).call(Document.prototype);
1441
1442 exports.Document = Document;
1443 });
1444
1445 define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
1446
1447 var comparePoints = function(p1, p2) {
1448 return p1.row - p2.row || p1.column - p2.column;
1449 };
1450 var Range = function(startRow, startColumn, endRow, endColumn) {
1451 this.start = {
1452 row: startRow,
1453 column: startColumn
1454 };
1455
1456 this.end = {
1457 row: endRow,
1458 column: endColumn
1459 };
1460 };
1461
1462 (function() {
1463 this.isEqual = function(range) {
1464 return this.start.row === range.start.row &&
1465 this.end.row === range.end.row &&
1466 this.start.column === range.start.column &&
1467 this.end.column === range.end.column;
1468 };
1469 this.toString = function() {
1470 return ("Range: [" + this.start.row + "/" + this.start.column +
1471 "] -> [" + this.end.row + "/" + this.end.column + "]");
1472 };
1473
1474 this.contains = function(row, column) {
1475 return this.compare(row, column) == 0;
1476 };
1477 this.compareRange = function(range) {
1478 var cmp,
1479 end = range.end,
1480 start = range.start;
1481
1482 cmp = this.compare(end.row, end.column);
1483 if (cmp == 1) {
1484 cmp = this.compare(start.row, start.column);
1485 if (cmp == 1) {
1486 return 2;
1487 } else if (cmp == 0) {
1488 return 1;
1489 } else {
1490 return 0;
1491 }
1492 } else if (cmp == -1) {
1493 return -2;
1494 } else {
1495 cmp = this.compare(start.row, start.column);
1496 if (cmp == -1) {
1497 return -1;
1498 } else if (cmp == 1) {
1499 return 42;
1500 } else {
1501 return 0;
1502 }
1503 }
1504 };
1505 this.comparePoint = function(p) {
1506 return this.compare(p.row, p.column);
1507 };
1508 this.containsRange = function(range) {
1509 return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
1510 };
1511 this.intersects = function(range) {
1512 var cmp = this.compareRange(range);
1513 return (cmp == -1 || cmp == 0 || cmp == 1);
1514 };
1515 this.isEnd = function(row, column) {
1516 return this.end.row == row && this.end.column == column;
1517 };
1518 this.isStart = function(row, column) {
1519 return this.start.row == row && this.start.column == column;
1520 };
1521 this.setStart = function(row, column) {
1522 if (typeof row == "object") {
1523 this.start.column = row.column;
1524 this.start.row = row.row;
1525 } else {
1526 this.start.row = row;
1527 this.start.column = column;
1528 }
1529 };
1530 this.setEnd = function(row, column) {
1531 if (typeof row == "object") {
1532 this.end.column = row.column;
1533 this.end.row = row.row;
1534 } else {
1535 this.end.row = row;
1536 this.end.column = column;
1537 }
1538 };
1539 this.inside = function(row, column) {
1540 if (this.compare(row, column) == 0) {
1541 if (this.isEnd(row, column) || this.isStart(row, column)) {
1542 return false;
1543 } else {
1544 return true;
1545 }
1546 }
1547 return false;
1548 };
1549 this.insideStart = function(row, column) {
1550 if (this.compare(row, column) == 0) {
1551 if (this.isEnd(row, column)) {
1552 return false;
1553 } else {
1554 return true;
1555 }
1556 }
1557 return false;
1558 };
1559 this.insideEnd = function(row, column) {
1560 if (this.compare(row, column) == 0) {
1561 if (this.isStart(row, column)) {
1562 return false;
1563 } else {
1564 return true;
1565 }
1566 }
1567 return false;
1568 };
1569 this.compare = function(row, column) {
1570 if (!this.isMultiLine()) {
1571 if (row === this.start.row) {
1572 return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
1573 };
1574 }
1575
1576 if (row < this.start.row)
1577 return -1;
1578
1579 if (row > this.end.row)
1580 return 1;
1581
1582 if (this.start.row === row)
1583 return column >= this.start.column ? 0 : -1;
1584
1585 if (this.end.row === row)
1586 return column <= this.end.column ? 0 : 1;
1587
1588 return 0;
1589 };
1590 this.compareStart = function(row, column) {
1591 if (this.start.row == row && this.start.column == column) {
1592 return -1;
1593 } else {
1594 return this.compare(row, column);
1595 }
1596 };
1597 this.compareEnd = function(row, column) {
1598 if (this.end.row == row && this.end.column == column) {
1599 return 1;
1600 } else {
1601 return this.compare(row, column);
1602 }
1603 };
1604 this.compareInside = function(row, column) {
1605 if (this.end.row == row && this.end.column == column) {
1606 return 1;
1607 } else if (this.start.row == row && this.start.column == column) {
1608 return -1;
1609 } else {
1610 return this.compare(row, column);
1611 }
1612 };
1613 this.clipRows = function(firstRow, lastRow) {
1614 if (this.end.row > lastRow)
1615 var end = {row: lastRow + 1, column: 0};
1616 else if (this.end.row < firstRow)
1617 var end = {row: firstRow, column: 0};
1618
1619 if (this.start.row > lastRow)
1620 var start = {row: lastRow + 1, column: 0};
1621 else if (this.start.row < firstRow)
1622 var start = {row: firstRow, column: 0};
1623
1624 return Range.fromPoints(start || this.start, end || this.end);
1625 };
1626 this.extend = function(row, column) {
1627 var cmp = this.compare(row, column);
1628
1629 if (cmp == 0)
1630 return this;
1631 else if (cmp == -1)
1632 var start = {row: row, column: column};
1633 else
1634 var end = {row: row, column: column};
1635
1636 return Range.fromPoints(start || this.start, end || this.end);
1637 };
1638
1639 this.isEmpty = function() {
1640 return (this.start.row === this.end.row && this.start.column === this.end.column);
1641 };
1642 this.isMultiLine = function() {
1643 return (this.start.row !== this.end.row);
1644 };
1645 this.clone = function() {
1646 return Range.fromPoints(this.start, this.end);
1647 };
1648 this.collapseRows = function() {
1649 if (this.end.column == 0)
1650 return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
1651 else
1652 return new Range(this.start.row, 0, this.end.row, 0)
1653 };
1654 this.toScreenRange = function(session) {
1655 var screenPosStart = session.documentToScreenPosition(this.start);
1656 var screenPosEnd = session.documentToScreenPosition(this.end);
1657
1658 return new Range(
1659 screenPosStart.row, screenPosStart.column,
1660 screenPosEnd.row, screenPosEnd.column
1661 );
1662 };
1663 this.moveBy = function(row, column) {
1664 this.start.row += row;
1665 this.start.column += column;
1666 this.end.row += row;
1667 this.end.column += column;
1668 };
1669
1670 }).call(Range.prototype);
1671 Range.fromPoints = function(start, end) {
1672 return new Range(start.row, start.column, end.row, end.column);
1673 };
1674 Range.comparePoints = comparePoints;
1675
1676 Range.comparePoints = function(p1, p2) {
1677 return p1.row - p2.row || p1.column - p2.column;
1678 };
1679
1680
1681 exports.Range = Range;
1682 });
1683
1684 define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
1685
1686
1687 var oop = require("./lib/oop");
1688 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1689
1690 var Anchor = exports.Anchor = function(doc, row, column) {
1691 this.document = doc;
1692
1693 if (typeof column == "undefined")
1694 this.setPosition(row.row, row.column);
1695 else
1696 this.setPosition(row, column);
1697
1698 this.$onChange = this.onChange.bind(this);
1699 doc.on("change", this.$onChange);
1700 };
1701
1702 (function() {
1703
1704 oop.implement(this, EventEmitter);
1705
1706 this.getPosition = function() {
1707 return this.$clipPositionToDocument(this.row, this.column);
1708 };
1709
1710 this.getDocument = function() {
1711 return this.document;
1712 };
1713
1714 this.onChange = function(e) {
1715 var delta = e.data;
1716 var range = delta.range;
1717
1718 if (range.start.row == range.end.row && range.start.row != this.row)
1719 return;
1720
1721 if (range.start.row > this.row)
1722 return;
1723
1724 if (range.start.row == this.row && range.start.column > this.column)
1725 return;
1726
1727 var row = this.row;
1728 var column = this.column;
1729 var start = range.start;
1730 var end = range.end;
1731
1732 if (delta.action === "insertText") {
1733 if (start.row === row && start.column <= column) {
1734 if (start.row === end.row) {
1735 column += end.column - start.column;
1736 } else {
1737 column -= start.column;
1738 row += end.row - start.row;
1739 }
1740 } else if (start.row !== end.row && start.row < row) {
1741 row += end.row - start.row;
1742 }
1743 } else if (delta.action === "insertLines") {
1744 if (start.row <= row) {
1745 row += end.row - start.row;
1746 }
1747 } else if (delta.action === "removeText") {
1748 if (start.row === row && start.column < column) {
1749 if (end.column >= column)
1750 column = start.column;
1751 else
1752 column = Math.max(0, column - (end.column - start.column));
1753
1754 } else if (start.row !== end.row && start.row < row) {
1755 if (end.row === row)
1756 column = Math.max(0, column - end.column) + start.column;
1757 row -= (end.row - start.row);
1758 } else if (end.row === row) {
1759 row -= end.row - start.row;
1760 column = Math.max(0, column - end.column) + start.column;
1761 }
1762 } else if (delta.action == "removeLines") {
1763 if (start.row <= row) {
1764 if (end.row <= row)
1765 row -= end.row - start.row;
1766 else {
1767 row = start.row;
1768 column = 0;
1769 }
1770 }
1771 }
1772
1773 this.setPosition(row, column, true);
1774 };
1775
1776 this.setPosition = function(row, column, noClip) {
1777 var pos;
1778 if (noClip) {
1779 pos = {
1780 row: row,
1781 column: column
1782 };
1783 } else {
1784 pos = this.$clipPositionToDocument(row, column);
1785 }
1786
1787 if (this.row == pos.row && this.column == pos.column)
1788 return;
1789
1790 var old = {
1791 row: this.row,
1792 column: this.column
1793 };
1794
1795 this.row = pos.row;
1796 this.column = pos.column;
1797 this._emit("change", {
1798 old: old,
1799 value: pos
1800 });
1801 };
1802
1803 this.detach = function() {
1804 this.document.removeEventListener("change", this.$onChange);
1805 };
1806 this.$clipPositionToDocument = function(row, column) {
1807 var pos = {};
1808
1809 if (row >= this.document.getLength()) {
1810 pos.row = Math.max(0, this.document.getLength() - 1);
1811 pos.column = this.document.getLine(pos.row).length;
1812 }
1813 else if (row < 0) {
1814 pos.row = 0;
1815 pos.column = 0;
1816 }
1817 else {
1818 pos.row = row;
1819 pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
1820 }
1821
1822 if (column < 0)
1823 pos.column = 0;
1824
1825 return pos;
1826 };
1827
1828 }).call(Anchor.prototype);
1829
1830 });
1831
1832 define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
1833
1834
1835 exports.stringReverse = function(string) {
1836 return string.split("").reverse().join("");
1837 };
1838
1839 exports.stringRepeat = function (string, count) {
1840 var result = '';
1841 while (count > 0) {
1842 if (count & 1)
1843 result += string;
1844
1845 if (count >>= 1)
1846 string += string;
1847 }
1848 return result;
1849 };
1850
1851 var trimBeginRegexp = /^\s\s*/;
1852 var trimEndRegexp = /\s\s*$/;
1853
1854 exports.stringTrimLeft = function (string) {
1855 return string.replace(trimBeginRegexp, '');
1856 };
1857
1858 exports.stringTrimRight = function (string) {
1859 return string.replace(trimEndRegexp, '');
1860 };
1861
1862 exports.copyObject = function(obj) {
1863 var copy = {};
1864 for (var key in obj) {
1865 copy[key] = obj[key];
1866 }
1867 return copy;
1868 };
1869
1870 exports.copyArray = function(array){
1871 var copy = [];
1872 for (var i=0, l=array.length; i<l; i++) {
1873 if (array[i] && typeof array[i] == "object")
1874 copy[i] = this.copyObject( array[i] );
1875 else
1876 copy[i] = array[i];
1877 }
1878 return copy;
1879 };
1880
1881 exports.deepCopy = function (obj) {
1882 if (typeof obj != "object") {
1883 return obj;
1884 }
1885
1886 var copy = obj.constructor();
1887 for (var key in obj) {
1888 if (typeof obj[key] == "object") {
1889 copy[key] = this.deepCopy(obj[key]);
1890 } else {
1891 copy[key] = obj[key];
1892 }
1893 }
1894 return copy;
1895 };
1896
1897 exports.arrayToMap = function(arr) {
1898 var map = {};
1899 for (var i=0; i<arr.length; i++) {
1900 map[arr[i]] = 1;
1901 }
1902 return map;
1903
1904 };
1905
1906 exports.createMap = function(props) {
1907 var map = Object.create(null);
1908 for (var i in props) {
1909 map[i] = props[i];
1910 }
1911 return map;
1912 };
1913 exports.arrayRemove = function(array, value) {
1914 for (var i = 0; i <= array.length; i++) {
1915 if (value === array[i]) {
1916 array.splice(i, 1);
1917 }
1918 }
1919 };
1920
1921 exports.escapeRegExp = function(str) {
1922 return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
1923 };
1924
1925 exports.escapeHTML = function(str) {
1926 return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
1927 };
1928
1929 exports.getMatchOffsets = function(string, regExp) {
1930 var matches = [];
1931
1932 string.replace(regExp, function(str) {
1933 matches.push({
1934 offset: arguments[arguments.length-2],
1935 length: str.length
1936 });
1937 });
1938
1939 return matches;
1940 };
1941 exports.deferredCall = function(fcn) {
1942
1943 var timer = null;
1944 var callback = function() {
1945 timer = null;
1946 fcn();
1947 };
1948
1949 var deferred = function(timeout) {
1950 deferred.cancel();
1951 timer = setTimeout(callback, timeout || 0);
1952 return deferred;
1953 };
1954
1955 deferred.schedule = deferred;
1956
1957 deferred.call = function() {
1958 this.cancel();
1959 fcn();
1960 return deferred;
1961 };
1962
1963 deferred.cancel = function() {
1964 clearTimeout(timer);
1965 timer = null;
1966 return deferred;
1967 };
1968
1969 return deferred;
1970 };
1971
1972
1973 exports.delayedCall = function(fcn, defaultTimeout) {
1974 var timer = null;
1975 var callback = function() {
1976 timer = null;
1977 fcn();
1978 };
1979
1980 var _self = function(timeout) {
1981 timer && clearTimeout(timer);
1982 timer = setTimeout(callback, timeout || defaultTimeout);
1983 };
1984
1985 _self.delay = _self;
1986 _self.schedule = function(timeout) {
1987 if (timer == null)
1988 timer = setTimeout(callback, timeout || 0);
1989 };
1990
1991 _self.call = function() {
1992 this.cancel();
1993 fcn();
1994 };
1995
1996 _self.cancel = function() {
1997 timer && clearTimeout(timer);
1998 timer = null;
1999 };
2000
2001 _self.isPending = function() {
2002 return timer;
2003 };
2004
2005 return _self;
2006 };
2007 });
2008
2009
2010
2011 define('ace/mode/php/php', ['require', 'exports', 'module' ], function(require, exports, module) {
2012
2013 var PHP = {Constants:{}};
2014
2015
2016
2017
2018
2019
2020 PHP.Constants.T_INCLUDE = 262;
2021 PHP.Constants.T_INCLUDE_ONCE = 261;
2022 PHP.Constants.T_EVAL = 260;
2023 PHP.Constants.T_REQUIRE = 259;
2024 PHP.Constants.T_REQUIRE_ONCE = 258;
2025 PHP.Constants.T_LOGICAL_OR = 263;
2026 PHP.Constants.T_LOGICAL_XOR = 264;
2027 PHP.Constants.T_LOGICAL_AND = 265;
2028 PHP.Constants.T_PRINT = 266;
2029 PHP.Constants.T_PLUS_EQUAL = 277;
2030 PHP.Constants.T_MINUS_EQUAL = 276;
2031 PHP.Constants.T_MUL_EQUAL = 275;
2032 PHP.Constants.T_DIV_EQUAL = 274;
2033 PHP.Constants.T_CONCAT_EQUAL = 273;
2034 PHP.Constants.T_MOD_EQUAL = 272;
2035 PHP.Constants.T_AND_EQUAL = 271;
2036 PHP.Constants.T_OR_EQUAL = 270;
2037 PHP.Constants.T_XOR_EQUAL = 269;
2038 PHP.Constants.T_SL_EQUAL = 268;
2039 PHP.Constants.T_SR_EQUAL = 267;
2040 PHP.Constants.T_BOOLEAN_OR = 278;
2041 PHP.Constants.T_BOOLEAN_AND = 279;
2042 PHP.Constants.T_IS_EQUAL = 283;
2043 PHP.Constants.T_IS_NOT_EQUAL = 282;
2044 PHP.Constants.T_IS_IDENTICAL = 281;
2045 PHP.Constants.T_IS_NOT_IDENTICAL = 280;
2046 PHP.Constants.T_IS_SMALLER_OR_EQUAL = 285;
2047 PHP.Constants.T_IS_GREATER_OR_EQUAL = 284;
2048 PHP.Constants.T_SL = 287;
2049 PHP.Constants.T_SR = 286;
2050 PHP.Constants.T_INSTANCEOF = 288;
2051 PHP.Constants.T_INC = 297;
2052 PHP.Constants.T_DEC = 296;
2053 PHP.Constants.T_INT_CAST = 295;
2054 PHP.Constants.T_DOUBLE_CAST = 294;
2055 PHP.Constants.T_STRING_CAST = 293;
2056 PHP.Constants.T_ARRAY_CAST = 292;
2057 PHP.Constants.T_OBJECT_CAST = 291;
2058 PHP.Constants.T_BOOL_CAST = 290;
2059 PHP.Constants.T_UNSET_CAST = 289;
2060 PHP.Constants.T_NEW = 299;
2061 PHP.Constants.T_CLONE = 298;
2062 PHP.Constants.T_EXIT = 300;
2063 PHP.Constants.T_IF = 301;
2064 PHP.Constants.T_ELSEIF = 302;
2065 PHP.Constants.T_ELSE = 303;
2066 PHP.Constants.T_ENDIF = 304;
2067 PHP.Constants.T_LNUMBER = 305;
2068 PHP.Constants.T_DNUMBER = 306;
2069 PHP.Constants.T_STRING = 307;
2070 PHP.Constants.T_STRING_VARNAME = 308;
2071 PHP.Constants.T_VARIABLE = 309;
2072 PHP.Constants.T_NUM_STRING = 310;
2073 PHP.Constants.T_INLINE_HTML = 311;
2074 PHP.Constants.T_CHARACTER = 312;
2075 PHP.Constants.T_BAD_CHARACTER = 313;
2076 PHP.Constants.T_ENCAPSED_AND_WHITESPACE = 314;
2077 PHP.Constants.T_CONSTANT_ENCAPSED_STRING = 315;
2078 PHP.Constants.T_ECHO = 316;
2079 PHP.Constants.T_DO = 317;
2080 PHP.Constants.T_WHILE = 318;
2081 PHP.Constants.T_ENDWHILE = 319;
2082 PHP.Constants.T_FOR = 320;
2083 PHP.Constants.T_ENDFOR = 321;
2084 PHP.Constants.T_FOREACH = 322;
2085 PHP.Constants.T_ENDFOREACH = 323;
2086 PHP.Constants.T_DECLARE = 324;
2087 PHP.Constants.T_ENDDECLARE = 325;
2088 PHP.Constants.T_AS = 326;
2089 PHP.Constants.T_SWITCH = 327;
2090 PHP.Constants.T_ENDSWITCH = 328;
2091 PHP.Constants.T_CASE = 329;
2092 PHP.Constants.T_DEFAULT = 330;
2093 PHP.Constants.T_BREAK = 331;
2094 PHP.Constants.T_CONTINUE = 332;
2095 PHP.Constants.T_GOTO = 333;
2096 PHP.Constants.T_FUNCTION = 334;
2097 PHP.Constants.T_CONST = 335;
2098 PHP.Constants.T_RETURN = 336;
2099 PHP.Constants.T_TRY = 337;
2100 PHP.Constants.T_CATCH = 338;
2101 PHP.Constants.T_THROW = 339;
2102 PHP.Constants.T_USE = 340;
2103 PHP.Constants.T_GLOBAL = 341;
2104 PHP.Constants.T_STATIC = 347;
2105 PHP.Constants.T_ABSTRACT = 346;
2106 PHP.Constants.T_FINAL = 345;
2107 PHP.Constants.T_PRIVATE = 344;
2108 PHP.Constants.T_PROTECTED = 343;
2109 PHP.Constants.T_PUBLIC = 342;
2110 PHP.Constants.T_VAR = 348;
2111 PHP.Constants.T_UNSET = 349;
2112 PHP.Constants.T_ISSET = 350;
2113 PHP.Constants.T_EMPTY = 351;
2114 PHP.Constants.T_HALT_COMPILER = 352;
2115 PHP.Constants.T_CLASS = 353;
2116 PHP.Constants.T_INTERFACE = 354;
2117 PHP.Constants.T_EXTENDS = 355;
2118 PHP.Constants.T_IMPLEMENTS = 356;
2119 PHP.Constants.T_OBJECT_OPERATOR = 357;
2120 PHP.Constants.T_DOUBLE_ARROW = 358;
2121 PHP.Constants.T_LIST = 359;
2122 PHP.Constants.T_ARRAY = 360;
2123 PHP.Constants.T_CLASS_C = 361;
2124 PHP.Constants.T_TRAIT_C = 381;
2125 PHP.Constants.T_METHOD_C = 362;
2126 PHP.Constants.T_FUNC_C = 363;
2127 PHP.Constants.T_LINE = 364;
2128 PHP.Constants.T_FILE = 365;
2129 PHP.Constants.T_COMMENT = 366;
2130 PHP.Constants.T_DOC_COMMENT = 367;
2131 PHP.Constants.T_OPEN_TAG = 368;
2132 PHP.Constants.T_OPEN_TAG_WITH_ECHO = 369;
2133 PHP.Constants.T_CLOSE_TAG = 370;
2134 PHP.Constants.T_WHITESPACE = 371;
2135 PHP.Constants.T_START_HEREDOC = 372;
2136 PHP.Constants.T_END_HEREDOC = 373;
2137 PHP.Constants.T_DOLLAR_OPEN_CURLY_BRACES = 374;
2138 PHP.Constants.T_CURLY_OPEN = 375;
2139 PHP.Constants.T_PAAMAYIM_NEKUDOTAYIM = 376;
2140 PHP.Constants.T_DOUBLE_COLON = 376;
2141 PHP.Constants.T_NAMESPACE = 377;
2142 PHP.Constants.T_NS_C = 378;
2143 PHP.Constants.T_DIR = 379;
2144 PHP.Constants.T_NS_SEPARATOR = 380;
2145 PHP.Lexer = function( src, ini ) {
2146
2147
2148 var heredoc,
2149 lineBreaker = function( result ) {
2150 if (result.match(/\n/) !== null) {
2151 var quote = result.substring(0, 1);
2152 result = '[' + result.split(/\n/).join( quote + "," + quote ) + '].join("\\n")';
2153
2154 }
2155
2156 return result;
2157 },
2158 prev,
2159
2160 openTag = (ini === undefined || (/^(on|true|1)$/i.test(ini.short_open_tag) ) ? /(\<\?php\s|\<\?|\<\%|\<script language\=('|")?php('|")?\>)/i : /(\<\?php\s|<\?=|\<script language\=('|")?php('|")?\>)/i),
2161 openTagStart = (ini === undefined || (/^(on|true|1)$/i.test(ini.short_open_tag)) ? /^(\<\?php\s|\<\?|\<\%|\<script language\=('|")?php('|")?\>)/i : /^(\<\?php\s|<\?=|\<script language\=('|")?php('|")?\>)/i),
2162 tokens = [
2163 {
2164 value: PHP.Constants.T_USE,
2165 re: /^use(?=\s)/i
2166 },
2167 {
2168 value: PHP.Constants.T_ABSTRACT,
2169 re: /^abstract(?=\s)/i
2170 },
2171 {
2172 value: PHP.Constants.T_IMPLEMENTS,
2173 re: /^implements(?=\s)/i
2174 },
2175 {
2176 value: PHP.Constants.T_INTERFACE,
2177 re: /^interface(?=\s)/i
2178 },
2179 {
2180 value: PHP.Constants.T_CONST,
2181 re: /^const(?=\s)/i
2182 },
2183 {
2184 value: PHP.Constants.T_STATIC,
2185 re: /^static(?=\s)/i
2186 },
2187 {
2188 value: PHP.Constants.T_FINAL,
2189 re: /^final(?=\s)/i
2190 },
2191 {
2192 value: PHP.Constants.T_VAR,
2193 re: /^var(?=\s)/i
2194 },
2195 {
2196 value: PHP.Constants.T_GLOBAL,
2197 re: /^global(?=\s)/i
2198 },
2199 {
2200 value: PHP.Constants.T_CLONE,
2201 re: /^clone(?=\s)/i
2202 },
2203 {
2204 value: PHP.Constants.T_THROW,
2205 re: /^throw(?=\s)/i
2206 },
2207 {
2208 value: PHP.Constants.T_EXTENDS,
2209 re: /^extends(?=\s)/i
2210 },
2211 {
2212 value: PHP.Constants.T_AND_EQUAL,
2213 re: /^&=/
2214 },
2215 {
2216 value: PHP.Constants.T_AS,
2217 re: /^as(?=\s)/i
2218 },
2219 {
2220 value: PHP.Constants.T_ARRAY_CAST,
2221 re: /^\(array\)/i
2222 },
2223 {
2224 value: PHP.Constants.T_BOOL_CAST,
2225 re: /^\((bool|boolean)\)/i
2226 },
2227 {
2228 value: PHP.Constants.T_DOUBLE_CAST,
2229 re: /^\((real|float|double)\)/i
2230 },
2231 {
2232 value: PHP.Constants.T_INT_CAST,
2233 re: /^\((int|integer)\)/i
2234 },
2235 {
2236 value: PHP.Constants.T_OBJECT_CAST,
2237 re: /^\(object\)/i
2238 },
2239 {
2240 value: PHP.Constants.T_STRING_CAST,
2241 re: /^\(string\)/i
2242 },
2243 {
2244 value: PHP.Constants.T_UNSET_CAST,
2245 re: /^\(unset\)/i
2246 },
2247 {
2248 value: PHP.Constants.T_TRY,
2249 re: /^try(?=\s*{)/i
2250 },
2251 {
2252 value: PHP.Constants.T_CATCH,
2253 re: /^catch(?=\s*\()/i
2254 },
2255 {
2256 value: PHP.Constants.T_INSTANCEOF,
2257 re: /^instanceof(?=\s)/i
2258 },
2259 {
2260 value: PHP.Constants.T_LOGICAL_OR,
2261 re: /^or(?=\s)/i
2262 },
2263 {
2264 value: PHP.Constants.T_LOGICAL_AND,
2265 re: /^and(?=\s)/i
2266 },
2267 {
2268 value: PHP.Constants.T_LOGICAL_XOR,
2269 re: /^xor(?=\s)/i
2270 },
2271 {
2272 value: PHP.Constants.T_BOOLEAN_AND,
2273 re: /^&&/
2274 },
2275 {
2276 value: PHP.Constants.T_BOOLEAN_OR,
2277 re: /^\|\|/
2278 },
2279 {
2280 value: PHP.Constants.T_CONTINUE,
2281 re: /^continue(?=\s|;)/i
2282 },
2283 {
2284 value: PHP.Constants.T_BREAK,
2285 re: /^break(?=\s|;)/i
2286 },
2287 {
2288 value: PHP.Constants.T_ENDDECLARE,
2289 re: /^enddeclare(?=\s|;)/i
2290 },
2291 {
2292 value: PHP.Constants.T_ENDFOR,
2293 re: /^endfor(?=\s|;)/i
2294 },
2295 {
2296 value: PHP.Constants.T_ENDFOREACH,
2297 re: /^endforeach(?=\s|;)/i
2298 },
2299 {
2300 value: PHP.Constants.T_ENDIF,
2301 re: /^endif(?=\s|;)/i
2302 },
2303 {
2304 value: PHP.Constants.T_ENDSWITCH,
2305 re: /^endswitch(?=\s|;)/i
2306 },
2307 {
2308 value: PHP.Constants.T_ENDWHILE,
2309 re: /^endwhile(?=\s|;)/i
2310 },
2311 {
2312 value: PHP.Constants.T_CASE,
2313 re: /^case(?=\s)/i
2314 },
2315 {
2316 value: PHP.Constants.T_DEFAULT,
2317 re: /^default(?=\s|:)/i
2318 },
2319 {
2320 value: PHP.Constants.T_SWITCH,
2321 re: /^switch(?=[ (])/i
2322 },
2323 {
2324 value: PHP.Constants.T_EXIT,
2325 re: /^(exit|die)(?=[ \(;])/i
2326 },
2327 {
2328 value: PHP.Constants.T_CLOSE_TAG,
2329 re: /^(\?\>|\%\>|\<\/script\>)\s?\s?/i,
2330 func: function( result ) {
2331 insidePHP = false;
2332 return result;
2333 }
2334 },
2335 {
2336 value: PHP.Constants.T_DOUBLE_ARROW,
2337 re: /^\=\>/
2338 },
2339 {
2340 value: PHP.Constants.T_DOUBLE_COLON,
2341 re: /^\:\:/
2342 },
2343 {
2344 value: PHP.Constants.T_METHOD_C,
2345 re: /^__METHOD__/
2346 },
2347 {
2348 value: PHP.Constants.T_LINE,
2349 re: /^__LINE__/
2350 },
2351 {
2352 value: PHP.Constants.T_FILE,
2353 re: /^__FILE__/
2354 },
2355 {
2356 value: PHP.Constants.T_FUNC_C,
2357 re: /^__FUNCTION__/
2358 },
2359 {
2360 value: PHP.Constants.T_NS_C,
2361 re: /^__NAMESPACE__/
2362 },
2363 {
2364 value: PHP.Constants.T_TRAIT_C,
2365 re: /^__TRAIT__/
2366 },
2367 {
2368 value: PHP.Constants.T_DIR,
2369 re: /^__DIR__/
2370 },
2371 {
2372 value: PHP.Constants.T_CLASS_C,
2373 re: /^__CLASS__/
2374 },
2375 {
2376 value: PHP.Constants.T_INC,
2377 re: /^\+\+/
2378 },
2379 {
2380 value: PHP.Constants.T_DEC,
2381 re: /^\-\-/
2382 },
2383 {
2384 value: PHP.Constants.T_CONCAT_EQUAL,
2385 re: /^\.\=/
2386 },
2387 {
2388 value: PHP.Constants.T_DIV_EQUAL,
2389 re: /^\/\=/
2390 },
2391 {
2392 value: PHP.Constants.T_XOR_EQUAL,
2393 re: /^\^\=/
2394 },
2395 {
2396 value: PHP.Constants.T_MUL_EQUAL,
2397 re: /^\*\=/
2398 },
2399 {
2400 value: PHP.Constants.T_MOD_EQUAL,
2401 re: /^\%\=/
2402 },
2403 {
2404 value: PHP.Constants.T_SL_EQUAL,
2405 re: /^<<=/
2406 },
2407 {
2408 value: PHP.Constants.T_START_HEREDOC,
2409 re: /^<<<[A-Z_0-9]+\s/i,
2410 func: function( result ){
2411 heredoc = result.substring(3, result.length - 1);
2412 return result;
2413 }
2414 },
2415 {
2416 value: PHP.Constants.T_SL,
2417 re: /^<</
2418 },
2419 {
2420 value: PHP.Constants.T_IS_SMALLER_OR_EQUAL,
2421 re: /^<=/
2422 },
2423 {
2424 value: PHP.Constants.T_SR_EQUAL,
2425 re: /^>>=/
2426 },
2427 {
2428 value: PHP.Constants.T_SR,
2429 re: /^>>/
2430 },
2431 {
2432 value: PHP.Constants.T_IS_GREATER_OR_EQUAL,
2433 re: /^>=/
2434 },
2435 {
2436 value: PHP.Constants.T_OR_EQUAL,
2437 re: /^\|\=/
2438 },
2439 {
2440 value: PHP.Constants.T_PLUS_EQUAL,
2441 re: /^\+\=/
2442 },
2443 {
2444 value: PHP.Constants.T_MINUS_EQUAL,
2445 re: /^-\=/
2446 },
2447 {
2448 value: PHP.Constants.T_OBJECT_OPERATOR,
2449 re: /^\-\>/i
2450 },
2451 {
2452 value: PHP.Constants.T_CLASS,
2453 re: /^class(?=[\s\{])/i,
2454 afterWhitespace: true
2455 },
2456 {
2457 value: PHP.Constants.T_PUBLIC,
2458 re: /^public(?=[\s])/i
2459 },
2460 {
2461 value: PHP.Constants.T_PRIVATE,
2462 re: /^private(?=[\s])/i
2463 },
2464 {
2465 value: PHP.Constants.T_PROTECTED,
2466 re: /^protected(?=[\s])/i
2467 },
2468 {
2469 value: PHP.Constants.T_ARRAY,
2470 re: /^array(?=\s*?\()/i
2471 },
2472 {
2473 value: PHP.Constants.T_EMPTY,
2474 re: /^empty(?=[ \(])/i
2475 },
2476 {
2477 value: PHP.Constants.T_ISSET,
2478 re: /^isset(?=[ \(])/i
2479 },
2480 {
2481 value: PHP.Constants.T_UNSET,
2482 re: /^unset(?=[ \(])/i
2483 },
2484 {
2485 value: PHP.Constants.T_RETURN,
2486 re: /^return(?=[ "'(;])/i
2487 },
2488 {
2489 value: PHP.Constants.T_FUNCTION,
2490 re: /^function(?=[ "'(;])/i
2491 },
2492 {
2493 value: PHP.Constants.T_ECHO,
2494 re: /^echo(?=[ "'(;])/i
2495 },
2496 {
2497 value: PHP.Constants.T_LIST,
2498 re: /^list(?=\s*?\()/i
2499 },
2500 {
2501 value: PHP.Constants.T_PRINT,
2502 re: /^print(?=[ "'(;])/i
2503 },
2504 {
2505 value: PHP.Constants.T_INCLUDE,
2506 re: /^include(?=[ "'(;])/i
2507 },
2508 {
2509 value: PHP.Constants.T_INCLUDE_ONCE,
2510 re: /^include_once(?=[ "'(;])/i
2511 },
2512 {
2513 value: PHP.Constants.T_REQUIRE,
2514 re: /^require(?=[ "'(;])/i
2515 },
2516 {
2517 value: PHP.Constants.T_REQUIRE_ONCE,
2518 re: /^require_once(?=[ "'(;])/i
2519 },
2520 {
2521 value: PHP.Constants.T_NEW,
2522 re: /^new(?=[ ])/i
2523 },
2524 {
2525 value: PHP.Constants.T_COMMENT,
2526 re: /^\/\*([\S\s]*?)(?:\*\/|$)/
2527 },
2528 {
2529 value: PHP.Constants.T_COMMENT,
2530 re: /^\/\/.*(\s)?/
2531 },
2532 {
2533 value: PHP.Constants.T_COMMENT,
2534 re: /^\#.*(\s)?/
2535 },
2536 {
2537 value: PHP.Constants.T_ELSEIF,
2538 re: /^elseif(?=[\s(])/i
2539 },
2540 {
2541 value: PHP.Constants.T_GOTO,
2542 re: /^goto(?=[\s(])/i
2543 },
2544 {
2545 value: PHP.Constants.T_ELSE,
2546 re: /^else(?=[\s{:])/i
2547 },
2548 {
2549 value: PHP.Constants.T_IF,
2550 re: /^if(?=[\s(])/i
2551 },
2552 {
2553 value: PHP.Constants.T_DO,
2554 re: /^do(?=[ {])/i
2555 },
2556 {
2557 value: PHP.Constants.T_WHILE,
2558 re: /^while(?=[ (])/i
2559 },
2560 {
2561 value: PHP.Constants.T_FOREACH,
2562 re: /^foreach(?=[ (])/i
2563 },
2564 {
2565 value: PHP.Constants.T_ISSET,
2566 re: /^isset(?=[ (])/i
2567 },
2568 {
2569 value: PHP.Constants.T_IS_IDENTICAL,
2570 re: /^===/
2571 },
2572 {
2573 value: PHP.Constants.T_IS_EQUAL,
2574 re: /^==/
2575 },
2576 {
2577 value: PHP.Constants.T_IS_NOT_IDENTICAL,
2578 re: /^\!==/
2579 },
2580 {
2581 value: PHP.Constants.T_IS_NOT_EQUAL,
2582 re: /^(\!=|\<\>)/
2583 },
2584 {
2585 value: PHP.Constants.T_FOR,
2586 re: /^for(?=[ (])/i
2587 },
2588
2589 {
2590 value: PHP.Constants.T_DNUMBER,
2591 re: /^[0-9]*\.[0-9]+([eE][-]?[0-9]*)?/
2592
2593 },
2594 {
2595 value: PHP.Constants.T_LNUMBER,
2596 re: /^(0x[0-9A-F]+|[0-9]+)/i
2597 },
2598 {
2599 value: PHP.Constants.T_OPEN_TAG_WITH_ECHO,
2600 re: /^(\<\?=|\<\%=)/i
2601 },
2602 {
2603 value: PHP.Constants.T_OPEN_TAG,
2604 re: openTagStart
2605 },
2606 {
2607 value: PHP.Constants.T_VARIABLE,
2608 re: /^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/
2609 },
2610 {
2611 value: PHP.Constants.T_WHITESPACE,
2612 re: /^\s+/
2613 },
2614 {
2615 value: PHP.Constants.T_CONSTANT_ENCAPSED_STRING,
2616 re: /^("(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*')/,
2617 func: function( result, token ) {
2618
2619 var curlyOpen = 0,
2620 len,
2621 bracketOpen = 0;
2622
2623 if (result.substring( 0,1 ) === "'") {
2624 return result;
2625 }
2626
2627 var match = result.match( /(?:[^\\]|\\.)*[^\\]\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/g );
2628 if ( match !== null ) {
2629
2630 while( result.length > 0 ) {
2631 len = result.length;
2632 match = result.match( /^[\[\]\;\:\?\(\)\!\.\,\>\<\=\+\-\/\*\|\&\@\^\%\"\'\{\}]/ );
2633
2634 if ( match !== null ) {
2635
2636 results.push( match[ 0 ] );
2637 result = result.substring( 1 );
2638
2639 if ( curlyOpen > 0 && match[ 0 ] === "}") {
2640 curlyOpen--;
2641 }
2642
2643 if ( match[ 0 ] === "[" ) {
2644 bracketOpen++;
2645 }
2646
2647 if ( match[ 0 ] === "]" ) {
2648 bracketOpen--;
2649 }
2650
2651 }
2652
2653 match = result.match(/^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/);
2654
2655
2656
2657 if ( match !== null ) {
2658
2659 results.push([
2660 parseInt(PHP.Constants.T_VARIABLE, 10),
2661 match[ 0 ],
2662 line
2663 ]);
2664
2665 result = result.substring( match[ 0 ].length );
2666
2667 match = result.match(/^(\-\>)([a-zA-Z0-9_\x7f-\xff]*)/);
2668
2669 if ( match !== null ) {
2670
2671 results.push([
2672 parseInt(PHP.Constants.T_OBJECT_OPERATOR, 10),
2673 match[ 1 ],
2674 line
2675 ]);
2676 results.push([
2677 parseInt(PHP.Constants.T_STRING, 10),
2678 match[ 2 ],
2679 line
2680 ]);
2681 result = result.substring( match[ 0 ].length );
2682 }
2683
2684
2685 if ( result.match( /^\[/g ) !== null ) {
2686 continue;
2687 }
2688 }
2689
2690 var re;
2691 if ( curlyOpen > 0) {
2692 re = /^([^\\\$"{}\]]|\\.)+/g;
2693 } else {
2694 re = /^([^\\\$"{]|\\.|{[^\$])+/g;
2695 }
2696
2697 while(( match = result.match( re )) !== null ) {
2698
2699
2700 if (result.length === 1) {
2701 throw new Error(match);
2702 }
2703
2704
2705
2706 results.push([
2707 parseInt(( curlyOpen > 0 ) ? PHP.Constants.T_CONSTANT_ENCAPSED_STRING : PHP.Constants.T_ENCAPSED_AND_WHITESPACE, 10),
2708 match[ 0 ],
2709 line
2710 ]);
2711
2712 line += match[ 0 ].split('\n').length - 1;
2713
2714 result = result.substring( match[ 0 ].length );
2715
2716 }
2717
2718 if( result.match(/^{\$/) !== null ) {
2719
2720 results.push([
2721 parseInt(PHP.Constants.T_CURLY_OPEN, 10),
2722 "{",
2723 line
2724 ]);
2725 result = result.substring( 1 );
2726 curlyOpen++;
2727 }
2728
2729 if (len === result.length) {
2730 if ((match = result.match( /^(([^\\]|\\.)*?[^\\]\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/g )) !== null) {
2731 return;
2732 }
2733 }
2734
2735 }
2736
2737 return undefined;
2738
2739 }
2740 return result;
2741 }
2742 },
2743 {
2744 value: PHP.Constants.T_STRING,
2745 re: /^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/
2746 },
2747 {
2748 value: -1,
2749 re: /^[\[\]\;\:\?\(\)\!\.\,\>\<\=\+\-\/\*\|\&\{\}\@\^\%\"\'\$\~]/
2750 }];
2751
2752
2753
2754
2755
2756 var results = [],
2757 line = 1,
2758 insidePHP = false,
2759 cancel = true;
2760
2761 if ( src === null ) {
2762 return results;
2763 }
2764
2765 if ( typeof src !== "string" ) {
2766 src = src.toString();
2767 }
2768
2769
2770
2771 while (src.length > 0 && cancel === true) {
2772
2773 if ( insidePHP === true ) {
2774
2775 if ( heredoc !== undefined ) {
2776
2777 var regexp = new RegExp('([\\S\\s]*)(\\r\\n|\\n|\\r)(' + heredoc + ')(;|\\r\\n|\\n)',"i");
2778
2779
2780
2781 var result = src.match( regexp );
2782 if ( result !== null ) {
2783
2784 results.push([
2785 parseInt(PHP.Constants.T_ENCAPSED_AND_WHITESPACE, 10),
2786 result[ 1 ].replace(/^\n/g,"").replace(/\\\$/g,"$") + "\n",
2787 line
2788 ]);
2789 line += result[ 1 ].split('\n').length;
2790 results.push([
2791 parseInt(PHP.Constants.T_END_HEREDOC, 10),
2792 result[ 3 ],
2793 line
2794 ]);
2795
2796 src = src.substring( result[1].length + result[2].length + result[3].length );
2797 heredoc = undefined;
2798 }
2799
2800 if (result === null) {
2801 throw Error("sup");
2802 }
2803
2804
2805 } else {
2806 cancel = tokens.some(function( token ){
2807 if ( token.afterWhitespace === true ) {
2808 var last = results[ results.length - 1 ];
2809 if ( !Array.isArray( last ) || (last[ 0 ] !== PHP.Constants.T_WHITESPACE && last[ 0 ] !== PHP.Constants.T_OPEN_TAG && last[ 0 ] !== PHP.Constants.T_COMMENT)) {
2810 return false;
2811 }
2812 }
2813 var result = src.match( token.re );
2814
2815 if ( result !== null ) {
2816 if ( token.value !== -1) {
2817 var resultString = result[ 0 ];
2818
2819
2820
2821 if (token.func !== undefined ) {
2822 resultString = token.func( resultString, token );
2823 }
2824 if (resultString !== undefined ) {
2825
2826 results.push([
2827 parseInt(token.value, 10),
2828 resultString,
2829 line
2830 ]);
2831 line += resultString.split('\n').length - 1;
2832 }
2833
2834 } else {
2835 results.push( result[ 0 ] );
2836 }
2837
2838 src = src.substring(result[ 0 ].length);
2839
2840 return true;
2841 }
2842 return false;
2843
2844
2845 });
2846 }
2847
2848 } else {
2849
2850 var result = openTag.exec( src );
2851
2852
2853 if ( result !== null ) {
2854 if ( result.index > 0 ) {
2855 var resultString = src.substring(0, result.index);
2856 results.push ([
2857 parseInt(PHP.Constants.T_INLINE_HTML, 10),
2858 resultString,
2859 line
2860 ]);
2861
2862 line += resultString.split('\n').length - 1;
2863
2864 src = src.substring( result.index );
2865 }
2866
2867 insidePHP = true;
2868 } else {
2869
2870 results.push ([
2871 parseInt(PHP.Constants.T_INLINE_HTML, 10),
2872 src.replace(/^\n/, ""),
2873 line
2874 ]);
2875 return results;
2876 }
2877
2878 }
2879
2880
2881
2882 }
2883
2884
2885
2886 return results;
2887
2888
2889
2890 };
2891
2892
2893 PHP.Parser = function ( preprocessedTokens, eval ) {
2894
2895 var yybase = this.yybase,
2896 yydefault = this.yydefault,
2897 yycheck = this.yycheck,
2898 yyaction = this.yyaction,
2899 yylen = this.yylen,
2900 yygbase = this.yygbase,
2901 yygcheck = this.yygcheck,
2902 yyp = this.yyp,
2903 yygoto = this.yygoto,
2904 yylhs = this.yylhs,
2905 terminals = this.terminals,
2906 translate = this.translate,
2907 yygdefault = this.yygdefault;
2908
2909
2910 this.pos = -1;
2911 this.line = 1;
2912
2913 this.tokenMap = this.createTokenMap( );
2914
2915 this.dropTokens = {};
2916 this.dropTokens[ PHP.Constants.T_WHITESPACE ] = 1;
2917 this.dropTokens[ PHP.Constants.T_OPEN_TAG ] = 1;
2918 var tokens = [];
2919 preprocessedTokens.forEach( function( token, index ) {
2920 if ( typeof token === "object" && token[ 0 ] === PHP.Constants.T_OPEN_TAG_WITH_ECHO) {
2921 tokens.push([
2922 PHP.Constants.T_OPEN_TAG,
2923 token[ 1 ],
2924 token[ 2 ]
2925 ]);
2926 tokens.push([
2927 PHP.Constants.T_ECHO,
2928 token[ 1 ],
2929 token[ 2 ]
2930 ]);
2931 } else {
2932 tokens.push( token );
2933 }
2934 });
2935 this.tokens = tokens;
2936 var tokenId = this.TOKEN_NONE;
2937 this.startAttributes = {
2938 'startLine': 1
2939 };
2940
2941 this.endAttributes = {};
2942 var attributeStack = [ this.startAttributes ];
2943 var state = 0;
2944 var stateStack = [ state ];
2945 this.yyastk = [];
2946 this.stackPos = 0;
2947
2948 var yyn;
2949
2950 var origTokenId;
2951
2952
2953 for (;;) {
2954
2955 if ( yybase[ state ] === 0 ) {
2956 yyn = yydefault[ state ];
2957 } else {
2958 if (tokenId === this.TOKEN_NONE ) {
2959 origTokenId = this.getNextToken( );
2960 tokenId = (origTokenId >= 0 && origTokenId < this.TOKEN_MAP_SIZE) ? translate[ origTokenId ] : this.TOKEN_INVALID;
2961
2962 attributeStack[ this.stackPos ] = this.startAttributes;
2963 }
2964
2965 if (((yyn = yybase[ state ] + tokenId) >= 0
2966 && yyn < this.YYLAST && yycheck[ yyn ] === tokenId
2967 || (state < this.YY2TBLSTATE
2968 && (yyn = yybase[state + this.YYNLSTATES] + tokenId) >= 0
2969 && yyn < this.YYLAST
2970 && yycheck[ yyn ] === tokenId))
2971 && (yyn = yyaction[ yyn ]) !== this.YYDEFAULT ) {
2972 if (yyn > 0) {
2973 ++this.stackPos;
2974
2975 stateStack[ this.stackPos ] = state = yyn;
2976 this.yyastk[ this.stackPos ] = this.tokenValue;
2977 attributeStack[ this.stackPos ] = this.startAttributes;
2978 tokenId = this.TOKEN_NONE;
2979
2980 if (yyn < this.YYNLSTATES)
2981 continue;
2982 yyn -= this.YYNLSTATES;
2983 } else {
2984 yyn = -yyn;
2985 }
2986 } else {
2987 yyn = yydefault[ state ];
2988 }
2989 }
2990
2991 for (;;) {
2992
2993 if ( yyn === 0 ) {
2994 return this.yyval;
2995 } else if (yyn !== this.YYUNEXPECTED ) {
2996 for (var attr in this.endAttributes) {
2997 attributeStack[ this.stackPos - yylen[ yyn ] ][ attr ] = this.endAttributes[ attr ];
2998 }
2999 try {
3000 this['yyn' + yyn](attributeStack[ this.stackPos - yylen[ yyn ] ]);
3001 } catch (e) {
3002 throw e;
3003 }
3004 this.stackPos -= yylen[ yyn ];
3005 yyn = yylhs[ yyn ];
3006 if ((yyp = yygbase[ yyn ] + stateStack[ this.stackPos ]) >= 0
3007 && yyp < this.YYGLAST
3008 && yygcheck[ yyp ] === yyn) {
3009 state = yygoto[ yyp ];
3010 } else {
3011 state = yygdefault[ yyn ];
3012 }
3013
3014 ++this.stackPos;
3015
3016 stateStack[ this.stackPos ] = state;
3017 this.yyastk[ this.stackPos ] = this.yyval;
3018 attributeStack[ this.stackPos ] = this.startAttributes;
3019 } else {
3020 if (eval !== true) {
3021
3022 var expected = [];
3023
3024 for (var i = 0; i < this.TOKEN_MAP_SIZE; ++i) {
3025 if ((yyn = yybase[ state ] + i) >= 0 && yyn < this.YYLAST && yycheck[ yyn ] == i
3026 || state < this.YY2TBLSTATE
3027 && (yyn = yybase[ state + this.YYNLSTATES] + i)
3028 && yyn < this.YYLAST && yycheck[ yyn ] == i
3029 ) {
3030 if (yyaction[ yyn ] != this.YYUNEXPECTED) {
3031 if (expected.length == 4) {
3032 expected = [];
3033 break;
3034 }
3035
3036 expected.push( this.terminals[ i ] );
3037 }
3038 }
3039 }
3040
3041 var expectedString = '';
3042 if (expected.length) {
3043 expectedString = ', expecting ' + expected.join(' or ');
3044 }
3045 throw new PHP.ParseError('syntax error, unexpected ' + terminals[ tokenId ] + expectedString, this.startAttributes['startLine']);
3046 } else {
3047 return this.startAttributes['startLine'];
3048 }
3049
3050 }
3051
3052 if (state < this.YYNLSTATES)
3053 break;
3054 yyn = state - this.YYNLSTATES;
3055 }
3056 }
3057 };
3058
3059 PHP.ParseError = function( msg, line ) {
3060 this.message = msg;
3061 this.line = line;
3062 };
3063
3064 PHP.Parser.prototype.MODIFIER_PUBLIC = 1;
3065 PHP.Parser.prototype.MODIFIER_PROTECTED = 2;
3066 PHP.Parser.prototype.MODIFIER_PRIVATE = 4;
3067 PHP.Parser.prototype.MODIFIER_STATIC = 8;
3068 PHP.Parser.prototype.MODIFIER_ABSTRACT = 16;
3069 PHP.Parser.prototype.MODIFIER_FINAL = 32;
3070
3071 PHP.Parser.prototype.getNextToken = function( ) {
3072
3073 this.startAttributes = {};
3074 this.endAttributes = {};
3075
3076 var token,
3077 tmp;
3078
3079 while (this.tokens[++this.pos] !== undefined) {
3080 token = this.tokens[this.pos];
3081
3082 if (typeof token === "string") {
3083 this.startAttributes['startLine'] = this.line;
3084 this.endAttributes['endLine'] = this.line;
3085
3086 this.tokenValue = token;
3087 return token.charCodeAt(0);
3088 } else {
3089
3090
3091
3092 this.line += ((tmp = token[ 1 ].match(/\n/g)) === null) ? 0 : tmp.length;
3093
3094 if (PHP.Constants.T_COMMENT === token[0]) {
3095
3096 if (!Array.isArray(this.startAttributes['comments'])) {
3097 this.startAttributes['comments'] = [];
3098 }
3099
3100 this.startAttributes['comments'].push( {
3101 type: "comment",
3102 comment: token[1],
3103 line: token[2]
3104 });
3105
3106 } else if (PHP.Constants.T_DOC_COMMENT === token[0]) {
3107 this.startAttributes['comments'].push( new PHPParser_Comment_Doc(token[1], token[2]) );
3108 } else if (this.dropTokens[token[0]] === undefined) {
3109 this.tokenValue = token[1];
3110 this.startAttributes['startLine'] = token[2];
3111 this.endAttributes['endLine'] = this.line;
3112
3113 return this.tokenMap[token[0]];
3114 }
3115 }
3116 }
3117
3118 this.startAttributes['startLine'] = this.line;
3119 return 0;
3120 };
3121
3122 PHP.Parser.prototype.tokenName = function( token ) {
3123 var constants = ["T_INCLUDE","T_INCLUDE_ONCE","T_EVAL","T_REQUIRE","T_REQUIRE_ONCE","T_LOGICAL_OR","T_LOGICAL_XOR","T_LOGICAL_AND","T_PRINT","T_PLUS_EQUAL","T_MINUS_EQUAL","T_MUL_EQUAL","T_DIV_EQUAL","T_CONCAT_EQUAL","T_MOD_EQUAL","T_AND_EQUAL","T_OR_EQUAL","T_XOR_EQUAL","T_SL_EQUAL","T_SR_EQUAL","T_BOOLEAN_OR","T_BOOLEAN_AND","T_IS_EQUAL","T_IS_NOT_EQUAL","T_IS_IDENTICAL","T_IS_NOT_IDENTICAL","T_IS_SMALLER_OR_EQUAL","T_IS_GREATER_OR_EQUAL","T_SL","T_SR","T_INSTANCEOF","T_INC","T_DEC","T_INT_CAST","T_DOUBLE_CAST","T_STRING_CAST","T_ARRAY_CAST","T_OBJECT_CAST","T_BOOL_CAST","T_UNSET_CAST","T_NEW","T_CLONE","T_EXIT","T_IF","T_ELSEIF","T_ELSE","T_ENDIF","T_LNUMBER","T_DNUMBER","T_STRING","T_STRING_VARNAME","T_VARIABLE","T_NUM_STRING","T_INLINE_HTML","T_CHARACTER","T_BAD_CHARACTER","T_ENCAPSED_AND_WHITESPACE","T_CONSTANT_ENCAPSED_STRING","T_ECHO","T_DO","T_WHILE","T_ENDWHILE","T_FOR","T_ENDFOR","T_FOREACH","T_ENDFOREACH","T_DECLARE","T_ENDDECLARE","T_AS","T_SWITCH","T_ENDSWITCH","T_CASE","T_DEFAULT","T_BREAK","T_CONTINUE","T_GOTO","T_FUNCTION","T_CONST","T_RETURN","T_TRY","T_CATCH","T_THROW","T_USE","T_INSTEADOF","T_GLOBAL","T_STATIC","T_ABSTRACT","T_FINAL","T_PRIVATE","T_PROTECTED","T_PUBLIC","T_VAR","T_UNSET","T_ISSET","T_EMPTY","T_HALT_COMPILER","T_CLASS","T_TRAIT","T_INTERFACE","T_EXTENDS","T_IMPLEMENTS","T_OBJECT_OPERATOR","T_DOUBLE_ARROW","T_LIST","T_ARRAY","T_CALLABLE","T_CLASS_C","T_TRAIT_C","T_METHOD_C","T_FUNC_C","T_LINE","T_FILE","T_COMMENT","T_DOC_COMMENT","T_OPEN_TAG","T_OPEN_TAG_WITH_ECHO","T_CLOSE_TAG","T_WHITESPACE","T_START_HEREDOC","T_END_HEREDOC","T_DOLLAR_OPEN_CURLY_BRACES","T_CURLY_OPEN","T_PAAMAYIM_NEKUDOTAYIM","T_DOUBLE_COLON","T_NAMESPACE","T_NS_C","T_DIR","T_NS_SEPARATOR"];
3124 var current = "UNKNOWN";
3125 constants.some(function( constant ) {
3126 if (PHP.Constants[ constant ] === token) {
3127 current = constant;
3128 return true;
3129 } else {
3130 return false;
3131 }
3132 });
3133
3134 return current;
3135 };
3136
3137 PHP.Parser.prototype.createTokenMap = function() {
3138 var tokenMap = {},
3139 name,
3140 i;
3141 var T_DOUBLE_COLON = PHP.Constants.T_PAAMAYIM_NEKUDOTAYIM;
3142 for ( i = 256; i < 1000; ++i ) {
3143 if ( T_DOUBLE_COLON === i ) {
3144 tokenMap[ i ] = this.T_PAAMAYIM_NEKUDOTAYIM;
3145 } else if( PHP.Constants.T_OPEN_TAG_WITH_ECHO === i ) {
3146 tokenMap[ i ] = PHP.Constants.T_ECHO;
3147 } else if( PHP.Constants.T_CLOSE_TAG === i ) {
3148 tokenMap[ i ] = 59;
3149 } else if ( 'UNKNOWN' !== (name = this.tokenName( i ) ) ) {
3150
3151 tokenMap[ i ] = this[name];
3152 }
3153 }
3154 return tokenMap;
3155 };
3156
3157 PHP.Parser.prototype.TOKEN_NONE = -1;
3158 PHP.Parser.prototype.TOKEN_INVALID = 149;
3159
3160 PHP.Parser.prototype.TOKEN_MAP_SIZE = 384;
3161
3162 PHP.Parser.prototype.YYLAST = 913;
3163 PHP.Parser.prototype.YY2TBLSTATE = 328;
3164 PHP.Parser.prototype.YYGLAST = 415;
3165 PHP.Parser.prototype.YYNLSTATES = 544;
3166 PHP.Parser.prototype.YYUNEXPECTED = 32767;
3167 PHP.Parser.prototype.YYDEFAULT = -32766;
3168 PHP.Parser.prototype.YYERRTOK = 256;
3169 PHP.Parser.prototype.T_INCLUDE = 257;
3170 PHP.Parser.prototype.T_INCLUDE_ONCE = 258;
3171 PHP.Parser.prototype.T_EVAL = 259;
3172 PHP.Parser.prototype.T_REQUIRE = 260;
3173 PHP.Parser.prototype.T_REQUIRE_ONCE = 261;
3174 PHP.Parser.prototype.T_LOGICAL_OR = 262;
3175 PHP.Parser.prototype.T_LOGICAL_XOR = 263;
3176 PHP.Parser.prototype.T_LOGICAL_AND = 264;
3177 PHP.Parser.prototype.T_PRINT = 265;
3178 PHP.Parser.prototype.T_PLUS_EQUAL = 266;
3179 PHP.Parser.prototype.T_MINUS_EQUAL = 267;
3180 PHP.Parser.prototype.T_MUL_EQUAL = 268;
3181 PHP.Parser.prototype.T_DIV_EQUAL = 269;
3182 PHP.Parser.prototype.T_CONCAT_EQUAL = 270;
3183 PHP.Parser.prototype.T_MOD_EQUAL = 271;
3184 PHP.Parser.prototype.T_AND_EQUAL = 272;
3185 PHP.Parser.prototype.T_OR_EQUAL = 273;
3186 PHP.Parser.prototype.T_XOR_EQUAL = 274;
3187 PHP.Parser.prototype.T_SL_EQUAL = 275;
3188 PHP.Parser.prototype.T_SR_EQUAL = 276;
3189 PHP.Parser.prototype.T_BOOLEAN_OR = 277;
3190 PHP.Parser.prototype.T_BOOLEAN_AND = 278;
3191 PHP.Parser.prototype.T_IS_EQUAL = 279;
3192 PHP.Parser.prototype.T_IS_NOT_EQUAL = 280;
3193 PHP.Parser.prototype.T_IS_IDENTICAL = 281;
3194 PHP.Parser.prototype.T_IS_NOT_IDENTICAL = 282;
3195 PHP.Parser.prototype.T_IS_SMALLER_OR_EQUAL = 283;
3196 PHP.Parser.prototype.T_IS_GREATER_OR_EQUAL = 284;
3197 PHP.Parser.prototype.T_SL = 285;
3198 PHP.Parser.prototype.T_SR = 286;
3199 PHP.Parser.prototype.T_INSTANCEOF = 287;
3200 PHP.Parser.prototype.T_INC = 288;
3201 PHP.Parser.prototype.T_DEC = 289;
3202 PHP.Parser.prototype.T_INT_CAST = 290;
3203 PHP.Parser.prototype.T_DOUBLE_CAST = 291;
3204 PHP.Parser.prototype.T_STRING_CAST = 292;
3205 PHP.Parser.prototype.T_ARRAY_CAST = 293;
3206 PHP.Parser.prototype.T_OBJECT_CAST = 294;
3207 PHP.Parser.prototype.T_BOOL_CAST = 295;
3208 PHP.Parser.prototype.T_UNSET_CAST = 296;
3209 PHP.Parser.prototype.T_NEW = 297;
3210 PHP.Parser.prototype.T_CLONE = 298;
3211 PHP.Parser.prototype.T_EXIT = 299;
3212 PHP.Parser.prototype.T_IF = 300;
3213 PHP.Parser.prototype.T_ELSEIF = 301;
3214 PHP.Parser.prototype.T_ELSE = 302;
3215 PHP.Parser.prototype.T_ENDIF = 303;
3216 PHP.Parser.prototype.T_LNUMBER = 304;
3217 PHP.Parser.prototype.T_DNUMBER = 305;
3218 PHP.Parser.prototype.T_STRING = 306;
3219 PHP.Parser.prototype.T_STRING_VARNAME = 307;
3220 PHP.Parser.prototype.T_VARIABLE = 308;
3221 PHP.Parser.prototype.T_NUM_STRING = 309;
3222 PHP.Parser.prototype.T_INLINE_HTML = 310;
3223 PHP.Parser.prototype.T_CHARACTER = 311;
3224 PHP.Parser.prototype.T_BAD_CHARACTER = 312;
3225 PHP.Parser.prototype.T_ENCAPSED_AND_WHITESPACE = 313;
3226 PHP.Parser.prototype.T_CONSTANT_ENCAPSED_STRING = 314;
3227 PHP.Parser.prototype.T_ECHO = 315;
3228 PHP.Parser.prototype.T_DO = 316;
3229 PHP.Parser.prototype.T_WHILE = 317;
3230 PHP.Parser.prototype.T_ENDWHILE = 318;
3231 PHP.Parser.prototype.T_FOR = 319;
3232 PHP.Parser.prototype.T_ENDFOR = 320;
3233 PHP.Parser.prototype.T_FOREACH = 321;
3234 PHP.Parser.prototype.T_ENDFOREACH = 322;
3235 PHP.Parser.prototype.T_DECLARE = 323;
3236 PHP.Parser.prototype.T_ENDDECLARE = 324;
3237 PHP.Parser.prototype.T_AS = 325;
3238 PHP.Parser.prototype.T_SWITCH = 326;
3239 PHP.Parser.prototype.T_ENDSWITCH = 327;
3240 PHP.Parser.prototype.T_CASE = 328;
3241 PHP.Parser.prototype.T_DEFAULT = 329;
3242 PHP.Parser.prototype.T_BREAK = 330;
3243 PHP.Parser.prototype.T_CONTINUE = 331;
3244 PHP.Parser.prototype.T_GOTO = 332;
3245 PHP.Parser.prototype.T_FUNCTION = 333;
3246 PHP.Parser.prototype.T_CONST = 334;
3247 PHP.Parser.prototype.T_RETURN = 335;
3248 PHP.Parser.prototype.T_TRY = 336;
3249 PHP.Parser.prototype.T_CATCH = 337;
3250 PHP.Parser.prototype.T_THROW = 338;
3251 PHP.Parser.prototype.T_USE = 339;
3252 PHP.Parser.prototype.T_INSTEADOF = 340;
3253 PHP.Parser.prototype.T_GLOBAL = 341;
3254 PHP.Parser.prototype.T_STATIC = 342;
3255 PHP.Parser.prototype.T_ABSTRACT = 343;
3256 PHP.Parser.prototype.T_FINAL = 344;
3257 PHP.Parser.prototype.T_PRIVATE = 345;
3258 PHP.Parser.prototype.T_PROTECTED = 346;
3259 PHP.Parser.prototype.T_PUBLIC = 347;
3260 PHP.Parser.prototype.T_VAR = 348;
3261 PHP.Parser.prototype.T_UNSET = 349;
3262 PHP.Parser.prototype.T_ISSET = 350;
3263 PHP.Parser.prototype.T_EMPTY = 351;
3264 PHP.Parser.prototype.T_HALT_COMPILER = 352;
3265 PHP.Parser.prototype.T_CLASS = 353;
3266 PHP.Parser.prototype.T_TRAIT = 354;
3267 PHP.Parser.prototype.T_INTERFACE = 355;
3268 PHP.Parser.prototype.T_EXTENDS = 356;
3269 PHP.Parser.prototype.T_IMPLEMENTS = 357;
3270 PHP.Parser.prototype.T_OBJECT_OPERATOR = 358;
3271 PHP.Parser.prototype.T_DOUBLE_ARROW = 359;
3272 PHP.Parser.prototype.T_LIST = 360;
3273 PHP.Parser.prototype.T_ARRAY = 361;
3274 PHP.Parser.prototype.T_CALLABLE = 362;
3275 PHP.Parser.prototype.T_CLASS_C = 363;
3276 PHP.Parser.prototype.T_TRAIT_C = 364;
3277 PHP.Parser.prototype.T_METHOD_C = 365;
3278 PHP.Parser.prototype.T_FUNC_C = 366;
3279 PHP.Parser.prototype.T_LINE = 367;
3280 PHP.Parser.prototype.T_FILE = 368;
3281 PHP.Parser.prototype.T_COMMENT = 369;
3282 PHP.Parser.prototype.T_DOC_COMMENT = 370;
3283 PHP.Parser.prototype.T_OPEN_TAG = 371;
3284 PHP.Parser.prototype.T_OPEN_TAG_WITH_ECHO = 372;
3285 PHP.Parser.prototype.T_CLOSE_TAG = 373;
3286 PHP.Parser.prototype.T_WHITESPACE = 374;
3287 PHP.Parser.prototype.T_START_HEREDOC = 375;
3288 PHP.Parser.prototype.T_END_HEREDOC = 376;
3289 PHP.Parser.prototype.T_DOLLAR_OPEN_CURLY_BRACES = 377;
3290 PHP.Parser.prototype.T_CURLY_OPEN = 378;
3291 PHP.Parser.prototype.T_PAAMAYIM_NEKUDOTAYIM = 379;
3292 PHP.Parser.prototype.T_NAMESPACE = 380;
3293 PHP.Parser.prototype.T_NS_C = 381;
3294 PHP.Parser.prototype.T_DIR = 382;
3295 PHP.Parser.prototype.T_NS_SEPARATOR = 383;
3296 PHP.Parser.prototype.terminals = [
3297 "$EOF",
3298 "error",
3299 "T_INCLUDE",
3300 "T_INCLUDE_ONCE",
3301 "T_EVAL",
3302 "T_REQUIRE",
3303 "T_REQUIRE_ONCE",
3304 "','",
3305 "T_LOGICAL_OR",
3306 "T_LOGICAL_XOR",
3307 "T_LOGICAL_AND",
3308 "T_PRINT",
3309 "'='",
3310 "T_PLUS_EQUAL",
3311 "T_MINUS_EQUAL",
3312 "T_MUL_EQUAL",
3313 "T_DIV_EQUAL",
3314 "T_CONCAT_EQUAL",
3315 "T_MOD_EQUAL",
3316 "T_AND_EQUAL",
3317 "T_OR_EQUAL",
3318 "T_XOR_EQUAL",
3319 "T_SL_EQUAL",
3320 "T_SR_EQUAL",
3321 "'?'",
3322 "':'",
3323 "T_BOOLEAN_OR",
3324 "T_BOOLEAN_AND",
3325 "'|'",
3326 "'^'",
3327 "'&'",
3328 "T_IS_EQUAL",
3329 "T_IS_NOT_EQUAL",
3330 "T_IS_IDENTICAL",
3331 "T_IS_NOT_IDENTICAL",
3332 "'<'",
3333 "T_IS_SMALLER_OR_EQUAL",
3334 "'>'",
3335 "T_IS_GREATER_OR_EQUAL",
3336 "T_SL",
3337 "T_SR",
3338 "'+'",
3339 "'-'",
3340 "'.'",
3341 "'*'",
3342 "'/'",
3343 "'%'",
3344 "'!'",
3345 "T_INSTANCEOF",
3346 "'~'",
3347 "T_INC",
3348 "T_DEC",
3349 "T_INT_CAST",
3350 "T_DOUBLE_CAST",
3351 "T_STRING_CAST",
3352 "T_ARRAY_CAST",
3353 "T_OBJECT_CAST",
3354 "T_BOOL_CAST",
3355 "T_UNSET_CAST",
3356 "'@'",
3357 "'['",
3358 "T_NEW",
3359 "T_CLONE",
3360 "T_EXIT",
3361 "T_IF",
3362 "T_ELSEIF",
3363 "T_ELSE",
3364 "T_ENDIF",
3365 "T_LNUMBER",
3366 "T_DNUMBER",
3367 "T_STRING",
3368 "T_STRING_VARNAME",
3369 "T_VARIABLE",
3370 "T_NUM_STRING",
3371 "T_INLINE_HTML",
3372 "T_ENCAPSED_AND_WHITESPACE",
3373 "T_CONSTANT_ENCAPSED_STRING",
3374 "T_ECHO",
3375 "T_DO",
3376 "T_WHILE",
3377 "T_ENDWHILE",
3378 "T_FOR",
3379 "T_ENDFOR",
3380 "T_FOREACH",
3381 "T_ENDFOREACH",
3382 "T_DECLARE",
3383 "T_ENDDECLARE",
3384 "T_AS",
3385 "T_SWITCH",
3386 "T_ENDSWITCH",
3387 "T_CASE",
3388 "T_DEFAULT",
3389 "T_BREAK",
3390 "T_CONTINUE",
3391 "T_GOTO",
3392 "T_FUNCTION",
3393 "T_CONST",
3394 "T_RETURN",
3395 "T_TRY",
3396 "T_CATCH",
3397 "T_THROW",
3398 "T_USE",
3399 "T_INSTEADOF",
3400 "T_GLOBAL",
3401 "T_STATIC",
3402 "T_ABSTRACT",
3403 "T_FINAL",
3404 "T_PRIVATE",
3405 "T_PROTECTED",
3406 "T_PUBLIC",
3407 "T_VAR",
3408 "T_UNSET",
3409 "T_ISSET",
3410 "T_EMPTY",
3411 "T_HALT_COMPILER",
3412 "T_CLASS",
3413 "T_TRAIT",
3414 "T_INTERFACE",
3415 "T_EXTENDS",
3416 "T_IMPLEMENTS",
3417 "T_OBJECT_OPERATOR",
3418 "T_DOUBLE_ARROW",
3419 "T_LIST",
3420 "T_ARRAY",
3421 "T_CALLABLE",
3422 "T_CLASS_C",
3423 "T_TRAIT_C",
3424 "T_METHOD_C",
3425 "T_FUNC_C",
3426 "T_LINE",
3427 "T_FILE",
3428 "T_START_HEREDOC",
3429 "T_END_HEREDOC",
3430 "T_DOLLAR_OPEN_CURLY_BRACES",
3431 "T_CURLY_OPEN",
3432 "T_PAAMAYIM_NEKUDOTAYIM",
3433 "T_NAMESPACE",
3434 "T_NS_C",
3435 "T_DIR",
3436 "T_NS_SEPARATOR",
3437 "';'",
3438 "'{'",
3439 "'}'",
3440 "'('",
3441 "')'",
3442 "'$'",
3443 "']'",
3444 "'`'",
3445 "'\"'"
3446 , "???"
3447 ];
3448 PHP.Parser.prototype.translate = [
3449 0, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3450 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3451 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3452 149, 149, 149, 47, 148, 149, 145, 46, 30, 149,
3453 143, 144, 44, 41, 7, 42, 43, 45, 149, 149,
3454 149, 149, 149, 149, 149, 149, 149, 149, 25, 140,
3455 35, 12, 37, 24, 59, 149, 149, 149, 149, 149,
3456 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3457 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3458 149, 60, 149, 146, 29, 149, 147, 149, 149, 149,
3459 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3460 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3461 149, 149, 149, 141, 28, 142, 49, 149, 149, 149,
3462 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3463 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3464 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3465 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3466 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3467 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3468 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3469 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3470 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3471 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3472 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3473 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
3474 149, 149, 149, 149, 149, 149, 1, 2, 3, 4,
3475 5, 6, 8, 9, 10, 11, 13, 14, 15, 16,
3476 17, 18, 19, 20, 21, 22, 23, 26, 27, 31,
3477 32, 33, 34, 36, 38, 39, 40, 48, 50, 51,
3478 52, 53, 54, 55, 56, 57, 58, 61, 62, 63,
3479 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
3480 74, 149, 149, 75, 76, 77, 78, 79, 80, 81,
3481 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
3482 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
3483 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
3484 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
3485 122, 123, 124, 125, 126, 127, 128, 129, 130, 149,
3486 149, 149, 149, 149, 149, 131, 132, 133, 134, 135,
3487 136, 137, 138, 139
3488 ];
3489
3490 PHP.Parser.prototype.yyaction = [
3491 61, 62, 363, 63, 64,-32766,-32766,-32766, 509, 65,
3492 708, 709, 710, 707, 706, 705,-32766,-32766,-32766,-32766,
3493 -32766,-32766, 132,-32766,-32766,-32766,-32766,-32766,-32767,-32767,
3494 -32767,-32767,-32766, 335,-32766,-32766,-32766,-32766,-32766, 66,
3495 67, 351, 663, 664, 40, 68, 548, 69, 232, 233,
3496 70, 71, 72, 73, 74, 75, 76, 77, 30, 246,
3497 78, 336, 364, -112, 0, 469, 833, 834, 365, 641,
3498 890, 436, 590, 41, 835, 53, 27, 366, 294, 367,
3499 687, 368, 921, 369, 923, 922, 370,-32766,-32766,-32766,
3500 42, 43, 371, 339, 126, 44, 372, 337, 79, 297,
3501 349, 292, 293,-32766, 918,-32766,-32766, 373, 374, 375,
3502 376, 377, 391, 199, 361, 338, 573, 613, 378, 379,
3503 380, 381, 845, 839, 840, 841, 842, 836, 837, 253,
3504 -32766, 87, 88, 89, 391, 843, 838, 338, 597, 519,
3505 128, 80, 129, 273, 332, 257, 261, 47, 673, 90,
3506 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
3507 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
3508 799, 247, 884, 108, 109, 110, 226, 247, 21,-32766,
3509 310,-32766,-32766,-32766, 642, 548,-32766,-32766,-32766,-32766,
3510 56, 353,-32766,-32766,-32766, 55,-32766,-32766,-32766,-32766,
3511 -32766, 58,-32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766,
3512 -32766, 557,-32766,-32766, 518,-32766, 548, 890,-32766, 390,
3513 -32766, 228, 252,-32766,-32766,-32766,-32766,-32766, 275,-32766,
3514 234,-32766, 587, 588,-32766,-32766,-32766,-32766,-32766,-32766,
3515 -32766, 46, 236,-32766,-32766, 281,-32766, 682, 348,-32766,
3516 390,-32766, 346, 333, 521,-32766,-32766,-32766, 271, 911,
3517 262, 237, 446, 911,-32766, 894, 59, 700, 358, 135,
3518 548, 123, 538, 35,-32766, 333, 122,-32766,-32766,-32766,
3519 271,-32766, 124,-32766, 692,-32766,-32766,-32766,-32766, 700,
3520 273, 22,-32766,-32766,-32766,-32766, 239,-32766,-32766, 612,
3521 -32766, 548, 134,-32766, 390,-32766, 462, 354,-32766,-32766,
3522 -32766,-32766,-32766, 227,-32766, 238,-32766, 845, 542,-32766,
3523 856, 611, 200,-32766,-32766,-32766, 259, 280,-32766,-32766,
3524 201,-32766, 855, 129,-32766, 390, 130, 202, 333, 206,
3525 -32766,-32766,-32766, 271,-32766,-32766,-32766, 125, 601,-32766,
3526 136, 299, 700, 489, 28, 548, 105, 106, 107,-32766,
3527 498, 499,-32766,-32766,-32766, 207,-32766, 133,-32766, 525,
3528 -32766,-32766,-32766,-32766, 663, 664, 527,-32766,-32766,-32766,
3529 -32766, 528,-32766,-32766, 610,-32766, 548, 427,-32766, 390,
3530 -32766, 532, 539,-32766,-32766,-32766,-32766,-32766, 240,-32766,
3531 247,-32766, 697, 543,-32766, 554, 523, 608,-32766,-32766,
3532 -32766, 686, 535,-32766,-32766, 54,-32766, 57, 60,-32766,
3533 390, 246, -155, 278, 345,-32766,-32766,-32766, 506, 347,
3534 -152, 471, 402, 403,-32766, 405, 404, 272, 493, 416,
3535 548, 318, 417, 505,-32766, 517, 548,-32766,-32766,-32766,
3536 549,-32766, 562,-32766, 916,-32766,-32766,-32766,-32766, 564,
3537 826, 848,-32766,-32766,-32766,-32766, 694,-32766,-32766, 485,
3538 -32766, 548, 487,-32766, 390,-32766, 504, 802,-32766,-32766,
3539 -32766,-32766,-32766, 279,-32766, 911,-32766, 502, 492,-32766,
3540 413, 483, 269,-32766,-32766,-32766, 243, 337,-32766,-32766,
3541 418,-32766, 454, 229,-32766, 390, 274, 373, 374, 344,
3542 -32766,-32766,-32766, 360, 614,-32766, 573, 613, 378, 379,
3543 -274, 548, 615, -332, 844,-32766, 258, 51,-32766,-32766,
3544 -32766, 270,-32766, 346,-32766, 52,-32766, 260, 0,-32766,
3545 -333,-32766,-32766,-32766,-32766,-32766,-32766, 205,-32766,-32766,
3546 49,-32766, 548, 424,-32766, 390,-32766, -266, 264,-32766,
3547 -32766,-32766,-32766,-32766, 409,-32766, 343,-32766, 265, 312,
3548 -32766, 470, 513, -275,-32766,-32766,-32766, 920, 337,-32766,
3549 -32766, 530,-32766, 531, 600,-32766, 390, 592, 373, 374,
3550 578, 581,-32766,-32766, 644, 629,-32766, 573, 613, 378,
3551 379, 635, 548, 636, 576, 627,-32766, 625, 693,-32766,
3552 -32766,-32766, 691,-32766, 591,-32766, 582,-32766, 203, 204,
3553 -32766, 584, 583,-32766,-32766,-32766,-32766, 586, 599,-32766,
3554 -32766, 589,-32766, 690, 558,-32766, 390, 197, 683, 919,
3555 86, 520, 522,-32766, 524, 833, 834, 529, 533,-32766,
3556 534, 537, 541, 835, 48, 111, 112, 113, 114, 115,
3557 116, 117, 118, 119, 120, 121, 127, 31, 633, 337,
3558 330, 634, 585,-32766, 32, 291, 337, 330, 478, 373,
3559 374, 917, 291, 891, 889, 875, 373, 374, 553, 613,
3560 378, 379, 737, 739, 887, 553, 613, 378, 379, 824,
3561 451, 675, 839, 840, 841, 842, 836, 837, 320, 895,
3562 277, 885, 23, 33, 843, 838, 556, 277, 337, 330,
3563 -32766, 34,-32766, 555, 291, 36, 37, 38, 373, 374,
3564 39, 45, 50, 81, 82, 83, 84, 553, 613, 378,
3565 379,-32767,-32767,-32767,-32767, 103, 104, 105, 106, 107,
3566 337, 85, 131, 137, 337, 138, 198, 224, 225, 277,
3567 373, 374, -332, 230, 373, 374, 24, 337, 231, 573,
3568 613, 378, 379, 573, 613, 378, 379, 373, 374, 235,
3569 248, 249, 250, 337, 251, 0, 573, 613, 378, 379,
3570 276, 329, 331, 373, 374,-32766, 337, 574, 490, 792,
3571 337, 609, 573, 613, 378, 379, 373, 374, 25, 300,
3572 373, 374, 319, 337, 795, 573, 613, 378, 379, 573,
3573 613, 378, 379, 373, 374, 516, 355, 359, 445, 482,
3574 796, 507, 573, 613, 378, 379, 508, 548, 337, 890,
3575 775, 791, 337, 604, 803, 808, 806, 698, 373, 374,
3576 888, 807, 373, 374,-32766,-32766,-32766, 573, 613, 378,
3577 379, 573, 613, 378, 379, 873, 832, 804, 872, 851,
3578 -32766, 809,-32766,-32766,-32766,-32766, 805, 20, 26, 29,
3579 298, 480, 515, 770, 778, 827, 457, 0, 900, 455,
3580 774, 0, 0, 0, 874, 870, 886, 823, 915, 852,
3581 869, 488, 0, 391, 793, 0, 338, 0, 0, 0,
3582 340, 0, 273
3583 ];
3584
3585 PHP.Parser.prototype.yycheck = [
3586 2, 3, 4, 5, 6, 8, 9, 10, 70, 11,
3587 104, 105, 106, 107, 108, 109, 8, 9, 10, 8,
3588 9, 24, 60, 26, 27, 28, 29, 30, 31, 32,
3589 33, 34, 24, 7, 26, 27, 28, 29, 30, 41,
3590 42, 7, 123, 124, 7, 47, 70, 49, 50, 51,
3591 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
3592 62, 63, 64, 144, 0, 75, 68, 69, 70, 25,
3593 72, 70, 74, 7, 76, 77, 78, 79, 7, 81,
3594 142, 83, 70, 85, 72, 73, 88, 8, 9, 10,
3595 92, 93, 94, 95, 7, 97, 98, 95, 100, 7,
3596 7, 103, 104, 24, 142, 26, 27, 105, 106, 111,
3597 112, 113, 136, 7, 7, 139, 114, 115, 116, 117,
3598 122, 123, 132, 125, 126, 127, 128, 129, 130, 131,
3599 8, 8, 9, 10, 136, 137, 138, 139, 140, 141,
3600 25, 143, 141, 145, 142, 147, 148, 24, 72, 26,
3601 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
3602 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
3603 144, 48, 72, 44, 45, 46, 30, 48, 144, 64,
3604 72, 8, 9, 10, 140, 70, 8, 9, 10, 74,
3605 60, 25, 77, 78, 79, 60, 81, 24, 83, 26,
3606 85, 60, 24, 88, 26, 27, 28, 92, 93, 94,
3607 64, 140, 97, 98, 70, 100, 70, 72, 103, 104,
3608 74, 145, 7, 77, 78, 79, 111, 81, 7, 83,
3609 30, 85, 140, 140, 88, 8, 9, 10, 92, 93,
3610 94, 133, 134, 97, 98, 145, 100, 140, 7, 103,
3611 104, 24, 139, 96, 141, 140, 141, 111, 101, 75,
3612 75, 30, 70, 75, 64, 70, 60, 110, 121, 12,
3613 70, 141, 25, 143, 74, 96, 141, 77, 78, 79,
3614 101, 81, 141, 83, 140, 85, 140, 141, 88, 110,
3615 145, 144, 92, 93, 94, 64, 7, 97, 98, 142,
3616 100, 70, 141, 103, 104, 74, 145, 141, 77, 78,
3617 79, 111, 81, 7, 83, 30, 85, 132, 25, 88,
3618 132, 142, 12, 92, 93, 94, 120, 60, 97, 98,
3619 12, 100, 148, 141, 103, 104, 141, 12, 96, 12,
3620 140, 141, 111, 101, 8, 9, 10, 141, 25, 64,
3621 90, 91, 110, 65, 66, 70, 41, 42, 43, 74,
3622 65, 66, 77, 78, 79, 12, 81, 25, 83, 25,
3623 85, 140, 141, 88, 123, 124, 25, 92, 93, 94,
3624 64, 25, 97, 98, 142, 100, 70, 120, 103, 104,
3625 74, 25, 25, 77, 78, 79, 111, 81, 30, 83,
3626 48, 85, 140, 141, 88, 140, 141, 30, 92, 93,
3627 94, 140, 141, 97, 98, 60, 100, 60, 60, 103,
3628 104, 61, 72, 75, 70, 140, 141, 111, 67, 70,
3629 87, 99, 70, 70, 64, 70, 72, 102, 89, 70,
3630 70, 71, 70, 70, 74, 70, 70, 77, 78, 79,
3631 70, 81, 70, 83, 70, 85, 140, 141, 88, 70,
3632 144, 70, 92, 93, 94, 64, 70, 97, 98, 72,
3633 100, 70, 72, 103, 104, 74, 72, 72, 77, 78,
3634 79, 111, 81, 75, 83, 75, 85, 89, 86, 88,
3635 79, 101, 118, 92, 93, 94, 87, 95, 97, 98,
3636 87, 100, 87, 87, 103, 104, 118, 105, 106, 95,
3637 140, 141, 111, 95, 115, 64, 114, 115, 116, 117,
3638 135, 70, 115, 120, 132, 74, 120, 140, 77, 78,
3639 79, 119, 81, 139, 83, 140, 85, 120, -1, 88,
3640 120, 140, 141, 92, 93, 94, 64, 121, 97, 98,
3641 121, 100, 70, 122, 103, 104, 74, 135, 135, 77,
3642 78, 79, 111, 81, 139, 83, 139, 85, 135, 135,
3643 88, 135, 135, 135, 92, 93, 94, 142, 95, 97,
3644 98, 140, 100, 140, 140, 103, 104, 140, 105, 106,
3645 140, 140, 141, 111, 140, 140, 64, 114, 115, 116,
3646 117, 140, 70, 140, 140, 140, 74, 140, 140, 77,
3647 78, 79, 140, 81, 140, 83, 140, 85, 41, 42,
3648 88, 140, 140, 141, 92, 93, 94, 140, 140, 97,
3649 98, 140, 100, 140, 140, 103, 104, 60, 140, 142,
3650 141, 141, 141, 111, 141, 68, 69, 141, 141, 72,
3651 141, 141, 141, 76, 12, 13, 14, 15, 16, 17,
3652 18, 19, 20, 21, 22, 23, 141, 143, 142, 95,
3653 96, 142, 140, 141, 143, 101, 95, 96, 142, 105,
3654 106, 142, 101, 142, 142, 142, 105, 106, 114, 115,
3655 116, 117, 50, 51, 142, 114, 115, 116, 117, 142,
3656 123, 142, 125, 126, 127, 128, 129, 130, 131, 142,
3657 136, 142, 144, 143, 137, 138, 142, 136, 95, 96,
3658 143, 143, 145, 142, 101, 143, 143, 143, 105, 106,
3659 143, 143, 143, 143, 143, 143, 143, 114, 115, 116,
3660 117, 35, 36, 37, 38, 39, 40, 41, 42, 43,
3661 95, 143, 143, 143, 95, 143, 143, 143, 143, 136,
3662 105, 106, 120, 143, 105, 106, 144, 95, 143, 114,
3663 115, 116, 117, 114, 115, 116, 117, 105, 106, 143,
3664 143, 143, 143, 95, 143, -1, 114, 115, 116, 117,
3665 143, 143, 143, 105, 106, 143, 95, 142, 80, 146,
3666 95, 142, 114, 115, 116, 117, 105, 106, 144, 144,
3667 105, 106, 144, 95, 142, 114, 115, 116, 117, 114,
3668 115, 116, 117, 105, 106, 82, 144, 144, 144, 144,
3669 142, 84, 114, 115, 116, 117, 144, 70, 95, 72,
3670 144, 144, 95, 142, 144, 146, 144, 142, 105, 106,
3671 146, 144, 105, 106, 8, 9, 10, 114, 115, 116,
3672 117, 114, 115, 116, 117, 144, 144, 144, 144, 144,
3673 24, 104, 26, 27, 28, 29, 144, 144, 144, 144,
3674 144, 144, 144, 144, 144, 144, 144, -1, 144, 144,
3675 144, -1, -1, -1, 146, 146, 146, 146, 146, 146,
3676 146, 146, -1, 136, 147, -1, 139, -1, -1, -1,
3677 143, -1, 145
3678 ];
3679
3680 PHP.Parser.prototype.yybase = [
3681 0, 574, 581, 623, 655, 2, 718, 402, 747, 659,
3682 672, 688, 743, 701, 705, 483, 483, 483, 483, 483,
3683 351, 356, 366, 366, 367, 366, 344, -2, -2, -2,
3684 200, 200, 231, 231, 231, 231, 231, 231, 231, 231,
3685 200, 231, 451, 482, 532, 316, 370, 115, 146, 285,
3686 401, 401, 401, 401, 401, 401, 401, 401, 401, 401,
3687 401, 401, 401, 401, 401, 401, 401, 401, 401, 401,
3688 401, 401, 401, 401, 401, 401, 401, 401, 401, 401,
3689 401, 401, 401, 401, 401, 401, 401, 401, 401, 401,
3690 401, 401, 401, 401, 401, 401, 401, 401, 401, 401,
3691 401, 401, 401, 401, 401, 401, 401, 401, 401, 401,
3692 401, 401, 401, 401, 401, 401, 401, 401, 401, 401,
3693 401, 401, 401, 401, 401, 401, 401, 401, 401, 401,
3694 401, 401, 401, 401, 401, 401, 401, 401, 401, 44,
3695 474, 429, 476, 481, 487, 488, 739, 740, 741, 734,
3696 733, 416, 736, 539, 541, 342, 542, 543, 552, 557,
3697 559, 536, 567, 737, 755, 569, 735, 738, 123, 123,
3698 123, 123, 123, 123, 123, 123, 123, 122, 11, 336,
3699 336, 336, 336, 336, 336, 336, 336, 336, 336, 336,
3700 336, 336, 336, 336, 227, 227, 173, 577, 577, 577,
3701 577, 577, 577, 577, 577, 577, 577, 577, 79, 178,
3702 846, 8, -3, -3, -3, -3, 642, 706, 706, 706,
3703 706, 157, 179, 242, 431, 431, 360, 431, 525, 368,
3704 767, 767, 767, 767, 767, 767, 767, 767, 767, 767,
3705 767, 767, 350, 375, 315, 315, 652, 652, -81, -81,
3706 -81, -81, 251, 185, 188, 184, -62, 348, 195, 195,
3707 195, 408, 392, 410, 1, 192, 129, 129, 129, -24,
3708 -24, -24, -24, 499, -24, -24, -24, 113, 108, 108,
3709 12, 161, 349, 526, 271, 398, 529, 438, 130, 206,
3710 265, 427, 76, 414, 427, 288, 295, 76, 166, 44,
3711 262, 422, 141, 491, 372, 494, 413, 71, 92, 93,
3712 267, 135, 100, 34, 415, 745, 746, 742, -38, 420,
3713 -10, 135, 147, 744, 498, 107, 26, 493, 144, 377,
3714 363, 369, 332, 363, 400, 377, 588, 377, 376, 377,
3715 360, 37, 582, 376, 377, 374, 376, 388, 363, 364,
3716 412, 369, 377, 441, 443, 390, 106, 332, 377, 390,
3717 377, 400, 64, 590, 591, 323, 592, 589, 593, 649,
3718 608, 362, 500, 399, 407, 620, 625, 636, 365, 354,
3719 614, 524, 425, 359, 355, 423, 570, 578, 357, 406,
3720 414, 394, 352, 403, 531, 433, 403, 653, 434, 385,
3721 417, 411, 444, 310, 318, 501, 425, 668, 757, 380,
3722 637, 684, 403, 609, 387, 87, 325, 638, 382, 403,
3723 639, 403, 696, 503, 615, 403, 697, 384, 435, 425,
3724 352, 352, 352, 700, 66, 699, 583, 702, 707, 704,
3725 748, 721, 749, 584, 750, 358, 583, 722, 751, 682,
3726 215, 613, 422, 436, 389, 447, 221, 257, 752, 403,
3727 403, 506, 499, 403, 395, 685, 397, 426, 753, 392,
3728 391, 647, 683, 403, 418, 754, 221, 723, 587, 724,
3729 450, 568, 507, 648, 509, 327, 725, 353, 497, 610,
3730 454, 622, 455, 461, 404, 510, 373, 732, 612, 247,
3731 361, 664, 463, 405, 692, 641, 464, 465, 511, 343,
3732 437, 335, 409, 396, 665, 293, 467, 468, 472, 0,
3733 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3734 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3735 0, 0, 0, 0, 0, -2, -2, -2, -2, -2,
3736 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3737 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3738 -2, 0, 0, 0, -2, -2, -2, -2, -2, -2,
3739 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3740 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3741 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3742 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3743 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3744 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3745 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3746 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3747 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3748 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
3749 -2, -2, -2, 123, 123, 123, 123, 123, 123, 123,
3750 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
3751 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
3752 123, 123, 0, 0, 0, 0, 0, 0, 0, 0,
3753 0, 123, 123, 123, 123, 123, 123, 123, 123, 123,
3754 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
3755 123, 767, 767, 767, 767, 767, 767, 767, 767, 767,
3756 767, 767, 123, 123, 123, 123, 123, 123, 123, 123,
3757 0, 129, 129, 129, 129, -94, -94, -94, 767, 767,
3758 767, 767, 767, 767, 0, 0, 0, 0, 0, 0,
3759 0, 0, 0, 0, 0, 0, -94, -94, 129, 129,
3760 767, 767, -24, -24, -24, -24, -24, 108, 108, 108,
3761 -24, 108, 145, 145, 145, 108, 108, 108, 100, 100,
3762 0, 0, 0, 0, 0, 0, 0, 145, 0, 0,
3763 0, 376, 0, 0, 0, 145, 260, 260, 221, 260,
3764 260, 135, 0, 0, 425, 376, 0, 364, 376, 0,
3765 0, 0, 0, 0, 0, 531, 0, 87, 637, 241,
3766 425, 0, 0, 0, 0, 0, 0, 0, 425, 289,
3767 289, 306, 0, 358, 0, 0, 0, 306, 241, 0,
3768 0, 221
3769 ];
3770
3771 PHP.Parser.prototype.yydefault = [
3772 3,32767,32767, 1,32767,32767,32767,32767,32767,32767,
3773 32767,32767,32767,32767,32767, 104, 96, 110, 95, 106,
3774 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3775 358, 358, 122, 122, 122, 122, 122, 122, 122, 122,
3776 316,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3777 173, 173, 173,32767, 348, 348, 348, 348, 348, 348,
3778 348,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3779 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3780 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3781 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3782 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3783 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3784 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3785 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3786 32767, 363,32767,32767,32767,32767,32767,32767,32767,32767,
3787 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3788 32767,32767,32767,32767,32767,32767,32767,32767, 232, 233,
3789 235, 236, 172, 125, 349, 362, 171, 199, 201, 250,
3790 200, 177, 182, 183, 184, 185, 186, 187, 188, 189,
3791 190, 191, 192, 176, 229, 228, 197, 313, 313, 316,
3792 32767,32767,32767,32767,32767,32767,32767,32767, 198, 202,
3793 204, 203, 219, 220, 217, 218, 175, 221, 222, 223,
3794 224, 157, 157, 157, 357, 357,32767, 357,32767,32767,
3795 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3796 32767,32767, 158,32767, 211, 212, 276, 276, 117, 117,
3797 117, 117, 117,32767,32767,32767,32767, 284,32767,32767,
3798 32767,32767,32767, 286,32767,32767, 206, 207, 205,32767,
3799 32767,32767,32767,32767,32767,32767,32767,32767, 285,32767,
3800 32767,32767,32767,32767,32767,32767,32767, 334, 321, 272,
3801 32767,32767,32767, 265,32767, 107, 109,32767,32767,32767,
3802 32767, 302, 339,32767,32767,32767, 17,32767,32767,32767,
3803 370, 334,32767,32767, 19,32767,32767,32767,32767, 227,
3804 32767, 338, 332,32767,32767,32767,32767,32767,32767, 63,
3805 32767,32767,32767,32767,32767, 63, 281, 63,32767, 63,
3806 32767, 315, 287,32767, 63, 74,32767, 72,32767,32767,
3807 76,32767, 63, 93, 93, 254, 315, 54, 63, 254,
3808 63,32767,32767,32767,32767, 4,32767,32767,32767,32767,
3809 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3810 32767,32767, 267,32767, 323,32767, 337, 336, 324,32767,
3811 265,32767, 215, 194, 266,32767, 196,32767,32767, 270,
3812 273,32767,32767,32767, 134,32767, 268, 180,32767,32767,
3813 32767,32767, 365,32767,32767, 174,32767,32767,32767, 130,
3814 32767, 61, 332,32767,32767, 355,32767,32767, 332, 269,
3815 208, 209, 210,32767, 121,32767, 310,32767,32767,32767,
3816 32767,32767,32767, 327,32767, 333,32767,32767,32767,32767,
3817 111,32767, 302,32767,32767,32767, 75,32767,32767, 178,
3818 126,32767,32767, 364,32767,32767,32767, 320,32767,32767,
3819 32767,32767,32767, 62,32767,32767, 77,32767,32767,32767,
3820 32767, 332,32767,32767,32767, 115,32767, 169,32767,32767,
3821 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
3822 32767, 332,32767,32767,32767,32767,32767,32767,32767, 4,
3823 32767, 151,32767,32767,32767,32767,32767,32767,32767, 25,
3824 25, 3, 137, 3, 137, 25, 101, 25, 25, 137,
3825 93, 93, 25, 25, 25, 144, 25, 25, 25, 25,
3826 25, 25, 25, 25
3827 ];
3828
3829 PHP.Parser.prototype.yygoto = [
3830 141, 141, 173, 173, 173, 173, 173, 173, 173, 173,
3831 141, 173, 142, 143, 144, 148, 153, 155, 181, 175,
3832 172, 172, 172, 172, 174, 174, 174, 174, 174, 174,
3833 174, 168, 169, 170, 171, 179, 757, 758, 392, 760,
3834 781, 782, 783, 784, 785, 786, 787, 789, 725, 145,
3835 146, 147, 149, 150, 151, 152, 154, 177, 178, 180,
3836 196, 208, 209, 210, 211, 212, 213, 214, 215, 217,
3837 218, 219, 220, 244, 245, 266, 267, 268, 430, 431,
3838 432, 182, 183, 184, 185, 186, 187, 188, 189, 190,
3839 191, 192, 156, 157, 158, 159, 176, 160, 194, 161,
3840 162, 163, 164, 195, 165, 193, 139, 166, 167, 452,
3841 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
3842 453, 453, 453, 453, 453, 453, 453, 453, 453, 453,
3843 453, 551, 551, 551, 464, 491, 394, 394, 394, 394,
3844 394, 394, 394, 394, 394, 394, 394, 394, 394, 394,
3845 394, 394, 394, 394, 407, 552, 552, 552, 810, 810,
3846 662, 662, 662, 662, 662, 594, 283, 595, 510, 399,
3847 399, 567, 679, 632, 849, 850, 863, 660, 714, 426,
3848 222, 622, 622, 622, 622, 223, 617, 623, 494, 395,
3849 395, 395, 395, 395, 395, 395, 395, 395, 395, 395,
3850 395, 395, 395, 395, 395, 395, 395, 465, 472, 514,
3851 904, 398, 398, 425, 425, 459, 425, 419, 322, 421,
3852 421, 393, 396, 412, 422, 428, 460, 463, 473, 481,
3853 501, 5, 476, 284, 327, 1, 15, 2, 6, 7,
3854 550, 550, 550, 8, 9, 10, 668, 16, 11, 17,
3855 12, 18, 13, 19, 14, 704, 328, 881, 881, 643,
3856 628, 626, 626, 624, 626, 526, 401, 652, 647, 847,
3857 847, 847, 847, 847, 847, 847, 847, 847, 847, 847,
3858 437, 438, 441, 447, 477, 479, 497, 290, 910, 910,
3859 400, 400, 486, 880, 880, 263, 913, 910, 303, 255,
3860 723, 306, 822, 821, 306, 896, 896, 896, 861, 304,
3861 323, 410, 913, 913, 897, 316, 420, 769, 658, 559,
3862 879, 671, 536, 324, 466, 565, 311, 311, 311, 801,
3863 241, 676, 496, 439, 440, 442, 444, 448, 475, 631,
3864 858, 311, 285, 286, 603, 495, 712, 0, 406, 321,
3865 0, 0, 0, 314, 0, 0, 429, 0, 0, 0,
3866 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3867 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3868 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3869 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3870 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3871 0, 0, 0, 0, 411
3872 ];
3873
3874 PHP.Parser.prototype.yygcheck = [
3875 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3876 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3877 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3878 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3879 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3880 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3881 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3882 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3883 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3884 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3885 15, 15, 15, 15, 15, 15, 15, 15, 15, 35,
3886 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
3887 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
3888 86, 6, 6, 6, 21, 21, 35, 35, 35, 35,
3889 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
3890 35, 35, 35, 35, 71, 7, 7, 7, 35, 35,
3891 35, 35, 35, 35, 35, 29, 44, 29, 35, 86,
3892 86, 12, 12, 12, 12, 12, 12, 12, 12, 75,
3893 40, 35, 35, 35, 35, 40, 35, 35, 35, 82,
3894 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
3895 82, 82, 82, 82, 82, 82, 82, 36, 36, 36,
3896 104, 82, 82, 28, 28, 28, 28, 28, 28, 28,
3897 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
3898 28, 13, 42, 42, 42, 2, 13, 2, 13, 13,
3899 5, 5, 5, 13, 13, 13, 54, 13, 13, 13,
3900 13, 13, 13, 13, 13, 67, 67, 83, 83, 5,
3901 5, 5, 5, 5, 5, 5, 5, 5, 5, 93,
3902 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
3903 52, 52, 52, 52, 52, 52, 52, 4, 105, 105,
3904 89, 89, 94, 84, 84, 92, 105, 105, 26, 92,
3905 71, 4, 91, 91, 4, 84, 84, 84, 97, 30,
3906 70, 30, 105, 105, 102, 27, 30, 72, 50, 10,
3907 84, 55, 46, 9, 30, 11, 90, 90, 90, 80,
3908 30, 56, 30, 85, 85, 85, 85, 85, 85, 43,
3909 96, 90, 44, 44, 34, 77, 69, -1, 4, 90,
3910 -1, -1, -1, 4, -1, -1, 4, -1, -1, -1,
3911 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3912 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3913 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3914 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3915 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3916 -1, -1, -1, -1, 71
3917 ];
3918
3919 PHP.Parser.prototype.yygbase = [
3920 0, 0, -286, 0, 10, 239, 130, 154, 0, -10,
3921 25, -23, -29, -289, 0, -30, 0, 0, 0, 0,
3922 0, 83, 0, 0, 0, 0, 245, 84, -11, 142,
3923 -28, 0, 0, 0, -13, -88, -42, 0, 0, 0,
3924 -344, 0, -38, -12, -188, 0, 23, 0, 0, 0,
3925 66, 0, 247, 0, 205, 24, -18, 0, 0, 0,
3926 0, 0, 0, 0, 0, 0, 0, 13, 0, -15,
3927 85, 74, 70, 0, 0, 148, 0, -14, 0, 0,
3928 -6, 0, -35, 11, 47, 278, -77, 0, 0, 44,
3929 68, 43, 38, 72, 94, 0, -16, 109, 0, 0,
3930 0, 0, 87, 0, 170, 34, 0
3931 ];
3932
3933 PHP.Parser.prototype.yygdefault = [
3934 -32768, 362, 3, 546, 382, 570, 571, 572, 307, 305,
3935 560, 566, 467, 4, 568, 140, 295, 575, 296, 500,
3936 577, 414, 579, 580, 308, 309, 415, 315, 216, 593,
3937 503, 313, 596, 357, 602, 301, 449, 383, 350, 461,
3938 221, 423, 456, 630, 282, 638, 540, 646, 649, 450,
3939 657, 352, 433, 434, 667, 672, 677, 680, 334, 325,
3940 474, 684, 685, 256, 689, 511, 512, 703, 242, 711,
3941 317, 724, 342, 788, 790, 397, 408, 484, 797, 326,
3942 800, 384, 385, 386, 387, 435, 818, 815, 289, 866,
3943 287, 443, 254, 853, 468, 356, 903, 862, 288, 388,
3944 389, 302, 898, 341, 905, 912, 458
3945 ];
3946
3947 PHP.Parser.prototype.yylhs = [
3948 0, 1, 2, 2, 4, 4, 3, 3, 3, 3,
3949 3, 3, 3, 3, 3, 8, 8, 10, 10, 10,
3950 10, 9, 9, 11, 13, 13, 14, 14, 14, 14,
3951 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
3952 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
3953 5, 5, 5, 5, 5, 5, 5, 5, 33, 33,
3954 34, 27, 27, 30, 30, 6, 7, 7, 7, 37,
3955 37, 37, 38, 38, 41, 41, 39, 39, 42, 42,
3956 22, 22, 29, 29, 32, 32, 31, 31, 43, 23,
3957 23, 23, 23, 44, 44, 45, 45, 46, 46, 20,
3958 20, 16, 16, 47, 18, 18, 48, 17, 17, 19,
3959 19, 36, 36, 49, 49, 50, 50, 51, 51, 51,
3960 51, 52, 52, 53, 53, 54, 54, 24, 24, 55,
3961 55, 55, 25, 25, 56, 56, 40, 40, 57, 57,
3962 57, 57, 62, 62, 63, 63, 64, 64, 64, 64,
3963 65, 66, 66, 61, 61, 58, 58, 60, 60, 68,
3964 68, 67, 67, 67, 67, 67, 67, 59, 59, 69,
3965 69, 26, 26, 21, 21, 15, 15, 15, 15, 15,
3966 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3967 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3968 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3969 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3970 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3971 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3972 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
3973 15, 15, 15, 71, 77, 77, 79, 79, 80, 81,
3974 81, 81, 81, 81, 81, 86, 86, 35, 35, 35,
3975 72, 72, 87, 87, 82, 82, 88, 88, 88, 88,
3976 88, 73, 73, 73, 76, 76, 76, 78, 78, 93,
3977 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
3978 93, 93, 93, 12, 12, 12, 12, 12, 12, 74,
3979 74, 74, 74, 94, 94, 96, 96, 95, 95, 97,
3980 97, 28, 28, 28, 28, 99, 99, 98, 98, 98,
3981 98, 98, 100, 100, 84, 84, 89, 89, 83, 83,
3982 101, 101, 101, 101, 90, 90, 90, 90, 85, 85,
3983 91, 91, 91, 70, 70, 102, 102, 102, 75, 75,
3984 103, 103, 104, 104, 104, 104, 92, 92, 92, 92,
3985 105, 105, 105, 105, 105, 105, 105, 106, 106, 106
3986 ];
3987
3988 PHP.Parser.prototype.yylen = [
3989 1, 1, 2, 0, 1, 3, 1, 1, 1, 1,
3990 3, 5, 4, 3, 3, 3, 1, 1, 3, 2,
3991 4, 3, 1, 3, 2, 0, 1, 1, 1, 1,
3992 3, 7, 10, 5, 7, 9, 5, 2, 3, 2,
3993 3, 2, 3, 3, 3, 3, 1, 2, 5, 7,
3994 8, 10, 5, 1, 5, 3, 3, 2, 1, 2,
3995 8, 1, 3, 0, 1, 9, 7, 6, 5, 1,
3996 2, 2, 0, 2, 0, 2, 0, 2, 1, 3,
3997 1, 4, 1, 4, 1, 4, 1, 3, 3, 3,
3998 4, 4, 5, 0, 2, 4, 3, 1, 1, 1,
3999 4, 0, 2, 5, 0, 2, 6, 0, 2, 0,
4000 3, 1, 0, 1, 3, 3, 5, 0, 1, 1,
4001 1, 1, 0, 1, 3, 1, 2, 3, 1, 1,
4002 2, 4, 3, 1, 1, 3, 2, 0, 3, 3,
4003 8, 3, 1, 3, 0, 2, 4, 5, 4, 4,
4004 3, 1, 1, 1, 3, 1, 1, 0, 1, 1,
4005 2, 1, 1, 1, 1, 1, 1, 1, 3, 1,
4006 3, 3, 1, 0, 1, 1, 6, 3, 4, 4,
4007 1, 2, 3, 3, 3, 3, 3, 3, 3, 3,
4008 3, 3, 3, 2, 2, 2, 2, 3, 3, 3,
4009 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4010 3, 3, 3, 2, 2, 2, 2, 3, 3, 3,
4011 3, 3, 3, 3, 3, 3, 3, 3, 5, 4,
4012 4, 4, 2, 2, 4, 2, 2, 2, 2, 2,
4013 2, 2, 2, 2, 2, 2, 1, 4, 3, 3,
4014 2, 9, 10, 3, 0, 4, 1, 3, 2, 4,
4015 6, 8, 4, 4, 4, 1, 1, 1, 2, 3,
4016 1, 1, 1, 1, 1, 1, 0, 3, 3, 4,
4017 4, 0, 2, 3, 0, 1, 1, 0, 3, 1,
4018 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4019 3, 2, 1, 1, 3, 2, 2, 4, 3, 1,
4020 3, 3, 3, 0, 2, 0, 1, 3, 1, 3,
4021 1, 1, 1, 1, 1, 6, 4, 3, 6, 4,
4022 4, 4, 1, 3, 1, 2, 1, 1, 4, 1,
4023 3, 6, 4, 4, 4, 4, 1, 4, 0, 1,
4024 1, 3, 1, 3, 1, 1, 4, 0, 0, 2,
4025 3, 1, 3, 1, 4, 2, 2, 2, 1, 2,
4026 1, 4, 3, 3, 3, 6, 3, 1, 1, 1
4027 ];
4028
4029
4030
4031
4032
4033
4034
4035 PHP.Parser.prototype.yyn0 = function () {
4036 this.yyval = this.yyastk[ this.stackPos ];
4037 };
4038
4039 PHP.Parser.prototype.yyn1 = function ( attributes ) {
4040 this.yyval = this.Stmt_Namespace_postprocess(this.yyastk[ this.stackPos-(1-1) ]);
4041 };
4042
4043 PHP.Parser.prototype.yyn2 = function ( attributes ) {
4044 if (Array.isArray(this.yyastk[ this.stackPos-(2-2) ])) { this.yyval = this.yyastk[ this.stackPos-(2-1) ].concat( this.yyastk[ this.stackPos-(2-2) ]); } else { this.yyastk[ this.stackPos-(2-1) ].push( this.yyastk[ this.stackPos-(2-2) ] ); this.yyval = this.yyastk[ this.stackPos-(2-1) ]; };
4045 };
4046
4047 PHP.Parser.prototype.yyn3 = function ( attributes ) {
4048 this.yyval = [];
4049 };
4050
4051 PHP.Parser.prototype.yyn4 = function ( attributes ) {
4052 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4053 };
4054
4055 PHP.Parser.prototype.yyn5 = function ( attributes ) {
4056 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4057 };
4058
4059 PHP.Parser.prototype.yyn6 = function ( attributes ) {
4060 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4061 };
4062
4063 PHP.Parser.prototype.yyn7 = function ( attributes ) {
4064 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4065 };
4066
4067 PHP.Parser.prototype.yyn8 = function ( attributes ) {
4068 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4069 };
4070
4071 PHP.Parser.prototype.yyn9 = function ( attributes ) {
4072 this.yyval = this.Node_Stmt_HaltCompiler(attributes);
4073 };
4074
4075 PHP.Parser.prototype.yyn10 = function ( attributes ) {
4076 this.yyval = this.Node_Stmt_Namespace(this.Node_Name(this.yyastk[ this.stackPos-(3-2) ], attributes), null, attributes);
4077 };
4078
4079 PHP.Parser.prototype.yyn11 = function ( attributes ) {
4080 this.yyval = this.Node_Stmt_Namespace(this.Node_Name(this.yyastk[ this.stackPos-(5-2) ], attributes), this.yyastk[ this.stackPos-(5-4) ], attributes);
4081 };
4082
4083 PHP.Parser.prototype.yyn12 = function ( attributes ) {
4084 this.yyval = this.Node_Stmt_Namespace(null, this.yyastk[ this.stackPos-(4-3) ], attributes);
4085 };
4086
4087 PHP.Parser.prototype.yyn13 = function ( attributes ) {
4088 this.yyval = this.Node_Stmt_Use(this.yyastk[ this.stackPos-(3-2) ], attributes);
4089 };
4090
4091 PHP.Parser.prototype.yyn14 = function ( attributes ) {
4092 this.yyval = this.Node_Stmt_Const(this.yyastk[ this.stackPos-(3-2) ], attributes);
4093 };
4094
4095 PHP.Parser.prototype.yyn15 = function ( attributes ) {
4096 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4097 };
4098
4099 PHP.Parser.prototype.yyn16 = function ( attributes ) {
4100 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4101 };
4102
4103 PHP.Parser.prototype.yyn17 = function ( attributes ) {
4104 this.yyval = this.Node_Stmt_UseUse(this.Node_Name(this.yyastk[ this.stackPos-(1-1) ], attributes), null, attributes);
4105 };
4106
4107 PHP.Parser.prototype.yyn18 = function ( attributes ) {
4108 this.yyval = this.Node_Stmt_UseUse(this.Node_Name(this.yyastk[ this.stackPos-(3-1) ], attributes), this.yyastk[ this.stackPos-(3-3) ], attributes);
4109 };
4110
4111 PHP.Parser.prototype.yyn19 = function ( attributes ) {
4112 this.yyval = this.Node_Stmt_UseUse(this.Node_Name(this.yyastk[ this.stackPos-(2-2) ], attributes), null, attributes);
4113 };
4114
4115 PHP.Parser.prototype.yyn20 = function ( attributes ) {
4116 this.yyval = this.Node_Stmt_UseUse(this.Node_Name(this.yyastk[ this.stackPos-(4-2) ], attributes), this.yyastk[ this.stackPos-(4-4) ], attributes);
4117 };
4118
4119 PHP.Parser.prototype.yyn21 = function ( attributes ) {
4120 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4121 };
4122
4123 PHP.Parser.prototype.yyn22 = function ( attributes ) {
4124 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4125 };
4126
4127 PHP.Parser.prototype.yyn23 = function ( attributes ) {
4128 this.yyval = this.Node_Const(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4129 };
4130
4131 PHP.Parser.prototype.yyn24 = function ( attributes ) {
4132 if (Array.isArray(this.yyastk[ this.stackPos-(2-2) ])) { this.yyval = this.yyastk[ this.stackPos-(2-1) ].concat( this.yyastk[ this.stackPos-(2-2) ]); } else { this.yyastk[ this.stackPos-(2-1) ].push( this.yyastk[ this.stackPos-(2-2) ] ); this.yyval = this.yyastk[ this.stackPos-(2-1) ]; };
4133 };
4134
4135 PHP.Parser.prototype.yyn25 = function ( attributes ) {
4136 this.yyval = [];
4137 };
4138
4139 PHP.Parser.prototype.yyn26 = function ( attributes ) {
4140 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4141 };
4142
4143 PHP.Parser.prototype.yyn27 = function ( attributes ) {
4144 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4145 };
4146
4147 PHP.Parser.prototype.yyn28 = function ( attributes ) {
4148 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4149 };
4150
4151 PHP.Parser.prototype.yyn29 = function ( attributes ) {
4152 throw new Error('__halt_compiler() can only be used from the outermost scope');
4153 };
4154
4155 PHP.Parser.prototype.yyn30 = function ( attributes ) {
4156 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
4157 };
4158
4159 PHP.Parser.prototype.yyn31 = function ( attributes ) {
4160 this.yyval = this.Node_Stmt_If(this.yyastk[ this.stackPos-(7-3) ], {'stmts': Array.isArray(this.yyastk[ this.stackPos-(7-5) ]) ? this.yyastk[ this.stackPos-(7-5) ] : [this.yyastk[ this.stackPos-(7-5) ]], 'elseifs': this.yyastk[ this.stackPos-(7-6) ], 'Else': this.yyastk[ this.stackPos-(7-7) ]}, attributes);
4161 };
4162
4163 PHP.Parser.prototype.yyn32 = function ( attributes ) {
4164 this.yyval = this.Node_Stmt_If(this.yyastk[ this.stackPos-(10-3) ], {'stmts': this.yyastk[ this.stackPos-(10-6) ], 'elseifs': this.yyastk[ this.stackPos-(10-7) ], 'else': this.yyastk[ this.stackPos-(10-8) ]}, attributes);
4165 };
4166
4167 PHP.Parser.prototype.yyn33 = function ( attributes ) {
4168 this.yyval = this.Node_Stmt_While(this.yyastk[ this.stackPos-(5-3) ], this.yyastk[ this.stackPos-(5-5) ], attributes);
4169 };
4170
4171 PHP.Parser.prototype.yyn34 = function ( attributes ) {
4172 this.yyval = this.Node_Stmt_Do(this.yyastk[ this.stackPos-(7-5) ], Array.isArray(this.yyastk[ this.stackPos-(7-2) ]) ? this.yyastk[ this.stackPos-(7-2) ] : [this.yyastk[ this.stackPos-(7-2) ]], attributes);
4173 };
4174
4175 PHP.Parser.prototype.yyn35 = function ( attributes ) {
4176 this.yyval = this.Node_Stmt_For({'init': this.yyastk[ this.stackPos-(9-3) ], 'cond': this.yyastk[ this.stackPos-(9-5) ], 'loop': this.yyastk[ this.stackPos-(9-7) ], 'stmts': this.yyastk[ this.stackPos-(9-9) ]}, attributes);
4177 };
4178
4179 PHP.Parser.prototype.yyn36 = function ( attributes ) {
4180 this.yyval = this.Node_Stmt_Switch(this.yyastk[ this.stackPos-(5-3) ], this.yyastk[ this.stackPos-(5-5) ], attributes);
4181 };
4182
4183 PHP.Parser.prototype.yyn37 = function ( attributes ) {
4184 this.yyval = this.Node_Stmt_Break(null, attributes);
4185 };
4186
4187 PHP.Parser.prototype.yyn38 = function ( attributes ) {
4188 this.yyval = this.Node_Stmt_Break(this.yyastk[ this.stackPos-(3-2) ], attributes);
4189 };
4190
4191 PHP.Parser.prototype.yyn39 = function ( attributes ) {
4192 this.yyval = this.Node_Stmt_Continue(null, attributes);
4193 };
4194
4195 PHP.Parser.prototype.yyn40 = function ( attributes ) {
4196 this.yyval = this.Node_Stmt_Continue(this.yyastk[ this.stackPos-(3-2) ], attributes);
4197 };
4198
4199 PHP.Parser.prototype.yyn41 = function ( attributes ) {
4200 this.yyval = this.Node_Stmt_Return(null, attributes);
4201 };
4202
4203 PHP.Parser.prototype.yyn42 = function ( attributes ) {
4204 this.yyval = this.Node_Stmt_Return(this.yyastk[ this.stackPos-(3-2) ], attributes);
4205 };
4206
4207 PHP.Parser.prototype.yyn43 = function ( attributes ) {
4208 this.yyval = this.Node_Stmt_Global(this.yyastk[ this.stackPos-(3-2) ], attributes);
4209 };
4210
4211 PHP.Parser.prototype.yyn44 = function ( attributes ) {
4212 this.yyval = this.Node_Stmt_Static(this.yyastk[ this.stackPos-(3-2) ], attributes);
4213 };
4214
4215 PHP.Parser.prototype.yyn45 = function ( attributes ) {
4216 this.yyval = this.Node_Stmt_Echo(this.yyastk[ this.stackPos-(3-2) ], attributes);
4217 };
4218
4219 PHP.Parser.prototype.yyn46 = function ( attributes ) {
4220 this.yyval = this.Node_Stmt_InlineHTML(this.yyastk[ this.stackPos-(1-1) ], attributes);
4221 };
4222
4223 PHP.Parser.prototype.yyn47 = function ( attributes ) {
4224 this.yyval = this.yyastk[ this.stackPos-(2-1) ];
4225 };
4226
4227 PHP.Parser.prototype.yyn48 = function ( attributes ) {
4228 this.yyval = this.Node_Stmt_Unset(this.yyastk[ this.stackPos-(5-3) ], attributes);
4229 };
4230
4231 PHP.Parser.prototype.yyn49 = function ( attributes ) {
4232 this.yyval = this.Node_Stmt_Foreach(this.yyastk[ this.stackPos-(7-3) ], this.yyastk[ this.stackPos-(7-5) ], {'keyVar': null, 'byRef': false, 'stmts': this.yyastk[ this.stackPos-(7-7) ]}, attributes);
4233 };
4234
4235 PHP.Parser.prototype.yyn50 = function ( attributes ) {
4236 this.yyval = this.Node_Stmt_Foreach(this.yyastk[ this.stackPos-(8-3) ], this.yyastk[ this.stackPos-(8-6) ], {'keyVar': null, 'byRef': true, 'stmts': this.yyastk[ this.stackPos-(8-8) ]}, attributes);
4237 };
4238
4239 PHP.Parser.prototype.yyn51 = function ( attributes ) {
4240 this.yyval = this.Node_Stmt_Foreach(this.yyastk[ this.stackPos-(10-3) ], this.yyastk[ this.stackPos-(10-8) ], {'keyVar': this.yyastk[ this.stackPos-(10-5) ], 'byRef': this.yyastk[ this.stackPos-(10-7) ], 'stmts': this.yyastk[ this.stackPos-(10-10) ]}, attributes);
4241 };
4242
4243 PHP.Parser.prototype.yyn52 = function ( attributes ) {
4244 this.yyval = this.Node_Stmt_Declare(this.yyastk[ this.stackPos-(5-3) ], this.yyastk[ this.stackPos-(5-5) ], attributes);
4245 };
4246
4247 PHP.Parser.prototype.yyn53 = function ( attributes ) {
4248 this.yyval = [];
4249 };
4250
4251 PHP.Parser.prototype.yyn54 = function ( attributes ) {
4252 this.yyval = this.Node_Stmt_TryCatch(this.yyastk[ this.stackPos-(5-3) ], this.yyastk[ this.stackPos-(5-5) ], attributes);
4253 };
4254
4255 PHP.Parser.prototype.yyn55 = function ( attributes ) {
4256 this.yyval = this.Node_Stmt_Throw(this.yyastk[ this.stackPos-(3-2) ], attributes);
4257 };
4258
4259 PHP.Parser.prototype.yyn56 = function ( attributes ) {
4260 this.yyval = this.Node_Stmt_Goto(this.yyastk[ this.stackPos-(3-2) ], attributes);
4261 };
4262
4263 PHP.Parser.prototype.yyn57 = function ( attributes ) {
4264 this.yyval = this.Node_Stmt_Label(this.yyastk[ this.stackPos-(2-1) ], attributes);
4265 };
4266
4267 PHP.Parser.prototype.yyn58 = function ( attributes ) {
4268 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4269 };
4270
4271 PHP.Parser.prototype.yyn59 = function ( attributes ) {
4272 this.yyastk[ this.stackPos-(2-1) ].push( this.yyastk[ this.stackPos-(2-2) ] ); this.yyval = this.yyastk[ this.stackPos-(2-1) ];
4273 };
4274
4275 PHP.Parser.prototype.yyn60 = function ( attributes ) {
4276 this.yyval = this.Node_Stmt_Catch(this.yyastk[ this.stackPos-(8-3) ], this.yyastk[ this.stackPos-(8-4) ].substring( 1 ), this.yyastk[ this.stackPos-(8-7) ], attributes);
4277 };
4278
4279 PHP.Parser.prototype.yyn61 = function ( attributes ) {
4280 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4281 };
4282
4283 PHP.Parser.prototype.yyn62 = function ( attributes ) {
4284 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4285 };
4286
4287 PHP.Parser.prototype.yyn63 = function ( attributes ) {
4288 this.yyval = false;
4289 };
4290
4291 PHP.Parser.prototype.yyn64 = function ( attributes ) {
4292 this.yyval = true;
4293 };
4294
4295 PHP.Parser.prototype.yyn65 = function ( attributes ) {
4296 this.yyval = this.Node_Stmt_Function(this.yyastk[ this.stackPos-(9-3) ], {'byRef': this.yyastk[ this.stackPos-(9-2) ], 'params': this.yyastk[ this.stackPos-(9-5) ], 'stmts': this.yyastk[ this.stackPos-(9-8) ]}, attributes);
4297 };
4298
4299 PHP.Parser.prototype.yyn66 = function ( attributes ) {
4300 this.yyval = this.Node_Stmt_Class(this.yyastk[ this.stackPos-(7-2) ], {'type': this.yyastk[ this.stackPos-(7-1) ], 'Extends': this.yyastk[ this.stackPos-(7-3) ], 'Implements': this.yyastk[ this.stackPos-(7-4) ], 'stmts': this.yyastk[ this.stackPos-(7-6) ]}, attributes);
4301 };
4302
4303 PHP.Parser.prototype.yyn67 = function ( attributes ) {
4304 this.yyval = this.Node_Stmt_Interface(this.yyastk[ this.stackPos-(6-2) ], {'Extends': this.yyastk[ this.stackPos-(6-3) ], 'stmts': this.yyastk[ this.stackPos-(6-5) ]}, attributes);
4305 };
4306
4307 PHP.Parser.prototype.yyn68 = function ( attributes ) {
4308 this.yyval = this.Node_Stmt_Trait(this.yyastk[ this.stackPos-(5-2) ], this.yyastk[ this.stackPos-(5-4) ], attributes);
4309 };
4310
4311 PHP.Parser.prototype.yyn69 = function ( attributes ) {
4312 this.yyval = 0;
4313 };
4314
4315 PHP.Parser.prototype.yyn70 = function ( attributes ) {
4316 this.yyval = this.MODIFIER_ABSTRACT;
4317 };
4318
4319 PHP.Parser.prototype.yyn71 = function ( attributes ) {
4320 this.yyval = this.MODIFIER_FINAL;
4321 };
4322
4323 PHP.Parser.prototype.yyn72 = function ( attributes ) {
4324 this.yyval = null;
4325 };
4326
4327 PHP.Parser.prototype.yyn73 = function ( attributes ) {
4328 this.yyval = this.yyastk[ this.stackPos-(2-2) ];
4329 };
4330
4331 PHP.Parser.prototype.yyn74 = function ( attributes ) {
4332 this.yyval = [];
4333 };
4334
4335 PHP.Parser.prototype.yyn75 = function ( attributes ) {
4336 this.yyval = this.yyastk[ this.stackPos-(2-2) ];
4337 };
4338
4339 PHP.Parser.prototype.yyn76 = function ( attributes ) {
4340 this.yyval = [];
4341 };
4342
4343 PHP.Parser.prototype.yyn77 = function ( attributes ) {
4344 this.yyval = this.yyastk[ this.stackPos-(2-2) ];
4345 };
4346
4347 PHP.Parser.prototype.yyn78 = function ( attributes ) {
4348 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4349 };
4350
4351 PHP.Parser.prototype.yyn79 = function ( attributes ) {
4352 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4353 };
4354
4355 PHP.Parser.prototype.yyn80 = function ( attributes ) {
4356 this.yyval = Array.isArray(this.yyastk[ this.stackPos-(1-1) ]) ? this.yyastk[ this.stackPos-(1-1) ] : [this.yyastk[ this.stackPos-(1-1) ]];
4357 };
4358
4359 PHP.Parser.prototype.yyn81 = function ( attributes ) {
4360 this.yyval = this.yyastk[ this.stackPos-(4-2) ];
4361 };
4362
4363 PHP.Parser.prototype.yyn82 = function ( attributes ) {
4364 this.yyval = Array.isArray(this.yyastk[ this.stackPos-(1-1) ]) ? this.yyastk[ this.stackPos-(1-1) ] : [this.yyastk[ this.stackPos-(1-1) ]];
4365 };
4366
4367 PHP.Parser.prototype.yyn83 = function ( attributes ) {
4368 this.yyval = this.yyastk[ this.stackPos-(4-2) ];
4369 };
4370
4371 PHP.Parser.prototype.yyn84 = function ( attributes ) {
4372 this.yyval = Array.isArray(this.yyastk[ this.stackPos-(1-1) ]) ? this.yyastk[ this.stackPos-(1-1) ] : [this.yyastk[ this.stackPos-(1-1) ]];
4373 };
4374
4375 PHP.Parser.prototype.yyn85 = function ( attributes ) {
4376 this.yyval = this.yyastk[ this.stackPos-(4-2) ];
4377 };
4378
4379 PHP.Parser.prototype.yyn86 = function ( attributes ) {
4380 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4381 };
4382
4383 PHP.Parser.prototype.yyn87 = function ( attributes ) {
4384 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4385 };
4386
4387 PHP.Parser.prototype.yyn88 = function ( attributes ) {
4388 this.yyval = this.Node_Stmt_DeclareDeclare(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4389 };
4390
4391 PHP.Parser.prototype.yyn89 = function ( attributes ) {
4392 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
4393 };
4394
4395 PHP.Parser.prototype.yyn90 = function ( attributes ) {
4396 this.yyval = this.yyastk[ this.stackPos-(4-3) ];
4397 };
4398
4399 PHP.Parser.prototype.yyn91 = function ( attributes ) {
4400 this.yyval = this.yyastk[ this.stackPos-(4-2) ];
4401 };
4402
4403 PHP.Parser.prototype.yyn92 = function ( attributes ) {
4404 this.yyval = this.yyastk[ this.stackPos-(5-3) ];
4405 };
4406
4407 PHP.Parser.prototype.yyn93 = function ( attributes ) {
4408 this.yyval = [];
4409 };
4410
4411 PHP.Parser.prototype.yyn94 = function ( attributes ) {
4412 this.yyastk[ this.stackPos-(2-1) ].push( this.yyastk[ this.stackPos-(2-2) ] ); this.yyval = this.yyastk[ this.stackPos-(2-1) ];
4413 };
4414
4415 PHP.Parser.prototype.yyn95 = function ( attributes ) {
4416 this.yyval = this.Node_Stmt_Case(this.yyastk[ this.stackPos-(4-2) ], this.yyastk[ this.stackPos-(4-4) ], attributes);
4417 };
4418
4419 PHP.Parser.prototype.yyn96 = function ( attributes ) {
4420 this.yyval = this.Node_Stmt_Case(null, this.yyastk[ this.stackPos-(3-3) ], attributes);
4421 };
4422
4423 PHP.Parser.prototype.yyn97 = function () {
4424 this.yyval = this.yyastk[ this.stackPos ];
4425 };
4426
4427 PHP.Parser.prototype.yyn98 = function () {
4428 this.yyval = this.yyastk[ this.stackPos ];
4429 };
4430
4431 PHP.Parser.prototype.yyn99 = function ( attributes ) {
4432 this.yyval = Array.isArray(this.yyastk[ this.stackPos-(1-1) ]) ? this.yyastk[ this.stackPos-(1-1) ] : [this.yyastk[ this.stackPos-(1-1) ]];
4433 };
4434
4435 PHP.Parser.prototype.yyn100 = function ( attributes ) {
4436 this.yyval = this.yyastk[ this.stackPos-(4-2) ];
4437 };
4438
4439 PHP.Parser.prototype.yyn101 = function ( attributes ) {
4440 this.yyval = [];
4441 };
4442
4443 PHP.Parser.prototype.yyn102 = function ( attributes ) {
4444 this.yyastk[ this.stackPos-(2-1) ].push( this.yyastk[ this.stackPos-(2-2) ] ); this.yyval = this.yyastk[ this.stackPos-(2-1) ];
4445 };
4446
4447 PHP.Parser.prototype.yyn103 = function ( attributes ) {
4448 this.yyval = this.Node_Stmt_ElseIf(this.yyastk[ this.stackPos-(5-3) ], Array.isArray(this.yyastk[ this.stackPos-(5-5) ]) ? this.yyastk[ this.stackPos-(5-5) ] : [this.yyastk[ this.stackPos-(5-5) ]], attributes);
4449 };
4450
4451 PHP.Parser.prototype.yyn104 = function ( attributes ) {
4452 this.yyval = [];
4453 };
4454
4455 PHP.Parser.prototype.yyn105 = function ( attributes ) {
4456 this.yyastk[ this.stackPos-(2-1) ].push( this.yyastk[ this.stackPos-(2-2) ] ); this.yyval = this.yyastk[ this.stackPos-(2-1) ];
4457 };
4458
4459 PHP.Parser.prototype.yyn106 = function ( attributes ) {
4460 this.yyval = this.Node_Stmt_ElseIf(this.yyastk[ this.stackPos-(6-3) ], this.yyastk[ this.stackPos-(6-6) ], attributes);
4461 };
4462
4463 PHP.Parser.prototype.yyn107 = function ( attributes ) {
4464 this.yyval = null;
4465 };
4466
4467 PHP.Parser.prototype.yyn108 = function ( attributes ) {
4468 this.yyval = this.Node_Stmt_Else(Array.isArray(this.yyastk[ this.stackPos-(2-2) ]) ? this.yyastk[ this.stackPos-(2-2) ] : [this.yyastk[ this.stackPos-(2-2) ]], attributes);
4469 };
4470
4471 PHP.Parser.prototype.yyn109 = function ( attributes ) {
4472 this.yyval = null;
4473 };
4474
4475 PHP.Parser.prototype.yyn110 = function ( attributes ) {
4476 this.yyval = this.Node_Stmt_Else(this.yyastk[ this.stackPos-(3-3) ], attributes);
4477 };
4478
4479 PHP.Parser.prototype.yyn111 = function ( attributes ) {
4480 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4481 };
4482
4483 PHP.Parser.prototype.yyn112 = function ( attributes ) {
4484 this.yyval = [];
4485 };
4486
4487 PHP.Parser.prototype.yyn113 = function ( attributes ) {
4488 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4489 };
4490
4491 PHP.Parser.prototype.yyn114 = function ( attributes ) {
4492 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4493 };
4494
4495 PHP.Parser.prototype.yyn115 = function ( attributes ) {
4496 this.yyval = this.Node_Param(this.yyastk[ this.stackPos-(3-3) ].substring( 1 ), null, this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-2) ], attributes);
4497 };
4498
4499 PHP.Parser.prototype.yyn116 = function ( attributes ) {
4500 this.yyval = this.Node_Param(this.yyastk[ this.stackPos-(5-3) ].substring( 1 ), this.yyastk[ this.stackPos-(5-5) ], this.yyastk[ this.stackPos-(5-1) ], this.yyastk[ this.stackPos-(5-2) ], attributes);
4501 };
4502
4503 PHP.Parser.prototype.yyn117 = function ( attributes ) {
4504 this.yyval = null;
4505 };
4506
4507 PHP.Parser.prototype.yyn118 = function ( attributes ) {
4508 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4509 };
4510
4511 PHP.Parser.prototype.yyn119 = function ( attributes ) {
4512 this.yyval = 'array';
4513 };
4514
4515 PHP.Parser.prototype.yyn120 = function ( attributes ) {
4516 this.yyval = 'callable';
4517 };
4518
4519 PHP.Parser.prototype.yyn121 = function ( attributes ) {
4520 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4521 };
4522
4523 PHP.Parser.prototype.yyn122 = function ( attributes ) {
4524 this.yyval = [];
4525 };
4526
4527 PHP.Parser.prototype.yyn123 = function ( attributes ) {
4528 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4529 };
4530
4531 PHP.Parser.prototype.yyn124 = function ( attributes ) {
4532 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4533 };
4534
4535 PHP.Parser.prototype.yyn125 = function ( attributes ) {
4536 this.yyval = this.Node_Arg(this.yyastk[ this.stackPos-(1-1) ], false, attributes);
4537 };
4538
4539 PHP.Parser.prototype.yyn126 = function ( attributes ) {
4540 this.yyval = this.Node_Arg(this.yyastk[ this.stackPos-(2-2) ], true, attributes);
4541 };
4542
4543 PHP.Parser.prototype.yyn127 = function ( attributes ) {
4544 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4545 };
4546
4547 PHP.Parser.prototype.yyn128 = function ( attributes ) {
4548 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4549 };
4550
4551 PHP.Parser.prototype.yyn129 = function ( attributes ) {
4552 this.yyval = this.Node_Expr_Variable(this.yyastk[ this.stackPos-(1-1) ].substring( 1 ), attributes);
4553 };
4554
4555 PHP.Parser.prototype.yyn130 = function ( attributes ) {
4556 this.yyval = this.Node_Expr_Variable(this.yyastk[ this.stackPos-(2-2) ], attributes);
4557 };
4558
4559 PHP.Parser.prototype.yyn131 = function ( attributes ) {
4560 this.yyval = this.Node_Expr_Variable(this.yyastk[ this.stackPos-(4-3) ], attributes);
4561 };
4562
4563 PHP.Parser.prototype.yyn132 = function ( attributes ) {
4564 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4565 };
4566
4567 PHP.Parser.prototype.yyn133 = function ( attributes ) {
4568 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4569 };
4570
4571 PHP.Parser.prototype.yyn134 = function ( attributes ) {
4572 this.yyval = this.Node_Stmt_StaticVar(this.yyastk[ this.stackPos-(1-1) ].substring( 1 ), null, attributes);
4573 };
4574
4575 PHP.Parser.prototype.yyn135 = function ( attributes ) {
4576 this.yyval = this.Node_Stmt_StaticVar(this.yyastk[ this.stackPos-(3-1) ].substring( 1 ), this.yyastk[ this.stackPos-(3-3) ], attributes);
4577 };
4578
4579 PHP.Parser.prototype.yyn136 = function ( attributes ) {
4580 this.yyastk[ this.stackPos-(2-1) ].push( this.yyastk[ this.stackPos-(2-2) ] ); this.yyval = this.yyastk[ this.stackPos-(2-1) ];
4581 };
4582
4583 PHP.Parser.prototype.yyn137 = function ( attributes ) {
4584 this.yyval = [];
4585 };
4586
4587 PHP.Parser.prototype.yyn138 = function ( attributes ) {
4588 this.yyval = this.Node_Stmt_Property(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-2) ], attributes);
4589 };
4590
4591 PHP.Parser.prototype.yyn139 = function ( attributes ) {
4592 this.yyval = this.Node_Stmt_ClassConst(this.yyastk[ this.stackPos-(3-2) ], attributes);
4593 };
4594
4595 PHP.Parser.prototype.yyn140 = function ( attributes ) {
4596 this.yyval = this.Node_Stmt_ClassMethod(this.yyastk[ this.stackPos-(8-4) ], {'type': this.yyastk[ this.stackPos-(8-1) ], 'byRef': this.yyastk[ this.stackPos-(8-3) ], 'params': this.yyastk[ this.stackPos-(8-6) ], 'stmts': this.yyastk[ this.stackPos-(8-8) ]}, attributes);
4597 };
4598
4599 PHP.Parser.prototype.yyn141 = function ( attributes ) {
4600 this.yyval = this.Node_Stmt_TraitUse(this.yyastk[ this.stackPos-(3-2) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4601 };
4602
4603 PHP.Parser.prototype.yyn142 = function ( attributes ) {
4604 this.yyval = [];
4605 };
4606
4607 PHP.Parser.prototype.yyn143 = function ( attributes ) {
4608 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
4609 };
4610
4611 PHP.Parser.prototype.yyn144 = function ( attributes ) {
4612 this.yyval = [];
4613 };
4614
4615 PHP.Parser.prototype.yyn145 = function ( attributes ) {
4616 this.yyastk[ this.stackPos-(2-1) ].push( this.yyastk[ this.stackPos-(2-2) ] ); this.yyval = this.yyastk[ this.stackPos-(2-1) ];
4617 };
4618
4619 PHP.Parser.prototype.yyn146 = function ( attributes ) {
4620 this.yyval = this.Node_Stmt_TraitUseAdaptation_Precedence(this.yyastk[ this.stackPos-(4-1) ][0], this.yyastk[ this.stackPos-(4-1) ][1], this.yyastk[ this.stackPos-(4-3) ], attributes);
4621 };
4622
4623 PHP.Parser.prototype.yyn147 = function ( attributes ) {
4624 this.yyval = this.Node_Stmt_TraitUseAdaptation_Alias(this.yyastk[ this.stackPos-(5-1) ][0], this.yyastk[ this.stackPos-(5-1) ][1], this.yyastk[ this.stackPos-(5-3) ], this.yyastk[ this.stackPos-(5-4) ], attributes);
4625 };
4626
4627 PHP.Parser.prototype.yyn148 = function ( attributes ) {
4628 this.yyval = this.Node_Stmt_TraitUseAdaptation_Alias(this.yyastk[ this.stackPos-(4-1) ][0], this.yyastk[ this.stackPos-(4-1) ][1], this.yyastk[ this.stackPos-(4-3) ], null, attributes);
4629 };
4630
4631 PHP.Parser.prototype.yyn149 = function ( attributes ) {
4632 this.yyval = this.Node_Stmt_TraitUseAdaptation_Alias(this.yyastk[ this.stackPos-(4-1) ][0], this.yyastk[ this.stackPos-(4-1) ][1], null, this.yyastk[ this.stackPos-(4-3) ], attributes);
4633 };
4634
4635 PHP.Parser.prototype.yyn150 = function ( attributes ) {
4636 this.yyval = array(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ]);
4637 };
4638
4639 PHP.Parser.prototype.yyn151 = function ( attributes ) {
4640 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4641 };
4642
4643 PHP.Parser.prototype.yyn152 = function ( attributes ) {
4644 this.yyval = array(null, this.yyastk[ this.stackPos-(1-1) ]);
4645 };
4646
4647 PHP.Parser.prototype.yyn153 = function ( attributes ) {
4648 this.yyval = null;
4649 };
4650
4651 PHP.Parser.prototype.yyn154 = function ( attributes ) {
4652 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
4653 };
4654
4655 PHP.Parser.prototype.yyn155 = function ( attributes ) {
4656 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4657 };
4658
4659 PHP.Parser.prototype.yyn156 = function ( attributes ) {
4660 this.yyval = this.MODIFIER_PUBLIC;
4661 };
4662
4663 PHP.Parser.prototype.yyn157 = function ( attributes ) {
4664 this.yyval = this.MODIFIER_PUBLIC;
4665 };
4666
4667 PHP.Parser.prototype.yyn158 = function ( attributes ) {
4668 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4669 };
4670
4671 PHP.Parser.prototype.yyn159 = function ( attributes ) {
4672 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4673 };
4674
4675 PHP.Parser.prototype.yyn160 = function ( attributes ) {
4676 this.Stmt_Class_verifyModifier(this.yyastk[ this.stackPos-(2-1) ], this.yyastk[ this.stackPos-(2-2) ]); this.yyval = this.yyastk[ this.stackPos-(2-1) ] | this.yyastk[ this.stackPos-(2-2) ];
4677 };
4678
4679 PHP.Parser.prototype.yyn161 = function ( attributes ) {
4680 this.yyval = this.MODIFIER_PUBLIC;
4681 };
4682
4683 PHP.Parser.prototype.yyn162 = function ( attributes ) {
4684 this.yyval = this.MODIFIER_PROTECTED;
4685 };
4686
4687 PHP.Parser.prototype.yyn163 = function ( attributes ) {
4688 this.yyval = this.MODIFIER_PRIVATE;
4689 };
4690
4691 PHP.Parser.prototype.yyn164 = function ( attributes ) {
4692 this.yyval = this.MODIFIER_STATIC;
4693 };
4694
4695 PHP.Parser.prototype.yyn165 = function ( attributes ) {
4696 this.yyval = this.MODIFIER_ABSTRACT;
4697 };
4698
4699 PHP.Parser.prototype.yyn166 = function ( attributes ) {
4700 this.yyval = this.MODIFIER_FINAL;
4701 };
4702
4703 PHP.Parser.prototype.yyn167 = function ( attributes ) {
4704 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4705 };
4706
4707 PHP.Parser.prototype.yyn168 = function ( attributes ) {
4708 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4709 };
4710
4711 PHP.Parser.prototype.yyn169 = function ( attributes ) {
4712 this.yyval = this.Node_Stmt_PropertyProperty(this.yyastk[ this.stackPos-(1-1) ].substring( 1 ), null, attributes);
4713 };
4714
4715 PHP.Parser.prototype.yyn170 = function ( attributes ) {
4716 this.yyval = this.Node_Stmt_PropertyProperty(this.yyastk[ this.stackPos-(3-1) ].substring( 1 ), this.yyastk[ this.stackPos-(3-3) ], attributes);
4717 };
4718
4719 PHP.Parser.prototype.yyn171 = function ( attributes ) {
4720 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
4721 };
4722
4723 PHP.Parser.prototype.yyn172 = function ( attributes ) {
4724 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
4725 };
4726
4727 PHP.Parser.prototype.yyn173 = function ( attributes ) {
4728 this.yyval = [];
4729 };
4730
4731 PHP.Parser.prototype.yyn174 = function ( attributes ) {
4732 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4733 };
4734
4735 PHP.Parser.prototype.yyn175 = function ( attributes ) {
4736 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4737 };
4738
4739 PHP.Parser.prototype.yyn176 = function ( attributes ) {
4740 this.yyval = this.Node_Expr_AssignList(this.yyastk[ this.stackPos-(6-3) ], this.yyastk[ this.stackPos-(6-6) ], attributes);
4741 };
4742
4743 PHP.Parser.prototype.yyn177 = function ( attributes ) {
4744 this.yyval = this.Node_Expr_Assign(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4745 };
4746
4747 PHP.Parser.prototype.yyn178 = function ( attributes ) {
4748 this.yyval = this.Node_Expr_AssignRef(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-4) ], attributes);
4749 };
4750
4751 PHP.Parser.prototype.yyn179 = function ( attributes ) {
4752 this.yyval = this.Node_Expr_AssignRef(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-4) ], attributes);
4753 };
4754
4755 PHP.Parser.prototype.yyn180 = function ( attributes ) {
4756 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
4757 };
4758
4759 PHP.Parser.prototype.yyn181 = function ( attributes ) {
4760 this.yyval = this.Node_Expr_Clone(this.yyastk[ this.stackPos-(2-2) ], attributes);
4761 };
4762
4763 PHP.Parser.prototype.yyn182 = function ( attributes ) {
4764 this.yyval = this.Node_Expr_AssignPlus(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4765 };
4766
4767 PHP.Parser.prototype.yyn183 = function ( attributes ) {
4768 this.yyval = this.Node_Expr_AssignMinus(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4769 };
4770
4771 PHP.Parser.prototype.yyn184 = function ( attributes ) {
4772 this.yyval = this.Node_Expr_AssignMul(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4773 };
4774
4775 PHP.Parser.prototype.yyn185 = function ( attributes ) {
4776 this.yyval = this.Node_Expr_AssignDiv(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4777 };
4778
4779 PHP.Parser.prototype.yyn186 = function ( attributes ) {
4780 this.yyval = this.Node_Expr_AssignConcat(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4781 };
4782
4783 PHP.Parser.prototype.yyn187 = function ( attributes ) {
4784 this.yyval = this.Node_Expr_AssignMod(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4785 };
4786
4787 PHP.Parser.prototype.yyn188 = function ( attributes ) {
4788 this.yyval = this.Node_Expr_AssignBitwiseAnd(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4789 };
4790
4791 PHP.Parser.prototype.yyn189 = function ( attributes ) {
4792 this.yyval = this.Node_Expr_AssignBitwiseOr(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4793 };
4794
4795 PHP.Parser.prototype.yyn190 = function ( attributes ) {
4796 this.yyval = this.Node_Expr_AssignBitwiseXor(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4797 };
4798
4799 PHP.Parser.prototype.yyn191 = function ( attributes ) {
4800 this.yyval = this.Node_Expr_AssignShiftLeft(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4801 };
4802
4803 PHP.Parser.prototype.yyn192 = function ( attributes ) {
4804 this.yyval = this.Node_Expr_AssignShiftRight(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4805 };
4806
4807 PHP.Parser.prototype.yyn193 = function ( attributes ) {
4808 this.yyval = this.Node_Expr_PostInc(this.yyastk[ this.stackPos-(2-1) ], attributes);
4809 };
4810
4811 PHP.Parser.prototype.yyn194 = function ( attributes ) {
4812 this.yyval = this.Node_Expr_PreInc(this.yyastk[ this.stackPos-(2-2) ], attributes);
4813 };
4814
4815 PHP.Parser.prototype.yyn195 = function ( attributes ) {
4816 this.yyval = this.Node_Expr_PostDec(this.yyastk[ this.stackPos-(2-1) ], attributes);
4817 };
4818
4819 PHP.Parser.prototype.yyn196 = function ( attributes ) {
4820 this.yyval = this.Node_Expr_PreDec(this.yyastk[ this.stackPos-(2-2) ], attributes);
4821 };
4822
4823 PHP.Parser.prototype.yyn197 = function ( attributes ) {
4824 this.yyval = this.Node_Expr_BooleanOr(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4825 };
4826
4827 PHP.Parser.prototype.yyn198 = function ( attributes ) {
4828 this.yyval = this.Node_Expr_BooleanAnd(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4829 };
4830
4831 PHP.Parser.prototype.yyn199 = function ( attributes ) {
4832 this.yyval = this.Node_Expr_LogicalOr(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4833 };
4834
4835 PHP.Parser.prototype.yyn200 = function ( attributes ) {
4836 this.yyval = this.Node_Expr_LogicalAnd(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4837 };
4838
4839 PHP.Parser.prototype.yyn201 = function ( attributes ) {
4840 this.yyval = this.Node_Expr_LogicalXor(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4841 };
4842
4843 PHP.Parser.prototype.yyn202 = function ( attributes ) {
4844 this.yyval = this.Node_Expr_BitwiseOr(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4845 };
4846
4847 PHP.Parser.prototype.yyn203 = function ( attributes ) {
4848 this.yyval = this.Node_Expr_BitwiseAnd(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4849 };
4850
4851 PHP.Parser.prototype.yyn204 = function ( attributes ) {
4852 this.yyval = this.Node_Expr_BitwiseXor(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4853 };
4854
4855 PHP.Parser.prototype.yyn205 = function ( attributes ) {
4856 this.yyval = this.Node_Expr_Concat(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4857 };
4858
4859 PHP.Parser.prototype.yyn206 = function ( attributes ) {
4860 this.yyval = this.Node_Expr_Plus(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4861 };
4862
4863 PHP.Parser.prototype.yyn207 = function ( attributes ) {
4864 this.yyval = this.Node_Expr_Minus(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4865 };
4866
4867 PHP.Parser.prototype.yyn208 = function ( attributes ) {
4868 this.yyval = this.Node_Expr_Mul(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4869 };
4870
4871 PHP.Parser.prototype.yyn209 = function ( attributes ) {
4872 this.yyval = this.Node_Expr_Div(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4873 };
4874
4875 PHP.Parser.prototype.yyn210 = function ( attributes ) {
4876 this.yyval = this.Node_Expr_Mod(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4877 };
4878
4879 PHP.Parser.prototype.yyn211 = function ( attributes ) {
4880 this.yyval = this.Node_Expr_ShiftLeft(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4881 };
4882
4883 PHP.Parser.prototype.yyn212 = function ( attributes ) {
4884 this.yyval = this.Node_Expr_ShiftRight(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4885 };
4886
4887 PHP.Parser.prototype.yyn213 = function ( attributes ) {
4888 this.yyval = this.Node_Expr_UnaryPlus(this.yyastk[ this.stackPos-(2-2) ], attributes);
4889 };
4890
4891 PHP.Parser.prototype.yyn214 = function ( attributes ) {
4892 this.yyval = this.Node_Expr_UnaryMinus(this.yyastk[ this.stackPos-(2-2) ], attributes);
4893 };
4894
4895 PHP.Parser.prototype.yyn215 = function ( attributes ) {
4896 this.yyval = this.Node_Expr_BooleanNot(this.yyastk[ this.stackPos-(2-2) ], attributes);
4897 };
4898
4899 PHP.Parser.prototype.yyn216 = function ( attributes ) {
4900 this.yyval = this.Node_Expr_BitwiseNot(this.yyastk[ this.stackPos-(2-2) ], attributes);
4901 };
4902
4903 PHP.Parser.prototype.yyn217 = function ( attributes ) {
4904 this.yyval = this.Node_Expr_Identical(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4905 };
4906
4907 PHP.Parser.prototype.yyn218 = function ( attributes ) {
4908 this.yyval = this.Node_Expr_NotIdentical(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4909 };
4910
4911 PHP.Parser.prototype.yyn219 = function ( attributes ) {
4912 this.yyval = this.Node_Expr_Equal(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4913 };
4914
4915 PHP.Parser.prototype.yyn220 = function ( attributes ) {
4916 this.yyval = this.Node_Expr_NotEqual(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4917 };
4918
4919 PHP.Parser.prototype.yyn221 = function ( attributes ) {
4920 this.yyval = this.Node_Expr_Smaller(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4921 };
4922
4923 PHP.Parser.prototype.yyn222 = function ( attributes ) {
4924 this.yyval = this.Node_Expr_SmallerOrEqual(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4925 };
4926
4927 PHP.Parser.prototype.yyn223 = function ( attributes ) {
4928 this.yyval = this.Node_Expr_Greater(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4929 };
4930
4931 PHP.Parser.prototype.yyn224 = function ( attributes ) {
4932 this.yyval = this.Node_Expr_GreaterOrEqual(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4933 };
4934
4935 PHP.Parser.prototype.yyn225 = function ( attributes ) {
4936 this.yyval = this.Node_Expr_Instanceof(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
4937 };
4938
4939 PHP.Parser.prototype.yyn226 = function ( attributes ) {
4940 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
4941 };
4942
4943 PHP.Parser.prototype.yyn227 = function ( attributes ) {
4944 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
4945 };
4946
4947 PHP.Parser.prototype.yyn228 = function ( attributes ) {
4948 this.yyval = this.Node_Expr_Ternary(this.yyastk[ this.stackPos-(5-1) ], this.yyastk[ this.stackPos-(5-3) ], this.yyastk[ this.stackPos-(5-5) ], attributes);
4949 };
4950
4951 PHP.Parser.prototype.yyn229 = function ( attributes ) {
4952 this.yyval = this.Node_Expr_Ternary(this.yyastk[ this.stackPos-(4-1) ], null, this.yyastk[ this.stackPos-(4-4) ], attributes);
4953 };
4954
4955 PHP.Parser.prototype.yyn230 = function ( attributes ) {
4956 this.yyval = this.Node_Expr_Isset(this.yyastk[ this.stackPos-(4-3) ], attributes);
4957 };
4958
4959 PHP.Parser.prototype.yyn231 = function ( attributes ) {
4960 this.yyval = this.Node_Expr_Empty(this.yyastk[ this.stackPos-(4-3) ], attributes);
4961 };
4962
4963 PHP.Parser.prototype.yyn232 = function ( attributes ) {
4964 this.yyval = this.Node_Expr_Include(this.yyastk[ this.stackPos-(2-2) ], "Node_Expr_Include", attributes);
4965 };
4966
4967 PHP.Parser.prototype.yyn233 = function ( attributes ) {
4968 this.yyval = this.Node_Expr_Include(this.yyastk[ this.stackPos-(2-2) ], "Node_Expr_IncludeOnce", attributes);
4969 };
4970
4971 PHP.Parser.prototype.yyn234 = function ( attributes ) {
4972 this.yyval = this.Node_Expr_Eval(this.yyastk[ this.stackPos-(4-3) ], attributes);
4973 };
4974
4975 PHP.Parser.prototype.yyn235 = function ( attributes ) {
4976 this.yyval = this.Node_Expr_Include(this.yyastk[ this.stackPos-(2-2) ], "Node_Expr_Require", attributes);
4977 };
4978
4979 PHP.Parser.prototype.yyn236 = function ( attributes ) {
4980 this.yyval = this.Node_Expr_Include(this.yyastk[ this.stackPos-(2-2) ], "Node_Expr_RequireOnce", attributes);
4981 };
4982
4983 PHP.Parser.prototype.yyn237 = function ( attributes ) {
4984 this.yyval = this.Node_Expr_Cast_Int(this.yyastk[ this.stackPos-(2-2) ], attributes);
4985 };
4986
4987 PHP.Parser.prototype.yyn238 = function ( attributes ) {
4988 this.yyval = this.Node_Expr_Cast_Double(this.yyastk[ this.stackPos-(2-2) ], attributes);
4989 };
4990
4991 PHP.Parser.prototype.yyn239 = function ( attributes ) {
4992 this.yyval = this.Node_Expr_Cast_String(this.yyastk[ this.stackPos-(2-2) ], attributes);
4993 };
4994
4995 PHP.Parser.prototype.yyn240 = function ( attributes ) {
4996 this.yyval = this.Node_Expr_Cast_Array(this.yyastk[ this.stackPos-(2-2) ], attributes);
4997 };
4998
4999 PHP.Parser.prototype.yyn241 = function ( attributes ) {
5000 this.yyval = this.Node_Expr_Cast_Object(this.yyastk[ this.stackPos-(2-2) ], attributes);
5001 };
5002
5003 PHP.Parser.prototype.yyn242 = function ( attributes ) {
5004 this.yyval = this.Node_Expr_Cast_Bool(this.yyastk[ this.stackPos-(2-2) ], attributes);
5005 };
5006
5007 PHP.Parser.prototype.yyn243 = function ( attributes ) {
5008 this.yyval = this.Node_Expr_Cast_Unset(this.yyastk[ this.stackPos-(2-2) ], attributes);
5009 };
5010
5011 PHP.Parser.prototype.yyn244 = function ( attributes ) {
5012 this.yyval = this.Node_Expr_Exit(this.yyastk[ this.stackPos-(2-2) ], attributes);
5013 };
5014
5015 PHP.Parser.prototype.yyn245 = function ( attributes ) {
5016 this.yyval = this.Node_Expr_ErrorSuppress(this.yyastk[ this.stackPos-(2-2) ], attributes);
5017 };
5018
5019 PHP.Parser.prototype.yyn246 = function ( attributes ) {
5020 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5021 };
5022
5023 PHP.Parser.prototype.yyn247 = function ( attributes ) {
5024 this.yyval = this.Node_Expr_Array(this.yyastk[ this.stackPos-(4-3) ], attributes);
5025 };
5026
5027 PHP.Parser.prototype.yyn248 = function ( attributes ) {
5028 this.yyval = this.Node_Expr_Array(this.yyastk[ this.stackPos-(3-2) ], attributes);
5029 };
5030
5031 PHP.Parser.prototype.yyn249 = function ( attributes ) {
5032 this.yyval = this.Node_Expr_ShellExec(this.yyastk[ this.stackPos-(3-2) ], attributes);
5033 };
5034
5035 PHP.Parser.prototype.yyn250 = function ( attributes ) {
5036 this.yyval = this.Node_Expr_Print(this.yyastk[ this.stackPos-(2-2) ], attributes);
5037 };
5038
5039 PHP.Parser.prototype.yyn251 = function ( attributes ) {
5040 this.yyval = this.Node_Expr_Closure({'static': false, 'byRef': this.yyastk[ this.stackPos-(9-2) ], 'params': this.yyastk[ this.stackPos-(9-4) ], 'uses': this.yyastk[ this.stackPos-(9-6) ], 'stmts': this.yyastk[ this.stackPos-(9-8) ]}, attributes);
5041 };
5042
5043 PHP.Parser.prototype.yyn252 = function ( attributes ) {
5044 this.yyval = this.Node_Expr_Closure({'static': true, 'byRef': this.yyastk[ this.stackPos-(10-3) ], 'params': this.yyastk[ this.stackPos-(10-5) ], 'uses': this.yyastk[ this.stackPos-(10-7) ], 'stmts': this.yyastk[ this.stackPos-(10-9) ]}, attributes);
5045 };
5046
5047 PHP.Parser.prototype.yyn253 = function ( attributes ) {
5048 this.yyval = this.Node_Expr_New(this.yyastk[ this.stackPos-(3-2) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
5049 };
5050
5051 PHP.Parser.prototype.yyn254 = function ( attributes ) {
5052 this.yyval = [];
5053 };
5054
5055 PHP.Parser.prototype.yyn255 = function ( attributes ) {
5056 this.yyval = this.yyastk[ this.stackPos-(4-3) ];
5057 };
5058
5059 PHP.Parser.prototype.yyn256 = function ( attributes ) {
5060 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
5061 };
5062
5063 PHP.Parser.prototype.yyn257 = function ( attributes ) {
5064 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
5065 };
5066
5067 PHP.Parser.prototype.yyn258 = function ( attributes ) {
5068 this.yyval = this.Node_Expr_ClosureUse(this.yyastk[ this.stackPos-(2-2) ].substring( 1 ), this.yyastk[ this.stackPos-(2-1) ], attributes);
5069 };
5070
5071 PHP.Parser.prototype.yyn259 = function ( attributes ) {
5072 this.yyval = this.Node_Expr_FuncCall(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5073 };
5074
5075 PHP.Parser.prototype.yyn260 = function ( attributes ) {
5076 this.yyval = this.Node_Expr_StaticCall(this.yyastk[ this.stackPos-(6-1) ], this.yyastk[ this.stackPos-(6-3) ], this.yyastk[ this.stackPos-(6-5) ], attributes);
5077 };
5078
5079 PHP.Parser.prototype.yyn261 = function ( attributes ) {
5080 this.yyval = this.Node_Expr_StaticCall(this.yyastk[ this.stackPos-(8-1) ], this.yyastk[ this.stackPos-(8-4) ], this.yyastk[ this.stackPos-(8-7) ], attributes);
5081 };
5082
5083 PHP.Parser.prototype.yyn262 = function ( attributes ) {
5084
5085 if (this.yyastk[ this.stackPos-(4-1) ].type === "Node_Expr_StaticPropertyFetch") {
5086 this.yyval = this.Node_Expr_StaticCall(this.yyastk[ this.stackPos-(4-1) ].Class, this.Node_Expr_Variable(this.yyastk[ this.stackPos-(4-1) ].name, attributes), this.yyastk[ this.stackPos-(4-3) ], attributes);
5087 } else if (this.yyastk[ this.stackPos-(4-1) ].type === "Node_Expr_ArrayDimFetch") {
5088 var tmp = this.yyastk[ this.stackPos-(4-1) ];
5089 while (tmp.variable.type === "Node_Expr_ArrayDimFetch") {
5090 tmp = tmp.variable;
5091 }
5092
5093 this.yyval = this.Node_Expr_StaticCall(tmp.variable.Class, this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5094 tmp.variable = this.Node_Expr_Variable(tmp.variable.name, attributes);
5095 } else {
5096 throw new Exception;
5097 }
5098
5099 };
5100
5101 PHP.Parser.prototype.yyn263 = function ( attributes ) {
5102 this.yyval = this.Node_Expr_FuncCall(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5103 };
5104
5105 PHP.Parser.prototype.yyn264 = function ( attributes ) {
5106 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5107 };
5108
5109 PHP.Parser.prototype.yyn265 = function ( attributes ) {
5110 this.yyval = this.Node_Name('static', attributes);
5111 };
5112
5113 PHP.Parser.prototype.yyn266 = function ( attributes ) {
5114 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5115 };
5116
5117 PHP.Parser.prototype.yyn267 = function ( attributes ) {
5118 this.yyval = this.Node_Name(this.yyastk[ this.stackPos-(1-1) ], attributes);
5119 };
5120
5121 PHP.Parser.prototype.yyn268 = function ( attributes ) {
5122 this.yyval = this.Node_Name_FullyQualified(this.yyastk[ this.stackPos-(2-2) ], attributes);
5123 };
5124
5125 PHP.Parser.prototype.yyn269 = function ( attributes ) {
5126 this.yyval = this.Node_Name_Relative(this.yyastk[ this.stackPos-(3-3) ], attributes);
5127 };
5128
5129 PHP.Parser.prototype.yyn270 = function ( attributes ) {
5130 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5131 };
5132
5133 PHP.Parser.prototype.yyn271 = function ( attributes ) {
5134 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5135 };
5136
5137 PHP.Parser.prototype.yyn272 = function ( attributes ) {
5138 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5139 };
5140
5141 PHP.Parser.prototype.yyn273 = function ( attributes ) {
5142 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5143 };
5144
5145 PHP.Parser.prototype.yyn274 = function ( attributes ) {
5146 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5147 };
5148
5149 PHP.Parser.prototype.yyn275 = function ( attributes ) {
5150 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5151 };
5152
5153 PHP.Parser.prototype.yyn276 = function () {
5154 this.yyval = this.yyastk[ this.stackPos ];
5155 };
5156
5157 PHP.Parser.prototype.yyn277 = function ( attributes ) {
5158 this.yyval = this.Node_Expr_PropertyFetch(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
5159 };
5160
5161 PHP.Parser.prototype.yyn278 = function ( attributes ) {
5162 this.yyval = this.Node_Expr_PropertyFetch(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
5163 };
5164
5165 PHP.Parser.prototype.yyn279 = function ( attributes ) {
5166 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5167 };
5168
5169 PHP.Parser.prototype.yyn280 = function ( attributes ) {
5170 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5171 };
5172
5173 PHP.Parser.prototype.yyn281 = function ( attributes ) {
5174 this.yyval = null;
5175 };
5176
5177 PHP.Parser.prototype.yyn282 = function ( attributes ) {
5178 this.yyval = null;
5179 };
5180
5181 PHP.Parser.prototype.yyn283 = function ( attributes ) {
5182 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
5183 };
5184
5185 PHP.Parser.prototype.yyn284 = function ( attributes ) {
5186 this.yyval = [];
5187 };
5188
5189 PHP.Parser.prototype.yyn285 = function ( attributes ) {
5190 this.yyval = [this.Scalar_String_parseEscapeSequences(this.yyastk[ this.stackPos-(1-1) ], '`')];
5191 };
5192
5193 PHP.Parser.prototype.yyn286 = function ( attributes ) {
5194 ; this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5195 };
5196
5197 PHP.Parser.prototype.yyn287 = function ( attributes ) {
5198 this.yyval = [];
5199 };
5200
5201 PHP.Parser.prototype.yyn288 = function ( attributes ) {
5202 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
5203 };
5204
5205 PHP.Parser.prototype.yyn289 = function ( attributes ) {
5206 this.yyval = this.Node_Scalar_LNumber(this.Scalar_LNumber_parse(this.yyastk[ this.stackPos-(1-1) ]), attributes);
5207 };
5208
5209 PHP.Parser.prototype.yyn290 = function ( attributes ) {
5210 this.yyval = this.Node_Scalar_DNumber(this.Scalar_DNumber_parse(this.yyastk[ this.stackPos-(1-1) ]), attributes);
5211 };
5212
5213 PHP.Parser.prototype.yyn291 = function ( attributes ) {
5214 this.yyval = this.Scalar_String_create(this.yyastk[ this.stackPos-(1-1) ], attributes);
5215 };
5216
5217 PHP.Parser.prototype.yyn292 = function ( attributes ) {
5218 this.yyval = {type: "Node_Scalar_LineConst", attributes: attributes};
5219 };
5220
5221 PHP.Parser.prototype.yyn293 = function ( attributes ) {
5222 this.yyval = {type: "Node_Scalar_FileConst", attributes: attributes};
5223 };
5224
5225 PHP.Parser.prototype.yyn294 = function ( attributes ) {
5226 this.yyval = {type: "Node_Scalar_DirConst", attributes: attributes};
5227 };
5228
5229 PHP.Parser.prototype.yyn295 = function ( attributes ) {
5230 this.yyval = {type: "Node_Scalar_ClassConst", attributes: attributes};
5231 };
5232
5233 PHP.Parser.prototype.yyn296 = function ( attributes ) {
5234 this.yyval = {type: "Node_Scalar_TraitConst", attributes: attributes};
5235 };
5236
5237 PHP.Parser.prototype.yyn297 = function ( attributes ) {
5238 this.yyval = {type: "Node_Scalar_MethodConst", attributes: attributes};
5239 };
5240
5241 PHP.Parser.prototype.yyn298 = function ( attributes ) {
5242 this.yyval = {type: "Node_Scalar_FuncConst", attributes: attributes};
5243 };
5244
5245 PHP.Parser.prototype.yyn299 = function ( attributes ) {
5246 this.yyval = {type: "Node_Scalar_NSConst", attributes: attributes};
5247 };
5248
5249 PHP.Parser.prototype.yyn300 = function ( attributes ) {
5250 this.yyval = this.Node_Scalar_String(this.Scalar_String_parseDocString(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-2) ]), attributes);
5251 };
5252
5253 PHP.Parser.prototype.yyn301 = function ( attributes ) {
5254 this.yyval = this.Node_Scalar_String('', attributes);
5255 };
5256
5257 PHP.Parser.prototype.yyn302 = function ( attributes ) {
5258 this.yyval = this.Node_Expr_ConstFetch(this.yyastk[ this.stackPos-(1-1) ], attributes);
5259 };
5260
5261 PHP.Parser.prototype.yyn303 = function ( attributes ) {
5262 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5263 };
5264
5265 PHP.Parser.prototype.yyn304 = function ( attributes ) {
5266 this.yyval = this.Node_Expr_ClassConstFetch(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
5267 };
5268
5269 PHP.Parser.prototype.yyn305 = function ( attributes ) {
5270 this.yyval = this.Node_Expr_UnaryPlus(this.yyastk[ this.stackPos-(2-2) ], attributes);
5271 };
5272
5273 PHP.Parser.prototype.yyn306 = function ( attributes ) {
5274 this.yyval = this.Node_Expr_UnaryMinus(this.yyastk[ this.stackPos-(2-2) ], attributes);
5275 };
5276
5277 PHP.Parser.prototype.yyn307 = function ( attributes ) {
5278 this.yyval = this.Node_Expr_Array(this.yyastk[ this.stackPos-(4-3) ], attributes);
5279 };
5280
5281 PHP.Parser.prototype.yyn308 = function ( attributes ) {
5282 this.yyval = this.Node_Expr_Array(this.yyastk[ this.stackPos-(3-2) ], attributes);
5283 };
5284
5285 PHP.Parser.prototype.yyn309 = function ( attributes ) {
5286 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5287 };
5288
5289 PHP.Parser.prototype.yyn310 = function ( attributes ) {
5290 this.yyval = this.Node_Expr_ClassConstFetch(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
5291 };
5292
5293 PHP.Parser.prototype.yyn311 = function ( attributes ) {
5294 ; this.yyval = this.Node_Scalar_Encapsed(this.yyastk[ this.stackPos-(3-2) ], attributes);
5295 };
5296
5297 PHP.Parser.prototype.yyn312 = function ( attributes ) {
5298 ; this.yyval = this.Node_Scalar_Encapsed(this.yyastk[ this.stackPos-(3-2) ], attributes);
5299 };
5300
5301 PHP.Parser.prototype.yyn313 = function ( attributes ) {
5302 this.yyval = [];
5303 };
5304
5305 PHP.Parser.prototype.yyn314 = function ( attributes ) {
5306 this.yyval = this.yyastk[ this.stackPos-(2-1) ];
5307 };
5308
5309 PHP.Parser.prototype.yyn315 = function () {
5310 this.yyval = this.yyastk[ this.stackPos ];
5311 };
5312
5313 PHP.Parser.prototype.yyn316 = function () {
5314 this.yyval = this.yyastk[ this.stackPos ];
5315 };
5316
5317 PHP.Parser.prototype.yyn317 = function ( attributes ) {
5318 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
5319 };
5320
5321 PHP.Parser.prototype.yyn318 = function ( attributes ) {
5322 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
5323 };
5324
5325 PHP.Parser.prototype.yyn319 = function ( attributes ) {
5326 this.yyval = this.Node_Expr_ArrayItem(this.yyastk[ this.stackPos-(3-3) ], this.yyastk[ this.stackPos-(3-1) ], false, attributes);
5327 };
5328
5329 PHP.Parser.prototype.yyn320 = function ( attributes ) {
5330 this.yyval = this.Node_Expr_ArrayItem(this.yyastk[ this.stackPos-(1-1) ], null, false, attributes);
5331 };
5332
5333 PHP.Parser.prototype.yyn321 = function ( attributes ) {
5334 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5335 };
5336
5337 PHP.Parser.prototype.yyn322 = function ( attributes ) {
5338 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5339 };
5340
5341 PHP.Parser.prototype.yyn323 = function ( attributes ) {
5342 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5343 };
5344
5345 PHP.Parser.prototype.yyn324 = function ( attributes ) {
5346 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5347 };
5348
5349 PHP.Parser.prototype.yyn325 = function ( attributes ) {
5350 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(6-2) ], this.yyastk[ this.stackPos-(6-5) ], attributes);
5351 };
5352
5353 PHP.Parser.prototype.yyn326 = function ( attributes ) {
5354 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5355 };
5356
5357 PHP.Parser.prototype.yyn327 = function ( attributes ) {
5358 this.yyval = this.Node_Expr_PropertyFetch(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ], attributes);
5359 };
5360
5361 PHP.Parser.prototype.yyn328 = function ( attributes ) {
5362 this.yyval = this.Node_Expr_MethodCall(this.yyastk[ this.stackPos-(6-1) ], this.yyastk[ this.stackPos-(6-3) ], this.yyastk[ this.stackPos-(6-5) ], attributes);
5363 };
5364
5365 PHP.Parser.prototype.yyn329 = function ( attributes ) {
5366 this.yyval = this.Node_Expr_FuncCall(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5367 };
5368
5369 PHP.Parser.prototype.yyn330 = function ( attributes ) {
5370 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5371 };
5372
5373 PHP.Parser.prototype.yyn331 = function ( attributes ) {
5374 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5375 };
5376
5377 PHP.Parser.prototype.yyn332 = function ( attributes ) {
5378 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5379 };
5380
5381 PHP.Parser.prototype.yyn333 = function ( attributes ) {
5382 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
5383 };
5384
5385 PHP.Parser.prototype.yyn334 = function ( attributes ) {
5386 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5387 };
5388
5389 PHP.Parser.prototype.yyn335 = function ( attributes ) {
5390 this.yyval = this.Node_Expr_Variable(this.yyastk[ this.stackPos-(2-2) ], attributes);
5391 };
5392
5393 PHP.Parser.prototype.yyn336 = function ( attributes ) {
5394 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5395 };
5396
5397 PHP.Parser.prototype.yyn337 = function ( attributes ) {
5398 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5399 };
5400
5401 PHP.Parser.prototype.yyn338 = function ( attributes ) {
5402 this.yyval = this.Node_Expr_StaticPropertyFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-4) ], attributes);
5403 };
5404
5405 PHP.Parser.prototype.yyn339 = function ( attributes ) {
5406 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5407 };
5408
5409 PHP.Parser.prototype.yyn340 = function ( attributes ) {
5410 this.yyval = this.Node_Expr_StaticPropertyFetch(this.yyastk[ this.stackPos-(3-1) ], this.yyastk[ this.stackPos-(3-3) ].substring( 1 ), attributes);
5411 };
5412
5413 PHP.Parser.prototype.yyn341 = function ( attributes ) {
5414 this.yyval = this.Node_Expr_StaticPropertyFetch(this.yyastk[ this.stackPos-(6-1) ], this.yyastk[ this.stackPos-(6-5) ], attributes);
5415 };
5416
5417 PHP.Parser.prototype.yyn342 = function ( attributes ) {
5418 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5419 };
5420
5421 PHP.Parser.prototype.yyn343 = function ( attributes ) {
5422 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5423 };
5424
5425 PHP.Parser.prototype.yyn344 = function ( attributes ) {
5426 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5427 };
5428
5429 PHP.Parser.prototype.yyn345 = function ( attributes ) {
5430 this.yyval = this.Node_Expr_ArrayDimFetch(this.yyastk[ this.stackPos-(4-1) ], this.yyastk[ this.stackPos-(4-3) ], attributes);
5431 };
5432
5433 PHP.Parser.prototype.yyn346 = function ( attributes ) {
5434 this.yyval = this.Node_Expr_Variable(this.yyastk[ this.stackPos-(1-1) ].substring( 1 ), attributes);
5435 };
5436
5437 PHP.Parser.prototype.yyn347 = function ( attributes ) {
5438 this.yyval = this.Node_Expr_Variable(this.yyastk[ this.stackPos-(4-3) ], attributes);
5439 };
5440
5441 PHP.Parser.prototype.yyn348 = function ( attributes ) {
5442 this.yyval = null;
5443 };
5444
5445 PHP.Parser.prototype.yyn349 = function ( attributes ) {
5446 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5447 };
5448
5449 PHP.Parser.prototype.yyn350 = function ( attributes ) {
5450 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5451 };
5452
5453 PHP.Parser.prototype.yyn351 = function ( attributes ) {
5454 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
5455 };
5456
5457 PHP.Parser.prototype.yyn352 = function ( attributes ) {
5458 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5459 };
5460
5461 PHP.Parser.prototype.yyn353 = function ( attributes ) {
5462 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
5463 };
5464
5465 PHP.Parser.prototype.yyn354 = function ( attributes ) {
5466 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
5467 };
5468
5469 PHP.Parser.prototype.yyn355 = function ( attributes ) {
5470 this.yyval = this.yyastk[ this.stackPos-(1-1) ];
5471 };
5472
5473 PHP.Parser.prototype.yyn356 = function ( attributes ) {
5474 this.yyval = this.yyastk[ this.stackPos-(4-3) ];
5475 };
5476
5477 PHP.Parser.prototype.yyn357 = function ( attributes ) {
5478 this.yyval = null;
5479 };
5480
5481 PHP.Parser.prototype.yyn358 = function ( attributes ) {
5482 this.yyval = [];
5483 };
5484
5485 PHP.Parser.prototype.yyn359 = function ( attributes ) {
5486 this.yyval = this.yyastk[ this.stackPos-(2-1) ];
5487 };
5488
5489 PHP.Parser.prototype.yyn360 = function ( attributes ) {
5490 this.yyastk[ this.stackPos-(3-1) ].push( this.yyastk[ this.stackPos-(3-3) ] ); this.yyval = this.yyastk[ this.stackPos-(3-1) ];
5491 };
5492
5493 PHP.Parser.prototype.yyn361 = function ( attributes ) {
5494 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
5495 };
5496
5497 PHP.Parser.prototype.yyn362 = function ( attributes ) {
5498 this.yyval = this.Node_Expr_ArrayItem(this.yyastk[ this.stackPos-(3-3) ], this.yyastk[ this.stackPos-(3-1) ], false, attributes);
5499 };
5500
5501 PHP.Parser.prototype.yyn363 = function ( attributes ) {
5502 this.yyval = this.Node_Expr_ArrayItem(this.yyastk[ this.stackPos-(1-1) ], null, false, attributes);
5503 };
5504
5505 PHP.Parser.prototype.yyn364 = function ( attributes ) {
5506 this.yyval = this.Node_Expr_ArrayItem(this.yyastk[ this.stackPos-(4-4) ], this.yyastk[ this.stackPos-(4-1) ], true, attributes);
5507 };
5508
5509 PHP.Parser.prototype.yyn365 = function ( attributes ) {
5510 this.yyval = this.Node_Expr_ArrayItem(this.yyastk[ this.stackPos-(2-2) ], null, true, attributes);
5511 };
5512
5513 PHP.Parser.prototype.yyn366 = function ( attributes ) {
5514 this.yyastk[ this.stackPos-(2-1) ].push( this.yyastk[ this.stackPos-(2-2) ] ); this.yyval = this.yyastk[ this.stackPos-(2-1) ];
5515 };
5516
5517 PHP.Parser.prototype.yyn367 = function ( attributes ) {
5518 this.yyastk[ this.stackPos-(2-1) ].push( this.yyastk[ this.stackPos-(2-2) ] ); this.yyval = this.yyastk[ this.stackPos-(2-1) ];
5519 };
5520
5521 PHP.Parser.prototype.yyn368 = function ( attributes ) {
5522 this.yyval = [this.yyastk[ this.stackPos-(1-1) ]];
5523 };
5524
5525 PHP.Parser.prototype.yyn369 = function ( attributes ) {
5526 this.yyval = [this.yyastk[ this.stackPos-(2-1) ], this.yyastk[ this.stackPos-(2-2) ]];
5527 };
5528
5529 PHP.Parser.prototype.yyn370 = function ( attributes ) {
5530 this.yyval = this.Node_Expr_Variable(this.yyastk[ this.stackPos-(1-1) ].substring( 1 ), attributes);
5531 };
5532
5533 PHP.Parser.prototype.yyn371 = function ( attributes ) {
5534 this.yyval = this.Node_Expr_ArrayDimFetch(this.Node_Expr_Variable(this.yyastk[ this.stackPos-(4-1) ].substring( 1 ), attributes), this.yyastk[ this.stackPos-(4-3) ], attributes);
5535 };
5536
5537 PHP.Parser.prototype.yyn372 = function ( attributes ) {
5538 this.yyval = this.Node_Expr_PropertyFetch(this.Node_Expr_Variable(this.yyastk[ this.stackPos-(3-1) ].substring( 1 ), attributes), this.yyastk[ this.stackPos-(3-3) ], attributes);
5539 };
5540
5541 PHP.Parser.prototype.yyn373 = function ( attributes ) {
5542 this.yyval = this.Node_Expr_Variable(this.yyastk[ this.stackPos-(3-2) ], attributes);
5543 };
5544
5545 PHP.Parser.prototype.yyn374 = function ( attributes ) {
5546 this.yyval = this.Node_Expr_Variable(this.yyastk[ this.stackPos-(3-2) ], attributes);
5547 };
5548
5549 PHP.Parser.prototype.yyn375 = function ( attributes ) {
5550 this.yyval = this.Node_Expr_ArrayDimFetch(this.Node_Expr_Variable(this.yyastk[ this.stackPos-(6-2) ], attributes), this.yyastk[ this.stackPos-(6-4) ], attributes);
5551 };
5552
5553 PHP.Parser.prototype.yyn376 = function ( attributes ) {
5554 this.yyval = this.yyastk[ this.stackPos-(3-2) ];
5555 };
5556
5557 PHP.Parser.prototype.yyn377 = function ( attributes ) {
5558 this.yyval = this.Node_Scalar_String(this.yyastk[ this.stackPos-(1-1) ], attributes);
5559 };
5560
5561 PHP.Parser.prototype.yyn378 = function ( attributes ) {
5562 this.yyval = this.Node_Scalar_String(this.yyastk[ this.stackPos-(1-1) ], attributes);
5563 };
5564
5565 PHP.Parser.prototype.yyn379 = function ( attributes ) {
5566 this.yyval = this.Node_Expr_Variable(this.yyastk[ this.stackPos-(1-1) ].substring( 1 ), attributes);
5567 };
5568
5569
5570 PHP.Parser.prototype.Stmt_Namespace_postprocess = function( a ) {
5571 return a;
5572 };
5573
5574
5575 PHP.Parser.prototype.Node_Stmt_Echo = function() {
5576 return {
5577 type: "Node_Stmt_Echo",
5578 exprs: arguments[ 0 ],
5579 attributes: arguments[ 1 ]
5580 };
5581
5582 };
5583
5584
5585 PHP.Parser.prototype.Node_Stmt_If = function() {
5586 return {
5587 type: "Node_Stmt_If",
5588 cond: arguments[ 0 ],
5589 stmts: arguments[ 1 ].stmts,
5590 elseifs: arguments[ 1 ].elseifs,
5591 Else: arguments[ 1 ].Else || null,
5592 attributes: arguments[ 2 ]
5593 };
5594
5595 };
5596
5597
5598 PHP.Parser.prototype.Node_Stmt_For = function() {
5599
5600 return {
5601 type: "Node_Stmt_For",
5602 init: arguments[ 0 ].init,
5603 cond: arguments[ 0 ].cond,
5604 loop: arguments[ 0 ].loop,
5605 stmts: arguments[ 0 ].stmts,
5606 attributes: arguments[ 1 ]
5607 };
5608
5609 };
5610
5611 PHP.Parser.prototype.Node_Stmt_Function = function() {
5612 return {
5613 type: "Node_Stmt_Function",
5614 name: arguments[ 0 ],
5615 byRef: arguments[ 1 ].byRef,
5616 params: arguments[ 1 ].params,
5617 stmts: arguments[ 1 ].stmts,
5618 attributes: arguments[ 2 ]
5619 };
5620
5621 };
5622
5623 PHP.Parser.prototype.Stmt_Class_verifyModifier = function() {
5624
5625
5626 };
5627
5628 PHP.Parser.prototype.Node_Stmt_Class = function() {
5629 return {
5630 type: "Node_Stmt_Class",
5631 name: arguments[ 0 ],
5632 Type: arguments[ 1 ].type,
5633 Extends: arguments[ 1 ].Extends,
5634 Implements: arguments[ 1 ].Implements,
5635 stmts: arguments[ 1 ].stmts,
5636 attributes: arguments[ 2 ]
5637 };
5638
5639 };
5640
5641 PHP.Parser.prototype.Node_Stmt_ClassMethod = function() {
5642 return {
5643 type: "Node_Stmt_ClassMethod",
5644 name: arguments[ 0 ],
5645 Type: arguments[ 1 ].type,
5646 byRef: arguments[ 1 ].byRef,
5647 params: arguments[ 1 ].params,
5648 stmts: arguments[ 1 ].stmts,
5649 attributes: arguments[ 2 ]
5650 };
5651
5652 };
5653
5654
5655 PHP.Parser.prototype.Node_Stmt_ClassConst = function() {
5656 return {
5657 type: "Node_Stmt_ClassConst",
5658 consts: arguments[ 0 ],
5659 attributes: arguments[ 1 ]
5660 };
5661
5662 };
5663
5664 PHP.Parser.prototype.Node_Stmt_Interface = function() {
5665 return {
5666 type: "Node_Stmt_Interface",
5667 name: arguments[ 0 ],
5668 Extends: arguments[ 1 ].Extends,
5669 stmts: arguments[ 1 ].stmts,
5670 attributes: arguments[ 2 ]
5671 };
5672
5673 };
5674
5675 PHP.Parser.prototype.Node_Stmt_Throw = function() {
5676 return {
5677 type: "Node_Stmt_Throw",
5678 expr: arguments[ 0 ],
5679 attributes: arguments[ 1 ]
5680 };
5681
5682 };
5683
5684 PHP.Parser.prototype.Node_Stmt_Catch = function() {
5685 return {
5686 type: "Node_Stmt_Catch",
5687 Type: arguments[ 0 ],
5688 variable: arguments[ 1 ],
5689 stmts: arguments[ 2 ],
5690 attributes: arguments[ 3 ]
5691 };
5692
5693 };
5694
5695
5696 PHP.Parser.prototype.Node_Stmt_TryCatch = function() {
5697 return {
5698 type: "Node_Stmt_TryCatch",
5699 stmts: arguments[ 0 ],
5700 catches: arguments[ 1 ],
5701 attributes: arguments[ 2 ]
5702 };
5703
5704 };
5705
5706
5707 PHP.Parser.prototype.Node_Stmt_Foreach = function() {
5708 return {
5709 type: "Node_Stmt_Foreach",
5710 expr: arguments[ 0 ],
5711 valueVar: arguments[ 1 ],
5712 keyVar: arguments[ 2 ].keyVar,
5713 byRef: arguments[ 2 ].byRef,
5714 stmts: arguments[ 2 ].stmts,
5715 attributes: arguments[ 3 ]
5716 };
5717
5718 };
5719
5720 PHP.Parser.prototype.Node_Stmt_While = function() {
5721 return {
5722 type: "Node_Stmt_While",
5723 cond: arguments[ 0 ],
5724 stmts: arguments[ 1 ],
5725 attributes: arguments[ 2 ]
5726 };
5727
5728 };
5729
5730 PHP.Parser.prototype.Node_Stmt_Do = function() {
5731 return {
5732 type: "Node_Stmt_Do",
5733 cond: arguments[ 0 ],
5734 stmts: arguments[ 1 ],
5735 attributes: arguments[ 2 ]
5736 };
5737
5738 };
5739
5740 PHP.Parser.prototype.Node_Stmt_Break = function() {
5741 return {
5742 type: "Node_Stmt_Break",
5743 num: arguments[ 0 ],
5744 attributes: arguments[ 1 ]
5745 };
5746
5747 };
5748
5749 PHP.Parser.prototype.Node_Stmt_Continue = function() {
5750 return {
5751 type: "Node_Stmt_Continue",
5752 num: arguments[ 0 ],
5753 attributes: arguments[ 1 ]
5754 };
5755
5756 };
5757
5758 PHP.Parser.prototype.Node_Stmt_Return = function() {
5759 return {
5760 type: "Node_Stmt_Return",
5761 expr: arguments[ 0 ],
5762 attributes: arguments[ 1 ]
5763 };
5764
5765 };
5766
5767 PHP.Parser.prototype.Node_Stmt_Case = function() {
5768 return {
5769 type: "Node_Stmt_Case",
5770 cond: arguments[ 0 ],
5771 stmts: arguments[ 1 ],
5772 attributes: arguments[ 2 ]
5773 };
5774
5775 };
5776
5777 PHP.Parser.prototype.Node_Stmt_Switch = function() {
5778 return {
5779 type: "Node_Stmt_Switch",
5780 cond: arguments[ 0 ],
5781 cases: arguments[ 1 ],
5782 attributes: arguments[ 2 ]
5783 };
5784
5785 };
5786
5787 PHP.Parser.prototype.Node_Stmt_Else = function() {
5788
5789 return {
5790 type: "Node_Stmt_Else",
5791 stmts: arguments[ 0 ],
5792 attributes: arguments[ 1 ]
5793 };
5794
5795 };
5796
5797 PHP.Parser.prototype.Node_Stmt_ElseIf = function() {
5798 return {
5799 type: "Node_Stmt_ElseIf",
5800 cond: arguments[ 0 ],
5801 stmts: arguments[ 1 ],
5802 attributes: arguments[ 1 ]
5803 };
5804
5805 };
5806
5807 PHP.Parser.prototype.Node_Stmt_InlineHTML = function() {
5808 return {
5809 type: "Node_Stmt_InlineHTML",
5810 value: arguments[ 0 ],
5811 attributes: arguments[ 1 ]
5812 };
5813
5814 };
5815
5816
5817 PHP.Parser.prototype.Node_Stmt_StaticVar = function() {
5818 return {
5819 type: "Node_Stmt_StaticVar",
5820 name: arguments[ 0 ],
5821 def: arguments[ 1 ],
5822 attributes: arguments[ 2 ]
5823 };
5824
5825 };
5826
5827
5828 PHP.Parser.prototype.Node_Stmt_Static = function() {
5829 return {
5830 type: "Node_Stmt_Static",
5831 vars: arguments[ 0 ],
5832 attributes: arguments[ 1 ]
5833 };
5834
5835 };
5836
5837 PHP.Parser.prototype.Node_Stmt_Global = function() {
5838 return {
5839 type: "Node_Stmt_Global",
5840 vars: arguments[ 0 ],
5841 attributes: arguments[ 1 ]
5842 };
5843
5844 };
5845
5846
5847 PHP.Parser.prototype.Node_Stmt_PropertyProperty = function() {
5848 return {
5849 type: "Node_Stmt_PropertyProperty",
5850 name: arguments[ 0 ],
5851 def: arguments[ 1 ],
5852 attributes: arguments[ 2 ]
5853 };
5854
5855 };
5856
5857
5858 PHP.Parser.prototype.Node_Stmt_Property = function() {
5859 return {
5860 type: "Node_Stmt_Property",
5861 Type: arguments[ 0 ],
5862 props: arguments[ 1 ],
5863 attributes: arguments[ 2 ]
5864 };
5865
5866 };
5867
5868 PHP.Parser.prototype.Node_Stmt_Unset = function() {
5869 return {
5870 type: "Node_Stmt_Unset",
5871 variables: arguments[ 0 ],
5872 attributes: arguments[ 1 ]
5873 };
5874
5875 };
5876
5877
5878 PHP.Parser.prototype.Node_Expr_Variable = function( a ) {
5879 return {
5880 type: "Node_Expr_Variable",
5881 name: arguments[ 0 ],
5882 attributes: arguments[ 1 ]
5883 };
5884 };
5885
5886 PHP.Parser.prototype.Node_Expr_FuncCall = function() {
5887
5888 return {
5889 type: "Node_Expr_FuncCall",
5890 func: arguments[ 0 ],
5891 args: arguments[ 1 ],
5892 attributes: arguments[ 2 ]
5893 };
5894
5895 };
5896
5897 PHP.Parser.prototype.Node_Expr_MethodCall = function() {
5898
5899 return {
5900 type: "Node_Expr_MethodCall",
5901 variable: arguments[ 0 ],
5902 name: arguments[ 1 ],
5903 args: arguments[ 2 ],
5904 attributes: arguments[ 3 ]
5905 };
5906
5907 };
5908
5909 PHP.Parser.prototype.Node_Expr_StaticCall = function() {
5910
5911 return {
5912 type: "Node_Expr_StaticCall",
5913 Class: arguments[ 0 ],
5914 func: arguments[ 1 ],
5915 args: arguments[ 2 ],
5916 attributes: arguments[ 3 ]
5917 };
5918
5919 };
5920
5921
5922 PHP.Parser.prototype.Node_Expr_Ternary = function() {
5923
5924 return {
5925 type: "Node_Expr_Ternary",
5926 cond: arguments[ 0 ],
5927 If: arguments[ 1 ],
5928 Else: arguments[ 2 ],
5929 attributes: arguments[ 3 ]
5930 };
5931
5932 };
5933
5934 PHP.Parser.prototype.Node_Expr_AssignList = function() {
5935
5936 return {
5937 type: "Node_Expr_AssignList",
5938 assignList: arguments[ 0 ],
5939 expr: arguments[ 1 ],
5940 attributes: arguments[ 2 ]
5941 };
5942
5943 };
5944
5945
5946 PHP.Parser.prototype.Node_Expr_Assign = function() {
5947
5948 return {
5949 type: "Node_Expr_Assign",
5950 variable: arguments[ 0 ],
5951 expr: arguments[ 1 ],
5952 attributes: arguments[ 2 ]
5953 };
5954
5955 };
5956
5957 PHP.Parser.prototype.Node_Expr_AssignConcat = function() {
5958
5959 return {
5960 type: "Node_Expr_AssignConcat",
5961 variable: arguments[ 0 ],
5962 expr: arguments[ 1 ],
5963 attributes: arguments[ 2 ]
5964 };
5965
5966 };
5967
5968 PHP.Parser.prototype.Node_Expr_AssignMinus = function() {
5969
5970 return {
5971 type: "Node_Expr_AssignMinus",
5972 variable: arguments[ 0 ],
5973 expr: arguments[ 1 ],
5974 attributes: arguments[ 2 ]
5975 };
5976
5977 };
5978
5979 PHP.Parser.prototype.Node_Expr_AssignPlus = function() {
5980
5981 return {
5982 type: "Node_Expr_AssignPlus",
5983 variable: arguments[ 0 ],
5984 expr: arguments[ 1 ],
5985 attributes: arguments[ 2 ]
5986 };
5987
5988 };
5989
5990 PHP.Parser.prototype.Node_Expr_AssignDiv = function() {
5991
5992 return {
5993 type: "Node_Expr_AssignDiv",
5994 variable: arguments[ 0 ],
5995 expr: arguments[ 1 ],
5996 attributes: arguments[ 2 ]
5997 };
5998
5999 };
6000
6001 PHP.Parser.prototype.Node_Expr_AssignRef = function() {
6002
6003 return {
6004 type: "Node_Expr_AssignRef",
6005 variable: arguments[ 0 ],
6006 refVar: arguments[ 1 ],
6007 attributes: arguments[ 2 ]
6008 };
6009
6010 };
6011
6012 PHP.Parser.prototype.Node_Expr_AssignMul = function() {
6013
6014 return {
6015 type: "Node_Expr_AssignMul",
6016 variable: arguments[ 0 ],
6017 expr: arguments[ 1 ],
6018 attributes: arguments[ 2 ]
6019 };
6020
6021 };
6022
6023 PHP.Parser.prototype.Node_Expr_AssignMod = function() {
6024
6025 return {
6026 type: "Node_Expr_AssignMod",
6027 variable: arguments[ 0 ],
6028 expr: arguments[ 1 ],
6029 attributes: arguments[ 2 ]
6030 };
6031
6032 };
6033
6034 PHP.Parser.prototype.Node_Expr_Plus = function() {
6035
6036 return {
6037 type: "Node_Expr_Plus",
6038 left: arguments[ 0 ],
6039 right: arguments[ 1 ],
6040 attributes: arguments[ 2 ]
6041 };
6042
6043 };
6044
6045 PHP.Parser.prototype.Node_Expr_Minus = function() {
6046
6047 return {
6048 type: "Node_Expr_Minus",
6049 left: arguments[ 0 ],
6050 right: arguments[ 1 ],
6051 attributes: arguments[ 2 ]
6052 };
6053
6054 };
6055
6056
6057 PHP.Parser.prototype.Node_Expr_Mul = function() {
6058
6059 return {
6060 type: "Node_Expr_Mul",
6061 left: arguments[ 0 ],
6062 right: arguments[ 1 ],
6063 attributes: arguments[ 2 ]
6064 };
6065
6066 };
6067
6068
6069 PHP.Parser.prototype.Node_Expr_Div = function() {
6070
6071 return {
6072 type: "Node_Expr_Div",
6073 left: arguments[ 0 ],
6074 right: arguments[ 1 ],
6075 attributes: arguments[ 2 ]
6076 };
6077
6078 };
6079
6080
6081 PHP.Parser.prototype.Node_Expr_Mod = function() {
6082
6083 return {
6084 type: "Node_Expr_Mod",
6085 left: arguments[ 0 ],
6086 right: arguments[ 1 ],
6087 attributes: arguments[ 2 ]
6088 };
6089
6090 };
6091
6092 PHP.Parser.prototype.Node_Expr_Greater = function() {
6093
6094 return {
6095 type: "Node_Expr_Greater",
6096 left: arguments[ 0 ],
6097 right: arguments[ 1 ],
6098 attributes: arguments[ 2 ]
6099 };
6100
6101 };
6102
6103 PHP.Parser.prototype.Node_Expr_Equal = function() {
6104
6105 return {
6106 type: "Node_Expr_Equal",
6107 left: arguments[ 0 ],
6108 right: arguments[ 1 ],
6109 attributes: arguments[ 2 ]
6110 };
6111
6112 };
6113
6114 PHP.Parser.prototype.Node_Expr_NotEqual = function() {
6115
6116 return {
6117 type: "Node_Expr_NotEqual",
6118 left: arguments[ 0 ],
6119 right: arguments[ 1 ],
6120 attributes: arguments[ 2 ]
6121 };
6122
6123 };
6124
6125
6126 PHP.Parser.prototype.Node_Expr_Identical = function() {
6127
6128 return {
6129 type: "Node_Expr_Identical",
6130 left: arguments[ 0 ],
6131 right: arguments[ 1 ],
6132 attributes: arguments[ 2 ]
6133 };
6134
6135 };
6136
6137
6138 PHP.Parser.prototype.Node_Expr_NotIdentical = function() {
6139
6140 return {
6141 type: "Node_Expr_NotIdentical",
6142 left: arguments[ 0 ],
6143 right: arguments[ 1 ],
6144 attributes: arguments[ 2 ]
6145 };
6146
6147 };
6148
6149 PHP.Parser.prototype.Node_Expr_GreaterOrEqual = function() {
6150
6151 return {
6152 type: "Node_Expr_GreaterOrEqual",
6153 left: arguments[ 0 ],
6154 right: arguments[ 1 ],
6155 attributes: arguments[ 2 ]
6156 };
6157
6158 };
6159
6160 PHP.Parser.prototype.Node_Expr_SmallerOrEqual = function() {
6161
6162 return {
6163 type: "Node_Expr_SmallerOrEqual",
6164 left: arguments[ 0 ],
6165 right: arguments[ 1 ],
6166 attributes: arguments[ 2 ]
6167 };
6168
6169 };
6170
6171 PHP.Parser.prototype.Node_Expr_Concat = function() {
6172
6173 return {
6174 type: "Node_Expr_Concat",
6175 left: arguments[ 0 ],
6176 right: arguments[ 1 ],
6177 attributes: arguments[ 2 ]
6178 };
6179
6180 };
6181
6182 PHP.Parser.prototype.Node_Expr_Smaller = function() {
6183
6184 return {
6185 type: "Node_Expr_Smaller",
6186 left: arguments[ 0 ],
6187 right: arguments[ 1 ],
6188 attributes: arguments[ 2 ]
6189 };
6190
6191 };
6192
6193 PHP.Parser.prototype.Node_Expr_PostInc = function() {
6194
6195 return {
6196 type: "Node_Expr_PostInc",
6197 variable: arguments[ 0 ],
6198 attributes: arguments[ 1 ]
6199 };
6200
6201 };
6202
6203 PHP.Parser.prototype.Node_Expr_PostDec = function() {
6204
6205 return {
6206 type: "Node_Expr_PostDec",
6207 variable: arguments[ 0 ],
6208 attributes: arguments[ 1 ]
6209 };
6210
6211 };
6212
6213 PHP.Parser.prototype.Node_Expr_PreInc = function() {
6214
6215 return {
6216 type: "Node_Expr_PreInc",
6217 variable: arguments[ 0 ],
6218 attributes: arguments[ 1 ]
6219 };
6220
6221 };
6222
6223 PHP.Parser.prototype.Node_Expr_PreDec = function() {
6224
6225 return {
6226 type: "Node_Expr_PreDec",
6227 variable: arguments[ 0 ],
6228 attributes: arguments[ 1 ]
6229 };
6230
6231 };
6232
6233 PHP.Parser.prototype.Node_Expr_Include = function() {
6234 return {
6235 expr: arguments[ 0 ],
6236 type: arguments[ 1 ],
6237 attributes: arguments[ 2 ]
6238 };
6239 };
6240
6241 PHP.Parser.prototype.Node_Expr_ArrayDimFetch = function() {
6242
6243 return {
6244 type: "Node_Expr_ArrayDimFetch",
6245 variable: arguments[ 0 ],
6246 dim: arguments[ 1 ],
6247 attributes: arguments[ 2 ]
6248 };
6249
6250 };
6251
6252 PHP.Parser.prototype.Node_Expr_StaticPropertyFetch = function() {
6253
6254 return {
6255 type: "Node_Expr_StaticPropertyFetch",
6256 Class: arguments[ 0 ],
6257 name: arguments[ 1 ],
6258 attributes: arguments[ 2 ]
6259 };
6260
6261 };
6262
6263 PHP.Parser.prototype.Node_Expr_ClassConstFetch = function() {
6264
6265 return {
6266 type: "Node_Expr_ClassConstFetch",
6267 Class: arguments[ 0 ],
6268 name: arguments[ 1 ],
6269 attributes: arguments[ 2 ]
6270 };
6271
6272 };
6273
6274
6275 PHP.Parser.prototype.Node_Expr_StaticPropertyFetch = function() {
6276
6277 return {
6278 type: "Node_Expr_StaticPropertyFetch",
6279 Class: arguments[ 0 ],
6280 name: arguments[ 1 ],
6281 attributes: arguments[ 2 ]
6282 };
6283
6284 };
6285
6286 PHP.Parser.prototype.Node_Expr_ConstFetch = function() {
6287
6288 return {
6289 type: "Node_Expr_ConstFetch",
6290 name: arguments[ 0 ],
6291 attributes: arguments[ 1 ]
6292 };
6293
6294 };
6295
6296 PHP.Parser.prototype.Node_Expr_ArrayItem = function() {
6297
6298 return {
6299 type: "Node_Expr_ArrayItem",
6300 value: arguments[ 0 ],
6301 key: arguments[ 1 ],
6302 byRef: arguments[ 2 ],
6303 attributes: arguments[ 3 ]
6304 };
6305
6306 };
6307
6308 PHP.Parser.prototype.Node_Expr_Array = function() {
6309
6310 return {
6311 type: "Node_Expr_Array",
6312 items: arguments[ 0 ],
6313 attributes: arguments[ 1 ]
6314 };
6315
6316 };
6317
6318 PHP.Parser.prototype.Node_Expr_PropertyFetch = function() {
6319
6320 return {
6321 type: "Node_Expr_PropertyFetch",
6322 variable: arguments[ 0 ],
6323 name: arguments[ 1 ],
6324 attributes: arguments[ 2 ]
6325 };
6326
6327 };
6328
6329 PHP.Parser.prototype.Node_Expr_New = function() {
6330
6331 return {
6332 type: "Node_Expr_New",
6333 Class: arguments[ 0 ],
6334 args: arguments[ 1 ],
6335 attributes: arguments[ 2 ]
6336 };
6337
6338 };
6339
6340
6341 PHP.Parser.prototype.Node_Expr_Print = function() {
6342 return {
6343 type: "Node_Expr_Print",
6344 expr: arguments[ 0 ],
6345 attributes: arguments[ 1 ]
6346 };
6347
6348 };
6349
6350
6351 PHP.Parser.prototype.Node_Expr_Exit = function() {
6352 return {
6353 type: "Node_Expr_Exit",
6354 expr: arguments[ 0 ],
6355 attributes: arguments[ 1 ]
6356 };
6357
6358 };
6359
6360
6361 PHP.Parser.prototype.Node_Expr_Cast_Bool = function() {
6362 return {
6363 type: "Node_Expr_Cast_Bool",
6364 expr: arguments[ 0 ],
6365 attributes: arguments[ 1 ]
6366 };
6367
6368 };
6369
6370 PHP.Parser.prototype.Node_Expr_Cast_Int = function() {
6371 return {
6372 type: "Node_Expr_Cast_Int",
6373 expr: arguments[ 0 ],
6374 attributes: arguments[ 1 ]
6375 };
6376
6377 };
6378
6379 PHP.Parser.prototype.Node_Expr_Cast_String = function() {
6380 return {
6381 type: "Node_Expr_Cast_String",
6382 expr: arguments[ 0 ],
6383 attributes: arguments[ 1 ]
6384 };
6385
6386 };
6387
6388 PHP.Parser.prototype.Node_Expr_Cast_Double = function() {
6389 return {
6390 type: "Node_Expr_Cast_Double",
6391 expr: arguments[ 0 ],
6392 attributes: arguments[ 1 ]
6393 };
6394
6395 };
6396
6397 PHP.Parser.prototype.Node_Expr_Cast_Array = function() {
6398 return {
6399 type: "Node_Expr_Cast_Array",
6400 expr: arguments[ 0 ],
6401 attributes: arguments[ 1 ]
6402 };
6403
6404 };
6405
6406 PHP.Parser.prototype.Node_Expr_Cast_Object = function() {
6407 return {
6408 type: "Node_Expr_Cast_Object",
6409 expr: arguments[ 0 ],
6410 attributes: arguments[ 1 ]
6411 };
6412
6413 };
6414
6415
6416 PHP.Parser.prototype.Node_Expr_ErrorSuppress = function() {
6417 return {
6418 type: "Node_Expr_ErrorSuppress",
6419 expr: arguments[ 0 ],
6420 attributes: arguments[ 1 ]
6421 };
6422
6423 };
6424
6425
6426 PHP.Parser.prototype.Node_Expr_Isset = function() {
6427 return {
6428 type: "Node_Expr_Isset",
6429 variables: arguments[ 0 ],
6430 attributes: arguments[ 1 ]
6431 };
6432
6433 };
6434
6435
6436
6437
6438 PHP.Parser.prototype.Node_Expr_UnaryMinus = function() {
6439 return {
6440 type: "Node_Expr_UnaryMinus",
6441 expr: arguments[ 0 ],
6442 attributes: arguments[ 1 ]
6443 };
6444
6445 };
6446
6447
6448 PHP.Parser.prototype.Node_Expr_UnaryPlus = function() {
6449 return {
6450 type: "Node_Expr_UnaryPlus",
6451 expr: arguments[ 0 ],
6452 attributes: arguments[ 1 ]
6453 };
6454
6455 };
6456
6457 PHP.Parser.prototype.Node_Expr_Empty = function() {
6458 return {
6459 type: "Node_Expr_Empty",
6460 variable: arguments[ 0 ],
6461 attributes: arguments[ 1 ]
6462 };
6463
6464 };
6465
6466 PHP.Parser.prototype.Node_Expr_BooleanOr = function() {
6467 return {
6468 type: "Node_Expr_BooleanOr",
6469 left: arguments[ 0 ],
6470 right: arguments[ 1 ],
6471 attributes: arguments[ 2 ]
6472 };
6473
6474 };
6475
6476 PHP.Parser.prototype.Node_Expr_LogicalOr = function() {
6477 return {
6478 type: "Node_Expr_LogicalOr",
6479 left: arguments[ 0 ],
6480 right: arguments[ 1 ],
6481 attributes: arguments[ 2 ]
6482 };
6483
6484 };
6485
6486 PHP.Parser.prototype.Node_Expr_LogicalAnd = function() {
6487 return {
6488 type: "Node_Expr_LogicalAnd",
6489 left: arguments[ 0 ],
6490 right: arguments[ 1 ],
6491 attributes: arguments[ 2 ]
6492 };
6493
6494 };
6495
6496
6497 PHP.Parser.prototype.Node_Expr_LogicalXor = function() {
6498 return {
6499 type: "Node_Expr_LogicalXor",
6500 left: arguments[ 0 ],
6501 right: arguments[ 1 ],
6502 attributes: arguments[ 2 ]
6503 };
6504
6505 };
6506
6507 PHP.Parser.prototype.Node_Expr_BitwiseAnd = function() {
6508 return {
6509 type: "Node_Expr_BitwiseAnd",
6510 left: arguments[ 0 ],
6511 right: arguments[ 1 ],
6512 attributes: arguments[ 2 ]
6513 };
6514
6515 };
6516
6517 PHP.Parser.prototype.Node_Expr_BitwiseOr = function() {
6518 return {
6519 type: "Node_Expr_BitwiseOr",
6520 left: arguments[ 0 ],
6521 right: arguments[ 1 ],
6522 attributes: arguments[ 2 ]
6523 };
6524
6525 };
6526
6527 PHP.Parser.prototype.Node_Expr_BitwiseNot = function() {
6528 return {
6529 type: "Node_Expr_BitwiseNot",
6530 expr: arguments[ 0 ],
6531 attributes: arguments[ 1 ]
6532 };
6533
6534 };
6535
6536 PHP.Parser.prototype.Node_Expr_BooleanNot = function() {
6537 return {
6538 type: "Node_Expr_BooleanNot",
6539 expr: arguments[ 0 ],
6540 attributes: arguments[ 1 ]
6541 };
6542
6543 };
6544
6545 PHP.Parser.prototype.Node_Expr_BooleanAnd = function() {
6546 return {
6547 type: "Node_Expr_BooleanAnd",
6548 left: arguments[ 0 ],
6549 right: arguments[ 1 ],
6550 attributes: arguments[ 2 ]
6551 };
6552
6553 };
6554
6555 PHP.Parser.prototype.Node_Expr_Instanceof = function() {
6556
6557 return {
6558 type: "Node_Expr_Instanceof",
6559 left: arguments[ 0 ],
6560 right: arguments[ 1 ],
6561 attributes: arguments[ 2 ]
6562 };
6563
6564 };
6565
6566 PHP.Parser.prototype.Node_Expr_Clone = function() {
6567
6568 return {
6569 type: "Node_Expr_Clone",
6570 expr: arguments[ 0 ],
6571 attributes: arguments[ 1 ]
6572 };
6573
6574 };
6575
6576
6577
6578 PHP.Parser.prototype.Scalar_LNumber_parse = function( a ) {
6579
6580 return a;
6581 };
6582
6583 PHP.Parser.prototype.Scalar_DNumber_parse = function( a ) {
6584
6585 return a;
6586 };
6587
6588 PHP.Parser.prototype.Scalar_String_parseDocString = function() {
6589
6590 return '"' + arguments[ 1 ].replace(/([^"\\]*(?:\\.[^"\\]*)*)"/g, '$1\\"') + '"';
6591 };
6592
6593
6594 PHP.Parser.prototype.Node_Scalar_String = function( ) {
6595
6596 return {
6597 type: "Node_Scalar_String",
6598 value: arguments[ 0 ],
6599 attributes: arguments[ 1 ]
6600 };
6601
6602 };
6603
6604 PHP.Parser.prototype.Scalar_String_create = function( ) {
6605 return {
6606 type: "Node_Scalar_String",
6607 value: arguments[ 0 ],
6608 attributes: arguments[ 1 ]
6609 };
6610
6611 };
6612
6613 PHP.Parser.prototype.Node_Scalar_LNumber = function() {
6614
6615 return {
6616 type: "Node_Scalar_LNumber",
6617 value: arguments[ 0 ],
6618 attributes: arguments[ 1 ]
6619 };
6620
6621 };
6622
6623
6624 PHP.Parser.prototype.Node_Scalar_DNumber = function() {
6625
6626 return {
6627 type: "Node_Scalar_DNumber",
6628 value: arguments[ 0 ],
6629 attributes: arguments[ 1 ]
6630 };
6631
6632 };
6633
6634
6635 PHP.Parser.prototype.Node_Scalar_Encapsed = function() {
6636
6637 return {
6638 type: "Node_Scalar_Encapsed",
6639 parts: arguments[ 0 ],
6640 attributes: arguments[ 1 ]
6641 };
6642
6643 };
6644
6645 PHP.Parser.prototype.Node_Name = function() {
6646
6647 return {
6648 type: "Node_Name",
6649 parts: arguments[ 0 ],
6650 attributes: arguments[ 1 ]
6651 };
6652
6653 };
6654
6655 PHP.Parser.prototype.Node_Param = function() {
6656
6657 return {
6658 type: "Node_Param",
6659 name: arguments[ 0 ],
6660 def: arguments[ 1 ],
6661 Type: arguments[ 2 ],
6662 byRef: arguments[ 3 ],
6663 attributes: arguments[ 4 ]
6664 };
6665
6666 };
6667
6668 PHP.Parser.prototype.Node_Arg = function() {
6669
6670 return {
6671 type: "Node_Name",
6672 value: arguments[ 0 ],
6673 byRef: arguments[ 1 ],
6674 attributes: arguments[ 2 ]
6675 };
6676
6677 };
6678
6679
6680 PHP.Parser.prototype.Node_Const = function() {
6681
6682 return {
6683 type: "Node_Const",
6684 name: arguments[ 0 ],
6685 value: arguments[ 1 ],
6686 attributes: arguments[ 2 ]
6687 };
6688
6689 };
6690
6691
6692 exports.PHP = PHP;
6693 });
+0
-21848
try/ace/worker-xquery.js less more
0 "no use strict";
1 ;(function(window) {
2 if (typeof window.window != "undefined" && window.document) {
3 return;
4 }
5
6 window.console = {
7 log: function() {
8 var msgs = Array.prototype.slice.call(arguments, 0);
9 postMessage({type: "log", data: msgs});
10 },
11 error: function() {
12 var msgs = Array.prototype.slice.call(arguments, 0);
13 postMessage({type: "log", data: msgs});
14 }
15 };
16 window.window = window;
17 window.ace = window;
18
19 window.normalizeModule = function(parentId, moduleName) {
20 if (moduleName.indexOf("!") !== -1) {
21 var chunks = moduleName.split("!");
22 return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
23 }
24 if (moduleName.charAt(0) == ".") {
25 var base = parentId.split("/").slice(0, -1).join("/");
26 moduleName = base + "/" + moduleName;
27
28 while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
29 var previous = moduleName;
30 moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
31 }
32 }
33
34 return moduleName;
35 };
36
37 window.require = function(parentId, id) {
38 if (!id) {
39 id = parentId
40 parentId = null;
41 }
42 if (!id.charAt)
43 throw new Error("worker.js require() accepts only (parentId, id) as arguments");
44
45 id = normalizeModule(parentId, id);
46
47 var module = require.modules[id];
48 if (module) {
49 if (!module.initialized) {
50 module.initialized = true;
51 module.exports = module.factory().exports;
52 }
53 return module.exports;
54 }
55
56 var chunks = id.split("/");
57 chunks[0] = require.tlns[chunks[0]] || chunks[0];
58 var path = chunks.join("/") + ".js";
59
60 require.id = id;
61 importScripts(path);
62 return require(parentId, id);
63 };
64
65 require.modules = {};
66 require.tlns = {};
67
68 window.define = function(id, deps, factory) {
69 if (arguments.length == 2) {
70 factory = deps;
71 if (typeof id != "string") {
72 deps = id;
73 id = require.id;
74 }
75 } else if (arguments.length == 1) {
76 factory = id;
77 id = require.id;
78 }
79
80 if (id.indexOf("text!") === 0)
81 return;
82
83 var req = function(deps, factory) {
84 return require(id, deps, factory);
85 };
86
87 require.modules[id] = {
88 factory: function() {
89 var module = {
90 exports: {}
91 };
92 var returnExports = factory(req, module.exports, module);
93 if (returnExports)
94 module.exports = returnExports;
95 return module;
96 }
97 };
98 };
99
100 window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
101 require.tlns = topLevelNamespaces;
102 }
103
104 window.initSender = function initSender() {
105
106 var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
107 var oop = require("ace/lib/oop");
108
109 var Sender = function() {};
110
111 (function() {
112
113 oop.implement(this, EventEmitter);
114
115 this.callback = function(data, callbackId) {
116 postMessage({
117 type: "call",
118 id: callbackId,
119 data: data
120 });
121 };
122
123 this.emit = function(name, data) {
124 postMessage({
125 type: "event",
126 name: name,
127 data: data
128 });
129 };
130
131 }).call(Sender.prototype);
132
133 return new Sender();
134 }
135
136 window.main = null;
137 window.sender = null;
138
139 window.onmessage = function(e) {
140 var msg = e.data;
141 if (msg.command) {
142 if (main[msg.command])
143 main[msg.command].apply(main, msg.args);
144 else
145 throw new Error("Unknown command:" + msg.command);
146 }
147 else if (msg.init) {
148 initBaseUrls(msg.tlns);
149 require("ace/lib/es5-shim");
150 sender = initSender();
151 var clazz = require(msg.module)[msg.classname];
152 main = new clazz(sender);
153 }
154 else if (msg.event && sender) {
155 sender._emit(msg.event, msg.data);
156 }
157 };
158 })(this);
159
160 define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
161
162
163 var EventEmitter = {};
164 var stopPropagation = function() { this.propagationStopped = true; };
165 var preventDefault = function() { this.defaultPrevented = true; };
166
167 EventEmitter._emit =
168 EventEmitter._dispatchEvent = function(eventName, e) {
169 this._eventRegistry || (this._eventRegistry = {});
170 this._defaultHandlers || (this._defaultHandlers = {});
171
172 var listeners = this._eventRegistry[eventName] || [];
173 var defaultHandler = this._defaultHandlers[eventName];
174 if (!listeners.length && !defaultHandler)
175 return;
176
177 if (typeof e != "object" || !e)
178 e = {};
179
180 if (!e.type)
181 e.type = eventName;
182 if (!e.stopPropagation)
183 e.stopPropagation = stopPropagation;
184 if (!e.preventDefault)
185 e.preventDefault = preventDefault;
186
187 for (var i=0; i<listeners.length; i++) {
188 listeners[i](e, this);
189 if (e.propagationStopped)
190 break;
191 }
192
193 if (defaultHandler && !e.defaultPrevented)
194 return defaultHandler(e, this);
195 };
196
197
198 EventEmitter._signal = function(eventName, e) {
199 var listeners = (this._eventRegistry || {})[eventName];
200 if (!listeners)
201 return;
202
203 for (var i=0; i<listeners.length; i++)
204 listeners[i](e, this);
205 };
206
207 EventEmitter.once = function(eventName, callback) {
208 var _self = this;
209 callback && this.addEventListener(eventName, function newCallback() {
210 _self.removeEventListener(eventName, newCallback);
211 callback.apply(null, arguments);
212 });
213 };
214
215
216 EventEmitter.setDefaultHandler = function(eventName, callback) {
217 var handlers = this._defaultHandlers
218 if (!handlers)
219 handlers = this._defaultHandlers = {_disabled_: {}};
220
221 if (handlers[eventName]) {
222 var old = handlers[eventName];
223 var disabled = handlers._disabled_[eventName];
224 if (!disabled)
225 handlers._disabled_[eventName] = disabled = [];
226 disabled.push(old);
227 var i = disabled.indexOf(callback);
228 if (i != -1)
229 disabled.splice(i, 1);
230 }
231 handlers[eventName] = callback;
232 };
233 EventEmitter.removeDefaultHandler = function(eventName, callback) {
234 var handlers = this._defaultHandlers
235 if (!handlers)
236 return;
237 var disabled = handlers._disabled_[eventName];
238
239 if (handlers[eventName] == callback) {
240 var old = handlers[eventName];
241 if (disabled)
242 this.setDefaultHandler(eventName, disabled.pop());
243 } else if (disabled) {
244 var i = disabled.indexOf(callback);
245 if (i != -1)
246 disabled.splice(i, 1);
247 }
248 };
249
250 EventEmitter.on =
251 EventEmitter.addEventListener = function(eventName, callback, capturing) {
252 this._eventRegistry = this._eventRegistry || {};
253
254 var listeners = this._eventRegistry[eventName];
255 if (!listeners)
256 listeners = this._eventRegistry[eventName] = [];
257
258 if (listeners.indexOf(callback) == -1)
259 listeners[capturing ? "unshift" : "push"](callback);
260 return callback;
261 };
262
263 EventEmitter.off =
264 EventEmitter.removeListener =
265 EventEmitter.removeEventListener = function(eventName, callback) {
266 this._eventRegistry = this._eventRegistry || {};
267
268 var listeners = this._eventRegistry[eventName];
269 if (!listeners)
270 return;
271
272 var index = listeners.indexOf(callback);
273 if (index !== -1)
274 listeners.splice(index, 1);
275 };
276
277 EventEmitter.removeAllListeners = function(eventName) {
278 if (this._eventRegistry) this._eventRegistry[eventName] = [];
279 };
280
281 exports.EventEmitter = EventEmitter;
282
283 });
284
285 define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
286
287
288 exports.inherits = (function() {
289 var tempCtor = function() {};
290 return function(ctor, superCtor) {
291 tempCtor.prototype = superCtor.prototype;
292 ctor.super_ = superCtor.prototype;
293 ctor.prototype = new tempCtor();
294 ctor.prototype.constructor = ctor;
295 };
296 }());
297
298 exports.mixin = function(obj, mixin) {
299 for (var key in mixin) {
300 obj[key] = mixin[key];
301 }
302 return obj;
303 };
304
305 exports.implement = function(proto, mixin) {
306 exports.mixin(proto, mixin);
307 };
308
309 });
310
311 define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) {
312
313 function Empty() {}
314
315 if (!Function.prototype.bind) {
316 Function.prototype.bind = function bind(that) { // .length is 1
317 var target = this;
318 if (typeof target != "function") {
319 throw new TypeError("Function.prototype.bind called on incompatible " + target);
320 }
321 var args = slice.call(arguments, 1); // for normal call
322 var bound = function () {
323
324 if (this instanceof bound) {
325
326 var result = target.apply(
327 this,
328 args.concat(slice.call(arguments))
329 );
330 if (Object(result) === result) {
331 return result;
332 }
333 return this;
334
335 } else {
336 return target.apply(
337 that,
338 args.concat(slice.call(arguments))
339 );
340
341 }
342
343 };
344 if(target.prototype) {
345 Empty.prototype = target.prototype;
346 bound.prototype = new Empty();
347 Empty.prototype = null;
348 }
349 return bound;
350 };
351 }
352 var call = Function.prototype.call;
353 var prototypeOfArray = Array.prototype;
354 var prototypeOfObject = Object.prototype;
355 var slice = prototypeOfArray.slice;
356 var _toString = call.bind(prototypeOfObject.toString);
357 var owns = call.bind(prototypeOfObject.hasOwnProperty);
358 var defineGetter;
359 var defineSetter;
360 var lookupGetter;
361 var lookupSetter;
362 var supportsAccessors;
363 if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
364 defineGetter = call.bind(prototypeOfObject.__defineGetter__);
365 defineSetter = call.bind(prototypeOfObject.__defineSetter__);
366 lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
367 lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
368 }
369 if ([1,2].splice(0).length != 2) {
370 if(function() { // test IE < 9 to splice bug - see issue #138
371 function makeArray(l) {
372 var a = new Array(l+2);
373 a[0] = a[1] = 0;
374 return a;
375 }
376 var array = [], lengthBefore;
377
378 array.splice.apply(array, makeArray(20));
379 array.splice.apply(array, makeArray(26));
380
381 lengthBefore = array.length; //46
382 array.splice(5, 0, "XXX"); // add one element
383
384 lengthBefore + 1 == array.length
385
386 if (lengthBefore + 1 == array.length) {
387 return true;// has right splice implementation without bugs
388 }
389 }()) {//IE 6/7
390 var array_splice = Array.prototype.splice;
391 Array.prototype.splice = function(start, deleteCount) {
392 if (!arguments.length) {
393 return [];
394 } else {
395 return array_splice.apply(this, [
396 start === void 0 ? 0 : start,
397 deleteCount === void 0 ? (this.length - start) : deleteCount
398 ].concat(slice.call(arguments, 2)))
399 }
400 };
401 } else {//IE8
402 Array.prototype.splice = function(pos, removeCount){
403 var length = this.length;
404 if (pos > 0) {
405 if (pos > length)
406 pos = length;
407 } else if (pos == void 0) {
408 pos = 0;
409 } else if (pos < 0) {
410 pos = Math.max(length + pos, 0);
411 }
412
413 if (!(pos+removeCount < length))
414 removeCount = length - pos;
415
416 var removed = this.slice(pos, pos+removeCount);
417 var insert = slice.call(arguments, 2);
418 var add = insert.length;
419 if (pos === length) {
420 if (add) {
421 this.push.apply(this, insert);
422 }
423 } else {
424 var remove = Math.min(removeCount, length - pos);
425 var tailOldPos = pos + remove;
426 var tailNewPos = tailOldPos + add - remove;
427 var tailCount = length - tailOldPos;
428 var lengthAfterRemove = length - remove;
429
430 if (tailNewPos < tailOldPos) { // case A
431 for (var i = 0; i < tailCount; ++i) {
432 this[tailNewPos+i] = this[tailOldPos+i];
433 }
434 } else if (tailNewPos > tailOldPos) { // case B
435 for (i = tailCount; i--; ) {
436 this[tailNewPos+i] = this[tailOldPos+i];
437 }
438 } // else, add == remove (nothing to do)
439
440 if (add && pos === lengthAfterRemove) {
441 this.length = lengthAfterRemove; // truncate array
442 this.push.apply(this, insert);
443 } else {
444 this.length = lengthAfterRemove + add; // reserves space
445 for (i = 0; i < add; ++i) {
446 this[pos+i] = insert[i];
447 }
448 }
449 }
450 return removed;
451 };
452 }
453 }
454 if (!Array.isArray) {
455 Array.isArray = function isArray(obj) {
456 return _toString(obj) == "[object Array]";
457 };
458 }
459 var boxedString = Object("a"),
460 splitString = boxedString[0] != "a" || !(0 in boxedString);
461
462 if (!Array.prototype.forEach) {
463 Array.prototype.forEach = function forEach(fun /*, thisp*/) {
464 var object = toObject(this),
465 self = splitString && _toString(this) == "[object String]" ?
466 this.split("") :
467 object,
468 thisp = arguments[1],
469 i = -1,
470 length = self.length >>> 0;
471 if (_toString(fun) != "[object Function]") {
472 throw new TypeError(); // TODO message
473 }
474
475 while (++i < length) {
476 if (i in self) {
477 fun.call(thisp, self[i], i, object);
478 }
479 }
480 };
481 }
482 if (!Array.prototype.map) {
483 Array.prototype.map = function map(fun /*, thisp*/) {
484 var object = toObject(this),
485 self = splitString && _toString(this) == "[object String]" ?
486 this.split("") :
487 object,
488 length = self.length >>> 0,
489 result = Array(length),
490 thisp = arguments[1];
491 if (_toString(fun) != "[object Function]") {
492 throw new TypeError(fun + " is not a function");
493 }
494
495 for (var i = 0; i < length; i++) {
496 if (i in self)
497 result[i] = fun.call(thisp, self[i], i, object);
498 }
499 return result;
500 };
501 }
502 if (!Array.prototype.filter) {
503 Array.prototype.filter = function filter(fun /*, thisp */) {
504 var object = toObject(this),
505 self = splitString && _toString(this) == "[object String]" ?
506 this.split("") :
507 object,
508 length = self.length >>> 0,
509 result = [],
510 value,
511 thisp = arguments[1];
512 if (_toString(fun) != "[object Function]") {
513 throw new TypeError(fun + " is not a function");
514 }
515
516 for (var i = 0; i < length; i++) {
517 if (i in self) {
518 value = self[i];
519 if (fun.call(thisp, value, i, object)) {
520 result.push(value);
521 }
522 }
523 }
524 return result;
525 };
526 }
527 if (!Array.prototype.every) {
528 Array.prototype.every = function every(fun /*, thisp */) {
529 var object = toObject(this),
530 self = splitString && _toString(this) == "[object String]" ?
531 this.split("") :
532 object,
533 length = self.length >>> 0,
534 thisp = arguments[1];
535 if (_toString(fun) != "[object Function]") {
536 throw new TypeError(fun + " is not a function");
537 }
538
539 for (var i = 0; i < length; i++) {
540 if (i in self && !fun.call(thisp, self[i], i, object)) {
541 return false;
542 }
543 }
544 return true;
545 };
546 }
547 if (!Array.prototype.some) {
548 Array.prototype.some = function some(fun /*, thisp */) {
549 var object = toObject(this),
550 self = splitString && _toString(this) == "[object String]" ?
551 this.split("") :
552 object,
553 length = self.length >>> 0,
554 thisp = arguments[1];
555 if (_toString(fun) != "[object Function]") {
556 throw new TypeError(fun + " is not a function");
557 }
558
559 for (var i = 0; i < length; i++) {
560 if (i in self && fun.call(thisp, self[i], i, object)) {
561 return true;
562 }
563 }
564 return false;
565 };
566 }
567 if (!Array.prototype.reduce) {
568 Array.prototype.reduce = function reduce(fun /*, initial*/) {
569 var object = toObject(this),
570 self = splitString && _toString(this) == "[object String]" ?
571 this.split("") :
572 object,
573 length = self.length >>> 0;
574 if (_toString(fun) != "[object Function]") {
575 throw new TypeError(fun + " is not a function");
576 }
577 if (!length && arguments.length == 1) {
578 throw new TypeError("reduce of empty array with no initial value");
579 }
580
581 var i = 0;
582 var result;
583 if (arguments.length >= 2) {
584 result = arguments[1];
585 } else {
586 do {
587 if (i in self) {
588 result = self[i++];
589 break;
590 }
591 if (++i >= length) {
592 throw new TypeError("reduce of empty array with no initial value");
593 }
594 } while (true);
595 }
596
597 for (; i < length; i++) {
598 if (i in self) {
599 result = fun.call(void 0, result, self[i], i, object);
600 }
601 }
602
603 return result;
604 };
605 }
606 if (!Array.prototype.reduceRight) {
607 Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
608 var object = toObject(this),
609 self = splitString && _toString(this) == "[object String]" ?
610 this.split("") :
611 object,
612 length = self.length >>> 0;
613 if (_toString(fun) != "[object Function]") {
614 throw new TypeError(fun + " is not a function");
615 }
616 if (!length && arguments.length == 1) {
617 throw new TypeError("reduceRight of empty array with no initial value");
618 }
619
620 var result, i = length - 1;
621 if (arguments.length >= 2) {
622 result = arguments[1];
623 } else {
624 do {
625 if (i in self) {
626 result = self[i--];
627 break;
628 }
629 if (--i < 0) {
630 throw new TypeError("reduceRight of empty array with no initial value");
631 }
632 } while (true);
633 }
634
635 do {
636 if (i in this) {
637 result = fun.call(void 0, result, self[i], i, object);
638 }
639 } while (i--);
640
641 return result;
642 };
643 }
644 if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
645 Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
646 var self = splitString && _toString(this) == "[object String]" ?
647 this.split("") :
648 toObject(this),
649 length = self.length >>> 0;
650
651 if (!length) {
652 return -1;
653 }
654
655 var i = 0;
656 if (arguments.length > 1) {
657 i = toInteger(arguments[1]);
658 }
659 i = i >= 0 ? i : Math.max(0, length + i);
660 for (; i < length; i++) {
661 if (i in self && self[i] === sought) {
662 return i;
663 }
664 }
665 return -1;
666 };
667 }
668 if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
669 Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
670 var self = splitString && _toString(this) == "[object String]" ?
671 this.split("") :
672 toObject(this),
673 length = self.length >>> 0;
674
675 if (!length) {
676 return -1;
677 }
678 var i = length - 1;
679 if (arguments.length > 1) {
680 i = Math.min(i, toInteger(arguments[1]));
681 }
682 i = i >= 0 ? i : length - Math.abs(i);
683 for (; i >= 0; i--) {
684 if (i in self && sought === self[i]) {
685 return i;
686 }
687 }
688 return -1;
689 };
690 }
691 if (!Object.getPrototypeOf) {
692 Object.getPrototypeOf = function getPrototypeOf(object) {
693 return object.__proto__ || (
694 object.constructor ?
695 object.constructor.prototype :
696 prototypeOfObject
697 );
698 };
699 }
700 if (!Object.getOwnPropertyDescriptor) {
701 var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
702 "non-object: ";
703 Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
704 if ((typeof object != "object" && typeof object != "function") || object === null)
705 throw new TypeError(ERR_NON_OBJECT + object);
706 if (!owns(object, property))
707 return;
708
709 var descriptor, getter, setter;
710 descriptor = { enumerable: true, configurable: true };
711 if (supportsAccessors) {
712 var prototype = object.__proto__;
713 object.__proto__ = prototypeOfObject;
714
715 var getter = lookupGetter(object, property);
716 var setter = lookupSetter(object, property);
717 object.__proto__ = prototype;
718
719 if (getter || setter) {
720 if (getter) descriptor.get = getter;
721 if (setter) descriptor.set = setter;
722 return descriptor;
723 }
724 }
725 descriptor.value = object[property];
726 return descriptor;
727 };
728 }
729 if (!Object.getOwnPropertyNames) {
730 Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
731 return Object.keys(object);
732 };
733 }
734 if (!Object.create) {
735 var createEmpty;
736 if (Object.prototype.__proto__ === null) {
737 createEmpty = function () {
738 return { "__proto__": null };
739 };
740 } else {
741 createEmpty = function () {
742 var empty = {};
743 for (var i in empty)
744 empty[i] = null;
745 empty.constructor =
746 empty.hasOwnProperty =
747 empty.propertyIsEnumerable =
748 empty.isPrototypeOf =
749 empty.toLocaleString =
750 empty.toString =
751 empty.valueOf =
752 empty.__proto__ = null;
753 return empty;
754 }
755 }
756
757 Object.create = function create(prototype, properties) {
758 var object;
759 if (prototype === null) {
760 object = createEmpty();
761 } else {
762 if (typeof prototype != "object")
763 throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
764 var Type = function () {};
765 Type.prototype = prototype;
766 object = new Type();
767 object.__proto__ = prototype;
768 }
769 if (properties !== void 0)
770 Object.defineProperties(object, properties);
771 return object;
772 };
773 }
774
775 function doesDefinePropertyWork(object) {
776 try {
777 Object.defineProperty(object, "sentinel", {});
778 return "sentinel" in object;
779 } catch (exception) {
780 }
781 }
782 if (Object.defineProperty) {
783 var definePropertyWorksOnObject = doesDefinePropertyWork({});
784 var definePropertyWorksOnDom = typeof document == "undefined" ||
785 doesDefinePropertyWork(document.createElement("div"));
786 if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
787 var definePropertyFallback = Object.defineProperty;
788 }
789 }
790
791 if (!Object.defineProperty || definePropertyFallback) {
792 var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
793 var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
794 var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
795 "on this javascript engine";
796
797 Object.defineProperty = function defineProperty(object, property, descriptor) {
798 if ((typeof object != "object" && typeof object != "function") || object === null)
799 throw new TypeError(ERR_NON_OBJECT_TARGET + object);
800 if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
801 throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
802 if (definePropertyFallback) {
803 try {
804 return definePropertyFallback.call(Object, object, property, descriptor);
805 } catch (exception) {
806 }
807 }
808 if (owns(descriptor, "value")) {
809
810 if (supportsAccessors && (lookupGetter(object, property) ||
811 lookupSetter(object, property)))
812 {
813 var prototype = object.__proto__;
814 object.__proto__ = prototypeOfObject;
815 delete object[property];
816 object[property] = descriptor.value;
817 object.__proto__ = prototype;
818 } else {
819 object[property] = descriptor.value;
820 }
821 } else {
822 if (!supportsAccessors)
823 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
824 if (owns(descriptor, "get"))
825 defineGetter(object, property, descriptor.get);
826 if (owns(descriptor, "set"))
827 defineSetter(object, property, descriptor.set);
828 }
829
830 return object;
831 };
832 }
833 if (!Object.defineProperties) {
834 Object.defineProperties = function defineProperties(object, properties) {
835 for (var property in properties) {
836 if (owns(properties, property))
837 Object.defineProperty(object, property, properties[property]);
838 }
839 return object;
840 };
841 }
842 if (!Object.seal) {
843 Object.seal = function seal(object) {
844 return object;
845 };
846 }
847 if (!Object.freeze) {
848 Object.freeze = function freeze(object) {
849 return object;
850 };
851 }
852 try {
853 Object.freeze(function () {});
854 } catch (exception) {
855 Object.freeze = (function freeze(freezeObject) {
856 return function freeze(object) {
857 if (typeof object == "function") {
858 return object;
859 } else {
860 return freezeObject(object);
861 }
862 };
863 })(Object.freeze);
864 }
865 if (!Object.preventExtensions) {
866 Object.preventExtensions = function preventExtensions(object) {
867 return object;
868 };
869 }
870 if (!Object.isSealed) {
871 Object.isSealed = function isSealed(object) {
872 return false;
873 };
874 }
875 if (!Object.isFrozen) {
876 Object.isFrozen = function isFrozen(object) {
877 return false;
878 };
879 }
880 if (!Object.isExtensible) {
881 Object.isExtensible = function isExtensible(object) {
882 if (Object(object) === object) {
883 throw new TypeError(); // TODO message
884 }
885 var name = '';
886 while (owns(object, name)) {
887 name += '?';
888 }
889 object[name] = true;
890 var returnValue = owns(object, name);
891 delete object[name];
892 return returnValue;
893 };
894 }
895 if (!Object.keys) {
896 var hasDontEnumBug = true,
897 dontEnums = [
898 "toString",
899 "toLocaleString",
900 "valueOf",
901 "hasOwnProperty",
902 "isPrototypeOf",
903 "propertyIsEnumerable",
904 "constructor"
905 ],
906 dontEnumsLength = dontEnums.length;
907
908 for (var key in {"toString": null}) {
909 hasDontEnumBug = false;
910 }
911
912 Object.keys = function keys(object) {
913
914 if (
915 (typeof object != "object" && typeof object != "function") ||
916 object === null
917 ) {
918 throw new TypeError("Object.keys called on a non-object");
919 }
920
921 var keys = [];
922 for (var name in object) {
923 if (owns(object, name)) {
924 keys.push(name);
925 }
926 }
927
928 if (hasDontEnumBug) {
929 for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
930 var dontEnum = dontEnums[i];
931 if (owns(object, dontEnum)) {
932 keys.push(dontEnum);
933 }
934 }
935 }
936 return keys;
937 };
938
939 }
940 if (!Date.now) {
941 Date.now = function now() {
942 return new Date().getTime();
943 };
944 }
945 var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
946 "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
947 "\u2029\uFEFF";
948 if (!String.prototype.trim || ws.trim()) {
949 ws = "[" + ws + "]";
950 var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
951 trimEndRegexp = new RegExp(ws + ws + "*$");
952 String.prototype.trim = function trim() {
953 return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
954 };
955 }
956
957 function toInteger(n) {
958 n = +n;
959 if (n !== n) { // isNaN
960 n = 0;
961 } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
962 n = (n > 0 || -1) * Math.floor(Math.abs(n));
963 }
964 return n;
965 }
966
967 function isPrimitive(input) {
968 var type = typeof input;
969 return (
970 input === null ||
971 type === "undefined" ||
972 type === "boolean" ||
973 type === "number" ||
974 type === "string"
975 );
976 }
977
978 function toPrimitive(input) {
979 var val, valueOf, toString;
980 if (isPrimitive(input)) {
981 return input;
982 }
983 valueOf = input.valueOf;
984 if (typeof valueOf === "function") {
985 val = valueOf.call(input);
986 if (isPrimitive(val)) {
987 return val;
988 }
989 }
990 toString = input.toString;
991 if (typeof toString === "function") {
992 val = toString.call(input);
993 if (isPrimitive(val)) {
994 return val;
995 }
996 }
997 throw new TypeError();
998 }
999 var toObject = function (o) {
1000 if (o == null) { // this matches both null and undefined
1001 throw new TypeError("can't convert "+o+" to object");
1002 }
1003 return Object(o);
1004 };
1005
1006 });
1007
1008 define('ace/mode/xquery_worker', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/worker/mirror', 'ace/mode/xquery/JSONParseTreeHandler', 'ace/mode/xquery/XQueryParser', 'ace/mode/xquery/visitors/SemanticHighlighter'], function(require, exports, module) {
1009
1010
1011 var oop = require("../lib/oop");
1012 var Mirror = require("../worker/mirror").Mirror;
1013 var JSONParseTreeHandler = require("./xquery/JSONParseTreeHandler").JSONParseTreeHandler;
1014 var XQueryParser = require("./xquery/XQueryParser").XQueryParser;
1015 var SemanticHighlighter = require("./xquery/visitors/SemanticHighlighter").SemanticHighlighter;
1016
1017 var XQueryWorker = exports.XQueryWorker = function(sender) {
1018 Mirror.call(this, sender);
1019 this.setTimeout(200);
1020 };
1021
1022 oop.inherits(XQueryWorker, Mirror);
1023
1024 (function() {
1025
1026 this.onUpdate = function() {
1027 this.sender.emit("start");
1028 var value = this.doc.getValue();
1029 var h = new JSONParseTreeHandler(value);
1030 var parser = new XQueryParser(value, h);
1031 try {
1032 parser.parse_XQuery();
1033 this.sender.emit("ok");
1034 var ast = h.getParseTree();
1035 var highlighter = new SemanticHighlighter(ast, value);
1036 var tokens = highlighter.getTokens();
1037 this.sender.emit("highlight", { tokens: tokens, lines: highlighter.lines });
1038 } catch(e) {
1039 if(e instanceof parser.ParseException) {
1040 var prefix = value.substring(0, e.getBegin());
1041 var line = prefix.split("\n").length;
1042 var column = e.getBegin() - prefix.lastIndexOf("\n");
1043 var message = parser.getErrorMessage(e);
1044 this.sender.emit("error", {
1045 row: line - 1,
1046 column: column,
1047 text: message,
1048 type: "error"
1049 });
1050 } else {
1051 throw e;
1052 }
1053 }
1054 };
1055
1056 }).call(XQueryWorker.prototype);
1057
1058 });
1059 define('ace/worker/mirror', ['require', 'exports', 'module' , 'ace/document', 'ace/lib/lang'], function(require, exports, module) {
1060
1061
1062 var Document = require("../document").Document;
1063 var lang = require("../lib/lang");
1064
1065 var Mirror = exports.Mirror = function(sender) {
1066 this.sender = sender;
1067 var doc = this.doc = new Document("");
1068
1069 var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1070
1071 var _self = this;
1072 sender.on("change", function(e) {
1073 doc.applyDeltas(e.data);
1074 deferredUpdate.schedule(_self.$timeout);
1075 });
1076 };
1077
1078 (function() {
1079
1080 this.$timeout = 500;
1081
1082 this.setTimeout = function(timeout) {
1083 this.$timeout = timeout;
1084 };
1085
1086 this.setValue = function(value) {
1087 this.doc.setValue(value);
1088 this.deferredUpdate.schedule(this.$timeout);
1089 };
1090
1091 this.getValue = function(callbackId) {
1092 this.sender.callback(this.doc.getValue(), callbackId);
1093 };
1094
1095 this.onUpdate = function() {
1096 };
1097
1098 }).call(Mirror.prototype);
1099
1100 });
1101
1102 define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
1103
1104
1105 var oop = require("./lib/oop");
1106 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1107 var Range = require("./range").Range;
1108 var Anchor = require("./anchor").Anchor;
1109
1110 var Document = function(text) {
1111 this.$lines = [];
1112 if (text.length == 0) {
1113 this.$lines = [""];
1114 } else if (Array.isArray(text)) {
1115 this._insertLines(0, text);
1116 } else {
1117 this.insert({row: 0, column:0}, text);
1118 }
1119 };
1120
1121 (function() {
1122
1123 oop.implement(this, EventEmitter);
1124 this.setValue = function(text) {
1125 var len = this.getLength();
1126 this.remove(new Range(0, 0, len, this.getLine(len-1).length));
1127 this.insert({row: 0, column:0}, text);
1128 };
1129 this.getValue = function() {
1130 return this.getAllLines().join(this.getNewLineCharacter());
1131 };
1132 this.createAnchor = function(row, column) {
1133 return new Anchor(this, row, column);
1134 };
1135 if ("aaa".split(/a/).length == 0)
1136 this.$split = function(text) {
1137 return text.replace(/\r\n|\r/g, "\n").split("\n");
1138 }
1139 else
1140 this.$split = function(text) {
1141 return text.split(/\r\n|\r|\n/);
1142 };
1143
1144
1145 this.$detectNewLine = function(text) {
1146 var match = text.match(/^.*?(\r\n|\r|\n)/m);
1147 this.$autoNewLine = match ? match[1] : "\n";
1148 };
1149 this.getNewLineCharacter = function() {
1150 switch (this.$newLineMode) {
1151 case "windows":
1152 return "\r\n";
1153 case "unix":
1154 return "\n";
1155 default:
1156 return this.$autoNewLine;
1157 }
1158 };
1159
1160 this.$autoNewLine = "\n";
1161 this.$newLineMode = "auto";
1162 this.setNewLineMode = function(newLineMode) {
1163 if (this.$newLineMode === newLineMode)
1164 return;
1165
1166 this.$newLineMode = newLineMode;
1167 };
1168 this.getNewLineMode = function() {
1169 return this.$newLineMode;
1170 };
1171 this.isNewLine = function(text) {
1172 return (text == "\r\n" || text == "\r" || text == "\n");
1173 };
1174 this.getLine = function(row) {
1175 return this.$lines[row] || "";
1176 };
1177 this.getLines = function(firstRow, lastRow) {
1178 return this.$lines.slice(firstRow, lastRow + 1);
1179 };
1180 this.getAllLines = function() {
1181 return this.getLines(0, this.getLength());
1182 };
1183 this.getLength = function() {
1184 return this.$lines.length;
1185 };
1186 this.getTextRange = function(range) {
1187 if (range.start.row == range.end.row) {
1188 return this.$lines[range.start.row]
1189 .substring(range.start.column, range.end.column);
1190 }
1191 var lines = this.getLines(range.start.row, range.end.row);
1192 lines[0] = (lines[0] || "").substring(range.start.column);
1193 var l = lines.length - 1;
1194 if (range.end.row - range.start.row == l)
1195 lines[l] = lines[l].substring(0, range.end.column);
1196 return lines.join(this.getNewLineCharacter());
1197 };
1198
1199 this.$clipPosition = function(position) {
1200 var length = this.getLength();
1201 if (position.row >= length) {
1202 position.row = Math.max(0, length - 1);
1203 position.column = this.getLine(length-1).length;
1204 } else if (position.row < 0)
1205 position.row = 0;
1206 return position;
1207 };
1208 this.insert = function(position, text) {
1209 if (!text || text.length === 0)
1210 return position;
1211
1212 position = this.$clipPosition(position);
1213 if (this.getLength() <= 1)
1214 this.$detectNewLine(text);
1215
1216 var lines = this.$split(text);
1217 var firstLine = lines.splice(0, 1)[0];
1218 var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
1219
1220 position = this.insertInLine(position, firstLine);
1221 if (lastLine !== null) {
1222 position = this.insertNewLine(position); // terminate first line
1223 position = this._insertLines(position.row, lines);
1224 position = this.insertInLine(position, lastLine || "");
1225 }
1226 return position;
1227 };
1228 this.insertLines = function(row, lines) {
1229 if (row >= this.getLength())
1230 return this.insert({row: row, column: 0}, "\n" + lines.join("\n"));
1231 return this._insertLines(Math.max(row, 0), lines);
1232 };
1233 this._insertLines = function(row, lines) {
1234 if (lines.length == 0)
1235 return {row: row, column: 0};
1236 if (lines.length > 0xFFFF) {
1237 var end = this._insertLines(row, lines.slice(0xFFFF));
1238 lines = lines.slice(0, 0xFFFF);
1239 }
1240
1241 var args = [row, 0];
1242 args.push.apply(args, lines);
1243 this.$lines.splice.apply(this.$lines, args);
1244
1245 var range = new Range(row, 0, row + lines.length, 0);
1246 var delta = {
1247 action: "insertLines",
1248 range: range,
1249 lines: lines
1250 };
1251 this._emit("change", { data: delta });
1252 return end || range.end;
1253 };
1254 this.insertNewLine = function(position) {
1255 position = this.$clipPosition(position);
1256 var line = this.$lines[position.row] || "";
1257
1258 this.$lines[position.row] = line.substring(0, position.column);
1259 this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
1260
1261 var end = {
1262 row : position.row + 1,
1263 column : 0
1264 };
1265
1266 var delta = {
1267 action: "insertText",
1268 range: Range.fromPoints(position, end),
1269 text: this.getNewLineCharacter()
1270 };
1271 this._emit("change", { data: delta });
1272
1273 return end;
1274 };
1275 this.insertInLine = function(position, text) {
1276 if (text.length == 0)
1277 return position;
1278
1279 var line = this.$lines[position.row] || "";
1280
1281 this.$lines[position.row] = line.substring(0, position.column) + text
1282 + line.substring(position.column);
1283
1284 var end = {
1285 row : position.row,
1286 column : position.column + text.length
1287 };
1288
1289 var delta = {
1290 action: "insertText",
1291 range: Range.fromPoints(position, end),
1292 text: text
1293 };
1294 this._emit("change", { data: delta });
1295
1296 return end;
1297 };
1298 this.remove = function(range) {
1299 range.start = this.$clipPosition(range.start);
1300 range.end = this.$clipPosition(range.end);
1301
1302 if (range.isEmpty())
1303 return range.start;
1304
1305 var firstRow = range.start.row;
1306 var lastRow = range.end.row;
1307
1308 if (range.isMultiLine()) {
1309 var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
1310 var lastFullRow = lastRow - 1;
1311
1312 if (range.end.column > 0)
1313 this.removeInLine(lastRow, 0, range.end.column);
1314
1315 if (lastFullRow >= firstFullRow)
1316 this._removeLines(firstFullRow, lastFullRow);
1317
1318 if (firstFullRow != firstRow) {
1319 this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
1320 this.removeNewLine(range.start.row);
1321 }
1322 }
1323 else {
1324 this.removeInLine(firstRow, range.start.column, range.end.column);
1325 }
1326 return range.start;
1327 };
1328 this.removeInLine = function(row, startColumn, endColumn) {
1329 if (startColumn == endColumn)
1330 return;
1331
1332 var range = new Range(row, startColumn, row, endColumn);
1333 var line = this.getLine(row);
1334 var removed = line.substring(startColumn, endColumn);
1335 var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
1336 this.$lines.splice(row, 1, newLine);
1337
1338 var delta = {
1339 action: "removeText",
1340 range: range,
1341 text: removed
1342 };
1343 this._emit("change", { data: delta });
1344 return range.start;
1345 };
1346 this.removeLines = function(firstRow, lastRow) {
1347 if (firstRow < 0 || lastRow >= this.getLength())
1348 return this.remove(new Range(firstRow, 0, lastRow + 1, 0));
1349 return this._removeLines(firstRow, lastRow);
1350 };
1351
1352 this._removeLines = function(firstRow, lastRow) {
1353 var range = new Range(firstRow, 0, lastRow + 1, 0);
1354 var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
1355
1356 var delta = {
1357 action: "removeLines",
1358 range: range,
1359 nl: this.getNewLineCharacter(),
1360 lines: removed
1361 };
1362 this._emit("change", { data: delta });
1363 return removed;
1364 };
1365 this.removeNewLine = function(row) {
1366 var firstLine = this.getLine(row);
1367 var secondLine = this.getLine(row+1);
1368
1369 var range = new Range(row, firstLine.length, row+1, 0);
1370 var line = firstLine + secondLine;
1371
1372 this.$lines.splice(row, 2, line);
1373
1374 var delta = {
1375 action: "removeText",
1376 range: range,
1377 text: this.getNewLineCharacter()
1378 };
1379 this._emit("change", { data: delta });
1380 };
1381 this.replace = function(range, text) {
1382 if (text.length == 0 && range.isEmpty())
1383 return range.start;
1384 if (text == this.getTextRange(range))
1385 return range.end;
1386
1387 this.remove(range);
1388 if (text) {
1389 var end = this.insert(range.start, text);
1390 }
1391 else {
1392 end = range.start;
1393 }
1394
1395 return end;
1396 };
1397 this.applyDeltas = function(deltas) {
1398 for (var i=0; i<deltas.length; i++) {
1399 var delta = deltas[i];
1400 var range = Range.fromPoints(delta.range.start, delta.range.end);
1401
1402 if (delta.action == "insertLines")
1403 this.insertLines(range.start.row, delta.lines);
1404 else if (delta.action == "insertText")
1405 this.insert(range.start, delta.text);
1406 else if (delta.action == "removeLines")
1407 this._removeLines(range.start.row, range.end.row - 1);
1408 else if (delta.action == "removeText")
1409 this.remove(range);
1410 }
1411 };
1412 this.revertDeltas = function(deltas) {
1413 for (var i=deltas.length-1; i>=0; i--) {
1414 var delta = deltas[i];
1415
1416 var range = Range.fromPoints(delta.range.start, delta.range.end);
1417
1418 if (delta.action == "insertLines")
1419 this._removeLines(range.start.row, range.end.row - 1);
1420 else if (delta.action == "insertText")
1421 this.remove(range);
1422 else if (delta.action == "removeLines")
1423 this._insertLines(range.start.row, delta.lines);
1424 else if (delta.action == "removeText")
1425 this.insert(range.start, delta.text);
1426 }
1427 };
1428 this.indexToPosition = function(index, startRow) {
1429 var lines = this.$lines || this.getAllLines();
1430 var newlineLength = this.getNewLineCharacter().length;
1431 for (var i = startRow || 0, l = lines.length; i < l; i++) {
1432 index -= lines[i].length + newlineLength;
1433 if (index < 0)
1434 return {row: i, column: index + lines[i].length + newlineLength};
1435 }
1436 return {row: l-1, column: lines[l-1].length};
1437 };
1438 this.positionToIndex = function(pos, startRow) {
1439 var lines = this.$lines || this.getAllLines();
1440 var newlineLength = this.getNewLineCharacter().length;
1441 var index = 0;
1442 var row = Math.min(pos.row, lines.length);
1443 for (var i = startRow || 0; i < row; ++i)
1444 index += lines[i].length + newlineLength;
1445
1446 return index + pos.column;
1447 };
1448
1449 }).call(Document.prototype);
1450
1451 exports.Document = Document;
1452 });
1453
1454 define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
1455
1456 var comparePoints = function(p1, p2) {
1457 return p1.row - p2.row || p1.column - p2.column;
1458 };
1459 var Range = function(startRow, startColumn, endRow, endColumn) {
1460 this.start = {
1461 row: startRow,
1462 column: startColumn
1463 };
1464
1465 this.end = {
1466 row: endRow,
1467 column: endColumn
1468 };
1469 };
1470
1471 (function() {
1472 this.isEqual = function(range) {
1473 return this.start.row === range.start.row &&
1474 this.end.row === range.end.row &&
1475 this.start.column === range.start.column &&
1476 this.end.column === range.end.column;
1477 };
1478 this.toString = function() {
1479 return ("Range: [" + this.start.row + "/" + this.start.column +
1480 "] -> [" + this.end.row + "/" + this.end.column + "]");
1481 };
1482
1483 this.contains = function(row, column) {
1484 return this.compare(row, column) == 0;
1485 };
1486 this.compareRange = function(range) {
1487 var cmp,
1488 end = range.end,
1489 start = range.start;
1490
1491 cmp = this.compare(end.row, end.column);
1492 if (cmp == 1) {
1493 cmp = this.compare(start.row, start.column);
1494 if (cmp == 1) {
1495 return 2;
1496 } else if (cmp == 0) {
1497 return 1;
1498 } else {
1499 return 0;
1500 }
1501 } else if (cmp == -1) {
1502 return -2;
1503 } else {
1504 cmp = this.compare(start.row, start.column);
1505 if (cmp == -1) {
1506 return -1;
1507 } else if (cmp == 1) {
1508 return 42;
1509 } else {
1510 return 0;
1511 }
1512 }
1513 };
1514 this.comparePoint = function(p) {
1515 return this.compare(p.row, p.column);
1516 };
1517 this.containsRange = function(range) {
1518 return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
1519 };
1520 this.intersects = function(range) {
1521 var cmp = this.compareRange(range);
1522 return (cmp == -1 || cmp == 0 || cmp == 1);
1523 };
1524 this.isEnd = function(row, column) {
1525 return this.end.row == row && this.end.column == column;
1526 };
1527 this.isStart = function(row, column) {
1528 return this.start.row == row && this.start.column == column;
1529 };
1530 this.setStart = function(row, column) {
1531 if (typeof row == "object") {
1532 this.start.column = row.column;
1533 this.start.row = row.row;
1534 } else {
1535 this.start.row = row;
1536 this.start.column = column;
1537 }
1538 };
1539 this.setEnd = function(row, column) {
1540 if (typeof row == "object") {
1541 this.end.column = row.column;
1542 this.end.row = row.row;
1543 } else {
1544 this.end.row = row;
1545 this.end.column = column;
1546 }
1547 };
1548 this.inside = function(row, column) {
1549 if (this.compare(row, column) == 0) {
1550 if (this.isEnd(row, column) || this.isStart(row, column)) {
1551 return false;
1552 } else {
1553 return true;
1554 }
1555 }
1556 return false;
1557 };
1558 this.insideStart = function(row, column) {
1559 if (this.compare(row, column) == 0) {
1560 if (this.isEnd(row, column)) {
1561 return false;
1562 } else {
1563 return true;
1564 }
1565 }
1566 return false;
1567 };
1568 this.insideEnd = function(row, column) {
1569 if (this.compare(row, column) == 0) {
1570 if (this.isStart(row, column)) {
1571 return false;
1572 } else {
1573 return true;
1574 }
1575 }
1576 return false;
1577 };
1578 this.compare = function(row, column) {
1579 if (!this.isMultiLine()) {
1580 if (row === this.start.row) {
1581 return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
1582 };
1583 }
1584
1585 if (row < this.start.row)
1586 return -1;
1587
1588 if (row > this.end.row)
1589 return 1;
1590
1591 if (this.start.row === row)
1592 return column >= this.start.column ? 0 : -1;
1593
1594 if (this.end.row === row)
1595 return column <= this.end.column ? 0 : 1;
1596
1597 return 0;
1598 };
1599 this.compareStart = function(row, column) {
1600 if (this.start.row == row && this.start.column == column) {
1601 return -1;
1602 } else {
1603 return this.compare(row, column);
1604 }
1605 };
1606 this.compareEnd = function(row, column) {
1607 if (this.end.row == row && this.end.column == column) {
1608 return 1;
1609 } else {
1610 return this.compare(row, column);
1611 }
1612 };
1613 this.compareInside = function(row, column) {
1614 if (this.end.row == row && this.end.column == column) {
1615 return 1;
1616 } else if (this.start.row == row && this.start.column == column) {
1617 return -1;
1618 } else {
1619 return this.compare(row, column);
1620 }
1621 };
1622 this.clipRows = function(firstRow, lastRow) {
1623 if (this.end.row > lastRow)
1624 var end = {row: lastRow + 1, column: 0};
1625 else if (this.end.row < firstRow)
1626 var end = {row: firstRow, column: 0};
1627
1628 if (this.start.row > lastRow)
1629 var start = {row: lastRow + 1, column: 0};
1630 else if (this.start.row < firstRow)
1631 var start = {row: firstRow, column: 0};
1632
1633 return Range.fromPoints(start || this.start, end || this.end);
1634 };
1635 this.extend = function(row, column) {
1636 var cmp = this.compare(row, column);
1637
1638 if (cmp == 0)
1639 return this;
1640 else if (cmp == -1)
1641 var start = {row: row, column: column};
1642 else
1643 var end = {row: row, column: column};
1644
1645 return Range.fromPoints(start || this.start, end || this.end);
1646 };
1647
1648 this.isEmpty = function() {
1649 return (this.start.row === this.end.row && this.start.column === this.end.column);
1650 };
1651 this.isMultiLine = function() {
1652 return (this.start.row !== this.end.row);
1653 };
1654 this.clone = function() {
1655 return Range.fromPoints(this.start, this.end);
1656 };
1657 this.collapseRows = function() {
1658 if (this.end.column == 0)
1659 return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
1660 else
1661 return new Range(this.start.row, 0, this.end.row, 0)
1662 };
1663 this.toScreenRange = function(session) {
1664 var screenPosStart = session.documentToScreenPosition(this.start);
1665 var screenPosEnd = session.documentToScreenPosition(this.end);
1666
1667 return new Range(
1668 screenPosStart.row, screenPosStart.column,
1669 screenPosEnd.row, screenPosEnd.column
1670 );
1671 };
1672 this.moveBy = function(row, column) {
1673 this.start.row += row;
1674 this.start.column += column;
1675 this.end.row += row;
1676 this.end.column += column;
1677 };
1678
1679 }).call(Range.prototype);
1680 Range.fromPoints = function(start, end) {
1681 return new Range(start.row, start.column, end.row, end.column);
1682 };
1683 Range.comparePoints = comparePoints;
1684
1685 Range.comparePoints = function(p1, p2) {
1686 return p1.row - p2.row || p1.column - p2.column;
1687 };
1688
1689
1690 exports.Range = Range;
1691 });
1692
1693 define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
1694
1695
1696 var oop = require("./lib/oop");
1697 var EventEmitter = require("./lib/event_emitter").EventEmitter;
1698
1699 var Anchor = exports.Anchor = function(doc, row, column) {
1700 this.document = doc;
1701
1702 if (typeof column == "undefined")
1703 this.setPosition(row.row, row.column);
1704 else
1705 this.setPosition(row, column);
1706
1707 this.$onChange = this.onChange.bind(this);
1708 doc.on("change", this.$onChange);
1709 };
1710
1711 (function() {
1712
1713 oop.implement(this, EventEmitter);
1714
1715 this.getPosition = function() {
1716 return this.$clipPositionToDocument(this.row, this.column);
1717 };
1718
1719 this.getDocument = function() {
1720 return this.document;
1721 };
1722
1723 this.onChange = function(e) {
1724 var delta = e.data;
1725 var range = delta.range;
1726
1727 if (range.start.row == range.end.row && range.start.row != this.row)
1728 return;
1729
1730 if (range.start.row > this.row)
1731 return;
1732
1733 if (range.start.row == this.row && range.start.column > this.column)
1734 return;
1735
1736 var row = this.row;
1737 var column = this.column;
1738 var start = range.start;
1739 var end = range.end;
1740
1741 if (delta.action === "insertText") {
1742 if (start.row === row && start.column <= column) {
1743 if (start.row === end.row) {
1744 column += end.column - start.column;
1745 } else {
1746 column -= start.column;
1747 row += end.row - start.row;
1748 }
1749 } else if (start.row !== end.row && start.row < row) {
1750 row += end.row - start.row;
1751 }
1752 } else if (delta.action === "insertLines") {
1753 if (start.row <= row) {
1754 row += end.row - start.row;
1755 }
1756 } else if (delta.action === "removeText") {
1757 if (start.row === row && start.column < column) {
1758 if (end.column >= column)
1759 column = start.column;
1760 else
1761 column = Math.max(0, column - (end.column - start.column));
1762
1763 } else if (start.row !== end.row && start.row < row) {
1764 if (end.row === row)
1765 column = Math.max(0, column - end.column) + start.column;
1766 row -= (end.row - start.row);
1767 } else if (end.row === row) {
1768 row -= end.row - start.row;
1769 column = Math.max(0, column - end.column) + start.column;
1770 }
1771 } else if (delta.action == "removeLines") {
1772 if (start.row <= row) {
1773 if (end.row <= row)
1774 row -= end.row - start.row;
1775 else {
1776 row = start.row;
1777 column = 0;
1778 }
1779 }
1780 }
1781
1782 this.setPosition(row, column, true);
1783 };
1784
1785 this.setPosition = function(row, column, noClip) {
1786 var pos;
1787 if (noClip) {
1788 pos = {
1789 row: row,
1790 column: column
1791 };
1792 } else {
1793 pos = this.$clipPositionToDocument(row, column);
1794 }
1795
1796 if (this.row == pos.row && this.column == pos.column)
1797 return;
1798
1799 var old = {
1800 row: this.row,
1801 column: this.column
1802 };
1803
1804 this.row = pos.row;
1805 this.column = pos.column;
1806 this._emit("change", {
1807 old: old,
1808 value: pos
1809 });
1810 };
1811
1812 this.detach = function() {
1813 this.document.removeEventListener("change", this.$onChange);
1814 };
1815 this.$clipPositionToDocument = function(row, column) {
1816 var pos = {};
1817
1818 if (row >= this.document.getLength()) {
1819 pos.row = Math.max(0, this.document.getLength() - 1);
1820 pos.column = this.document.getLine(pos.row).length;
1821 }
1822 else if (row < 0) {
1823 pos.row = 0;
1824 pos.column = 0;
1825 }
1826 else {
1827 pos.row = row;
1828 pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
1829 }
1830
1831 if (column < 0)
1832 pos.column = 0;
1833
1834 return pos;
1835 };
1836
1837 }).call(Anchor.prototype);
1838
1839 });
1840
1841 define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
1842
1843
1844 exports.stringReverse = function(string) {
1845 return string.split("").reverse().join("");
1846 };
1847
1848 exports.stringRepeat = function (string, count) {
1849 var result = '';
1850 while (count > 0) {
1851 if (count & 1)
1852 result += string;
1853
1854 if (count >>= 1)
1855 string += string;
1856 }
1857 return result;
1858 };
1859
1860 var trimBeginRegexp = /^\s\s*/;
1861 var trimEndRegexp = /\s\s*$/;
1862
1863 exports.stringTrimLeft = function (string) {
1864 return string.replace(trimBeginRegexp, '');
1865 };
1866
1867 exports.stringTrimRight = function (string) {
1868 return string.replace(trimEndRegexp, '');
1869 };
1870
1871 exports.copyObject = function(obj) {
1872 var copy = {};
1873 for (var key in obj) {
1874 copy[key] = obj[key];
1875 }
1876 return copy;
1877 };
1878
1879 exports.copyArray = function(array){
1880 var copy = [];
1881 for (var i=0, l=array.length; i<l; i++) {
1882 if (array[i] && typeof array[i] == "object")
1883 copy[i] = this.copyObject( array[i] );
1884 else
1885 copy[i] = array[i];
1886 }
1887 return copy;
1888 };
1889
1890 exports.deepCopy = function (obj) {
1891 if (typeof obj != "object") {
1892 return obj;
1893 }
1894
1895 var copy = obj.constructor();
1896 for (var key in obj) {
1897 if (typeof obj[key] == "object") {
1898 copy[key] = this.deepCopy(obj[key]);
1899 } else {
1900 copy[key] = obj[key];
1901 }
1902 }
1903 return copy;
1904 };
1905
1906 exports.arrayToMap = function(arr) {
1907 var map = {};
1908 for (var i=0; i<arr.length; i++) {
1909 map[arr[i]] = 1;
1910 }
1911 return map;
1912
1913 };
1914
1915 exports.createMap = function(props) {
1916 var map = Object.create(null);
1917 for (var i in props) {
1918 map[i] = props[i];
1919 }
1920 return map;
1921 };
1922 exports.arrayRemove = function(array, value) {
1923 for (var i = 0; i <= array.length; i++) {
1924 if (value === array[i]) {
1925 array.splice(i, 1);
1926 }
1927 }
1928 };
1929
1930 exports.escapeRegExp = function(str) {
1931 return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
1932 };
1933
1934 exports.escapeHTML = function(str) {
1935 return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
1936 };
1937
1938 exports.getMatchOffsets = function(string, regExp) {
1939 var matches = [];
1940
1941 string.replace(regExp, function(str) {
1942 matches.push({
1943 offset: arguments[arguments.length-2],
1944 length: str.length
1945 });
1946 });
1947
1948 return matches;
1949 };
1950 exports.deferredCall = function(fcn) {
1951
1952 var timer = null;
1953 var callback = function() {
1954 timer = null;
1955 fcn();
1956 };
1957
1958 var deferred = function(timeout) {
1959 deferred.cancel();
1960 timer = setTimeout(callback, timeout || 0);
1961 return deferred;
1962 };
1963
1964 deferred.schedule = deferred;
1965
1966 deferred.call = function() {
1967 this.cancel();
1968 fcn();
1969 return deferred;
1970 };
1971
1972 deferred.cancel = function() {
1973 clearTimeout(timer);
1974 timer = null;
1975 return deferred;
1976 };
1977
1978 return deferred;
1979 };
1980
1981
1982 exports.delayedCall = function(fcn, defaultTimeout) {
1983 var timer = null;
1984 var callback = function() {
1985 timer = null;
1986 fcn();
1987 };
1988
1989 var _self = function(timeout) {
1990 timer && clearTimeout(timer);
1991 timer = setTimeout(callback, timeout || defaultTimeout);
1992 };
1993
1994 _self.delay = _self;
1995 _self.schedule = function(timeout) {
1996 if (timer == null)
1997 timer = setTimeout(callback, timeout || 0);
1998 };
1999
2000 _self.call = function() {
2001 this.cancel();
2002 fcn();
2003 };
2004
2005 _self.cancel = function() {
2006 timer && clearTimeout(timer);
2007 timer = null;
2008 };
2009
2010 _self.isPending = function() {
2011 return timer;
2012 };
2013
2014 return _self;
2015 };
2016 });
2017
2018 define('ace/mode/xquery/JSONParseTreeHandler', ['require', 'exports', 'module' ], function(require, exports, module) {
2019
2020 var JSONParseTreeHandler = exports.JSONParseTreeHandler = function(code) {
2021 var list = [
2022 "OrExpr", "AndExpr", "ComparisonExpr", "StringConcatExpr", "RangeExpr"
2023 , "UnionExpr", "IntersectExceptExpr", "InstanceofExpr", "TreatExpr", "CastableExpr"
2024 , "CastExpr", "UnaryExpr", "ValueExpr", "FTContainsExpr", "SimpleMapExpr", "PathExpr", "RelativePathExpr"
2025 , "PostfixExpr", "StepExpr"
2026 ];
2027
2028 var ast = null;
2029 var ptr = null;
2030 var remains = code;
2031 var cursor = 0;
2032 var lineCursor = 0;
2033 var line = 0;
2034 var col = 0;
2035
2036 function createNode(name){
2037 return { name: name, children: [], getParent: null, pos: { sl: 0, sc: 0, el: 0, ec: 0 } };
2038 }
2039
2040 function pushNode(name, begin){
2041 var node = createNode(name);
2042 if(ast === null) {
2043 ast = node;
2044 ptr = node;
2045 } else {
2046 node.getParent = ptr;
2047 ptr.children.push(node);
2048 ptr = ptr.children[ptr.children.length - 1];
2049 }
2050 }
2051
2052 function popNode(){
2053
2054 if(ptr.children.length > 0) {
2055 var s = ptr.children[0];
2056 var e = null;
2057 for(var i= ptr.children.length - 1; i >= 0;i--) {
2058 e = ptr.children[i];
2059 if(e.pos.el !== 0 || e.pos.ec !== 0) {
2060 break;
2061 }
2062 }
2063 ptr.pos.sl = s.pos.sl;
2064 ptr.pos.sc = s.pos.sc;
2065 ptr.pos.el = e.pos.el;
2066 ptr.pos.ec = e.pos.ec;
2067 }
2068 if(ptr.name === "FunctionName") {
2069 ptr.name = "EQName";
2070 }
2071 if(ptr.name === "EQName" && ptr.value === undefined) {
2072 ptr.value = ptr.children[0].value;
2073 ptr.children.pop();
2074 }
2075
2076 if(ptr.getParent !== null) {
2077 ptr = ptr.getParent;
2078 } else {
2079 }
2080 if(ptr.children.length > 0) {
2081 var lastChild = ptr.children[ptr.children.length - 1];
2082 if(lastChild.children.length === 1 && list.indexOf(lastChild.name) !== -1) {
2083 ptr.children[ptr.children.length - 1] = lastChild.children[0];
2084 }
2085 }
2086 }
2087
2088 this.closeParseTree = function() {
2089 while(ptr.getParent !== null) {
2090 popNode();
2091 }
2092 popNode();
2093 };
2094
2095 this.peek = function() {
2096 return ptr;
2097 };
2098
2099 this.getParseTree = function() {
2100 return ast;
2101 };
2102
2103 this.reset = function(input) {};
2104
2105 this.startNonterminal = function(name, begin) {
2106 pushNode(name, begin);
2107 };
2108
2109 this.endNonterminal = function(name, end) {
2110 popNode();
2111 };
2112
2113 this.terminal = function(name, begin, end) {
2114 name = (name.substring(0, 1) === "'" && name.substring(name.length - 1) === "'") ? "TOKEN" : name;
2115 pushNode(name, begin);
2116 setValue(ptr, begin, end);
2117 popNode();
2118 };
2119
2120 this.whitespace = function(begin, end) {
2121 var name = "WS";
2122 pushNode(name, begin);
2123 setValue(ptr, begin, end);
2124 popNode();
2125 };
2126
2127 function setValue(node, begin, end) {
2128
2129 var e = end - cursor;
2130 ptr.value = remains.substring(0, e);
2131 remains = remains.substring(e);
2132 cursor = end;
2133
2134 var sl = line;
2135 var sc = lineCursor;
2136 var el = sl + ptr.value.split("\n").length - 1;
2137 var lastIdx = ptr.value.lastIndexOf("\n");
2138 var ec = lastIdx === -1 ? sc + ptr.value.length : ptr.value.substring(lastIdx + 1).length;
2139
2140 line = el;
2141 lineCursor = ec;
2142
2143 ptr.pos.sl = sl;
2144 ptr.pos.sc = sc;
2145 ptr.pos.el = el;
2146 ptr.pos.ec = ec;
2147 }
2148 };
2149 });
2150
2151 define('ace/mode/xquery/XQueryParser', ['require', 'exports', 'module' ], function(require, exports, module) {
2152 var XQueryParser = exports.XQueryParser = function XQueryParser(string, parsingEventHandler)
2153 {
2154 init(string, parsingEventHandler);
2155 var self = this;
2156
2157 this.ParseException = function(b, e, s, o, x)
2158 {
2159 var
2160 begin = b,
2161 end = e,
2162 state = s,
2163 offending = o,
2164 expected = x;
2165
2166 this.getBegin = function() {return begin;};
2167 this.getEnd = function() {return end;};
2168 this.getState = function() {return state;};
2169 this.getExpected = function() {return expected;};
2170 this.getOffending = function() {return offending;};
2171
2172 this.getMessage = function()
2173 {
2174 return offending < 0 ? "lexical analysis failed" : "syntax error";
2175 };
2176 };
2177
2178 function init(string, parsingEventHandler)
2179 {
2180 eventHandler = parsingEventHandler;
2181 input = string;
2182 size = string.length;
2183 reset(0, 0, 0);
2184 }
2185
2186 this.getInput = function()
2187 {
2188 return input;
2189 };
2190
2191 function reset(l, b, e)
2192 {
2193 b0 = b; e0 = b;
2194 l1 = l; b1 = b; e1 = e;
2195 l2 = 0;
2196 end = e;
2197 ex = -1;
2198 memo = {};
2199 eventHandler.reset(input);
2200 }
2201
2202 this.getOffendingToken = function(e)
2203 {
2204 var o = e.getOffending();
2205 return o >= 0 ? XQueryParser.TOKEN[o] : null;
2206 };
2207
2208 this.getExpectedTokenSet = function(e)
2209 {
2210 var expected;
2211 if (e.getExpected() < 0)
2212 {
2213 expected = XQueryParser.getTokenSet(- e.getState());
2214 }
2215 else
2216 {
2217 expected = [XQueryParser.TOKEN[e.getExpected()]];
2218 }
2219 return expected;
2220 };
2221
2222 this.getErrorMessage = function(e)
2223 {
2224 var tokenSet = this.getExpectedTokenSet(e);
2225 var found = this.getOffendingToken(e);
2226 var prefix = input.substring(0, e.getBegin());
2227 var lines = prefix.split("\n");
2228 var line = lines.length;
2229 var column = lines[line - 1].length + 1;
2230 var size = e.getEnd() - e.getBegin();
2231 return e.getMessage()
2232 + (found == null ? "" : ", found " + found)
2233 + "\nwhile expecting "
2234 + (tokenSet.length == 1 ? tokenSet[0] : ("[" + tokenSet.join(", ") + "]"))
2235 + "\n"
2236 + (size == 0 || found != null ? "" : "after successfully scanning " + size + " characters beginning ")
2237 + "at line " + line + ", column " + column + ":\n..."
2238 + input.substring(e.getBegin(), Math.min(input.length, e.getBegin() + 64))
2239 + "...";
2240 };
2241
2242 this.parse_XQuery = function()
2243 {
2244 eventHandler.startNonterminal("XQuery", e0);
2245 lookahead1W(268); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
2246 whitespace();
2247 parse_Module();
2248 shift(25); // EOF
2249 eventHandler.endNonterminal("XQuery", e0);
2250 };
2251
2252 function parse_Module()
2253 {
2254 eventHandler.startNonterminal("Module", e0);
2255 switch (l1)
2256 {
2257 case 274: // 'xquery'
2258 lookahead2W(199); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
2259 break;
2260 default:
2261 lk = l1;
2262 }
2263 if (lk == 64274 // 'xquery' 'encoding'
2264 || lk == 134930) // 'xquery' 'version'
2265 {
2266 parse_VersionDecl();
2267 }
2268 lookahead1W(268); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
2269 switch (l1)
2270 {
2271 case 182: // 'module'
2272 lookahead2W(194); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
2273 break;
2274 default:
2275 lk = l1;
2276 }
2277 switch (lk)
2278 {
2279 case 94390: // 'module' 'namespace'
2280 whitespace();
2281 parse_LibraryModule();
2282 break;
2283 default:
2284 whitespace();
2285 parse_MainModule();
2286 }
2287 eventHandler.endNonterminal("Module", e0);
2288 }
2289
2290 function parse_VersionDecl()
2291 {
2292 eventHandler.startNonterminal("VersionDecl", e0);
2293 shift(274); // 'xquery'
2294 lookahead1W(116); // S^WS | '(:' | 'encoding' | 'version'
2295 switch (l1)
2296 {
2297 case 125: // 'encoding'
2298 shift(125); // 'encoding'
2299 lookahead1W(17); // StringLiteral | S^WS | '(:'
2300 shift(11); // StringLiteral
2301 break;
2302 default:
2303 shift(263); // 'version'
2304 lookahead1W(17); // StringLiteral | S^WS | '(:'
2305 shift(11); // StringLiteral
2306 lookahead1W(109); // S^WS | '(:' | ';' | 'encoding'
2307 if (l1 == 125) // 'encoding'
2308 {
2309 shift(125); // 'encoding'
2310 lookahead1W(17); // StringLiteral | S^WS | '(:'
2311 shift(11); // StringLiteral
2312 }
2313 }
2314 lookahead1W(28); // S^WS | '(:' | ';'
2315 whitespace();
2316 parse_Separator();
2317 eventHandler.endNonterminal("VersionDecl", e0);
2318 }
2319
2320 function parse_LibraryModule()
2321 {
2322 eventHandler.startNonterminal("LibraryModule", e0);
2323 parse_ModuleDecl();
2324 lookahead1W(138); // S^WS | EOF | '(:' | 'declare' | 'import'
2325 whitespace();
2326 parse_Prolog();
2327 eventHandler.endNonterminal("LibraryModule", e0);
2328 }
2329
2330 function parse_ModuleDecl()
2331 {
2332 eventHandler.startNonterminal("ModuleDecl", e0);
2333 shift(182); // 'module'
2334 lookahead1W(61); // S^WS | '(:' | 'namespace'
2335 shift(184); // 'namespace'
2336 lookahead1W(247); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
2337 whitespace();
2338 parse_NCName();
2339 lookahead1W(29); // S^WS | '(:' | '='
2340 shift(60); // '='
2341 lookahead1W(15); // URILiteral | S^WS | '(:'
2342 shift(7); // URILiteral
2343 lookahead1W(28); // S^WS | '(:' | ';'
2344 whitespace();
2345 parse_Separator();
2346 eventHandler.endNonterminal("ModuleDecl", e0);
2347 }
2348
2349 function parse_Prolog()
2350 {
2351 eventHandler.startNonterminal("Prolog", e0);
2352 for (;;)
2353 {
2354 lookahead1W(268); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
2355 switch (l1)
2356 {
2357 case 108: // 'declare'
2358 lookahead2W(213); // S^WS | EOF | '!' | '!=' | '#' | '%' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' |
2359 break;
2360 case 153: // 'import'
2361 lookahead2W(201); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
2362 break;
2363 default:
2364 lk = l1;
2365 }
2366 if (lk != 42604 // 'declare' 'base-uri'
2367 && lk != 43628 // 'declare' 'boundary-space'
2368 && lk != 50284 // 'declare' 'construction'
2369 && lk != 53356 // 'declare' 'copy-namespaces'
2370 && lk != 54380 // 'declare' 'decimal-format'
2371 && lk != 55916 // 'declare' 'default'
2372 && lk != 72300 // 'declare' 'ft-option'
2373 && lk != 93337 // 'import' 'module'
2374 && lk != 94316 // 'declare' 'namespace'
2375 && lk != 104044 // 'declare' 'ordering'
2376 && lk != 113772 // 'declare' 'revalidation'
2377 && lk != 115353) // 'import' 'schema'
2378 {
2379 break;
2380 }
2381 switch (l1)
2382 {
2383 case 108: // 'declare'
2384 lookahead2W(178); // S^WS | '(:' | 'base-uri' | 'boundary-space' | 'construction' |
2385 break;
2386 default:
2387 lk = l1;
2388 }
2389 if (lk == 55916) // 'declare' 'default'
2390 {
2391 lk = memoized(0, e0);
2392 if (lk == 0)
2393 {
2394 var b0A = b0; var e0A = e0; var l1A = l1;
2395 var b1A = b1; var e1A = e1; var l2A = l2;
2396 var b2A = b2; var e2A = e2;
2397 try
2398 {
2399 try_DefaultNamespaceDecl();
2400 lk = -1;
2401 }
2402 catch (p1A)
2403 {
2404 lk = -2;
2405 }
2406 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
2407 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
2408 b2 = b2A; e2 = e2A; end = e2A; }}
2409 memoize(0, e0, lk);
2410 }
2411 }
2412 switch (lk)
2413 {
2414 case -1:
2415 whitespace();
2416 parse_DefaultNamespaceDecl();
2417 break;
2418 case 94316: // 'declare' 'namespace'
2419 whitespace();
2420 parse_NamespaceDecl();
2421 break;
2422 case 153: // 'import'
2423 whitespace();
2424 parse_Import();
2425 break;
2426 case 72300: // 'declare' 'ft-option'
2427 whitespace();
2428 parse_FTOptionDecl();
2429 break;
2430 default:
2431 whitespace();
2432 parse_Setter();
2433 }
2434 lookahead1W(28); // S^WS | '(:' | ';'
2435 whitespace();
2436 parse_Separator();
2437 }
2438 for (;;)
2439 {
2440 lookahead1W(268); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
2441 switch (l1)
2442 {
2443 case 108: // 'declare'
2444 lookahead2W(210); // S^WS | EOF | '!' | '!=' | '#' | '%' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' |
2445 break;
2446 default:
2447 lk = l1;
2448 }
2449 if (lk != 16492 // 'declare' '%'
2450 && lk != 48748 // 'declare' 'collection'
2451 && lk != 51820 // 'declare' 'context'
2452 && lk != 74348 // 'declare' 'function'
2453 && lk != 79468 // 'declare' 'index'
2454 && lk != 82540 // 'declare' 'integrity'
2455 && lk != 101996 // 'declare' 'option'
2456 && lk != 131692 // 'declare' 'updating'
2457 && lk != 134252) // 'declare' 'variable'
2458 {
2459 break;
2460 }
2461 switch (l1)
2462 {
2463 case 108: // 'declare'
2464 lookahead2W(175); // S^WS | '%' | '(:' | 'collection' | 'context' | 'function' | 'index' |
2465 break;
2466 default:
2467 lk = l1;
2468 }
2469 switch (lk)
2470 {
2471 case 51820: // 'declare' 'context'
2472 whitespace();
2473 parse_ContextItemDecl();
2474 break;
2475 case 101996: // 'declare' 'option'
2476 whitespace();
2477 parse_OptionDecl();
2478 break;
2479 default:
2480 whitespace();
2481 parse_AnnotatedDecl();
2482 }
2483 lookahead1W(28); // S^WS | '(:' | ';'
2484 whitespace();
2485 parse_Separator();
2486 }
2487 eventHandler.endNonterminal("Prolog", e0);
2488 }
2489
2490 function parse_Separator()
2491 {
2492 eventHandler.startNonterminal("Separator", e0);
2493 shift(53); // ';'
2494 eventHandler.endNonterminal("Separator", e0);
2495 }
2496
2497 function parse_Setter()
2498 {
2499 eventHandler.startNonterminal("Setter", e0);
2500 switch (l1)
2501 {
2502 case 108: // 'declare'
2503 lookahead2W(172); // S^WS | '(:' | 'base-uri' | 'boundary-space' | 'construction' |
2504 break;
2505 default:
2506 lk = l1;
2507 }
2508 if (lk == 55916) // 'declare' 'default'
2509 {
2510 lk = memoized(1, e0);
2511 if (lk == 0)
2512 {
2513 var b0A = b0; var e0A = e0; var l1A = l1;
2514 var b1A = b1; var e1A = e1; var l2A = l2;
2515 var b2A = b2; var e2A = e2;
2516 try
2517 {
2518 try_DefaultCollationDecl();
2519 lk = -2;
2520 }
2521 catch (p2A)
2522 {
2523 try
2524 {
2525 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
2526 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
2527 b2 = b2A; e2 = e2A; end = e2A; }}
2528 try_EmptyOrderDecl();
2529 lk = -6;
2530 }
2531 catch (p6A)
2532 {
2533 lk = -9;
2534 }
2535 }
2536 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
2537 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
2538 b2 = b2A; e2 = e2A; end = e2A; }}
2539 memoize(1, e0, lk);
2540 }
2541 }
2542 switch (lk)
2543 {
2544 case 43628: // 'declare' 'boundary-space'
2545 parse_BoundarySpaceDecl();
2546 break;
2547 case -2:
2548 parse_DefaultCollationDecl();
2549 break;
2550 case 42604: // 'declare' 'base-uri'
2551 parse_BaseURIDecl();
2552 break;
2553 case 50284: // 'declare' 'construction'
2554 parse_ConstructionDecl();
2555 break;
2556 case 104044: // 'declare' 'ordering'
2557 parse_OrderingModeDecl();
2558 break;
2559 case -6:
2560 parse_EmptyOrderDecl();
2561 break;
2562 case 113772: // 'declare' 'revalidation'
2563 parse_RevalidationDecl();
2564 break;
2565 case 53356: // 'declare' 'copy-namespaces'
2566 parse_CopyNamespacesDecl();
2567 break;
2568 default:
2569 parse_DecimalFormatDecl();
2570 }
2571 eventHandler.endNonterminal("Setter", e0);
2572 }
2573
2574 function parse_BoundarySpaceDecl()
2575 {
2576 eventHandler.startNonterminal("BoundarySpaceDecl", e0);
2577 shift(108); // 'declare'
2578 lookahead1W(33); // S^WS | '(:' | 'boundary-space'
2579 shift(85); // 'boundary-space'
2580 lookahead1W(133); // S^WS | '(:' | 'preserve' | 'strip'
2581 switch (l1)
2582 {
2583 case 214: // 'preserve'
2584 shift(214); // 'preserve'
2585 break;
2586 default:
2587 shift(241); // 'strip'
2588 }
2589 eventHandler.endNonterminal("BoundarySpaceDecl", e0);
2590 }
2591
2592 function parse_DefaultCollationDecl()
2593 {
2594 eventHandler.startNonterminal("DefaultCollationDecl", e0);
2595 shift(108); // 'declare'
2596 lookahead1W(46); // S^WS | '(:' | 'default'
2597 shift(109); // 'default'
2598 lookahead1W(38); // S^WS | '(:' | 'collation'
2599 shift(94); // 'collation'
2600 lookahead1W(15); // URILiteral | S^WS | '(:'
2601 shift(7); // URILiteral
2602 eventHandler.endNonterminal("DefaultCollationDecl", e0);
2603 }
2604
2605 function try_DefaultCollationDecl()
2606 {
2607 shiftT(108); // 'declare'
2608 lookahead1W(46); // S^WS | '(:' | 'default'
2609 shiftT(109); // 'default'
2610 lookahead1W(38); // S^WS | '(:' | 'collation'
2611 shiftT(94); // 'collation'
2612 lookahead1W(15); // URILiteral | S^WS | '(:'
2613 shiftT(7); // URILiteral
2614 }
2615
2616 function parse_BaseURIDecl()
2617 {
2618 eventHandler.startNonterminal("BaseURIDecl", e0);
2619 shift(108); // 'declare'
2620 lookahead1W(32); // S^WS | '(:' | 'base-uri'
2621 shift(83); // 'base-uri'
2622 lookahead1W(15); // URILiteral | S^WS | '(:'
2623 shift(7); // URILiteral
2624 eventHandler.endNonterminal("BaseURIDecl", e0);
2625 }
2626
2627 function parse_ConstructionDecl()
2628 {
2629 eventHandler.startNonterminal("ConstructionDecl", e0);
2630 shift(108); // 'declare'
2631 lookahead1W(41); // S^WS | '(:' | 'construction'
2632 shift(98); // 'construction'
2633 lookahead1W(133); // S^WS | '(:' | 'preserve' | 'strip'
2634 switch (l1)
2635 {
2636 case 241: // 'strip'
2637 shift(241); // 'strip'
2638 break;
2639 default:
2640 shift(214); // 'preserve'
2641 }
2642 eventHandler.endNonterminal("ConstructionDecl", e0);
2643 }
2644
2645 function parse_OrderingModeDecl()
2646 {
2647 eventHandler.startNonterminal("OrderingModeDecl", e0);
2648 shift(108); // 'declare'
2649 lookahead1W(68); // S^WS | '(:' | 'ordering'
2650 shift(203); // 'ordering'
2651 lookahead1W(131); // S^WS | '(:' | 'ordered' | 'unordered'
2652 switch (l1)
2653 {
2654 case 202: // 'ordered'
2655 shift(202); // 'ordered'
2656 break;
2657 default:
2658 shift(256); // 'unordered'
2659 }
2660 eventHandler.endNonterminal("OrderingModeDecl", e0);
2661 }
2662
2663 function parse_EmptyOrderDecl()
2664 {
2665 eventHandler.startNonterminal("EmptyOrderDecl", e0);
2666 shift(108); // 'declare'
2667 lookahead1W(46); // S^WS | '(:' | 'default'
2668 shift(109); // 'default'
2669 lookahead1W(67); // S^WS | '(:' | 'order'
2670 shift(201); // 'order'
2671 lookahead1W(49); // S^WS | '(:' | 'empty'
2672 shift(123); // 'empty'
2673 lookahead1W(121); // S^WS | '(:' | 'greatest' | 'least'
2674 switch (l1)
2675 {
2676 case 147: // 'greatest'
2677 shift(147); // 'greatest'
2678 break;
2679 default:
2680 shift(173); // 'least'
2681 }
2682 eventHandler.endNonterminal("EmptyOrderDecl", e0);
2683 }
2684
2685 function try_EmptyOrderDecl()
2686 {
2687 shiftT(108); // 'declare'
2688 lookahead1W(46); // S^WS | '(:' | 'default'
2689 shiftT(109); // 'default'
2690 lookahead1W(67); // S^WS | '(:' | 'order'
2691 shiftT(201); // 'order'
2692 lookahead1W(49); // S^WS | '(:' | 'empty'
2693 shiftT(123); // 'empty'
2694 lookahead1W(121); // S^WS | '(:' | 'greatest' | 'least'
2695 switch (l1)
2696 {
2697 case 147: // 'greatest'
2698 shiftT(147); // 'greatest'
2699 break;
2700 default:
2701 shiftT(173); // 'least'
2702 }
2703 }
2704
2705 function parse_CopyNamespacesDecl()
2706 {
2707 eventHandler.startNonterminal("CopyNamespacesDecl", e0);
2708 shift(108); // 'declare'
2709 lookahead1W(44); // S^WS | '(:' | 'copy-namespaces'
2710 shift(104); // 'copy-namespaces'
2711 lookahead1W(128); // S^WS | '(:' | 'no-preserve' | 'preserve'
2712 whitespace();
2713 parse_PreserveMode();
2714 lookahead1W(25); // S^WS | '(:' | ','
2715 shift(41); // ','
2716 lookahead1W(123); // S^WS | '(:' | 'inherit' | 'no-inherit'
2717 whitespace();
2718 parse_InheritMode();
2719 eventHandler.endNonterminal("CopyNamespacesDecl", e0);
2720 }
2721
2722 function parse_PreserveMode()
2723 {
2724 eventHandler.startNonterminal("PreserveMode", e0);
2725 switch (l1)
2726 {
2727 case 214: // 'preserve'
2728 shift(214); // 'preserve'
2729 break;
2730 default:
2731 shift(190); // 'no-preserve'
2732 }
2733 eventHandler.endNonterminal("PreserveMode", e0);
2734 }
2735
2736 function parse_InheritMode()
2737 {
2738 eventHandler.startNonterminal("InheritMode", e0);
2739 switch (l1)
2740 {
2741 case 157: // 'inherit'
2742 shift(157); // 'inherit'
2743 break;
2744 default:
2745 shift(189); // 'no-inherit'
2746 }
2747 eventHandler.endNonterminal("InheritMode", e0);
2748 }
2749
2750 function parse_DecimalFormatDecl()
2751 {
2752 eventHandler.startNonterminal("DecimalFormatDecl", e0);
2753 shift(108); // 'declare'
2754 lookahead1W(114); // S^WS | '(:' | 'decimal-format' | 'default'
2755 switch (l1)
2756 {
2757 case 106: // 'decimal-format'
2758 shift(106); // 'decimal-format'
2759 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
2760 whitespace();
2761 parse_EQName();
2762 break;
2763 default:
2764 shift(109); // 'default'
2765 lookahead1W(45); // S^WS | '(:' | 'decimal-format'
2766 shift(106); // 'decimal-format'
2767 }
2768 for (;;)
2769 {
2770 lookahead1W(180); // S^WS | '(:' | ';' | 'NaN' | 'decimal-separator' | 'digit' |
2771 if (l1 == 53) // ';'
2772 {
2773 break;
2774 }
2775 whitespace();
2776 parse_DFPropertyName();
2777 lookahead1W(29); // S^WS | '(:' | '='
2778 shift(60); // '='
2779 lookahead1W(17); // StringLiteral | S^WS | '(:'
2780 shift(11); // StringLiteral
2781 }
2782 eventHandler.endNonterminal("DecimalFormatDecl", e0);
2783 }
2784
2785 function parse_DFPropertyName()
2786 {
2787 eventHandler.startNonterminal("DFPropertyName", e0);
2788 switch (l1)
2789 {
2790 case 107: // 'decimal-separator'
2791 shift(107); // 'decimal-separator'
2792 break;
2793 case 149: // 'grouping-separator'
2794 shift(149); // 'grouping-separator'
2795 break;
2796 case 156: // 'infinity'
2797 shift(156); // 'infinity'
2798 break;
2799 case 179: // 'minus-sign'
2800 shift(179); // 'minus-sign'
2801 break;
2802 case 67: // 'NaN'
2803 shift(67); // 'NaN'
2804 break;
2805 case 209: // 'percent'
2806 shift(209); // 'percent'
2807 break;
2808 case 208: // 'per-mille'
2809 shift(208); // 'per-mille'
2810 break;
2811 case 275: // 'zero-digit'
2812 shift(275); // 'zero-digit'
2813 break;
2814 case 116: // 'digit'
2815 shift(116); // 'digit'
2816 break;
2817 default:
2818 shift(207); // 'pattern-separator'
2819 }
2820 eventHandler.endNonterminal("DFPropertyName", e0);
2821 }
2822
2823 function parse_Import()
2824 {
2825 eventHandler.startNonterminal("Import", e0);
2826 switch (l1)
2827 {
2828 case 153: // 'import'
2829 lookahead2W(126); // S^WS | '(:' | 'module' | 'schema'
2830 break;
2831 default:
2832 lk = l1;
2833 }
2834 switch (lk)
2835 {
2836 case 115353: // 'import' 'schema'
2837 parse_SchemaImport();
2838 break;
2839 default:
2840 parse_ModuleImport();
2841 }
2842 eventHandler.endNonterminal("Import", e0);
2843 }
2844
2845 function parse_SchemaImport()
2846 {
2847 eventHandler.startNonterminal("SchemaImport", e0);
2848 shift(153); // 'import'
2849 lookahead1W(73); // S^WS | '(:' | 'schema'
2850 shift(225); // 'schema'
2851 lookahead1W(137); // URILiteral | S^WS | '(:' | 'default' | 'namespace'
2852 if (l1 != 7) // URILiteral
2853 {
2854 whitespace();
2855 parse_SchemaPrefix();
2856 }
2857 lookahead1W(15); // URILiteral | S^WS | '(:'
2858 shift(7); // URILiteral
2859 lookahead1W(108); // S^WS | '(:' | ';' | 'at'
2860 if (l1 == 81) // 'at'
2861 {
2862 shift(81); // 'at'
2863 lookahead1W(15); // URILiteral | S^WS | '(:'
2864 shift(7); // URILiteral
2865 for (;;)
2866 {
2867 lookahead1W(103); // S^WS | '(:' | ',' | ';'
2868 if (l1 != 41) // ','
2869 {
2870 break;
2871 }
2872 shift(41); // ','
2873 lookahead1W(15); // URILiteral | S^WS | '(:'
2874 shift(7); // URILiteral
2875 }
2876 }
2877 eventHandler.endNonterminal("SchemaImport", e0);
2878 }
2879
2880 function parse_SchemaPrefix()
2881 {
2882 eventHandler.startNonterminal("SchemaPrefix", e0);
2883 switch (l1)
2884 {
2885 case 184: // 'namespace'
2886 shift(184); // 'namespace'
2887 lookahead1W(247); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
2888 whitespace();
2889 parse_NCName();
2890 lookahead1W(29); // S^WS | '(:' | '='
2891 shift(60); // '='
2892 break;
2893 default:
2894 shift(109); // 'default'
2895 lookahead1W(47); // S^WS | '(:' | 'element'
2896 shift(121); // 'element'
2897 lookahead1W(61); // S^WS | '(:' | 'namespace'
2898 shift(184); // 'namespace'
2899 }
2900 eventHandler.endNonterminal("SchemaPrefix", e0);
2901 }
2902
2903 function parse_ModuleImport()
2904 {
2905 eventHandler.startNonterminal("ModuleImport", e0);
2906 shift(153); // 'import'
2907 lookahead1W(60); // S^WS | '(:' | 'module'
2908 shift(182); // 'module'
2909 lookahead1W(90); // URILiteral | S^WS | '(:' | 'namespace'
2910 if (l1 == 184) // 'namespace'
2911 {
2912 shift(184); // 'namespace'
2913 lookahead1W(247); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
2914 whitespace();
2915 parse_NCName();
2916 lookahead1W(29); // S^WS | '(:' | '='
2917 shift(60); // '='
2918 }
2919 lookahead1W(15); // URILiteral | S^WS | '(:'
2920 shift(7); // URILiteral
2921 lookahead1W(108); // S^WS | '(:' | ';' | 'at'
2922 if (l1 == 81) // 'at'
2923 {
2924 shift(81); // 'at'
2925 lookahead1W(15); // URILiteral | S^WS | '(:'
2926 shift(7); // URILiteral
2927 for (;;)
2928 {
2929 lookahead1W(103); // S^WS | '(:' | ',' | ';'
2930 if (l1 != 41) // ','
2931 {
2932 break;
2933 }
2934 shift(41); // ','
2935 lookahead1W(15); // URILiteral | S^WS | '(:'
2936 shift(7); // URILiteral
2937 }
2938 }
2939 eventHandler.endNonterminal("ModuleImport", e0);
2940 }
2941
2942 function parse_NamespaceDecl()
2943 {
2944 eventHandler.startNonterminal("NamespaceDecl", e0);
2945 shift(108); // 'declare'
2946 lookahead1W(61); // S^WS | '(:' | 'namespace'
2947 shift(184); // 'namespace'
2948 lookahead1W(247); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
2949 whitespace();
2950 parse_NCName();
2951 lookahead1W(29); // S^WS | '(:' | '='
2952 shift(60); // '='
2953 lookahead1W(15); // URILiteral | S^WS | '(:'
2954 shift(7); // URILiteral
2955 eventHandler.endNonterminal("NamespaceDecl", e0);
2956 }
2957
2958 function parse_DefaultNamespaceDecl()
2959 {
2960 eventHandler.startNonterminal("DefaultNamespaceDecl", e0);
2961 shift(108); // 'declare'
2962 lookahead1W(46); // S^WS | '(:' | 'default'
2963 shift(109); // 'default'
2964 lookahead1W(115); // S^WS | '(:' | 'element' | 'function'
2965 switch (l1)
2966 {
2967 case 121: // 'element'
2968 shift(121); // 'element'
2969 break;
2970 default:
2971 shift(145); // 'function'
2972 }
2973 lookahead1W(61); // S^WS | '(:' | 'namespace'
2974 shift(184); // 'namespace'
2975 lookahead1W(15); // URILiteral | S^WS | '(:'
2976 shift(7); // URILiteral
2977 eventHandler.endNonterminal("DefaultNamespaceDecl", e0);
2978 }
2979
2980 function try_DefaultNamespaceDecl()
2981 {
2982 shiftT(108); // 'declare'
2983 lookahead1W(46); // S^WS | '(:' | 'default'
2984 shiftT(109); // 'default'
2985 lookahead1W(115); // S^WS | '(:' | 'element' | 'function'
2986 switch (l1)
2987 {
2988 case 121: // 'element'
2989 shiftT(121); // 'element'
2990 break;
2991 default:
2992 shiftT(145); // 'function'
2993 }
2994 lookahead1W(61); // S^WS | '(:' | 'namespace'
2995 shiftT(184); // 'namespace'
2996 lookahead1W(15); // URILiteral | S^WS | '(:'
2997 shiftT(7); // URILiteral
2998 }
2999
3000 function parse_FTOptionDecl()
3001 {
3002 eventHandler.startNonterminal("FTOptionDecl", e0);
3003 shift(108); // 'declare'
3004 lookahead1W(52); // S^WS | '(:' | 'ft-option'
3005 shift(141); // 'ft-option'
3006 lookahead1W(81); // S^WS | '(:' | 'using'
3007 whitespace();
3008 parse_FTMatchOptions();
3009 eventHandler.endNonterminal("FTOptionDecl", e0);
3010 }
3011
3012 function parse_AnnotatedDecl()
3013 {
3014 eventHandler.startNonterminal("AnnotatedDecl", e0);
3015 shift(108); // 'declare'
3016 for (;;)
3017 {
3018 lookahead1W(170); // S^WS | '%' | '(:' | 'collection' | 'function' | 'index' | 'integrity' |
3019 if (l1 != 32 // '%'
3020 && l1 != 257) // 'updating'
3021 {
3022 break;
3023 }
3024 switch (l1)
3025 {
3026 case 257: // 'updating'
3027 whitespace();
3028 parse_CompatibilityAnnotation();
3029 break;
3030 default:
3031 whitespace();
3032 parse_Annotation();
3033 }
3034 }
3035 switch (l1)
3036 {
3037 case 262: // 'variable'
3038 whitespace();
3039 parse_VarDecl();
3040 break;
3041 case 145: // 'function'
3042 whitespace();
3043 parse_FunctionDecl();
3044 break;
3045 case 95: // 'collection'
3046 whitespace();
3047 parse_CollectionDecl();
3048 break;
3049 case 155: // 'index'
3050 whitespace();
3051 parse_IndexDecl();
3052 break;
3053 default:
3054 whitespace();
3055 parse_ICDecl();
3056 }
3057 eventHandler.endNonterminal("AnnotatedDecl", e0);
3058 }
3059
3060 function parse_CompatibilityAnnotation()
3061 {
3062 eventHandler.startNonterminal("CompatibilityAnnotation", e0);
3063 shift(257); // 'updating'
3064 eventHandler.endNonterminal("CompatibilityAnnotation", e0);
3065 }
3066
3067 function parse_Annotation()
3068 {
3069 eventHandler.startNonterminal("Annotation", e0);
3070 shift(32); // '%'
3071 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3072 whitespace();
3073 parse_EQName();
3074 lookahead1W(171); // S^WS | '%' | '(' | '(:' | 'collection' | 'function' | 'index' | 'integrity' |
3075 if (l1 == 34) // '('
3076 {
3077 shift(34); // '('
3078 lookahead1W(154); // IntegerLiteral | DecimalLiteral | DoubleLiteral | StringLiteral | S^WS | '(:'
3079 whitespace();
3080 parse_Literal();
3081 for (;;)
3082 {
3083 lookahead1W(101); // S^WS | '(:' | ')' | ','
3084 if (l1 != 41) // ','
3085 {
3086 break;
3087 }
3088 shift(41); // ','
3089 lookahead1W(154); // IntegerLiteral | DecimalLiteral | DoubleLiteral | StringLiteral | S^WS | '(:'
3090 whitespace();
3091 parse_Literal();
3092 }
3093 shift(37); // ')'
3094 }
3095 eventHandler.endNonterminal("Annotation", e0);
3096 }
3097
3098 function try_Annotation()
3099 {
3100 shiftT(32); // '%'
3101 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3102 try_EQName();
3103 lookahead1W(171); // S^WS | '%' | '(' | '(:' | 'collection' | 'function' | 'index' | 'integrity' |
3104 if (l1 == 34) // '('
3105 {
3106 shiftT(34); // '('
3107 lookahead1W(154); // IntegerLiteral | DecimalLiteral | DoubleLiteral | StringLiteral | S^WS | '(:'
3108 try_Literal();
3109 for (;;)
3110 {
3111 lookahead1W(101); // S^WS | '(:' | ')' | ','
3112 if (l1 != 41) // ','
3113 {
3114 break;
3115 }
3116 shiftT(41); // ','
3117 lookahead1W(154); // IntegerLiteral | DecimalLiteral | DoubleLiteral | StringLiteral | S^WS | '(:'
3118 try_Literal();
3119 }
3120 shiftT(37); // ')'
3121 }
3122 }
3123
3124 function parse_VarDecl()
3125 {
3126 eventHandler.startNonterminal("VarDecl", e0);
3127 shift(262); // 'variable'
3128 lookahead1W(21); // S^WS | '$' | '(:'
3129 shift(31); // '$'
3130 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3131 whitespace();
3132 parse_VarName();
3133 lookahead1W(147); // S^WS | '(:' | ':=' | 'as' | 'external'
3134 if (l1 == 79) // 'as'
3135 {
3136 whitespace();
3137 parse_TypeDeclaration();
3138 }
3139 lookahead1W(106); // S^WS | '(:' | ':=' | 'external'
3140 switch (l1)
3141 {
3142 case 52: // ':='
3143 shift(52); // ':='
3144 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3145 whitespace();
3146 parse_VarValue();
3147 break;
3148 default:
3149 shift(133); // 'external'
3150 lookahead1W(104); // S^WS | '(:' | ':=' | ';'
3151 if (l1 == 52) // ':='
3152 {
3153 shift(52); // ':='
3154 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3155 whitespace();
3156 parse_VarDefaultValue();
3157 }
3158 }
3159 eventHandler.endNonterminal("VarDecl", e0);
3160 }
3161
3162 function parse_VarValue()
3163 {
3164 eventHandler.startNonterminal("VarValue", e0);
3165 parse_ExprSingle();
3166 eventHandler.endNonterminal("VarValue", e0);
3167 }
3168
3169 function parse_VarDefaultValue()
3170 {
3171 eventHandler.startNonterminal("VarDefaultValue", e0);
3172 parse_ExprSingle();
3173 eventHandler.endNonterminal("VarDefaultValue", e0);
3174 }
3175
3176 function parse_ContextItemDecl()
3177 {
3178 eventHandler.startNonterminal("ContextItemDecl", e0);
3179 shift(108); // 'declare'
3180 lookahead1W(43); // S^WS | '(:' | 'context'
3181 shift(101); // 'context'
3182 lookahead1W(55); // S^WS | '(:' | 'item'
3183 shift(165); // 'item'
3184 lookahead1W(147); // S^WS | '(:' | ':=' | 'as' | 'external'
3185 if (l1 == 79) // 'as'
3186 {
3187 shift(79); // 'as'
3188 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
3189 whitespace();
3190 parse_ItemType();
3191 }
3192 lookahead1W(106); // S^WS | '(:' | ':=' | 'external'
3193 switch (l1)
3194 {
3195 case 52: // ':='
3196 shift(52); // ':='
3197 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3198 whitespace();
3199 parse_VarValue();
3200 break;
3201 default:
3202 shift(133); // 'external'
3203 lookahead1W(104); // S^WS | '(:' | ':=' | ';'
3204 if (l1 == 52) // ':='
3205 {
3206 shift(52); // ':='
3207 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3208 whitespace();
3209 parse_VarDefaultValue();
3210 }
3211 }
3212 eventHandler.endNonterminal("ContextItemDecl", e0);
3213 }
3214
3215 function parse_ParamList()
3216 {
3217 eventHandler.startNonterminal("ParamList", e0);
3218 parse_Param();
3219 for (;;)
3220 {
3221 lookahead1W(101); // S^WS | '(:' | ')' | ','
3222 if (l1 != 41) // ','
3223 {
3224 break;
3225 }
3226 shift(41); // ','
3227 lookahead1W(21); // S^WS | '$' | '(:'
3228 whitespace();
3229 parse_Param();
3230 }
3231 eventHandler.endNonterminal("ParamList", e0);
3232 }
3233
3234 function try_ParamList()
3235 {
3236 try_Param();
3237 for (;;)
3238 {
3239 lookahead1W(101); // S^WS | '(:' | ')' | ','
3240 if (l1 != 41) // ','
3241 {
3242 break;
3243 }
3244 shiftT(41); // ','
3245 lookahead1W(21); // S^WS | '$' | '(:'
3246 try_Param();
3247 }
3248 }
3249
3250 function parse_Param()
3251 {
3252 eventHandler.startNonterminal("Param", e0);
3253 shift(31); // '$'
3254 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3255 whitespace();
3256 parse_EQName();
3257 lookahead1W(143); // S^WS | '(:' | ')' | ',' | 'as'
3258 if (l1 == 79) // 'as'
3259 {
3260 whitespace();
3261 parse_TypeDeclaration();
3262 }
3263 eventHandler.endNonterminal("Param", e0);
3264 }
3265
3266 function try_Param()
3267 {
3268 shiftT(31); // '$'
3269 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3270 try_EQName();
3271 lookahead1W(143); // S^WS | '(:' | ')' | ',' | 'as'
3272 if (l1 == 79) // 'as'
3273 {
3274 try_TypeDeclaration();
3275 }
3276 }
3277
3278 function parse_FunctionBody()
3279 {
3280 eventHandler.startNonterminal("FunctionBody", e0);
3281 parse_EnclosedExpr();
3282 eventHandler.endNonterminal("FunctionBody", e0);
3283 }
3284
3285 function try_FunctionBody()
3286 {
3287 try_EnclosedExpr();
3288 }
3289
3290 function parse_EnclosedExpr()
3291 {
3292 eventHandler.startNonterminal("EnclosedExpr", e0);
3293 shift(276); // '{'
3294 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3295 whitespace();
3296 parse_Expr();
3297 shift(282); // '}'
3298 eventHandler.endNonterminal("EnclosedExpr", e0);
3299 }
3300
3301 function try_EnclosedExpr()
3302 {
3303 shiftT(276); // '{'
3304 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3305 try_Expr();
3306 shiftT(282); // '}'
3307 }
3308
3309 function parse_OptionDecl()
3310 {
3311 eventHandler.startNonterminal("OptionDecl", e0);
3312 shift(108); // 'declare'
3313 lookahead1W(66); // S^WS | '(:' | 'option'
3314 shift(199); // 'option'
3315 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3316 whitespace();
3317 parse_EQName();
3318 lookahead1W(17); // StringLiteral | S^WS | '(:'
3319 shift(11); // StringLiteral
3320 eventHandler.endNonterminal("OptionDecl", e0);
3321 }
3322
3323 function parse_Expr()
3324 {
3325 eventHandler.startNonterminal("Expr", e0);
3326 parse_ExprSingle();
3327 for (;;)
3328 {
3329 if (l1 != 41) // ','
3330 {
3331 break;
3332 }
3333 shift(41); // ','
3334 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3335 whitespace();
3336 parse_ExprSingle();
3337 }
3338 eventHandler.endNonterminal("Expr", e0);
3339 }
3340
3341 function try_Expr()
3342 {
3343 try_ExprSingle();
3344 for (;;)
3345 {
3346 if (l1 != 41) // ','
3347 {
3348 break;
3349 }
3350 shiftT(41); // ','
3351 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3352 try_ExprSingle();
3353 }
3354 }
3355
3356 function parse_FLWORExpr()
3357 {
3358 eventHandler.startNonterminal("FLWORExpr", e0);
3359 parse_InitialClause();
3360 for (;;)
3361 {
3362 lookahead1W(173); // S^WS | '(:' | 'count' | 'for' | 'group' | 'let' | 'order' | 'return' | 'stable' |
3363 if (l1 == 220) // 'return'
3364 {
3365 break;
3366 }
3367 whitespace();
3368 parse_IntermediateClause();
3369 }
3370 whitespace();
3371 parse_ReturnClause();
3372 eventHandler.endNonterminal("FLWORExpr", e0);
3373 }
3374
3375 function try_FLWORExpr()
3376 {
3377 try_InitialClause();
3378 for (;;)
3379 {
3380 lookahead1W(173); // S^WS | '(:' | 'count' | 'for' | 'group' | 'let' | 'order' | 'return' | 'stable' |
3381 if (l1 == 220) // 'return'
3382 {
3383 break;
3384 }
3385 try_IntermediateClause();
3386 }
3387 try_ReturnClause();
3388 }
3389
3390 function parse_InitialClause()
3391 {
3392 eventHandler.startNonterminal("InitialClause", e0);
3393 switch (l1)
3394 {
3395 case 137: // 'for'
3396 lookahead2W(141); // S^WS | '$' | '(:' | 'sliding' | 'tumbling'
3397 break;
3398 default:
3399 lk = l1;
3400 }
3401 switch (lk)
3402 {
3403 case 16009: // 'for' '$'
3404 parse_ForClause();
3405 break;
3406 case 174: // 'let'
3407 parse_LetClause();
3408 break;
3409 default:
3410 parse_WindowClause();
3411 }
3412 eventHandler.endNonterminal("InitialClause", e0);
3413 }
3414
3415 function try_InitialClause()
3416 {
3417 switch (l1)
3418 {
3419 case 137: // 'for'
3420 lookahead2W(141); // S^WS | '$' | '(:' | 'sliding' | 'tumbling'
3421 break;
3422 default:
3423 lk = l1;
3424 }
3425 switch (lk)
3426 {
3427 case 16009: // 'for' '$'
3428 try_ForClause();
3429 break;
3430 case 174: // 'let'
3431 try_LetClause();
3432 break;
3433 default:
3434 try_WindowClause();
3435 }
3436 }
3437
3438 function parse_IntermediateClause()
3439 {
3440 eventHandler.startNonterminal("IntermediateClause", e0);
3441 switch (l1)
3442 {
3443 case 137: // 'for'
3444 case 174: // 'let'
3445 parse_InitialClause();
3446 break;
3447 case 266: // 'where'
3448 parse_WhereClause();
3449 break;
3450 case 148: // 'group'
3451 parse_GroupByClause();
3452 break;
3453 case 105: // 'count'
3454 parse_CountClause();
3455 break;
3456 default:
3457 parse_OrderByClause();
3458 }
3459 eventHandler.endNonterminal("IntermediateClause", e0);
3460 }
3461
3462 function try_IntermediateClause()
3463 {
3464 switch (l1)
3465 {
3466 case 137: // 'for'
3467 case 174: // 'let'
3468 try_InitialClause();
3469 break;
3470 case 266: // 'where'
3471 try_WhereClause();
3472 break;
3473 case 148: // 'group'
3474 try_GroupByClause();
3475 break;
3476 case 105: // 'count'
3477 try_CountClause();
3478 break;
3479 default:
3480 try_OrderByClause();
3481 }
3482 }
3483
3484 function parse_ForClause()
3485 {
3486 eventHandler.startNonterminal("ForClause", e0);
3487 shift(137); // 'for'
3488 lookahead1W(21); // S^WS | '$' | '(:'
3489 whitespace();
3490 parse_ForBinding();
3491 for (;;)
3492 {
3493 if (l1 != 41) // ','
3494 {
3495 break;
3496 }
3497 shift(41); // ','
3498 lookahead1W(21); // S^WS | '$' | '(:'
3499 whitespace();
3500 parse_ForBinding();
3501 }
3502 eventHandler.endNonterminal("ForClause", e0);
3503 }
3504
3505 function try_ForClause()
3506 {
3507 shiftT(137); // 'for'
3508 lookahead1W(21); // S^WS | '$' | '(:'
3509 try_ForBinding();
3510 for (;;)
3511 {
3512 if (l1 != 41) // ','
3513 {
3514 break;
3515 }
3516 shiftT(41); // ','
3517 lookahead1W(21); // S^WS | '$' | '(:'
3518 try_ForBinding();
3519 }
3520 }
3521
3522 function parse_ForBinding()
3523 {
3524 eventHandler.startNonterminal("ForBinding", e0);
3525 shift(31); // '$'
3526 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3527 whitespace();
3528 parse_VarName();
3529 lookahead1W(164); // S^WS | '(:' | 'allowing' | 'as' | 'at' | 'in' | 'score'
3530 if (l1 == 79) // 'as'
3531 {
3532 whitespace();
3533 parse_TypeDeclaration();
3534 }
3535 lookahead1W(158); // S^WS | '(:' | 'allowing' | 'at' | 'in' | 'score'
3536 if (l1 == 72) // 'allowing'
3537 {
3538 whitespace();
3539 parse_AllowingEmpty();
3540 }
3541 lookahead1W(150); // S^WS | '(:' | 'at' | 'in' | 'score'
3542 if (l1 == 81) // 'at'
3543 {
3544 whitespace();
3545 parse_PositionalVar();
3546 }
3547 lookahead1W(122); // S^WS | '(:' | 'in' | 'score'
3548 if (l1 == 228) // 'score'
3549 {
3550 whitespace();
3551 parse_FTScoreVar();
3552 }
3553 lookahead1W(53); // S^WS | '(:' | 'in'
3554 shift(154); // 'in'
3555 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3556 whitespace();
3557 parse_ExprSingle();
3558 eventHandler.endNonterminal("ForBinding", e0);
3559 }
3560
3561 function try_ForBinding()
3562 {
3563 shiftT(31); // '$'
3564 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3565 try_VarName();
3566 lookahead1W(164); // S^WS | '(:' | 'allowing' | 'as' | 'at' | 'in' | 'score'
3567 if (l1 == 79) // 'as'
3568 {
3569 try_TypeDeclaration();
3570 }
3571 lookahead1W(158); // S^WS | '(:' | 'allowing' | 'at' | 'in' | 'score'
3572 if (l1 == 72) // 'allowing'
3573 {
3574 try_AllowingEmpty();
3575 }
3576 lookahead1W(150); // S^WS | '(:' | 'at' | 'in' | 'score'
3577 if (l1 == 81) // 'at'
3578 {
3579 try_PositionalVar();
3580 }
3581 lookahead1W(122); // S^WS | '(:' | 'in' | 'score'
3582 if (l1 == 228) // 'score'
3583 {
3584 try_FTScoreVar();
3585 }
3586 lookahead1W(53); // S^WS | '(:' | 'in'
3587 shiftT(154); // 'in'
3588 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3589 try_ExprSingle();
3590 }
3591
3592 function parse_AllowingEmpty()
3593 {
3594 eventHandler.startNonterminal("AllowingEmpty", e0);
3595 shift(72); // 'allowing'
3596 lookahead1W(49); // S^WS | '(:' | 'empty'
3597 shift(123); // 'empty'
3598 eventHandler.endNonterminal("AllowingEmpty", e0);
3599 }
3600
3601 function try_AllowingEmpty()
3602 {
3603 shiftT(72); // 'allowing'
3604 lookahead1W(49); // S^WS | '(:' | 'empty'
3605 shiftT(123); // 'empty'
3606 }
3607
3608 function parse_PositionalVar()
3609 {
3610 eventHandler.startNonterminal("PositionalVar", e0);
3611 shift(81); // 'at'
3612 lookahead1W(21); // S^WS | '$' | '(:'
3613 shift(31); // '$'
3614 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3615 whitespace();
3616 parse_VarName();
3617 eventHandler.endNonterminal("PositionalVar", e0);
3618 }
3619
3620 function try_PositionalVar()
3621 {
3622 shiftT(81); // 'at'
3623 lookahead1W(21); // S^WS | '$' | '(:'
3624 shiftT(31); // '$'
3625 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3626 try_VarName();
3627 }
3628
3629 function parse_FTScoreVar()
3630 {
3631 eventHandler.startNonterminal("FTScoreVar", e0);
3632 shift(228); // 'score'
3633 lookahead1W(21); // S^WS | '$' | '(:'
3634 shift(31); // '$'
3635 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3636 whitespace();
3637 parse_VarName();
3638 eventHandler.endNonterminal("FTScoreVar", e0);
3639 }
3640
3641 function try_FTScoreVar()
3642 {
3643 shiftT(228); // 'score'
3644 lookahead1W(21); // S^WS | '$' | '(:'
3645 shiftT(31); // '$'
3646 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3647 try_VarName();
3648 }
3649
3650 function parse_LetClause()
3651 {
3652 eventHandler.startNonterminal("LetClause", e0);
3653 shift(174); // 'let'
3654 lookahead1W(96); // S^WS | '$' | '(:' | 'score'
3655 whitespace();
3656 parse_LetBinding();
3657 for (;;)
3658 {
3659 if (l1 != 41) // ','
3660 {
3661 break;
3662 }
3663 shift(41); // ','
3664 lookahead1W(96); // S^WS | '$' | '(:' | 'score'
3665 whitespace();
3666 parse_LetBinding();
3667 }
3668 eventHandler.endNonterminal("LetClause", e0);
3669 }
3670
3671 function try_LetClause()
3672 {
3673 shiftT(174); // 'let'
3674 lookahead1W(96); // S^WS | '$' | '(:' | 'score'
3675 try_LetBinding();
3676 for (;;)
3677 {
3678 if (l1 != 41) // ','
3679 {
3680 break;
3681 }
3682 shiftT(41); // ','
3683 lookahead1W(96); // S^WS | '$' | '(:' | 'score'
3684 try_LetBinding();
3685 }
3686 }
3687
3688 function parse_LetBinding()
3689 {
3690 eventHandler.startNonterminal("LetBinding", e0);
3691 switch (l1)
3692 {
3693 case 31: // '$'
3694 shift(31); // '$'
3695 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3696 whitespace();
3697 parse_VarName();
3698 lookahead1W(105); // S^WS | '(:' | ':=' | 'as'
3699 if (l1 == 79) // 'as'
3700 {
3701 whitespace();
3702 parse_TypeDeclaration();
3703 }
3704 break;
3705 default:
3706 parse_FTScoreVar();
3707 }
3708 lookahead1W(27); // S^WS | '(:' | ':='
3709 shift(52); // ':='
3710 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3711 whitespace();
3712 parse_ExprSingle();
3713 eventHandler.endNonterminal("LetBinding", e0);
3714 }
3715
3716 function try_LetBinding()
3717 {
3718 switch (l1)
3719 {
3720 case 31: // '$'
3721 shiftT(31); // '$'
3722 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3723 try_VarName();
3724 lookahead1W(105); // S^WS | '(:' | ':=' | 'as'
3725 if (l1 == 79) // 'as'
3726 {
3727 try_TypeDeclaration();
3728 }
3729 break;
3730 default:
3731 try_FTScoreVar();
3732 }
3733 lookahead1W(27); // S^WS | '(:' | ':='
3734 shiftT(52); // ':='
3735 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3736 try_ExprSingle();
3737 }
3738
3739 function parse_WindowClause()
3740 {
3741 eventHandler.startNonterminal("WindowClause", e0);
3742 shift(137); // 'for'
3743 lookahead1W(135); // S^WS | '(:' | 'sliding' | 'tumbling'
3744 switch (l1)
3745 {
3746 case 251: // 'tumbling'
3747 whitespace();
3748 parse_TumblingWindowClause();
3749 break;
3750 default:
3751 whitespace();
3752 parse_SlidingWindowClause();
3753 }
3754 eventHandler.endNonterminal("WindowClause", e0);
3755 }
3756
3757 function try_WindowClause()
3758 {
3759 shiftT(137); // 'for'
3760 lookahead1W(135); // S^WS | '(:' | 'sliding' | 'tumbling'
3761 switch (l1)
3762 {
3763 case 251: // 'tumbling'
3764 try_TumblingWindowClause();
3765 break;
3766 default:
3767 try_SlidingWindowClause();
3768 }
3769 }
3770
3771 function parse_TumblingWindowClause()
3772 {
3773 eventHandler.startNonterminal("TumblingWindowClause", e0);
3774 shift(251); // 'tumbling'
3775 lookahead1W(85); // S^WS | '(:' | 'window'
3776 shift(269); // 'window'
3777 lookahead1W(21); // S^WS | '$' | '(:'
3778 shift(31); // '$'
3779 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3780 whitespace();
3781 parse_VarName();
3782 lookahead1W(110); // S^WS | '(:' | 'as' | 'in'
3783 if (l1 == 79) // 'as'
3784 {
3785 whitespace();
3786 parse_TypeDeclaration();
3787 }
3788 lookahead1W(53); // S^WS | '(:' | 'in'
3789 shift(154); // 'in'
3790 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3791 whitespace();
3792 parse_ExprSingle();
3793 whitespace();
3794 parse_WindowStartCondition();
3795 if (l1 == 126 // 'end'
3796 || l1 == 198) // 'only'
3797 {
3798 whitespace();
3799 parse_WindowEndCondition();
3800 }
3801 eventHandler.endNonterminal("TumblingWindowClause", e0);
3802 }
3803
3804 function try_TumblingWindowClause()
3805 {
3806 shiftT(251); // 'tumbling'
3807 lookahead1W(85); // S^WS | '(:' | 'window'
3808 shiftT(269); // 'window'
3809 lookahead1W(21); // S^WS | '$' | '(:'
3810 shiftT(31); // '$'
3811 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3812 try_VarName();
3813 lookahead1W(110); // S^WS | '(:' | 'as' | 'in'
3814 if (l1 == 79) // 'as'
3815 {
3816 try_TypeDeclaration();
3817 }
3818 lookahead1W(53); // S^WS | '(:' | 'in'
3819 shiftT(154); // 'in'
3820 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3821 try_ExprSingle();
3822 try_WindowStartCondition();
3823 if (l1 == 126 // 'end'
3824 || l1 == 198) // 'only'
3825 {
3826 try_WindowEndCondition();
3827 }
3828 }
3829
3830 function parse_SlidingWindowClause()
3831 {
3832 eventHandler.startNonterminal("SlidingWindowClause", e0);
3833 shift(234); // 'sliding'
3834 lookahead1W(85); // S^WS | '(:' | 'window'
3835 shift(269); // 'window'
3836 lookahead1W(21); // S^WS | '$' | '(:'
3837 shift(31); // '$'
3838 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3839 whitespace();
3840 parse_VarName();
3841 lookahead1W(110); // S^WS | '(:' | 'as' | 'in'
3842 if (l1 == 79) // 'as'
3843 {
3844 whitespace();
3845 parse_TypeDeclaration();
3846 }
3847 lookahead1W(53); // S^WS | '(:' | 'in'
3848 shift(154); // 'in'
3849 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3850 whitespace();
3851 parse_ExprSingle();
3852 whitespace();
3853 parse_WindowStartCondition();
3854 whitespace();
3855 parse_WindowEndCondition();
3856 eventHandler.endNonterminal("SlidingWindowClause", e0);
3857 }
3858
3859 function try_SlidingWindowClause()
3860 {
3861 shiftT(234); // 'sliding'
3862 lookahead1W(85); // S^WS | '(:' | 'window'
3863 shiftT(269); // 'window'
3864 lookahead1W(21); // S^WS | '$' | '(:'
3865 shiftT(31); // '$'
3866 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3867 try_VarName();
3868 lookahead1W(110); // S^WS | '(:' | 'as' | 'in'
3869 if (l1 == 79) // 'as'
3870 {
3871 try_TypeDeclaration();
3872 }
3873 lookahead1W(53); // S^WS | '(:' | 'in'
3874 shiftT(154); // 'in'
3875 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3876 try_ExprSingle();
3877 try_WindowStartCondition();
3878 try_WindowEndCondition();
3879 }
3880
3881 function parse_WindowStartCondition()
3882 {
3883 eventHandler.startNonterminal("WindowStartCondition", e0);
3884 shift(237); // 'start'
3885 lookahead1W(163); // S^WS | '$' | '(:' | 'at' | 'next' | 'previous' | 'when'
3886 whitespace();
3887 parse_WindowVars();
3888 lookahead1W(83); // S^WS | '(:' | 'when'
3889 shift(265); // 'when'
3890 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3891 whitespace();
3892 parse_ExprSingle();
3893 eventHandler.endNonterminal("WindowStartCondition", e0);
3894 }
3895
3896 function try_WindowStartCondition()
3897 {
3898 shiftT(237); // 'start'
3899 lookahead1W(163); // S^WS | '$' | '(:' | 'at' | 'next' | 'previous' | 'when'
3900 try_WindowVars();
3901 lookahead1W(83); // S^WS | '(:' | 'when'
3902 shiftT(265); // 'when'
3903 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3904 try_ExprSingle();
3905 }
3906
3907 function parse_WindowEndCondition()
3908 {
3909 eventHandler.startNonterminal("WindowEndCondition", e0);
3910 if (l1 == 198) // 'only'
3911 {
3912 shift(198); // 'only'
3913 }
3914 lookahead1W(50); // S^WS | '(:' | 'end'
3915 shift(126); // 'end'
3916 lookahead1W(163); // S^WS | '$' | '(:' | 'at' | 'next' | 'previous' | 'when'
3917 whitespace();
3918 parse_WindowVars();
3919 lookahead1W(83); // S^WS | '(:' | 'when'
3920 shift(265); // 'when'
3921 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3922 whitespace();
3923 parse_ExprSingle();
3924 eventHandler.endNonterminal("WindowEndCondition", e0);
3925 }
3926
3927 function try_WindowEndCondition()
3928 {
3929 if (l1 == 198) // 'only'
3930 {
3931 shiftT(198); // 'only'
3932 }
3933 lookahead1W(50); // S^WS | '(:' | 'end'
3934 shiftT(126); // 'end'
3935 lookahead1W(163); // S^WS | '$' | '(:' | 'at' | 'next' | 'previous' | 'when'
3936 try_WindowVars();
3937 lookahead1W(83); // S^WS | '(:' | 'when'
3938 shiftT(265); // 'when'
3939 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
3940 try_ExprSingle();
3941 }
3942
3943 function parse_WindowVars()
3944 {
3945 eventHandler.startNonterminal("WindowVars", e0);
3946 if (l1 == 31) // '$'
3947 {
3948 shift(31); // '$'
3949 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3950 whitespace();
3951 parse_CurrentItem();
3952 }
3953 lookahead1W(159); // S^WS | '(:' | 'at' | 'next' | 'previous' | 'when'
3954 if (l1 == 81) // 'at'
3955 {
3956 whitespace();
3957 parse_PositionalVar();
3958 }
3959 lookahead1W(153); // S^WS | '(:' | 'next' | 'previous' | 'when'
3960 if (l1 == 215) // 'previous'
3961 {
3962 shift(215); // 'previous'
3963 lookahead1W(21); // S^WS | '$' | '(:'
3964 shift(31); // '$'
3965 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3966 whitespace();
3967 parse_PreviousItem();
3968 }
3969 lookahead1W(127); // S^WS | '(:' | 'next' | 'when'
3970 if (l1 == 187) // 'next'
3971 {
3972 shift(187); // 'next'
3973 lookahead1W(21); // S^WS | '$' | '(:'
3974 shift(31); // '$'
3975 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3976 whitespace();
3977 parse_NextItem();
3978 }
3979 eventHandler.endNonterminal("WindowVars", e0);
3980 }
3981
3982 function try_WindowVars()
3983 {
3984 if (l1 == 31) // '$'
3985 {
3986 shiftT(31); // '$'
3987 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
3988 try_CurrentItem();
3989 }
3990 lookahead1W(159); // S^WS | '(:' | 'at' | 'next' | 'previous' | 'when'
3991 if (l1 == 81) // 'at'
3992 {
3993 try_PositionalVar();
3994 }
3995 lookahead1W(153); // S^WS | '(:' | 'next' | 'previous' | 'when'
3996 if (l1 == 215) // 'previous'
3997 {
3998 shiftT(215); // 'previous'
3999 lookahead1W(21); // S^WS | '$' | '(:'
4000 shiftT(31); // '$'
4001 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4002 try_PreviousItem();
4003 }
4004 lookahead1W(127); // S^WS | '(:' | 'next' | 'when'
4005 if (l1 == 187) // 'next'
4006 {
4007 shiftT(187); // 'next'
4008 lookahead1W(21); // S^WS | '$' | '(:'
4009 shiftT(31); // '$'
4010 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4011 try_NextItem();
4012 }
4013 }
4014
4015 function parse_CurrentItem()
4016 {
4017 eventHandler.startNonterminal("CurrentItem", e0);
4018 parse_EQName();
4019 eventHandler.endNonterminal("CurrentItem", e0);
4020 }
4021
4022 function try_CurrentItem()
4023 {
4024 try_EQName();
4025 }
4026
4027 function parse_PreviousItem()
4028 {
4029 eventHandler.startNonterminal("PreviousItem", e0);
4030 parse_EQName();
4031 eventHandler.endNonterminal("PreviousItem", e0);
4032 }
4033
4034 function try_PreviousItem()
4035 {
4036 try_EQName();
4037 }
4038
4039 function parse_NextItem()
4040 {
4041 eventHandler.startNonterminal("NextItem", e0);
4042 parse_EQName();
4043 eventHandler.endNonterminal("NextItem", e0);
4044 }
4045
4046 function try_NextItem()
4047 {
4048 try_EQName();
4049 }
4050
4051 function parse_CountClause()
4052 {
4053 eventHandler.startNonterminal("CountClause", e0);
4054 shift(105); // 'count'
4055 lookahead1W(21); // S^WS | '$' | '(:'
4056 shift(31); // '$'
4057 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4058 whitespace();
4059 parse_VarName();
4060 eventHandler.endNonterminal("CountClause", e0);
4061 }
4062
4063 function try_CountClause()
4064 {
4065 shiftT(105); // 'count'
4066 lookahead1W(21); // S^WS | '$' | '(:'
4067 shiftT(31); // '$'
4068 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4069 try_VarName();
4070 }
4071
4072 function parse_WhereClause()
4073 {
4074 eventHandler.startNonterminal("WhereClause", e0);
4075 shift(266); // 'where'
4076 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4077 whitespace();
4078 parse_ExprSingle();
4079 eventHandler.endNonterminal("WhereClause", e0);
4080 }
4081
4082 function try_WhereClause()
4083 {
4084 shiftT(266); // 'where'
4085 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4086 try_ExprSingle();
4087 }
4088
4089 function parse_GroupByClause()
4090 {
4091 eventHandler.startNonterminal("GroupByClause", e0);
4092 shift(148); // 'group'
4093 lookahead1W(34); // S^WS | '(:' | 'by'
4094 shift(87); // 'by'
4095 lookahead1W(21); // S^WS | '$' | '(:'
4096 whitespace();
4097 parse_GroupingSpecList();
4098 eventHandler.endNonterminal("GroupByClause", e0);
4099 }
4100
4101 function try_GroupByClause()
4102 {
4103 shiftT(148); // 'group'
4104 lookahead1W(34); // S^WS | '(:' | 'by'
4105 shiftT(87); // 'by'
4106 lookahead1W(21); // S^WS | '$' | '(:'
4107 try_GroupingSpecList();
4108 }
4109
4110 function parse_GroupingSpecList()
4111 {
4112 eventHandler.startNonterminal("GroupingSpecList", e0);
4113 parse_GroupingSpec();
4114 for (;;)
4115 {
4116 lookahead1W(176); // S^WS | '(:' | ',' | 'count' | 'for' | 'group' | 'let' | 'order' | 'return' |
4117 if (l1 != 41) // ','
4118 {
4119 break;
4120 }
4121 shift(41); // ','
4122 lookahead1W(21); // S^WS | '$' | '(:'
4123 whitespace();
4124 parse_GroupingSpec();
4125 }
4126 eventHandler.endNonterminal("GroupingSpecList", e0);
4127 }
4128
4129 function try_GroupingSpecList()
4130 {
4131 try_GroupingSpec();
4132 for (;;)
4133 {
4134 lookahead1W(176); // S^WS | '(:' | ',' | 'count' | 'for' | 'group' | 'let' | 'order' | 'return' |
4135 if (l1 != 41) // ','
4136 {
4137 break;
4138 }
4139 shiftT(41); // ','
4140 lookahead1W(21); // S^WS | '$' | '(:'
4141 try_GroupingSpec();
4142 }
4143 }
4144
4145 function parse_GroupingSpec()
4146 {
4147 eventHandler.startNonterminal("GroupingSpec", e0);
4148 parse_GroupingVariable();
4149 lookahead1W(182); // S^WS | '(:' | ',' | ':=' | 'as' | 'collation' | 'count' | 'for' | 'group' |
4150 if (l1 == 52 // ':='
4151 || l1 == 79) // 'as'
4152 {
4153 if (l1 == 79) // 'as'
4154 {
4155 whitespace();
4156 parse_TypeDeclaration();
4157 }
4158 lookahead1W(27); // S^WS | '(:' | ':='
4159 shift(52); // ':='
4160 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4161 whitespace();
4162 parse_ExprSingle();
4163 }
4164 if (l1 == 94) // 'collation'
4165 {
4166 shift(94); // 'collation'
4167 lookahead1W(15); // URILiteral | S^WS | '(:'
4168 shift(7); // URILiteral
4169 }
4170 eventHandler.endNonterminal("GroupingSpec", e0);
4171 }
4172
4173 function try_GroupingSpec()
4174 {
4175 try_GroupingVariable();
4176 lookahead1W(182); // S^WS | '(:' | ',' | ':=' | 'as' | 'collation' | 'count' | 'for' | 'group' |
4177 if (l1 == 52 // ':='
4178 || l1 == 79) // 'as'
4179 {
4180 if (l1 == 79) // 'as'
4181 {
4182 try_TypeDeclaration();
4183 }
4184 lookahead1W(27); // S^WS | '(:' | ':='
4185 shiftT(52); // ':='
4186 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4187 try_ExprSingle();
4188 }
4189 if (l1 == 94) // 'collation'
4190 {
4191 shiftT(94); // 'collation'
4192 lookahead1W(15); // URILiteral | S^WS | '(:'
4193 shiftT(7); // URILiteral
4194 }
4195 }
4196
4197 function parse_GroupingVariable()
4198 {
4199 eventHandler.startNonterminal("GroupingVariable", e0);
4200 shift(31); // '$'
4201 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4202 whitespace();
4203 parse_VarName();
4204 eventHandler.endNonterminal("GroupingVariable", e0);
4205 }
4206
4207 function try_GroupingVariable()
4208 {
4209 shiftT(31); // '$'
4210 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4211 try_VarName();
4212 }
4213
4214 function parse_OrderByClause()
4215 {
4216 eventHandler.startNonterminal("OrderByClause", e0);
4217 switch (l1)
4218 {
4219 case 201: // 'order'
4220 shift(201); // 'order'
4221 lookahead1W(34); // S^WS | '(:' | 'by'
4222 shift(87); // 'by'
4223 break;
4224 default:
4225 shift(236); // 'stable'
4226 lookahead1W(67); // S^WS | '(:' | 'order'
4227 shift(201); // 'order'
4228 lookahead1W(34); // S^WS | '(:' | 'by'
4229 shift(87); // 'by'
4230 }
4231 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4232 whitespace();
4233 parse_OrderSpecList();
4234 eventHandler.endNonterminal("OrderByClause", e0);
4235 }
4236
4237 function try_OrderByClause()
4238 {
4239 switch (l1)
4240 {
4241 case 201: // 'order'
4242 shiftT(201); // 'order'
4243 lookahead1W(34); // S^WS | '(:' | 'by'
4244 shiftT(87); // 'by'
4245 break;
4246 default:
4247 shiftT(236); // 'stable'
4248 lookahead1W(67); // S^WS | '(:' | 'order'
4249 shiftT(201); // 'order'
4250 lookahead1W(34); // S^WS | '(:' | 'by'
4251 shiftT(87); // 'by'
4252 }
4253 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4254 try_OrderSpecList();
4255 }
4256
4257 function parse_OrderSpecList()
4258 {
4259 eventHandler.startNonterminal("OrderSpecList", e0);
4260 parse_OrderSpec();
4261 for (;;)
4262 {
4263 lookahead1W(176); // S^WS | '(:' | ',' | 'count' | 'for' | 'group' | 'let' | 'order' | 'return' |
4264 if (l1 != 41) // ','
4265 {
4266 break;
4267 }
4268 shift(41); // ','
4269 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4270 whitespace();
4271 parse_OrderSpec();
4272 }
4273 eventHandler.endNonterminal("OrderSpecList", e0);
4274 }
4275
4276 function try_OrderSpecList()
4277 {
4278 try_OrderSpec();
4279 for (;;)
4280 {
4281 lookahead1W(176); // S^WS | '(:' | ',' | 'count' | 'for' | 'group' | 'let' | 'order' | 'return' |
4282 if (l1 != 41) // ','
4283 {
4284 break;
4285 }
4286 shiftT(41); // ','
4287 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4288 try_OrderSpec();
4289 }
4290 }
4291
4292 function parse_OrderSpec()
4293 {
4294 eventHandler.startNonterminal("OrderSpec", e0);
4295 parse_ExprSingle();
4296 whitespace();
4297 parse_OrderModifier();
4298 eventHandler.endNonterminal("OrderSpec", e0);
4299 }
4300
4301 function try_OrderSpec()
4302 {
4303 try_ExprSingle();
4304 try_OrderModifier();
4305 }
4306
4307 function parse_OrderModifier()
4308 {
4309 eventHandler.startNonterminal("OrderModifier", e0);
4310 if (l1 == 80 // 'ascending'
4311 || l1 == 113) // 'descending'
4312 {
4313 switch (l1)
4314 {
4315 case 80: // 'ascending'
4316 shift(80); // 'ascending'
4317 break;
4318 default:
4319 shift(113); // 'descending'
4320 }
4321 }
4322 lookahead1W(179); // S^WS | '(:' | ',' | 'collation' | 'count' | 'empty' | 'for' | 'group' | 'let' |
4323 if (l1 == 123) // 'empty'
4324 {
4325 shift(123); // 'empty'
4326 lookahead1W(121); // S^WS | '(:' | 'greatest' | 'least'
4327 switch (l1)
4328 {
4329 case 147: // 'greatest'
4330 shift(147); // 'greatest'
4331 break;
4332 default:
4333 shift(173); // 'least'
4334 }
4335 }
4336 lookahead1W(177); // S^WS | '(:' | ',' | 'collation' | 'count' | 'for' | 'group' | 'let' | 'order' |
4337 if (l1 == 94) // 'collation'
4338 {
4339 shift(94); // 'collation'
4340 lookahead1W(15); // URILiteral | S^WS | '(:'
4341 shift(7); // URILiteral
4342 }
4343 eventHandler.endNonterminal("OrderModifier", e0);
4344 }
4345
4346 function try_OrderModifier()
4347 {
4348 if (l1 == 80 // 'ascending'
4349 || l1 == 113) // 'descending'
4350 {
4351 switch (l1)
4352 {
4353 case 80: // 'ascending'
4354 shiftT(80); // 'ascending'
4355 break;
4356 default:
4357 shiftT(113); // 'descending'
4358 }
4359 }
4360 lookahead1W(179); // S^WS | '(:' | ',' | 'collation' | 'count' | 'empty' | 'for' | 'group' | 'let' |
4361 if (l1 == 123) // 'empty'
4362 {
4363 shiftT(123); // 'empty'
4364 lookahead1W(121); // S^WS | '(:' | 'greatest' | 'least'
4365 switch (l1)
4366 {
4367 case 147: // 'greatest'
4368 shiftT(147); // 'greatest'
4369 break;
4370 default:
4371 shiftT(173); // 'least'
4372 }
4373 }
4374 lookahead1W(177); // S^WS | '(:' | ',' | 'collation' | 'count' | 'for' | 'group' | 'let' | 'order' |
4375 if (l1 == 94) // 'collation'
4376 {
4377 shiftT(94); // 'collation'
4378 lookahead1W(15); // URILiteral | S^WS | '(:'
4379 shiftT(7); // URILiteral
4380 }
4381 }
4382
4383 function parse_ReturnClause()
4384 {
4385 eventHandler.startNonterminal("ReturnClause", e0);
4386 shift(220); // 'return'
4387 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4388 whitespace();
4389 parse_ExprSingle();
4390 eventHandler.endNonterminal("ReturnClause", e0);
4391 }
4392
4393 function try_ReturnClause()
4394 {
4395 shiftT(220); // 'return'
4396 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4397 try_ExprSingle();
4398 }
4399
4400 function parse_QuantifiedExpr()
4401 {
4402 eventHandler.startNonterminal("QuantifiedExpr", e0);
4403 switch (l1)
4404 {
4405 case 235: // 'some'
4406 shift(235); // 'some'
4407 break;
4408 default:
4409 shift(129); // 'every'
4410 }
4411 lookahead1W(21); // S^WS | '$' | '(:'
4412 shift(31); // '$'
4413 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4414 whitespace();
4415 parse_VarName();
4416 lookahead1W(110); // S^WS | '(:' | 'as' | 'in'
4417 if (l1 == 79) // 'as'
4418 {
4419 whitespace();
4420 parse_TypeDeclaration();
4421 }
4422 lookahead1W(53); // S^WS | '(:' | 'in'
4423 shift(154); // 'in'
4424 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4425 whitespace();
4426 parse_ExprSingle();
4427 for (;;)
4428 {
4429 if (l1 != 41) // ','
4430 {
4431 break;
4432 }
4433 shift(41); // ','
4434 lookahead1W(21); // S^WS | '$' | '(:'
4435 shift(31); // '$'
4436 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4437 whitespace();
4438 parse_VarName();
4439 lookahead1W(110); // S^WS | '(:' | 'as' | 'in'
4440 if (l1 == 79) // 'as'
4441 {
4442 whitespace();
4443 parse_TypeDeclaration();
4444 }
4445 lookahead1W(53); // S^WS | '(:' | 'in'
4446 shift(154); // 'in'
4447 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4448 whitespace();
4449 parse_ExprSingle();
4450 }
4451 shift(224); // 'satisfies'
4452 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4453 whitespace();
4454 parse_ExprSingle();
4455 eventHandler.endNonterminal("QuantifiedExpr", e0);
4456 }
4457
4458 function try_QuantifiedExpr()
4459 {
4460 switch (l1)
4461 {
4462 case 235: // 'some'
4463 shiftT(235); // 'some'
4464 break;
4465 default:
4466 shiftT(129); // 'every'
4467 }
4468 lookahead1W(21); // S^WS | '$' | '(:'
4469 shiftT(31); // '$'
4470 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4471 try_VarName();
4472 lookahead1W(110); // S^WS | '(:' | 'as' | 'in'
4473 if (l1 == 79) // 'as'
4474 {
4475 try_TypeDeclaration();
4476 }
4477 lookahead1W(53); // S^WS | '(:' | 'in'
4478 shiftT(154); // 'in'
4479 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4480 try_ExprSingle();
4481 for (;;)
4482 {
4483 if (l1 != 41) // ','
4484 {
4485 break;
4486 }
4487 shiftT(41); // ','
4488 lookahead1W(21); // S^WS | '$' | '(:'
4489 shiftT(31); // '$'
4490 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4491 try_VarName();
4492 lookahead1W(110); // S^WS | '(:' | 'as' | 'in'
4493 if (l1 == 79) // 'as'
4494 {
4495 try_TypeDeclaration();
4496 }
4497 lookahead1W(53); // S^WS | '(:' | 'in'
4498 shiftT(154); // 'in'
4499 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4500 try_ExprSingle();
4501 }
4502 shiftT(224); // 'satisfies'
4503 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4504 try_ExprSingle();
4505 }
4506
4507 function parse_SwitchExpr()
4508 {
4509 eventHandler.startNonterminal("SwitchExpr", e0);
4510 shift(243); // 'switch'
4511 lookahead1W(22); // S^WS | '(' | '(:'
4512 shift(34); // '('
4513 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4514 whitespace();
4515 parse_Expr();
4516 shift(37); // ')'
4517 for (;;)
4518 {
4519 lookahead1W(35); // S^WS | '(:' | 'case'
4520 whitespace();
4521 parse_SwitchCaseClause();
4522 if (l1 != 88) // 'case'
4523 {
4524 break;
4525 }
4526 }
4527 shift(109); // 'default'
4528 lookahead1W(70); // S^WS | '(:' | 'return'
4529 shift(220); // 'return'
4530 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4531 whitespace();
4532 parse_ExprSingle();
4533 eventHandler.endNonterminal("SwitchExpr", e0);
4534 }
4535
4536 function try_SwitchExpr()
4537 {
4538 shiftT(243); // 'switch'
4539 lookahead1W(22); // S^WS | '(' | '(:'
4540 shiftT(34); // '('
4541 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4542 try_Expr();
4543 shiftT(37); // ')'
4544 for (;;)
4545 {
4546 lookahead1W(35); // S^WS | '(:' | 'case'
4547 try_SwitchCaseClause();
4548 if (l1 != 88) // 'case'
4549 {
4550 break;
4551 }
4552 }
4553 shiftT(109); // 'default'
4554 lookahead1W(70); // S^WS | '(:' | 'return'
4555 shiftT(220); // 'return'
4556 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4557 try_ExprSingle();
4558 }
4559
4560 function parse_SwitchCaseClause()
4561 {
4562 eventHandler.startNonterminal("SwitchCaseClause", e0);
4563 for (;;)
4564 {
4565 shift(88); // 'case'
4566 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4567 whitespace();
4568 parse_SwitchCaseOperand();
4569 if (l1 != 88) // 'case'
4570 {
4571 break;
4572 }
4573 }
4574 shift(220); // 'return'
4575 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4576 whitespace();
4577 parse_ExprSingle();
4578 eventHandler.endNonterminal("SwitchCaseClause", e0);
4579 }
4580
4581 function try_SwitchCaseClause()
4582 {
4583 for (;;)
4584 {
4585 shiftT(88); // 'case'
4586 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4587 try_SwitchCaseOperand();
4588 if (l1 != 88) // 'case'
4589 {
4590 break;
4591 }
4592 }
4593 shiftT(220); // 'return'
4594 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4595 try_ExprSingle();
4596 }
4597
4598 function parse_SwitchCaseOperand()
4599 {
4600 eventHandler.startNonterminal("SwitchCaseOperand", e0);
4601 parse_ExprSingle();
4602 eventHandler.endNonterminal("SwitchCaseOperand", e0);
4603 }
4604
4605 function try_SwitchCaseOperand()
4606 {
4607 try_ExprSingle();
4608 }
4609
4610 function parse_TypeswitchExpr()
4611 {
4612 eventHandler.startNonterminal("TypeswitchExpr", e0);
4613 shift(253); // 'typeswitch'
4614 lookahead1W(22); // S^WS | '(' | '(:'
4615 shift(34); // '('
4616 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4617 whitespace();
4618 parse_Expr();
4619 shift(37); // ')'
4620 for (;;)
4621 {
4622 lookahead1W(35); // S^WS | '(:' | 'case'
4623 whitespace();
4624 parse_CaseClause();
4625 if (l1 != 88) // 'case'
4626 {
4627 break;
4628 }
4629 }
4630 shift(109); // 'default'
4631 lookahead1W(95); // S^WS | '$' | '(:' | 'return'
4632 if (l1 == 31) // '$'
4633 {
4634 shift(31); // '$'
4635 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4636 whitespace();
4637 parse_VarName();
4638 }
4639 lookahead1W(70); // S^WS | '(:' | 'return'
4640 shift(220); // 'return'
4641 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4642 whitespace();
4643 parse_ExprSingle();
4644 eventHandler.endNonterminal("TypeswitchExpr", e0);
4645 }
4646
4647 function try_TypeswitchExpr()
4648 {
4649 shiftT(253); // 'typeswitch'
4650 lookahead1W(22); // S^WS | '(' | '(:'
4651 shiftT(34); // '('
4652 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4653 try_Expr();
4654 shiftT(37); // ')'
4655 for (;;)
4656 {
4657 lookahead1W(35); // S^WS | '(:' | 'case'
4658 try_CaseClause();
4659 if (l1 != 88) // 'case'
4660 {
4661 break;
4662 }
4663 }
4664 shiftT(109); // 'default'
4665 lookahead1W(95); // S^WS | '$' | '(:' | 'return'
4666 if (l1 == 31) // '$'
4667 {
4668 shiftT(31); // '$'
4669 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4670 try_VarName();
4671 }
4672 lookahead1W(70); // S^WS | '(:' | 'return'
4673 shiftT(220); // 'return'
4674 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4675 try_ExprSingle();
4676 }
4677
4678 function parse_CaseClause()
4679 {
4680 eventHandler.startNonterminal("CaseClause", e0);
4681 shift(88); // 'case'
4682 lookahead1W(260); // EQName^Token | S^WS | '$' | '%' | '(' | '(:' | 'after' | 'allowing' |
4683 if (l1 == 31) // '$'
4684 {
4685 shift(31); // '$'
4686 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4687 whitespace();
4688 parse_VarName();
4689 lookahead1W(30); // S^WS | '(:' | 'as'
4690 shift(79); // 'as'
4691 }
4692 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
4693 whitespace();
4694 parse_SequenceTypeUnion();
4695 shift(220); // 'return'
4696 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4697 whitespace();
4698 parse_ExprSingle();
4699 eventHandler.endNonterminal("CaseClause", e0);
4700 }
4701
4702 function try_CaseClause()
4703 {
4704 shiftT(88); // 'case'
4705 lookahead1W(260); // EQName^Token | S^WS | '$' | '%' | '(' | '(:' | 'after' | 'allowing' |
4706 if (l1 == 31) // '$'
4707 {
4708 shiftT(31); // '$'
4709 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4710 try_VarName();
4711 lookahead1W(30); // S^WS | '(:' | 'as'
4712 shiftT(79); // 'as'
4713 }
4714 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
4715 try_SequenceTypeUnion();
4716 shiftT(220); // 'return'
4717 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4718 try_ExprSingle();
4719 }
4720
4721 function parse_SequenceTypeUnion()
4722 {
4723 eventHandler.startNonterminal("SequenceTypeUnion", e0);
4724 parse_SequenceType();
4725 for (;;)
4726 {
4727 lookahead1W(134); // S^WS | '(:' | 'return' | '|'
4728 if (l1 != 279) // '|'
4729 {
4730 break;
4731 }
4732 shift(279); // '|'
4733 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
4734 whitespace();
4735 parse_SequenceType();
4736 }
4737 eventHandler.endNonterminal("SequenceTypeUnion", e0);
4738 }
4739
4740 function try_SequenceTypeUnion()
4741 {
4742 try_SequenceType();
4743 for (;;)
4744 {
4745 lookahead1W(134); // S^WS | '(:' | 'return' | '|'
4746 if (l1 != 279) // '|'
4747 {
4748 break;
4749 }
4750 shiftT(279); // '|'
4751 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
4752 try_SequenceType();
4753 }
4754 }
4755
4756 function parse_IfExpr()
4757 {
4758 eventHandler.startNonterminal("IfExpr", e0);
4759 shift(152); // 'if'
4760 lookahead1W(22); // S^WS | '(' | '(:'
4761 shift(34); // '('
4762 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4763 whitespace();
4764 parse_Expr();
4765 shift(37); // ')'
4766 lookahead1W(77); // S^WS | '(:' | 'then'
4767 shift(245); // 'then'
4768 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4769 whitespace();
4770 parse_ExprSingle();
4771 shift(122); // 'else'
4772 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4773 whitespace();
4774 parse_ExprSingle();
4775 eventHandler.endNonterminal("IfExpr", e0);
4776 }
4777
4778 function try_IfExpr()
4779 {
4780 shiftT(152); // 'if'
4781 lookahead1W(22); // S^WS | '(' | '(:'
4782 shiftT(34); // '('
4783 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4784 try_Expr();
4785 shiftT(37); // ')'
4786 lookahead1W(77); // S^WS | '(:' | 'then'
4787 shiftT(245); // 'then'
4788 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4789 try_ExprSingle();
4790 shiftT(122); // 'else'
4791 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4792 try_ExprSingle();
4793 }
4794
4795 function parse_TryCatchExpr()
4796 {
4797 eventHandler.startNonterminal("TryCatchExpr", e0);
4798 parse_TryClause();
4799 for (;;)
4800 {
4801 lookahead1W(36); // S^WS | '(:' | 'catch'
4802 whitespace();
4803 parse_CatchClause();
4804 lookahead1W(184); // S^WS | EOF | '(:' | ')' | ',' | ':' | ';' | ']' | 'after' | 'as' | 'ascending' |
4805 if (l1 != 91) // 'catch'
4806 {
4807 break;
4808 }
4809 }
4810 eventHandler.endNonterminal("TryCatchExpr", e0);
4811 }
4812
4813 function try_TryCatchExpr()
4814 {
4815 try_TryClause();
4816 for (;;)
4817 {
4818 lookahead1W(36); // S^WS | '(:' | 'catch'
4819 try_CatchClause();
4820 lookahead1W(184); // S^WS | EOF | '(:' | ')' | ',' | ':' | ';' | ']' | 'after' | 'as' | 'ascending' |
4821 if (l1 != 91) // 'catch'
4822 {
4823 break;
4824 }
4825 }
4826 }
4827
4828 function parse_TryClause()
4829 {
4830 eventHandler.startNonterminal("TryClause", e0);
4831 shift(250); // 'try'
4832 lookahead1W(87); // S^WS | '(:' | '{'
4833 shift(276); // '{'
4834 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4835 whitespace();
4836 parse_TryTargetExpr();
4837 shift(282); // '}'
4838 eventHandler.endNonterminal("TryClause", e0);
4839 }
4840
4841 function try_TryClause()
4842 {
4843 shiftT(250); // 'try'
4844 lookahead1W(87); // S^WS | '(:' | '{'
4845 shiftT(276); // '{'
4846 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4847 try_TryTargetExpr();
4848 shiftT(282); // '}'
4849 }
4850
4851 function parse_TryTargetExpr()
4852 {
4853 eventHandler.startNonterminal("TryTargetExpr", e0);
4854 parse_Expr();
4855 eventHandler.endNonterminal("TryTargetExpr", e0);
4856 }
4857
4858 function try_TryTargetExpr()
4859 {
4860 try_Expr();
4861 }
4862
4863 function parse_CatchClause()
4864 {
4865 eventHandler.startNonterminal("CatchClause", e0);
4866 shift(91); // 'catch'
4867 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4868 whitespace();
4869 parse_CatchErrorList();
4870 shift(276); // '{'
4871 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4872 whitespace();
4873 parse_Expr();
4874 shift(282); // '}'
4875 eventHandler.endNonterminal("CatchClause", e0);
4876 }
4877
4878 function try_CatchClause()
4879 {
4880 shiftT(91); // 'catch'
4881 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4882 try_CatchErrorList();
4883 shiftT(276); // '{'
4884 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4885 try_Expr();
4886 shiftT(282); // '}'
4887 }
4888
4889 function parse_CatchErrorList()
4890 {
4891 eventHandler.startNonterminal("CatchErrorList", e0);
4892 parse_NameTest();
4893 for (;;)
4894 {
4895 lookahead1W(136); // S^WS | '(:' | '{' | '|'
4896 if (l1 != 279) // '|'
4897 {
4898 break;
4899 }
4900 shift(279); // '|'
4901 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4902 whitespace();
4903 parse_NameTest();
4904 }
4905 eventHandler.endNonterminal("CatchErrorList", e0);
4906 }
4907
4908 function try_CatchErrorList()
4909 {
4910 try_NameTest();
4911 for (;;)
4912 {
4913 lookahead1W(136); // S^WS | '(:' | '{' | '|'
4914 if (l1 != 279) // '|'
4915 {
4916 break;
4917 }
4918 shiftT(279); // '|'
4919 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
4920 try_NameTest();
4921 }
4922 }
4923
4924 function parse_OrExpr()
4925 {
4926 eventHandler.startNonterminal("OrExpr", e0);
4927 parse_AndExpr();
4928 for (;;)
4929 {
4930 if (l1 != 200) // 'or'
4931 {
4932 break;
4933 }
4934 shift(200); // 'or'
4935 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4936 whitespace();
4937 parse_AndExpr();
4938 }
4939 eventHandler.endNonterminal("OrExpr", e0);
4940 }
4941
4942 function try_OrExpr()
4943 {
4944 try_AndExpr();
4945 for (;;)
4946 {
4947 if (l1 != 200) // 'or'
4948 {
4949 break;
4950 }
4951 shiftT(200); // 'or'
4952 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4953 try_AndExpr();
4954 }
4955 }
4956
4957 function parse_AndExpr()
4958 {
4959 eventHandler.startNonterminal("AndExpr", e0);
4960 parse_ComparisonExpr();
4961 for (;;)
4962 {
4963 if (l1 != 75) // 'and'
4964 {
4965 break;
4966 }
4967 shift(75); // 'and'
4968 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4969 whitespace();
4970 parse_ComparisonExpr();
4971 }
4972 eventHandler.endNonterminal("AndExpr", e0);
4973 }
4974
4975 function try_AndExpr()
4976 {
4977 try_ComparisonExpr();
4978 for (;;)
4979 {
4980 if (l1 != 75) // 'and'
4981 {
4982 break;
4983 }
4984 shiftT(75); // 'and'
4985 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
4986 try_ComparisonExpr();
4987 }
4988 }
4989
4990 function parse_ComparisonExpr()
4991 {
4992 eventHandler.startNonterminal("ComparisonExpr", e0);
4993 parse_FTContainsExpr();
4994 if (l1 == 27 // '!='
4995 || l1 == 54 // '<'
4996 || l1 == 57 // '<<'
4997 || l1 == 58 // '<='
4998 || l1 == 60 // '='
4999 || l1 == 61 // '>'
5000 || l1 == 62 // '>='
5001 || l1 == 63 // '>>'
5002 || l1 == 128 // 'eq'
5003 || l1 == 146 // 'ge'
5004 || l1 == 150 // 'gt'
5005 || l1 == 164 // 'is'
5006 || l1 == 172 // 'le'
5007 || l1 == 178 // 'lt'
5008 || l1 == 186) // 'ne'
5009 {
5010 switch (l1)
5011 {
5012 case 128: // 'eq'
5013 case 146: // 'ge'
5014 case 150: // 'gt'
5015 case 172: // 'le'
5016 case 178: // 'lt'
5017 case 186: // 'ne'
5018 whitespace();
5019 parse_ValueComp();
5020 break;
5021 case 57: // '<<'
5022 case 63: // '>>'
5023 case 164: // 'is'
5024 whitespace();
5025 parse_NodeComp();
5026 break;
5027 default:
5028 whitespace();
5029 parse_GeneralComp();
5030 }
5031 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5032 whitespace();
5033 parse_FTContainsExpr();
5034 }
5035 eventHandler.endNonterminal("ComparisonExpr", e0);
5036 }
5037
5038 function try_ComparisonExpr()
5039 {
5040 try_FTContainsExpr();
5041 if (l1 == 27 // '!='
5042 || l1 == 54 // '<'
5043 || l1 == 57 // '<<'
5044 || l1 == 58 // '<='
5045 || l1 == 60 // '='
5046 || l1 == 61 // '>'
5047 || l1 == 62 // '>='
5048 || l1 == 63 // '>>'
5049 || l1 == 128 // 'eq'
5050 || l1 == 146 // 'ge'
5051 || l1 == 150 // 'gt'
5052 || l1 == 164 // 'is'
5053 || l1 == 172 // 'le'
5054 || l1 == 178 // 'lt'
5055 || l1 == 186) // 'ne'
5056 {
5057 switch (l1)
5058 {
5059 case 128: // 'eq'
5060 case 146: // 'ge'
5061 case 150: // 'gt'
5062 case 172: // 'le'
5063 case 178: // 'lt'
5064 case 186: // 'ne'
5065 try_ValueComp();
5066 break;
5067 case 57: // '<<'
5068 case 63: // '>>'
5069 case 164: // 'is'
5070 try_NodeComp();
5071 break;
5072 default:
5073 try_GeneralComp();
5074 }
5075 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5076 try_FTContainsExpr();
5077 }
5078 }
5079
5080 function parse_FTContainsExpr()
5081 {
5082 eventHandler.startNonterminal("FTContainsExpr", e0);
5083 parse_StringConcatExpr();
5084 if (l1 == 99) // 'contains'
5085 {
5086 shift(99); // 'contains'
5087 lookahead1W(76); // S^WS | '(:' | 'text'
5088 shift(244); // 'text'
5089 lookahead1W(162); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{'
5090 whitespace();
5091 parse_FTSelection();
5092 if (l1 == 271) // 'without'
5093 {
5094 whitespace();
5095 parse_FTIgnoreOption();
5096 }
5097 }
5098 eventHandler.endNonterminal("FTContainsExpr", e0);
5099 }
5100
5101 function try_FTContainsExpr()
5102 {
5103 try_StringConcatExpr();
5104 if (l1 == 99) // 'contains'
5105 {
5106 shiftT(99); // 'contains'
5107 lookahead1W(76); // S^WS | '(:' | 'text'
5108 shiftT(244); // 'text'
5109 lookahead1W(162); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{'
5110 try_FTSelection();
5111 if (l1 == 271) // 'without'
5112 {
5113 try_FTIgnoreOption();
5114 }
5115 }
5116 }
5117
5118 function parse_StringConcatExpr()
5119 {
5120 eventHandler.startNonterminal("StringConcatExpr", e0);
5121 parse_RangeExpr();
5122 for (;;)
5123 {
5124 if (l1 != 280) // '||'
5125 {
5126 break;
5127 }
5128 shift(280); // '||'
5129 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5130 whitespace();
5131 parse_RangeExpr();
5132 }
5133 eventHandler.endNonterminal("StringConcatExpr", e0);
5134 }
5135
5136 function try_StringConcatExpr()
5137 {
5138 try_RangeExpr();
5139 for (;;)
5140 {
5141 if (l1 != 280) // '||'
5142 {
5143 break;
5144 }
5145 shiftT(280); // '||'
5146 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5147 try_RangeExpr();
5148 }
5149 }
5150
5151 function parse_RangeExpr()
5152 {
5153 eventHandler.startNonterminal("RangeExpr", e0);
5154 parse_AdditiveExpr();
5155 if (l1 == 248) // 'to'
5156 {
5157 shift(248); // 'to'
5158 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5159 whitespace();
5160 parse_AdditiveExpr();
5161 }
5162 eventHandler.endNonterminal("RangeExpr", e0);
5163 }
5164
5165 function try_RangeExpr()
5166 {
5167 try_AdditiveExpr();
5168 if (l1 == 248) // 'to'
5169 {
5170 shiftT(248); // 'to'
5171 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5172 try_AdditiveExpr();
5173 }
5174 }
5175
5176 function parse_AdditiveExpr()
5177 {
5178 eventHandler.startNonterminal("AdditiveExpr", e0);
5179 parse_MultiplicativeExpr();
5180 for (;;)
5181 {
5182 if (l1 != 40 // '+'
5183 && l1 != 42) // '-'
5184 {
5185 break;
5186 }
5187 switch (l1)
5188 {
5189 case 40: // '+'
5190 shift(40); // '+'
5191 break;
5192 default:
5193 shift(42); // '-'
5194 }
5195 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5196 whitespace();
5197 parse_MultiplicativeExpr();
5198 }
5199 eventHandler.endNonterminal("AdditiveExpr", e0);
5200 }
5201
5202 function try_AdditiveExpr()
5203 {
5204 try_MultiplicativeExpr();
5205 for (;;)
5206 {
5207 if (l1 != 40 // '+'
5208 && l1 != 42) // '-'
5209 {
5210 break;
5211 }
5212 switch (l1)
5213 {
5214 case 40: // '+'
5215 shiftT(40); // '+'
5216 break;
5217 default:
5218 shiftT(42); // '-'
5219 }
5220 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5221 try_MultiplicativeExpr();
5222 }
5223 }
5224
5225 function parse_MultiplicativeExpr()
5226 {
5227 eventHandler.startNonterminal("MultiplicativeExpr", e0);
5228 parse_UnionExpr();
5229 for (;;)
5230 {
5231 if (l1 != 38 // '*'
5232 && l1 != 118 // 'div'
5233 && l1 != 151 // 'idiv'
5234 && l1 != 180) // 'mod'
5235 {
5236 break;
5237 }
5238 switch (l1)
5239 {
5240 case 38: // '*'
5241 shift(38); // '*'
5242 break;
5243 case 118: // 'div'
5244 shift(118); // 'div'
5245 break;
5246 case 151: // 'idiv'
5247 shift(151); // 'idiv'
5248 break;
5249 default:
5250 shift(180); // 'mod'
5251 }
5252 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5253 whitespace();
5254 parse_UnionExpr();
5255 }
5256 eventHandler.endNonterminal("MultiplicativeExpr", e0);
5257 }
5258
5259 function try_MultiplicativeExpr()
5260 {
5261 try_UnionExpr();
5262 for (;;)
5263 {
5264 if (l1 != 38 // '*'
5265 && l1 != 118 // 'div'
5266 && l1 != 151 // 'idiv'
5267 && l1 != 180) // 'mod'
5268 {
5269 break;
5270 }
5271 switch (l1)
5272 {
5273 case 38: // '*'
5274 shiftT(38); // '*'
5275 break;
5276 case 118: // 'div'
5277 shiftT(118); // 'div'
5278 break;
5279 case 151: // 'idiv'
5280 shiftT(151); // 'idiv'
5281 break;
5282 default:
5283 shiftT(180); // 'mod'
5284 }
5285 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5286 try_UnionExpr();
5287 }
5288 }
5289
5290 function parse_UnionExpr()
5291 {
5292 eventHandler.startNonterminal("UnionExpr", e0);
5293 parse_IntersectExceptExpr();
5294 for (;;)
5295 {
5296 if (l1 != 254 // 'union'
5297 && l1 != 279) // '|'
5298 {
5299 break;
5300 }
5301 switch (l1)
5302 {
5303 case 254: // 'union'
5304 shift(254); // 'union'
5305 break;
5306 default:
5307 shift(279); // '|'
5308 }
5309 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5310 whitespace();
5311 parse_IntersectExceptExpr();
5312 }
5313 eventHandler.endNonterminal("UnionExpr", e0);
5314 }
5315
5316 function try_UnionExpr()
5317 {
5318 try_IntersectExceptExpr();
5319 for (;;)
5320 {
5321 if (l1 != 254 // 'union'
5322 && l1 != 279) // '|'
5323 {
5324 break;
5325 }
5326 switch (l1)
5327 {
5328 case 254: // 'union'
5329 shiftT(254); // 'union'
5330 break;
5331 default:
5332 shiftT(279); // '|'
5333 }
5334 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5335 try_IntersectExceptExpr();
5336 }
5337 }
5338
5339 function parse_IntersectExceptExpr()
5340 {
5341 eventHandler.startNonterminal("IntersectExceptExpr", e0);
5342 parse_InstanceofExpr();
5343 for (;;)
5344 {
5345 lookahead1W(222); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
5346 if (l1 != 131 // 'except'
5347 && l1 != 162) // 'intersect'
5348 {
5349 break;
5350 }
5351 switch (l1)
5352 {
5353 case 162: // 'intersect'
5354 shift(162); // 'intersect'
5355 break;
5356 default:
5357 shift(131); // 'except'
5358 }
5359 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5360 whitespace();
5361 parse_InstanceofExpr();
5362 }
5363 eventHandler.endNonterminal("IntersectExceptExpr", e0);
5364 }
5365
5366 function try_IntersectExceptExpr()
5367 {
5368 try_InstanceofExpr();
5369 for (;;)
5370 {
5371 lookahead1W(222); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
5372 if (l1 != 131 // 'except'
5373 && l1 != 162) // 'intersect'
5374 {
5375 break;
5376 }
5377 switch (l1)
5378 {
5379 case 162: // 'intersect'
5380 shiftT(162); // 'intersect'
5381 break;
5382 default:
5383 shiftT(131); // 'except'
5384 }
5385 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5386 try_InstanceofExpr();
5387 }
5388 }
5389
5390 function parse_InstanceofExpr()
5391 {
5392 eventHandler.startNonterminal("InstanceofExpr", e0);
5393 parse_TreatExpr();
5394 lookahead1W(223); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
5395 if (l1 == 160) // 'instance'
5396 {
5397 shift(160); // 'instance'
5398 lookahead1W(64); // S^WS | '(:' | 'of'
5399 shift(196); // 'of'
5400 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
5401 whitespace();
5402 parse_SequenceType();
5403 }
5404 eventHandler.endNonterminal("InstanceofExpr", e0);
5405 }
5406
5407 function try_InstanceofExpr()
5408 {
5409 try_TreatExpr();
5410 lookahead1W(223); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
5411 if (l1 == 160) // 'instance'
5412 {
5413 shiftT(160); // 'instance'
5414 lookahead1W(64); // S^WS | '(:' | 'of'
5415 shiftT(196); // 'of'
5416 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
5417 try_SequenceType();
5418 }
5419 }
5420
5421 function parse_TreatExpr()
5422 {
5423 eventHandler.startNonterminal("TreatExpr", e0);
5424 parse_CastableExpr();
5425 lookahead1W(224); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
5426 if (l1 == 249) // 'treat'
5427 {
5428 shift(249); // 'treat'
5429 lookahead1W(30); // S^WS | '(:' | 'as'
5430 shift(79); // 'as'
5431 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
5432 whitespace();
5433 parse_SequenceType();
5434 }
5435 eventHandler.endNonterminal("TreatExpr", e0);
5436 }
5437
5438 function try_TreatExpr()
5439 {
5440 try_CastableExpr();
5441 lookahead1W(224); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
5442 if (l1 == 249) // 'treat'
5443 {
5444 shiftT(249); // 'treat'
5445 lookahead1W(30); // S^WS | '(:' | 'as'
5446 shiftT(79); // 'as'
5447 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
5448 try_SequenceType();
5449 }
5450 }
5451
5452 function parse_CastableExpr()
5453 {
5454 eventHandler.startNonterminal("CastableExpr", e0);
5455 parse_CastExpr();
5456 lookahead1W(225); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
5457 if (l1 == 90) // 'castable'
5458 {
5459 shift(90); // 'castable'
5460 lookahead1W(30); // S^WS | '(:' | 'as'
5461 shift(79); // 'as'
5462 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
5463 whitespace();
5464 parse_SingleType();
5465 }
5466 eventHandler.endNonterminal("CastableExpr", e0);
5467 }
5468
5469 function try_CastableExpr()
5470 {
5471 try_CastExpr();
5472 lookahead1W(225); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
5473 if (l1 == 90) // 'castable'
5474 {
5475 shiftT(90); // 'castable'
5476 lookahead1W(30); // S^WS | '(:' | 'as'
5477 shiftT(79); // 'as'
5478 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
5479 try_SingleType();
5480 }
5481 }
5482
5483 function parse_CastExpr()
5484 {
5485 eventHandler.startNonterminal("CastExpr", e0);
5486 parse_UnaryExpr();
5487 lookahead1W(227); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
5488 if (l1 == 89) // 'cast'
5489 {
5490 shift(89); // 'cast'
5491 lookahead1W(30); // S^WS | '(:' | 'as'
5492 shift(79); // 'as'
5493 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
5494 whitespace();
5495 parse_SingleType();
5496 }
5497 eventHandler.endNonterminal("CastExpr", e0);
5498 }
5499
5500 function try_CastExpr()
5501 {
5502 try_UnaryExpr();
5503 lookahead1W(227); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
5504 if (l1 == 89) // 'cast'
5505 {
5506 shiftT(89); // 'cast'
5507 lookahead1W(30); // S^WS | '(:' | 'as'
5508 shiftT(79); // 'as'
5509 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
5510 try_SingleType();
5511 }
5512 }
5513
5514 function parse_UnaryExpr()
5515 {
5516 eventHandler.startNonterminal("UnaryExpr", e0);
5517 for (;;)
5518 {
5519 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5520 if (l1 != 40 // '+'
5521 && l1 != 42) // '-'
5522 {
5523 break;
5524 }
5525 switch (l1)
5526 {
5527 case 42: // '-'
5528 shift(42); // '-'
5529 break;
5530 default:
5531 shift(40); // '+'
5532 }
5533 }
5534 whitespace();
5535 parse_ValueExpr();
5536 eventHandler.endNonterminal("UnaryExpr", e0);
5537 }
5538
5539 function try_UnaryExpr()
5540 {
5541 for (;;)
5542 {
5543 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5544 if (l1 != 40 // '+'
5545 && l1 != 42) // '-'
5546 {
5547 break;
5548 }
5549 switch (l1)
5550 {
5551 case 42: // '-'
5552 shiftT(42); // '-'
5553 break;
5554 default:
5555 shiftT(40); // '+'
5556 }
5557 }
5558 try_ValueExpr();
5559 }
5560
5561 function parse_ValueExpr()
5562 {
5563 eventHandler.startNonterminal("ValueExpr", e0);
5564 switch (l1)
5565 {
5566 case 260: // 'validate'
5567 lookahead2W(246); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
5568 break;
5569 default:
5570 lk = l1;
5571 }
5572 switch (lk)
5573 {
5574 case 87812: // 'validate' 'lax'
5575 case 123140: // 'validate' 'strict'
5576 case 129284: // 'validate' 'type'
5577 case 141572: // 'validate' '{'
5578 parse_ValidateExpr();
5579 break;
5580 case 35: // '(#'
5581 parse_ExtensionExpr();
5582 break;
5583 default:
5584 parse_SimpleMapExpr();
5585 }
5586 eventHandler.endNonterminal("ValueExpr", e0);
5587 }
5588
5589 function try_ValueExpr()
5590 {
5591 switch (l1)
5592 {
5593 case 260: // 'validate'
5594 lookahead2W(246); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
5595 break;
5596 default:
5597 lk = l1;
5598 }
5599 switch (lk)
5600 {
5601 case 87812: // 'validate' 'lax'
5602 case 123140: // 'validate' 'strict'
5603 case 129284: // 'validate' 'type'
5604 case 141572: // 'validate' '{'
5605 try_ValidateExpr();
5606 break;
5607 case 35: // '(#'
5608 try_ExtensionExpr();
5609 break;
5610 default:
5611 try_SimpleMapExpr();
5612 }
5613 }
5614
5615 function parse_SimpleMapExpr()
5616 {
5617 eventHandler.startNonterminal("SimpleMapExpr", e0);
5618 parse_PathExpr();
5619 for (;;)
5620 {
5621 if (l1 != 26) // '!'
5622 {
5623 break;
5624 }
5625 shift(26); // '!'
5626 lookahead1W(264); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5627 whitespace();
5628 parse_PathExpr();
5629 }
5630 eventHandler.endNonterminal("SimpleMapExpr", e0);
5631 }
5632
5633 function try_SimpleMapExpr()
5634 {
5635 try_PathExpr();
5636 for (;;)
5637 {
5638 if (l1 != 26) // '!'
5639 {
5640 break;
5641 }
5642 shiftT(26); // '!'
5643 lookahead1W(264); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5644 try_PathExpr();
5645 }
5646 }
5647
5648 function parse_GeneralComp()
5649 {
5650 eventHandler.startNonterminal("GeneralComp", e0);
5651 switch (l1)
5652 {
5653 case 60: // '='
5654 shift(60); // '='
5655 break;
5656 case 27: // '!='
5657 shift(27); // '!='
5658 break;
5659 case 54: // '<'
5660 shift(54); // '<'
5661 break;
5662 case 58: // '<='
5663 shift(58); // '<='
5664 break;
5665 case 61: // '>'
5666 shift(61); // '>'
5667 break;
5668 default:
5669 shift(62); // '>='
5670 }
5671 eventHandler.endNonterminal("GeneralComp", e0);
5672 }
5673
5674 function try_GeneralComp()
5675 {
5676 switch (l1)
5677 {
5678 case 60: // '='
5679 shiftT(60); // '='
5680 break;
5681 case 27: // '!='
5682 shiftT(27); // '!='
5683 break;
5684 case 54: // '<'
5685 shiftT(54); // '<'
5686 break;
5687 case 58: // '<='
5688 shiftT(58); // '<='
5689 break;
5690 case 61: // '>'
5691 shiftT(61); // '>'
5692 break;
5693 default:
5694 shiftT(62); // '>='
5695 }
5696 }
5697
5698 function parse_ValueComp()
5699 {
5700 eventHandler.startNonterminal("ValueComp", e0);
5701 switch (l1)
5702 {
5703 case 128: // 'eq'
5704 shift(128); // 'eq'
5705 break;
5706 case 186: // 'ne'
5707 shift(186); // 'ne'
5708 break;
5709 case 178: // 'lt'
5710 shift(178); // 'lt'
5711 break;
5712 case 172: // 'le'
5713 shift(172); // 'le'
5714 break;
5715 case 150: // 'gt'
5716 shift(150); // 'gt'
5717 break;
5718 default:
5719 shift(146); // 'ge'
5720 }
5721 eventHandler.endNonterminal("ValueComp", e0);
5722 }
5723
5724 function try_ValueComp()
5725 {
5726 switch (l1)
5727 {
5728 case 128: // 'eq'
5729 shiftT(128); // 'eq'
5730 break;
5731 case 186: // 'ne'
5732 shiftT(186); // 'ne'
5733 break;
5734 case 178: // 'lt'
5735 shiftT(178); // 'lt'
5736 break;
5737 case 172: // 'le'
5738 shiftT(172); // 'le'
5739 break;
5740 case 150: // 'gt'
5741 shiftT(150); // 'gt'
5742 break;
5743 default:
5744 shiftT(146); // 'ge'
5745 }
5746 }
5747
5748 function parse_NodeComp()
5749 {
5750 eventHandler.startNonterminal("NodeComp", e0);
5751 switch (l1)
5752 {
5753 case 164: // 'is'
5754 shift(164); // 'is'
5755 break;
5756 case 57: // '<<'
5757 shift(57); // '<<'
5758 break;
5759 default:
5760 shift(63); // '>>'
5761 }
5762 eventHandler.endNonterminal("NodeComp", e0);
5763 }
5764
5765 function try_NodeComp()
5766 {
5767 switch (l1)
5768 {
5769 case 164: // 'is'
5770 shiftT(164); // 'is'
5771 break;
5772 case 57: // '<<'
5773 shiftT(57); // '<<'
5774 break;
5775 default:
5776 shiftT(63); // '>>'
5777 }
5778 }
5779
5780 function parse_ValidateExpr()
5781 {
5782 eventHandler.startNonterminal("ValidateExpr", e0);
5783 shift(260); // 'validate'
5784 lookahead1W(160); // S^WS | '(:' | 'lax' | 'strict' | 'type' | '{'
5785 if (l1 != 276) // '{'
5786 {
5787 switch (l1)
5788 {
5789 case 252: // 'type'
5790 shift(252); // 'type'
5791 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
5792 whitespace();
5793 parse_TypeName();
5794 break;
5795 default:
5796 whitespace();
5797 parse_ValidationMode();
5798 }
5799 }
5800 lookahead1W(87); // S^WS | '(:' | '{'
5801 shift(276); // '{'
5802 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5803 whitespace();
5804 parse_Expr();
5805 shift(282); // '}'
5806 eventHandler.endNonterminal("ValidateExpr", e0);
5807 }
5808
5809 function try_ValidateExpr()
5810 {
5811 shiftT(260); // 'validate'
5812 lookahead1W(160); // S^WS | '(:' | 'lax' | 'strict' | 'type' | '{'
5813 if (l1 != 276) // '{'
5814 {
5815 switch (l1)
5816 {
5817 case 252: // 'type'
5818 shiftT(252); // 'type'
5819 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
5820 try_TypeName();
5821 break;
5822 default:
5823 try_ValidationMode();
5824 }
5825 }
5826 lookahead1W(87); // S^WS | '(:' | '{'
5827 shiftT(276); // '{'
5828 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5829 try_Expr();
5830 shiftT(282); // '}'
5831 }
5832
5833 function parse_ValidationMode()
5834 {
5835 eventHandler.startNonterminal("ValidationMode", e0);
5836 switch (l1)
5837 {
5838 case 171: // 'lax'
5839 shift(171); // 'lax'
5840 break;
5841 default:
5842 shift(240); // 'strict'
5843 }
5844 eventHandler.endNonterminal("ValidationMode", e0);
5845 }
5846
5847 function try_ValidationMode()
5848 {
5849 switch (l1)
5850 {
5851 case 171: // 'lax'
5852 shiftT(171); // 'lax'
5853 break;
5854 default:
5855 shiftT(240); // 'strict'
5856 }
5857 }
5858
5859 function parse_ExtensionExpr()
5860 {
5861 eventHandler.startNonterminal("ExtensionExpr", e0);
5862 for (;;)
5863 {
5864 whitespace();
5865 parse_Pragma();
5866 lookahead1W(100); // S^WS | '(#' | '(:' | '{'
5867 if (l1 != 35) // '(#'
5868 {
5869 break;
5870 }
5871 }
5872 shift(276); // '{'
5873 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5874 if (l1 != 282) // '}'
5875 {
5876 whitespace();
5877 parse_Expr();
5878 }
5879 shift(282); // '}'
5880 eventHandler.endNonterminal("ExtensionExpr", e0);
5881 }
5882
5883 function try_ExtensionExpr()
5884 {
5885 for (;;)
5886 {
5887 try_Pragma();
5888 lookahead1W(100); // S^WS | '(#' | '(:' | '{'
5889 if (l1 != 35) // '(#'
5890 {
5891 break;
5892 }
5893 }
5894 shiftT(276); // '{'
5895 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5896 if (l1 != 282) // '}'
5897 {
5898 try_Expr();
5899 }
5900 shiftT(282); // '}'
5901 }
5902
5903 function parse_Pragma()
5904 {
5905 eventHandler.startNonterminal("Pragma", e0);
5906 shift(35); // '(#'
5907 lookahead1(250); // EQName^Token | S | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
5908 if (l1 == 21) // S
5909 {
5910 shift(21); // S
5911 }
5912 parse_EQName();
5913 lookahead1(10); // S | '#)'
5914 if (l1 == 21) // S
5915 {
5916 shift(21); // S
5917 lookahead1(0); // PragmaContents
5918 shift(1); // PragmaContents
5919 }
5920 lookahead1(5); // '#)'
5921 shift(30); // '#)'
5922 eventHandler.endNonterminal("Pragma", e0);
5923 }
5924
5925 function try_Pragma()
5926 {
5927 shiftT(35); // '(#'
5928 lookahead1(250); // EQName^Token | S | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
5929 if (l1 == 21) // S
5930 {
5931 shiftT(21); // S
5932 }
5933 try_EQName();
5934 lookahead1(10); // S | '#)'
5935 if (l1 == 21) // S
5936 {
5937 shiftT(21); // S
5938 lookahead1(0); // PragmaContents
5939 shiftT(1); // PragmaContents
5940 }
5941 lookahead1(5); // '#)'
5942 shiftT(30); // '#)'
5943 }
5944
5945 function parse_PathExpr()
5946 {
5947 eventHandler.startNonterminal("PathExpr", e0);
5948 switch (l1)
5949 {
5950 case 46: // '/'
5951 shift(46); // '/'
5952 lookahead1W(283); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5953 switch (l1)
5954 {
5955 case 25: // EOF
5956 case 26: // '!'
5957 case 27: // '!='
5958 case 37: // ')'
5959 case 38: // '*'
5960 case 40: // '+'
5961 case 41: // ','
5962 case 42: // '-'
5963 case 49: // ':'
5964 case 53: // ';'
5965 case 57: // '<<'
5966 case 58: // '<='
5967 case 60: // '='
5968 case 61: // '>'
5969 case 62: // '>='
5970 case 63: // '>>'
5971 case 69: // ']'
5972 case 87: // 'by'
5973 case 99: // 'contains'
5974 case 205: // 'paragraphs'
5975 case 232: // 'sentences'
5976 case 247: // 'times'
5977 case 273: // 'words'
5978 case 279: // '|'
5979 case 280: // '||'
5980 case 281: // '|}'
5981 case 282: // '}'
5982 break;
5983 default:
5984 whitespace();
5985 parse_RelativePathExpr();
5986 }
5987 break;
5988 case 47: // '//'
5989 shift(47); // '//'
5990 lookahead1W(263); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
5991 whitespace();
5992 parse_RelativePathExpr();
5993 break;
5994 default:
5995 parse_RelativePathExpr();
5996 }
5997 eventHandler.endNonterminal("PathExpr", e0);
5998 }
5999
6000 function try_PathExpr()
6001 {
6002 switch (l1)
6003 {
6004 case 46: // '/'
6005 shiftT(46); // '/'
6006 lookahead1W(283); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
6007 switch (l1)
6008 {
6009 case 25: // EOF
6010 case 26: // '!'
6011 case 27: // '!='
6012 case 37: // ')'
6013 case 38: // '*'
6014 case 40: // '+'
6015 case 41: // ','
6016 case 42: // '-'
6017 case 49: // ':'
6018 case 53: // ';'
6019 case 57: // '<<'
6020 case 58: // '<='
6021 case 60: // '='
6022 case 61: // '>'
6023 case 62: // '>='
6024 case 63: // '>>'
6025 case 69: // ']'
6026 case 87: // 'by'
6027 case 99: // 'contains'
6028 case 205: // 'paragraphs'
6029 case 232: // 'sentences'
6030 case 247: // 'times'
6031 case 273: // 'words'
6032 case 279: // '|'
6033 case 280: // '||'
6034 case 281: // '|}'
6035 case 282: // '}'
6036 break;
6037 default:
6038 try_RelativePathExpr();
6039 }
6040 break;
6041 case 47: // '//'
6042 shiftT(47); // '//'
6043 lookahead1W(263); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
6044 try_RelativePathExpr();
6045 break;
6046 default:
6047 try_RelativePathExpr();
6048 }
6049 }
6050
6051 function parse_RelativePathExpr()
6052 {
6053 eventHandler.startNonterminal("RelativePathExpr", e0);
6054 parse_StepExpr();
6055 for (;;)
6056 {
6057 switch (l1)
6058 {
6059 case 26: // '!'
6060 lookahead2W(264); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
6061 break;
6062 default:
6063 lk = l1;
6064 }
6065 if (lk != 25 // EOF
6066 && lk != 27 // '!='
6067 && lk != 37 // ')'
6068 && lk != 38 // '*'
6069 && lk != 40 // '+'
6070 && lk != 41 // ','
6071 && lk != 42 // '-'
6072 && lk != 46 // '/'
6073 && lk != 47 // '//'
6074 && lk != 49 // ':'
6075 && lk != 53 // ';'
6076 && lk != 54 // '<'
6077 && lk != 57 // '<<'
6078 && lk != 58 // '<='
6079 && lk != 60 // '='
6080 && lk != 61 // '>'
6081 && lk != 62 // '>='
6082 && lk != 63 // '>>'
6083 && lk != 69 // ']'
6084 && lk != 70 // 'after'
6085 && lk != 75 // 'and'
6086 && lk != 79 // 'as'
6087 && lk != 80 // 'ascending'
6088 && lk != 81 // 'at'
6089 && lk != 84 // 'before'
6090 && lk != 87 // 'by'
6091 && lk != 88 // 'case'
6092 && lk != 89 // 'cast'
6093 && lk != 90 // 'castable'
6094 && lk != 94 // 'collation'
6095 && lk != 99 // 'contains'
6096 && lk != 105 // 'count'
6097 && lk != 109 // 'default'
6098 && lk != 113 // 'descending'
6099 && lk != 118 // 'div'
6100 && lk != 122 // 'else'
6101 && lk != 123 // 'empty'
6102 && lk != 126 // 'end'
6103 && lk != 128 // 'eq'
6104 && lk != 131 // 'except'
6105 && lk != 137 // 'for'
6106 && lk != 146 // 'ge'
6107 && lk != 148 // 'group'
6108 && lk != 150 // 'gt'
6109 && lk != 151 // 'idiv'
6110 && lk != 160 // 'instance'
6111 && lk != 162 // 'intersect'
6112 && lk != 163 // 'into'
6113 && lk != 164 // 'is'
6114 && lk != 172 // 'le'
6115 && lk != 174 // 'let'
6116 && lk != 178 // 'lt'
6117 && lk != 180 // 'mod'
6118 && lk != 181 // 'modify'
6119 && lk != 186 // 'ne'
6120 && lk != 198 // 'only'
6121 && lk != 200 // 'or'
6122 && lk != 201 // 'order'
6123 && lk != 205 // 'paragraphs'
6124 && lk != 220 // 'return'
6125 && lk != 224 // 'satisfies'
6126 && lk != 232 // 'sentences'
6127 && lk != 236 // 'stable'
6128 && lk != 237 // 'start'
6129 && lk != 247 // 'times'
6130 && lk != 248 // 'to'
6131 && lk != 249 // 'treat'
6132 && lk != 254 // 'union'
6133 && lk != 266 // 'where'
6134 && lk != 270 // 'with'
6135 && lk != 273 // 'words'
6136 && lk != 279 // '|'
6137 && lk != 280 // '||'
6138 && lk != 281 // '|}'
6139 && lk != 282 // '}'
6140 && lk != 23578 // '!' '/'
6141 && lk != 24090) // '!' '//'
6142 {
6143 lk = memoized(2, e0);
6144 if (lk == 0)
6145 {
6146 var b0A = b0; var e0A = e0; var l1A = l1;
6147 var b1A = b1; var e1A = e1; var l2A = l2;
6148 var b2A = b2; var e2A = e2;
6149 try
6150 {
6151 switch (l1)
6152 {
6153 case 46: // '/'
6154 shiftT(46); // '/'
6155 break;
6156 case 47: // '//'
6157 shiftT(47); // '//'
6158 break;
6159 default:
6160 shiftT(26); // '!'
6161 }
6162 lookahead1W(263); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
6163 try_StepExpr();
6164 lk = -1;
6165 }
6166 catch (p1A)
6167 {
6168 lk = -2;
6169 }
6170 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
6171 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
6172 b2 = b2A; e2 = e2A; end = e2A; }}
6173 memoize(2, e0, lk);
6174 }
6175 }
6176 if (lk != -1
6177 && lk != 46 // '/'
6178 && lk != 47) // '//'
6179 {
6180 break;
6181 }
6182 switch (l1)
6183 {
6184 case 46: // '/'
6185 shift(46); // '/'
6186 break;
6187 case 47: // '//'
6188 shift(47); // '//'
6189 break;
6190 default:
6191 shift(26); // '!'
6192 }
6193 lookahead1W(263); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
6194 whitespace();
6195 parse_StepExpr();
6196 }
6197 eventHandler.endNonterminal("RelativePathExpr", e0);
6198 }
6199
6200 function try_RelativePathExpr()
6201 {
6202 try_StepExpr();
6203 for (;;)
6204 {
6205 switch (l1)
6206 {
6207 case 26: // '!'
6208 lookahead2W(264); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
6209 break;
6210 default:
6211 lk = l1;
6212 }
6213 if (lk != 25 // EOF
6214 && lk != 27 // '!='
6215 && lk != 37 // ')'
6216 && lk != 38 // '*'
6217 && lk != 40 // '+'
6218 && lk != 41 // ','
6219 && lk != 42 // '-'
6220 && lk != 46 // '/'
6221 && lk != 47 // '//'
6222 && lk != 49 // ':'
6223 && lk != 53 // ';'
6224 && lk != 54 // '<'
6225 && lk != 57 // '<<'
6226 && lk != 58 // '<='
6227 && lk != 60 // '='
6228 && lk != 61 // '>'
6229 && lk != 62 // '>='
6230 && lk != 63 // '>>'
6231 && lk != 69 // ']'
6232 && lk != 70 // 'after'
6233 && lk != 75 // 'and'
6234 && lk != 79 // 'as'
6235 && lk != 80 // 'ascending'
6236 && lk != 81 // 'at'
6237 && lk != 84 // 'before'
6238 && lk != 87 // 'by'
6239 && lk != 88 // 'case'
6240 && lk != 89 // 'cast'
6241 && lk != 90 // 'castable'
6242 && lk != 94 // 'collation'
6243 && lk != 99 // 'contains'
6244 && lk != 105 // 'count'
6245 && lk != 109 // 'default'
6246 && lk != 113 // 'descending'
6247 && lk != 118 // 'div'
6248 && lk != 122 // 'else'
6249 && lk != 123 // 'empty'
6250 && lk != 126 // 'end'
6251 && lk != 128 // 'eq'
6252 && lk != 131 // 'except'
6253 && lk != 137 // 'for'
6254 && lk != 146 // 'ge'
6255 && lk != 148 // 'group'
6256 && lk != 150 // 'gt'
6257 && lk != 151 // 'idiv'
6258 && lk != 160 // 'instance'
6259 && lk != 162 // 'intersect'
6260 && lk != 163 // 'into'
6261 && lk != 164 // 'is'
6262 && lk != 172 // 'le'
6263 && lk != 174 // 'let'
6264 && lk != 178 // 'lt'
6265 && lk != 180 // 'mod'
6266 && lk != 181 // 'modify'
6267 && lk != 186 // 'ne'
6268 && lk != 198 // 'only'
6269 && lk != 200 // 'or'
6270 && lk != 201 // 'order'
6271 && lk != 205 // 'paragraphs'
6272 && lk != 220 // 'return'
6273 && lk != 224 // 'satisfies'
6274 && lk != 232 // 'sentences'
6275 && lk != 236 // 'stable'
6276 && lk != 237 // 'start'
6277 && lk != 247 // 'times'
6278 && lk != 248 // 'to'
6279 && lk != 249 // 'treat'
6280 && lk != 254 // 'union'
6281 && lk != 266 // 'where'
6282 && lk != 270 // 'with'
6283 && lk != 273 // 'words'
6284 && lk != 279 // '|'
6285 && lk != 280 // '||'
6286 && lk != 281 // '|}'
6287 && lk != 282 // '}'
6288 && lk != 23578 // '!' '/'
6289 && lk != 24090) // '!' '//'
6290 {
6291 lk = memoized(2, e0);
6292 if (lk == 0)
6293 {
6294 var b0A = b0; var e0A = e0; var l1A = l1;
6295 var b1A = b1; var e1A = e1; var l2A = l2;
6296 var b2A = b2; var e2A = e2;
6297 try
6298 {
6299 switch (l1)
6300 {
6301 case 46: // '/'
6302 shiftT(46); // '/'
6303 break;
6304 case 47: // '//'
6305 shiftT(47); // '//'
6306 break;
6307 default:
6308 shiftT(26); // '!'
6309 }
6310 lookahead1W(263); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
6311 try_StepExpr();
6312 memoize(2, e0A, -1);
6313 continue;
6314 }
6315 catch (p1A)
6316 {
6317 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
6318 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
6319 b2 = b2A; e2 = e2A; end = e2A; }}
6320 memoize(2, e0A, -2);
6321 break;
6322 }
6323 }
6324 }
6325 if (lk != -1
6326 && lk != 46 // '/'
6327 && lk != 47) // '//'
6328 {
6329 break;
6330 }
6331 switch (l1)
6332 {
6333 case 46: // '/'
6334 shiftT(46); // '/'
6335 break;
6336 case 47: // '//'
6337 shiftT(47); // '//'
6338 break;
6339 default:
6340 shiftT(26); // '!'
6341 }
6342 lookahead1W(263); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
6343 try_StepExpr();
6344 }
6345 }
6346
6347 function parse_StepExpr()
6348 {
6349 eventHandler.startNonterminal("StepExpr", e0);
6350 switch (l1)
6351 {
6352 case 82: // 'attribute'
6353 lookahead2W(282); // EQName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' |
6354 break;
6355 case 121: // 'element'
6356 lookahead2W(280); // EQName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' |
6357 break;
6358 case 184: // 'namespace'
6359 case 216: // 'processing-instruction'
6360 lookahead2W(279); // NCName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' |
6361 break;
6362 case 96: // 'comment'
6363 case 119: // 'document'
6364 case 202: // 'ordered'
6365 case 244: // 'text'
6366 case 256: // 'unordered'
6367 lookahead2W(245); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
6368 break;
6369 case 124: // 'empty-sequence'
6370 case 152: // 'if'
6371 case 165: // 'item'
6372 case 243: // 'switch'
6373 case 253: // 'typeswitch'
6374 lookahead2W(238); // S^WS | EOF | '!' | '!=' | '#' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' |
6375 break;
6376 case 73: // 'ancestor'
6377 case 74: // 'ancestor-or-self'
6378 case 93: // 'child'
6379 case 111: // 'descendant'
6380 case 112: // 'descendant-or-self'
6381 case 135: // 'following'
6382 case 136: // 'following-sibling'
6383 case 206: // 'parent'
6384 case 212: // 'preceding'
6385 case 213: // 'preceding-sibling'
6386 case 229: // 'self'
6387 lookahead2W(244); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
6388 break;
6389 case 6: // EQName^Token
6390 case 70: // 'after'
6391 case 72: // 'allowing'
6392 case 75: // 'and'
6393 case 78: // 'array'
6394 case 79: // 'as'
6395 case 80: // 'ascending'
6396 case 81: // 'at'
6397 case 83: // 'base-uri'
6398 case 84: // 'before'
6399 case 85: // 'boundary-space'
6400 case 86: // 'break'
6401 case 88: // 'case'
6402 case 89: // 'cast'
6403 case 90: // 'castable'
6404 case 91: // 'catch'
6405 case 94: // 'collation'
6406 case 97: // 'constraint'
6407 case 98: // 'construction'
6408 case 101: // 'context'
6409 case 102: // 'continue'
6410 case 103: // 'copy'
6411 case 104: // 'copy-namespaces'
6412 case 105: // 'count'
6413 case 106: // 'decimal-format'
6414 case 108: // 'declare'
6415 case 109: // 'default'
6416 case 110: // 'delete'
6417 case 113: // 'descending'
6418 case 118: // 'div'
6419 case 120: // 'document-node'
6420 case 122: // 'else'
6421 case 123: // 'empty'
6422 case 125: // 'encoding'
6423 case 126: // 'end'
6424 case 128: // 'eq'
6425 case 129: // 'every'
6426 case 131: // 'except'
6427 case 132: // 'exit'
6428 case 133: // 'external'
6429 case 134: // 'first'
6430 case 137: // 'for'
6431 case 141: // 'ft-option'
6432 case 145: // 'function'
6433 case 146: // 'ge'
6434 case 148: // 'group'
6435 case 150: // 'gt'
6436 case 151: // 'idiv'
6437 case 153: // 'import'
6438 case 154: // 'in'
6439 case 155: // 'index'
6440 case 159: // 'insert'
6441 case 160: // 'instance'
6442 case 161: // 'integrity'
6443 case 162: // 'intersect'
6444 case 163: // 'into'
6445 case 164: // 'is'
6446 case 167: // 'json-item'
6447 case 170: // 'last'
6448 case 171: // 'lax'
6449 case 172: // 'le'
6450 case 174: // 'let'
6451 case 176: // 'loop'
6452 case 178: // 'lt'
6453 case 180: // 'mod'
6454 case 181: // 'modify'
6455 case 182: // 'module'
6456 case 185: // 'namespace-node'
6457 case 186: // 'ne'
6458 case 191: // 'node'
6459 case 192: // 'nodes'
6460 case 194: // 'object'
6461 case 198: // 'only'
6462 case 199: // 'option'
6463 case 200: // 'or'
6464 case 201: // 'order'
6465 case 203: // 'ordering'
6466 case 218: // 'rename'
6467 case 219: // 'replace'
6468 case 220: // 'return'
6469 case 221: // 'returning'
6470 case 222: // 'revalidation'
6471 case 224: // 'satisfies'
6472 case 225: // 'schema'
6473 case 226: // 'schema-attribute'
6474 case 227: // 'schema-element'
6475 case 228: // 'score'
6476 case 234: // 'sliding'
6477 case 235: // 'some'
6478 case 236: // 'stable'
6479 case 237: // 'start'
6480 case 240: // 'strict'
6481 case 248: // 'to'
6482 case 249: // 'treat'
6483 case 250: // 'try'
6484 case 251: // 'tumbling'
6485 case 252: // 'type'
6486 case 254: // 'union'
6487 case 257: // 'updating'
6488 case 260: // 'validate'
6489 case 261: // 'value'
6490 case 262: // 'variable'
6491 case 263: // 'version'
6492 case 266: // 'where'
6493 case 267: // 'while'
6494 case 270: // 'with'
6495 case 274: // 'xquery'
6496 lookahead2W(242); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
6497 break;
6498 default:
6499 lk = l1;
6500 }
6501 if (lk == 17486 // 'array' '('
6502 || lk == 17575 // 'json-item' '('
6503 || lk == 17602 // 'object' '('
6504 || lk == 35922 // 'attribute' 'after'
6505 || lk == 35961 // 'element' 'after'
6506 || lk == 36024 // 'namespace' 'after'
6507 || lk == 36056 // 'processing-instruction' 'after'
6508 || lk == 38482 // 'attribute' 'and'
6509 || lk == 38521 // 'element' 'and'
6510 || lk == 38584 // 'namespace' 'and'
6511 || lk == 38616 // 'processing-instruction' 'and'
6512 || lk == 40530 // 'attribute' 'as'
6513 || lk == 40569 // 'element' 'as'
6514 || lk == 40632 // 'namespace' 'as'
6515 || lk == 40664 // 'processing-instruction' 'as'
6516 || lk == 41042 // 'attribute' 'ascending'
6517 || lk == 41081 // 'element' 'ascending'
6518 || lk == 41144 // 'namespace' 'ascending'
6519 || lk == 41176 // 'processing-instruction' 'ascending'
6520 || lk == 41554 // 'attribute' 'at'
6521 || lk == 41593 // 'element' 'at'
6522 || lk == 41656 // 'namespace' 'at'
6523 || lk == 41688 // 'processing-instruction' 'at'
6524 || lk == 43090 // 'attribute' 'before'
6525 || lk == 43129 // 'element' 'before'
6526 || lk == 43192 // 'namespace' 'before'
6527 || lk == 43224 // 'processing-instruction' 'before'
6528 || lk == 45138 // 'attribute' 'case'
6529 || lk == 45177 // 'element' 'case'
6530 || lk == 45240 // 'namespace' 'case'
6531 || lk == 45272 // 'processing-instruction' 'case'
6532 || lk == 45650 // 'attribute' 'cast'
6533 || lk == 45689 // 'element' 'cast'
6534 || lk == 45752 // 'namespace' 'cast'
6535 || lk == 45784 // 'processing-instruction' 'cast'
6536 || lk == 46162 // 'attribute' 'castable'
6537 || lk == 46201 // 'element' 'castable'
6538 || lk == 46264 // 'namespace' 'castable'
6539 || lk == 46296 // 'processing-instruction' 'castable'
6540 || lk == 48210 // 'attribute' 'collation'
6541 || lk == 48249 // 'element' 'collation'
6542 || lk == 48312 // 'namespace' 'collation'
6543 || lk == 48344 // 'processing-instruction' 'collation'
6544 || lk == 53842 // 'attribute' 'count'
6545 || lk == 53881 // 'element' 'count'
6546 || lk == 53944 // 'namespace' 'count'
6547 || lk == 53976 // 'processing-instruction' 'count'
6548 || lk == 55890 // 'attribute' 'default'
6549 || lk == 55929 // 'element' 'default'
6550 || lk == 55992 // 'namespace' 'default'
6551 || lk == 56024 // 'processing-instruction' 'default'
6552 || lk == 57938 // 'attribute' 'descending'
6553 || lk == 57977 // 'element' 'descending'
6554 || lk == 58040 // 'namespace' 'descending'
6555 || lk == 58072 // 'processing-instruction' 'descending'
6556 || lk == 60498 // 'attribute' 'div'
6557 || lk == 60537 // 'element' 'div'
6558 || lk == 60600 // 'namespace' 'div'
6559 || lk == 60632 // 'processing-instruction' 'div'
6560 || lk == 62546 // 'attribute' 'else'
6561 || lk == 62585 // 'element' 'else'
6562 || lk == 62648 // 'namespace' 'else'
6563 || lk == 62680 // 'processing-instruction' 'else'
6564 || lk == 63058 // 'attribute' 'empty'
6565 || lk == 63097 // 'element' 'empty'
6566 || lk == 63160 // 'namespace' 'empty'
6567 || lk == 63192 // 'processing-instruction' 'empty'
6568 || lk == 64594 // 'attribute' 'end'
6569 || lk == 64633 // 'element' 'end'
6570 || lk == 64696 // 'namespace' 'end'
6571 || lk == 64728 // 'processing-instruction' 'end'
6572 || lk == 65618 // 'attribute' 'eq'
6573 || lk == 65657 // 'element' 'eq'
6574 || lk == 65720 // 'namespace' 'eq'
6575 || lk == 65752 // 'processing-instruction' 'eq'
6576 || lk == 67154 // 'attribute' 'except'
6577 || lk == 67193 // 'element' 'except'
6578 || lk == 67256 // 'namespace' 'except'
6579 || lk == 67288 // 'processing-instruction' 'except'
6580 || lk == 70226 // 'attribute' 'for'
6581 || lk == 70265 // 'element' 'for'
6582 || lk == 70328 // 'namespace' 'for'
6583 || lk == 70360 // 'processing-instruction' 'for'
6584 || lk == 74834 // 'attribute' 'ge'
6585 || lk == 74873 // 'element' 'ge'
6586 || lk == 74936 // 'namespace' 'ge'
6587 || lk == 74968 // 'processing-instruction' 'ge'
6588 || lk == 75858 // 'attribute' 'group'
6589 || lk == 75897 // 'element' 'group'
6590 || lk == 75960 // 'namespace' 'group'
6591 || lk == 75992 // 'processing-instruction' 'group'
6592 || lk == 76882 // 'attribute' 'gt'
6593 || lk == 76921 // 'element' 'gt'
6594 || lk == 76984 // 'namespace' 'gt'
6595 || lk == 77016 // 'processing-instruction' 'gt'
6596 || lk == 77394 // 'attribute' 'idiv'
6597 || lk == 77433 // 'element' 'idiv'
6598 || lk == 77496 // 'namespace' 'idiv'
6599 || lk == 77528 // 'processing-instruction' 'idiv'
6600 || lk == 82002 // 'attribute' 'instance'
6601 || lk == 82041 // 'element' 'instance'
6602 || lk == 82104 // 'namespace' 'instance'
6603 || lk == 82136 // 'processing-instruction' 'instance'
6604 || lk == 83026 // 'attribute' 'intersect'
6605 || lk == 83065 // 'element' 'intersect'
6606 || lk == 83128 // 'namespace' 'intersect'
6607 || lk == 83160 // 'processing-instruction' 'intersect'
6608 || lk == 83538 // 'attribute' 'into'
6609 || lk == 83577 // 'element' 'into'
6610 || lk == 83640 // 'namespace' 'into'
6611 || lk == 83672 // 'processing-instruction' 'into'
6612 || lk == 84050 // 'attribute' 'is'
6613 || lk == 84089 // 'element' 'is'
6614 || lk == 84152 // 'namespace' 'is'
6615 || lk == 84184 // 'processing-instruction' 'is'
6616 || lk == 88146 // 'attribute' 'le'
6617 || lk == 88185 // 'element' 'le'
6618 || lk == 88248 // 'namespace' 'le'
6619 || lk == 88280 // 'processing-instruction' 'le'
6620 || lk == 89170 // 'attribute' 'let'
6621 || lk == 89209 // 'element' 'let'
6622 || lk == 89272 // 'namespace' 'let'
6623 || lk == 89304 // 'processing-instruction' 'let'
6624 || lk == 91218 // 'attribute' 'lt'
6625 || lk == 91257 // 'element' 'lt'
6626 || lk == 91320 // 'namespace' 'lt'
6627 || lk == 91352 // 'processing-instruction' 'lt'
6628 || lk == 92242 // 'attribute' 'mod'
6629 || lk == 92281 // 'element' 'mod'
6630 || lk == 92344 // 'namespace' 'mod'
6631 || lk == 92376 // 'processing-instruction' 'mod'
6632 || lk == 92754 // 'attribute' 'modify'
6633 || lk == 92793 // 'element' 'modify'
6634 || lk == 92856 // 'namespace' 'modify'
6635 || lk == 92888 // 'processing-instruction' 'modify'
6636 || lk == 95314 // 'attribute' 'ne'
6637 || lk == 95353 // 'element' 'ne'
6638 || lk == 95416 // 'namespace' 'ne'
6639 || lk == 95448 // 'processing-instruction' 'ne'
6640 || lk == 101458 // 'attribute' 'only'
6641 || lk == 101497 // 'element' 'only'
6642 || lk == 101560 // 'namespace' 'only'
6643 || lk == 101592 // 'processing-instruction' 'only'
6644 || lk == 102482 // 'attribute' 'or'
6645 || lk == 102521 // 'element' 'or'
6646 || lk == 102584 // 'namespace' 'or'
6647 || lk == 102616 // 'processing-instruction' 'or'
6648 || lk == 102994 // 'attribute' 'order'
6649 || lk == 103033 // 'element' 'order'
6650 || lk == 103096 // 'namespace' 'order'
6651 || lk == 103128 // 'processing-instruction' 'order'
6652 || lk == 112722 // 'attribute' 'return'
6653 || lk == 112761 // 'element' 'return'
6654 || lk == 112824 // 'namespace' 'return'
6655 || lk == 112856 // 'processing-instruction' 'return'
6656 || lk == 114770 // 'attribute' 'satisfies'
6657 || lk == 114809 // 'element' 'satisfies'
6658 || lk == 114872 // 'namespace' 'satisfies'
6659 || lk == 114904 // 'processing-instruction' 'satisfies'
6660 || lk == 120914 // 'attribute' 'stable'
6661 || lk == 120953 // 'element' 'stable'
6662 || lk == 121016 // 'namespace' 'stable'
6663 || lk == 121048 // 'processing-instruction' 'stable'
6664 || lk == 121426 // 'attribute' 'start'
6665 || lk == 121465 // 'element' 'start'
6666 || lk == 121528 // 'namespace' 'start'
6667 || lk == 121560 // 'processing-instruction' 'start'
6668 || lk == 127058 // 'attribute' 'to'
6669 || lk == 127097 // 'element' 'to'
6670 || lk == 127160 // 'namespace' 'to'
6671 || lk == 127192 // 'processing-instruction' 'to'
6672 || lk == 127570 // 'attribute' 'treat'
6673 || lk == 127609 // 'element' 'treat'
6674 || lk == 127672 // 'namespace' 'treat'
6675 || lk == 127704 // 'processing-instruction' 'treat'
6676 || lk == 130130 // 'attribute' 'union'
6677 || lk == 130169 // 'element' 'union'
6678 || lk == 130232 // 'namespace' 'union'
6679 || lk == 130264 // 'processing-instruction' 'union'
6680 || lk == 136274 // 'attribute' 'where'
6681 || lk == 136313 // 'element' 'where'
6682 || lk == 136376 // 'namespace' 'where'
6683 || lk == 136408 // 'processing-instruction' 'where'
6684 || lk == 138322 // 'attribute' 'with'
6685 || lk == 138361 // 'element' 'with'
6686 || lk == 138424 // 'namespace' 'with'
6687 || lk == 138456) // 'processing-instruction' 'with'
6688 {
6689 lk = memoized(3, e0);
6690 if (lk == 0)
6691 {
6692 var b0A = b0; var e0A = e0; var l1A = l1;
6693 var b1A = b1; var e1A = e1; var l2A = l2;
6694 var b2A = b2; var e2A = e2;
6695 try
6696 {
6697 try_PostfixExpr();
6698 lk = -1;
6699 }
6700 catch (p1A)
6701 {
6702 lk = -2;
6703 }
6704 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
6705 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
6706 b2 = b2A; e2 = e2A; end = e2A; }}
6707 memoize(3, e0, lk);
6708 }
6709 }
6710 switch (lk)
6711 {
6712 case -1:
6713 case 8: // IntegerLiteral
6714 case 9: // DecimalLiteral
6715 case 10: // DoubleLiteral
6716 case 11: // StringLiteral
6717 case 31: // '$'
6718 case 32: // '%'
6719 case 34: // '('
6720 case 44: // '.'
6721 case 54: // '<'
6722 case 55: // '<!--'
6723 case 59: // '<?'
6724 case 68: // '['
6725 case 276: // '{'
6726 case 278: // '{|'
6727 case 3154: // 'attribute' EQName^Token
6728 case 3193: // 'element' EQName^Token
6729 case 9912: // 'namespace' NCName^Token
6730 case 9944: // 'processing-instruction' NCName^Token
6731 case 14854: // EQName^Token '#'
6732 case 14918: // 'after' '#'
6733 case 14920: // 'allowing' '#'
6734 case 14921: // 'ancestor' '#'
6735 case 14922: // 'ancestor-or-self' '#'
6736 case 14923: // 'and' '#'
6737 case 14926: // 'array' '#'
6738 case 14927: // 'as' '#'
6739 case 14928: // 'ascending' '#'
6740 case 14929: // 'at' '#'
6741 case 14930: // 'attribute' '#'
6742 case 14931: // 'base-uri' '#'
6743 case 14932: // 'before' '#'
6744 case 14933: // 'boundary-space' '#'
6745 case 14934: // 'break' '#'
6746 case 14936: // 'case' '#'
6747 case 14937: // 'cast' '#'
6748 case 14938: // 'castable' '#'
6749 case 14939: // 'catch' '#'
6750 case 14941: // 'child' '#'
6751 case 14942: // 'collation' '#'
6752 case 14944: // 'comment' '#'
6753 case 14945: // 'constraint' '#'
6754 case 14946: // 'construction' '#'
6755 case 14949: // 'context' '#'
6756 case 14950: // 'continue' '#'
6757 case 14951: // 'copy' '#'
6758 case 14952: // 'copy-namespaces' '#'
6759 case 14953: // 'count' '#'
6760 case 14954: // 'decimal-format' '#'
6761 case 14956: // 'declare' '#'
6762 case 14957: // 'default' '#'
6763 case 14958: // 'delete' '#'
6764 case 14959: // 'descendant' '#'
6765 case 14960: // 'descendant-or-self' '#'
6766 case 14961: // 'descending' '#'
6767 case 14966: // 'div' '#'
6768 case 14967: // 'document' '#'
6769 case 14968: // 'document-node' '#'
6770 case 14969: // 'element' '#'
6771 case 14970: // 'else' '#'
6772 case 14971: // 'empty' '#'
6773 case 14972: // 'empty-sequence' '#'
6774 case 14973: // 'encoding' '#'
6775 case 14974: // 'end' '#'
6776 case 14976: // 'eq' '#'
6777 case 14977: // 'every' '#'
6778 case 14979: // 'except' '#'
6779 case 14980: // 'exit' '#'
6780 case 14981: // 'external' '#'
6781 case 14982: // 'first' '#'
6782 case 14983: // 'following' '#'
6783 case 14984: // 'following-sibling' '#'
6784 case 14985: // 'for' '#'
6785 case 14989: // 'ft-option' '#'
6786 case 14993: // 'function' '#'
6787 case 14994: // 'ge' '#'
6788 case 14996: // 'group' '#'
6789 case 14998: // 'gt' '#'
6790 case 14999: // 'idiv' '#'
6791 case 15000: // 'if' '#'
6792 case 15001: // 'import' '#'
6793 case 15002: // 'in' '#'
6794 case 15003: // 'index' '#'
6795 case 15007: // 'insert' '#'
6796 case 15008: // 'instance' '#'
6797 case 15009: // 'integrity' '#'
6798 case 15010: // 'intersect' '#'
6799 case 15011: // 'into' '#'
6800 case 15012: // 'is' '#'
6801 case 15013: // 'item' '#'
6802 case 15015: // 'json-item' '#'
6803 case 15018: // 'last' '#'
6804 case 15019: // 'lax' '#'
6805 case 15020: // 'le' '#'
6806 case 15022: // 'let' '#'
6807 case 15024: // 'loop' '#'
6808 case 15026: // 'lt' '#'
6809 case 15028: // 'mod' '#'
6810 case 15029: // 'modify' '#'
6811 case 15030: // 'module' '#'
6812 case 15032: // 'namespace' '#'
6813 case 15033: // 'namespace-node' '#'
6814 case 15034: // 'ne' '#'
6815 case 15039: // 'node' '#'
6816 case 15040: // 'nodes' '#'
6817 case 15042: // 'object' '#'
6818 case 15046: // 'only' '#'
6819 case 15047: // 'option' '#'
6820 case 15048: // 'or' '#'
6821 case 15049: // 'order' '#'
6822 case 15050: // 'ordered' '#'
6823 case 15051: // 'ordering' '#'
6824 case 15054: // 'parent' '#'
6825 case 15060: // 'preceding' '#'
6826 case 15061: // 'preceding-sibling' '#'
6827 case 15064: // 'processing-instruction' '#'
6828 case 15066: // 'rename' '#'
6829 case 15067: // 'replace' '#'
6830 case 15068: // 'return' '#'
6831 case 15069: // 'returning' '#'
6832 case 15070: // 'revalidation' '#'
6833 case 15072: // 'satisfies' '#'
6834 case 15073: // 'schema' '#'
6835 case 15074: // 'schema-attribute' '#'
6836 case 15075: // 'schema-element' '#'
6837 case 15076: // 'score' '#'
6838 case 15077: // 'self' '#'
6839 case 15082: // 'sliding' '#'
6840 case 15083: // 'some' '#'
6841 case 15084: // 'stable' '#'
6842 case 15085: // 'start' '#'
6843 case 15088: // 'strict' '#'
6844 case 15091: // 'switch' '#'
6845 case 15092: // 'text' '#'
6846 case 15096: // 'to' '#'
6847 case 15097: // 'treat' '#'
6848 case 15098: // 'try' '#'
6849 case 15099: // 'tumbling' '#'
6850 case 15100: // 'type' '#'
6851 case 15101: // 'typeswitch' '#'
6852 case 15102: // 'union' '#'
6853 case 15104: // 'unordered' '#'
6854 case 15105: // 'updating' '#'
6855 case 15108: // 'validate' '#'
6856 case 15109: // 'value' '#'
6857 case 15110: // 'variable' '#'
6858 case 15111: // 'version' '#'
6859 case 15114: // 'where' '#'
6860 case 15115: // 'while' '#'
6861 case 15118: // 'with' '#'
6862 case 15122: // 'xquery' '#'
6863 case 17414: // EQName^Token '('
6864 case 17478: // 'after' '('
6865 case 17480: // 'allowing' '('
6866 case 17481: // 'ancestor' '('
6867 case 17482: // 'ancestor-or-self' '('
6868 case 17483: // 'and' '('
6869 case 17487: // 'as' '('
6870 case 17488: // 'ascending' '('
6871 case 17489: // 'at' '('
6872 case 17491: // 'base-uri' '('
6873 case 17492: // 'before' '('
6874 case 17493: // 'boundary-space' '('
6875 case 17494: // 'break' '('
6876 case 17496: // 'case' '('
6877 case 17497: // 'cast' '('
6878 case 17498: // 'castable' '('
6879 case 17499: // 'catch' '('
6880 case 17501: // 'child' '('
6881 case 17502: // 'collation' '('
6882 case 17505: // 'constraint' '('
6883 case 17506: // 'construction' '('
6884 case 17509: // 'context' '('
6885 case 17510: // 'continue' '('
6886 case 17511: // 'copy' '('
6887 case 17512: // 'copy-namespaces' '('
6888 case 17513: // 'count' '('
6889 case 17514: // 'decimal-format' '('
6890 case 17516: // 'declare' '('
6891 case 17517: // 'default' '('
6892 case 17518: // 'delete' '('
6893 case 17519: // 'descendant' '('
6894 case 17520: // 'descendant-or-self' '('
6895 case 17521: // 'descending' '('
6896 case 17526: // 'div' '('
6897 case 17527: // 'document' '('
6898 case 17530: // 'else' '('
6899 case 17531: // 'empty' '('
6900 case 17533: // 'encoding' '('
6901 case 17534: // 'end' '('
6902 case 17536: // 'eq' '('
6903 case 17537: // 'every' '('
6904 case 17539: // 'except' '('
6905 case 17540: // 'exit' '('
6906 case 17541: // 'external' '('
6907 case 17542: // 'first' '('
6908 case 17543: // 'following' '('
6909 case 17544: // 'following-sibling' '('
6910 case 17545: // 'for' '('
6911 case 17549: // 'ft-option' '('
6912 case 17553: // 'function' '('
6913 case 17554: // 'ge' '('
6914 case 17556: // 'group' '('
6915 case 17558: // 'gt' '('
6916 case 17559: // 'idiv' '('
6917 case 17561: // 'import' '('
6918 case 17562: // 'in' '('
6919 case 17563: // 'index' '('
6920 case 17567: // 'insert' '('
6921 case 17568: // 'instance' '('
6922 case 17569: // 'integrity' '('
6923 case 17570: // 'intersect' '('
6924 case 17571: // 'into' '('
6925 case 17572: // 'is' '('
6926 case 17578: // 'last' '('
6927 case 17579: // 'lax' '('
6928 case 17580: // 'le' '('
6929 case 17582: // 'let' '('
6930 case 17584: // 'loop' '('
6931 case 17586: // 'lt' '('
6932 case 17588: // 'mod' '('
6933 case 17589: // 'modify' '('
6934 case 17590: // 'module' '('
6935 case 17592: // 'namespace' '('
6936 case 17594: // 'ne' '('
6937 case 17600: // 'nodes' '('
6938 case 17606: // 'only' '('
6939 case 17607: // 'option' '('
6940 case 17608: // 'or' '('
6941 case 17609: // 'order' '('
6942 case 17610: // 'ordered' '('
6943 case 17611: // 'ordering' '('
6944 case 17614: // 'parent' '('
6945 case 17620: // 'preceding' '('
6946 case 17621: // 'preceding-sibling' '('
6947 case 17626: // 'rename' '('
6948 case 17627: // 'replace' '('
6949 case 17628: // 'return' '('
6950 case 17629: // 'returning' '('
6951 case 17630: // 'revalidation' '('
6952 case 17632: // 'satisfies' '('
6953 case 17633: // 'schema' '('
6954 case 17636: // 'score' '('
6955 case 17637: // 'self' '('
6956 case 17642: // 'sliding' '('
6957 case 17643: // 'some' '('
6958 case 17644: // 'stable' '('
6959 case 17645: // 'start' '('
6960 case 17648: // 'strict' '('
6961 case 17656: // 'to' '('
6962 case 17657: // 'treat' '('
6963 case 17658: // 'try' '('
6964 case 17659: // 'tumbling' '('
6965 case 17660: // 'type' '('
6966 case 17662: // 'union' '('
6967 case 17664: // 'unordered' '('
6968 case 17665: // 'updating' '('
6969 case 17668: // 'validate' '('
6970 case 17669: // 'value' '('
6971 case 17670: // 'variable' '('
6972 case 17671: // 'version' '('
6973 case 17674: // 'where' '('
6974 case 17675: // 'while' '('
6975 case 17678: // 'with' '('
6976 case 17682: // 'xquery' '('
6977 case 36946: // 'attribute' 'allowing'
6978 case 36985: // 'element' 'allowing'
6979 case 37048: // 'namespace' 'allowing'
6980 case 37080: // 'processing-instruction' 'allowing'
6981 case 37458: // 'attribute' 'ancestor'
6982 case 37497: // 'element' 'ancestor'
6983 case 37560: // 'namespace' 'ancestor'
6984 case 37592: // 'processing-instruction' 'ancestor'
6985 case 37970: // 'attribute' 'ancestor-or-self'
6986 case 38009: // 'element' 'ancestor-or-self'
6987 case 38072: // 'namespace' 'ancestor-or-self'
6988 case 38104: // 'processing-instruction' 'ancestor-or-self'
6989 case 40018: // 'attribute' 'array'
6990 case 40057: // 'element' 'array'
6991 case 42066: // 'attribute' 'attribute'
6992 case 42105: // 'element' 'attribute'
6993 case 42168: // 'namespace' 'attribute'
6994 case 42200: // 'processing-instruction' 'attribute'
6995 case 42578: // 'attribute' 'base-uri'
6996 case 42617: // 'element' 'base-uri'
6997 case 42680: // 'namespace' 'base-uri'
6998 case 42712: // 'processing-instruction' 'base-uri'
6999 case 43602: // 'attribute' 'boundary-space'
7000 case 43641: // 'element' 'boundary-space'
7001 case 43704: // 'namespace' 'boundary-space'
7002 case 43736: // 'processing-instruction' 'boundary-space'
7003 case 44114: // 'attribute' 'break'
7004 case 44153: // 'element' 'break'
7005 case 44216: // 'namespace' 'break'
7006 case 44248: // 'processing-instruction' 'break'
7007 case 46674: // 'attribute' 'catch'
7008 case 46713: // 'element' 'catch'
7009 case 46776: // 'namespace' 'catch'
7010 case 46808: // 'processing-instruction' 'catch'
7011 case 47698: // 'attribute' 'child'
7012 case 47737: // 'element' 'child'
7013 case 47800: // 'namespace' 'child'
7014 case 47832: // 'processing-instruction' 'child'
7015 case 49234: // 'attribute' 'comment'
7016 case 49273: // 'element' 'comment'
7017 case 49336: // 'namespace' 'comment'
7018 case 49368: // 'processing-instruction' 'comment'
7019 case 49746: // 'attribute' 'constraint'
7020 case 49785: // 'element' 'constraint'
7021 case 49848: // 'namespace' 'constraint'
7022 case 49880: // 'processing-instruction' 'constraint'
7023 case 50258: // 'attribute' 'construction'
7024 case 50297: // 'element' 'construction'
7025 case 50360: // 'namespace' 'construction'
7026 case 50392: // 'processing-instruction' 'construction'
7027 case 51794: // 'attribute' 'context'
7028 case 51833: // 'element' 'context'
7029 case 51896: // 'namespace' 'context'
7030 case 51928: // 'processing-instruction' 'context'
7031 case 52306: // 'attribute' 'continue'
7032 case 52345: // 'element' 'continue'
7033 case 52408: // 'namespace' 'continue'
7034 case 52440: // 'processing-instruction' 'continue'
7035 case 52818: // 'attribute' 'copy'
7036 case 52857: // 'element' 'copy'
7037 case 52920: // 'namespace' 'copy'
7038 case 52952: // 'processing-instruction' 'copy'
7039 case 53330: // 'attribute' 'copy-namespaces'
7040 case 53369: // 'element' 'copy-namespaces'
7041 case 53432: // 'namespace' 'copy-namespaces'
7042 case 53464: // 'processing-instruction' 'copy-namespaces'
7043 case 54354: // 'attribute' 'decimal-format'
7044 case 54393: // 'element' 'decimal-format'
7045 case 54456: // 'namespace' 'decimal-format'
7046 case 54488: // 'processing-instruction' 'decimal-format'
7047 case 55378: // 'attribute' 'declare'
7048 case 55417: // 'element' 'declare'
7049 case 55480: // 'namespace' 'declare'
7050 case 55512: // 'processing-instruction' 'declare'
7051 case 56402: // 'attribute' 'delete'
7052 case 56441: // 'element' 'delete'
7053 case 56504: // 'namespace' 'delete'
7054 case 56536: // 'processing-instruction' 'delete'
7055 case 56914: // 'attribute' 'descendant'
7056 case 56953: // 'element' 'descendant'
7057 case 57016: // 'namespace' 'descendant'
7058 case 57048: // 'processing-instruction' 'descendant'
7059 case 57426: // 'attribute' 'descendant-or-self'
7060 case 57465: // 'element' 'descendant-or-self'
7061 case 57528: // 'namespace' 'descendant-or-self'
7062 case 57560: // 'processing-instruction' 'descendant-or-self'
7063 case 61010: // 'attribute' 'document'
7064 case 61049: // 'element' 'document'
7065 case 61112: // 'namespace' 'document'
7066 case 61144: // 'processing-instruction' 'document'
7067 case 61522: // 'attribute' 'document-node'
7068 case 61561: // 'element' 'document-node'
7069 case 61624: // 'namespace' 'document-node'
7070 case 61656: // 'processing-instruction' 'document-node'
7071 case 62034: // 'attribute' 'element'
7072 case 62073: // 'element' 'element'
7073 case 62136: // 'namespace' 'element'
7074 case 62168: // 'processing-instruction' 'element'
7075 case 63570: // 'attribute' 'empty-sequence'
7076 case 63609: // 'element' 'empty-sequence'
7077 case 63672: // 'namespace' 'empty-sequence'
7078 case 63704: // 'processing-instruction' 'empty-sequence'
7079 case 64082: // 'attribute' 'encoding'
7080 case 64121: // 'element' 'encoding'
7081 case 64184: // 'namespace' 'encoding'
7082 case 64216: // 'processing-instruction' 'encoding'
7083 case 66130: // 'attribute' 'every'
7084 case 66169: // 'element' 'every'
7085 case 66232: // 'namespace' 'every'
7086 case 66264: // 'processing-instruction' 'every'
7087 case 67666: // 'attribute' 'exit'
7088 case 67705: // 'element' 'exit'
7089 case 67768: // 'namespace' 'exit'
7090 case 67800: // 'processing-instruction' 'exit'
7091 case 68178: // 'attribute' 'external'
7092 case 68217: // 'element' 'external'
7093 case 68280: // 'namespace' 'external'
7094 case 68312: // 'processing-instruction' 'external'
7095 case 68690: // 'attribute' 'first'
7096 case 68729: // 'element' 'first'
7097 case 68792: // 'namespace' 'first'
7098 case 68824: // 'processing-instruction' 'first'
7099 case 69202: // 'attribute' 'following'
7100 case 69241: // 'element' 'following'
7101 case 69304: // 'namespace' 'following'
7102 case 69336: // 'processing-instruction' 'following'
7103 case 69714: // 'attribute' 'following-sibling'
7104 case 69753: // 'element' 'following-sibling'
7105 case 69816: // 'namespace' 'following-sibling'
7106 case 69848: // 'processing-instruction' 'following-sibling'
7107 case 72274: // 'attribute' 'ft-option'
7108 case 72313: // 'element' 'ft-option'
7109 case 72376: // 'namespace' 'ft-option'
7110 case 72408: // 'processing-instruction' 'ft-option'
7111 case 74322: // 'attribute' 'function'
7112 case 74361: // 'element' 'function'
7113 case 74424: // 'namespace' 'function'
7114 case 74456: // 'processing-instruction' 'function'
7115 case 77906: // 'attribute' 'if'
7116 case 77945: // 'element' 'if'
7117 case 78008: // 'namespace' 'if'
7118 case 78040: // 'processing-instruction' 'if'
7119 case 78418: // 'attribute' 'import'
7120 case 78457: // 'element' 'import'
7121 case 78520: // 'namespace' 'import'
7122 case 78552: // 'processing-instruction' 'import'
7123 case 78930: // 'attribute' 'in'
7124 case 78969: // 'element' 'in'
7125 case 79032: // 'namespace' 'in'
7126 case 79064: // 'processing-instruction' 'in'
7127 case 79442: // 'attribute' 'index'
7128 case 79481: // 'element' 'index'
7129 case 79544: // 'namespace' 'index'
7130 case 79576: // 'processing-instruction' 'index'
7131 case 81490: // 'attribute' 'insert'
7132 case 81529: // 'element' 'insert'
7133 case 81592: // 'namespace' 'insert'
7134 case 81624: // 'processing-instruction' 'insert'
7135 case 82514: // 'attribute' 'integrity'
7136 case 82553: // 'element' 'integrity'
7137 case 82616: // 'namespace' 'integrity'
7138 case 82648: // 'processing-instruction' 'integrity'
7139 case 84562: // 'attribute' 'item'
7140 case 84601: // 'element' 'item'
7141 case 84664: // 'namespace' 'item'
7142 case 84696: // 'processing-instruction' 'item'
7143 case 85586: // 'attribute' 'json-item'
7144 case 85625: // 'element' 'json-item'
7145 case 87122: // 'attribute' 'last'
7146 case 87161: // 'element' 'last'
7147 case 87224: // 'namespace' 'last'
7148 case 87256: // 'processing-instruction' 'last'
7149 case 87634: // 'attribute' 'lax'
7150 case 87673: // 'element' 'lax'
7151 case 87736: // 'namespace' 'lax'
7152 case 87768: // 'processing-instruction' 'lax'
7153 case 90194: // 'attribute' 'loop'
7154 case 90233: // 'element' 'loop'
7155 case 90296: // 'namespace' 'loop'
7156 case 90328: // 'processing-instruction' 'loop'
7157 case 93266: // 'attribute' 'module'
7158 case 93305: // 'element' 'module'
7159 case 93368: // 'namespace' 'module'
7160 case 93400: // 'processing-instruction' 'module'
7161 case 94290: // 'attribute' 'namespace'
7162 case 94329: // 'element' 'namespace'
7163 case 94392: // 'namespace' 'namespace'
7164 case 94424: // 'processing-instruction' 'namespace'
7165 case 94802: // 'attribute' 'namespace-node'
7166 case 94841: // 'element' 'namespace-node'
7167 case 94904: // 'namespace' 'namespace-node'
7168 case 94936: // 'processing-instruction' 'namespace-node'
7169 case 97874: // 'attribute' 'node'
7170 case 97913: // 'element' 'node'
7171 case 97976: // 'namespace' 'node'
7172 case 98008: // 'processing-instruction' 'node'
7173 case 98386: // 'attribute' 'nodes'
7174 case 98425: // 'element' 'nodes'
7175 case 98488: // 'namespace' 'nodes'
7176 case 98520: // 'processing-instruction' 'nodes'
7177 case 99410: // 'attribute' 'object'
7178 case 99449: // 'element' 'object'
7179 case 101970: // 'attribute' 'option'
7180 case 102009: // 'element' 'option'
7181 case 102072: // 'namespace' 'option'
7182 case 102104: // 'processing-instruction' 'option'
7183 case 103506: // 'attribute' 'ordered'
7184 case 103545: // 'element' 'ordered'
7185 case 103608: // 'namespace' 'ordered'
7186 case 103640: // 'processing-instruction' 'ordered'
7187 case 104018: // 'attribute' 'ordering'
7188 case 104057: // 'element' 'ordering'
7189 case 104120: // 'namespace' 'ordering'
7190 case 104152: // 'processing-instruction' 'ordering'
7191 case 105554: // 'attribute' 'parent'
7192 case 105593: // 'element' 'parent'
7193 case 105656: // 'namespace' 'parent'
7194 case 105688: // 'processing-instruction' 'parent'
7195 case 108626: // 'attribute' 'preceding'
7196 case 108665: // 'element' 'preceding'
7197 case 108728: // 'namespace' 'preceding'
7198 case 108760: // 'processing-instruction' 'preceding'
7199 case 109138: // 'attribute' 'preceding-sibling'
7200 case 109177: // 'element' 'preceding-sibling'
7201 case 109240: // 'namespace' 'preceding-sibling'
7202 case 109272: // 'processing-instruction' 'preceding-sibling'
7203 case 110674: // 'attribute' 'processing-instruction'
7204 case 110713: // 'element' 'processing-instruction'
7205 case 110776: // 'namespace' 'processing-instruction'
7206 case 110808: // 'processing-instruction' 'processing-instruction'
7207 case 111698: // 'attribute' 'rename'
7208 case 111737: // 'element' 'rename'
7209 case 111800: // 'namespace' 'rename'
7210 case 111832: // 'processing-instruction' 'rename'
7211 case 112210: // 'attribute' 'replace'
7212 case 112249: // 'element' 'replace'
7213 case 112312: // 'namespace' 'replace'
7214 case 112344: // 'processing-instruction' 'replace'
7215 case 113234: // 'attribute' 'returning'
7216 case 113273: // 'element' 'returning'
7217 case 113336: // 'namespace' 'returning'
7218 case 113368: // 'processing-instruction' 'returning'
7219 case 113746: // 'attribute' 'revalidation'
7220 case 113785: // 'element' 'revalidation'
7221 case 113848: // 'namespace' 'revalidation'
7222 case 113880: // 'processing-instruction' 'revalidation'
7223 case 115282: // 'attribute' 'schema'
7224 case 115321: // 'element' 'schema'
7225 case 115384: // 'namespace' 'schema'
7226 case 115416: // 'processing-instruction' 'schema'
7227 case 115794: // 'attribute' 'schema-attribute'
7228 case 115833: // 'element' 'schema-attribute'
7229 case 115896: // 'namespace' 'schema-attribute'
7230 case 115928: // 'processing-instruction' 'schema-attribute'
7231 case 116306: // 'attribute' 'schema-element'
7232 case 116345: // 'element' 'schema-element'
7233 case 116408: // 'namespace' 'schema-element'
7234 case 116440: // 'processing-instruction' 'schema-element'
7235 case 116818: // 'attribute' 'score'
7236 case 116857: // 'element' 'score'
7237 case 116920: // 'namespace' 'score'
7238 case 116952: // 'processing-instruction' 'score'
7239 case 117330: // 'attribute' 'self'
7240 case 117369: // 'element' 'self'
7241 case 117432: // 'namespace' 'self'
7242 case 117464: // 'processing-instruction' 'self'
7243 case 119890: // 'attribute' 'sliding'
7244 case 119929: // 'element' 'sliding'
7245 case 119992: // 'namespace' 'sliding'
7246 case 120024: // 'processing-instruction' 'sliding'
7247 case 120402: // 'attribute' 'some'
7248 case 120441: // 'element' 'some'
7249 case 120504: // 'namespace' 'some'
7250 case 120536: // 'processing-instruction' 'some'
7251 case 122962: // 'attribute' 'strict'
7252 case 123001: // 'element' 'strict'
7253 case 123064: // 'namespace' 'strict'
7254 case 123096: // 'processing-instruction' 'strict'
7255 case 124498: // 'attribute' 'switch'
7256 case 124537: // 'element' 'switch'
7257 case 124600: // 'namespace' 'switch'
7258 case 124632: // 'processing-instruction' 'switch'
7259 case 125010: // 'attribute' 'text'
7260 case 125049: // 'element' 'text'
7261 case 125112: // 'namespace' 'text'
7262 case 125144: // 'processing-instruction' 'text'
7263 case 128082: // 'attribute' 'try'
7264 case 128121: // 'element' 'try'
7265 case 128184: // 'namespace' 'try'
7266 case 128216: // 'processing-instruction' 'try'
7267 case 128594: // 'attribute' 'tumbling'
7268 case 128633: // 'element' 'tumbling'
7269 case 128696: // 'namespace' 'tumbling'
7270 case 128728: // 'processing-instruction' 'tumbling'
7271 case 129106: // 'attribute' 'type'
7272 case 129145: // 'element' 'type'
7273 case 129208: // 'namespace' 'type'
7274 case 129240: // 'processing-instruction' 'type'
7275 case 129618: // 'attribute' 'typeswitch'
7276 case 129657: // 'element' 'typeswitch'
7277 case 129720: // 'namespace' 'typeswitch'
7278 case 129752: // 'processing-instruction' 'typeswitch'
7279 case 131154: // 'attribute' 'unordered'
7280 case 131193: // 'element' 'unordered'
7281 case 131256: // 'namespace' 'unordered'
7282 case 131288: // 'processing-instruction' 'unordered'
7283 case 131666: // 'attribute' 'updating'
7284 case 131705: // 'element' 'updating'
7285 case 131768: // 'namespace' 'updating'
7286 case 131800: // 'processing-instruction' 'updating'
7287 case 133202: // 'attribute' 'validate'
7288 case 133241: // 'element' 'validate'
7289 case 133304: // 'namespace' 'validate'
7290 case 133336: // 'processing-instruction' 'validate'
7291 case 133714: // 'attribute' 'value'
7292 case 133753: // 'element' 'value'
7293 case 133816: // 'namespace' 'value'
7294 case 133848: // 'processing-instruction' 'value'
7295 case 134226: // 'attribute' 'variable'
7296 case 134265: // 'element' 'variable'
7297 case 134328: // 'namespace' 'variable'
7298 case 134360: // 'processing-instruction' 'variable'
7299 case 134738: // 'attribute' 'version'
7300 case 134777: // 'element' 'version'
7301 case 134840: // 'namespace' 'version'
7302 case 134872: // 'processing-instruction' 'version'
7303 case 136786: // 'attribute' 'while'
7304 case 136825: // 'element' 'while'
7305 case 136888: // 'namespace' 'while'
7306 case 136920: // 'processing-instruction' 'while'
7307 case 140370: // 'attribute' 'xquery'
7308 case 140409: // 'element' 'xquery'
7309 case 140472: // 'namespace' 'xquery'
7310 case 140504: // 'processing-instruction' 'xquery'
7311 case 141394: // 'attribute' '{'
7312 case 141408: // 'comment' '{'
7313 case 141431: // 'document' '{'
7314 case 141433: // 'element' '{'
7315 case 141496: // 'namespace' '{'
7316 case 141514: // 'ordered' '{'
7317 case 141528: // 'processing-instruction' '{'
7318 case 141556: // 'text' '{'
7319 case 141568: // 'unordered' '{'
7320 parse_PostfixExpr();
7321 break;
7322 default:
7323 parse_AxisStep();
7324 }
7325 eventHandler.endNonterminal("StepExpr", e0);
7326 }
7327
7328 function try_StepExpr()
7329 {
7330 switch (l1)
7331 {
7332 case 82: // 'attribute'
7333 lookahead2W(282); // EQName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' |
7334 break;
7335 case 121: // 'element'
7336 lookahead2W(280); // EQName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' |
7337 break;
7338 case 184: // 'namespace'
7339 case 216: // 'processing-instruction'
7340 lookahead2W(279); // NCName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' |
7341 break;
7342 case 96: // 'comment'
7343 case 119: // 'document'
7344 case 202: // 'ordered'
7345 case 244: // 'text'
7346 case 256: // 'unordered'
7347 lookahead2W(245); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
7348 break;
7349 case 124: // 'empty-sequence'
7350 case 152: // 'if'
7351 case 165: // 'item'
7352 case 243: // 'switch'
7353 case 253: // 'typeswitch'
7354 lookahead2W(238); // S^WS | EOF | '!' | '!=' | '#' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' |
7355 break;
7356 case 73: // 'ancestor'
7357 case 74: // 'ancestor-or-self'
7358 case 93: // 'child'
7359 case 111: // 'descendant'
7360 case 112: // 'descendant-or-self'
7361 case 135: // 'following'
7362 case 136: // 'following-sibling'
7363 case 206: // 'parent'
7364 case 212: // 'preceding'
7365 case 213: // 'preceding-sibling'
7366 case 229: // 'self'
7367 lookahead2W(244); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
7368 break;
7369 case 6: // EQName^Token
7370 case 70: // 'after'
7371 case 72: // 'allowing'
7372 case 75: // 'and'
7373 case 78: // 'array'
7374 case 79: // 'as'
7375 case 80: // 'ascending'
7376 case 81: // 'at'
7377 case 83: // 'base-uri'
7378 case 84: // 'before'
7379 case 85: // 'boundary-space'
7380 case 86: // 'break'
7381 case 88: // 'case'
7382 case 89: // 'cast'
7383 case 90: // 'castable'
7384 case 91: // 'catch'
7385 case 94: // 'collation'
7386 case 97: // 'constraint'
7387 case 98: // 'construction'
7388 case 101: // 'context'
7389 case 102: // 'continue'
7390 case 103: // 'copy'
7391 case 104: // 'copy-namespaces'
7392 case 105: // 'count'
7393 case 106: // 'decimal-format'
7394 case 108: // 'declare'
7395 case 109: // 'default'
7396 case 110: // 'delete'
7397 case 113: // 'descending'
7398 case 118: // 'div'
7399 case 120: // 'document-node'
7400 case 122: // 'else'
7401 case 123: // 'empty'
7402 case 125: // 'encoding'
7403 case 126: // 'end'
7404 case 128: // 'eq'
7405 case 129: // 'every'
7406 case 131: // 'except'
7407 case 132: // 'exit'
7408 case 133: // 'external'
7409 case 134: // 'first'
7410 case 137: // 'for'
7411 case 141: // 'ft-option'
7412 case 145: // 'function'
7413 case 146: // 'ge'
7414 case 148: // 'group'
7415 case 150: // 'gt'
7416 case 151: // 'idiv'
7417 case 153: // 'import'
7418 case 154: // 'in'
7419 case 155: // 'index'
7420 case 159: // 'insert'
7421 case 160: // 'instance'
7422 case 161: // 'integrity'
7423 case 162: // 'intersect'
7424 case 163: // 'into'
7425 case 164: // 'is'
7426 case 167: // 'json-item'
7427 case 170: // 'last'
7428 case 171: // 'lax'
7429 case 172: // 'le'
7430 case 174: // 'let'
7431 case 176: // 'loop'
7432 case 178: // 'lt'
7433 case 180: // 'mod'
7434 case 181: // 'modify'
7435 case 182: // 'module'
7436 case 185: // 'namespace-node'
7437 case 186: // 'ne'
7438 case 191: // 'node'
7439 case 192: // 'nodes'
7440 case 194: // 'object'
7441 case 198: // 'only'
7442 case 199: // 'option'
7443 case 200: // 'or'
7444 case 201: // 'order'
7445 case 203: // 'ordering'
7446 case 218: // 'rename'
7447 case 219: // 'replace'
7448 case 220: // 'return'
7449 case 221: // 'returning'
7450 case 222: // 'revalidation'
7451 case 224: // 'satisfies'
7452 case 225: // 'schema'
7453 case 226: // 'schema-attribute'
7454 case 227: // 'schema-element'
7455 case 228: // 'score'
7456 case 234: // 'sliding'
7457 case 235: // 'some'
7458 case 236: // 'stable'
7459 case 237: // 'start'
7460 case 240: // 'strict'
7461 case 248: // 'to'
7462 case 249: // 'treat'
7463 case 250: // 'try'
7464 case 251: // 'tumbling'
7465 case 252: // 'type'
7466 case 254: // 'union'
7467 case 257: // 'updating'
7468 case 260: // 'validate'
7469 case 261: // 'value'
7470 case 262: // 'variable'
7471 case 263: // 'version'
7472 case 266: // 'where'
7473 case 267: // 'while'
7474 case 270: // 'with'
7475 case 274: // 'xquery'
7476 lookahead2W(242); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
7477 break;
7478 default:
7479 lk = l1;
7480 }
7481 if (lk == 17486 // 'array' '('
7482 || lk == 17575 // 'json-item' '('
7483 || lk == 17602 // 'object' '('
7484 || lk == 35922 // 'attribute' 'after'
7485 || lk == 35961 // 'element' 'after'
7486 || lk == 36024 // 'namespace' 'after'
7487 || lk == 36056 // 'processing-instruction' 'after'
7488 || lk == 38482 // 'attribute' 'and'
7489 || lk == 38521 // 'element' 'and'
7490 || lk == 38584 // 'namespace' 'and'
7491 || lk == 38616 // 'processing-instruction' 'and'
7492 || lk == 40530 // 'attribute' 'as'
7493 || lk == 40569 // 'element' 'as'
7494 || lk == 40632 // 'namespace' 'as'
7495 || lk == 40664 // 'processing-instruction' 'as'
7496 || lk == 41042 // 'attribute' 'ascending'
7497 || lk == 41081 // 'element' 'ascending'
7498 || lk == 41144 // 'namespace' 'ascending'
7499 || lk == 41176 // 'processing-instruction' 'ascending'
7500 || lk == 41554 // 'attribute' 'at'
7501 || lk == 41593 // 'element' 'at'
7502 || lk == 41656 // 'namespace' 'at'
7503 || lk == 41688 // 'processing-instruction' 'at'
7504 || lk == 43090 // 'attribute' 'before'
7505 || lk == 43129 // 'element' 'before'
7506 || lk == 43192 // 'namespace' 'before'
7507 || lk == 43224 // 'processing-instruction' 'before'
7508 || lk == 45138 // 'attribute' 'case'
7509 || lk == 45177 // 'element' 'case'
7510 || lk == 45240 // 'namespace' 'case'
7511 || lk == 45272 // 'processing-instruction' 'case'
7512 || lk == 45650 // 'attribute' 'cast'
7513 || lk == 45689 // 'element' 'cast'
7514 || lk == 45752 // 'namespace' 'cast'
7515 || lk == 45784 // 'processing-instruction' 'cast'
7516 || lk == 46162 // 'attribute' 'castable'
7517 || lk == 46201 // 'element' 'castable'
7518 || lk == 46264 // 'namespace' 'castable'
7519 || lk == 46296 // 'processing-instruction' 'castable'
7520 || lk == 48210 // 'attribute' 'collation'
7521 || lk == 48249 // 'element' 'collation'
7522 || lk == 48312 // 'namespace' 'collation'
7523 || lk == 48344 // 'processing-instruction' 'collation'
7524 || lk == 53842 // 'attribute' 'count'
7525 || lk == 53881 // 'element' 'count'
7526 || lk == 53944 // 'namespace' 'count'
7527 || lk == 53976 // 'processing-instruction' 'count'
7528 || lk == 55890 // 'attribute' 'default'
7529 || lk == 55929 // 'element' 'default'
7530 || lk == 55992 // 'namespace' 'default'
7531 || lk == 56024 // 'processing-instruction' 'default'
7532 || lk == 57938 // 'attribute' 'descending'
7533 || lk == 57977 // 'element' 'descending'
7534 || lk == 58040 // 'namespace' 'descending'
7535 || lk == 58072 // 'processing-instruction' 'descending'
7536 || lk == 60498 // 'attribute' 'div'
7537 || lk == 60537 // 'element' 'div'
7538 || lk == 60600 // 'namespace' 'div'
7539 || lk == 60632 // 'processing-instruction' 'div'
7540 || lk == 62546 // 'attribute' 'else'
7541 || lk == 62585 // 'element' 'else'
7542 || lk == 62648 // 'namespace' 'else'
7543 || lk == 62680 // 'processing-instruction' 'else'
7544 || lk == 63058 // 'attribute' 'empty'
7545 || lk == 63097 // 'element' 'empty'
7546 || lk == 63160 // 'namespace' 'empty'
7547 || lk == 63192 // 'processing-instruction' 'empty'
7548 || lk == 64594 // 'attribute' 'end'
7549 || lk == 64633 // 'element' 'end'
7550 || lk == 64696 // 'namespace' 'end'
7551 || lk == 64728 // 'processing-instruction' 'end'
7552 || lk == 65618 // 'attribute' 'eq'
7553 || lk == 65657 // 'element' 'eq'
7554 || lk == 65720 // 'namespace' 'eq'
7555 || lk == 65752 // 'processing-instruction' 'eq'
7556 || lk == 67154 // 'attribute' 'except'
7557 || lk == 67193 // 'element' 'except'
7558 || lk == 67256 // 'namespace' 'except'
7559 || lk == 67288 // 'processing-instruction' 'except'
7560 || lk == 70226 // 'attribute' 'for'
7561 || lk == 70265 // 'element' 'for'
7562 || lk == 70328 // 'namespace' 'for'
7563 || lk == 70360 // 'processing-instruction' 'for'
7564 || lk == 74834 // 'attribute' 'ge'
7565 || lk == 74873 // 'element' 'ge'
7566 || lk == 74936 // 'namespace' 'ge'
7567 || lk == 74968 // 'processing-instruction' 'ge'
7568 || lk == 75858 // 'attribute' 'group'
7569 || lk == 75897 // 'element' 'group'
7570 || lk == 75960 // 'namespace' 'group'
7571 || lk == 75992 // 'processing-instruction' 'group'
7572 || lk == 76882 // 'attribute' 'gt'
7573 || lk == 76921 // 'element' 'gt'
7574 || lk == 76984 // 'namespace' 'gt'
7575 || lk == 77016 // 'processing-instruction' 'gt'
7576 || lk == 77394 // 'attribute' 'idiv'
7577 || lk == 77433 // 'element' 'idiv'
7578 || lk == 77496 // 'namespace' 'idiv'
7579 || lk == 77528 // 'processing-instruction' 'idiv'
7580 || lk == 82002 // 'attribute' 'instance'
7581 || lk == 82041 // 'element' 'instance'
7582 || lk == 82104 // 'namespace' 'instance'
7583 || lk == 82136 // 'processing-instruction' 'instance'
7584 || lk == 83026 // 'attribute' 'intersect'
7585 || lk == 83065 // 'element' 'intersect'
7586 || lk == 83128 // 'namespace' 'intersect'
7587 || lk == 83160 // 'processing-instruction' 'intersect'
7588 || lk == 83538 // 'attribute' 'into'
7589 || lk == 83577 // 'element' 'into'
7590 || lk == 83640 // 'namespace' 'into'
7591 || lk == 83672 // 'processing-instruction' 'into'
7592 || lk == 84050 // 'attribute' 'is'
7593 || lk == 84089 // 'element' 'is'
7594 || lk == 84152 // 'namespace' 'is'
7595 || lk == 84184 // 'processing-instruction' 'is'
7596 || lk == 88146 // 'attribute' 'le'
7597 || lk == 88185 // 'element' 'le'
7598 || lk == 88248 // 'namespace' 'le'
7599 || lk == 88280 // 'processing-instruction' 'le'
7600 || lk == 89170 // 'attribute' 'let'
7601 || lk == 89209 // 'element' 'let'
7602 || lk == 89272 // 'namespace' 'let'
7603 || lk == 89304 // 'processing-instruction' 'let'
7604 || lk == 91218 // 'attribute' 'lt'
7605 || lk == 91257 // 'element' 'lt'
7606 || lk == 91320 // 'namespace' 'lt'
7607 || lk == 91352 // 'processing-instruction' 'lt'
7608 || lk == 92242 // 'attribute' 'mod'
7609 || lk == 92281 // 'element' 'mod'
7610 || lk == 92344 // 'namespace' 'mod'
7611 || lk == 92376 // 'processing-instruction' 'mod'
7612 || lk == 92754 // 'attribute' 'modify'
7613 || lk == 92793 // 'element' 'modify'
7614 || lk == 92856 // 'namespace' 'modify'
7615 || lk == 92888 // 'processing-instruction' 'modify'
7616 || lk == 95314 // 'attribute' 'ne'
7617 || lk == 95353 // 'element' 'ne'
7618 || lk == 95416 // 'namespace' 'ne'
7619 || lk == 95448 // 'processing-instruction' 'ne'
7620 || lk == 101458 // 'attribute' 'only'
7621 || lk == 101497 // 'element' 'only'
7622 || lk == 101560 // 'namespace' 'only'
7623 || lk == 101592 // 'processing-instruction' 'only'
7624 || lk == 102482 // 'attribute' 'or'
7625 || lk == 102521 // 'element' 'or'
7626 || lk == 102584 // 'namespace' 'or'
7627 || lk == 102616 // 'processing-instruction' 'or'
7628 || lk == 102994 // 'attribute' 'order'
7629 || lk == 103033 // 'element' 'order'
7630 || lk == 103096 // 'namespace' 'order'
7631 || lk == 103128 // 'processing-instruction' 'order'
7632 || lk == 112722 // 'attribute' 'return'
7633 || lk == 112761 // 'element' 'return'
7634 || lk == 112824 // 'namespace' 'return'
7635 || lk == 112856 // 'processing-instruction' 'return'
7636 || lk == 114770 // 'attribute' 'satisfies'
7637 || lk == 114809 // 'element' 'satisfies'
7638 || lk == 114872 // 'namespace' 'satisfies'
7639 || lk == 114904 // 'processing-instruction' 'satisfies'
7640 || lk == 120914 // 'attribute' 'stable'
7641 || lk == 120953 // 'element' 'stable'
7642 || lk == 121016 // 'namespace' 'stable'
7643 || lk == 121048 // 'processing-instruction' 'stable'
7644 || lk == 121426 // 'attribute' 'start'
7645 || lk == 121465 // 'element' 'start'
7646 || lk == 121528 // 'namespace' 'start'
7647 || lk == 121560 // 'processing-instruction' 'start'
7648 || lk == 127058 // 'attribute' 'to'
7649 || lk == 127097 // 'element' 'to'
7650 || lk == 127160 // 'namespace' 'to'
7651 || lk == 127192 // 'processing-instruction' 'to'
7652 || lk == 127570 // 'attribute' 'treat'
7653 || lk == 127609 // 'element' 'treat'
7654 || lk == 127672 // 'namespace' 'treat'
7655 || lk == 127704 // 'processing-instruction' 'treat'
7656 || lk == 130130 // 'attribute' 'union'
7657 || lk == 130169 // 'element' 'union'
7658 || lk == 130232 // 'namespace' 'union'
7659 || lk == 130264 // 'processing-instruction' 'union'
7660 || lk == 136274 // 'attribute' 'where'
7661 || lk == 136313 // 'element' 'where'
7662 || lk == 136376 // 'namespace' 'where'
7663 || lk == 136408 // 'processing-instruction' 'where'
7664 || lk == 138322 // 'attribute' 'with'
7665 || lk == 138361 // 'element' 'with'
7666 || lk == 138424 // 'namespace' 'with'
7667 || lk == 138456) // 'processing-instruction' 'with'
7668 {
7669 lk = memoized(3, e0);
7670 if (lk == 0)
7671 {
7672 var b0A = b0; var e0A = e0; var l1A = l1;
7673 var b1A = b1; var e1A = e1; var l2A = l2;
7674 var b2A = b2; var e2A = e2;
7675 try
7676 {
7677 try_PostfixExpr();
7678 memoize(3, e0A, -1);
7679 lk = -3;
7680 }
7681 catch (p1A)
7682 {
7683 lk = -2;
7684 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
7685 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
7686 b2 = b2A; e2 = e2A; end = e2A; }}
7687 memoize(3, e0A, -2);
7688 }
7689 }
7690 }
7691 switch (lk)
7692 {
7693 case -1:
7694 case 8: // IntegerLiteral
7695 case 9: // DecimalLiteral
7696 case 10: // DoubleLiteral
7697 case 11: // StringLiteral
7698 case 31: // '$'
7699 case 32: // '%'
7700 case 34: // '('
7701 case 44: // '.'
7702 case 54: // '<'
7703 case 55: // '<!--'
7704 case 59: // '<?'
7705 case 68: // '['
7706 case 276: // '{'
7707 case 278: // '{|'
7708 case 3154: // 'attribute' EQName^Token
7709 case 3193: // 'element' EQName^Token
7710 case 9912: // 'namespace' NCName^Token
7711 case 9944: // 'processing-instruction' NCName^Token
7712 case 14854: // EQName^Token '#'
7713 case 14918: // 'after' '#'
7714 case 14920: // 'allowing' '#'
7715 case 14921: // 'ancestor' '#'
7716 case 14922: // 'ancestor-or-self' '#'
7717 case 14923: // 'and' '#'
7718 case 14926: // 'array' '#'
7719 case 14927: // 'as' '#'
7720 case 14928: // 'ascending' '#'
7721 case 14929: // 'at' '#'
7722 case 14930: // 'attribute' '#'
7723 case 14931: // 'base-uri' '#'
7724 case 14932: // 'before' '#'
7725 case 14933: // 'boundary-space' '#'
7726 case 14934: // 'break' '#'
7727 case 14936: // 'case' '#'
7728 case 14937: // 'cast' '#'
7729 case 14938: // 'castable' '#'
7730 case 14939: // 'catch' '#'
7731 case 14941: // 'child' '#'
7732 case 14942: // 'collation' '#'
7733 case 14944: // 'comment' '#'
7734 case 14945: // 'constraint' '#'
7735 case 14946: // 'construction' '#'
7736 case 14949: // 'context' '#'
7737 case 14950: // 'continue' '#'
7738 case 14951: // 'copy' '#'
7739 case 14952: // 'copy-namespaces' '#'
7740 case 14953: // 'count' '#'
7741 case 14954: // 'decimal-format' '#'
7742 case 14956: // 'declare' '#'
7743 case 14957: // 'default' '#'
7744 case 14958: // 'delete' '#'
7745 case 14959: // 'descendant' '#'
7746 case 14960: // 'descendant-or-self' '#'
7747 case 14961: // 'descending' '#'
7748 case 14966: // 'div' '#'
7749 case 14967: // 'document' '#'
7750 case 14968: // 'document-node' '#'
7751 case 14969: // 'element' '#'
7752 case 14970: // 'else' '#'
7753 case 14971: // 'empty' '#'
7754 case 14972: // 'empty-sequence' '#'
7755 case 14973: // 'encoding' '#'
7756 case 14974: // 'end' '#'
7757 case 14976: // 'eq' '#'
7758 case 14977: // 'every' '#'
7759 case 14979: // 'except' '#'
7760 case 14980: // 'exit' '#'
7761 case 14981: // 'external' '#'
7762 case 14982: // 'first' '#'
7763 case 14983: // 'following' '#'
7764 case 14984: // 'following-sibling' '#'
7765 case 14985: // 'for' '#'
7766 case 14989: // 'ft-option' '#'
7767 case 14993: // 'function' '#'
7768 case 14994: // 'ge' '#'
7769 case 14996: // 'group' '#'
7770 case 14998: // 'gt' '#'
7771 case 14999: // 'idiv' '#'
7772 case 15000: // 'if' '#'
7773 case 15001: // 'import' '#'
7774 case 15002: // 'in' '#'
7775 case 15003: // 'index' '#'
7776 case 15007: // 'insert' '#'
7777 case 15008: // 'instance' '#'
7778 case 15009: // 'integrity' '#'
7779 case 15010: // 'intersect' '#'
7780 case 15011: // 'into' '#'
7781 case 15012: // 'is' '#'
7782 case 15013: // 'item' '#'
7783 case 15015: // 'json-item' '#'
7784 case 15018: // 'last' '#'
7785 case 15019: // 'lax' '#'
7786 case 15020: // 'le' '#'
7787 case 15022: // 'let' '#'
7788 case 15024: // 'loop' '#'
7789 case 15026: // 'lt' '#'
7790 case 15028: // 'mod' '#'
7791 case 15029: // 'modify' '#'
7792 case 15030: // 'module' '#'
7793 case 15032: // 'namespace' '#'
7794 case 15033: // 'namespace-node' '#'
7795 case 15034: // 'ne' '#'
7796 case 15039: // 'node' '#'
7797 case 15040: // 'nodes' '#'
7798 case 15042: // 'object' '#'
7799 case 15046: // 'only' '#'
7800 case 15047: // 'option' '#'
7801 case 15048: // 'or' '#'
7802 case 15049: // 'order' '#'
7803 case 15050: // 'ordered' '#'
7804 case 15051: // 'ordering' '#'
7805 case 15054: // 'parent' '#'
7806 case 15060: // 'preceding' '#'
7807 case 15061: // 'preceding-sibling' '#'
7808 case 15064: // 'processing-instruction' '#'
7809 case 15066: // 'rename' '#'
7810 case 15067: // 'replace' '#'
7811 case 15068: // 'return' '#'
7812 case 15069: // 'returning' '#'
7813 case 15070: // 'revalidation' '#'
7814 case 15072: // 'satisfies' '#'
7815 case 15073: // 'schema' '#'
7816 case 15074: // 'schema-attribute' '#'
7817 case 15075: // 'schema-element' '#'
7818 case 15076: // 'score' '#'
7819 case 15077: // 'self' '#'
7820 case 15082: // 'sliding' '#'
7821 case 15083: // 'some' '#'
7822 case 15084: // 'stable' '#'
7823 case 15085: // 'start' '#'
7824 case 15088: // 'strict' '#'
7825 case 15091: // 'switch' '#'
7826 case 15092: // 'text' '#'
7827 case 15096: // 'to' '#'
7828 case 15097: // 'treat' '#'
7829 case 15098: // 'try' '#'
7830 case 15099: // 'tumbling' '#'
7831 case 15100: // 'type' '#'
7832 case 15101: // 'typeswitch' '#'
7833 case 15102: // 'union' '#'
7834 case 15104: // 'unordered' '#'
7835 case 15105: // 'updating' '#'
7836 case 15108: // 'validate' '#'
7837 case 15109: // 'value' '#'
7838 case 15110: // 'variable' '#'
7839 case 15111: // 'version' '#'
7840 case 15114: // 'where' '#'
7841 case 15115: // 'while' '#'
7842 case 15118: // 'with' '#'
7843 case 15122: // 'xquery' '#'
7844 case 17414: // EQName^Token '('
7845 case 17478: // 'after' '('
7846 case 17480: // 'allowing' '('
7847 case 17481: // 'ancestor' '('
7848 case 17482: // 'ancestor-or-self' '('
7849 case 17483: // 'and' '('
7850 case 17487: // 'as' '('
7851 case 17488: // 'ascending' '('
7852 case 17489: // 'at' '('
7853 case 17491: // 'base-uri' '('
7854 case 17492: // 'before' '('
7855 case 17493: // 'boundary-space' '('
7856 case 17494: // 'break' '('
7857 case 17496: // 'case' '('
7858 case 17497: // 'cast' '('
7859 case 17498: // 'castable' '('
7860 case 17499: // 'catch' '('
7861 case 17501: // 'child' '('
7862 case 17502: // 'collation' '('
7863 case 17505: // 'constraint' '('
7864 case 17506: // 'construction' '('
7865 case 17509: // 'context' '('
7866 case 17510: // 'continue' '('
7867 case 17511: // 'copy' '('
7868 case 17512: // 'copy-namespaces' '('
7869 case 17513: // 'count' '('
7870 case 17514: // 'decimal-format' '('
7871 case 17516: // 'declare' '('
7872 case 17517: // 'default' '('
7873 case 17518: // 'delete' '('
7874 case 17519: // 'descendant' '('
7875 case 17520: // 'descendant-or-self' '('
7876 case 17521: // 'descending' '('
7877 case 17526: // 'div' '('
7878 case 17527: // 'document' '('
7879 case 17530: // 'else' '('
7880 case 17531: // 'empty' '('
7881 case 17533: // 'encoding' '('
7882 case 17534: // 'end' '('
7883 case 17536: // 'eq' '('
7884 case 17537: // 'every' '('
7885 case 17539: // 'except' '('
7886 case 17540: // 'exit' '('
7887 case 17541: // 'external' '('
7888 case 17542: // 'first' '('
7889 case 17543: // 'following' '('
7890 case 17544: // 'following-sibling' '('
7891 case 17545: // 'for' '('
7892 case 17549: // 'ft-option' '('
7893 case 17553: // 'function' '('
7894 case 17554: // 'ge' '('
7895 case 17556: // 'group' '('
7896 case 17558: // 'gt' '('
7897 case 17559: // 'idiv' '('
7898 case 17561: // 'import' '('
7899 case 17562: // 'in' '('
7900 case 17563: // 'index' '('
7901 case 17567: // 'insert' '('
7902 case 17568: // 'instance' '('
7903 case 17569: // 'integrity' '('
7904 case 17570: // 'intersect' '('
7905 case 17571: // 'into' '('
7906 case 17572: // 'is' '('
7907 case 17578: // 'last' '('
7908 case 17579: // 'lax' '('
7909 case 17580: // 'le' '('
7910 case 17582: // 'let' '('
7911 case 17584: // 'loop' '('
7912 case 17586: // 'lt' '('
7913 case 17588: // 'mod' '('
7914 case 17589: // 'modify' '('
7915 case 17590: // 'module' '('
7916 case 17592: // 'namespace' '('
7917 case 17594: // 'ne' '('
7918 case 17600: // 'nodes' '('
7919 case 17606: // 'only' '('
7920 case 17607: // 'option' '('
7921 case 17608: // 'or' '('
7922 case 17609: // 'order' '('
7923 case 17610: // 'ordered' '('
7924 case 17611: // 'ordering' '('
7925 case 17614: // 'parent' '('
7926 case 17620: // 'preceding' '('
7927 case 17621: // 'preceding-sibling' '('
7928 case 17626: // 'rename' '('
7929 case 17627: // 'replace' '('
7930 case 17628: // 'return' '('
7931 case 17629: // 'returning' '('
7932 case 17630: // 'revalidation' '('
7933 case 17632: // 'satisfies' '('
7934 case 17633: // 'schema' '('
7935 case 17636: // 'score' '('
7936 case 17637: // 'self' '('
7937 case 17642: // 'sliding' '('
7938 case 17643: // 'some' '('
7939 case 17644: // 'stable' '('
7940 case 17645: // 'start' '('
7941 case 17648: // 'strict' '('
7942 case 17656: // 'to' '('
7943 case 17657: // 'treat' '('
7944 case 17658: // 'try' '('
7945 case 17659: // 'tumbling' '('
7946 case 17660: // 'type' '('
7947 case 17662: // 'union' '('
7948 case 17664: // 'unordered' '('
7949 case 17665: // 'updating' '('
7950 case 17668: // 'validate' '('
7951 case 17669: // 'value' '('
7952 case 17670: // 'variable' '('
7953 case 17671: // 'version' '('
7954 case 17674: // 'where' '('
7955 case 17675: // 'while' '('
7956 case 17678: // 'with' '('
7957 case 17682: // 'xquery' '('
7958 case 36946: // 'attribute' 'allowing'
7959 case 36985: // 'element' 'allowing'
7960 case 37048: // 'namespace' 'allowing'
7961 case 37080: // 'processing-instruction' 'allowing'
7962 case 37458: // 'attribute' 'ancestor'
7963 case 37497: // 'element' 'ancestor'
7964 case 37560: // 'namespace' 'ancestor'
7965 case 37592: // 'processing-instruction' 'ancestor'
7966 case 37970: // 'attribute' 'ancestor-or-self'
7967 case 38009: // 'element' 'ancestor-or-self'
7968 case 38072: // 'namespace' 'ancestor-or-self'
7969 case 38104: // 'processing-instruction' 'ancestor-or-self'
7970 case 40018: // 'attribute' 'array'
7971 case 40057: // 'element' 'array'
7972 case 42066: // 'attribute' 'attribute'
7973 case 42105: // 'element' 'attribute'
7974 case 42168: // 'namespace' 'attribute'
7975 case 42200: // 'processing-instruction' 'attribute'
7976 case 42578: // 'attribute' 'base-uri'
7977 case 42617: // 'element' 'base-uri'
7978 case 42680: // 'namespace' 'base-uri'
7979 case 42712: // 'processing-instruction' 'base-uri'
7980 case 43602: // 'attribute' 'boundary-space'
7981 case 43641: // 'element' 'boundary-space'
7982 case 43704: // 'namespace' 'boundary-space'
7983 case 43736: // 'processing-instruction' 'boundary-space'
7984 case 44114: // 'attribute' 'break'
7985 case 44153: // 'element' 'break'
7986 case 44216: // 'namespace' 'break'
7987 case 44248: // 'processing-instruction' 'break'
7988 case 46674: // 'attribute' 'catch'
7989 case 46713: // 'element' 'catch'
7990 case 46776: // 'namespace' 'catch'
7991 case 46808: // 'processing-instruction' 'catch'
7992 case 47698: // 'attribute' 'child'
7993 case 47737: // 'element' 'child'
7994 case 47800: // 'namespace' 'child'
7995 case 47832: // 'processing-instruction' 'child'
7996 case 49234: // 'attribute' 'comment'
7997 case 49273: // 'element' 'comment'
7998 case 49336: // 'namespace' 'comment'
7999 case 49368: // 'processing-instruction' 'comment'
8000 case 49746: // 'attribute' 'constraint'
8001 case 49785: // 'element' 'constraint'
8002 case 49848: // 'namespace' 'constraint'
8003 case 49880: // 'processing-instruction' 'constraint'
8004 case 50258: // 'attribute' 'construction'
8005 case 50297: // 'element' 'construction'
8006 case 50360: // 'namespace' 'construction'
8007 case 50392: // 'processing-instruction' 'construction'
8008 case 51794: // 'attribute' 'context'
8009 case 51833: // 'element' 'context'
8010 case 51896: // 'namespace' 'context'
8011 case 51928: // 'processing-instruction' 'context'
8012 case 52306: // 'attribute' 'continue'
8013 case 52345: // 'element' 'continue'
8014 case 52408: // 'namespace' 'continue'
8015 case 52440: // 'processing-instruction' 'continue'
8016 case 52818: // 'attribute' 'copy'
8017 case 52857: // 'element' 'copy'
8018 case 52920: // 'namespace' 'copy'
8019 case 52952: // 'processing-instruction' 'copy'
8020 case 53330: // 'attribute' 'copy-namespaces'
8021 case 53369: // 'element' 'copy-namespaces'
8022 case 53432: // 'namespace' 'copy-namespaces'
8023 case 53464: // 'processing-instruction' 'copy-namespaces'
8024 case 54354: // 'attribute' 'decimal-format'
8025 case 54393: // 'element' 'decimal-format'
8026 case 54456: // 'namespace' 'decimal-format'
8027 case 54488: // 'processing-instruction' 'decimal-format'
8028 case 55378: // 'attribute' 'declare'
8029 case 55417: // 'element' 'declare'
8030 case 55480: // 'namespace' 'declare'
8031 case 55512: // 'processing-instruction' 'declare'
8032 case 56402: // 'attribute' 'delete'
8033 case 56441: // 'element' 'delete'
8034 case 56504: // 'namespace' 'delete'
8035 case 56536: // 'processing-instruction' 'delete'
8036 case 56914: // 'attribute' 'descendant'
8037 case 56953: // 'element' 'descendant'
8038 case 57016: // 'namespace' 'descendant'
8039 case 57048: // 'processing-instruction' 'descendant'
8040 case 57426: // 'attribute' 'descendant-or-self'
8041 case 57465: // 'element' 'descendant-or-self'
8042 case 57528: // 'namespace' 'descendant-or-self'
8043 case 57560: // 'processing-instruction' 'descendant-or-self'
8044 case 61010: // 'attribute' 'document'
8045 case 61049: // 'element' 'document'
8046 case 61112: // 'namespace' 'document'
8047 case 61144: // 'processing-instruction' 'document'
8048 case 61522: // 'attribute' 'document-node'
8049 case 61561: // 'element' 'document-node'
8050 case 61624: // 'namespace' 'document-node'
8051 case 61656: // 'processing-instruction' 'document-node'
8052 case 62034: // 'attribute' 'element'
8053 case 62073: // 'element' 'element'
8054 case 62136: // 'namespace' 'element'
8055 case 62168: // 'processing-instruction' 'element'
8056 case 63570: // 'attribute' 'empty-sequence'
8057 case 63609: // 'element' 'empty-sequence'
8058 case 63672: // 'namespace' 'empty-sequence'
8059 case 63704: // 'processing-instruction' 'empty-sequence'
8060 case 64082: // 'attribute' 'encoding'
8061 case 64121: // 'element' 'encoding'
8062 case 64184: // 'namespace' 'encoding'
8063 case 64216: // 'processing-instruction' 'encoding'
8064 case 66130: // 'attribute' 'every'
8065 case 66169: // 'element' 'every'
8066 case 66232: // 'namespace' 'every'
8067 case 66264: // 'processing-instruction' 'every'
8068 case 67666: // 'attribute' 'exit'
8069 case 67705: // 'element' 'exit'
8070 case 67768: // 'namespace' 'exit'
8071 case 67800: // 'processing-instruction' 'exit'
8072 case 68178: // 'attribute' 'external'
8073 case 68217: // 'element' 'external'
8074 case 68280: // 'namespace' 'external'
8075 case 68312: // 'processing-instruction' 'external'
8076 case 68690: // 'attribute' 'first'
8077 case 68729: // 'element' 'first'
8078 case 68792: // 'namespace' 'first'
8079 case 68824: // 'processing-instruction' 'first'
8080 case 69202: // 'attribute' 'following'
8081 case 69241: // 'element' 'following'
8082 case 69304: // 'namespace' 'following'
8083 case 69336: // 'processing-instruction' 'following'
8084 case 69714: // 'attribute' 'following-sibling'
8085 case 69753: // 'element' 'following-sibling'
8086 case 69816: // 'namespace' 'following-sibling'
8087 case 69848: // 'processing-instruction' 'following-sibling'
8088 case 72274: // 'attribute' 'ft-option'
8089 case 72313: // 'element' 'ft-option'
8090 case 72376: // 'namespace' 'ft-option'
8091 case 72408: // 'processing-instruction' 'ft-option'
8092 case 74322: // 'attribute' 'function'
8093 case 74361: // 'element' 'function'
8094 case 74424: // 'namespace' 'function'
8095 case 74456: // 'processing-instruction' 'function'
8096 case 77906: // 'attribute' 'if'
8097 case 77945: // 'element' 'if'
8098 case 78008: // 'namespace' 'if'
8099 case 78040: // 'processing-instruction' 'if'
8100 case 78418: // 'attribute' 'import'
8101 case 78457: // 'element' 'import'
8102 case 78520: // 'namespace' 'import'
8103 case 78552: // 'processing-instruction' 'import'
8104 case 78930: // 'attribute' 'in'
8105 case 78969: // 'element' 'in'
8106 case 79032: // 'namespace' 'in'
8107 case 79064: // 'processing-instruction' 'in'
8108 case 79442: // 'attribute' 'index'
8109 case 79481: // 'element' 'index'
8110 case 79544: // 'namespace' 'index'
8111 case 79576: // 'processing-instruction' 'index'
8112 case 81490: // 'attribute' 'insert'
8113 case 81529: // 'element' 'insert'
8114 case 81592: // 'namespace' 'insert'
8115 case 81624: // 'processing-instruction' 'insert'
8116 case 82514: // 'attribute' 'integrity'
8117 case 82553: // 'element' 'integrity'
8118 case 82616: // 'namespace' 'integrity'
8119 case 82648: // 'processing-instruction' 'integrity'
8120 case 84562: // 'attribute' 'item'
8121 case 84601: // 'element' 'item'
8122 case 84664: // 'namespace' 'item'
8123 case 84696: // 'processing-instruction' 'item'
8124 case 85586: // 'attribute' 'json-item'
8125 case 85625: // 'element' 'json-item'
8126 case 87122: // 'attribute' 'last'
8127 case 87161: // 'element' 'last'
8128 case 87224: // 'namespace' 'last'
8129 case 87256: // 'processing-instruction' 'last'
8130 case 87634: // 'attribute' 'lax'
8131 case 87673: // 'element' 'lax'
8132 case 87736: // 'namespace' 'lax'
8133 case 87768: // 'processing-instruction' 'lax'
8134 case 90194: // 'attribute' 'loop'
8135 case 90233: // 'element' 'loop'
8136 case 90296: // 'namespace' 'loop'
8137 case 90328: // 'processing-instruction' 'loop'
8138 case 93266: // 'attribute' 'module'
8139 case 93305: // 'element' 'module'
8140 case 93368: // 'namespace' 'module'
8141 case 93400: // 'processing-instruction' 'module'
8142 case 94290: // 'attribute' 'namespace'
8143 case 94329: // 'element' 'namespace'
8144 case 94392: // 'namespace' 'namespace'
8145 case 94424: // 'processing-instruction' 'namespace'
8146 case 94802: // 'attribute' 'namespace-node'
8147 case 94841: // 'element' 'namespace-node'
8148 case 94904: // 'namespace' 'namespace-node'
8149 case 94936: // 'processing-instruction' 'namespace-node'
8150 case 97874: // 'attribute' 'node'
8151 case 97913: // 'element' 'node'
8152 case 97976: // 'namespace' 'node'
8153 case 98008: // 'processing-instruction' 'node'
8154 case 98386: // 'attribute' 'nodes'
8155 case 98425: // 'element' 'nodes'
8156 case 98488: // 'namespace' 'nodes'
8157 case 98520: // 'processing-instruction' 'nodes'
8158 case 99410: // 'attribute' 'object'
8159 case 99449: // 'element' 'object'
8160 case 101970: // 'attribute' 'option'
8161 case 102009: // 'element' 'option'
8162 case 102072: // 'namespace' 'option'
8163 case 102104: // 'processing-instruction' 'option'
8164 case 103506: // 'attribute' 'ordered'
8165 case 103545: // 'element' 'ordered'
8166 case 103608: // 'namespace' 'ordered'
8167 case 103640: // 'processing-instruction' 'ordered'
8168 case 104018: // 'attribute' 'ordering'
8169 case 104057: // 'element' 'ordering'
8170 case 104120: // 'namespace' 'ordering'
8171 case 104152: // 'processing-instruction' 'ordering'
8172 case 105554: // 'attribute' 'parent'
8173 case 105593: // 'element' 'parent'
8174 case 105656: // 'namespace' 'parent'
8175 case 105688: // 'processing-instruction' 'parent'
8176 case 108626: // 'attribute' 'preceding'
8177 case 108665: // 'element' 'preceding'
8178 case 108728: // 'namespace' 'preceding'
8179 case 108760: // 'processing-instruction' 'preceding'
8180 case 109138: // 'attribute' 'preceding-sibling'
8181 case 109177: // 'element' 'preceding-sibling'
8182 case 109240: // 'namespace' 'preceding-sibling'
8183 case 109272: // 'processing-instruction' 'preceding-sibling'
8184 case 110674: // 'attribute' 'processing-instruction'
8185 case 110713: // 'element' 'processing-instruction'
8186 case 110776: // 'namespace' 'processing-instruction'
8187 case 110808: // 'processing-instruction' 'processing-instruction'
8188 case 111698: // 'attribute' 'rename'
8189 case 111737: // 'element' 'rename'
8190 case 111800: // 'namespace' 'rename'
8191 case 111832: // 'processing-instruction' 'rename'
8192 case 112210: // 'attribute' 'replace'
8193 case 112249: // 'element' 'replace'
8194 case 112312: // 'namespace' 'replace'
8195 case 112344: // 'processing-instruction' 'replace'
8196 case 113234: // 'attribute' 'returning'
8197 case 113273: // 'element' 'returning'
8198 case 113336: // 'namespace' 'returning'
8199 case 113368: // 'processing-instruction' 'returning'
8200 case 113746: // 'attribute' 'revalidation'
8201 case 113785: // 'element' 'revalidation'
8202 case 113848: // 'namespace' 'revalidation'
8203 case 113880: // 'processing-instruction' 'revalidation'
8204 case 115282: // 'attribute' 'schema'
8205 case 115321: // 'element' 'schema'
8206 case 115384: // 'namespace' 'schema'
8207 case 115416: // 'processing-instruction' 'schema'
8208 case 115794: // 'attribute' 'schema-attribute'
8209 case 115833: // 'element' 'schema-attribute'
8210 case 115896: // 'namespace' 'schema-attribute'
8211 case 115928: // 'processing-instruction' 'schema-attribute'
8212 case 116306: // 'attribute' 'schema-element'
8213 case 116345: // 'element' 'schema-element'
8214 case 116408: // 'namespace' 'schema-element'
8215 case 116440: // 'processing-instruction' 'schema-element'
8216 case 116818: // 'attribute' 'score'
8217 case 116857: // 'element' 'score'
8218 case 116920: // 'namespace' 'score'
8219 case 116952: // 'processing-instruction' 'score'
8220 case 117330: // 'attribute' 'self'
8221 case 117369: // 'element' 'self'
8222 case 117432: // 'namespace' 'self'
8223 case 117464: // 'processing-instruction' 'self'
8224 case 119890: // 'attribute' 'sliding'
8225 case 119929: // 'element' 'sliding'
8226 case 119992: // 'namespace' 'sliding'
8227 case 120024: // 'processing-instruction' 'sliding'
8228 case 120402: // 'attribute' 'some'
8229 case 120441: // 'element' 'some'
8230 case 120504: // 'namespace' 'some'
8231 case 120536: // 'processing-instruction' 'some'
8232 case 122962: // 'attribute' 'strict'
8233 case 123001: // 'element' 'strict'
8234 case 123064: // 'namespace' 'strict'
8235 case 123096: // 'processing-instruction' 'strict'
8236 case 124498: // 'attribute' 'switch'
8237 case 124537: // 'element' 'switch'
8238 case 124600: // 'namespace' 'switch'
8239 case 124632: // 'processing-instruction' 'switch'
8240 case 125010: // 'attribute' 'text'
8241 case 125049: // 'element' 'text'
8242 case 125112: // 'namespace' 'text'
8243 case 125144: // 'processing-instruction' 'text'
8244 case 128082: // 'attribute' 'try'
8245 case 128121: // 'element' 'try'
8246 case 128184: // 'namespace' 'try'
8247 case 128216: // 'processing-instruction' 'try'
8248 case 128594: // 'attribute' 'tumbling'
8249 case 128633: // 'element' 'tumbling'
8250 case 128696: // 'namespace' 'tumbling'
8251 case 128728: // 'processing-instruction' 'tumbling'
8252 case 129106: // 'attribute' 'type'
8253 case 129145: // 'element' 'type'
8254 case 129208: // 'namespace' 'type'
8255 case 129240: // 'processing-instruction' 'type'
8256 case 129618: // 'attribute' 'typeswitch'
8257 case 129657: // 'element' 'typeswitch'
8258 case 129720: // 'namespace' 'typeswitch'
8259 case 129752: // 'processing-instruction' 'typeswitch'
8260 case 131154: // 'attribute' 'unordered'
8261 case 131193: // 'element' 'unordered'
8262 case 131256: // 'namespace' 'unordered'
8263 case 131288: // 'processing-instruction' 'unordered'
8264 case 131666: // 'attribute' 'updating'
8265 case 131705: // 'element' 'updating'
8266 case 131768: // 'namespace' 'updating'
8267 case 131800: // 'processing-instruction' 'updating'
8268 case 133202: // 'attribute' 'validate'
8269 case 133241: // 'element' 'validate'
8270 case 133304: // 'namespace' 'validate'
8271 case 133336: // 'processing-instruction' 'validate'
8272 case 133714: // 'attribute' 'value'
8273 case 133753: // 'element' 'value'
8274 case 133816: // 'namespace' 'value'
8275 case 133848: // 'processing-instruction' 'value'
8276 case 134226: // 'attribute' 'variable'
8277 case 134265: // 'element' 'variable'
8278 case 134328: // 'namespace' 'variable'
8279 case 134360: // 'processing-instruction' 'variable'
8280 case 134738: // 'attribute' 'version'
8281 case 134777: // 'element' 'version'
8282 case 134840: // 'namespace' 'version'
8283 case 134872: // 'processing-instruction' 'version'
8284 case 136786: // 'attribute' 'while'
8285 case 136825: // 'element' 'while'
8286 case 136888: // 'namespace' 'while'
8287 case 136920: // 'processing-instruction' 'while'
8288 case 140370: // 'attribute' 'xquery'
8289 case 140409: // 'element' 'xquery'
8290 case 140472: // 'namespace' 'xquery'
8291 case 140504: // 'processing-instruction' 'xquery'
8292 case 141394: // 'attribute' '{'
8293 case 141408: // 'comment' '{'
8294 case 141431: // 'document' '{'
8295 case 141433: // 'element' '{'
8296 case 141496: // 'namespace' '{'
8297 case 141514: // 'ordered' '{'
8298 case 141528: // 'processing-instruction' '{'
8299 case 141556: // 'text' '{'
8300 case 141568: // 'unordered' '{'
8301 try_PostfixExpr();
8302 break;
8303 case -3:
8304 break;
8305 default:
8306 try_AxisStep();
8307 }
8308 }
8309
8310 function parse_AxisStep()
8311 {
8312 eventHandler.startNonterminal("AxisStep", e0);
8313 switch (l1)
8314 {
8315 case 73: // 'ancestor'
8316 case 74: // 'ancestor-or-self'
8317 case 206: // 'parent'
8318 case 212: // 'preceding'
8319 case 213: // 'preceding-sibling'
8320 lookahead2W(240); // S^WS | EOF | '!' | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' | ':' |
8321 break;
8322 default:
8323 lk = l1;
8324 }
8325 switch (lk)
8326 {
8327 case 45: // '..'
8328 case 26185: // 'ancestor' '::'
8329 case 26186: // 'ancestor-or-self' '::'
8330 case 26318: // 'parent' '::'
8331 case 26324: // 'preceding' '::'
8332 case 26325: // 'preceding-sibling' '::'
8333 parse_ReverseStep();
8334 break;
8335 default:
8336 parse_ForwardStep();
8337 }
8338 lookahead1W(236); // S^WS | EOF | '!' | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' | ':' |
8339 whitespace();
8340 parse_PredicateList();
8341 eventHandler.endNonterminal("AxisStep", e0);
8342 }
8343
8344 function try_AxisStep()
8345 {
8346 switch (l1)
8347 {
8348 case 73: // 'ancestor'
8349 case 74: // 'ancestor-or-self'
8350 case 206: // 'parent'
8351 case 212: // 'preceding'
8352 case 213: // 'preceding-sibling'
8353 lookahead2W(240); // S^WS | EOF | '!' | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' | ':' |
8354 break;
8355 default:
8356 lk = l1;
8357 }
8358 switch (lk)
8359 {
8360 case 45: // '..'
8361 case 26185: // 'ancestor' '::'
8362 case 26186: // 'ancestor-or-self' '::'
8363 case 26318: // 'parent' '::'
8364 case 26324: // 'preceding' '::'
8365 case 26325: // 'preceding-sibling' '::'
8366 try_ReverseStep();
8367 break;
8368 default:
8369 try_ForwardStep();
8370 }
8371 lookahead1W(236); // S^WS | EOF | '!' | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' | ':' |
8372 try_PredicateList();
8373 }
8374
8375 function parse_ForwardStep()
8376 {
8377 eventHandler.startNonterminal("ForwardStep", e0);
8378 switch (l1)
8379 {
8380 case 82: // 'attribute'
8381 lookahead2W(243); // S^WS | EOF | '!' | '!=' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' |
8382 break;
8383 case 93: // 'child'
8384 case 111: // 'descendant'
8385 case 112: // 'descendant-or-self'
8386 case 135: // 'following'
8387 case 136: // 'following-sibling'
8388 case 229: // 'self'
8389 lookahead2W(240); // S^WS | EOF | '!' | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' | ':' |
8390 break;
8391 default:
8392 lk = l1;
8393 }
8394 switch (lk)
8395 {
8396 case 26194: // 'attribute' '::'
8397 case 26205: // 'child' '::'
8398 case 26223: // 'descendant' '::'
8399 case 26224: // 'descendant-or-self' '::'
8400 case 26247: // 'following' '::'
8401 case 26248: // 'following-sibling' '::'
8402 case 26341: // 'self' '::'
8403 parse_ForwardAxis();
8404 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
8405 whitespace();
8406 parse_NodeTest();
8407 break;
8408 default:
8409 parse_AbbrevForwardStep();
8410 }
8411 eventHandler.endNonterminal("ForwardStep", e0);
8412 }
8413
8414 function try_ForwardStep()
8415 {
8416 switch (l1)
8417 {
8418 case 82: // 'attribute'
8419 lookahead2W(243); // S^WS | EOF | '!' | '!=' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' |
8420 break;
8421 case 93: // 'child'
8422 case 111: // 'descendant'
8423 case 112: // 'descendant-or-self'
8424 case 135: // 'following'
8425 case 136: // 'following-sibling'
8426 case 229: // 'self'
8427 lookahead2W(240); // S^WS | EOF | '!' | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' | ':' |
8428 break;
8429 default:
8430 lk = l1;
8431 }
8432 switch (lk)
8433 {
8434 case 26194: // 'attribute' '::'
8435 case 26205: // 'child' '::'
8436 case 26223: // 'descendant' '::'
8437 case 26224: // 'descendant-or-self' '::'
8438 case 26247: // 'following' '::'
8439 case 26248: // 'following-sibling' '::'
8440 case 26341: // 'self' '::'
8441 try_ForwardAxis();
8442 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
8443 try_NodeTest();
8444 break;
8445 default:
8446 try_AbbrevForwardStep();
8447 }
8448 }
8449
8450 function parse_ForwardAxis()
8451 {
8452 eventHandler.startNonterminal("ForwardAxis", e0);
8453 switch (l1)
8454 {
8455 case 93: // 'child'
8456 shift(93); // 'child'
8457 lookahead1W(26); // S^WS | '(:' | '::'
8458 shift(51); // '::'
8459 break;
8460 case 111: // 'descendant'
8461 shift(111); // 'descendant'
8462 lookahead1W(26); // S^WS | '(:' | '::'
8463 shift(51); // '::'
8464 break;
8465 case 82: // 'attribute'
8466 shift(82); // 'attribute'
8467 lookahead1W(26); // S^WS | '(:' | '::'
8468 shift(51); // '::'
8469 break;
8470 case 229: // 'self'
8471 shift(229); // 'self'
8472 lookahead1W(26); // S^WS | '(:' | '::'
8473 shift(51); // '::'
8474 break;
8475 case 112: // 'descendant-or-self'
8476 shift(112); // 'descendant-or-self'
8477 lookahead1W(26); // S^WS | '(:' | '::'
8478 shift(51); // '::'
8479 break;
8480 case 136: // 'following-sibling'
8481 shift(136); // 'following-sibling'
8482 lookahead1W(26); // S^WS | '(:' | '::'
8483 shift(51); // '::'
8484 break;
8485 default:
8486 shift(135); // 'following'
8487 lookahead1W(26); // S^WS | '(:' | '::'
8488 shift(51); // '::'
8489 }
8490 eventHandler.endNonterminal("ForwardAxis", e0);
8491 }
8492
8493 function try_ForwardAxis()
8494 {
8495 switch (l1)
8496 {
8497 case 93: // 'child'
8498 shiftT(93); // 'child'
8499 lookahead1W(26); // S^WS | '(:' | '::'
8500 shiftT(51); // '::'
8501 break;
8502 case 111: // 'descendant'
8503 shiftT(111); // 'descendant'
8504 lookahead1W(26); // S^WS | '(:' | '::'
8505 shiftT(51); // '::'
8506 break;
8507 case 82: // 'attribute'
8508 shiftT(82); // 'attribute'
8509 lookahead1W(26); // S^WS | '(:' | '::'
8510 shiftT(51); // '::'
8511 break;
8512 case 229: // 'self'
8513 shiftT(229); // 'self'
8514 lookahead1W(26); // S^WS | '(:' | '::'
8515 shiftT(51); // '::'
8516 break;
8517 case 112: // 'descendant-or-self'
8518 shiftT(112); // 'descendant-or-self'
8519 lookahead1W(26); // S^WS | '(:' | '::'
8520 shiftT(51); // '::'
8521 break;
8522 case 136: // 'following-sibling'
8523 shiftT(136); // 'following-sibling'
8524 lookahead1W(26); // S^WS | '(:' | '::'
8525 shiftT(51); // '::'
8526 break;
8527 default:
8528 shiftT(135); // 'following'
8529 lookahead1W(26); // S^WS | '(:' | '::'
8530 shiftT(51); // '::'
8531 }
8532 }
8533
8534 function parse_AbbrevForwardStep()
8535 {
8536 eventHandler.startNonterminal("AbbrevForwardStep", e0);
8537 if (l1 == 66) // '@'
8538 {
8539 shift(66); // '@'
8540 }
8541 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
8542 whitespace();
8543 parse_NodeTest();
8544 eventHandler.endNonterminal("AbbrevForwardStep", e0);
8545 }
8546
8547 function try_AbbrevForwardStep()
8548 {
8549 if (l1 == 66) // '@'
8550 {
8551 shiftT(66); // '@'
8552 }
8553 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
8554 try_NodeTest();
8555 }
8556
8557 function parse_ReverseStep()
8558 {
8559 eventHandler.startNonterminal("ReverseStep", e0);
8560 switch (l1)
8561 {
8562 case 45: // '..'
8563 parse_AbbrevReverseStep();
8564 break;
8565 default:
8566 parse_ReverseAxis();
8567 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
8568 whitespace();
8569 parse_NodeTest();
8570 }
8571 eventHandler.endNonterminal("ReverseStep", e0);
8572 }
8573
8574 function try_ReverseStep()
8575 {
8576 switch (l1)
8577 {
8578 case 45: // '..'
8579 try_AbbrevReverseStep();
8580 break;
8581 default:
8582 try_ReverseAxis();
8583 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
8584 try_NodeTest();
8585 }
8586 }
8587
8588 function parse_ReverseAxis()
8589 {
8590 eventHandler.startNonterminal("ReverseAxis", e0);
8591 switch (l1)
8592 {
8593 case 206: // 'parent'
8594 shift(206); // 'parent'
8595 lookahead1W(26); // S^WS | '(:' | '::'
8596 shift(51); // '::'
8597 break;
8598 case 73: // 'ancestor'
8599 shift(73); // 'ancestor'
8600 lookahead1W(26); // S^WS | '(:' | '::'
8601 shift(51); // '::'
8602 break;
8603 case 213: // 'preceding-sibling'
8604 shift(213); // 'preceding-sibling'
8605 lookahead1W(26); // S^WS | '(:' | '::'
8606 shift(51); // '::'
8607 break;
8608 case 212: // 'preceding'
8609 shift(212); // 'preceding'
8610 lookahead1W(26); // S^WS | '(:' | '::'
8611 shift(51); // '::'
8612 break;
8613 default:
8614 shift(74); // 'ancestor-or-self'
8615 lookahead1W(26); // S^WS | '(:' | '::'
8616 shift(51); // '::'
8617 }
8618 eventHandler.endNonterminal("ReverseAxis", e0);
8619 }
8620
8621 function try_ReverseAxis()
8622 {
8623 switch (l1)
8624 {
8625 case 206: // 'parent'
8626 shiftT(206); // 'parent'
8627 lookahead1W(26); // S^WS | '(:' | '::'
8628 shiftT(51); // '::'
8629 break;
8630 case 73: // 'ancestor'
8631 shiftT(73); // 'ancestor'
8632 lookahead1W(26); // S^WS | '(:' | '::'
8633 shiftT(51); // '::'
8634 break;
8635 case 213: // 'preceding-sibling'
8636 shiftT(213); // 'preceding-sibling'
8637 lookahead1W(26); // S^WS | '(:' | '::'
8638 shiftT(51); // '::'
8639 break;
8640 case 212: // 'preceding'
8641 shiftT(212); // 'preceding'
8642 lookahead1W(26); // S^WS | '(:' | '::'
8643 shiftT(51); // '::'
8644 break;
8645 default:
8646 shiftT(74); // 'ancestor-or-self'
8647 lookahead1W(26); // S^WS | '(:' | '::'
8648 shiftT(51); // '::'
8649 }
8650 }
8651
8652 function parse_AbbrevReverseStep()
8653 {
8654 eventHandler.startNonterminal("AbbrevReverseStep", e0);
8655 shift(45); // '..'
8656 eventHandler.endNonterminal("AbbrevReverseStep", e0);
8657 }
8658
8659 function try_AbbrevReverseStep()
8660 {
8661 shiftT(45); // '..'
8662 }
8663
8664 function parse_NodeTest()
8665 {
8666 eventHandler.startNonterminal("NodeTest", e0);
8667 switch (l1)
8668 {
8669 case 78: // 'array'
8670 case 82: // 'attribute'
8671 case 96: // 'comment'
8672 case 120: // 'document-node'
8673 case 121: // 'element'
8674 case 167: // 'json-item'
8675 case 185: // 'namespace-node'
8676 case 191: // 'node'
8677 case 194: // 'object'
8678 case 216: // 'processing-instruction'
8679 case 226: // 'schema-attribute'
8680 case 227: // 'schema-element'
8681 case 244: // 'text'
8682 lookahead2W(239); // S^WS | EOF | '!' | '!=' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' |
8683 break;
8684 default:
8685 lk = l1;
8686 }
8687 switch (lk)
8688 {
8689 case 17486: // 'array' '('
8690 case 17490: // 'attribute' '('
8691 case 17504: // 'comment' '('
8692 case 17528: // 'document-node' '('
8693 case 17529: // 'element' '('
8694 case 17575: // 'json-item' '('
8695 case 17593: // 'namespace-node' '('
8696 case 17599: // 'node' '('
8697 case 17602: // 'object' '('
8698 case 17624: // 'processing-instruction' '('
8699 case 17634: // 'schema-attribute' '('
8700 case 17635: // 'schema-element' '('
8701 case 17652: // 'text' '('
8702 parse_KindTest();
8703 break;
8704 default:
8705 parse_NameTest();
8706 }
8707 eventHandler.endNonterminal("NodeTest", e0);
8708 }
8709
8710 function try_NodeTest()
8711 {
8712 switch (l1)
8713 {
8714 case 78: // 'array'
8715 case 82: // 'attribute'
8716 case 96: // 'comment'
8717 case 120: // 'document-node'
8718 case 121: // 'element'
8719 case 167: // 'json-item'
8720 case 185: // 'namespace-node'
8721 case 191: // 'node'
8722 case 194: // 'object'
8723 case 216: // 'processing-instruction'
8724 case 226: // 'schema-attribute'
8725 case 227: // 'schema-element'
8726 case 244: // 'text'
8727 lookahead2W(239); // S^WS | EOF | '!' | '!=' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' |
8728 break;
8729 default:
8730 lk = l1;
8731 }
8732 switch (lk)
8733 {
8734 case 17486: // 'array' '('
8735 case 17490: // 'attribute' '('
8736 case 17504: // 'comment' '('
8737 case 17528: // 'document-node' '('
8738 case 17529: // 'element' '('
8739 case 17575: // 'json-item' '('
8740 case 17593: // 'namespace-node' '('
8741 case 17599: // 'node' '('
8742 case 17602: // 'object' '('
8743 case 17624: // 'processing-instruction' '('
8744 case 17634: // 'schema-attribute' '('
8745 case 17635: // 'schema-element' '('
8746 case 17652: // 'text' '('
8747 try_KindTest();
8748 break;
8749 default:
8750 try_NameTest();
8751 }
8752 }
8753
8754 function parse_NameTest()
8755 {
8756 eventHandler.startNonterminal("NameTest", e0);
8757 switch (l1)
8758 {
8759 case 5: // Wildcard
8760 shift(5); // Wildcard
8761 break;
8762 default:
8763 parse_EQName();
8764 }
8765 eventHandler.endNonterminal("NameTest", e0);
8766 }
8767
8768 function try_NameTest()
8769 {
8770 switch (l1)
8771 {
8772 case 5: // Wildcard
8773 shiftT(5); // Wildcard
8774 break;
8775 default:
8776 try_EQName();
8777 }
8778 }
8779
8780 function parse_PostfixExpr()
8781 {
8782 eventHandler.startNonterminal("PostfixExpr", e0);
8783 parse_PrimaryExpr();
8784 for (;;)
8785 {
8786 lookahead1W(239); // S^WS | EOF | '!' | '!=' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' |
8787 if (l1 != 34 // '('
8788 && l1 != 68) // '['
8789 {
8790 break;
8791 }
8792 switch (l1)
8793 {
8794 case 68: // '['
8795 whitespace();
8796 parse_Predicate();
8797 break;
8798 default:
8799 whitespace();
8800 parse_ArgumentList();
8801 }
8802 }
8803 eventHandler.endNonterminal("PostfixExpr", e0);
8804 }
8805
8806 function try_PostfixExpr()
8807 {
8808 try_PrimaryExpr();
8809 for (;;)
8810 {
8811 lookahead1W(239); // S^WS | EOF | '!' | '!=' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' |
8812 if (l1 != 34 // '('
8813 && l1 != 68) // '['
8814 {
8815 break;
8816 }
8817 switch (l1)
8818 {
8819 case 68: // '['
8820 try_Predicate();
8821 break;
8822 default:
8823 try_ArgumentList();
8824 }
8825 }
8826 }
8827
8828 function parse_ArgumentList()
8829 {
8830 eventHandler.startNonterminal("ArgumentList", e0);
8831 shift(34); // '('
8832 lookahead1W(275); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
8833 if (l1 != 37) // ')'
8834 {
8835 whitespace();
8836 parse_Argument();
8837 for (;;)
8838 {
8839 lookahead1W(101); // S^WS | '(:' | ')' | ','
8840 if (l1 != 41) // ','
8841 {
8842 break;
8843 }
8844 shift(41); // ','
8845 lookahead1W(270); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
8846 whitespace();
8847 parse_Argument();
8848 }
8849 }
8850 shift(37); // ')'
8851 eventHandler.endNonterminal("ArgumentList", e0);
8852 }
8853
8854 function try_ArgumentList()
8855 {
8856 shiftT(34); // '('
8857 lookahead1W(275); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
8858 if (l1 != 37) // ')'
8859 {
8860 try_Argument();
8861 for (;;)
8862 {
8863 lookahead1W(101); // S^WS | '(:' | ')' | ','
8864 if (l1 != 41) // ','
8865 {
8866 break;
8867 }
8868 shiftT(41); // ','
8869 lookahead1W(270); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
8870 try_Argument();
8871 }
8872 }
8873 shiftT(37); // ')'
8874 }
8875
8876 function parse_PredicateList()
8877 {
8878 eventHandler.startNonterminal("PredicateList", e0);
8879 for (;;)
8880 {
8881 lookahead1W(236); // S^WS | EOF | '!' | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' | ':' |
8882 if (l1 != 68) // '['
8883 {
8884 break;
8885 }
8886 whitespace();
8887 parse_Predicate();
8888 }
8889 eventHandler.endNonterminal("PredicateList", e0);
8890 }
8891
8892 function try_PredicateList()
8893 {
8894 for (;;)
8895 {
8896 lookahead1W(236); // S^WS | EOF | '!' | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' | '//' | ':' |
8897 if (l1 != 68) // '['
8898 {
8899 break;
8900 }
8901 try_Predicate();
8902 }
8903 }
8904
8905 function parse_Predicate()
8906 {
8907 eventHandler.startNonterminal("Predicate", e0);
8908 shift(68); // '['
8909 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
8910 whitespace();
8911 parse_Expr();
8912 shift(69); // ']'
8913 eventHandler.endNonterminal("Predicate", e0);
8914 }
8915
8916 function try_Predicate()
8917 {
8918 shiftT(68); // '['
8919 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
8920 try_Expr();
8921 shiftT(69); // ']'
8922 }
8923
8924 function parse_Literal()
8925 {
8926 eventHandler.startNonterminal("Literal", e0);
8927 switch (l1)
8928 {
8929 case 11: // StringLiteral
8930 shift(11); // StringLiteral
8931 break;
8932 default:
8933 parse_NumericLiteral();
8934 }
8935 eventHandler.endNonterminal("Literal", e0);
8936 }
8937
8938 function try_Literal()
8939 {
8940 switch (l1)
8941 {
8942 case 11: // StringLiteral
8943 shiftT(11); // StringLiteral
8944 break;
8945 default:
8946 try_NumericLiteral();
8947 }
8948 }
8949
8950 function parse_NumericLiteral()
8951 {
8952 eventHandler.startNonterminal("NumericLiteral", e0);
8953 switch (l1)
8954 {
8955 case 8: // IntegerLiteral
8956 shift(8); // IntegerLiteral
8957 break;
8958 case 9: // DecimalLiteral
8959 shift(9); // DecimalLiteral
8960 break;
8961 default:
8962 shift(10); // DoubleLiteral
8963 }
8964 eventHandler.endNonterminal("NumericLiteral", e0);
8965 }
8966
8967 function try_NumericLiteral()
8968 {
8969 switch (l1)
8970 {
8971 case 8: // IntegerLiteral
8972 shiftT(8); // IntegerLiteral
8973 break;
8974 case 9: // DecimalLiteral
8975 shiftT(9); // DecimalLiteral
8976 break;
8977 default:
8978 shiftT(10); // DoubleLiteral
8979 }
8980 }
8981
8982 function parse_VarRef()
8983 {
8984 eventHandler.startNonterminal("VarRef", e0);
8985 shift(31); // '$'
8986 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
8987 whitespace();
8988 parse_VarName();
8989 eventHandler.endNonterminal("VarRef", e0);
8990 }
8991
8992 function try_VarRef()
8993 {
8994 shiftT(31); // '$'
8995 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
8996 try_VarName();
8997 }
8998
8999 function parse_VarName()
9000 {
9001 eventHandler.startNonterminal("VarName", e0);
9002 parse_EQName();
9003 eventHandler.endNonterminal("VarName", e0);
9004 }
9005
9006 function try_VarName()
9007 {
9008 try_EQName();
9009 }
9010
9011 function parse_ParenthesizedExpr()
9012 {
9013 eventHandler.startNonterminal("ParenthesizedExpr", e0);
9014 shift(34); // '('
9015 lookahead1W(269); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9016 if (l1 != 37) // ')'
9017 {
9018 whitespace();
9019 parse_Expr();
9020 }
9021 shift(37); // ')'
9022 eventHandler.endNonterminal("ParenthesizedExpr", e0);
9023 }
9024
9025 function try_ParenthesizedExpr()
9026 {
9027 shiftT(34); // '('
9028 lookahead1W(269); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9029 if (l1 != 37) // ')'
9030 {
9031 try_Expr();
9032 }
9033 shiftT(37); // ')'
9034 }
9035
9036 function parse_ContextItemExpr()
9037 {
9038 eventHandler.startNonterminal("ContextItemExpr", e0);
9039 shift(44); // '.'
9040 eventHandler.endNonterminal("ContextItemExpr", e0);
9041 }
9042
9043 function try_ContextItemExpr()
9044 {
9045 shiftT(44); // '.'
9046 }
9047
9048 function parse_OrderedExpr()
9049 {
9050 eventHandler.startNonterminal("OrderedExpr", e0);
9051 shift(202); // 'ordered'
9052 lookahead1W(87); // S^WS | '(:' | '{'
9053 shift(276); // '{'
9054 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9055 whitespace();
9056 parse_Expr();
9057 shift(282); // '}'
9058 eventHandler.endNonterminal("OrderedExpr", e0);
9059 }
9060
9061 function try_OrderedExpr()
9062 {
9063 shiftT(202); // 'ordered'
9064 lookahead1W(87); // S^WS | '(:' | '{'
9065 shiftT(276); // '{'
9066 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9067 try_Expr();
9068 shiftT(282); // '}'
9069 }
9070
9071 function parse_UnorderedExpr()
9072 {
9073 eventHandler.startNonterminal("UnorderedExpr", e0);
9074 shift(256); // 'unordered'
9075 lookahead1W(87); // S^WS | '(:' | '{'
9076 shift(276); // '{'
9077 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9078 whitespace();
9079 parse_Expr();
9080 shift(282); // '}'
9081 eventHandler.endNonterminal("UnorderedExpr", e0);
9082 }
9083
9084 function try_UnorderedExpr()
9085 {
9086 shiftT(256); // 'unordered'
9087 lookahead1W(87); // S^WS | '(:' | '{'
9088 shiftT(276); // '{'
9089 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9090 try_Expr();
9091 shiftT(282); // '}'
9092 }
9093
9094 function parse_FunctionCall()
9095 {
9096 eventHandler.startNonterminal("FunctionCall", e0);
9097 parse_FunctionName();
9098 lookahead1W(22); // S^WS | '(' | '(:'
9099 whitespace();
9100 parse_ArgumentList();
9101 eventHandler.endNonterminal("FunctionCall", e0);
9102 }
9103
9104 function try_FunctionCall()
9105 {
9106 try_FunctionName();
9107 lookahead1W(22); // S^WS | '(' | '(:'
9108 try_ArgumentList();
9109 }
9110
9111 function parse_Argument()
9112 {
9113 eventHandler.startNonterminal("Argument", e0);
9114 switch (l1)
9115 {
9116 case 64: // '?'
9117 parse_ArgumentPlaceholder();
9118 break;
9119 default:
9120 parse_ExprSingle();
9121 }
9122 eventHandler.endNonterminal("Argument", e0);
9123 }
9124
9125 function try_Argument()
9126 {
9127 switch (l1)
9128 {
9129 case 64: // '?'
9130 try_ArgumentPlaceholder();
9131 break;
9132 default:
9133 try_ExprSingle();
9134 }
9135 }
9136
9137 function parse_ArgumentPlaceholder()
9138 {
9139 eventHandler.startNonterminal("ArgumentPlaceholder", e0);
9140 shift(64); // '?'
9141 eventHandler.endNonterminal("ArgumentPlaceholder", e0);
9142 }
9143
9144 function try_ArgumentPlaceholder()
9145 {
9146 shiftT(64); // '?'
9147 }
9148
9149 function parse_Constructor()
9150 {
9151 eventHandler.startNonterminal("Constructor", e0);
9152 switch (l1)
9153 {
9154 case 54: // '<'
9155 case 55: // '<!--'
9156 case 59: // '<?'
9157 parse_DirectConstructor();
9158 break;
9159 default:
9160 parse_ComputedConstructor();
9161 }
9162 eventHandler.endNonterminal("Constructor", e0);
9163 }
9164
9165 function try_Constructor()
9166 {
9167 switch (l1)
9168 {
9169 case 54: // '<'
9170 case 55: // '<!--'
9171 case 59: // '<?'
9172 try_DirectConstructor();
9173 break;
9174 default:
9175 try_ComputedConstructor();
9176 }
9177 }
9178
9179 function parse_DirectConstructor()
9180 {
9181 eventHandler.startNonterminal("DirectConstructor", e0);
9182 switch (l1)
9183 {
9184 case 54: // '<'
9185 parse_DirElemConstructor();
9186 break;
9187 case 55: // '<!--'
9188 parse_DirCommentConstructor();
9189 break;
9190 default:
9191 parse_DirPIConstructor();
9192 }
9193 eventHandler.endNonterminal("DirectConstructor", e0);
9194 }
9195
9196 function try_DirectConstructor()
9197 {
9198 switch (l1)
9199 {
9200 case 54: // '<'
9201 try_DirElemConstructor();
9202 break;
9203 case 55: // '<!--'
9204 try_DirCommentConstructor();
9205 break;
9206 default:
9207 try_DirPIConstructor();
9208 }
9209 }
9210
9211 function parse_DirElemConstructor()
9212 {
9213 eventHandler.startNonterminal("DirElemConstructor", e0);
9214 shift(54); // '<'
9215 lookahead1(4); // QName
9216 shift(20); // QName
9217 parse_DirAttributeList();
9218 switch (l1)
9219 {
9220 case 48: // '/>'
9221 shift(48); // '/>'
9222 break;
9223 default:
9224 shift(61); // '>'
9225 for (;;)
9226 {
9227 lookahead1(174); // CDataSection | PredefinedEntityRef | ElementContentChar | CharRef | '<' |
9228 if (l1 == 56) // '</'
9229 {
9230 break;
9231 }
9232 parse_DirElemContent();
9233 }
9234 shift(56); // '</'
9235 lookahead1(4); // QName
9236 shift(20); // QName
9237 lookahead1(12); // S | '>'
9238 if (l1 == 21) // S
9239 {
9240 shift(21); // S
9241 }
9242 lookahead1(8); // '>'
9243 shift(61); // '>'
9244 }
9245 eventHandler.endNonterminal("DirElemConstructor", e0);
9246 }
9247
9248 function try_DirElemConstructor()
9249 {
9250 shiftT(54); // '<'
9251 lookahead1(4); // QName
9252 shiftT(20); // QName
9253 try_DirAttributeList();
9254 switch (l1)
9255 {
9256 case 48: // '/>'
9257 shiftT(48); // '/>'
9258 break;
9259 default:
9260 shiftT(61); // '>'
9261 for (;;)
9262 {
9263 lookahead1(174); // CDataSection | PredefinedEntityRef | ElementContentChar | CharRef | '<' |
9264 if (l1 == 56) // '</'
9265 {
9266 break;
9267 }
9268 try_DirElemContent();
9269 }
9270 shiftT(56); // '</'
9271 lookahead1(4); // QName
9272 shiftT(20); // QName
9273 lookahead1(12); // S | '>'
9274 if (l1 == 21) // S
9275 {
9276 shiftT(21); // S
9277 }
9278 lookahead1(8); // '>'
9279 shiftT(61); // '>'
9280 }
9281 }
9282
9283 function parse_DirAttributeList()
9284 {
9285 eventHandler.startNonterminal("DirAttributeList", e0);
9286 for (;;)
9287 {
9288 lookahead1(19); // S | '/>' | '>'
9289 if (l1 != 21) // S
9290 {
9291 break;
9292 }
9293 shift(21); // S
9294 lookahead1(91); // QName | S | '/>' | '>'
9295 if (l1 == 20) // QName
9296 {
9297 shift(20); // QName
9298 lookahead1(11); // S | '='
9299 if (l1 == 21) // S
9300 {
9301 shift(21); // S
9302 }
9303 lookahead1(7); // '='
9304 shift(60); // '='
9305 lookahead1(18); // S | '"' | "'"
9306 if (l1 == 21) // S
9307 {
9308 shift(21); // S
9309 }
9310 parse_DirAttributeValue();
9311 }
9312 }
9313 eventHandler.endNonterminal("DirAttributeList", e0);
9314 }
9315
9316 function try_DirAttributeList()
9317 {
9318 for (;;)
9319 {
9320 lookahead1(19); // S | '/>' | '>'
9321 if (l1 != 21) // S
9322 {
9323 break;
9324 }
9325 shiftT(21); // S
9326 lookahead1(91); // QName | S | '/>' | '>'
9327 if (l1 == 20) // QName
9328 {
9329 shiftT(20); // QName
9330 lookahead1(11); // S | '='
9331 if (l1 == 21) // S
9332 {
9333 shiftT(21); // S
9334 }
9335 lookahead1(7); // '='
9336 shiftT(60); // '='
9337 lookahead1(18); // S | '"' | "'"
9338 if (l1 == 21) // S
9339 {
9340 shiftT(21); // S
9341 }
9342 try_DirAttributeValue();
9343 }
9344 }
9345 }
9346
9347 function parse_DirAttributeValue()
9348 {
9349 eventHandler.startNonterminal("DirAttributeValue", e0);
9350 lookahead1(14); // '"' | "'"
9351 switch (l1)
9352 {
9353 case 28: // '"'
9354 shift(28); // '"'
9355 for (;;)
9356 {
9357 lookahead1(167); // PredefinedEntityRef | EscapeQuot | QuotAttrContentChar | CharRef | '"' | '{' |
9358 if (l1 == 28) // '"'
9359 {
9360 break;
9361 }
9362 switch (l1)
9363 {
9364 case 13: // EscapeQuot
9365 shift(13); // EscapeQuot
9366 break;
9367 default:
9368 parse_QuotAttrValueContent();
9369 }
9370 }
9371 shift(28); // '"'
9372 break;
9373 default:
9374 shift(33); // "'"
9375 for (;;)
9376 {
9377 lookahead1(168); // PredefinedEntityRef | EscapeApos | AposAttrContentChar | CharRef | "'" | '{' |
9378 if (l1 == 33) // "'"
9379 {
9380 break;
9381 }
9382 switch (l1)
9383 {
9384 case 14: // EscapeApos
9385 shift(14); // EscapeApos
9386 break;
9387 default:
9388 parse_AposAttrValueContent();
9389 }
9390 }
9391 shift(33); // "'"
9392 }
9393 eventHandler.endNonterminal("DirAttributeValue", e0);
9394 }
9395
9396 function try_DirAttributeValue()
9397 {
9398 lookahead1(14); // '"' | "'"
9399 switch (l1)
9400 {
9401 case 28: // '"'
9402 shiftT(28); // '"'
9403 for (;;)
9404 {
9405 lookahead1(167); // PredefinedEntityRef | EscapeQuot | QuotAttrContentChar | CharRef | '"' | '{' |
9406 if (l1 == 28) // '"'
9407 {
9408 break;
9409 }
9410 switch (l1)
9411 {
9412 case 13: // EscapeQuot
9413 shiftT(13); // EscapeQuot
9414 break;
9415 default:
9416 try_QuotAttrValueContent();
9417 }
9418 }
9419 shiftT(28); // '"'
9420 break;
9421 default:
9422 shiftT(33); // "'"
9423 for (;;)
9424 {
9425 lookahead1(168); // PredefinedEntityRef | EscapeApos | AposAttrContentChar | CharRef | "'" | '{' |
9426 if (l1 == 33) // "'"
9427 {
9428 break;
9429 }
9430 switch (l1)
9431 {
9432 case 14: // EscapeApos
9433 shiftT(14); // EscapeApos
9434 break;
9435 default:
9436 try_AposAttrValueContent();
9437 }
9438 }
9439 shiftT(33); // "'"
9440 }
9441 }
9442
9443 function parse_QuotAttrValueContent()
9444 {
9445 eventHandler.startNonterminal("QuotAttrValueContent", e0);
9446 switch (l1)
9447 {
9448 case 16: // QuotAttrContentChar
9449 shift(16); // QuotAttrContentChar
9450 break;
9451 default:
9452 parse_CommonContent();
9453 }
9454 eventHandler.endNonterminal("QuotAttrValueContent", e0);
9455 }
9456
9457 function try_QuotAttrValueContent()
9458 {
9459 switch (l1)
9460 {
9461 case 16: // QuotAttrContentChar
9462 shiftT(16); // QuotAttrContentChar
9463 break;
9464 default:
9465 try_CommonContent();
9466 }
9467 }
9468
9469 function parse_AposAttrValueContent()
9470 {
9471 eventHandler.startNonterminal("AposAttrValueContent", e0);
9472 switch (l1)
9473 {
9474 case 17: // AposAttrContentChar
9475 shift(17); // AposAttrContentChar
9476 break;
9477 default:
9478 parse_CommonContent();
9479 }
9480 eventHandler.endNonterminal("AposAttrValueContent", e0);
9481 }
9482
9483 function try_AposAttrValueContent()
9484 {
9485 switch (l1)
9486 {
9487 case 17: // AposAttrContentChar
9488 shiftT(17); // AposAttrContentChar
9489 break;
9490 default:
9491 try_CommonContent();
9492 }
9493 }
9494
9495 function parse_DirElemContent()
9496 {
9497 eventHandler.startNonterminal("DirElemContent", e0);
9498 switch (l1)
9499 {
9500 case 54: // '<'
9501 case 55: // '<!--'
9502 case 59: // '<?'
9503 parse_DirectConstructor();
9504 break;
9505 case 4: // CDataSection
9506 shift(4); // CDataSection
9507 break;
9508 case 15: // ElementContentChar
9509 shift(15); // ElementContentChar
9510 break;
9511 default:
9512 parse_CommonContent();
9513 }
9514 eventHandler.endNonterminal("DirElemContent", e0);
9515 }
9516
9517 function try_DirElemContent()
9518 {
9519 switch (l1)
9520 {
9521 case 54: // '<'
9522 case 55: // '<!--'
9523 case 59: // '<?'
9524 try_DirectConstructor();
9525 break;
9526 case 4: // CDataSection
9527 shiftT(4); // CDataSection
9528 break;
9529 case 15: // ElementContentChar
9530 shiftT(15); // ElementContentChar
9531 break;
9532 default:
9533 try_CommonContent();
9534 }
9535 }
9536
9537 function parse_DirCommentConstructor()
9538 {
9539 eventHandler.startNonterminal("DirCommentConstructor", e0);
9540 shift(55); // '<!--'
9541 lookahead1(1); // DirCommentContents
9542 shift(2); // DirCommentContents
9543 lookahead1(6); // '-->'
9544 shift(43); // '-->'
9545 eventHandler.endNonterminal("DirCommentConstructor", e0);
9546 }
9547
9548 function try_DirCommentConstructor()
9549 {
9550 shiftT(55); // '<!--'
9551 lookahead1(1); // DirCommentContents
9552 shiftT(2); // DirCommentContents
9553 lookahead1(6); // '-->'
9554 shiftT(43); // '-->'
9555 }
9556
9557 function parse_DirPIConstructor()
9558 {
9559 eventHandler.startNonterminal("DirPIConstructor", e0);
9560 shift(59); // '<?'
9561 lookahead1(3); // PITarget
9562 shift(18); // PITarget
9563 lookahead1(13); // S | '?>'
9564 if (l1 == 21) // S
9565 {
9566 shift(21); // S
9567 lookahead1(2); // DirPIContents
9568 shift(3); // DirPIContents
9569 }
9570 lookahead1(9); // '?>'
9571 shift(65); // '?>'
9572 eventHandler.endNonterminal("DirPIConstructor", e0);
9573 }
9574
9575 function try_DirPIConstructor()
9576 {
9577 shiftT(59); // '<?'
9578 lookahead1(3); // PITarget
9579 shiftT(18); // PITarget
9580 lookahead1(13); // S | '?>'
9581 if (l1 == 21) // S
9582 {
9583 shiftT(21); // S
9584 lookahead1(2); // DirPIContents
9585 shiftT(3); // DirPIContents
9586 }
9587 lookahead1(9); // '?>'
9588 shiftT(65); // '?>'
9589 }
9590
9591 function parse_ComputedConstructor()
9592 {
9593 eventHandler.startNonterminal("ComputedConstructor", e0);
9594 switch (l1)
9595 {
9596 case 119: // 'document'
9597 parse_CompDocConstructor();
9598 break;
9599 case 121: // 'element'
9600 parse_CompElemConstructor();
9601 break;
9602 case 82: // 'attribute'
9603 parse_CompAttrConstructor();
9604 break;
9605 case 184: // 'namespace'
9606 parse_CompNamespaceConstructor();
9607 break;
9608 case 244: // 'text'
9609 parse_CompTextConstructor();
9610 break;
9611 case 96: // 'comment'
9612 parse_CompCommentConstructor();
9613 break;
9614 default:
9615 parse_CompPIConstructor();
9616 }
9617 eventHandler.endNonterminal("ComputedConstructor", e0);
9618 }
9619
9620 function try_ComputedConstructor()
9621 {
9622 switch (l1)
9623 {
9624 case 119: // 'document'
9625 try_CompDocConstructor();
9626 break;
9627 case 121: // 'element'
9628 try_CompElemConstructor();
9629 break;
9630 case 82: // 'attribute'
9631 try_CompAttrConstructor();
9632 break;
9633 case 184: // 'namespace'
9634 try_CompNamespaceConstructor();
9635 break;
9636 case 244: // 'text'
9637 try_CompTextConstructor();
9638 break;
9639 case 96: // 'comment'
9640 try_CompCommentConstructor();
9641 break;
9642 default:
9643 try_CompPIConstructor();
9644 }
9645 }
9646
9647 function parse_CompElemConstructor()
9648 {
9649 eventHandler.startNonterminal("CompElemConstructor", e0);
9650 shift(121); // 'element'
9651 lookahead1W(256); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
9652 switch (l1)
9653 {
9654 case 276: // '{'
9655 shift(276); // '{'
9656 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9657 whitespace();
9658 parse_Expr();
9659 shift(282); // '}'
9660 break;
9661 default:
9662 whitespace();
9663 parse_EQName();
9664 }
9665 lookahead1W(87); // S^WS | '(:' | '{'
9666 shift(276); // '{'
9667 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9668 if (l1 != 282) // '}'
9669 {
9670 whitespace();
9671 parse_ContentExpr();
9672 }
9673 shift(282); // '}'
9674 eventHandler.endNonterminal("CompElemConstructor", e0);
9675 }
9676
9677 function try_CompElemConstructor()
9678 {
9679 shiftT(121); // 'element'
9680 lookahead1W(256); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
9681 switch (l1)
9682 {
9683 case 276: // '{'
9684 shiftT(276); // '{'
9685 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9686 try_Expr();
9687 shiftT(282); // '}'
9688 break;
9689 default:
9690 try_EQName();
9691 }
9692 lookahead1W(87); // S^WS | '(:' | '{'
9693 shiftT(276); // '{'
9694 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9695 if (l1 != 282) // '}'
9696 {
9697 try_ContentExpr();
9698 }
9699 shiftT(282); // '}'
9700 }
9701
9702 function parse_CompNamespaceConstructor()
9703 {
9704 eventHandler.startNonterminal("CompNamespaceConstructor", e0);
9705 shift(184); // 'namespace'
9706 lookahead1W(249); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
9707 switch (l1)
9708 {
9709 case 276: // '{'
9710 shift(276); // '{'
9711 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9712 whitespace();
9713 parse_PrefixExpr();
9714 shift(282); // '}'
9715 break;
9716 default:
9717 whitespace();
9718 parse_Prefix();
9719 }
9720 lookahead1W(87); // S^WS | '(:' | '{'
9721 shift(276); // '{'
9722 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9723 whitespace();
9724 parse_URIExpr();
9725 shift(282); // '}'
9726 eventHandler.endNonterminal("CompNamespaceConstructor", e0);
9727 }
9728
9729 function try_CompNamespaceConstructor()
9730 {
9731 shiftT(184); // 'namespace'
9732 lookahead1W(249); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
9733 switch (l1)
9734 {
9735 case 276: // '{'
9736 shiftT(276); // '{'
9737 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9738 try_PrefixExpr();
9739 shiftT(282); // '}'
9740 break;
9741 default:
9742 try_Prefix();
9743 }
9744 lookahead1W(87); // S^WS | '(:' | '{'
9745 shiftT(276); // '{'
9746 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
9747 try_URIExpr();
9748 shiftT(282); // '}'
9749 }
9750
9751 function parse_Prefix()
9752 {
9753 eventHandler.startNonterminal("Prefix", e0);
9754 parse_NCName();
9755 eventHandler.endNonterminal("Prefix", e0);
9756 }
9757
9758 function try_Prefix()
9759 {
9760 try_NCName();
9761 }
9762
9763 function parse_PrefixExpr()
9764 {
9765 eventHandler.startNonterminal("PrefixExpr", e0);
9766 parse_Expr();
9767 eventHandler.endNonterminal("PrefixExpr", e0);
9768 }
9769
9770 function try_PrefixExpr()
9771 {
9772 try_Expr();
9773 }
9774
9775 function parse_URIExpr()
9776 {
9777 eventHandler.startNonterminal("URIExpr", e0);
9778 parse_Expr();
9779 eventHandler.endNonterminal("URIExpr", e0);
9780 }
9781
9782 function try_URIExpr()
9783 {
9784 try_Expr();
9785 }
9786
9787 function parse_FunctionItemExpr()
9788 {
9789 eventHandler.startNonterminal("FunctionItemExpr", e0);
9790 switch (l1)
9791 {
9792 case 145: // 'function'
9793 lookahead2W(92); // S^WS | '#' | '(' | '(:'
9794 break;
9795 default:
9796 lk = l1;
9797 }
9798 switch (lk)
9799 {
9800 case 32: // '%'
9801 case 17553: // 'function' '('
9802 parse_InlineFunctionExpr();
9803 break;
9804 default:
9805 parse_NamedFunctionRef();
9806 }
9807 eventHandler.endNonterminal("FunctionItemExpr", e0);
9808 }
9809
9810 function try_FunctionItemExpr()
9811 {
9812 switch (l1)
9813 {
9814 case 145: // 'function'
9815 lookahead2W(92); // S^WS | '#' | '(' | '(:'
9816 break;
9817 default:
9818 lk = l1;
9819 }
9820 switch (lk)
9821 {
9822 case 32: // '%'
9823 case 17553: // 'function' '('
9824 try_InlineFunctionExpr();
9825 break;
9826 default:
9827 try_NamedFunctionRef();
9828 }
9829 }
9830
9831 function parse_NamedFunctionRef()
9832 {
9833 eventHandler.startNonterminal("NamedFunctionRef", e0);
9834 parse_EQName();
9835 lookahead1W(20); // S^WS | '#' | '(:'
9836 shift(29); // '#'
9837 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
9838 shift(8); // IntegerLiteral
9839 eventHandler.endNonterminal("NamedFunctionRef", e0);
9840 }
9841
9842 function try_NamedFunctionRef()
9843 {
9844 try_EQName();
9845 lookahead1W(20); // S^WS | '#' | '(:'
9846 shiftT(29); // '#'
9847 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
9848 shiftT(8); // IntegerLiteral
9849 }
9850
9851 function parse_InlineFunctionExpr()
9852 {
9853 eventHandler.startNonterminal("InlineFunctionExpr", e0);
9854 for (;;)
9855 {
9856 lookahead1W(97); // S^WS | '%' | '(:' | 'function'
9857 if (l1 != 32) // '%'
9858 {
9859 break;
9860 }
9861 whitespace();
9862 parse_Annotation();
9863 }
9864 shift(145); // 'function'
9865 lookahead1W(22); // S^WS | '(' | '(:'
9866 shift(34); // '('
9867 lookahead1W(94); // S^WS | '$' | '(:' | ')'
9868 if (l1 == 31) // '$'
9869 {
9870 whitespace();
9871 parse_ParamList();
9872 }
9873 shift(37); // ')'
9874 lookahead1W(111); // S^WS | '(:' | 'as' | '{'
9875 if (l1 == 79) // 'as'
9876 {
9877 shift(79); // 'as'
9878 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
9879 whitespace();
9880 parse_SequenceType();
9881 }
9882 lookahead1W(87); // S^WS | '(:' | '{'
9883 whitespace();
9884 parse_FunctionBody();
9885 eventHandler.endNonterminal("InlineFunctionExpr", e0);
9886 }
9887
9888 function try_InlineFunctionExpr()
9889 {
9890 for (;;)
9891 {
9892 lookahead1W(97); // S^WS | '%' | '(:' | 'function'
9893 if (l1 != 32) // '%'
9894 {
9895 break;
9896 }
9897 try_Annotation();
9898 }
9899 shiftT(145); // 'function'
9900 lookahead1W(22); // S^WS | '(' | '(:'
9901 shiftT(34); // '('
9902 lookahead1W(94); // S^WS | '$' | '(:' | ')'
9903 if (l1 == 31) // '$'
9904 {
9905 try_ParamList();
9906 }
9907 shiftT(37); // ')'
9908 lookahead1W(111); // S^WS | '(:' | 'as' | '{'
9909 if (l1 == 79) // 'as'
9910 {
9911 shiftT(79); // 'as'
9912 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
9913 try_SequenceType();
9914 }
9915 lookahead1W(87); // S^WS | '(:' | '{'
9916 try_FunctionBody();
9917 }
9918
9919 function parse_SingleType()
9920 {
9921 eventHandler.startNonterminal("SingleType", e0);
9922 parse_SimpleTypeName();
9923 lookahead1W(226); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
9924 if (l1 == 64) // '?'
9925 {
9926 shift(64); // '?'
9927 }
9928 eventHandler.endNonterminal("SingleType", e0);
9929 }
9930
9931 function try_SingleType()
9932 {
9933 try_SimpleTypeName();
9934 lookahead1W(226); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '+' | ',' | '-' | ':' | ';' | '<' | '<<' |
9935 if (l1 == 64) // '?'
9936 {
9937 shiftT(64); // '?'
9938 }
9939 }
9940
9941 function parse_TypeDeclaration()
9942 {
9943 eventHandler.startNonterminal("TypeDeclaration", e0);
9944 shift(79); // 'as'
9945 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
9946 whitespace();
9947 parse_SequenceType();
9948 eventHandler.endNonterminal("TypeDeclaration", e0);
9949 }
9950
9951 function try_TypeDeclaration()
9952 {
9953 shiftT(79); // 'as'
9954 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
9955 try_SequenceType();
9956 }
9957
9958 function parse_SequenceType()
9959 {
9960 eventHandler.startNonterminal("SequenceType", e0);
9961 switch (l1)
9962 {
9963 case 124: // 'empty-sequence'
9964 lookahead2W(241); // S^WS | EOF | '!=' | '(' | '(:' | ')' | '*' | '*' | '+' | ',' | '-' | ':' | ':=' |
9965 break;
9966 default:
9967 lk = l1;
9968 }
9969 switch (lk)
9970 {
9971 case 17532: // 'empty-sequence' '('
9972 shift(124); // 'empty-sequence'
9973 lookahead1W(22); // S^WS | '(' | '(:'
9974 shift(34); // '('
9975 lookahead1W(23); // S^WS | '(:' | ')'
9976 shift(37); // ')'
9977 break;
9978 default:
9979 parse_ItemType();
9980 lookahead1W(237); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '*' | '+' | ',' | '-' | ':' | ':=' | ';' |
9981 switch (l1)
9982 {
9983 case 39: // '*'
9984 case 40: // '+'
9985 case 64: // '?'
9986 whitespace();
9987 parse_OccurrenceIndicator();
9988 break;
9989 default:
9990 break;
9991 }
9992 }
9993 eventHandler.endNonterminal("SequenceType", e0);
9994 }
9995
9996 function try_SequenceType()
9997 {
9998 switch (l1)
9999 {
10000 case 124: // 'empty-sequence'
10001 lookahead2W(241); // S^WS | EOF | '!=' | '(' | '(:' | ')' | '*' | '*' | '+' | ',' | '-' | ':' | ':=' |
10002 break;
10003 default:
10004 lk = l1;
10005 }
10006 switch (lk)
10007 {
10008 case 17532: // 'empty-sequence' '('
10009 shiftT(124); // 'empty-sequence'
10010 lookahead1W(22); // S^WS | '(' | '(:'
10011 shiftT(34); // '('
10012 lookahead1W(23); // S^WS | '(:' | ')'
10013 shiftT(37); // ')'
10014 break;
10015 default:
10016 try_ItemType();
10017 lookahead1W(237); // S^WS | EOF | '!=' | '(:' | ')' | '*' | '*' | '+' | ',' | '-' | ':' | ':=' | ';' |
10018 switch (l1)
10019 {
10020 case 39: // '*'
10021 case 40: // '+'
10022 case 64: // '?'
10023 try_OccurrenceIndicator();
10024 break;
10025 default:
10026 break;
10027 }
10028 }
10029 }
10030
10031 function parse_OccurrenceIndicator()
10032 {
10033 eventHandler.startNonterminal("OccurrenceIndicator", e0);
10034 switch (l1)
10035 {
10036 case 64: // '?'
10037 shift(64); // '?'
10038 break;
10039 case 39: // '*'
10040 shift(39); // '*'
10041 break;
10042 default:
10043 shift(40); // '+'
10044 }
10045 eventHandler.endNonterminal("OccurrenceIndicator", e0);
10046 }
10047
10048 function try_OccurrenceIndicator()
10049 {
10050 switch (l1)
10051 {
10052 case 64: // '?'
10053 shiftT(64); // '?'
10054 break;
10055 case 39: // '*'
10056 shiftT(39); // '*'
10057 break;
10058 default:
10059 shiftT(40); // '+'
10060 }
10061 }
10062
10063 function parse_ItemType()
10064 {
10065 eventHandler.startNonterminal("ItemType", e0);
10066 switch (l1)
10067 {
10068 case 78: // 'array'
10069 case 82: // 'attribute'
10070 case 96: // 'comment'
10071 case 120: // 'document-node'
10072 case 121: // 'element'
10073 case 145: // 'function'
10074 case 165: // 'item'
10075 case 167: // 'json-item'
10076 case 185: // 'namespace-node'
10077 case 191: // 'node'
10078 case 194: // 'object'
10079 case 216: // 'processing-instruction'
10080 case 226: // 'schema-attribute'
10081 case 227: // 'schema-element'
10082 case 244: // 'text'
10083 lookahead2W(241); // S^WS | EOF | '!=' | '(' | '(:' | ')' | '*' | '*' | '+' | ',' | '-' | ':' | ':=' |
10084 break;
10085 default:
10086 lk = l1;
10087 }
10088 if (lk == 17486 // 'array' '('
10089 || lk == 17575 // 'json-item' '('
10090 || lk == 17602) // 'object' '('
10091 {
10092 lk = memoized(4, e0);
10093 if (lk == 0)
10094 {
10095 var b0A = b0; var e0A = e0; var l1A = l1;
10096 var b1A = b1; var e1A = e1; var l2A = l2;
10097 var b2A = b2; var e2A = e2;
10098 try
10099 {
10100 try_KindTest();
10101 lk = -1;
10102 }
10103 catch (p1A)
10104 {
10105 lk = -6;
10106 }
10107 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
10108 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
10109 b2 = b2A; e2 = e2A; end = e2A; }}
10110 memoize(4, e0, lk);
10111 }
10112 }
10113 switch (lk)
10114 {
10115 case -1:
10116 case 17490: // 'attribute' '('
10117 case 17504: // 'comment' '('
10118 case 17528: // 'document-node' '('
10119 case 17529: // 'element' '('
10120 case 17593: // 'namespace-node' '('
10121 case 17599: // 'node' '('
10122 case 17624: // 'processing-instruction' '('
10123 case 17634: // 'schema-attribute' '('
10124 case 17635: // 'schema-element' '('
10125 case 17652: // 'text' '('
10126 parse_KindTest();
10127 break;
10128 case 17573: // 'item' '('
10129 shift(165); // 'item'
10130 lookahead1W(22); // S^WS | '(' | '(:'
10131 shift(34); // '('
10132 lookahead1W(23); // S^WS | '(:' | ')'
10133 shift(37); // ')'
10134 break;
10135 case 32: // '%'
10136 case 17553: // 'function' '('
10137 parse_FunctionTest();
10138 break;
10139 case 34: // '('
10140 parse_ParenthesizedItemType();
10141 break;
10142 case -6:
10143 parse_JSONTest();
10144 break;
10145 case 242: // 'structured-item'
10146 parse_StructuredItemTest();
10147 break;
10148 default:
10149 parse_AtomicOrUnionType();
10150 }
10151 eventHandler.endNonterminal("ItemType", e0);
10152 }
10153
10154 function try_ItemType()
10155 {
10156 switch (l1)
10157 {
10158 case 78: // 'array'
10159 case 82: // 'attribute'
10160 case 96: // 'comment'
10161 case 120: // 'document-node'
10162 case 121: // 'element'
10163 case 145: // 'function'
10164 case 165: // 'item'
10165 case 167: // 'json-item'
10166 case 185: // 'namespace-node'
10167 case 191: // 'node'
10168 case 194: // 'object'
10169 case 216: // 'processing-instruction'
10170 case 226: // 'schema-attribute'
10171 case 227: // 'schema-element'
10172 case 244: // 'text'
10173 lookahead2W(241); // S^WS | EOF | '!=' | '(' | '(:' | ')' | '*' | '*' | '+' | ',' | '-' | ':' | ':=' |
10174 break;
10175 default:
10176 lk = l1;
10177 }
10178 if (lk == 17486 // 'array' '('
10179 || lk == 17575 // 'json-item' '('
10180 || lk == 17602) // 'object' '('
10181 {
10182 lk = memoized(4, e0);
10183 if (lk == 0)
10184 {
10185 var b0A = b0; var e0A = e0; var l1A = l1;
10186 var b1A = b1; var e1A = e1; var l2A = l2;
10187 var b2A = b2; var e2A = e2;
10188 try
10189 {
10190 try_KindTest();
10191 memoize(4, e0A, -1);
10192 lk = -8;
10193 }
10194 catch (p1A)
10195 {
10196 lk = -6;
10197 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
10198 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
10199 b2 = b2A; e2 = e2A; end = e2A; }}
10200 memoize(4, e0A, -6);
10201 }
10202 }
10203 }
10204 switch (lk)
10205 {
10206 case -1:
10207 case 17490: // 'attribute' '('
10208 case 17504: // 'comment' '('
10209 case 17528: // 'document-node' '('
10210 case 17529: // 'element' '('
10211 case 17593: // 'namespace-node' '('
10212 case 17599: // 'node' '('
10213 case 17624: // 'processing-instruction' '('
10214 case 17634: // 'schema-attribute' '('
10215 case 17635: // 'schema-element' '('
10216 case 17652: // 'text' '('
10217 try_KindTest();
10218 break;
10219 case 17573: // 'item' '('
10220 shiftT(165); // 'item'
10221 lookahead1W(22); // S^WS | '(' | '(:'
10222 shiftT(34); // '('
10223 lookahead1W(23); // S^WS | '(:' | ')'
10224 shiftT(37); // ')'
10225 break;
10226 case 32: // '%'
10227 case 17553: // 'function' '('
10228 try_FunctionTest();
10229 break;
10230 case 34: // '('
10231 try_ParenthesizedItemType();
10232 break;
10233 case -6:
10234 try_JSONTest();
10235 break;
10236 case 242: // 'structured-item'
10237 try_StructuredItemTest();
10238 break;
10239 case -8:
10240 break;
10241 default:
10242 try_AtomicOrUnionType();
10243 }
10244 }
10245
10246 function parse_JSONTest()
10247 {
10248 eventHandler.startNonterminal("JSONTest", e0);
10249 switch (l1)
10250 {
10251 case 167: // 'json-item'
10252 parse_JSONItemTest();
10253 break;
10254 case 194: // 'object'
10255 parse_JSONObjectTest();
10256 break;
10257 default:
10258 parse_JSONArrayTest();
10259 }
10260 eventHandler.endNonterminal("JSONTest", e0);
10261 }
10262
10263 function try_JSONTest()
10264 {
10265 switch (l1)
10266 {
10267 case 167: // 'json-item'
10268 try_JSONItemTest();
10269 break;
10270 case 194: // 'object'
10271 try_JSONObjectTest();
10272 break;
10273 default:
10274 try_JSONArrayTest();
10275 }
10276 }
10277
10278 function parse_StructuredItemTest()
10279 {
10280 eventHandler.startNonterminal("StructuredItemTest", e0);
10281 shift(242); // 'structured-item'
10282 lookahead1W(22); // S^WS | '(' | '(:'
10283 shift(34); // '('
10284 lookahead1W(23); // S^WS | '(:' | ')'
10285 shift(37); // ')'
10286 eventHandler.endNonterminal("StructuredItemTest", e0);
10287 }
10288
10289 function try_StructuredItemTest()
10290 {
10291 shiftT(242); // 'structured-item'
10292 lookahead1W(22); // S^WS | '(' | '(:'
10293 shiftT(34); // '('
10294 lookahead1W(23); // S^WS | '(:' | ')'
10295 shiftT(37); // ')'
10296 }
10297
10298 function parse_JSONItemTest()
10299 {
10300 eventHandler.startNonterminal("JSONItemTest", e0);
10301 shift(167); // 'json-item'
10302 lookahead1W(22); // S^WS | '(' | '(:'
10303 shift(34); // '('
10304 lookahead1W(23); // S^WS | '(:' | ')'
10305 shift(37); // ')'
10306 eventHandler.endNonterminal("JSONItemTest", e0);
10307 }
10308
10309 function try_JSONItemTest()
10310 {
10311 shiftT(167); // 'json-item'
10312 lookahead1W(22); // S^WS | '(' | '(:'
10313 shiftT(34); // '('
10314 lookahead1W(23); // S^WS | '(:' | ')'
10315 shiftT(37); // ')'
10316 }
10317
10318 function parse_JSONObjectTest()
10319 {
10320 eventHandler.startNonterminal("JSONObjectTest", e0);
10321 shift(194); // 'object'
10322 lookahead1W(22); // S^WS | '(' | '(:'
10323 shift(34); // '('
10324 lookahead1W(23); // S^WS | '(:' | ')'
10325 shift(37); // ')'
10326 eventHandler.endNonterminal("JSONObjectTest", e0);
10327 }
10328
10329 function try_JSONObjectTest()
10330 {
10331 shiftT(194); // 'object'
10332 lookahead1W(22); // S^WS | '(' | '(:'
10333 shiftT(34); // '('
10334 lookahead1W(23); // S^WS | '(:' | ')'
10335 shiftT(37); // ')'
10336 }
10337
10338 function parse_JSONArrayTest()
10339 {
10340 eventHandler.startNonterminal("JSONArrayTest", e0);
10341 shift(78); // 'array'
10342 lookahead1W(22); // S^WS | '(' | '(:'
10343 shift(34); // '('
10344 lookahead1W(23); // S^WS | '(:' | ')'
10345 shift(37); // ')'
10346 eventHandler.endNonterminal("JSONArrayTest", e0);
10347 }
10348
10349 function try_JSONArrayTest()
10350 {
10351 shiftT(78); // 'array'
10352 lookahead1W(22); // S^WS | '(' | '(:'
10353 shiftT(34); // '('
10354 lookahead1W(23); // S^WS | '(:' | ')'
10355 shiftT(37); // ')'
10356 }
10357
10358 function parse_AtomicOrUnionType()
10359 {
10360 eventHandler.startNonterminal("AtomicOrUnionType", e0);
10361 parse_EQName();
10362 eventHandler.endNonterminal("AtomicOrUnionType", e0);
10363 }
10364
10365 function try_AtomicOrUnionType()
10366 {
10367 try_EQName();
10368 }
10369
10370 function parse_KindTest()
10371 {
10372 eventHandler.startNonterminal("KindTest", e0);
10373 switch (l1)
10374 {
10375 case 120: // 'document-node'
10376 parse_DocumentTest();
10377 break;
10378 case 121: // 'element'
10379 parse_ElementTest();
10380 break;
10381 case 82: // 'attribute'
10382 parse_AttributeTest();
10383 break;
10384 case 227: // 'schema-element'
10385 parse_SchemaElementTest();
10386 break;
10387 case 226: // 'schema-attribute'
10388 parse_SchemaAttributeTest();
10389 break;
10390 case 216: // 'processing-instruction'
10391 parse_PITest();
10392 break;
10393 case 96: // 'comment'
10394 parse_CommentTest();
10395 break;
10396 case 244: // 'text'
10397 parse_TextTest();
10398 break;
10399 case 185: // 'namespace-node'
10400 parse_NamespaceNodeTest();
10401 break;
10402 case 191: // 'node'
10403 parse_AnyKindTest();
10404 break;
10405 default:
10406 parse_JSONTest();
10407 }
10408 eventHandler.endNonterminal("KindTest", e0);
10409 }
10410
10411 function try_KindTest()
10412 {
10413 switch (l1)
10414 {
10415 case 120: // 'document-node'
10416 try_DocumentTest();
10417 break;
10418 case 121: // 'element'
10419 try_ElementTest();
10420 break;
10421 case 82: // 'attribute'
10422 try_AttributeTest();
10423 break;
10424 case 227: // 'schema-element'
10425 try_SchemaElementTest();
10426 break;
10427 case 226: // 'schema-attribute'
10428 try_SchemaAttributeTest();
10429 break;
10430 case 216: // 'processing-instruction'
10431 try_PITest();
10432 break;
10433 case 96: // 'comment'
10434 try_CommentTest();
10435 break;
10436 case 244: // 'text'
10437 try_TextTest();
10438 break;
10439 case 185: // 'namespace-node'
10440 try_NamespaceNodeTest();
10441 break;
10442 case 191: // 'node'
10443 try_AnyKindTest();
10444 break;
10445 default:
10446 try_JSONTest();
10447 }
10448 }
10449
10450 function parse_AnyKindTest()
10451 {
10452 eventHandler.startNonterminal("AnyKindTest", e0);
10453 shift(191); // 'node'
10454 lookahead1W(22); // S^WS | '(' | '(:'
10455 shift(34); // '('
10456 lookahead1W(23); // S^WS | '(:' | ')'
10457 shift(37); // ')'
10458 eventHandler.endNonterminal("AnyKindTest", e0);
10459 }
10460
10461 function try_AnyKindTest()
10462 {
10463 shiftT(191); // 'node'
10464 lookahead1W(22); // S^WS | '(' | '(:'
10465 shiftT(34); // '('
10466 lookahead1W(23); // S^WS | '(:' | ')'
10467 shiftT(37); // ')'
10468 }
10469
10470 function parse_DocumentTest()
10471 {
10472 eventHandler.startNonterminal("DocumentTest", e0);
10473 shift(120); // 'document-node'
10474 lookahead1W(22); // S^WS | '(' | '(:'
10475 shift(34); // '('
10476 lookahead1W(144); // S^WS | '(:' | ')' | 'element' | 'schema-element'
10477 if (l1 != 37) // ')'
10478 {
10479 switch (l1)
10480 {
10481 case 121: // 'element'
10482 whitespace();
10483 parse_ElementTest();
10484 break;
10485 default:
10486 whitespace();
10487 parse_SchemaElementTest();
10488 }
10489 }
10490 lookahead1W(23); // S^WS | '(:' | ')'
10491 shift(37); // ')'
10492 eventHandler.endNonterminal("DocumentTest", e0);
10493 }
10494
10495 function try_DocumentTest()
10496 {
10497 shiftT(120); // 'document-node'
10498 lookahead1W(22); // S^WS | '(' | '(:'
10499 shiftT(34); // '('
10500 lookahead1W(144); // S^WS | '(:' | ')' | 'element' | 'schema-element'
10501 if (l1 != 37) // ')'
10502 {
10503 switch (l1)
10504 {
10505 case 121: // 'element'
10506 try_ElementTest();
10507 break;
10508 default:
10509 try_SchemaElementTest();
10510 }
10511 }
10512 lookahead1W(23); // S^WS | '(:' | ')'
10513 shiftT(37); // ')'
10514 }
10515
10516 function parse_TextTest()
10517 {
10518 eventHandler.startNonterminal("TextTest", e0);
10519 shift(244); // 'text'
10520 lookahead1W(22); // S^WS | '(' | '(:'
10521 shift(34); // '('
10522 lookahead1W(23); // S^WS | '(:' | ')'
10523 shift(37); // ')'
10524 eventHandler.endNonterminal("TextTest", e0);
10525 }
10526
10527 function try_TextTest()
10528 {
10529 shiftT(244); // 'text'
10530 lookahead1W(22); // S^WS | '(' | '(:'
10531 shiftT(34); // '('
10532 lookahead1W(23); // S^WS | '(:' | ')'
10533 shiftT(37); // ')'
10534 }
10535
10536 function parse_CommentTest()
10537 {
10538 eventHandler.startNonterminal("CommentTest", e0);
10539 shift(96); // 'comment'
10540 lookahead1W(22); // S^WS | '(' | '(:'
10541 shift(34); // '('
10542 lookahead1W(23); // S^WS | '(:' | ')'
10543 shift(37); // ')'
10544 eventHandler.endNonterminal("CommentTest", e0);
10545 }
10546
10547 function try_CommentTest()
10548 {
10549 shiftT(96); // 'comment'
10550 lookahead1W(22); // S^WS | '(' | '(:'
10551 shiftT(34); // '('
10552 lookahead1W(23); // S^WS | '(:' | ')'
10553 shiftT(37); // ')'
10554 }
10555
10556 function parse_NamespaceNodeTest()
10557 {
10558 eventHandler.startNonterminal("NamespaceNodeTest", e0);
10559 shift(185); // 'namespace-node'
10560 lookahead1W(22); // S^WS | '(' | '(:'
10561 shift(34); // '('
10562 lookahead1W(23); // S^WS | '(:' | ')'
10563 shift(37); // ')'
10564 eventHandler.endNonterminal("NamespaceNodeTest", e0);
10565 }
10566
10567 function try_NamespaceNodeTest()
10568 {
10569 shiftT(185); // 'namespace-node'
10570 lookahead1W(22); // S^WS | '(' | '(:'
10571 shiftT(34); // '('
10572 lookahead1W(23); // S^WS | '(:' | ')'
10573 shiftT(37); // ')'
10574 }
10575
10576 function parse_PITest()
10577 {
10578 eventHandler.startNonterminal("PITest", e0);
10579 shift(216); // 'processing-instruction'
10580 lookahead1W(22); // S^WS | '(' | '(:'
10581 shift(34); // '('
10582 lookahead1W(251); // StringLiteral | NCName^Token | S^WS | '(:' | ')' | 'after' | 'allowing' |
10583 if (l1 != 37) // ')'
10584 {
10585 switch (l1)
10586 {
10587 case 11: // StringLiteral
10588 shift(11); // StringLiteral
10589 break;
10590 default:
10591 whitespace();
10592 parse_NCName();
10593 }
10594 }
10595 lookahead1W(23); // S^WS | '(:' | ')'
10596 shift(37); // ')'
10597 eventHandler.endNonterminal("PITest", e0);
10598 }
10599
10600 function try_PITest()
10601 {
10602 shiftT(216); // 'processing-instruction'
10603 lookahead1W(22); // S^WS | '(' | '(:'
10604 shiftT(34); // '('
10605 lookahead1W(251); // StringLiteral | NCName^Token | S^WS | '(:' | ')' | 'after' | 'allowing' |
10606 if (l1 != 37) // ')'
10607 {
10608 switch (l1)
10609 {
10610 case 11: // StringLiteral
10611 shiftT(11); // StringLiteral
10612 break;
10613 default:
10614 try_NCName();
10615 }
10616 }
10617 lookahead1W(23); // S^WS | '(:' | ')'
10618 shiftT(37); // ')'
10619 }
10620
10621 function parse_AttributeTest()
10622 {
10623 eventHandler.startNonterminal("AttributeTest", e0);
10624 shift(82); // 'attribute'
10625 lookahead1W(22); // S^WS | '(' | '(:'
10626 shift(34); // '('
10627 lookahead1W(258); // EQName^Token | S^WS | '(:' | ')' | '*' | 'after' | 'allowing' | 'ancestor' |
10628 if (l1 != 37) // ')'
10629 {
10630 whitespace();
10631 parse_AttribNameOrWildcard();
10632 lookahead1W(101); // S^WS | '(:' | ')' | ','
10633 if (l1 == 41) // ','
10634 {
10635 shift(41); // ','
10636 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
10637 whitespace();
10638 parse_TypeName();
10639 }
10640 }
10641 lookahead1W(23); // S^WS | '(:' | ')'
10642 shift(37); // ')'
10643 eventHandler.endNonterminal("AttributeTest", e0);
10644 }
10645
10646 function try_AttributeTest()
10647 {
10648 shiftT(82); // 'attribute'
10649 lookahead1W(22); // S^WS | '(' | '(:'
10650 shiftT(34); // '('
10651 lookahead1W(258); // EQName^Token | S^WS | '(:' | ')' | '*' | 'after' | 'allowing' | 'ancestor' |
10652 if (l1 != 37) // ')'
10653 {
10654 try_AttribNameOrWildcard();
10655 lookahead1W(101); // S^WS | '(:' | ')' | ','
10656 if (l1 == 41) // ','
10657 {
10658 shiftT(41); // ','
10659 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
10660 try_TypeName();
10661 }
10662 }
10663 lookahead1W(23); // S^WS | '(:' | ')'
10664 shiftT(37); // ')'
10665 }
10666
10667 function parse_AttribNameOrWildcard()
10668 {
10669 eventHandler.startNonterminal("AttribNameOrWildcard", e0);
10670 switch (l1)
10671 {
10672 case 38: // '*'
10673 shift(38); // '*'
10674 break;
10675 default:
10676 parse_AttributeName();
10677 }
10678 eventHandler.endNonterminal("AttribNameOrWildcard", e0);
10679 }
10680
10681 function try_AttribNameOrWildcard()
10682 {
10683 switch (l1)
10684 {
10685 case 38: // '*'
10686 shiftT(38); // '*'
10687 break;
10688 default:
10689 try_AttributeName();
10690 }
10691 }
10692
10693 function parse_SchemaAttributeTest()
10694 {
10695 eventHandler.startNonterminal("SchemaAttributeTest", e0);
10696 shift(226); // 'schema-attribute'
10697 lookahead1W(22); // S^WS | '(' | '(:'
10698 shift(34); // '('
10699 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
10700 whitespace();
10701 parse_AttributeDeclaration();
10702 lookahead1W(23); // S^WS | '(:' | ')'
10703 shift(37); // ')'
10704 eventHandler.endNonterminal("SchemaAttributeTest", e0);
10705 }
10706
10707 function try_SchemaAttributeTest()
10708 {
10709 shiftT(226); // 'schema-attribute'
10710 lookahead1W(22); // S^WS | '(' | '(:'
10711 shiftT(34); // '('
10712 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
10713 try_AttributeDeclaration();
10714 lookahead1W(23); // S^WS | '(:' | ')'
10715 shiftT(37); // ')'
10716 }
10717
10718 function parse_AttributeDeclaration()
10719 {
10720 eventHandler.startNonterminal("AttributeDeclaration", e0);
10721 parse_AttributeName();
10722 eventHandler.endNonterminal("AttributeDeclaration", e0);
10723 }
10724
10725 function try_AttributeDeclaration()
10726 {
10727 try_AttributeName();
10728 }
10729
10730 function parse_ElementTest()
10731 {
10732 eventHandler.startNonterminal("ElementTest", e0);
10733 shift(121); // 'element'
10734 lookahead1W(22); // S^WS | '(' | '(:'
10735 shift(34); // '('
10736 lookahead1W(258); // EQName^Token | S^WS | '(:' | ')' | '*' | 'after' | 'allowing' | 'ancestor' |
10737 if (l1 != 37) // ')'
10738 {
10739 whitespace();
10740 parse_ElementNameOrWildcard();
10741 lookahead1W(101); // S^WS | '(:' | ')' | ','
10742 if (l1 == 41) // ','
10743 {
10744 shift(41); // ','
10745 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
10746 whitespace();
10747 parse_TypeName();
10748 lookahead1W(102); // S^WS | '(:' | ')' | '?'
10749 if (l1 == 64) // '?'
10750 {
10751 shift(64); // '?'
10752 }
10753 }
10754 }
10755 lookahead1W(23); // S^WS | '(:' | ')'
10756 shift(37); // ')'
10757 eventHandler.endNonterminal("ElementTest", e0);
10758 }
10759
10760 function try_ElementTest()
10761 {
10762 shiftT(121); // 'element'
10763 lookahead1W(22); // S^WS | '(' | '(:'
10764 shiftT(34); // '('
10765 lookahead1W(258); // EQName^Token | S^WS | '(:' | ')' | '*' | 'after' | 'allowing' | 'ancestor' |
10766 if (l1 != 37) // ')'
10767 {
10768 try_ElementNameOrWildcard();
10769 lookahead1W(101); // S^WS | '(:' | ')' | ','
10770 if (l1 == 41) // ','
10771 {
10772 shiftT(41); // ','
10773 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
10774 try_TypeName();
10775 lookahead1W(102); // S^WS | '(:' | ')' | '?'
10776 if (l1 == 64) // '?'
10777 {
10778 shiftT(64); // '?'
10779 }
10780 }
10781 }
10782 lookahead1W(23); // S^WS | '(:' | ')'
10783 shiftT(37); // ')'
10784 }
10785
10786 function parse_ElementNameOrWildcard()
10787 {
10788 eventHandler.startNonterminal("ElementNameOrWildcard", e0);
10789 switch (l1)
10790 {
10791 case 38: // '*'
10792 shift(38); // '*'
10793 break;
10794 default:
10795 parse_ElementName();
10796 }
10797 eventHandler.endNonterminal("ElementNameOrWildcard", e0);
10798 }
10799
10800 function try_ElementNameOrWildcard()
10801 {
10802 switch (l1)
10803 {
10804 case 38: // '*'
10805 shiftT(38); // '*'
10806 break;
10807 default:
10808 try_ElementName();
10809 }
10810 }
10811
10812 function parse_SchemaElementTest()
10813 {
10814 eventHandler.startNonterminal("SchemaElementTest", e0);
10815 shift(227); // 'schema-element'
10816 lookahead1W(22); // S^WS | '(' | '(:'
10817 shift(34); // '('
10818 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
10819 whitespace();
10820 parse_ElementDeclaration();
10821 lookahead1W(23); // S^WS | '(:' | ')'
10822 shift(37); // ')'
10823 eventHandler.endNonterminal("SchemaElementTest", e0);
10824 }
10825
10826 function try_SchemaElementTest()
10827 {
10828 shiftT(227); // 'schema-element'
10829 lookahead1W(22); // S^WS | '(' | '(:'
10830 shiftT(34); // '('
10831 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
10832 try_ElementDeclaration();
10833 lookahead1W(23); // S^WS | '(:' | ')'
10834 shiftT(37); // ')'
10835 }
10836
10837 function parse_ElementDeclaration()
10838 {
10839 eventHandler.startNonterminal("ElementDeclaration", e0);
10840 parse_ElementName();
10841 eventHandler.endNonterminal("ElementDeclaration", e0);
10842 }
10843
10844 function try_ElementDeclaration()
10845 {
10846 try_ElementName();
10847 }
10848
10849 function parse_AttributeName()
10850 {
10851 eventHandler.startNonterminal("AttributeName", e0);
10852 parse_EQName();
10853 eventHandler.endNonterminal("AttributeName", e0);
10854 }
10855
10856 function try_AttributeName()
10857 {
10858 try_EQName();
10859 }
10860
10861 function parse_ElementName()
10862 {
10863 eventHandler.startNonterminal("ElementName", e0);
10864 parse_EQName();
10865 eventHandler.endNonterminal("ElementName", e0);
10866 }
10867
10868 function try_ElementName()
10869 {
10870 try_EQName();
10871 }
10872
10873 function parse_SimpleTypeName()
10874 {
10875 eventHandler.startNonterminal("SimpleTypeName", e0);
10876 parse_TypeName();
10877 eventHandler.endNonterminal("SimpleTypeName", e0);
10878 }
10879
10880 function try_SimpleTypeName()
10881 {
10882 try_TypeName();
10883 }
10884
10885 function parse_TypeName()
10886 {
10887 eventHandler.startNonterminal("TypeName", e0);
10888 parse_EQName();
10889 eventHandler.endNonterminal("TypeName", e0);
10890 }
10891
10892 function try_TypeName()
10893 {
10894 try_EQName();
10895 }
10896
10897 function parse_FunctionTest()
10898 {
10899 eventHandler.startNonterminal("FunctionTest", e0);
10900 for (;;)
10901 {
10902 lookahead1W(97); // S^WS | '%' | '(:' | 'function'
10903 if (l1 != 32) // '%'
10904 {
10905 break;
10906 }
10907 whitespace();
10908 parse_Annotation();
10909 }
10910 switch (l1)
10911 {
10912 case 145: // 'function'
10913 lookahead2W(22); // S^WS | '(' | '(:'
10914 break;
10915 default:
10916 lk = l1;
10917 }
10918 lk = memoized(5, e0);
10919 if (lk == 0)
10920 {
10921 var b0A = b0; var e0A = e0; var l1A = l1;
10922 var b1A = b1; var e1A = e1; var l2A = l2;
10923 var b2A = b2; var e2A = e2;
10924 try
10925 {
10926 try_AnyFunctionTest();
10927 lk = -1;
10928 }
10929 catch (p1A)
10930 {
10931 lk = -2;
10932 }
10933 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
10934 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
10935 b2 = b2A; e2 = e2A; end = e2A; }}
10936 memoize(5, e0, lk);
10937 }
10938 switch (lk)
10939 {
10940 case -1:
10941 whitespace();
10942 parse_AnyFunctionTest();
10943 break;
10944 default:
10945 whitespace();
10946 parse_TypedFunctionTest();
10947 }
10948 eventHandler.endNonterminal("FunctionTest", e0);
10949 }
10950
10951 function try_FunctionTest()
10952 {
10953 for (;;)
10954 {
10955 lookahead1W(97); // S^WS | '%' | '(:' | 'function'
10956 if (l1 != 32) // '%'
10957 {
10958 break;
10959 }
10960 try_Annotation();
10961 }
10962 switch (l1)
10963 {
10964 case 145: // 'function'
10965 lookahead2W(22); // S^WS | '(' | '(:'
10966 break;
10967 default:
10968 lk = l1;
10969 }
10970 lk = memoized(5, e0);
10971 if (lk == 0)
10972 {
10973 var b0A = b0; var e0A = e0; var l1A = l1;
10974 var b1A = b1; var e1A = e1; var l2A = l2;
10975 var b2A = b2; var e2A = e2;
10976 try
10977 {
10978 try_AnyFunctionTest();
10979 memoize(5, e0A, -1);
10980 lk = -3;
10981 }
10982 catch (p1A)
10983 {
10984 lk = -2;
10985 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
10986 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
10987 b2 = b2A; e2 = e2A; end = e2A; }}
10988 memoize(5, e0A, -2);
10989 }
10990 }
10991 switch (lk)
10992 {
10993 case -1:
10994 try_AnyFunctionTest();
10995 break;
10996 case -3:
10997 break;
10998 default:
10999 try_TypedFunctionTest();
11000 }
11001 }
11002
11003 function parse_AnyFunctionTest()
11004 {
11005 eventHandler.startNonterminal("AnyFunctionTest", e0);
11006 shift(145); // 'function'
11007 lookahead1W(22); // S^WS | '(' | '(:'
11008 shift(34); // '('
11009 lookahead1W(24); // S^WS | '(:' | '*'
11010 shift(38); // '*'
11011 lookahead1W(23); // S^WS | '(:' | ')'
11012 shift(37); // ')'
11013 eventHandler.endNonterminal("AnyFunctionTest", e0);
11014 }
11015
11016 function try_AnyFunctionTest()
11017 {
11018 shiftT(145); // 'function'
11019 lookahead1W(22); // S^WS | '(' | '(:'
11020 shiftT(34); // '('
11021 lookahead1W(24); // S^WS | '(:' | '*'
11022 shiftT(38); // '*'
11023 lookahead1W(23); // S^WS | '(:' | ')'
11024 shiftT(37); // ')'
11025 }
11026
11027 function parse_TypedFunctionTest()
11028 {
11029 eventHandler.startNonterminal("TypedFunctionTest", e0);
11030 shift(145); // 'function'
11031 lookahead1W(22); // S^WS | '(' | '(:'
11032 shift(34); // '('
11033 lookahead1W(261); // EQName^Token | S^WS | '%' | '(' | '(:' | ')' | 'after' | 'allowing' |
11034 if (l1 != 37) // ')'
11035 {
11036 whitespace();
11037 parse_SequenceType();
11038 for (;;)
11039 {
11040 lookahead1W(101); // S^WS | '(:' | ')' | ','
11041 if (l1 != 41) // ','
11042 {
11043 break;
11044 }
11045 shift(41); // ','
11046 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
11047 whitespace();
11048 parse_SequenceType();
11049 }
11050 }
11051 shift(37); // ')'
11052 lookahead1W(30); // S^WS | '(:' | 'as'
11053 shift(79); // 'as'
11054 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
11055 whitespace();
11056 parse_SequenceType();
11057 eventHandler.endNonterminal("TypedFunctionTest", e0);
11058 }
11059
11060 function try_TypedFunctionTest()
11061 {
11062 shiftT(145); // 'function'
11063 lookahead1W(22); // S^WS | '(' | '(:'
11064 shiftT(34); // '('
11065 lookahead1W(261); // EQName^Token | S^WS | '%' | '(' | '(:' | ')' | 'after' | 'allowing' |
11066 if (l1 != 37) // ')'
11067 {
11068 try_SequenceType();
11069 for (;;)
11070 {
11071 lookahead1W(101); // S^WS | '(:' | ')' | ','
11072 if (l1 != 41) // ','
11073 {
11074 break;
11075 }
11076 shiftT(41); // ','
11077 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
11078 try_SequenceType();
11079 }
11080 }
11081 shiftT(37); // ')'
11082 lookahead1W(30); // S^WS | '(:' | 'as'
11083 shiftT(79); // 'as'
11084 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
11085 try_SequenceType();
11086 }
11087
11088 function parse_ParenthesizedItemType()
11089 {
11090 eventHandler.startNonterminal("ParenthesizedItemType", e0);
11091 shift(34); // '('
11092 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
11093 whitespace();
11094 parse_ItemType();
11095 lookahead1W(23); // S^WS | '(:' | ')'
11096 shift(37); // ')'
11097 eventHandler.endNonterminal("ParenthesizedItemType", e0);
11098 }
11099
11100 function try_ParenthesizedItemType()
11101 {
11102 shiftT(34); // '('
11103 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
11104 try_ItemType();
11105 lookahead1W(23); // S^WS | '(:' | ')'
11106 shiftT(37); // ')'
11107 }
11108
11109 function parse_RevalidationDecl()
11110 {
11111 eventHandler.startNonterminal("RevalidationDecl", e0);
11112 shift(108); // 'declare'
11113 lookahead1W(72); // S^WS | '(:' | 'revalidation'
11114 shift(222); // 'revalidation'
11115 lookahead1W(152); // S^WS | '(:' | 'lax' | 'skip' | 'strict'
11116 switch (l1)
11117 {
11118 case 240: // 'strict'
11119 shift(240); // 'strict'
11120 break;
11121 case 171: // 'lax'
11122 shift(171); // 'lax'
11123 break;
11124 default:
11125 shift(233); // 'skip'
11126 }
11127 eventHandler.endNonterminal("RevalidationDecl", e0);
11128 }
11129
11130 function parse_InsertExprTargetChoice()
11131 {
11132 eventHandler.startNonterminal("InsertExprTargetChoice", e0);
11133 switch (l1)
11134 {
11135 case 70: // 'after'
11136 shift(70); // 'after'
11137 break;
11138 case 84: // 'before'
11139 shift(84); // 'before'
11140 break;
11141 default:
11142 if (l1 == 79) // 'as'
11143 {
11144 shift(79); // 'as'
11145 lookahead1W(119); // S^WS | '(:' | 'first' | 'last'
11146 switch (l1)
11147 {
11148 case 134: // 'first'
11149 shift(134); // 'first'
11150 break;
11151 default:
11152 shift(170); // 'last'
11153 }
11154 }
11155 lookahead1W(54); // S^WS | '(:' | 'into'
11156 shift(163); // 'into'
11157 }
11158 eventHandler.endNonterminal("InsertExprTargetChoice", e0);
11159 }
11160
11161 function try_InsertExprTargetChoice()
11162 {
11163 switch (l1)
11164 {
11165 case 70: // 'after'
11166 shiftT(70); // 'after'
11167 break;
11168 case 84: // 'before'
11169 shiftT(84); // 'before'
11170 break;
11171 default:
11172 if (l1 == 79) // 'as'
11173 {
11174 shiftT(79); // 'as'
11175 lookahead1W(119); // S^WS | '(:' | 'first' | 'last'
11176 switch (l1)
11177 {
11178 case 134: // 'first'
11179 shiftT(134); // 'first'
11180 break;
11181 default:
11182 shiftT(170); // 'last'
11183 }
11184 }
11185 lookahead1W(54); // S^WS | '(:' | 'into'
11186 shiftT(163); // 'into'
11187 }
11188 }
11189
11190 function parse_InsertExpr()
11191 {
11192 eventHandler.startNonterminal("InsertExpr", e0);
11193 shift(159); // 'insert'
11194 lookahead1W(129); // S^WS | '(:' | 'node' | 'nodes'
11195 switch (l1)
11196 {
11197 case 191: // 'node'
11198 shift(191); // 'node'
11199 break;
11200 default:
11201 shift(192); // 'nodes'
11202 }
11203 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11204 whitespace();
11205 parse_SourceExpr();
11206 whitespace();
11207 parse_InsertExprTargetChoice();
11208 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11209 whitespace();
11210 parse_TargetExpr();
11211 eventHandler.endNonterminal("InsertExpr", e0);
11212 }
11213
11214 function try_InsertExpr()
11215 {
11216 shiftT(159); // 'insert'
11217 lookahead1W(129); // S^WS | '(:' | 'node' | 'nodes'
11218 switch (l1)
11219 {
11220 case 191: // 'node'
11221 shiftT(191); // 'node'
11222 break;
11223 default:
11224 shiftT(192); // 'nodes'
11225 }
11226 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11227 try_SourceExpr();
11228 try_InsertExprTargetChoice();
11229 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11230 try_TargetExpr();
11231 }
11232
11233 function parse_DeleteExpr()
11234 {
11235 eventHandler.startNonterminal("DeleteExpr", e0);
11236 shift(110); // 'delete'
11237 lookahead1W(129); // S^WS | '(:' | 'node' | 'nodes'
11238 switch (l1)
11239 {
11240 case 191: // 'node'
11241 shift(191); // 'node'
11242 break;
11243 default:
11244 shift(192); // 'nodes'
11245 }
11246 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11247 whitespace();
11248 parse_TargetExpr();
11249 eventHandler.endNonterminal("DeleteExpr", e0);
11250 }
11251
11252 function try_DeleteExpr()
11253 {
11254 shiftT(110); // 'delete'
11255 lookahead1W(129); // S^WS | '(:' | 'node' | 'nodes'
11256 switch (l1)
11257 {
11258 case 191: // 'node'
11259 shiftT(191); // 'node'
11260 break;
11261 default:
11262 shiftT(192); // 'nodes'
11263 }
11264 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11265 try_TargetExpr();
11266 }
11267
11268 function parse_ReplaceExpr()
11269 {
11270 eventHandler.startNonterminal("ReplaceExpr", e0);
11271 shift(219); // 'replace'
11272 lookahead1W(130); // S^WS | '(:' | 'node' | 'value'
11273 if (l1 == 261) // 'value'
11274 {
11275 shift(261); // 'value'
11276 lookahead1W(64); // S^WS | '(:' | 'of'
11277 shift(196); // 'of'
11278 }
11279 lookahead1W(62); // S^WS | '(:' | 'node'
11280 shift(191); // 'node'
11281 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11282 whitespace();
11283 parse_TargetExpr();
11284 shift(270); // 'with'
11285 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11286 whitespace();
11287 parse_ExprSingle();
11288 eventHandler.endNonterminal("ReplaceExpr", e0);
11289 }
11290
11291 function try_ReplaceExpr()
11292 {
11293 shiftT(219); // 'replace'
11294 lookahead1W(130); // S^WS | '(:' | 'node' | 'value'
11295 if (l1 == 261) // 'value'
11296 {
11297 shiftT(261); // 'value'
11298 lookahead1W(64); // S^WS | '(:' | 'of'
11299 shiftT(196); // 'of'
11300 }
11301 lookahead1W(62); // S^WS | '(:' | 'node'
11302 shiftT(191); // 'node'
11303 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11304 try_TargetExpr();
11305 shiftT(270); // 'with'
11306 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11307 try_ExprSingle();
11308 }
11309
11310 function parse_RenameExpr()
11311 {
11312 eventHandler.startNonterminal("RenameExpr", e0);
11313 shift(218); // 'rename'
11314 lookahead1W(62); // S^WS | '(:' | 'node'
11315 shift(191); // 'node'
11316 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11317 whitespace();
11318 parse_TargetExpr();
11319 shift(79); // 'as'
11320 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11321 whitespace();
11322 parse_NewNameExpr();
11323 eventHandler.endNonterminal("RenameExpr", e0);
11324 }
11325
11326 function try_RenameExpr()
11327 {
11328 shiftT(218); // 'rename'
11329 lookahead1W(62); // S^WS | '(:' | 'node'
11330 shiftT(191); // 'node'
11331 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11332 try_TargetExpr();
11333 shiftT(79); // 'as'
11334 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11335 try_NewNameExpr();
11336 }
11337
11338 function parse_SourceExpr()
11339 {
11340 eventHandler.startNonterminal("SourceExpr", e0);
11341 parse_ExprSingle();
11342 eventHandler.endNonterminal("SourceExpr", e0);
11343 }
11344
11345 function try_SourceExpr()
11346 {
11347 try_ExprSingle();
11348 }
11349
11350 function parse_TargetExpr()
11351 {
11352 eventHandler.startNonterminal("TargetExpr", e0);
11353 parse_ExprSingle();
11354 eventHandler.endNonterminal("TargetExpr", e0);
11355 }
11356
11357 function try_TargetExpr()
11358 {
11359 try_ExprSingle();
11360 }
11361
11362 function parse_NewNameExpr()
11363 {
11364 eventHandler.startNonterminal("NewNameExpr", e0);
11365 parse_ExprSingle();
11366 eventHandler.endNonterminal("NewNameExpr", e0);
11367 }
11368
11369 function try_NewNameExpr()
11370 {
11371 try_ExprSingle();
11372 }
11373
11374 function parse_TransformExpr()
11375 {
11376 eventHandler.startNonterminal("TransformExpr", e0);
11377 shift(103); // 'copy'
11378 lookahead1W(21); // S^WS | '$' | '(:'
11379 shift(31); // '$'
11380 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
11381 whitespace();
11382 parse_VarName();
11383 lookahead1W(27); // S^WS | '(:' | ':='
11384 shift(52); // ':='
11385 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11386 whitespace();
11387 parse_ExprSingle();
11388 for (;;)
11389 {
11390 if (l1 != 41) // ','
11391 {
11392 break;
11393 }
11394 shift(41); // ','
11395 lookahead1W(21); // S^WS | '$' | '(:'
11396 shift(31); // '$'
11397 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
11398 whitespace();
11399 parse_VarName();
11400 lookahead1W(27); // S^WS | '(:' | ':='
11401 shift(52); // ':='
11402 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11403 whitespace();
11404 parse_ExprSingle();
11405 }
11406 shift(181); // 'modify'
11407 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11408 whitespace();
11409 parse_ExprSingle();
11410 shift(220); // 'return'
11411 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11412 whitespace();
11413 parse_ExprSingle();
11414 eventHandler.endNonterminal("TransformExpr", e0);
11415 }
11416
11417 function try_TransformExpr()
11418 {
11419 shiftT(103); // 'copy'
11420 lookahead1W(21); // S^WS | '$' | '(:'
11421 shiftT(31); // '$'
11422 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
11423 try_VarName();
11424 lookahead1W(27); // S^WS | '(:' | ':='
11425 shiftT(52); // ':='
11426 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11427 try_ExprSingle();
11428 for (;;)
11429 {
11430 if (l1 != 41) // ','
11431 {
11432 break;
11433 }
11434 shiftT(41); // ','
11435 lookahead1W(21); // S^WS | '$' | '(:'
11436 shiftT(31); // '$'
11437 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
11438 try_VarName();
11439 lookahead1W(27); // S^WS | '(:' | ':='
11440 shiftT(52); // ':='
11441 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11442 try_ExprSingle();
11443 }
11444 shiftT(181); // 'modify'
11445 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11446 try_ExprSingle();
11447 shiftT(220); // 'return'
11448 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11449 try_ExprSingle();
11450 }
11451
11452 function parse_FTSelection()
11453 {
11454 eventHandler.startNonterminal("FTSelection", e0);
11455 parse_FTOr();
11456 for (;;)
11457 {
11458 lookahead1W(211); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11459 switch (l1)
11460 {
11461 case 81: // 'at'
11462 lookahead2W(151); // S^WS | '(:' | 'end' | 'position' | 'start'
11463 break;
11464 default:
11465 lk = l1;
11466 }
11467 if (lk != 115 // 'different'
11468 && lk != 117 // 'distance'
11469 && lk != 127 // 'entire'
11470 && lk != 202 // 'ordered'
11471 && lk != 223 // 'same'
11472 && lk != 269 // 'window'
11473 && lk != 64593 // 'at' 'end'
11474 && lk != 121425) // 'at' 'start'
11475 {
11476 break;
11477 }
11478 whitespace();
11479 parse_FTPosFilter();
11480 }
11481 eventHandler.endNonterminal("FTSelection", e0);
11482 }
11483
11484 function try_FTSelection()
11485 {
11486 try_FTOr();
11487 for (;;)
11488 {
11489 lookahead1W(211); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11490 switch (l1)
11491 {
11492 case 81: // 'at'
11493 lookahead2W(151); // S^WS | '(:' | 'end' | 'position' | 'start'
11494 break;
11495 default:
11496 lk = l1;
11497 }
11498 if (lk != 115 // 'different'
11499 && lk != 117 // 'distance'
11500 && lk != 127 // 'entire'
11501 && lk != 202 // 'ordered'
11502 && lk != 223 // 'same'
11503 && lk != 269 // 'window'
11504 && lk != 64593 // 'at' 'end'
11505 && lk != 121425) // 'at' 'start'
11506 {
11507 break;
11508 }
11509 try_FTPosFilter();
11510 }
11511 }
11512
11513 function parse_FTWeight()
11514 {
11515 eventHandler.startNonterminal("FTWeight", e0);
11516 shift(264); // 'weight'
11517 lookahead1W(87); // S^WS | '(:' | '{'
11518 shift(276); // '{'
11519 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11520 whitespace();
11521 parse_Expr();
11522 shift(282); // '}'
11523 eventHandler.endNonterminal("FTWeight", e0);
11524 }
11525
11526 function try_FTWeight()
11527 {
11528 shiftT(264); // 'weight'
11529 lookahead1W(87); // S^WS | '(:' | '{'
11530 shiftT(276); // '{'
11531 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11532 try_Expr();
11533 shiftT(282); // '}'
11534 }
11535
11536 function parse_FTOr()
11537 {
11538 eventHandler.startNonterminal("FTOr", e0);
11539 parse_FTAnd();
11540 for (;;)
11541 {
11542 if (l1 != 144) // 'ftor'
11543 {
11544 break;
11545 }
11546 shift(144); // 'ftor'
11547 lookahead1W(162); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{'
11548 whitespace();
11549 parse_FTAnd();
11550 }
11551 eventHandler.endNonterminal("FTOr", e0);
11552 }
11553
11554 function try_FTOr()
11555 {
11556 try_FTAnd();
11557 for (;;)
11558 {
11559 if (l1 != 144) // 'ftor'
11560 {
11561 break;
11562 }
11563 shiftT(144); // 'ftor'
11564 lookahead1W(162); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{'
11565 try_FTAnd();
11566 }
11567 }
11568
11569 function parse_FTAnd()
11570 {
11571 eventHandler.startNonterminal("FTAnd", e0);
11572 parse_FTMildNot();
11573 for (;;)
11574 {
11575 if (l1 != 142) // 'ftand'
11576 {
11577 break;
11578 }
11579 shift(142); // 'ftand'
11580 lookahead1W(162); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{'
11581 whitespace();
11582 parse_FTMildNot();
11583 }
11584 eventHandler.endNonterminal("FTAnd", e0);
11585 }
11586
11587 function try_FTAnd()
11588 {
11589 try_FTMildNot();
11590 for (;;)
11591 {
11592 if (l1 != 142) // 'ftand'
11593 {
11594 break;
11595 }
11596 shiftT(142); // 'ftand'
11597 lookahead1W(162); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{'
11598 try_FTMildNot();
11599 }
11600 }
11601
11602 function parse_FTMildNot()
11603 {
11604 eventHandler.startNonterminal("FTMildNot", e0);
11605 parse_FTUnaryNot();
11606 for (;;)
11607 {
11608 lookahead1W(212); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11609 if (l1 != 193) // 'not'
11610 {
11611 break;
11612 }
11613 shift(193); // 'not'
11614 lookahead1W(53); // S^WS | '(:' | 'in'
11615 shift(154); // 'in'
11616 lookahead1W(162); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{'
11617 whitespace();
11618 parse_FTUnaryNot();
11619 }
11620 eventHandler.endNonterminal("FTMildNot", e0);
11621 }
11622
11623 function try_FTMildNot()
11624 {
11625 try_FTUnaryNot();
11626 for (;;)
11627 {
11628 lookahead1W(212); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11629 if (l1 != 193) // 'not'
11630 {
11631 break;
11632 }
11633 shiftT(193); // 'not'
11634 lookahead1W(53); // S^WS | '(:' | 'in'
11635 shiftT(154); // 'in'
11636 lookahead1W(162); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{'
11637 try_FTUnaryNot();
11638 }
11639 }
11640
11641 function parse_FTUnaryNot()
11642 {
11643 eventHandler.startNonterminal("FTUnaryNot", e0);
11644 if (l1 == 143) // 'ftnot'
11645 {
11646 shift(143); // 'ftnot'
11647 }
11648 lookahead1W(155); // StringLiteral | S^WS | '(' | '(#' | '(:' | '{'
11649 whitespace();
11650 parse_FTPrimaryWithOptions();
11651 eventHandler.endNonterminal("FTUnaryNot", e0);
11652 }
11653
11654 function try_FTUnaryNot()
11655 {
11656 if (l1 == 143) // 'ftnot'
11657 {
11658 shiftT(143); // 'ftnot'
11659 }
11660 lookahead1W(155); // StringLiteral | S^WS | '(' | '(#' | '(:' | '{'
11661 try_FTPrimaryWithOptions();
11662 }
11663
11664 function parse_FTPrimaryWithOptions()
11665 {
11666 eventHandler.startNonterminal("FTPrimaryWithOptions", e0);
11667 parse_FTPrimary();
11668 lookahead1W(214); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11669 if (l1 == 259) // 'using'
11670 {
11671 whitespace();
11672 parse_FTMatchOptions();
11673 }
11674 if (l1 == 264) // 'weight'
11675 {
11676 whitespace();
11677 parse_FTWeight();
11678 }
11679 eventHandler.endNonterminal("FTPrimaryWithOptions", e0);
11680 }
11681
11682 function try_FTPrimaryWithOptions()
11683 {
11684 try_FTPrimary();
11685 lookahead1W(214); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11686 if (l1 == 259) // 'using'
11687 {
11688 try_FTMatchOptions();
11689 }
11690 if (l1 == 264) // 'weight'
11691 {
11692 try_FTWeight();
11693 }
11694 }
11695
11696 function parse_FTPrimary()
11697 {
11698 eventHandler.startNonterminal("FTPrimary", e0);
11699 switch (l1)
11700 {
11701 case 34: // '('
11702 shift(34); // '('
11703 lookahead1W(162); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{'
11704 whitespace();
11705 parse_FTSelection();
11706 shift(37); // ')'
11707 break;
11708 case 35: // '(#'
11709 parse_FTExtensionSelection();
11710 break;
11711 default:
11712 parse_FTWords();
11713 lookahead1W(215); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11714 if (l1 == 195) // 'occurs'
11715 {
11716 whitespace();
11717 parse_FTTimes();
11718 }
11719 }
11720 eventHandler.endNonterminal("FTPrimary", e0);
11721 }
11722
11723 function try_FTPrimary()
11724 {
11725 switch (l1)
11726 {
11727 case 34: // '('
11728 shiftT(34); // '('
11729 lookahead1W(162); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{'
11730 try_FTSelection();
11731 shiftT(37); // ')'
11732 break;
11733 case 35: // '(#'
11734 try_FTExtensionSelection();
11735 break;
11736 default:
11737 try_FTWords();
11738 lookahead1W(215); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11739 if (l1 == 195) // 'occurs'
11740 {
11741 try_FTTimes();
11742 }
11743 }
11744 }
11745
11746 function parse_FTWords()
11747 {
11748 eventHandler.startNonterminal("FTWords", e0);
11749 parse_FTWordsValue();
11750 lookahead1W(221); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11751 if (l1 == 71 // 'all'
11752 || l1 == 76 // 'any'
11753 || l1 == 210) // 'phrase'
11754 {
11755 whitespace();
11756 parse_FTAnyallOption();
11757 }
11758 eventHandler.endNonterminal("FTWords", e0);
11759 }
11760
11761 function try_FTWords()
11762 {
11763 try_FTWordsValue();
11764 lookahead1W(221); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11765 if (l1 == 71 // 'all'
11766 || l1 == 76 // 'any'
11767 || l1 == 210) // 'phrase'
11768 {
11769 try_FTAnyallOption();
11770 }
11771 }
11772
11773 function parse_FTWordsValue()
11774 {
11775 eventHandler.startNonterminal("FTWordsValue", e0);
11776 switch (l1)
11777 {
11778 case 11: // StringLiteral
11779 shift(11); // StringLiteral
11780 break;
11781 default:
11782 shift(276); // '{'
11783 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11784 whitespace();
11785 parse_Expr();
11786 shift(282); // '}'
11787 }
11788 eventHandler.endNonterminal("FTWordsValue", e0);
11789 }
11790
11791 function try_FTWordsValue()
11792 {
11793 switch (l1)
11794 {
11795 case 11: // StringLiteral
11796 shiftT(11); // StringLiteral
11797 break;
11798 default:
11799 shiftT(276); // '{'
11800 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11801 try_Expr();
11802 shiftT(282); // '}'
11803 }
11804 }
11805
11806 function parse_FTExtensionSelection()
11807 {
11808 eventHandler.startNonterminal("FTExtensionSelection", e0);
11809 for (;;)
11810 {
11811 whitespace();
11812 parse_Pragma();
11813 lookahead1W(100); // S^WS | '(#' | '(:' | '{'
11814 if (l1 != 35) // '(#'
11815 {
11816 break;
11817 }
11818 }
11819 shift(276); // '{'
11820 lookahead1W(166); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{' | '}'
11821 if (l1 != 282) // '}'
11822 {
11823 whitespace();
11824 parse_FTSelection();
11825 }
11826 shift(282); // '}'
11827 eventHandler.endNonterminal("FTExtensionSelection", e0);
11828 }
11829
11830 function try_FTExtensionSelection()
11831 {
11832 for (;;)
11833 {
11834 try_Pragma();
11835 lookahead1W(100); // S^WS | '(#' | '(:' | '{'
11836 if (l1 != 35) // '(#'
11837 {
11838 break;
11839 }
11840 }
11841 shiftT(276); // '{'
11842 lookahead1W(166); // StringLiteral | S^WS | '(' | '(#' | '(:' | 'ftnot' | '{' | '}'
11843 if (l1 != 282) // '}'
11844 {
11845 try_FTSelection();
11846 }
11847 shiftT(282); // '}'
11848 }
11849
11850 function parse_FTAnyallOption()
11851 {
11852 eventHandler.startNonterminal("FTAnyallOption", e0);
11853 switch (l1)
11854 {
11855 case 76: // 'any'
11856 shift(76); // 'any'
11857 lookahead1W(218); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11858 if (l1 == 272) // 'word'
11859 {
11860 shift(272); // 'word'
11861 }
11862 break;
11863 case 71: // 'all'
11864 shift(71); // 'all'
11865 lookahead1W(219); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11866 if (l1 == 273) // 'words'
11867 {
11868 shift(273); // 'words'
11869 }
11870 break;
11871 default:
11872 shift(210); // 'phrase'
11873 }
11874 eventHandler.endNonterminal("FTAnyallOption", e0);
11875 }
11876
11877 function try_FTAnyallOption()
11878 {
11879 switch (l1)
11880 {
11881 case 76: // 'any'
11882 shiftT(76); // 'any'
11883 lookahead1W(218); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11884 if (l1 == 272) // 'word'
11885 {
11886 shiftT(272); // 'word'
11887 }
11888 break;
11889 case 71: // 'all'
11890 shiftT(71); // 'all'
11891 lookahead1W(219); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
11892 if (l1 == 273) // 'words'
11893 {
11894 shiftT(273); // 'words'
11895 }
11896 break;
11897 default:
11898 shiftT(210); // 'phrase'
11899 }
11900 }
11901
11902 function parse_FTTimes()
11903 {
11904 eventHandler.startNonterminal("FTTimes", e0);
11905 shift(195); // 'occurs'
11906 lookahead1W(149); // S^WS | '(:' | 'at' | 'exactly' | 'from'
11907 whitespace();
11908 parse_FTRange();
11909 shift(247); // 'times'
11910 eventHandler.endNonterminal("FTTimes", e0);
11911 }
11912
11913 function try_FTTimes()
11914 {
11915 shiftT(195); // 'occurs'
11916 lookahead1W(149); // S^WS | '(:' | 'at' | 'exactly' | 'from'
11917 try_FTRange();
11918 shiftT(247); // 'times'
11919 }
11920
11921 function parse_FTRange()
11922 {
11923 eventHandler.startNonterminal("FTRange", e0);
11924 switch (l1)
11925 {
11926 case 130: // 'exactly'
11927 shift(130); // 'exactly'
11928 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11929 whitespace();
11930 parse_AdditiveExpr();
11931 break;
11932 case 81: // 'at'
11933 shift(81); // 'at'
11934 lookahead1W(125); // S^WS | '(:' | 'least' | 'most'
11935 switch (l1)
11936 {
11937 case 173: // 'least'
11938 shift(173); // 'least'
11939 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11940 whitespace();
11941 parse_AdditiveExpr();
11942 break;
11943 default:
11944 shift(183); // 'most'
11945 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11946 whitespace();
11947 parse_AdditiveExpr();
11948 }
11949 break;
11950 default:
11951 shift(140); // 'from'
11952 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11953 whitespace();
11954 parse_AdditiveExpr();
11955 shift(248); // 'to'
11956 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11957 whitespace();
11958 parse_AdditiveExpr();
11959 }
11960 eventHandler.endNonterminal("FTRange", e0);
11961 }
11962
11963 function try_FTRange()
11964 {
11965 switch (l1)
11966 {
11967 case 130: // 'exactly'
11968 shiftT(130); // 'exactly'
11969 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11970 try_AdditiveExpr();
11971 break;
11972 case 81: // 'at'
11973 shiftT(81); // 'at'
11974 lookahead1W(125); // S^WS | '(:' | 'least' | 'most'
11975 switch (l1)
11976 {
11977 case 173: // 'least'
11978 shiftT(173); // 'least'
11979 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11980 try_AdditiveExpr();
11981 break;
11982 default:
11983 shiftT(183); // 'most'
11984 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11985 try_AdditiveExpr();
11986 }
11987 break;
11988 default:
11989 shiftT(140); // 'from'
11990 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11991 try_AdditiveExpr();
11992 shiftT(248); // 'to'
11993 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
11994 try_AdditiveExpr();
11995 }
11996 }
11997
11998 function parse_FTPosFilter()
11999 {
12000 eventHandler.startNonterminal("FTPosFilter", e0);
12001 switch (l1)
12002 {
12003 case 202: // 'ordered'
12004 parse_FTOrder();
12005 break;
12006 case 269: // 'window'
12007 parse_FTWindow();
12008 break;
12009 case 117: // 'distance'
12010 parse_FTDistance();
12011 break;
12012 case 115: // 'different'
12013 case 223: // 'same'
12014 parse_FTScope();
12015 break;
12016 default:
12017 parse_FTContent();
12018 }
12019 eventHandler.endNonterminal("FTPosFilter", e0);
12020 }
12021
12022 function try_FTPosFilter()
12023 {
12024 switch (l1)
12025 {
12026 case 202: // 'ordered'
12027 try_FTOrder();
12028 break;
12029 case 269: // 'window'
12030 try_FTWindow();
12031 break;
12032 case 117: // 'distance'
12033 try_FTDistance();
12034 break;
12035 case 115: // 'different'
12036 case 223: // 'same'
12037 try_FTScope();
12038 break;
12039 default:
12040 try_FTContent();
12041 }
12042 }
12043
12044 function parse_FTOrder()
12045 {
12046 eventHandler.startNonterminal("FTOrder", e0);
12047 shift(202); // 'ordered'
12048 eventHandler.endNonterminal("FTOrder", e0);
12049 }
12050
12051 function try_FTOrder()
12052 {
12053 shiftT(202); // 'ordered'
12054 }
12055
12056 function parse_FTWindow()
12057 {
12058 eventHandler.startNonterminal("FTWindow", e0);
12059 shift(269); // 'window'
12060 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
12061 whitespace();
12062 parse_AdditiveExpr();
12063 whitespace();
12064 parse_FTUnit();
12065 eventHandler.endNonterminal("FTWindow", e0);
12066 }
12067
12068 function try_FTWindow()
12069 {
12070 shiftT(269); // 'window'
12071 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
12072 try_AdditiveExpr();
12073 try_FTUnit();
12074 }
12075
12076 function parse_FTDistance()
12077 {
12078 eventHandler.startNonterminal("FTDistance", e0);
12079 shift(117); // 'distance'
12080 lookahead1W(149); // S^WS | '(:' | 'at' | 'exactly' | 'from'
12081 whitespace();
12082 parse_FTRange();
12083 whitespace();
12084 parse_FTUnit();
12085 eventHandler.endNonterminal("FTDistance", e0);
12086 }
12087
12088 function try_FTDistance()
12089 {
12090 shiftT(117); // 'distance'
12091 lookahead1W(149); // S^WS | '(:' | 'at' | 'exactly' | 'from'
12092 try_FTRange();
12093 try_FTUnit();
12094 }
12095
12096 function parse_FTUnit()
12097 {
12098 eventHandler.startNonterminal("FTUnit", e0);
12099 switch (l1)
12100 {
12101 case 273: // 'words'
12102 shift(273); // 'words'
12103 break;
12104 case 232: // 'sentences'
12105 shift(232); // 'sentences'
12106 break;
12107 default:
12108 shift(205); // 'paragraphs'
12109 }
12110 eventHandler.endNonterminal("FTUnit", e0);
12111 }
12112
12113 function try_FTUnit()
12114 {
12115 switch (l1)
12116 {
12117 case 273: // 'words'
12118 shiftT(273); // 'words'
12119 break;
12120 case 232: // 'sentences'
12121 shiftT(232); // 'sentences'
12122 break;
12123 default:
12124 shiftT(205); // 'paragraphs'
12125 }
12126 }
12127
12128 function parse_FTScope()
12129 {
12130 eventHandler.startNonterminal("FTScope", e0);
12131 switch (l1)
12132 {
12133 case 223: // 'same'
12134 shift(223); // 'same'
12135 break;
12136 default:
12137 shift(115); // 'different'
12138 }
12139 lookahead1W(132); // S^WS | '(:' | 'paragraph' | 'sentence'
12140 whitespace();
12141 parse_FTBigUnit();
12142 eventHandler.endNonterminal("FTScope", e0);
12143 }
12144
12145 function try_FTScope()
12146 {
12147 switch (l1)
12148 {
12149 case 223: // 'same'
12150 shiftT(223); // 'same'
12151 break;
12152 default:
12153 shiftT(115); // 'different'
12154 }
12155 lookahead1W(132); // S^WS | '(:' | 'paragraph' | 'sentence'
12156 try_FTBigUnit();
12157 }
12158
12159 function parse_FTBigUnit()
12160 {
12161 eventHandler.startNonterminal("FTBigUnit", e0);
12162 switch (l1)
12163 {
12164 case 231: // 'sentence'
12165 shift(231); // 'sentence'
12166 break;
12167 default:
12168 shift(204); // 'paragraph'
12169 }
12170 eventHandler.endNonterminal("FTBigUnit", e0);
12171 }
12172
12173 function try_FTBigUnit()
12174 {
12175 switch (l1)
12176 {
12177 case 231: // 'sentence'
12178 shiftT(231); // 'sentence'
12179 break;
12180 default:
12181 shiftT(204); // 'paragraph'
12182 }
12183 }
12184
12185 function parse_FTContent()
12186 {
12187 eventHandler.startNonterminal("FTContent", e0);
12188 switch (l1)
12189 {
12190 case 81: // 'at'
12191 shift(81); // 'at'
12192 lookahead1W(117); // S^WS | '(:' | 'end' | 'start'
12193 switch (l1)
12194 {
12195 case 237: // 'start'
12196 shift(237); // 'start'
12197 break;
12198 default:
12199 shift(126); // 'end'
12200 }
12201 break;
12202 default:
12203 shift(127); // 'entire'
12204 lookahead1W(42); // S^WS | '(:' | 'content'
12205 shift(100); // 'content'
12206 }
12207 eventHandler.endNonterminal("FTContent", e0);
12208 }
12209
12210 function try_FTContent()
12211 {
12212 switch (l1)
12213 {
12214 case 81: // 'at'
12215 shiftT(81); // 'at'
12216 lookahead1W(117); // S^WS | '(:' | 'end' | 'start'
12217 switch (l1)
12218 {
12219 case 237: // 'start'
12220 shiftT(237); // 'start'
12221 break;
12222 default:
12223 shiftT(126); // 'end'
12224 }
12225 break;
12226 default:
12227 shiftT(127); // 'entire'
12228 lookahead1W(42); // S^WS | '(:' | 'content'
12229 shiftT(100); // 'content'
12230 }
12231 }
12232
12233 function parse_FTMatchOptions()
12234 {
12235 eventHandler.startNonterminal("FTMatchOptions", e0);
12236 for (;;)
12237 {
12238 shift(259); // 'using'
12239 lookahead1W(181); // S^WS | '(:' | 'case' | 'diacritics' | 'language' | 'lowercase' | 'no' |
12240 whitespace();
12241 parse_FTMatchOption();
12242 lookahead1W(214); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
12243 if (l1 != 259) // 'using'
12244 {
12245 break;
12246 }
12247 }
12248 eventHandler.endNonterminal("FTMatchOptions", e0);
12249 }
12250
12251 function try_FTMatchOptions()
12252 {
12253 for (;;)
12254 {
12255 shiftT(259); // 'using'
12256 lookahead1W(181); // S^WS | '(:' | 'case' | 'diacritics' | 'language' | 'lowercase' | 'no' |
12257 try_FTMatchOption();
12258 lookahead1W(214); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
12259 if (l1 != 259) // 'using'
12260 {
12261 break;
12262 }
12263 }
12264 }
12265
12266 function parse_FTMatchOption()
12267 {
12268 eventHandler.startNonterminal("FTMatchOption", e0);
12269 switch (l1)
12270 {
12271 case 188: // 'no'
12272 lookahead2W(161); // S^WS | '(:' | 'stemming' | 'stop' | 'thesaurus' | 'wildcards'
12273 break;
12274 default:
12275 lk = l1;
12276 }
12277 switch (lk)
12278 {
12279 case 169: // 'language'
12280 parse_FTLanguageOption();
12281 break;
12282 case 268: // 'wildcards'
12283 case 137404: // 'no' 'wildcards'
12284 parse_FTWildCardOption();
12285 break;
12286 case 246: // 'thesaurus'
12287 case 126140: // 'no' 'thesaurus'
12288 parse_FTThesaurusOption();
12289 break;
12290 case 238: // 'stemming'
12291 case 122044: // 'no' 'stemming'
12292 parse_FTStemOption();
12293 break;
12294 case 114: // 'diacritics'
12295 parse_FTDiacriticsOption();
12296 break;
12297 case 239: // 'stop'
12298 case 122556: // 'no' 'stop'
12299 parse_FTStopWordOption();
12300 break;
12301 case 199: // 'option'
12302 parse_FTExtensionOption();
12303 break;
12304 default:
12305 parse_FTCaseOption();
12306 }
12307 eventHandler.endNonterminal("FTMatchOption", e0);
12308 }
12309
12310 function try_FTMatchOption()
12311 {
12312 switch (l1)
12313 {
12314 case 188: // 'no'
12315 lookahead2W(161); // S^WS | '(:' | 'stemming' | 'stop' | 'thesaurus' | 'wildcards'
12316 break;
12317 default:
12318 lk = l1;
12319 }
12320 switch (lk)
12321 {
12322 case 169: // 'language'
12323 try_FTLanguageOption();
12324 break;
12325 case 268: // 'wildcards'
12326 case 137404: // 'no' 'wildcards'
12327 try_FTWildCardOption();
12328 break;
12329 case 246: // 'thesaurus'
12330 case 126140: // 'no' 'thesaurus'
12331 try_FTThesaurusOption();
12332 break;
12333 case 238: // 'stemming'
12334 case 122044: // 'no' 'stemming'
12335 try_FTStemOption();
12336 break;
12337 case 114: // 'diacritics'
12338 try_FTDiacriticsOption();
12339 break;
12340 case 239: // 'stop'
12341 case 122556: // 'no' 'stop'
12342 try_FTStopWordOption();
12343 break;
12344 case 199: // 'option'
12345 try_FTExtensionOption();
12346 break;
12347 default:
12348 try_FTCaseOption();
12349 }
12350 }
12351
12352 function parse_FTCaseOption()
12353 {
12354 eventHandler.startNonterminal("FTCaseOption", e0);
12355 switch (l1)
12356 {
12357 case 88: // 'case'
12358 shift(88); // 'case'
12359 lookahead1W(124); // S^WS | '(:' | 'insensitive' | 'sensitive'
12360 switch (l1)
12361 {
12362 case 158: // 'insensitive'
12363 shift(158); // 'insensitive'
12364 break;
12365 default:
12366 shift(230); // 'sensitive'
12367 }
12368 break;
12369 case 177: // 'lowercase'
12370 shift(177); // 'lowercase'
12371 break;
12372 default:
12373 shift(258); // 'uppercase'
12374 }
12375 eventHandler.endNonterminal("FTCaseOption", e0);
12376 }
12377
12378 function try_FTCaseOption()
12379 {
12380 switch (l1)
12381 {
12382 case 88: // 'case'
12383 shiftT(88); // 'case'
12384 lookahead1W(124); // S^WS | '(:' | 'insensitive' | 'sensitive'
12385 switch (l1)
12386 {
12387 case 158: // 'insensitive'
12388 shiftT(158); // 'insensitive'
12389 break;
12390 default:
12391 shiftT(230); // 'sensitive'
12392 }
12393 break;
12394 case 177: // 'lowercase'
12395 shiftT(177); // 'lowercase'
12396 break;
12397 default:
12398 shiftT(258); // 'uppercase'
12399 }
12400 }
12401
12402 function parse_FTDiacriticsOption()
12403 {
12404 eventHandler.startNonterminal("FTDiacriticsOption", e0);
12405 shift(114); // 'diacritics'
12406 lookahead1W(124); // S^WS | '(:' | 'insensitive' | 'sensitive'
12407 switch (l1)
12408 {
12409 case 158: // 'insensitive'
12410 shift(158); // 'insensitive'
12411 break;
12412 default:
12413 shift(230); // 'sensitive'
12414 }
12415 eventHandler.endNonterminal("FTDiacriticsOption", e0);
12416 }
12417
12418 function try_FTDiacriticsOption()
12419 {
12420 shiftT(114); // 'diacritics'
12421 lookahead1W(124); // S^WS | '(:' | 'insensitive' | 'sensitive'
12422 switch (l1)
12423 {
12424 case 158: // 'insensitive'
12425 shiftT(158); // 'insensitive'
12426 break;
12427 default:
12428 shiftT(230); // 'sensitive'
12429 }
12430 }
12431
12432 function parse_FTStemOption()
12433 {
12434 eventHandler.startNonterminal("FTStemOption", e0);
12435 switch (l1)
12436 {
12437 case 238: // 'stemming'
12438 shift(238); // 'stemming'
12439 break;
12440 default:
12441 shift(188); // 'no'
12442 lookahead1W(74); // S^WS | '(:' | 'stemming'
12443 shift(238); // 'stemming'
12444 }
12445 eventHandler.endNonterminal("FTStemOption", e0);
12446 }
12447
12448 function try_FTStemOption()
12449 {
12450 switch (l1)
12451 {
12452 case 238: // 'stemming'
12453 shiftT(238); // 'stemming'
12454 break;
12455 default:
12456 shiftT(188); // 'no'
12457 lookahead1W(74); // S^WS | '(:' | 'stemming'
12458 shiftT(238); // 'stemming'
12459 }
12460 }
12461
12462 function parse_FTThesaurusOption()
12463 {
12464 eventHandler.startNonterminal("FTThesaurusOption", e0);
12465 switch (l1)
12466 {
12467 case 246: // 'thesaurus'
12468 shift(246); // 'thesaurus'
12469 lookahead1W(142); // S^WS | '(' | '(:' | 'at' | 'default'
12470 switch (l1)
12471 {
12472 case 81: // 'at'
12473 whitespace();
12474 parse_FTThesaurusID();
12475 break;
12476 case 109: // 'default'
12477 shift(109); // 'default'
12478 break;
12479 default:
12480 shift(34); // '('
12481 lookahead1W(112); // S^WS | '(:' | 'at' | 'default'
12482 switch (l1)
12483 {
12484 case 81: // 'at'
12485 whitespace();
12486 parse_FTThesaurusID();
12487 break;
12488 default:
12489 shift(109); // 'default'
12490 }
12491 for (;;)
12492 {
12493 lookahead1W(101); // S^WS | '(:' | ')' | ','
12494 if (l1 != 41) // ','
12495 {
12496 break;
12497 }
12498 shift(41); // ','
12499 lookahead1W(31); // S^WS | '(:' | 'at'
12500 whitespace();
12501 parse_FTThesaurusID();
12502 }
12503 shift(37); // ')'
12504 }
12505 break;
12506 default:
12507 shift(188); // 'no'
12508 lookahead1W(78); // S^WS | '(:' | 'thesaurus'
12509 shift(246); // 'thesaurus'
12510 }
12511 eventHandler.endNonterminal("FTThesaurusOption", e0);
12512 }
12513
12514 function try_FTThesaurusOption()
12515 {
12516 switch (l1)
12517 {
12518 case 246: // 'thesaurus'
12519 shiftT(246); // 'thesaurus'
12520 lookahead1W(142); // S^WS | '(' | '(:' | 'at' | 'default'
12521 switch (l1)
12522 {
12523 case 81: // 'at'
12524 try_FTThesaurusID();
12525 break;
12526 case 109: // 'default'
12527 shiftT(109); // 'default'
12528 break;
12529 default:
12530 shiftT(34); // '('
12531 lookahead1W(112); // S^WS | '(:' | 'at' | 'default'
12532 switch (l1)
12533 {
12534 case 81: // 'at'
12535 try_FTThesaurusID();
12536 break;
12537 default:
12538 shiftT(109); // 'default'
12539 }
12540 for (;;)
12541 {
12542 lookahead1W(101); // S^WS | '(:' | ')' | ','
12543 if (l1 != 41) // ','
12544 {
12545 break;
12546 }
12547 shiftT(41); // ','
12548 lookahead1W(31); // S^WS | '(:' | 'at'
12549 try_FTThesaurusID();
12550 }
12551 shiftT(37); // ')'
12552 }
12553 break;
12554 default:
12555 shiftT(188); // 'no'
12556 lookahead1W(78); // S^WS | '(:' | 'thesaurus'
12557 shiftT(246); // 'thesaurus'
12558 }
12559 }
12560
12561 function parse_FTThesaurusID()
12562 {
12563 eventHandler.startNonterminal("FTThesaurusID", e0);
12564 shift(81); // 'at'
12565 lookahead1W(15); // URILiteral | S^WS | '(:'
12566 shift(7); // URILiteral
12567 lookahead1W(220); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
12568 if (l1 == 217) // 'relationship'
12569 {
12570 shift(217); // 'relationship'
12571 lookahead1W(17); // StringLiteral | S^WS | '(:'
12572 shift(11); // StringLiteral
12573 }
12574 lookahead1W(216); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
12575 switch (l1)
12576 {
12577 case 81: // 'at'
12578 lookahead2W(165); // S^WS | '(:' | 'end' | 'least' | 'most' | 'position' | 'start'
12579 break;
12580 default:
12581 lk = l1;
12582 }
12583 if (lk == 130 // 'exactly'
12584 || lk == 140 // 'from'
12585 || lk == 88657 // 'at' 'least'
12586 || lk == 93777) // 'at' 'most'
12587 {
12588 whitespace();
12589 parse_FTLiteralRange();
12590 lookahead1W(58); // S^WS | '(:' | 'levels'
12591 shift(175); // 'levels'
12592 }
12593 eventHandler.endNonterminal("FTThesaurusID", e0);
12594 }
12595
12596 function try_FTThesaurusID()
12597 {
12598 shiftT(81); // 'at'
12599 lookahead1W(15); // URILiteral | S^WS | '(:'
12600 shiftT(7); // URILiteral
12601 lookahead1W(220); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
12602 if (l1 == 217) // 'relationship'
12603 {
12604 shiftT(217); // 'relationship'
12605 lookahead1W(17); // StringLiteral | S^WS | '(:'
12606 shiftT(11); // StringLiteral
12607 }
12608 lookahead1W(216); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
12609 switch (l1)
12610 {
12611 case 81: // 'at'
12612 lookahead2W(165); // S^WS | '(:' | 'end' | 'least' | 'most' | 'position' | 'start'
12613 break;
12614 default:
12615 lk = l1;
12616 }
12617 if (lk == 130 // 'exactly'
12618 || lk == 140 // 'from'
12619 || lk == 88657 // 'at' 'least'
12620 || lk == 93777) // 'at' 'most'
12621 {
12622 try_FTLiteralRange();
12623 lookahead1W(58); // S^WS | '(:' | 'levels'
12624 shiftT(175); // 'levels'
12625 }
12626 }
12627
12628 function parse_FTLiteralRange()
12629 {
12630 eventHandler.startNonterminal("FTLiteralRange", e0);
12631 switch (l1)
12632 {
12633 case 130: // 'exactly'
12634 shift(130); // 'exactly'
12635 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
12636 shift(8); // IntegerLiteral
12637 break;
12638 case 81: // 'at'
12639 shift(81); // 'at'
12640 lookahead1W(125); // S^WS | '(:' | 'least' | 'most'
12641 switch (l1)
12642 {
12643 case 173: // 'least'
12644 shift(173); // 'least'
12645 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
12646 shift(8); // IntegerLiteral
12647 break;
12648 default:
12649 shift(183); // 'most'
12650 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
12651 shift(8); // IntegerLiteral
12652 }
12653 break;
12654 default:
12655 shift(140); // 'from'
12656 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
12657 shift(8); // IntegerLiteral
12658 lookahead1W(79); // S^WS | '(:' | 'to'
12659 shift(248); // 'to'
12660 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
12661 shift(8); // IntegerLiteral
12662 }
12663 eventHandler.endNonterminal("FTLiteralRange", e0);
12664 }
12665
12666 function try_FTLiteralRange()
12667 {
12668 switch (l1)
12669 {
12670 case 130: // 'exactly'
12671 shiftT(130); // 'exactly'
12672 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
12673 shiftT(8); // IntegerLiteral
12674 break;
12675 case 81: // 'at'
12676 shiftT(81); // 'at'
12677 lookahead1W(125); // S^WS | '(:' | 'least' | 'most'
12678 switch (l1)
12679 {
12680 case 173: // 'least'
12681 shiftT(173); // 'least'
12682 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
12683 shiftT(8); // IntegerLiteral
12684 break;
12685 default:
12686 shiftT(183); // 'most'
12687 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
12688 shiftT(8); // IntegerLiteral
12689 }
12690 break;
12691 default:
12692 shiftT(140); // 'from'
12693 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
12694 shiftT(8); // IntegerLiteral
12695 lookahead1W(79); // S^WS | '(:' | 'to'
12696 shiftT(248); // 'to'
12697 lookahead1W(16); // IntegerLiteral | S^WS | '(:'
12698 shiftT(8); // IntegerLiteral
12699 }
12700 }
12701
12702 function parse_FTStopWordOption()
12703 {
12704 eventHandler.startNonterminal("FTStopWordOption", e0);
12705 switch (l1)
12706 {
12707 case 239: // 'stop'
12708 shift(239); // 'stop'
12709 lookahead1W(86); // S^WS | '(:' | 'words'
12710 shift(273); // 'words'
12711 lookahead1W(142); // S^WS | '(' | '(:' | 'at' | 'default'
12712 switch (l1)
12713 {
12714 case 109: // 'default'
12715 shift(109); // 'default'
12716 for (;;)
12717 {
12718 lookahead1W(217); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
12719 if (l1 != 131 // 'except'
12720 && l1 != 254) // 'union'
12721 {
12722 break;
12723 }
12724 whitespace();
12725 parse_FTStopWordsInclExcl();
12726 }
12727 break;
12728 default:
12729 whitespace();
12730 parse_FTStopWords();
12731 for (;;)
12732 {
12733 lookahead1W(217); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
12734 if (l1 != 131 // 'except'
12735 && l1 != 254) // 'union'
12736 {
12737 break;
12738 }
12739 whitespace();
12740 parse_FTStopWordsInclExcl();
12741 }
12742 }
12743 break;
12744 default:
12745 shift(188); // 'no'
12746 lookahead1W(75); // S^WS | '(:' | 'stop'
12747 shift(239); // 'stop'
12748 lookahead1W(86); // S^WS | '(:' | 'words'
12749 shift(273); // 'words'
12750 }
12751 eventHandler.endNonterminal("FTStopWordOption", e0);
12752 }
12753
12754 function try_FTStopWordOption()
12755 {
12756 switch (l1)
12757 {
12758 case 239: // 'stop'
12759 shiftT(239); // 'stop'
12760 lookahead1W(86); // S^WS | '(:' | 'words'
12761 shiftT(273); // 'words'
12762 lookahead1W(142); // S^WS | '(' | '(:' | 'at' | 'default'
12763 switch (l1)
12764 {
12765 case 109: // 'default'
12766 shiftT(109); // 'default'
12767 for (;;)
12768 {
12769 lookahead1W(217); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
12770 if (l1 != 131 // 'except'
12771 && l1 != 254) // 'union'
12772 {
12773 break;
12774 }
12775 try_FTStopWordsInclExcl();
12776 }
12777 break;
12778 default:
12779 try_FTStopWords();
12780 for (;;)
12781 {
12782 lookahead1W(217); // S^WS | EOF | '!=' | '(:' | ')' | ',' | ':' | ';' | '<' | '<<' | '<=' | '=' |
12783 if (l1 != 131 // 'except'
12784 && l1 != 254) // 'union'
12785 {
12786 break;
12787 }
12788 try_FTStopWordsInclExcl();
12789 }
12790 }
12791 break;
12792 default:
12793 shiftT(188); // 'no'
12794 lookahead1W(75); // S^WS | '(:' | 'stop'
12795 shiftT(239); // 'stop'
12796 lookahead1W(86); // S^WS | '(:' | 'words'
12797 shiftT(273); // 'words'
12798 }
12799 }
12800
12801 function parse_FTStopWords()
12802 {
12803 eventHandler.startNonterminal("FTStopWords", e0);
12804 switch (l1)
12805 {
12806 case 81: // 'at'
12807 shift(81); // 'at'
12808 lookahead1W(15); // URILiteral | S^WS | '(:'
12809 shift(7); // URILiteral
12810 break;
12811 default:
12812 shift(34); // '('
12813 lookahead1W(17); // StringLiteral | S^WS | '(:'
12814 shift(11); // StringLiteral
12815 for (;;)
12816 {
12817 lookahead1W(101); // S^WS | '(:' | ')' | ','
12818 if (l1 != 41) // ','
12819 {
12820 break;
12821 }
12822 shift(41); // ','
12823 lookahead1W(17); // StringLiteral | S^WS | '(:'
12824 shift(11); // StringLiteral
12825 }
12826 shift(37); // ')'
12827 }
12828 eventHandler.endNonterminal("FTStopWords", e0);
12829 }
12830
12831 function try_FTStopWords()
12832 {
12833 switch (l1)
12834 {
12835 case 81: // 'at'
12836 shiftT(81); // 'at'
12837 lookahead1W(15); // URILiteral | S^WS | '(:'
12838 shiftT(7); // URILiteral
12839 break;
12840 default:
12841 shiftT(34); // '('
12842 lookahead1W(17); // StringLiteral | S^WS | '(:'
12843 shiftT(11); // StringLiteral
12844 for (;;)
12845 {
12846 lookahead1W(101); // S^WS | '(:' | ')' | ','
12847 if (l1 != 41) // ','
12848 {
12849 break;
12850 }
12851 shiftT(41); // ','
12852 lookahead1W(17); // StringLiteral | S^WS | '(:'
12853 shiftT(11); // StringLiteral
12854 }
12855 shiftT(37); // ')'
12856 }
12857 }
12858
12859 function parse_FTStopWordsInclExcl()
12860 {
12861 eventHandler.startNonterminal("FTStopWordsInclExcl", e0);
12862 switch (l1)
12863 {
12864 case 254: // 'union'
12865 shift(254); // 'union'
12866 break;
12867 default:
12868 shift(131); // 'except'
12869 }
12870 lookahead1W(99); // S^WS | '(' | '(:' | 'at'
12871 whitespace();
12872 parse_FTStopWords();
12873 eventHandler.endNonterminal("FTStopWordsInclExcl", e0);
12874 }
12875
12876 function try_FTStopWordsInclExcl()
12877 {
12878 switch (l1)
12879 {
12880 case 254: // 'union'
12881 shiftT(254); // 'union'
12882 break;
12883 default:
12884 shiftT(131); // 'except'
12885 }
12886 lookahead1W(99); // S^WS | '(' | '(:' | 'at'
12887 try_FTStopWords();
12888 }
12889
12890 function parse_FTLanguageOption()
12891 {
12892 eventHandler.startNonterminal("FTLanguageOption", e0);
12893 shift(169); // 'language'
12894 lookahead1W(17); // StringLiteral | S^WS | '(:'
12895 shift(11); // StringLiteral
12896 eventHandler.endNonterminal("FTLanguageOption", e0);
12897 }
12898
12899 function try_FTLanguageOption()
12900 {
12901 shiftT(169); // 'language'
12902 lookahead1W(17); // StringLiteral | S^WS | '(:'
12903 shiftT(11); // StringLiteral
12904 }
12905
12906 function parse_FTWildCardOption()
12907 {
12908 eventHandler.startNonterminal("FTWildCardOption", e0);
12909 switch (l1)
12910 {
12911 case 268: // 'wildcards'
12912 shift(268); // 'wildcards'
12913 break;
12914 default:
12915 shift(188); // 'no'
12916 lookahead1W(84); // S^WS | '(:' | 'wildcards'
12917 shift(268); // 'wildcards'
12918 }
12919 eventHandler.endNonterminal("FTWildCardOption", e0);
12920 }
12921
12922 function try_FTWildCardOption()
12923 {
12924 switch (l1)
12925 {
12926 case 268: // 'wildcards'
12927 shiftT(268); // 'wildcards'
12928 break;
12929 default:
12930 shiftT(188); // 'no'
12931 lookahead1W(84); // S^WS | '(:' | 'wildcards'
12932 shiftT(268); // 'wildcards'
12933 }
12934 }
12935
12936 function parse_FTExtensionOption()
12937 {
12938 eventHandler.startNonterminal("FTExtensionOption", e0);
12939 shift(199); // 'option'
12940 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
12941 whitespace();
12942 parse_EQName();
12943 lookahead1W(17); // StringLiteral | S^WS | '(:'
12944 shift(11); // StringLiteral
12945 eventHandler.endNonterminal("FTExtensionOption", e0);
12946 }
12947
12948 function try_FTExtensionOption()
12949 {
12950 shiftT(199); // 'option'
12951 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
12952 try_EQName();
12953 lookahead1W(17); // StringLiteral | S^WS | '(:'
12954 shiftT(11); // StringLiteral
12955 }
12956
12957 function parse_FTIgnoreOption()
12958 {
12959 eventHandler.startNonterminal("FTIgnoreOption", e0);
12960 shift(271); // 'without'
12961 lookahead1W(42); // S^WS | '(:' | 'content'
12962 shift(100); // 'content'
12963 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
12964 whitespace();
12965 parse_UnionExpr();
12966 eventHandler.endNonterminal("FTIgnoreOption", e0);
12967 }
12968
12969 function try_FTIgnoreOption()
12970 {
12971 shiftT(271); // 'without'
12972 lookahead1W(42); // S^WS | '(:' | 'content'
12973 shiftT(100); // 'content'
12974 lookahead1W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
12975 try_UnionExpr();
12976 }
12977
12978 function parse_CollectionDecl()
12979 {
12980 eventHandler.startNonterminal("CollectionDecl", e0);
12981 shift(95); // 'collection'
12982 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
12983 whitespace();
12984 parse_EQName();
12985 lookahead1W(107); // S^WS | '(:' | ';' | 'as'
12986 if (l1 == 79) // 'as'
12987 {
12988 whitespace();
12989 parse_CollectionTypeDecl();
12990 }
12991 eventHandler.endNonterminal("CollectionDecl", e0);
12992 }
12993
12994 function parse_CollectionTypeDecl()
12995 {
12996 eventHandler.startNonterminal("CollectionTypeDecl", e0);
12997 shift(79); // 'as'
12998 lookahead1W(183); // S^WS | '(:' | 'array' | 'attribute' | 'comment' | 'document-node' | 'element' |
12999 whitespace();
13000 parse_KindTest();
13001 lookahead1W(156); // S^WS | '(:' | '*' | '+' | ';' | '?'
13002 if (l1 != 53) // ';'
13003 {
13004 whitespace();
13005 parse_OccurrenceIndicator();
13006 }
13007 eventHandler.endNonterminal("CollectionTypeDecl", e0);
13008 }
13009
13010 function parse_IndexName()
13011 {
13012 eventHandler.startNonterminal("IndexName", e0);
13013 parse_EQName();
13014 eventHandler.endNonterminal("IndexName", e0);
13015 }
13016
13017 function parse_IndexDomainExpr()
13018 {
13019 eventHandler.startNonterminal("IndexDomainExpr", e0);
13020 parse_PathExpr();
13021 eventHandler.endNonterminal("IndexDomainExpr", e0);
13022 }
13023
13024 function parse_IndexKeySpec()
13025 {
13026 eventHandler.startNonterminal("IndexKeySpec", e0);
13027 parse_IndexKeyExpr();
13028 if (l1 == 79) // 'as'
13029 {
13030 whitespace();
13031 parse_IndexKeyTypeDecl();
13032 }
13033 lookahead1W(146); // S^WS | '(:' | ',' | ';' | 'collation'
13034 if (l1 == 94) // 'collation'
13035 {
13036 whitespace();
13037 parse_IndexKeyCollation();
13038 }
13039 eventHandler.endNonterminal("IndexKeySpec", e0);
13040 }
13041
13042 function parse_IndexKeyExpr()
13043 {
13044 eventHandler.startNonterminal("IndexKeyExpr", e0);
13045 parse_PathExpr();
13046 eventHandler.endNonterminal("IndexKeyExpr", e0);
13047 }
13048
13049 function parse_IndexKeyTypeDecl()
13050 {
13051 eventHandler.startNonterminal("IndexKeyTypeDecl", e0);
13052 shift(79); // 'as'
13053 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
13054 whitespace();
13055 parse_AtomicType();
13056 lookahead1W(169); // S^WS | '(:' | '*' | '+' | ',' | ';' | '?' | 'collation'
13057 if (l1 == 39 // '*'
13058 || l1 == 40 // '+'
13059 || l1 == 64) // '?'
13060 {
13061 whitespace();
13062 parse_OccurrenceIndicator();
13063 }
13064 eventHandler.endNonterminal("IndexKeyTypeDecl", e0);
13065 }
13066
13067 function parse_AtomicType()
13068 {
13069 eventHandler.startNonterminal("AtomicType", e0);
13070 parse_EQName();
13071 eventHandler.endNonterminal("AtomicType", e0);
13072 }
13073
13074 function parse_IndexKeyCollation()
13075 {
13076 eventHandler.startNonterminal("IndexKeyCollation", e0);
13077 shift(94); // 'collation'
13078 lookahead1W(15); // URILiteral | S^WS | '(:'
13079 shift(7); // URILiteral
13080 eventHandler.endNonterminal("IndexKeyCollation", e0);
13081 }
13082
13083 function parse_IndexDecl()
13084 {
13085 eventHandler.startNonterminal("IndexDecl", e0);
13086 shift(155); // 'index'
13087 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
13088 whitespace();
13089 parse_IndexName();
13090 lookahead1W(65); // S^WS | '(:' | 'on'
13091 shift(197); // 'on'
13092 lookahead1W(63); // S^WS | '(:' | 'nodes'
13093 shift(192); // 'nodes'
13094 lookahead1W(264); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
13095 whitespace();
13096 parse_IndexDomainExpr();
13097 shift(87); // 'by'
13098 lookahead1W(264); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
13099 whitespace();
13100 parse_IndexKeySpec();
13101 for (;;)
13102 {
13103 lookahead1W(103); // S^WS | '(:' | ',' | ';'
13104 if (l1 != 41) // ','
13105 {
13106 break;
13107 }
13108 shift(41); // ','
13109 lookahead1W(264); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
13110 whitespace();
13111 parse_IndexKeySpec();
13112 }
13113 eventHandler.endNonterminal("IndexDecl", e0);
13114 }
13115
13116 function parse_ICDecl()
13117 {
13118 eventHandler.startNonterminal("ICDecl", e0);
13119 shift(161); // 'integrity'
13120 lookahead1W(40); // S^WS | '(:' | 'constraint'
13121 shift(97); // 'constraint'
13122 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
13123 whitespace();
13124 parse_EQName();
13125 lookahead1W(120); // S^WS | '(:' | 'foreign' | 'on'
13126 switch (l1)
13127 {
13128 case 197: // 'on'
13129 whitespace();
13130 parse_ICCollection();
13131 break;
13132 default:
13133 whitespace();
13134 parse_ICForeignKey();
13135 }
13136 eventHandler.endNonterminal("ICDecl", e0);
13137 }
13138
13139 function parse_ICCollection()
13140 {
13141 eventHandler.startNonterminal("ICCollection", e0);
13142 shift(197); // 'on'
13143 lookahead1W(39); // S^WS | '(:' | 'collection'
13144 shift(95); // 'collection'
13145 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
13146 whitespace();
13147 parse_EQName();
13148 lookahead1W(140); // S^WS | '$' | '(:' | 'foreach' | 'node'
13149 switch (l1)
13150 {
13151 case 31: // '$'
13152 whitespace();
13153 parse_ICCollSequence();
13154 break;
13155 case 191: // 'node'
13156 whitespace();
13157 parse_ICCollSequenceUnique();
13158 break;
13159 default:
13160 whitespace();
13161 parse_ICCollNode();
13162 }
13163 eventHandler.endNonterminal("ICCollection", e0);
13164 }
13165
13166 function parse_ICCollSequence()
13167 {
13168 eventHandler.startNonterminal("ICCollSequence", e0);
13169 parse_VarRef();
13170 lookahead1W(37); // S^WS | '(:' | 'check'
13171 shift(92); // 'check'
13172 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
13173 whitespace();
13174 parse_ExprSingle();
13175 eventHandler.endNonterminal("ICCollSequence", e0);
13176 }
13177
13178 function parse_ICCollSequenceUnique()
13179 {
13180 eventHandler.startNonterminal("ICCollSequenceUnique", e0);
13181 shift(191); // 'node'
13182 lookahead1W(21); // S^WS | '$' | '(:'
13183 whitespace();
13184 parse_VarRef();
13185 lookahead1W(37); // S^WS | '(:' | 'check'
13186 shift(92); // 'check'
13187 lookahead1W(80); // S^WS | '(:' | 'unique'
13188 shift(255); // 'unique'
13189 lookahead1W(57); // S^WS | '(:' | 'key'
13190 shift(168); // 'key'
13191 lookahead1W(264); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
13192 whitespace();
13193 parse_PathExpr();
13194 eventHandler.endNonterminal("ICCollSequenceUnique", e0);
13195 }
13196
13197 function parse_ICCollNode()
13198 {
13199 eventHandler.startNonterminal("ICCollNode", e0);
13200 shift(138); // 'foreach'
13201 lookahead1W(62); // S^WS | '(:' | 'node'
13202 shift(191); // 'node'
13203 lookahead1W(21); // S^WS | '$' | '(:'
13204 whitespace();
13205 parse_VarRef();
13206 lookahead1W(37); // S^WS | '(:' | 'check'
13207 shift(92); // 'check'
13208 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
13209 whitespace();
13210 parse_ExprSingle();
13211 eventHandler.endNonterminal("ICCollNode", e0);
13212 }
13213
13214 function parse_ICForeignKey()
13215 {
13216 eventHandler.startNonterminal("ICForeignKey", e0);
13217 shift(139); // 'foreign'
13218 lookahead1W(57); // S^WS | '(:' | 'key'
13219 shift(168); // 'key'
13220 lookahead1W(51); // S^WS | '(:' | 'from'
13221 whitespace();
13222 parse_ICForeignKeySource();
13223 whitespace();
13224 parse_ICForeignKeyTarget();
13225 eventHandler.endNonterminal("ICForeignKey", e0);
13226 }
13227
13228 function parse_ICForeignKeySource()
13229 {
13230 eventHandler.startNonterminal("ICForeignKeySource", e0);
13231 shift(140); // 'from'
13232 lookahead1W(39); // S^WS | '(:' | 'collection'
13233 whitespace();
13234 parse_ICForeignKeyValues();
13235 eventHandler.endNonterminal("ICForeignKeySource", e0);
13236 }
13237
13238 function parse_ICForeignKeyTarget()
13239 {
13240 eventHandler.startNonterminal("ICForeignKeyTarget", e0);
13241 shift(248); // 'to'
13242 lookahead1W(39); // S^WS | '(:' | 'collection'
13243 whitespace();
13244 parse_ICForeignKeyValues();
13245 eventHandler.endNonterminal("ICForeignKeyTarget", e0);
13246 }
13247
13248 function parse_ICForeignKeyValues()
13249 {
13250 eventHandler.startNonterminal("ICForeignKeyValues", e0);
13251 shift(95); // 'collection'
13252 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
13253 whitespace();
13254 parse_EQName();
13255 lookahead1W(62); // S^WS | '(:' | 'node'
13256 shift(191); // 'node'
13257 lookahead1W(21); // S^WS | '$' | '(:'
13258 whitespace();
13259 parse_VarRef();
13260 lookahead1W(57); // S^WS | '(:' | 'key'
13261 shift(168); // 'key'
13262 lookahead1W(264); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
13263 whitespace();
13264 parse_PathExpr();
13265 eventHandler.endNonterminal("ICForeignKeyValues", e0);
13266 }
13267
13268 function try_Comment()
13269 {
13270 shiftT(36); // '(:'
13271 for (;;)
13272 {
13273 lookahead1(89); // CommentContents | '(:' | ':)'
13274 if (l1 == 50) // ':)'
13275 {
13276 break;
13277 }
13278 switch (l1)
13279 {
13280 case 24: // CommentContents
13281 shiftT(24); // CommentContents
13282 break;
13283 default:
13284 try_Comment();
13285 }
13286 }
13287 shiftT(50); // ':)'
13288 }
13289
13290 function try_Whitespace()
13291 {
13292 switch (l1)
13293 {
13294 case 22: // S^WS
13295 shiftT(22); // S^WS
13296 break;
13297 default:
13298 try_Comment();
13299 }
13300 }
13301
13302 function parse_EQName()
13303 {
13304 eventHandler.startNonterminal("EQName", e0);
13305 lookahead1(248); // EQName^Token | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' | 'and' |
13306 switch (l1)
13307 {
13308 case 82: // 'attribute'
13309 shift(82); // 'attribute'
13310 break;
13311 case 96: // 'comment'
13312 shift(96); // 'comment'
13313 break;
13314 case 120: // 'document-node'
13315 shift(120); // 'document-node'
13316 break;
13317 case 121: // 'element'
13318 shift(121); // 'element'
13319 break;
13320 case 124: // 'empty-sequence'
13321 shift(124); // 'empty-sequence'
13322 break;
13323 case 145: // 'function'
13324 shift(145); // 'function'
13325 break;
13326 case 152: // 'if'
13327 shift(152); // 'if'
13328 break;
13329 case 165: // 'item'
13330 shift(165); // 'item'
13331 break;
13332 case 185: // 'namespace-node'
13333 shift(185); // 'namespace-node'
13334 break;
13335 case 191: // 'node'
13336 shift(191); // 'node'
13337 break;
13338 case 216: // 'processing-instruction'
13339 shift(216); // 'processing-instruction'
13340 break;
13341 case 226: // 'schema-attribute'
13342 shift(226); // 'schema-attribute'
13343 break;
13344 case 227: // 'schema-element'
13345 shift(227); // 'schema-element'
13346 break;
13347 case 243: // 'switch'
13348 shift(243); // 'switch'
13349 break;
13350 case 244: // 'text'
13351 shift(244); // 'text'
13352 break;
13353 case 253: // 'typeswitch'
13354 shift(253); // 'typeswitch'
13355 break;
13356 default:
13357 parse_FunctionName();
13358 }
13359 eventHandler.endNonterminal("EQName", e0);
13360 }
13361
13362 function try_EQName()
13363 {
13364 lookahead1(248); // EQName^Token | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' | 'and' |
13365 switch (l1)
13366 {
13367 case 82: // 'attribute'
13368 shiftT(82); // 'attribute'
13369 break;
13370 case 96: // 'comment'
13371 shiftT(96); // 'comment'
13372 break;
13373 case 120: // 'document-node'
13374 shiftT(120); // 'document-node'
13375 break;
13376 case 121: // 'element'
13377 shiftT(121); // 'element'
13378 break;
13379 case 124: // 'empty-sequence'
13380 shiftT(124); // 'empty-sequence'
13381 break;
13382 case 145: // 'function'
13383 shiftT(145); // 'function'
13384 break;
13385 case 152: // 'if'
13386 shiftT(152); // 'if'
13387 break;
13388 case 165: // 'item'
13389 shiftT(165); // 'item'
13390 break;
13391 case 185: // 'namespace-node'
13392 shiftT(185); // 'namespace-node'
13393 break;
13394 case 191: // 'node'
13395 shiftT(191); // 'node'
13396 break;
13397 case 216: // 'processing-instruction'
13398 shiftT(216); // 'processing-instruction'
13399 break;
13400 case 226: // 'schema-attribute'
13401 shiftT(226); // 'schema-attribute'
13402 break;
13403 case 227: // 'schema-element'
13404 shiftT(227); // 'schema-element'
13405 break;
13406 case 243: // 'switch'
13407 shiftT(243); // 'switch'
13408 break;
13409 case 244: // 'text'
13410 shiftT(244); // 'text'
13411 break;
13412 case 253: // 'typeswitch'
13413 shiftT(253); // 'typeswitch'
13414 break;
13415 default:
13416 try_FunctionName();
13417 }
13418 }
13419
13420 function parse_FunctionName()
13421 {
13422 eventHandler.startNonterminal("FunctionName", e0);
13423 switch (l1)
13424 {
13425 case 6: // EQName^Token
13426 shift(6); // EQName^Token
13427 break;
13428 case 70: // 'after'
13429 shift(70); // 'after'
13430 break;
13431 case 73: // 'ancestor'
13432 shift(73); // 'ancestor'
13433 break;
13434 case 74: // 'ancestor-or-self'
13435 shift(74); // 'ancestor-or-self'
13436 break;
13437 case 75: // 'and'
13438 shift(75); // 'and'
13439 break;
13440 case 79: // 'as'
13441 shift(79); // 'as'
13442 break;
13443 case 80: // 'ascending'
13444 shift(80); // 'ascending'
13445 break;
13446 case 84: // 'before'
13447 shift(84); // 'before'
13448 break;
13449 case 88: // 'case'
13450 shift(88); // 'case'
13451 break;
13452 case 89: // 'cast'
13453 shift(89); // 'cast'
13454 break;
13455 case 90: // 'castable'
13456 shift(90); // 'castable'
13457 break;
13458 case 93: // 'child'
13459 shift(93); // 'child'
13460 break;
13461 case 94: // 'collation'
13462 shift(94); // 'collation'
13463 break;
13464 case 103: // 'copy'
13465 shift(103); // 'copy'
13466 break;
13467 case 105: // 'count'
13468 shift(105); // 'count'
13469 break;
13470 case 108: // 'declare'
13471 shift(108); // 'declare'
13472 break;
13473 case 109: // 'default'
13474 shift(109); // 'default'
13475 break;
13476 case 110: // 'delete'
13477 shift(110); // 'delete'
13478 break;
13479 case 111: // 'descendant'
13480 shift(111); // 'descendant'
13481 break;
13482 case 112: // 'descendant-or-self'
13483 shift(112); // 'descendant-or-self'
13484 break;
13485 case 113: // 'descending'
13486 shift(113); // 'descending'
13487 break;
13488 case 118: // 'div'
13489 shift(118); // 'div'
13490 break;
13491 case 119: // 'document'
13492 shift(119); // 'document'
13493 break;
13494 case 122: // 'else'
13495 shift(122); // 'else'
13496 break;
13497 case 123: // 'empty'
13498 shift(123); // 'empty'
13499 break;
13500 case 126: // 'end'
13501 shift(126); // 'end'
13502 break;
13503 case 128: // 'eq'
13504 shift(128); // 'eq'
13505 break;
13506 case 129: // 'every'
13507 shift(129); // 'every'
13508 break;
13509 case 131: // 'except'
13510 shift(131); // 'except'
13511 break;
13512 case 134: // 'first'
13513 shift(134); // 'first'
13514 break;
13515 case 135: // 'following'
13516 shift(135); // 'following'
13517 break;
13518 case 136: // 'following-sibling'
13519 shift(136); // 'following-sibling'
13520 break;
13521 case 137: // 'for'
13522 shift(137); // 'for'
13523 break;
13524 case 146: // 'ge'
13525 shift(146); // 'ge'
13526 break;
13527 case 148: // 'group'
13528 shift(148); // 'group'
13529 break;
13530 case 150: // 'gt'
13531 shift(150); // 'gt'
13532 break;
13533 case 151: // 'idiv'
13534 shift(151); // 'idiv'
13535 break;
13536 case 153: // 'import'
13537 shift(153); // 'import'
13538 break;
13539 case 159: // 'insert'
13540 shift(159); // 'insert'
13541 break;
13542 case 160: // 'instance'
13543 shift(160); // 'instance'
13544 break;
13545 case 162: // 'intersect'
13546 shift(162); // 'intersect'
13547 break;
13548 case 163: // 'into'
13549 shift(163); // 'into'
13550 break;
13551 case 164: // 'is'
13552 shift(164); // 'is'
13553 break;
13554 case 170: // 'last'
13555 shift(170); // 'last'
13556 break;
13557 case 172: // 'le'
13558 shift(172); // 'le'
13559 break;
13560 case 174: // 'let'
13561 shift(174); // 'let'
13562 break;
13563 case 178: // 'lt'
13564 shift(178); // 'lt'
13565 break;
13566 case 180: // 'mod'
13567 shift(180); // 'mod'
13568 break;
13569 case 181: // 'modify'
13570 shift(181); // 'modify'
13571 break;
13572 case 182: // 'module'
13573 shift(182); // 'module'
13574 break;
13575 case 184: // 'namespace'
13576 shift(184); // 'namespace'
13577 break;
13578 case 186: // 'ne'
13579 shift(186); // 'ne'
13580 break;
13581 case 198: // 'only'
13582 shift(198); // 'only'
13583 break;
13584 case 200: // 'or'
13585 shift(200); // 'or'
13586 break;
13587 case 201: // 'order'
13588 shift(201); // 'order'
13589 break;
13590 case 202: // 'ordered'
13591 shift(202); // 'ordered'
13592 break;
13593 case 206: // 'parent'
13594 shift(206); // 'parent'
13595 break;
13596 case 212: // 'preceding'
13597 shift(212); // 'preceding'
13598 break;
13599 case 213: // 'preceding-sibling'
13600 shift(213); // 'preceding-sibling'
13601 break;
13602 case 218: // 'rename'
13603 shift(218); // 'rename'
13604 break;
13605 case 219: // 'replace'
13606 shift(219); // 'replace'
13607 break;
13608 case 220: // 'return'
13609 shift(220); // 'return'
13610 break;
13611 case 224: // 'satisfies'
13612 shift(224); // 'satisfies'
13613 break;
13614 case 229: // 'self'
13615 shift(229); // 'self'
13616 break;
13617 case 235: // 'some'
13618 shift(235); // 'some'
13619 break;
13620 case 236: // 'stable'
13621 shift(236); // 'stable'
13622 break;
13623 case 237: // 'start'
13624 shift(237); // 'start'
13625 break;
13626 case 248: // 'to'
13627 shift(248); // 'to'
13628 break;
13629 case 249: // 'treat'
13630 shift(249); // 'treat'
13631 break;
13632 case 250: // 'try'
13633 shift(250); // 'try'
13634 break;
13635 case 254: // 'union'
13636 shift(254); // 'union'
13637 break;
13638 case 256: // 'unordered'
13639 shift(256); // 'unordered'
13640 break;
13641 case 260: // 'validate'
13642 shift(260); // 'validate'
13643 break;
13644 case 266: // 'where'
13645 shift(266); // 'where'
13646 break;
13647 case 270: // 'with'
13648 shift(270); // 'with'
13649 break;
13650 case 274: // 'xquery'
13651 shift(274); // 'xquery'
13652 break;
13653 case 72: // 'allowing'
13654 shift(72); // 'allowing'
13655 break;
13656 case 81: // 'at'
13657 shift(81); // 'at'
13658 break;
13659 case 83: // 'base-uri'
13660 shift(83); // 'base-uri'
13661 break;
13662 case 85: // 'boundary-space'
13663 shift(85); // 'boundary-space'
13664 break;
13665 case 86: // 'break'
13666 shift(86); // 'break'
13667 break;
13668 case 91: // 'catch'
13669 shift(91); // 'catch'
13670 break;
13671 case 98: // 'construction'
13672 shift(98); // 'construction'
13673 break;
13674 case 101: // 'context'
13675 shift(101); // 'context'
13676 break;
13677 case 102: // 'continue'
13678 shift(102); // 'continue'
13679 break;
13680 case 104: // 'copy-namespaces'
13681 shift(104); // 'copy-namespaces'
13682 break;
13683 case 106: // 'decimal-format'
13684 shift(106); // 'decimal-format'
13685 break;
13686 case 125: // 'encoding'
13687 shift(125); // 'encoding'
13688 break;
13689 case 132: // 'exit'
13690 shift(132); // 'exit'
13691 break;
13692 case 133: // 'external'
13693 shift(133); // 'external'
13694 break;
13695 case 141: // 'ft-option'
13696 shift(141); // 'ft-option'
13697 break;
13698 case 154: // 'in'
13699 shift(154); // 'in'
13700 break;
13701 case 155: // 'index'
13702 shift(155); // 'index'
13703 break;
13704 case 161: // 'integrity'
13705 shift(161); // 'integrity'
13706 break;
13707 case 171: // 'lax'
13708 shift(171); // 'lax'
13709 break;
13710 case 192: // 'nodes'
13711 shift(192); // 'nodes'
13712 break;
13713 case 199: // 'option'
13714 shift(199); // 'option'
13715 break;
13716 case 203: // 'ordering'
13717 shift(203); // 'ordering'
13718 break;
13719 case 222: // 'revalidation'
13720 shift(222); // 'revalidation'
13721 break;
13722 case 225: // 'schema'
13723 shift(225); // 'schema'
13724 break;
13725 case 228: // 'score'
13726 shift(228); // 'score'
13727 break;
13728 case 234: // 'sliding'
13729 shift(234); // 'sliding'
13730 break;
13731 case 240: // 'strict'
13732 shift(240); // 'strict'
13733 break;
13734 case 251: // 'tumbling'
13735 shift(251); // 'tumbling'
13736 break;
13737 case 252: // 'type'
13738 shift(252); // 'type'
13739 break;
13740 case 257: // 'updating'
13741 shift(257); // 'updating'
13742 break;
13743 case 261: // 'value'
13744 shift(261); // 'value'
13745 break;
13746 case 262: // 'variable'
13747 shift(262); // 'variable'
13748 break;
13749 case 263: // 'version'
13750 shift(263); // 'version'
13751 break;
13752 case 267: // 'while'
13753 shift(267); // 'while'
13754 break;
13755 case 97: // 'constraint'
13756 shift(97); // 'constraint'
13757 break;
13758 case 176: // 'loop'
13759 shift(176); // 'loop'
13760 break;
13761 case 221: // 'returning'
13762 shift(221); // 'returning'
13763 break;
13764 case 194: // 'object'
13765 shift(194); // 'object'
13766 break;
13767 case 167: // 'json-item'
13768 shift(167); // 'json-item'
13769 break;
13770 default:
13771 shift(78); // 'array'
13772 }
13773 eventHandler.endNonterminal("FunctionName", e0);
13774 }
13775
13776 function try_FunctionName()
13777 {
13778 switch (l1)
13779 {
13780 case 6: // EQName^Token
13781 shiftT(6); // EQName^Token
13782 break;
13783 case 70: // 'after'
13784 shiftT(70); // 'after'
13785 break;
13786 case 73: // 'ancestor'
13787 shiftT(73); // 'ancestor'
13788 break;
13789 case 74: // 'ancestor-or-self'
13790 shiftT(74); // 'ancestor-or-self'
13791 break;
13792 case 75: // 'and'
13793 shiftT(75); // 'and'
13794 break;
13795 case 79: // 'as'
13796 shiftT(79); // 'as'
13797 break;
13798 case 80: // 'ascending'
13799 shiftT(80); // 'ascending'
13800 break;
13801 case 84: // 'before'
13802 shiftT(84); // 'before'
13803 break;
13804 case 88: // 'case'
13805 shiftT(88); // 'case'
13806 break;
13807 case 89: // 'cast'
13808 shiftT(89); // 'cast'
13809 break;
13810 case 90: // 'castable'
13811 shiftT(90); // 'castable'
13812 break;
13813 case 93: // 'child'
13814 shiftT(93); // 'child'
13815 break;
13816 case 94: // 'collation'
13817 shiftT(94); // 'collation'
13818 break;
13819 case 103: // 'copy'
13820 shiftT(103); // 'copy'
13821 break;
13822 case 105: // 'count'
13823 shiftT(105); // 'count'
13824 break;
13825 case 108: // 'declare'
13826 shiftT(108); // 'declare'
13827 break;
13828 case 109: // 'default'
13829 shiftT(109); // 'default'
13830 break;
13831 case 110: // 'delete'
13832 shiftT(110); // 'delete'
13833 break;
13834 case 111: // 'descendant'
13835 shiftT(111); // 'descendant'
13836 break;
13837 case 112: // 'descendant-or-self'
13838 shiftT(112); // 'descendant-or-self'
13839 break;
13840 case 113: // 'descending'
13841 shiftT(113); // 'descending'
13842 break;
13843 case 118: // 'div'
13844 shiftT(118); // 'div'
13845 break;
13846 case 119: // 'document'
13847 shiftT(119); // 'document'
13848 break;
13849 case 122: // 'else'
13850 shiftT(122); // 'else'
13851 break;
13852 case 123: // 'empty'
13853 shiftT(123); // 'empty'
13854 break;
13855 case 126: // 'end'
13856 shiftT(126); // 'end'
13857 break;
13858 case 128: // 'eq'
13859 shiftT(128); // 'eq'
13860 break;
13861 case 129: // 'every'
13862 shiftT(129); // 'every'
13863 break;
13864 case 131: // 'except'
13865 shiftT(131); // 'except'
13866 break;
13867 case 134: // 'first'
13868 shiftT(134); // 'first'
13869 break;
13870 case 135: // 'following'
13871 shiftT(135); // 'following'
13872 break;
13873 case 136: // 'following-sibling'
13874 shiftT(136); // 'following-sibling'
13875 break;
13876 case 137: // 'for'
13877 shiftT(137); // 'for'
13878 break;
13879 case 146: // 'ge'
13880 shiftT(146); // 'ge'
13881 break;
13882 case 148: // 'group'
13883 shiftT(148); // 'group'
13884 break;
13885 case 150: // 'gt'
13886 shiftT(150); // 'gt'
13887 break;
13888 case 151: // 'idiv'
13889 shiftT(151); // 'idiv'
13890 break;
13891 case 153: // 'import'
13892 shiftT(153); // 'import'
13893 break;
13894 case 159: // 'insert'
13895 shiftT(159); // 'insert'
13896 break;
13897 case 160: // 'instance'
13898 shiftT(160); // 'instance'
13899 break;
13900 case 162: // 'intersect'
13901 shiftT(162); // 'intersect'
13902 break;
13903 case 163: // 'into'
13904 shiftT(163); // 'into'
13905 break;
13906 case 164: // 'is'
13907 shiftT(164); // 'is'
13908 break;
13909 case 170: // 'last'
13910 shiftT(170); // 'last'
13911 break;
13912 case 172: // 'le'
13913 shiftT(172); // 'le'
13914 break;
13915 case 174: // 'let'
13916 shiftT(174); // 'let'
13917 break;
13918 case 178: // 'lt'
13919 shiftT(178); // 'lt'
13920 break;
13921 case 180: // 'mod'
13922 shiftT(180); // 'mod'
13923 break;
13924 case 181: // 'modify'
13925 shiftT(181); // 'modify'
13926 break;
13927 case 182: // 'module'
13928 shiftT(182); // 'module'
13929 break;
13930 case 184: // 'namespace'
13931 shiftT(184); // 'namespace'
13932 break;
13933 case 186: // 'ne'
13934 shiftT(186); // 'ne'
13935 break;
13936 case 198: // 'only'
13937 shiftT(198); // 'only'
13938 break;
13939 case 200: // 'or'
13940 shiftT(200); // 'or'
13941 break;
13942 case 201: // 'order'
13943 shiftT(201); // 'order'
13944 break;
13945 case 202: // 'ordered'
13946 shiftT(202); // 'ordered'
13947 break;
13948 case 206: // 'parent'
13949 shiftT(206); // 'parent'
13950 break;
13951 case 212: // 'preceding'
13952 shiftT(212); // 'preceding'
13953 break;
13954 case 213: // 'preceding-sibling'
13955 shiftT(213); // 'preceding-sibling'
13956 break;
13957 case 218: // 'rename'
13958 shiftT(218); // 'rename'
13959 break;
13960 case 219: // 'replace'
13961 shiftT(219); // 'replace'
13962 break;
13963 case 220: // 'return'
13964 shiftT(220); // 'return'
13965 break;
13966 case 224: // 'satisfies'
13967 shiftT(224); // 'satisfies'
13968 break;
13969 case 229: // 'self'
13970 shiftT(229); // 'self'
13971 break;
13972 case 235: // 'some'
13973 shiftT(235); // 'some'
13974 break;
13975 case 236: // 'stable'
13976 shiftT(236); // 'stable'
13977 break;
13978 case 237: // 'start'
13979 shiftT(237); // 'start'
13980 break;
13981 case 248: // 'to'
13982 shiftT(248); // 'to'
13983 break;
13984 case 249: // 'treat'
13985 shiftT(249); // 'treat'
13986 break;
13987 case 250: // 'try'
13988 shiftT(250); // 'try'
13989 break;
13990 case 254: // 'union'
13991 shiftT(254); // 'union'
13992 break;
13993 case 256: // 'unordered'
13994 shiftT(256); // 'unordered'
13995 break;
13996 case 260: // 'validate'
13997 shiftT(260); // 'validate'
13998 break;
13999 case 266: // 'where'
14000 shiftT(266); // 'where'
14001 break;
14002 case 270: // 'with'
14003 shiftT(270); // 'with'
14004 break;
14005 case 274: // 'xquery'
14006 shiftT(274); // 'xquery'
14007 break;
14008 case 72: // 'allowing'
14009 shiftT(72); // 'allowing'
14010 break;
14011 case 81: // 'at'
14012 shiftT(81); // 'at'
14013 break;
14014 case 83: // 'base-uri'
14015 shiftT(83); // 'base-uri'
14016 break;
14017 case 85: // 'boundary-space'
14018 shiftT(85); // 'boundary-space'
14019 break;
14020 case 86: // 'break'
14021 shiftT(86); // 'break'
14022 break;
14023 case 91: // 'catch'
14024 shiftT(91); // 'catch'
14025 break;
14026 case 98: // 'construction'
14027 shiftT(98); // 'construction'
14028 break;
14029 case 101: // 'context'
14030 shiftT(101); // 'context'
14031 break;
14032 case 102: // 'continue'
14033 shiftT(102); // 'continue'
14034 break;
14035 case 104: // 'copy-namespaces'
14036 shiftT(104); // 'copy-namespaces'
14037 break;
14038 case 106: // 'decimal-format'
14039 shiftT(106); // 'decimal-format'
14040 break;
14041 case 125: // 'encoding'
14042 shiftT(125); // 'encoding'
14043 break;
14044 case 132: // 'exit'
14045 shiftT(132); // 'exit'
14046 break;
14047 case 133: // 'external'
14048 shiftT(133); // 'external'
14049 break;
14050 case 141: // 'ft-option'
14051 shiftT(141); // 'ft-option'
14052 break;
14053 case 154: // 'in'
14054 shiftT(154); // 'in'
14055 break;
14056 case 155: // 'index'
14057 shiftT(155); // 'index'
14058 break;
14059 case 161: // 'integrity'
14060 shiftT(161); // 'integrity'
14061 break;
14062 case 171: // 'lax'
14063 shiftT(171); // 'lax'
14064 break;
14065 case 192: // 'nodes'
14066 shiftT(192); // 'nodes'
14067 break;
14068 case 199: // 'option'
14069 shiftT(199); // 'option'
14070 break;
14071 case 203: // 'ordering'
14072 shiftT(203); // 'ordering'
14073 break;
14074 case 222: // 'revalidation'
14075 shiftT(222); // 'revalidation'
14076 break;
14077 case 225: // 'schema'
14078 shiftT(225); // 'schema'
14079 break;
14080 case 228: // 'score'
14081 shiftT(228); // 'score'
14082 break;
14083 case 234: // 'sliding'
14084 shiftT(234); // 'sliding'
14085 break;
14086 case 240: // 'strict'
14087 shiftT(240); // 'strict'
14088 break;
14089 case 251: // 'tumbling'
14090 shiftT(251); // 'tumbling'
14091 break;
14092 case 252: // 'type'
14093 shiftT(252); // 'type'
14094 break;
14095 case 257: // 'updating'
14096 shiftT(257); // 'updating'
14097 break;
14098 case 261: // 'value'
14099 shiftT(261); // 'value'
14100 break;
14101 case 262: // 'variable'
14102 shiftT(262); // 'variable'
14103 break;
14104 case 263: // 'version'
14105 shiftT(263); // 'version'
14106 break;
14107 case 267: // 'while'
14108 shiftT(267); // 'while'
14109 break;
14110 case 97: // 'constraint'
14111 shiftT(97); // 'constraint'
14112 break;
14113 case 176: // 'loop'
14114 shiftT(176); // 'loop'
14115 break;
14116 case 221: // 'returning'
14117 shiftT(221); // 'returning'
14118 break;
14119 case 194: // 'object'
14120 shiftT(194); // 'object'
14121 break;
14122 case 167: // 'json-item'
14123 shiftT(167); // 'json-item'
14124 break;
14125 default:
14126 shiftT(78); // 'array'
14127 }
14128 }
14129
14130 function parse_NCName()
14131 {
14132 eventHandler.startNonterminal("NCName", e0);
14133 switch (l1)
14134 {
14135 case 19: // NCName^Token
14136 shift(19); // NCName^Token
14137 break;
14138 case 70: // 'after'
14139 shift(70); // 'after'
14140 break;
14141 case 75: // 'and'
14142 shift(75); // 'and'
14143 break;
14144 case 79: // 'as'
14145 shift(79); // 'as'
14146 break;
14147 case 80: // 'ascending'
14148 shift(80); // 'ascending'
14149 break;
14150 case 84: // 'before'
14151 shift(84); // 'before'
14152 break;
14153 case 88: // 'case'
14154 shift(88); // 'case'
14155 break;
14156 case 89: // 'cast'
14157 shift(89); // 'cast'
14158 break;
14159 case 90: // 'castable'
14160 shift(90); // 'castable'
14161 break;
14162 case 94: // 'collation'
14163 shift(94); // 'collation'
14164 break;
14165 case 105: // 'count'
14166 shift(105); // 'count'
14167 break;
14168 case 109: // 'default'
14169 shift(109); // 'default'
14170 break;
14171 case 113: // 'descending'
14172 shift(113); // 'descending'
14173 break;
14174 case 118: // 'div'
14175 shift(118); // 'div'
14176 break;
14177 case 122: // 'else'
14178 shift(122); // 'else'
14179 break;
14180 case 123: // 'empty'
14181 shift(123); // 'empty'
14182 break;
14183 case 126: // 'end'
14184 shift(126); // 'end'
14185 break;
14186 case 128: // 'eq'
14187 shift(128); // 'eq'
14188 break;
14189 case 131: // 'except'
14190 shift(131); // 'except'
14191 break;
14192 case 137: // 'for'
14193 shift(137); // 'for'
14194 break;
14195 case 146: // 'ge'
14196 shift(146); // 'ge'
14197 break;
14198 case 148: // 'group'
14199 shift(148); // 'group'
14200 break;
14201 case 150: // 'gt'
14202 shift(150); // 'gt'
14203 break;
14204 case 151: // 'idiv'
14205 shift(151); // 'idiv'
14206 break;
14207 case 160: // 'instance'
14208 shift(160); // 'instance'
14209 break;
14210 case 162: // 'intersect'
14211 shift(162); // 'intersect'
14212 break;
14213 case 163: // 'into'
14214 shift(163); // 'into'
14215 break;
14216 case 164: // 'is'
14217 shift(164); // 'is'
14218 break;
14219 case 172: // 'le'
14220 shift(172); // 'le'
14221 break;
14222 case 174: // 'let'
14223 shift(174); // 'let'
14224 break;
14225 case 178: // 'lt'
14226 shift(178); // 'lt'
14227 break;
14228 case 180: // 'mod'
14229 shift(180); // 'mod'
14230 break;
14231 case 181: // 'modify'
14232 shift(181); // 'modify'
14233 break;
14234 case 186: // 'ne'
14235 shift(186); // 'ne'
14236 break;
14237 case 198: // 'only'
14238 shift(198); // 'only'
14239 break;
14240 case 200: // 'or'
14241 shift(200); // 'or'
14242 break;
14243 case 201: // 'order'
14244 shift(201); // 'order'
14245 break;
14246 case 220: // 'return'
14247 shift(220); // 'return'
14248 break;
14249 case 224: // 'satisfies'
14250 shift(224); // 'satisfies'
14251 break;
14252 case 236: // 'stable'
14253 shift(236); // 'stable'
14254 break;
14255 case 237: // 'start'
14256 shift(237); // 'start'
14257 break;
14258 case 248: // 'to'
14259 shift(248); // 'to'
14260 break;
14261 case 249: // 'treat'
14262 shift(249); // 'treat'
14263 break;
14264 case 254: // 'union'
14265 shift(254); // 'union'
14266 break;
14267 case 266: // 'where'
14268 shift(266); // 'where'
14269 break;
14270 case 270: // 'with'
14271 shift(270); // 'with'
14272 break;
14273 case 73: // 'ancestor'
14274 shift(73); // 'ancestor'
14275 break;
14276 case 74: // 'ancestor-or-self'
14277 shift(74); // 'ancestor-or-self'
14278 break;
14279 case 82: // 'attribute'
14280 shift(82); // 'attribute'
14281 break;
14282 case 93: // 'child'
14283 shift(93); // 'child'
14284 break;
14285 case 96: // 'comment'
14286 shift(96); // 'comment'
14287 break;
14288 case 103: // 'copy'
14289 shift(103); // 'copy'
14290 break;
14291 case 108: // 'declare'
14292 shift(108); // 'declare'
14293 break;
14294 case 110: // 'delete'
14295 shift(110); // 'delete'
14296 break;
14297 case 111: // 'descendant'
14298 shift(111); // 'descendant'
14299 break;
14300 case 112: // 'descendant-or-self'
14301 shift(112); // 'descendant-or-self'
14302 break;
14303 case 119: // 'document'
14304 shift(119); // 'document'
14305 break;
14306 case 120: // 'document-node'
14307 shift(120); // 'document-node'
14308 break;
14309 case 121: // 'element'
14310 shift(121); // 'element'
14311 break;
14312 case 124: // 'empty-sequence'
14313 shift(124); // 'empty-sequence'
14314 break;
14315 case 129: // 'every'
14316 shift(129); // 'every'
14317 break;
14318 case 134: // 'first'
14319 shift(134); // 'first'
14320 break;
14321 case 135: // 'following'
14322 shift(135); // 'following'
14323 break;
14324 case 136: // 'following-sibling'
14325 shift(136); // 'following-sibling'
14326 break;
14327 case 145: // 'function'
14328 shift(145); // 'function'
14329 break;
14330 case 152: // 'if'
14331 shift(152); // 'if'
14332 break;
14333 case 153: // 'import'
14334 shift(153); // 'import'
14335 break;
14336 case 159: // 'insert'
14337 shift(159); // 'insert'
14338 break;
14339 case 165: // 'item'
14340 shift(165); // 'item'
14341 break;
14342 case 170: // 'last'
14343 shift(170); // 'last'
14344 break;
14345 case 182: // 'module'
14346 shift(182); // 'module'
14347 break;
14348 case 184: // 'namespace'
14349 shift(184); // 'namespace'
14350 break;
14351 case 185: // 'namespace-node'
14352 shift(185); // 'namespace-node'
14353 break;
14354 case 191: // 'node'
14355 shift(191); // 'node'
14356 break;
14357 case 202: // 'ordered'
14358 shift(202); // 'ordered'
14359 break;
14360 case 206: // 'parent'
14361 shift(206); // 'parent'
14362 break;
14363 case 212: // 'preceding'
14364 shift(212); // 'preceding'
14365 break;
14366 case 213: // 'preceding-sibling'
14367 shift(213); // 'preceding-sibling'
14368 break;
14369 case 216: // 'processing-instruction'
14370 shift(216); // 'processing-instruction'
14371 break;
14372 case 218: // 'rename'
14373 shift(218); // 'rename'
14374 break;
14375 case 219: // 'replace'
14376 shift(219); // 'replace'
14377 break;
14378 case 226: // 'schema-attribute'
14379 shift(226); // 'schema-attribute'
14380 break;
14381 case 227: // 'schema-element'
14382 shift(227); // 'schema-element'
14383 break;
14384 case 229: // 'self'
14385 shift(229); // 'self'
14386 break;
14387 case 235: // 'some'
14388 shift(235); // 'some'
14389 break;
14390 case 243: // 'switch'
14391 shift(243); // 'switch'
14392 break;
14393 case 244: // 'text'
14394 shift(244); // 'text'
14395 break;
14396 case 250: // 'try'
14397 shift(250); // 'try'
14398 break;
14399 case 253: // 'typeswitch'
14400 shift(253); // 'typeswitch'
14401 break;
14402 case 256: // 'unordered'
14403 shift(256); // 'unordered'
14404 break;
14405 case 260: // 'validate'
14406 shift(260); // 'validate'
14407 break;
14408 case 262: // 'variable'
14409 shift(262); // 'variable'
14410 break;
14411 case 274: // 'xquery'
14412 shift(274); // 'xquery'
14413 break;
14414 case 72: // 'allowing'
14415 shift(72); // 'allowing'
14416 break;
14417 case 81: // 'at'
14418 shift(81); // 'at'
14419 break;
14420 case 83: // 'base-uri'
14421 shift(83); // 'base-uri'
14422 break;
14423 case 85: // 'boundary-space'
14424 shift(85); // 'boundary-space'
14425 break;
14426 case 86: // 'break'
14427 shift(86); // 'break'
14428 break;
14429 case 91: // 'catch'
14430 shift(91); // 'catch'
14431 break;
14432 case 98: // 'construction'
14433 shift(98); // 'construction'
14434 break;
14435 case 101: // 'context'
14436 shift(101); // 'context'
14437 break;
14438 case 102: // 'continue'
14439 shift(102); // 'continue'
14440 break;
14441 case 104: // 'copy-namespaces'
14442 shift(104); // 'copy-namespaces'
14443 break;
14444 case 106: // 'decimal-format'
14445 shift(106); // 'decimal-format'
14446 break;
14447 case 125: // 'encoding'
14448 shift(125); // 'encoding'
14449 break;
14450 case 132: // 'exit'
14451 shift(132); // 'exit'
14452 break;
14453 case 133: // 'external'
14454 shift(133); // 'external'
14455 break;
14456 case 141: // 'ft-option'
14457 shift(141); // 'ft-option'
14458 break;
14459 case 154: // 'in'
14460 shift(154); // 'in'
14461 break;
14462 case 155: // 'index'
14463 shift(155); // 'index'
14464 break;
14465 case 161: // 'integrity'
14466 shift(161); // 'integrity'
14467 break;
14468 case 171: // 'lax'
14469 shift(171); // 'lax'
14470 break;
14471 case 192: // 'nodes'
14472 shift(192); // 'nodes'
14473 break;
14474 case 199: // 'option'
14475 shift(199); // 'option'
14476 break;
14477 case 203: // 'ordering'
14478 shift(203); // 'ordering'
14479 break;
14480 case 222: // 'revalidation'
14481 shift(222); // 'revalidation'
14482 break;
14483 case 225: // 'schema'
14484 shift(225); // 'schema'
14485 break;
14486 case 228: // 'score'
14487 shift(228); // 'score'
14488 break;
14489 case 234: // 'sliding'
14490 shift(234); // 'sliding'
14491 break;
14492 case 240: // 'strict'
14493 shift(240); // 'strict'
14494 break;
14495 case 251: // 'tumbling'
14496 shift(251); // 'tumbling'
14497 break;
14498 case 252: // 'type'
14499 shift(252); // 'type'
14500 break;
14501 case 257: // 'updating'
14502 shift(257); // 'updating'
14503 break;
14504 case 261: // 'value'
14505 shift(261); // 'value'
14506 break;
14507 case 263: // 'version'
14508 shift(263); // 'version'
14509 break;
14510 case 267: // 'while'
14511 shift(267); // 'while'
14512 break;
14513 case 97: // 'constraint'
14514 shift(97); // 'constraint'
14515 break;
14516 case 176: // 'loop'
14517 shift(176); // 'loop'
14518 break;
14519 default:
14520 shift(221); // 'returning'
14521 }
14522 eventHandler.endNonterminal("NCName", e0);
14523 }
14524
14525 function try_NCName()
14526 {
14527 switch (l1)
14528 {
14529 case 19: // NCName^Token
14530 shiftT(19); // NCName^Token
14531 break;
14532 case 70: // 'after'
14533 shiftT(70); // 'after'
14534 break;
14535 case 75: // 'and'
14536 shiftT(75); // 'and'
14537 break;
14538 case 79: // 'as'
14539 shiftT(79); // 'as'
14540 break;
14541 case 80: // 'ascending'
14542 shiftT(80); // 'ascending'
14543 break;
14544 case 84: // 'before'
14545 shiftT(84); // 'before'
14546 break;
14547 case 88: // 'case'
14548 shiftT(88); // 'case'
14549 break;
14550 case 89: // 'cast'
14551 shiftT(89); // 'cast'
14552 break;
14553 case 90: // 'castable'
14554 shiftT(90); // 'castable'
14555 break;
14556 case 94: // 'collation'
14557 shiftT(94); // 'collation'
14558 break;
14559 case 105: // 'count'
14560 shiftT(105); // 'count'
14561 break;
14562 case 109: // 'default'
14563 shiftT(109); // 'default'
14564 break;
14565 case 113: // 'descending'
14566 shiftT(113); // 'descending'
14567 break;
14568 case 118: // 'div'
14569 shiftT(118); // 'div'
14570 break;
14571 case 122: // 'else'
14572 shiftT(122); // 'else'
14573 break;
14574 case 123: // 'empty'
14575 shiftT(123); // 'empty'
14576 break;
14577 case 126: // 'end'
14578 shiftT(126); // 'end'
14579 break;
14580 case 128: // 'eq'
14581 shiftT(128); // 'eq'
14582 break;
14583 case 131: // 'except'
14584 shiftT(131); // 'except'
14585 break;
14586 case 137: // 'for'
14587 shiftT(137); // 'for'
14588 break;
14589 case 146: // 'ge'
14590 shiftT(146); // 'ge'
14591 break;
14592 case 148: // 'group'
14593 shiftT(148); // 'group'
14594 break;
14595 case 150: // 'gt'
14596 shiftT(150); // 'gt'
14597 break;
14598 case 151: // 'idiv'
14599 shiftT(151); // 'idiv'
14600 break;
14601 case 160: // 'instance'
14602 shiftT(160); // 'instance'
14603 break;
14604 case 162: // 'intersect'
14605 shiftT(162); // 'intersect'
14606 break;
14607 case 163: // 'into'
14608 shiftT(163); // 'into'
14609 break;
14610 case 164: // 'is'
14611 shiftT(164); // 'is'
14612 break;
14613 case 172: // 'le'
14614 shiftT(172); // 'le'
14615 break;
14616 case 174: // 'let'
14617 shiftT(174); // 'let'
14618 break;
14619 case 178: // 'lt'
14620 shiftT(178); // 'lt'
14621 break;
14622 case 180: // 'mod'
14623 shiftT(180); // 'mod'
14624 break;
14625 case 181: // 'modify'
14626 shiftT(181); // 'modify'
14627 break;
14628 case 186: // 'ne'
14629 shiftT(186); // 'ne'
14630 break;
14631 case 198: // 'only'
14632 shiftT(198); // 'only'
14633 break;
14634 case 200: // 'or'
14635 shiftT(200); // 'or'
14636 break;
14637 case 201: // 'order'
14638 shiftT(201); // 'order'
14639 break;
14640 case 220: // 'return'
14641 shiftT(220); // 'return'
14642 break;
14643 case 224: // 'satisfies'
14644 shiftT(224); // 'satisfies'
14645 break;
14646 case 236: // 'stable'
14647 shiftT(236); // 'stable'
14648 break;
14649 case 237: // 'start'
14650 shiftT(237); // 'start'
14651 break;
14652 case 248: // 'to'
14653 shiftT(248); // 'to'
14654 break;
14655 case 249: // 'treat'
14656 shiftT(249); // 'treat'
14657 break;
14658 case 254: // 'union'
14659 shiftT(254); // 'union'
14660 break;
14661 case 266: // 'where'
14662 shiftT(266); // 'where'
14663 break;
14664 case 270: // 'with'
14665 shiftT(270); // 'with'
14666 break;
14667 case 73: // 'ancestor'
14668 shiftT(73); // 'ancestor'
14669 break;
14670 case 74: // 'ancestor-or-self'
14671 shiftT(74); // 'ancestor-or-self'
14672 break;
14673 case 82: // 'attribute'
14674 shiftT(82); // 'attribute'
14675 break;
14676 case 93: // 'child'
14677 shiftT(93); // 'child'
14678 break;
14679 case 96: // 'comment'
14680 shiftT(96); // 'comment'
14681 break;
14682 case 103: // 'copy'
14683 shiftT(103); // 'copy'
14684 break;
14685 case 108: // 'declare'
14686 shiftT(108); // 'declare'
14687 break;
14688 case 110: // 'delete'
14689 shiftT(110); // 'delete'
14690 break;
14691 case 111: // 'descendant'
14692 shiftT(111); // 'descendant'
14693 break;
14694 case 112: // 'descendant-or-self'
14695 shiftT(112); // 'descendant-or-self'
14696 break;
14697 case 119: // 'document'
14698 shiftT(119); // 'document'
14699 break;
14700 case 120: // 'document-node'
14701 shiftT(120); // 'document-node'
14702 break;
14703 case 121: // 'element'
14704 shiftT(121); // 'element'
14705 break;
14706 case 124: // 'empty-sequence'
14707 shiftT(124); // 'empty-sequence'
14708 break;
14709 case 129: // 'every'
14710 shiftT(129); // 'every'
14711 break;
14712 case 134: // 'first'
14713 shiftT(134); // 'first'
14714 break;
14715 case 135: // 'following'
14716 shiftT(135); // 'following'
14717 break;
14718 case 136: // 'following-sibling'
14719 shiftT(136); // 'following-sibling'
14720 break;
14721 case 145: // 'function'
14722 shiftT(145); // 'function'
14723 break;
14724 case 152: // 'if'
14725 shiftT(152); // 'if'
14726 break;
14727 case 153: // 'import'
14728 shiftT(153); // 'import'
14729 break;
14730 case 159: // 'insert'
14731 shiftT(159); // 'insert'
14732 break;
14733 case 165: // 'item'
14734 shiftT(165); // 'item'
14735 break;
14736 case 170: // 'last'
14737 shiftT(170); // 'last'
14738 break;
14739 case 182: // 'module'
14740 shiftT(182); // 'module'
14741 break;
14742 case 184: // 'namespace'
14743 shiftT(184); // 'namespace'
14744 break;
14745 case 185: // 'namespace-node'
14746 shiftT(185); // 'namespace-node'
14747 break;
14748 case 191: // 'node'
14749 shiftT(191); // 'node'
14750 break;
14751 case 202: // 'ordered'
14752 shiftT(202); // 'ordered'
14753 break;
14754 case 206: // 'parent'
14755 shiftT(206); // 'parent'
14756 break;
14757 case 212: // 'preceding'
14758 shiftT(212); // 'preceding'
14759 break;
14760 case 213: // 'preceding-sibling'
14761 shiftT(213); // 'preceding-sibling'
14762 break;
14763 case 216: // 'processing-instruction'
14764 shiftT(216); // 'processing-instruction'
14765 break;
14766 case 218: // 'rename'
14767 shiftT(218); // 'rename'
14768 break;
14769 case 219: // 'replace'
14770 shiftT(219); // 'replace'
14771 break;
14772 case 226: // 'schema-attribute'
14773 shiftT(226); // 'schema-attribute'
14774 break;
14775 case 227: // 'schema-element'
14776 shiftT(227); // 'schema-element'
14777 break;
14778 case 229: // 'self'
14779 shiftT(229); // 'self'
14780 break;
14781 case 235: // 'some'
14782 shiftT(235); // 'some'
14783 break;
14784 case 243: // 'switch'
14785 shiftT(243); // 'switch'
14786 break;
14787 case 244: // 'text'
14788 shiftT(244); // 'text'
14789 break;
14790 case 250: // 'try'
14791 shiftT(250); // 'try'
14792 break;
14793 case 253: // 'typeswitch'
14794 shiftT(253); // 'typeswitch'
14795 break;
14796 case 256: // 'unordered'
14797 shiftT(256); // 'unordered'
14798 break;
14799 case 260: // 'validate'
14800 shiftT(260); // 'validate'
14801 break;
14802 case 262: // 'variable'
14803 shiftT(262); // 'variable'
14804 break;
14805 case 274: // 'xquery'
14806 shiftT(274); // 'xquery'
14807 break;
14808 case 72: // 'allowing'
14809 shiftT(72); // 'allowing'
14810 break;
14811 case 81: // 'at'
14812 shiftT(81); // 'at'
14813 break;
14814 case 83: // 'base-uri'
14815 shiftT(83); // 'base-uri'
14816 break;
14817 case 85: // 'boundary-space'
14818 shiftT(85); // 'boundary-space'
14819 break;
14820 case 86: // 'break'
14821 shiftT(86); // 'break'
14822 break;
14823 case 91: // 'catch'
14824 shiftT(91); // 'catch'
14825 break;
14826 case 98: // 'construction'
14827 shiftT(98); // 'construction'
14828 break;
14829 case 101: // 'context'
14830 shiftT(101); // 'context'
14831 break;
14832 case 102: // 'continue'
14833 shiftT(102); // 'continue'
14834 break;
14835 case 104: // 'copy-namespaces'
14836 shiftT(104); // 'copy-namespaces'
14837 break;
14838 case 106: // 'decimal-format'
14839 shiftT(106); // 'decimal-format'
14840 break;
14841 case 125: // 'encoding'
14842 shiftT(125); // 'encoding'
14843 break;
14844 case 132: // 'exit'
14845 shiftT(132); // 'exit'
14846 break;
14847 case 133: // 'external'
14848 shiftT(133); // 'external'
14849 break;
14850 case 141: // 'ft-option'
14851 shiftT(141); // 'ft-option'
14852 break;
14853 case 154: // 'in'
14854 shiftT(154); // 'in'
14855 break;
14856 case 155: // 'index'
14857 shiftT(155); // 'index'
14858 break;
14859 case 161: // 'integrity'
14860 shiftT(161); // 'integrity'
14861 break;
14862 case 171: // 'lax'
14863 shiftT(171); // 'lax'
14864 break;
14865 case 192: // 'nodes'
14866 shiftT(192); // 'nodes'
14867 break;
14868 case 199: // 'option'
14869 shiftT(199); // 'option'
14870 break;
14871 case 203: // 'ordering'
14872 shiftT(203); // 'ordering'
14873 break;
14874 case 222: // 'revalidation'
14875 shiftT(222); // 'revalidation'
14876 break;
14877 case 225: // 'schema'
14878 shiftT(225); // 'schema'
14879 break;
14880 case 228: // 'score'
14881 shiftT(228); // 'score'
14882 break;
14883 case 234: // 'sliding'
14884 shiftT(234); // 'sliding'
14885 break;
14886 case 240: // 'strict'
14887 shiftT(240); // 'strict'
14888 break;
14889 case 251: // 'tumbling'
14890 shiftT(251); // 'tumbling'
14891 break;
14892 case 252: // 'type'
14893 shiftT(252); // 'type'
14894 break;
14895 case 257: // 'updating'
14896 shiftT(257); // 'updating'
14897 break;
14898 case 261: // 'value'
14899 shiftT(261); // 'value'
14900 break;
14901 case 263: // 'version'
14902 shiftT(263); // 'version'
14903 break;
14904 case 267: // 'while'
14905 shiftT(267); // 'while'
14906 break;
14907 case 97: // 'constraint'
14908 shiftT(97); // 'constraint'
14909 break;
14910 case 176: // 'loop'
14911 shiftT(176); // 'loop'
14912 break;
14913 default:
14914 shiftT(221); // 'returning'
14915 }
14916 }
14917
14918 function parse_MainModule()
14919 {
14920 eventHandler.startNonterminal("MainModule", e0);
14921 parse_Prolog();
14922 whitespace();
14923 parse_Program();
14924 eventHandler.endNonterminal("MainModule", e0);
14925 }
14926
14927 function parse_Program()
14928 {
14929 eventHandler.startNonterminal("Program", e0);
14930 parse_StatementsAndOptionalExpr();
14931 eventHandler.endNonterminal("Program", e0);
14932 }
14933
14934 function parse_Statements()
14935 {
14936 eventHandler.startNonterminal("Statements", e0);
14937 for (;;)
14938 {
14939 lookahead1W(274); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
14940 switch (l1)
14941 {
14942 case 34: // '('
14943 lookahead2W(269); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
14944 break;
14945 case 35: // '(#'
14946 lookahead2(250); // EQName^Token | S | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
14947 break;
14948 case 46: // '/'
14949 lookahead2W(281); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
14950 break;
14951 case 47: // '//'
14952 lookahead2W(263); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
14953 break;
14954 case 54: // '<'
14955 lookahead2(4); // QName
14956 break;
14957 case 55: // '<!--'
14958 lookahead2(1); // DirCommentContents
14959 break;
14960 case 59: // '<?'
14961 lookahead2(3); // PITarget
14962 break;
14963 case 66: // '@'
14964 lookahead2W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
14965 break;
14966 case 68: // '['
14967 lookahead2W(271); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
14968 break;
14969 case 77: // 'append'
14970 lookahead2W(56); // S^WS | '(:' | 'json'
14971 break;
14972 case 82: // 'attribute'
14973 lookahead2W(278); // EQName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' |
14974 break;
14975 case 121: // 'element'
14976 lookahead2W(277); // EQName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' |
14977 break;
14978 case 132: // 'exit'
14979 lookahead2W(202); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
14980 break;
14981 case 137: // 'for'
14982 lookahead2W(206); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' |
14983 break;
14984 case 174: // 'let'
14985 lookahead2W(204); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' |
14986 break;
14987 case 218: // 'rename'
14988 lookahead2W(205); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
14989 break;
14990 case 219: // 'replace'
14991 lookahead2W(208); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
14992 break;
14993 case 260: // 'validate'
14994 lookahead2W(209); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
14995 break;
14996 case 276: // '{'
14997 lookahead2W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
14998 break;
14999 case 278: // '{|'
15000 lookahead2W(272); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
15001 break;
15002 case 5: // Wildcard
15003 case 45: // '..'
15004 lookahead2W(186); // S^WS | EOF | '!' | '!=' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' | ';' | '<' |
15005 break;
15006 case 31: // '$'
15007 case 32: // '%'
15008 lookahead2W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
15009 break;
15010 case 40: // '+'
15011 case 42: // '-'
15012 lookahead2W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
15013 break;
15014 case 86: // 'break'
15015 case 102: // 'continue'
15016 lookahead2W(200); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15017 break;
15018 case 110: // 'delete'
15019 case 159: // 'insert'
15020 lookahead2W(207); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15021 break;
15022 case 124: // 'empty-sequence'
15023 case 165: // 'item'
15024 lookahead2W(191); // S^WS | EOF | '!' | '!=' | '#' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' | ';' |
15025 break;
15026 case 184: // 'namespace'
15027 case 216: // 'processing-instruction'
15028 lookahead2W(266); // NCName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' |
15029 break;
15030 case 103: // 'copy'
15031 case 129: // 'every'
15032 case 235: // 'some'
15033 case 262: // 'variable'
15034 lookahead2W(197); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' |
15035 break;
15036 case 8: // IntegerLiteral
15037 case 9: // DecimalLiteral
15038 case 10: // DoubleLiteral
15039 case 11: // StringLiteral
15040 case 44: // '.'
15041 lookahead2W(192); // S^WS | EOF | '!' | '!=' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' | ';' |
15042 break;
15043 case 96: // 'comment'
15044 case 119: // 'document'
15045 case 202: // 'ordered'
15046 case 244: // 'text'
15047 case 250: // 'try'
15048 case 256: // 'unordered'
15049 lookahead2W(203); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15050 break;
15051 case 73: // 'ancestor'
15052 case 74: // 'ancestor-or-self'
15053 case 93: // 'child'
15054 case 111: // 'descendant'
15055 case 112: // 'descendant-or-self'
15056 case 135: // 'following'
15057 case 136: // 'following-sibling'
15058 case 206: // 'parent'
15059 case 212: // 'preceding'
15060 case 213: // 'preceding-sibling'
15061 case 229: // 'self'
15062 lookahead2W(198); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15063 break;
15064 case 6: // EQName^Token
15065 case 70: // 'after'
15066 case 72: // 'allowing'
15067 case 75: // 'and'
15068 case 78: // 'array'
15069 case 79: // 'as'
15070 case 80: // 'ascending'
15071 case 81: // 'at'
15072 case 83: // 'base-uri'
15073 case 84: // 'before'
15074 case 85: // 'boundary-space'
15075 case 88: // 'case'
15076 case 89: // 'cast'
15077 case 90: // 'castable'
15078 case 91: // 'catch'
15079 case 94: // 'collation'
15080 case 97: // 'constraint'
15081 case 98: // 'construction'
15082 case 101: // 'context'
15083 case 104: // 'copy-namespaces'
15084 case 105: // 'count'
15085 case 106: // 'decimal-format'
15086 case 108: // 'declare'
15087 case 109: // 'default'
15088 case 113: // 'descending'
15089 case 118: // 'div'
15090 case 120: // 'document-node'
15091 case 122: // 'else'
15092 case 123: // 'empty'
15093 case 125: // 'encoding'
15094 case 126: // 'end'
15095 case 128: // 'eq'
15096 case 131: // 'except'
15097 case 133: // 'external'
15098 case 134: // 'first'
15099 case 141: // 'ft-option'
15100 case 145: // 'function'
15101 case 146: // 'ge'
15102 case 148: // 'group'
15103 case 150: // 'gt'
15104 case 151: // 'idiv'
15105 case 152: // 'if'
15106 case 153: // 'import'
15107 case 154: // 'in'
15108 case 155: // 'index'
15109 case 160: // 'instance'
15110 case 161: // 'integrity'
15111 case 162: // 'intersect'
15112 case 163: // 'into'
15113 case 164: // 'is'
15114 case 167: // 'json-item'
15115 case 170: // 'last'
15116 case 171: // 'lax'
15117 case 172: // 'le'
15118 case 176: // 'loop'
15119 case 178: // 'lt'
15120 case 180: // 'mod'
15121 case 181: // 'modify'
15122 case 182: // 'module'
15123 case 185: // 'namespace-node'
15124 case 186: // 'ne'
15125 case 191: // 'node'
15126 case 192: // 'nodes'
15127 case 194: // 'object'
15128 case 198: // 'only'
15129 case 199: // 'option'
15130 case 200: // 'or'
15131 case 201: // 'order'
15132 case 203: // 'ordering'
15133 case 220: // 'return'
15134 case 221: // 'returning'
15135 case 222: // 'revalidation'
15136 case 224: // 'satisfies'
15137 case 225: // 'schema'
15138 case 226: // 'schema-attribute'
15139 case 227: // 'schema-element'
15140 case 228: // 'score'
15141 case 234: // 'sliding'
15142 case 236: // 'stable'
15143 case 237: // 'start'
15144 case 240: // 'strict'
15145 case 243: // 'switch'
15146 case 248: // 'to'
15147 case 249: // 'treat'
15148 case 251: // 'tumbling'
15149 case 252: // 'type'
15150 case 253: // 'typeswitch'
15151 case 254: // 'union'
15152 case 257: // 'updating'
15153 case 261: // 'value'
15154 case 263: // 'version'
15155 case 266: // 'where'
15156 case 267: // 'while'
15157 case 270: // 'with'
15158 case 274: // 'xquery'
15159 lookahead2W(195); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15160 break;
15161 default:
15162 lk = l1;
15163 }
15164 if (lk != 25 // EOF
15165 && lk != 282 // '}'
15166 && lk != 12805 // Wildcard EOF
15167 && lk != 12806 // EQName^Token EOF
15168 && lk != 12808 // IntegerLiteral EOF
15169 && lk != 12809 // DecimalLiteral EOF
15170 && lk != 12810 // DoubleLiteral EOF
15171 && lk != 12811 // StringLiteral EOF
15172 && lk != 12844 // '.' EOF
15173 && lk != 12845 // '..' EOF
15174 && lk != 12846 // '/' EOF
15175 && lk != 12870 // 'after' EOF
15176 && lk != 12872 // 'allowing' EOF
15177 && lk != 12873 // 'ancestor' EOF
15178 && lk != 12874 // 'ancestor-or-self' EOF
15179 && lk != 12875 // 'and' EOF
15180 && lk != 12878 // 'array' EOF
15181 && lk != 12879 // 'as' EOF
15182 && lk != 12880 // 'ascending' EOF
15183 && lk != 12881 // 'at' EOF
15184 && lk != 12882 // 'attribute' EOF
15185 && lk != 12883 // 'base-uri' EOF
15186 && lk != 12884 // 'before' EOF
15187 && lk != 12885 // 'boundary-space' EOF
15188 && lk != 12886 // 'break' EOF
15189 && lk != 12888 // 'case' EOF
15190 && lk != 12889 // 'cast' EOF
15191 && lk != 12890 // 'castable' EOF
15192 && lk != 12891 // 'catch' EOF
15193 && lk != 12893 // 'child' EOF
15194 && lk != 12894 // 'collation' EOF
15195 && lk != 12896 // 'comment' EOF
15196 && lk != 12897 // 'constraint' EOF
15197 && lk != 12898 // 'construction' EOF
15198 && lk != 12901 // 'context' EOF
15199 && lk != 12902 // 'continue' EOF
15200 && lk != 12903 // 'copy' EOF
15201 && lk != 12904 // 'copy-namespaces' EOF
15202 && lk != 12905 // 'count' EOF
15203 && lk != 12906 // 'decimal-format' EOF
15204 && lk != 12908 // 'declare' EOF
15205 && lk != 12909 // 'default' EOF
15206 && lk != 12910 // 'delete' EOF
15207 && lk != 12911 // 'descendant' EOF
15208 && lk != 12912 // 'descendant-or-self' EOF
15209 && lk != 12913 // 'descending' EOF
15210 && lk != 12918 // 'div' EOF
15211 && lk != 12919 // 'document' EOF
15212 && lk != 12920 // 'document-node' EOF
15213 && lk != 12921 // 'element' EOF
15214 && lk != 12922 // 'else' EOF
15215 && lk != 12923 // 'empty' EOF
15216 && lk != 12924 // 'empty-sequence' EOF
15217 && lk != 12925 // 'encoding' EOF
15218 && lk != 12926 // 'end' EOF
15219 && lk != 12928 // 'eq' EOF
15220 && lk != 12929 // 'every' EOF
15221 && lk != 12931 // 'except' EOF
15222 && lk != 12932 // 'exit' EOF
15223 && lk != 12933 // 'external' EOF
15224 && lk != 12934 // 'first' EOF
15225 && lk != 12935 // 'following' EOF
15226 && lk != 12936 // 'following-sibling' EOF
15227 && lk != 12937 // 'for' EOF
15228 && lk != 12941 // 'ft-option' EOF
15229 && lk != 12945 // 'function' EOF
15230 && lk != 12946 // 'ge' EOF
15231 && lk != 12948 // 'group' EOF
15232 && lk != 12950 // 'gt' EOF
15233 && lk != 12951 // 'idiv' EOF
15234 && lk != 12952 // 'if' EOF
15235 && lk != 12953 // 'import' EOF
15236 && lk != 12954 // 'in' EOF
15237 && lk != 12955 // 'index' EOF
15238 && lk != 12959 // 'insert' EOF
15239 && lk != 12960 // 'instance' EOF
15240 && lk != 12961 // 'integrity' EOF
15241 && lk != 12962 // 'intersect' EOF
15242 && lk != 12963 // 'into' EOF
15243 && lk != 12964 // 'is' EOF
15244 && lk != 12965 // 'item' EOF
15245 && lk != 12967 // 'json-item' EOF
15246 && lk != 12970 // 'last' EOF
15247 && lk != 12971 // 'lax' EOF
15248 && lk != 12972 // 'le' EOF
15249 && lk != 12974 // 'let' EOF
15250 && lk != 12976 // 'loop' EOF
15251 && lk != 12978 // 'lt' EOF
15252 && lk != 12980 // 'mod' EOF
15253 && lk != 12981 // 'modify' EOF
15254 && lk != 12982 // 'module' EOF
15255 && lk != 12984 // 'namespace' EOF
15256 && lk != 12985 // 'namespace-node' EOF
15257 && lk != 12986 // 'ne' EOF
15258 && lk != 12991 // 'node' EOF
15259 && lk != 12992 // 'nodes' EOF
15260 && lk != 12994 // 'object' EOF
15261 && lk != 12998 // 'only' EOF
15262 && lk != 12999 // 'option' EOF
15263 && lk != 13000 // 'or' EOF
15264 && lk != 13001 // 'order' EOF
15265 && lk != 13002 // 'ordered' EOF
15266 && lk != 13003 // 'ordering' EOF
15267 && lk != 13006 // 'parent' EOF
15268 && lk != 13012 // 'preceding' EOF
15269 && lk != 13013 // 'preceding-sibling' EOF
15270 && lk != 13016 // 'processing-instruction' EOF
15271 && lk != 13018 // 'rename' EOF
15272 && lk != 13019 // 'replace' EOF
15273 && lk != 13020 // 'return' EOF
15274 && lk != 13021 // 'returning' EOF
15275 && lk != 13022 // 'revalidation' EOF
15276 && lk != 13024 // 'satisfies' EOF
15277 && lk != 13025 // 'schema' EOF
15278 && lk != 13026 // 'schema-attribute' EOF
15279 && lk != 13027 // 'schema-element' EOF
15280 && lk != 13028 // 'score' EOF
15281 && lk != 13029 // 'self' EOF
15282 && lk != 13034 // 'sliding' EOF
15283 && lk != 13035 // 'some' EOF
15284 && lk != 13036 // 'stable' EOF
15285 && lk != 13037 // 'start' EOF
15286 && lk != 13040 // 'strict' EOF
15287 && lk != 13043 // 'switch' EOF
15288 && lk != 13044 // 'text' EOF
15289 && lk != 13048 // 'to' EOF
15290 && lk != 13049 // 'treat' EOF
15291 && lk != 13050 // 'try' EOF
15292 && lk != 13051 // 'tumbling' EOF
15293 && lk != 13052 // 'type' EOF
15294 && lk != 13053 // 'typeswitch' EOF
15295 && lk != 13054 // 'union' EOF
15296 && lk != 13056 // 'unordered' EOF
15297 && lk != 13057 // 'updating' EOF
15298 && lk != 13060 // 'validate' EOF
15299 && lk != 13061 // 'value' EOF
15300 && lk != 13062 // 'variable' EOF
15301 && lk != 13063 // 'version' EOF
15302 && lk != 13066 // 'where' EOF
15303 && lk != 13067 // 'while' EOF
15304 && lk != 13070 // 'with' EOF
15305 && lk != 13074 // 'xquery' EOF
15306 && lk != 16134 // 'variable' '$'
15307 && lk != 20997 // Wildcard ','
15308 && lk != 20998 // EQName^Token ','
15309 && lk != 21000 // IntegerLiteral ','
15310 && lk != 21001 // DecimalLiteral ','
15311 && lk != 21002 // DoubleLiteral ','
15312 && lk != 21003 // StringLiteral ','
15313 && lk != 21036 // '.' ','
15314 && lk != 21037 // '..' ','
15315 && lk != 21038 // '/' ','
15316 && lk != 21062 // 'after' ','
15317 && lk != 21064 // 'allowing' ','
15318 && lk != 21065 // 'ancestor' ','
15319 && lk != 21066 // 'ancestor-or-self' ','
15320 && lk != 21067 // 'and' ','
15321 && lk != 21070 // 'array' ','
15322 && lk != 21071 // 'as' ','
15323 && lk != 21072 // 'ascending' ','
15324 && lk != 21073 // 'at' ','
15325 && lk != 21074 // 'attribute' ','
15326 && lk != 21075 // 'base-uri' ','
15327 && lk != 21076 // 'before' ','
15328 && lk != 21077 // 'boundary-space' ','
15329 && lk != 21078 // 'break' ','
15330 && lk != 21080 // 'case' ','
15331 && lk != 21081 // 'cast' ','
15332 && lk != 21082 // 'castable' ','
15333 && lk != 21083 // 'catch' ','
15334 && lk != 21085 // 'child' ','
15335 && lk != 21086 // 'collation' ','
15336 && lk != 21088 // 'comment' ','
15337 && lk != 21089 // 'constraint' ','
15338 && lk != 21090 // 'construction' ','
15339 && lk != 21093 // 'context' ','
15340 && lk != 21094 // 'continue' ','
15341 && lk != 21095 // 'copy' ','
15342 && lk != 21096 // 'copy-namespaces' ','
15343 && lk != 21097 // 'count' ','
15344 && lk != 21098 // 'decimal-format' ','
15345 && lk != 21100 // 'declare' ','
15346 && lk != 21101 // 'default' ','
15347 && lk != 21102 // 'delete' ','
15348 && lk != 21103 // 'descendant' ','
15349 && lk != 21104 // 'descendant-or-self' ','
15350 && lk != 21105 // 'descending' ','
15351 && lk != 21110 // 'div' ','
15352 && lk != 21111 // 'document' ','
15353 && lk != 21112 // 'document-node' ','
15354 && lk != 21113 // 'element' ','
15355 && lk != 21114 // 'else' ','
15356 && lk != 21115 // 'empty' ','
15357 && lk != 21116 // 'empty-sequence' ','
15358 && lk != 21117 // 'encoding' ','
15359 && lk != 21118 // 'end' ','
15360 && lk != 21120 // 'eq' ','
15361 && lk != 21121 // 'every' ','
15362 && lk != 21123 // 'except' ','
15363 && lk != 21124 // 'exit' ','
15364 && lk != 21125 // 'external' ','
15365 && lk != 21126 // 'first' ','
15366 && lk != 21127 // 'following' ','
15367 && lk != 21128 // 'following-sibling' ','
15368 && lk != 21129 // 'for' ','
15369 && lk != 21133 // 'ft-option' ','
15370 && lk != 21137 // 'function' ','
15371 && lk != 21138 // 'ge' ','
15372 && lk != 21140 // 'group' ','
15373 && lk != 21142 // 'gt' ','
15374 && lk != 21143 // 'idiv' ','
15375 && lk != 21144 // 'if' ','
15376 && lk != 21145 // 'import' ','
15377 && lk != 21146 // 'in' ','
15378 && lk != 21147 // 'index' ','
15379 && lk != 21151 // 'insert' ','
15380 && lk != 21152 // 'instance' ','
15381 && lk != 21153 // 'integrity' ','
15382 && lk != 21154 // 'intersect' ','
15383 && lk != 21155 // 'into' ','
15384 && lk != 21156 // 'is' ','
15385 && lk != 21157 // 'item' ','
15386 && lk != 21159 // 'json-item' ','
15387 && lk != 21162 // 'last' ','
15388 && lk != 21163 // 'lax' ','
15389 && lk != 21164 // 'le' ','
15390 && lk != 21166 // 'let' ','
15391 && lk != 21168 // 'loop' ','
15392 && lk != 21170 // 'lt' ','
15393 && lk != 21172 // 'mod' ','
15394 && lk != 21173 // 'modify' ','
15395 && lk != 21174 // 'module' ','
15396 && lk != 21176 // 'namespace' ','
15397 && lk != 21177 // 'namespace-node' ','
15398 && lk != 21178 // 'ne' ','
15399 && lk != 21183 // 'node' ','
15400 && lk != 21184 // 'nodes' ','
15401 && lk != 21186 // 'object' ','
15402 && lk != 21190 // 'only' ','
15403 && lk != 21191 // 'option' ','
15404 && lk != 21192 // 'or' ','
15405 && lk != 21193 // 'order' ','
15406 && lk != 21194 // 'ordered' ','
15407 && lk != 21195 // 'ordering' ','
15408 && lk != 21198 // 'parent' ','
15409 && lk != 21204 // 'preceding' ','
15410 && lk != 21205 // 'preceding-sibling' ','
15411 && lk != 21208 // 'processing-instruction' ','
15412 && lk != 21210 // 'rename' ','
15413 && lk != 21211 // 'replace' ','
15414 && lk != 21212 // 'return' ','
15415 && lk != 21213 // 'returning' ','
15416 && lk != 21214 // 'revalidation' ','
15417 && lk != 21216 // 'satisfies' ','
15418 && lk != 21217 // 'schema' ','
15419 && lk != 21218 // 'schema-attribute' ','
15420 && lk != 21219 // 'schema-element' ','
15421 && lk != 21220 // 'score' ','
15422 && lk != 21221 // 'self' ','
15423 && lk != 21226 // 'sliding' ','
15424 && lk != 21227 // 'some' ','
15425 && lk != 21228 // 'stable' ','
15426 && lk != 21229 // 'start' ','
15427 && lk != 21232 // 'strict' ','
15428 && lk != 21235 // 'switch' ','
15429 && lk != 21236 // 'text' ','
15430 && lk != 21240 // 'to' ','
15431 && lk != 21241 // 'treat' ','
15432 && lk != 21242 // 'try' ','
15433 && lk != 21243 // 'tumbling' ','
15434 && lk != 21244 // 'type' ','
15435 && lk != 21245 // 'typeswitch' ','
15436 && lk != 21246 // 'union' ','
15437 && lk != 21248 // 'unordered' ','
15438 && lk != 21249 // 'updating' ','
15439 && lk != 21252 // 'validate' ','
15440 && lk != 21253 // 'value' ','
15441 && lk != 21254 // 'variable' ','
15442 && lk != 21255 // 'version' ','
15443 && lk != 21258 // 'where' ','
15444 && lk != 21259 // 'while' ','
15445 && lk != 21262 // 'with' ','
15446 && lk != 21266 // 'xquery' ','
15447 && lk != 27141 // Wildcard ';'
15448 && lk != 27142 // EQName^Token ';'
15449 && lk != 27144 // IntegerLiteral ';'
15450 && lk != 27145 // DecimalLiteral ';'
15451 && lk != 27146 // DoubleLiteral ';'
15452 && lk != 27147 // StringLiteral ';'
15453 && lk != 27180 // '.' ';'
15454 && lk != 27181 // '..' ';'
15455 && lk != 27182 // '/' ';'
15456 && lk != 27206 // 'after' ';'
15457 && lk != 27208 // 'allowing' ';'
15458 && lk != 27209 // 'ancestor' ';'
15459 && lk != 27210 // 'ancestor-or-self' ';'
15460 && lk != 27211 // 'and' ';'
15461 && lk != 27214 // 'array' ';'
15462 && lk != 27215 // 'as' ';'
15463 && lk != 27216 // 'ascending' ';'
15464 && lk != 27217 // 'at' ';'
15465 && lk != 27218 // 'attribute' ';'
15466 && lk != 27219 // 'base-uri' ';'
15467 && lk != 27220 // 'before' ';'
15468 && lk != 27221 // 'boundary-space' ';'
15469 && lk != 27222 // 'break' ';'
15470 && lk != 27224 // 'case' ';'
15471 && lk != 27225 // 'cast' ';'
15472 && lk != 27226 // 'castable' ';'
15473 && lk != 27227 // 'catch' ';'
15474 && lk != 27229 // 'child' ';'
15475 && lk != 27230 // 'collation' ';'
15476 && lk != 27232 // 'comment' ';'
15477 && lk != 27233 // 'constraint' ';'
15478 && lk != 27234 // 'construction' ';'
15479 && lk != 27237 // 'context' ';'
15480 && lk != 27238 // 'continue' ';'
15481 && lk != 27239 // 'copy' ';'
15482 && lk != 27240 // 'copy-namespaces' ';'
15483 && lk != 27241 // 'count' ';'
15484 && lk != 27242 // 'decimal-format' ';'
15485 && lk != 27244 // 'declare' ';'
15486 && lk != 27245 // 'default' ';'
15487 && lk != 27246 // 'delete' ';'
15488 && lk != 27247 // 'descendant' ';'
15489 && lk != 27248 // 'descendant-or-self' ';'
15490 && lk != 27249 // 'descending' ';'
15491 && lk != 27254 // 'div' ';'
15492 && lk != 27255 // 'document' ';'
15493 && lk != 27256 // 'document-node' ';'
15494 && lk != 27257 // 'element' ';'
15495 && lk != 27258 // 'else' ';'
15496 && lk != 27259 // 'empty' ';'
15497 && lk != 27260 // 'empty-sequence' ';'
15498 && lk != 27261 // 'encoding' ';'
15499 && lk != 27262 // 'end' ';'
15500 && lk != 27264 // 'eq' ';'
15501 && lk != 27265 // 'every' ';'
15502 && lk != 27267 // 'except' ';'
15503 && lk != 27268 // 'exit' ';'
15504 && lk != 27269 // 'external' ';'
15505 && lk != 27270 // 'first' ';'
15506 && lk != 27271 // 'following' ';'
15507 && lk != 27272 // 'following-sibling' ';'
15508 && lk != 27273 // 'for' ';'
15509 && lk != 27277 // 'ft-option' ';'
15510 && lk != 27281 // 'function' ';'
15511 && lk != 27282 // 'ge' ';'
15512 && lk != 27284 // 'group' ';'
15513 && lk != 27286 // 'gt' ';'
15514 && lk != 27287 // 'idiv' ';'
15515 && lk != 27288 // 'if' ';'
15516 && lk != 27289 // 'import' ';'
15517 && lk != 27290 // 'in' ';'
15518 && lk != 27291 // 'index' ';'
15519 && lk != 27295 // 'insert' ';'
15520 && lk != 27296 // 'instance' ';'
15521 && lk != 27297 // 'integrity' ';'
15522 && lk != 27298 // 'intersect' ';'
15523 && lk != 27299 // 'into' ';'
15524 && lk != 27300 // 'is' ';'
15525 && lk != 27301 // 'item' ';'
15526 && lk != 27303 // 'json-item' ';'
15527 && lk != 27306 // 'last' ';'
15528 && lk != 27307 // 'lax' ';'
15529 && lk != 27308 // 'le' ';'
15530 && lk != 27310 // 'let' ';'
15531 && lk != 27312 // 'loop' ';'
15532 && lk != 27314 // 'lt' ';'
15533 && lk != 27316 // 'mod' ';'
15534 && lk != 27317 // 'modify' ';'
15535 && lk != 27318 // 'module' ';'
15536 && lk != 27320 // 'namespace' ';'
15537 && lk != 27321 // 'namespace-node' ';'
15538 && lk != 27322 // 'ne' ';'
15539 && lk != 27327 // 'node' ';'
15540 && lk != 27328 // 'nodes' ';'
15541 && lk != 27330 // 'object' ';'
15542 && lk != 27334 // 'only' ';'
15543 && lk != 27335 // 'option' ';'
15544 && lk != 27336 // 'or' ';'
15545 && lk != 27337 // 'order' ';'
15546 && lk != 27338 // 'ordered' ';'
15547 && lk != 27339 // 'ordering' ';'
15548 && lk != 27342 // 'parent' ';'
15549 && lk != 27348 // 'preceding' ';'
15550 && lk != 27349 // 'preceding-sibling' ';'
15551 && lk != 27352 // 'processing-instruction' ';'
15552 && lk != 27354 // 'rename' ';'
15553 && lk != 27355 // 'replace' ';'
15554 && lk != 27356 // 'return' ';'
15555 && lk != 27357 // 'returning' ';'
15556 && lk != 27358 // 'revalidation' ';'
15557 && lk != 27360 // 'satisfies' ';'
15558 && lk != 27361 // 'schema' ';'
15559 && lk != 27362 // 'schema-attribute' ';'
15560 && lk != 27363 // 'schema-element' ';'
15561 && lk != 27364 // 'score' ';'
15562 && lk != 27365 // 'self' ';'
15563 && lk != 27370 // 'sliding' ';'
15564 && lk != 27371 // 'some' ';'
15565 && lk != 27372 // 'stable' ';'
15566 && lk != 27373 // 'start' ';'
15567 && lk != 27376 // 'strict' ';'
15568 && lk != 27379 // 'switch' ';'
15569 && lk != 27380 // 'text' ';'
15570 && lk != 27384 // 'to' ';'
15571 && lk != 27385 // 'treat' ';'
15572 && lk != 27386 // 'try' ';'
15573 && lk != 27387 // 'tumbling' ';'
15574 && lk != 27388 // 'type' ';'
15575 && lk != 27389 // 'typeswitch' ';'
15576 && lk != 27390 // 'union' ';'
15577 && lk != 27392 // 'unordered' ';'
15578 && lk != 27393 // 'updating' ';'
15579 && lk != 27396 // 'validate' ';'
15580 && lk != 27397 // 'value' ';'
15581 && lk != 27398 // 'variable' ';'
15582 && lk != 27399 // 'version' ';'
15583 && lk != 27402 // 'where' ';'
15584 && lk != 27403 // 'while' ';'
15585 && lk != 27406 // 'with' ';'
15586 && lk != 27410 // 'xquery' ';'
15587 && lk != 90198 // 'break' 'loop'
15588 && lk != 90214 // 'continue' 'loop'
15589 && lk != 113284 // 'exit' 'returning'
15590 && lk != 144389 // Wildcard '}'
15591 && lk != 144390 // EQName^Token '}'
15592 && lk != 144392 // IntegerLiteral '}'
15593 && lk != 144393 // DecimalLiteral '}'
15594 && lk != 144394 // DoubleLiteral '}'
15595 && lk != 144395 // StringLiteral '}'
15596 && lk != 144428 // '.' '}'
15597 && lk != 144429 // '..' '}'
15598 && lk != 144430 // '/' '}'
15599 && lk != 144454 // 'after' '}'
15600 && lk != 144456 // 'allowing' '}'
15601 && lk != 144457 // 'ancestor' '}'
15602 && lk != 144458 // 'ancestor-or-self' '}'
15603 && lk != 144459 // 'and' '}'
15604 && lk != 144462 // 'array' '}'
15605 && lk != 144463 // 'as' '}'
15606 && lk != 144464 // 'ascending' '}'
15607 && lk != 144465 // 'at' '}'
15608 && lk != 144466 // 'attribute' '}'
15609 && lk != 144467 // 'base-uri' '}'
15610 && lk != 144468 // 'before' '}'
15611 && lk != 144469 // 'boundary-space' '}'
15612 && lk != 144470 // 'break' '}'
15613 && lk != 144472 // 'case' '}'
15614 && lk != 144473 // 'cast' '}'
15615 && lk != 144474 // 'castable' '}'
15616 && lk != 144475 // 'catch' '}'
15617 && lk != 144477 // 'child' '}'
15618 && lk != 144478 // 'collation' '}'
15619 && lk != 144480 // 'comment' '}'
15620 && lk != 144481 // 'constraint' '}'
15621 && lk != 144482 // 'construction' '}'
15622 && lk != 144485 // 'context' '}'
15623 && lk != 144486 // 'continue' '}'
15624 && lk != 144487 // 'copy' '}'
15625 && lk != 144488 // 'copy-namespaces' '}'
15626 && lk != 144489 // 'count' '}'
15627 && lk != 144490 // 'decimal-format' '}'
15628 && lk != 144492 // 'declare' '}'
15629 && lk != 144493 // 'default' '}'
15630 && lk != 144494 // 'delete' '}'
15631 && lk != 144495 // 'descendant' '}'
15632 && lk != 144496 // 'descendant-or-self' '}'
15633 && lk != 144497 // 'descending' '}'
15634 && lk != 144502 // 'div' '}'
15635 && lk != 144503 // 'document' '}'
15636 && lk != 144504 // 'document-node' '}'
15637 && lk != 144505 // 'element' '}'
15638 && lk != 144506 // 'else' '}'
15639 && lk != 144507 // 'empty' '}'
15640 && lk != 144508 // 'empty-sequence' '}'
15641 && lk != 144509 // 'encoding' '}'
15642 && lk != 144510 // 'end' '}'
15643 && lk != 144512 // 'eq' '}'
15644 && lk != 144513 // 'every' '}'
15645 && lk != 144515 // 'except' '}'
15646 && lk != 144516 // 'exit' '}'
15647 && lk != 144517 // 'external' '}'
15648 && lk != 144518 // 'first' '}'
15649 && lk != 144519 // 'following' '}'
15650 && lk != 144520 // 'following-sibling' '}'
15651 && lk != 144521 // 'for' '}'
15652 && lk != 144525 // 'ft-option' '}'
15653 && lk != 144529 // 'function' '}'
15654 && lk != 144530 // 'ge' '}'
15655 && lk != 144532 // 'group' '}'
15656 && lk != 144534 // 'gt' '}'
15657 && lk != 144535 // 'idiv' '}'
15658 && lk != 144536 // 'if' '}'
15659 && lk != 144537 // 'import' '}'
15660 && lk != 144538 // 'in' '}'
15661 && lk != 144539 // 'index' '}'
15662 && lk != 144543 // 'insert' '}'
15663 && lk != 144544 // 'instance' '}'
15664 && lk != 144545 // 'integrity' '}'
15665 && lk != 144546 // 'intersect' '}'
15666 && lk != 144547 // 'into' '}'
15667 && lk != 144548 // 'is' '}'
15668 && lk != 144549 // 'item' '}'
15669 && lk != 144551 // 'json-item' '}'
15670 && lk != 144554 // 'last' '}'
15671 && lk != 144555 // 'lax' '}'
15672 && lk != 144556 // 'le' '}'
15673 && lk != 144558 // 'let' '}'
15674 && lk != 144560 // 'loop' '}'
15675 && lk != 144562 // 'lt' '}'
15676 && lk != 144564 // 'mod' '}'
15677 && lk != 144565 // 'modify' '}'
15678 && lk != 144566 // 'module' '}'
15679 && lk != 144568 // 'namespace' '}'
15680 && lk != 144569 // 'namespace-node' '}'
15681 && lk != 144570 // 'ne' '}'
15682 && lk != 144575 // 'node' '}'
15683 && lk != 144576 // 'nodes' '}'
15684 && lk != 144578 // 'object' '}'
15685 && lk != 144582 // 'only' '}'
15686 && lk != 144583 // 'option' '}'
15687 && lk != 144584 // 'or' '}'
15688 && lk != 144585 // 'order' '}'
15689 && lk != 144586 // 'ordered' '}'
15690 && lk != 144587 // 'ordering' '}'
15691 && lk != 144590 // 'parent' '}'
15692 && lk != 144596 // 'preceding' '}'
15693 && lk != 144597 // 'preceding-sibling' '}'
15694 && lk != 144600 // 'processing-instruction' '}'
15695 && lk != 144602 // 'rename' '}'
15696 && lk != 144603 // 'replace' '}'
15697 && lk != 144604 // 'return' '}'
15698 && lk != 144605 // 'returning' '}'
15699 && lk != 144606 // 'revalidation' '}'
15700 && lk != 144608 // 'satisfies' '}'
15701 && lk != 144609 // 'schema' '}'
15702 && lk != 144610 // 'schema-attribute' '}'
15703 && lk != 144611 // 'schema-element' '}'
15704 && lk != 144612 // 'score' '}'
15705 && lk != 144613 // 'self' '}'
15706 && lk != 144618 // 'sliding' '}'
15707 && lk != 144619 // 'some' '}'
15708 && lk != 144620 // 'stable' '}'
15709 && lk != 144621 // 'start' '}'
15710 && lk != 144624 // 'strict' '}'
15711 && lk != 144627 // 'switch' '}'
15712 && lk != 144628 // 'text' '}'
15713 && lk != 144632 // 'to' '}'
15714 && lk != 144633 // 'treat' '}'
15715 && lk != 144634 // 'try' '}'
15716 && lk != 144635 // 'tumbling' '}'
15717 && lk != 144636 // 'type' '}'
15718 && lk != 144637 // 'typeswitch' '}'
15719 && lk != 144638 // 'union' '}'
15720 && lk != 144640 // 'unordered' '}'
15721 && lk != 144641 // 'updating' '}'
15722 && lk != 144644 // 'validate' '}'
15723 && lk != 144645 // 'value' '}'
15724 && lk != 144646 // 'variable' '}'
15725 && lk != 144647 // 'version' '}'
15726 && lk != 144650 // 'where' '}'
15727 && lk != 144651 // 'while' '}'
15728 && lk != 144654 // 'with' '}'
15729 && lk != 144658) // 'xquery' '}'
15730 {
15731 lk = memoized(6, e0);
15732 if (lk == 0)
15733 {
15734 var b0A = b0; var e0A = e0; var l1A = l1;
15735 var b1A = b1; var e1A = e1; var l2A = l2;
15736 var b2A = b2; var e2A = e2;
15737 try
15738 {
15739 try_Statement();
15740 lk = -1;
15741 }
15742 catch (p1A)
15743 {
15744 lk = -2;
15745 }
15746 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
15747 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
15748 b2 = b2A; e2 = e2A; end = e2A; }}
15749 memoize(6, e0, lk);
15750 }
15751 }
15752 if (lk != -1
15753 && lk != 16134 // 'variable' '$'
15754 && lk != 27141 // Wildcard ';'
15755 && lk != 27142 // EQName^Token ';'
15756 && lk != 27144 // IntegerLiteral ';'
15757 && lk != 27145 // DecimalLiteral ';'
15758 && lk != 27146 // DoubleLiteral ';'
15759 && lk != 27147 // StringLiteral ';'
15760 && lk != 27180 // '.' ';'
15761 && lk != 27181 // '..' ';'
15762 && lk != 27182 // '/' ';'
15763 && lk != 27206 // 'after' ';'
15764 && lk != 27208 // 'allowing' ';'
15765 && lk != 27209 // 'ancestor' ';'
15766 && lk != 27210 // 'ancestor-or-self' ';'
15767 && lk != 27211 // 'and' ';'
15768 && lk != 27214 // 'array' ';'
15769 && lk != 27215 // 'as' ';'
15770 && lk != 27216 // 'ascending' ';'
15771 && lk != 27217 // 'at' ';'
15772 && lk != 27218 // 'attribute' ';'
15773 && lk != 27219 // 'base-uri' ';'
15774 && lk != 27220 // 'before' ';'
15775 && lk != 27221 // 'boundary-space' ';'
15776 && lk != 27222 // 'break' ';'
15777 && lk != 27224 // 'case' ';'
15778 && lk != 27225 // 'cast' ';'
15779 && lk != 27226 // 'castable' ';'
15780 && lk != 27227 // 'catch' ';'
15781 && lk != 27229 // 'child' ';'
15782 && lk != 27230 // 'collation' ';'
15783 && lk != 27232 // 'comment' ';'
15784 && lk != 27233 // 'constraint' ';'
15785 && lk != 27234 // 'construction' ';'
15786 && lk != 27237 // 'context' ';'
15787 && lk != 27238 // 'continue' ';'
15788 && lk != 27239 // 'copy' ';'
15789 && lk != 27240 // 'copy-namespaces' ';'
15790 && lk != 27241 // 'count' ';'
15791 && lk != 27242 // 'decimal-format' ';'
15792 && lk != 27244 // 'declare' ';'
15793 && lk != 27245 // 'default' ';'
15794 && lk != 27246 // 'delete' ';'
15795 && lk != 27247 // 'descendant' ';'
15796 && lk != 27248 // 'descendant-or-self' ';'
15797 && lk != 27249 // 'descending' ';'
15798 && lk != 27254 // 'div' ';'
15799 && lk != 27255 // 'document' ';'
15800 && lk != 27256 // 'document-node' ';'
15801 && lk != 27257 // 'element' ';'
15802 && lk != 27258 // 'else' ';'
15803 && lk != 27259 // 'empty' ';'
15804 && lk != 27260 // 'empty-sequence' ';'
15805 && lk != 27261 // 'encoding' ';'
15806 && lk != 27262 // 'end' ';'
15807 && lk != 27264 // 'eq' ';'
15808 && lk != 27265 // 'every' ';'
15809 && lk != 27267 // 'except' ';'
15810 && lk != 27268 // 'exit' ';'
15811 && lk != 27269 // 'external' ';'
15812 && lk != 27270 // 'first' ';'
15813 && lk != 27271 // 'following' ';'
15814 && lk != 27272 // 'following-sibling' ';'
15815 && lk != 27273 // 'for' ';'
15816 && lk != 27277 // 'ft-option' ';'
15817 && lk != 27281 // 'function' ';'
15818 && lk != 27282 // 'ge' ';'
15819 && lk != 27284 // 'group' ';'
15820 && lk != 27286 // 'gt' ';'
15821 && lk != 27287 // 'idiv' ';'
15822 && lk != 27288 // 'if' ';'
15823 && lk != 27289 // 'import' ';'
15824 && lk != 27290 // 'in' ';'
15825 && lk != 27291 // 'index' ';'
15826 && lk != 27295 // 'insert' ';'
15827 && lk != 27296 // 'instance' ';'
15828 && lk != 27297 // 'integrity' ';'
15829 && lk != 27298 // 'intersect' ';'
15830 && lk != 27299 // 'into' ';'
15831 && lk != 27300 // 'is' ';'
15832 && lk != 27301 // 'item' ';'
15833 && lk != 27303 // 'json-item' ';'
15834 && lk != 27306 // 'last' ';'
15835 && lk != 27307 // 'lax' ';'
15836 && lk != 27308 // 'le' ';'
15837 && lk != 27310 // 'let' ';'
15838 && lk != 27312 // 'loop' ';'
15839 && lk != 27314 // 'lt' ';'
15840 && lk != 27316 // 'mod' ';'
15841 && lk != 27317 // 'modify' ';'
15842 && lk != 27318 // 'module' ';'
15843 && lk != 27320 // 'namespace' ';'
15844 && lk != 27321 // 'namespace-node' ';'
15845 && lk != 27322 // 'ne' ';'
15846 && lk != 27327 // 'node' ';'
15847 && lk != 27328 // 'nodes' ';'
15848 && lk != 27330 // 'object' ';'
15849 && lk != 27334 // 'only' ';'
15850 && lk != 27335 // 'option' ';'
15851 && lk != 27336 // 'or' ';'
15852 && lk != 27337 // 'order' ';'
15853 && lk != 27338 // 'ordered' ';'
15854 && lk != 27339 // 'ordering' ';'
15855 && lk != 27342 // 'parent' ';'
15856 && lk != 27348 // 'preceding' ';'
15857 && lk != 27349 // 'preceding-sibling' ';'
15858 && lk != 27352 // 'processing-instruction' ';'
15859 && lk != 27354 // 'rename' ';'
15860 && lk != 27355 // 'replace' ';'
15861 && lk != 27356 // 'return' ';'
15862 && lk != 27357 // 'returning' ';'
15863 && lk != 27358 // 'revalidation' ';'
15864 && lk != 27360 // 'satisfies' ';'
15865 && lk != 27361 // 'schema' ';'
15866 && lk != 27362 // 'schema-attribute' ';'
15867 && lk != 27363 // 'schema-element' ';'
15868 && lk != 27364 // 'score' ';'
15869 && lk != 27365 // 'self' ';'
15870 && lk != 27370 // 'sliding' ';'
15871 && lk != 27371 // 'some' ';'
15872 && lk != 27372 // 'stable' ';'
15873 && lk != 27373 // 'start' ';'
15874 && lk != 27376 // 'strict' ';'
15875 && lk != 27379 // 'switch' ';'
15876 && lk != 27380 // 'text' ';'
15877 && lk != 27384 // 'to' ';'
15878 && lk != 27385 // 'treat' ';'
15879 && lk != 27386 // 'try' ';'
15880 && lk != 27387 // 'tumbling' ';'
15881 && lk != 27388 // 'type' ';'
15882 && lk != 27389 // 'typeswitch' ';'
15883 && lk != 27390 // 'union' ';'
15884 && lk != 27392 // 'unordered' ';'
15885 && lk != 27393 // 'updating' ';'
15886 && lk != 27396 // 'validate' ';'
15887 && lk != 27397 // 'value' ';'
15888 && lk != 27398 // 'variable' ';'
15889 && lk != 27399 // 'version' ';'
15890 && lk != 27402 // 'where' ';'
15891 && lk != 27403 // 'while' ';'
15892 && lk != 27406 // 'with' ';'
15893 && lk != 27410 // 'xquery' ';'
15894 && lk != 90198 // 'break' 'loop'
15895 && lk != 90214 // 'continue' 'loop'
15896 && lk != 113284) // 'exit' 'returning'
15897 {
15898 break;
15899 }
15900 whitespace();
15901 parse_Statement();
15902 }
15903 eventHandler.endNonterminal("Statements", e0);
15904 }
15905
15906 function try_Statements()
15907 {
15908 for (;;)
15909 {
15910 lookahead1W(274); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
15911 switch (l1)
15912 {
15913 case 34: // '('
15914 lookahead2W(269); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
15915 break;
15916 case 35: // '(#'
15917 lookahead2(250); // EQName^Token | S | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
15918 break;
15919 case 46: // '/'
15920 lookahead2W(281); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
15921 break;
15922 case 47: // '//'
15923 lookahead2W(263); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
15924 break;
15925 case 54: // '<'
15926 lookahead2(4); // QName
15927 break;
15928 case 55: // '<!--'
15929 lookahead2(1); // DirCommentContents
15930 break;
15931 case 59: // '<?'
15932 lookahead2(3); // PITarget
15933 break;
15934 case 66: // '@'
15935 lookahead2W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
15936 break;
15937 case 68: // '['
15938 lookahead2W(271); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
15939 break;
15940 case 77: // 'append'
15941 lookahead2W(56); // S^WS | '(:' | 'json'
15942 break;
15943 case 82: // 'attribute'
15944 lookahead2W(278); // EQName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' |
15945 break;
15946 case 121: // 'element'
15947 lookahead2W(277); // EQName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' |
15948 break;
15949 case 132: // 'exit'
15950 lookahead2W(202); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15951 break;
15952 case 137: // 'for'
15953 lookahead2W(206); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' |
15954 break;
15955 case 174: // 'let'
15956 lookahead2W(204); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' |
15957 break;
15958 case 218: // 'rename'
15959 lookahead2W(205); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15960 break;
15961 case 219: // 'replace'
15962 lookahead2W(208); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15963 break;
15964 case 260: // 'validate'
15965 lookahead2W(209); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15966 break;
15967 case 276: // '{'
15968 lookahead2W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
15969 break;
15970 case 278: // '{|'
15971 lookahead2W(272); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
15972 break;
15973 case 5: // Wildcard
15974 case 45: // '..'
15975 lookahead2W(186); // S^WS | EOF | '!' | '!=' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' | ';' | '<' |
15976 break;
15977 case 31: // '$'
15978 case 32: // '%'
15979 lookahead2W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
15980 break;
15981 case 40: // '+'
15982 case 42: // '-'
15983 lookahead2W(265); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
15984 break;
15985 case 86: // 'break'
15986 case 102: // 'continue'
15987 lookahead2W(200); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15988 break;
15989 case 110: // 'delete'
15990 case 159: // 'insert'
15991 lookahead2W(207); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
15992 break;
15993 case 124: // 'empty-sequence'
15994 case 165: // 'item'
15995 lookahead2W(191); // S^WS | EOF | '!' | '!=' | '#' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' | ';' |
15996 break;
15997 case 184: // 'namespace'
15998 case 216: // 'processing-instruction'
15999 lookahead2W(266); // NCName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' |
16000 break;
16001 case 103: // 'copy'
16002 case 129: // 'every'
16003 case 235: // 'some'
16004 case 262: // 'variable'
16005 lookahead2W(197); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' |
16006 break;
16007 case 8: // IntegerLiteral
16008 case 9: // DecimalLiteral
16009 case 10: // DoubleLiteral
16010 case 11: // StringLiteral
16011 case 44: // '.'
16012 lookahead2W(192); // S^WS | EOF | '!' | '!=' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' | ';' |
16013 break;
16014 case 96: // 'comment'
16015 case 119: // 'document'
16016 case 202: // 'ordered'
16017 case 244: // 'text'
16018 case 250: // 'try'
16019 case 256: // 'unordered'
16020 lookahead2W(203); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
16021 break;
16022 case 73: // 'ancestor'
16023 case 74: // 'ancestor-or-self'
16024 case 93: // 'child'
16025 case 111: // 'descendant'
16026 case 112: // 'descendant-or-self'
16027 case 135: // 'following'
16028 case 136: // 'following-sibling'
16029 case 206: // 'parent'
16030 case 212: // 'preceding'
16031 case 213: // 'preceding-sibling'
16032 case 229: // 'self'
16033 lookahead2W(198); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
16034 break;
16035 case 6: // EQName^Token
16036 case 70: // 'after'
16037 case 72: // 'allowing'
16038 case 75: // 'and'
16039 case 78: // 'array'
16040 case 79: // 'as'
16041 case 80: // 'ascending'
16042 case 81: // 'at'
16043 case 83: // 'base-uri'
16044 case 84: // 'before'
16045 case 85: // 'boundary-space'
16046 case 88: // 'case'
16047 case 89: // 'cast'
16048 case 90: // 'castable'
16049 case 91: // 'catch'
16050 case 94: // 'collation'
16051 case 97: // 'constraint'
16052 case 98: // 'construction'
16053 case 101: // 'context'
16054 case 104: // 'copy-namespaces'
16055 case 105: // 'count'
16056 case 106: // 'decimal-format'
16057 case 108: // 'declare'
16058 case 109: // 'default'
16059 case 113: // 'descending'
16060 case 118: // 'div'
16061 case 120: // 'document-node'
16062 case 122: // 'else'
16063 case 123: // 'empty'
16064 case 125: // 'encoding'
16065 case 126: // 'end'
16066 case 128: // 'eq'
16067 case 131: // 'except'
16068 case 133: // 'external'
16069 case 134: // 'first'
16070 case 141: // 'ft-option'
16071 case 145: // 'function'
16072 case 146: // 'ge'
16073 case 148: // 'group'
16074 case 150: // 'gt'
16075 case 151: // 'idiv'
16076 case 152: // 'if'
16077 case 153: // 'import'
16078 case 154: // 'in'
16079 case 155: // 'index'
16080 case 160: // 'instance'
16081 case 161: // 'integrity'
16082 case 162: // 'intersect'
16083 case 163: // 'into'
16084 case 164: // 'is'
16085 case 167: // 'json-item'
16086 case 170: // 'last'
16087 case 171: // 'lax'
16088 case 172: // 'le'
16089 case 176: // 'loop'
16090 case 178: // 'lt'
16091 case 180: // 'mod'
16092 case 181: // 'modify'
16093 case 182: // 'module'
16094 case 185: // 'namespace-node'
16095 case 186: // 'ne'
16096 case 191: // 'node'
16097 case 192: // 'nodes'
16098 case 194: // 'object'
16099 case 198: // 'only'
16100 case 199: // 'option'
16101 case 200: // 'or'
16102 case 201: // 'order'
16103 case 203: // 'ordering'
16104 case 220: // 'return'
16105 case 221: // 'returning'
16106 case 222: // 'revalidation'
16107 case 224: // 'satisfies'
16108 case 225: // 'schema'
16109 case 226: // 'schema-attribute'
16110 case 227: // 'schema-element'
16111 case 228: // 'score'
16112 case 234: // 'sliding'
16113 case 236: // 'stable'
16114 case 237: // 'start'
16115 case 240: // 'strict'
16116 case 243: // 'switch'
16117 case 248: // 'to'
16118 case 249: // 'treat'
16119 case 251: // 'tumbling'
16120 case 252: // 'type'
16121 case 253: // 'typeswitch'
16122 case 254: // 'union'
16123 case 257: // 'updating'
16124 case 261: // 'value'
16125 case 263: // 'version'
16126 case 266: // 'where'
16127 case 267: // 'while'
16128 case 270: // 'with'
16129 case 274: // 'xquery'
16130 lookahead2W(195); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | ',' | '-' | '/' | '//' |
16131 break;
16132 default:
16133 lk = l1;
16134 }
16135 if (lk != 25 // EOF
16136 && lk != 282 // '}'
16137 && lk != 12805 // Wildcard EOF
16138 && lk != 12806 // EQName^Token EOF
16139 && lk != 12808 // IntegerLiteral EOF
16140 && lk != 12809 // DecimalLiteral EOF
16141 && lk != 12810 // DoubleLiteral EOF
16142 && lk != 12811 // StringLiteral EOF
16143 && lk != 12844 // '.' EOF
16144 && lk != 12845 // '..' EOF
16145 && lk != 12846 // '/' EOF
16146 && lk != 12870 // 'after' EOF
16147 && lk != 12872 // 'allowing' EOF
16148 && lk != 12873 // 'ancestor' EOF
16149 && lk != 12874 // 'ancestor-or-self' EOF
16150 && lk != 12875 // 'and' EOF
16151 && lk != 12878 // 'array' EOF
16152 && lk != 12879 // 'as' EOF
16153 && lk != 12880 // 'ascending' EOF
16154 && lk != 12881 // 'at' EOF
16155 && lk != 12882 // 'attribute' EOF
16156 && lk != 12883 // 'base-uri' EOF
16157 && lk != 12884 // 'before' EOF
16158 && lk != 12885 // 'boundary-space' EOF
16159 && lk != 12886 // 'break' EOF
16160 && lk != 12888 // 'case' EOF
16161 && lk != 12889 // 'cast' EOF
16162 && lk != 12890 // 'castable' EOF
16163 && lk != 12891 // 'catch' EOF
16164 && lk != 12893 // 'child' EOF
16165 && lk != 12894 // 'collation' EOF
16166 && lk != 12896 // 'comment' EOF
16167 && lk != 12897 // 'constraint' EOF
16168 && lk != 12898 // 'construction' EOF
16169 && lk != 12901 // 'context' EOF
16170 && lk != 12902 // 'continue' EOF
16171 && lk != 12903 // 'copy' EOF
16172 && lk != 12904 // 'copy-namespaces' EOF
16173 && lk != 12905 // 'count' EOF
16174 && lk != 12906 // 'decimal-format' EOF
16175 && lk != 12908 // 'declare' EOF
16176 && lk != 12909 // 'default' EOF
16177 && lk != 12910 // 'delete' EOF
16178 && lk != 12911 // 'descendant' EOF
16179 && lk != 12912 // 'descendant-or-self' EOF
16180 && lk != 12913 // 'descending' EOF
16181 && lk != 12918 // 'div' EOF
16182 && lk != 12919 // 'document' EOF
16183 && lk != 12920 // 'document-node' EOF
16184 && lk != 12921 // 'element' EOF
16185 && lk != 12922 // 'else' EOF
16186 && lk != 12923 // 'empty' EOF
16187 && lk != 12924 // 'empty-sequence' EOF
16188 && lk != 12925 // 'encoding' EOF
16189 && lk != 12926 // 'end' EOF
16190 && lk != 12928 // 'eq' EOF
16191 && lk != 12929 // 'every' EOF
16192 && lk != 12931 // 'except' EOF
16193 && lk != 12932 // 'exit' EOF
16194 && lk != 12933 // 'external' EOF
16195 && lk != 12934 // 'first' EOF
16196 && lk != 12935 // 'following' EOF
16197 && lk != 12936 // 'following-sibling' EOF
16198 && lk != 12937 // 'for' EOF
16199 && lk != 12941 // 'ft-option' EOF
16200 && lk != 12945 // 'function' EOF
16201 && lk != 12946 // 'ge' EOF
16202 && lk != 12948 // 'group' EOF
16203 && lk != 12950 // 'gt' EOF
16204 && lk != 12951 // 'idiv' EOF
16205 && lk != 12952 // 'if' EOF
16206 && lk != 12953 // 'import' EOF
16207 && lk != 12954 // 'in' EOF
16208 && lk != 12955 // 'index' EOF
16209 && lk != 12959 // 'insert' EOF
16210 && lk != 12960 // 'instance' EOF
16211 && lk != 12961 // 'integrity' EOF
16212 && lk != 12962 // 'intersect' EOF
16213 && lk != 12963 // 'into' EOF
16214 && lk != 12964 // 'is' EOF
16215 && lk != 12965 // 'item' EOF
16216 && lk != 12967 // 'json-item' EOF
16217 && lk != 12970 // 'last' EOF
16218 && lk != 12971 // 'lax' EOF
16219 && lk != 12972 // 'le' EOF
16220 && lk != 12974 // 'let' EOF
16221 && lk != 12976 // 'loop' EOF
16222 && lk != 12978 // 'lt' EOF
16223 && lk != 12980 // 'mod' EOF
16224 && lk != 12981 // 'modify' EOF
16225 && lk != 12982 // 'module' EOF
16226 && lk != 12984 // 'namespace' EOF
16227 && lk != 12985 // 'namespace-node' EOF
16228 && lk != 12986 // 'ne' EOF
16229 && lk != 12991 // 'node' EOF
16230 && lk != 12992 // 'nodes' EOF
16231 && lk != 12994 // 'object' EOF
16232 && lk != 12998 // 'only' EOF
16233 && lk != 12999 // 'option' EOF
16234 && lk != 13000 // 'or' EOF
16235 && lk != 13001 // 'order' EOF
16236 && lk != 13002 // 'ordered' EOF
16237 && lk != 13003 // 'ordering' EOF
16238 && lk != 13006 // 'parent' EOF
16239 && lk != 13012 // 'preceding' EOF
16240 && lk != 13013 // 'preceding-sibling' EOF
16241 && lk != 13016 // 'processing-instruction' EOF
16242 && lk != 13018 // 'rename' EOF
16243 && lk != 13019 // 'replace' EOF
16244 && lk != 13020 // 'return' EOF
16245 && lk != 13021 // 'returning' EOF
16246 && lk != 13022 // 'revalidation' EOF
16247 && lk != 13024 // 'satisfies' EOF
16248 && lk != 13025 // 'schema' EOF
16249 && lk != 13026 // 'schema-attribute' EOF
16250 && lk != 13027 // 'schema-element' EOF
16251 && lk != 13028 // 'score' EOF
16252 && lk != 13029 // 'self' EOF
16253 && lk != 13034 // 'sliding' EOF
16254 && lk != 13035 // 'some' EOF
16255 && lk != 13036 // 'stable' EOF
16256 && lk != 13037 // 'start' EOF
16257 && lk != 13040 // 'strict' EOF
16258 && lk != 13043 // 'switch' EOF
16259 && lk != 13044 // 'text' EOF
16260 && lk != 13048 // 'to' EOF
16261 && lk != 13049 // 'treat' EOF
16262 && lk != 13050 // 'try' EOF
16263 && lk != 13051 // 'tumbling' EOF
16264 && lk != 13052 // 'type' EOF
16265 && lk != 13053 // 'typeswitch' EOF
16266 && lk != 13054 // 'union' EOF
16267 && lk != 13056 // 'unordered' EOF
16268 && lk != 13057 // 'updating' EOF
16269 && lk != 13060 // 'validate' EOF
16270 && lk != 13061 // 'value' EOF
16271 && lk != 13062 // 'variable' EOF
16272 && lk != 13063 // 'version' EOF
16273 && lk != 13066 // 'where' EOF
16274 && lk != 13067 // 'while' EOF
16275 && lk != 13070 // 'with' EOF
16276 && lk != 13074 // 'xquery' EOF
16277 && lk != 16134 // 'variable' '$'
16278 && lk != 20997 // Wildcard ','
16279 && lk != 20998 // EQName^Token ','
16280 && lk != 21000 // IntegerLiteral ','
16281 && lk != 21001 // DecimalLiteral ','
16282 && lk != 21002 // DoubleLiteral ','
16283 && lk != 21003 // StringLiteral ','
16284 && lk != 21036 // '.' ','
16285 && lk != 21037 // '..' ','
16286 && lk != 21038 // '/' ','
16287 && lk != 21062 // 'after' ','
16288 && lk != 21064 // 'allowing' ','
16289 && lk != 21065 // 'ancestor' ','
16290 && lk != 21066 // 'ancestor-or-self' ','
16291 && lk != 21067 // 'and' ','
16292 && lk != 21070 // 'array' ','
16293 && lk != 21071 // 'as' ','
16294 && lk != 21072 // 'ascending' ','
16295 && lk != 21073 // 'at' ','
16296 && lk != 21074 // 'attribute' ','
16297 && lk != 21075 // 'base-uri' ','
16298 && lk != 21076 // 'before' ','
16299 && lk != 21077 // 'boundary-space' ','
16300 && lk != 21078 // 'break' ','
16301 && lk != 21080 // 'case' ','
16302 && lk != 21081 // 'cast' ','
16303 && lk != 21082 // 'castable' ','
16304 && lk != 21083 // 'catch' ','
16305 && lk != 21085 // 'child' ','
16306 && lk != 21086 // 'collation' ','
16307 && lk != 21088 // 'comment' ','
16308 && lk != 21089 // 'constraint' ','
16309 && lk != 21090 // 'construction' ','
16310 && lk != 21093 // 'context' ','
16311 && lk != 21094 // 'continue' ','
16312 && lk != 21095 // 'copy' ','
16313 && lk != 21096 // 'copy-namespaces' ','
16314 && lk != 21097 // 'count' ','
16315 && lk != 21098 // 'decimal-format' ','
16316 && lk != 21100 // 'declare' ','
16317 && lk != 21101 // 'default' ','
16318 && lk != 21102 // 'delete' ','
16319 && lk != 21103 // 'descendant' ','
16320 && lk != 21104 // 'descendant-or-self' ','
16321 && lk != 21105 // 'descending' ','
16322 && lk != 21110 // 'div' ','
16323 && lk != 21111 // 'document' ','
16324 && lk != 21112 // 'document-node' ','
16325 && lk != 21113 // 'element' ','
16326 && lk != 21114 // 'else' ','
16327 && lk != 21115 // 'empty' ','
16328 && lk != 21116 // 'empty-sequence' ','
16329 && lk != 21117 // 'encoding' ','
16330 && lk != 21118 // 'end' ','
16331 && lk != 21120 // 'eq' ','
16332 && lk != 21121 // 'every' ','
16333 && lk != 21123 // 'except' ','
16334 && lk != 21124 // 'exit' ','
16335 && lk != 21125 // 'external' ','
16336 && lk != 21126 // 'first' ','
16337 && lk != 21127 // 'following' ','
16338 && lk != 21128 // 'following-sibling' ','
16339 && lk != 21129 // 'for' ','
16340 && lk != 21133 // 'ft-option' ','
16341 && lk != 21137 // 'function' ','
16342 && lk != 21138 // 'ge' ','
16343 && lk != 21140 // 'group' ','
16344 && lk != 21142 // 'gt' ','
16345 && lk != 21143 // 'idiv' ','
16346 && lk != 21144 // 'if' ','
16347 && lk != 21145 // 'import' ','
16348 && lk != 21146 // 'in' ','
16349 && lk != 21147 // 'index' ','
16350 && lk != 21151 // 'insert' ','
16351 && lk != 21152 // 'instance' ','
16352 && lk != 21153 // 'integrity' ','
16353 && lk != 21154 // 'intersect' ','
16354 && lk != 21155 // 'into' ','
16355 && lk != 21156 // 'is' ','
16356 && lk != 21157 // 'item' ','
16357 && lk != 21159 // 'json-item' ','
16358 && lk != 21162 // 'last' ','
16359 && lk != 21163 // 'lax' ','
16360 && lk != 21164 // 'le' ','
16361 && lk != 21166 // 'let' ','
16362 && lk != 21168 // 'loop' ','
16363 && lk != 21170 // 'lt' ','
16364 && lk != 21172 // 'mod' ','
16365 && lk != 21173 // 'modify' ','
16366 && lk != 21174 // 'module' ','
16367 && lk != 21176 // 'namespace' ','
16368 && lk != 21177 // 'namespace-node' ','
16369 && lk != 21178 // 'ne' ','
16370 && lk != 21183 // 'node' ','
16371 && lk != 21184 // 'nodes' ','
16372 && lk != 21186 // 'object' ','
16373 && lk != 21190 // 'only' ','
16374 && lk != 21191 // 'option' ','
16375 && lk != 21192 // 'or' ','
16376 && lk != 21193 // 'order' ','
16377 && lk != 21194 // 'ordered' ','
16378 && lk != 21195 // 'ordering' ','
16379 && lk != 21198 // 'parent' ','
16380 && lk != 21204 // 'preceding' ','
16381 && lk != 21205 // 'preceding-sibling' ','
16382 && lk != 21208 // 'processing-instruction' ','
16383 && lk != 21210 // 'rename' ','
16384 && lk != 21211 // 'replace' ','
16385 && lk != 21212 // 'return' ','
16386 && lk != 21213 // 'returning' ','
16387 && lk != 21214 // 'revalidation' ','
16388 && lk != 21216 // 'satisfies' ','
16389 && lk != 21217 // 'schema' ','
16390 && lk != 21218 // 'schema-attribute' ','
16391 && lk != 21219 // 'schema-element' ','
16392 && lk != 21220 // 'score' ','
16393 && lk != 21221 // 'self' ','
16394 && lk != 21226 // 'sliding' ','
16395 && lk != 21227 // 'some' ','
16396 && lk != 21228 // 'stable' ','
16397 && lk != 21229 // 'start' ','
16398 && lk != 21232 // 'strict' ','
16399 && lk != 21235 // 'switch' ','
16400 && lk != 21236 // 'text' ','
16401 && lk != 21240 // 'to' ','
16402 && lk != 21241 // 'treat' ','
16403 && lk != 21242 // 'try' ','
16404 && lk != 21243 // 'tumbling' ','
16405 && lk != 21244 // 'type' ','
16406 && lk != 21245 // 'typeswitch' ','
16407 && lk != 21246 // 'union' ','
16408 && lk != 21248 // 'unordered' ','
16409 && lk != 21249 // 'updating' ','
16410 && lk != 21252 // 'validate' ','
16411 && lk != 21253 // 'value' ','
16412 && lk != 21254 // 'variable' ','
16413 && lk != 21255 // 'version' ','
16414 && lk != 21258 // 'where' ','
16415 && lk != 21259 // 'while' ','
16416 && lk != 21262 // 'with' ','
16417 && lk != 21266 // 'xquery' ','
16418 && lk != 27141 // Wildcard ';'
16419 && lk != 27142 // EQName^Token ';'
16420 && lk != 27144 // IntegerLiteral ';'
16421 && lk != 27145 // DecimalLiteral ';'
16422 && lk != 27146 // DoubleLiteral ';'
16423 && lk != 27147 // StringLiteral ';'
16424 && lk != 27180 // '.' ';'
16425 && lk != 27181 // '..' ';'
16426 && lk != 27182 // '/' ';'
16427 && lk != 27206 // 'after' ';'
16428 && lk != 27208 // 'allowing' ';'
16429 && lk != 27209 // 'ancestor' ';'
16430 && lk != 27210 // 'ancestor-or-self' ';'
16431 && lk != 27211 // 'and' ';'
16432 && lk != 27214 // 'array' ';'
16433 && lk != 27215 // 'as' ';'
16434 && lk != 27216 // 'ascending' ';'
16435 && lk != 27217 // 'at' ';'
16436 && lk != 27218 // 'attribute' ';'
16437 && lk != 27219 // 'base-uri' ';'
16438 && lk != 27220 // 'before' ';'
16439 && lk != 27221 // 'boundary-space' ';'
16440 && lk != 27222 // 'break' ';'
16441 && lk != 27224 // 'case' ';'
16442 && lk != 27225 // 'cast' ';'
16443 && lk != 27226 // 'castable' ';'
16444 && lk != 27227 // 'catch' ';'
16445 && lk != 27229 // 'child' ';'
16446 && lk != 27230 // 'collation' ';'
16447 && lk != 27232 // 'comment' ';'
16448 && lk != 27233 // 'constraint' ';'
16449 && lk != 27234 // 'construction' ';'
16450 && lk != 27237 // 'context' ';'
16451 && lk != 27238 // 'continue' ';'
16452 && lk != 27239 // 'copy' ';'
16453 && lk != 27240 // 'copy-namespaces' ';'
16454 && lk != 27241 // 'count' ';'
16455 && lk != 27242 // 'decimal-format' ';'
16456 && lk != 27244 // 'declare' ';'
16457 && lk != 27245 // 'default' ';'
16458 && lk != 27246 // 'delete' ';'
16459 && lk != 27247 // 'descendant' ';'
16460 && lk != 27248 // 'descendant-or-self' ';'
16461 && lk != 27249 // 'descending' ';'
16462 && lk != 27254 // 'div' ';'
16463 && lk != 27255 // 'document' ';'
16464 && lk != 27256 // 'document-node' ';'
16465 && lk != 27257 // 'element' ';'
16466 && lk != 27258 // 'else' ';'
16467 && lk != 27259 // 'empty' ';'
16468 && lk != 27260 // 'empty-sequence' ';'
16469 && lk != 27261 // 'encoding' ';'
16470 && lk != 27262 // 'end' ';'
16471 && lk != 27264 // 'eq' ';'
16472 && lk != 27265 // 'every' ';'
16473 && lk != 27267 // 'except' ';'
16474 && lk != 27268 // 'exit' ';'
16475 && lk != 27269 // 'external' ';'
16476 && lk != 27270 // 'first' ';'
16477 && lk != 27271 // 'following' ';'
16478 && lk != 27272 // 'following-sibling' ';'
16479 && lk != 27273 // 'for' ';'
16480 && lk != 27277 // 'ft-option' ';'
16481 && lk != 27281 // 'function' ';'
16482 && lk != 27282 // 'ge' ';'
16483 && lk != 27284 // 'group' ';'
16484 && lk != 27286 // 'gt' ';'
16485 && lk != 27287 // 'idiv' ';'
16486 && lk != 27288 // 'if' ';'
16487 && lk != 27289 // 'import' ';'
16488 && lk != 27290 // 'in' ';'
16489 && lk != 27291 // 'index' ';'
16490 && lk != 27295 // 'insert' ';'
16491 && lk != 27296 // 'instance' ';'
16492 && lk != 27297 // 'integrity' ';'
16493 && lk != 27298 // 'intersect' ';'
16494 && lk != 27299 // 'into' ';'
16495 && lk != 27300 // 'is' ';'
16496 && lk != 27301 // 'item' ';'
16497 && lk != 27303 // 'json-item' ';'
16498 && lk != 27306 // 'last' ';'
16499 && lk != 27307 // 'lax' ';'
16500 && lk != 27308 // 'le' ';'
16501 && lk != 27310 // 'let' ';'
16502 && lk != 27312 // 'loop' ';'
16503 && lk != 27314 // 'lt' ';'
16504 && lk != 27316 // 'mod' ';'
16505 && lk != 27317 // 'modify' ';'
16506 && lk != 27318 // 'module' ';'
16507 && lk != 27320 // 'namespace' ';'
16508 && lk != 27321 // 'namespace-node' ';'
16509 && lk != 27322 // 'ne' ';'
16510 && lk != 27327 // 'node' ';'
16511 && lk != 27328 // 'nodes' ';'
16512 && lk != 27330 // 'object' ';'
16513 && lk != 27334 // 'only' ';'
16514 && lk != 27335 // 'option' ';'
16515 && lk != 27336 // 'or' ';'
16516 && lk != 27337 // 'order' ';'
16517 && lk != 27338 // 'ordered' ';'
16518 && lk != 27339 // 'ordering' ';'
16519 && lk != 27342 // 'parent' ';'
16520 && lk != 27348 // 'preceding' ';'
16521 && lk != 27349 // 'preceding-sibling' ';'
16522 && lk != 27352 // 'processing-instruction' ';'
16523 && lk != 27354 // 'rename' ';'
16524 && lk != 27355 // 'replace' ';'
16525 && lk != 27356 // 'return' ';'
16526 && lk != 27357 // 'returning' ';'
16527 && lk != 27358 // 'revalidation' ';'
16528 && lk != 27360 // 'satisfies' ';'
16529 && lk != 27361 // 'schema' ';'
16530 && lk != 27362 // 'schema-attribute' ';'
16531 && lk != 27363 // 'schema-element' ';'
16532 && lk != 27364 // 'score' ';'
16533 && lk != 27365 // 'self' ';'
16534 && lk != 27370 // 'sliding' ';'
16535 && lk != 27371 // 'some' ';'
16536 && lk != 27372 // 'stable' ';'
16537 && lk != 27373 // 'start' ';'
16538 && lk != 27376 // 'strict' ';'
16539 && lk != 27379 // 'switch' ';'
16540 && lk != 27380 // 'text' ';'
16541 && lk != 27384 // 'to' ';'
16542 && lk != 27385 // 'treat' ';'
16543 && lk != 27386 // 'try' ';'
16544 && lk != 27387 // 'tumbling' ';'
16545 && lk != 27388 // 'type' ';'
16546 && lk != 27389 // 'typeswitch' ';'
16547 && lk != 27390 // 'union' ';'
16548 && lk != 27392 // 'unordered' ';'
16549 && lk != 27393 // 'updating' ';'
16550 && lk != 27396 // 'validate' ';'
16551 && lk != 27397 // 'value' ';'
16552 && lk != 27398 // 'variable' ';'
16553 && lk != 27399 // 'version' ';'
16554 && lk != 27402 // 'where' ';'
16555 && lk != 27403 // 'while' ';'
16556 && lk != 27406 // 'with' ';'
16557 && lk != 27410 // 'xquery' ';'
16558 && lk != 90198 // 'break' 'loop'
16559 && lk != 90214 // 'continue' 'loop'
16560 && lk != 113284 // 'exit' 'returning'
16561 && lk != 144389 // Wildcard '}'
16562 && lk != 144390 // EQName^Token '}'
16563 && lk != 144392 // IntegerLiteral '}'
16564 && lk != 144393 // DecimalLiteral '}'
16565 && lk != 144394 // DoubleLiteral '}'
16566 && lk != 144395 // StringLiteral '}'
16567 && lk != 144428 // '.' '}'
16568 && lk != 144429 // '..' '}'
16569 && lk != 144430 // '/' '}'
16570 && lk != 144454 // 'after' '}'
16571 && lk != 144456 // 'allowing' '}'
16572 && lk != 144457 // 'ancestor' '}'
16573 && lk != 144458 // 'ancestor-or-self' '}'
16574 && lk != 144459 // 'and' '}'
16575 && lk != 144462 // 'array' '}'
16576 && lk != 144463 // 'as' '}'
16577 && lk != 144464 // 'ascending' '}'
16578 && lk != 144465 // 'at' '}'
16579 && lk != 144466 // 'attribute' '}'
16580 && lk != 144467 // 'base-uri' '}'
16581 && lk != 144468 // 'before' '}'
16582 && lk != 144469 // 'boundary-space' '}'
16583 && lk != 144470 // 'break' '}'
16584 && lk != 144472 // 'case' '}'
16585 && lk != 144473 // 'cast' '}'
16586 && lk != 144474 // 'castable' '}'
16587 && lk != 144475 // 'catch' '}'
16588 && lk != 144477 // 'child' '}'
16589 && lk != 144478 // 'collation' '}'
16590 && lk != 144480 // 'comment' '}'
16591 && lk != 144481 // 'constraint' '}'
16592 && lk != 144482 // 'construction' '}'
16593 && lk != 144485 // 'context' '}'
16594 && lk != 144486 // 'continue' '}'
16595 && lk != 144487 // 'copy' '}'
16596 && lk != 144488 // 'copy-namespaces' '}'
16597 && lk != 144489 // 'count' '}'
16598 && lk != 144490 // 'decimal-format' '}'
16599 && lk != 144492 // 'declare' '}'
16600 && lk != 144493 // 'default' '}'
16601 && lk != 144494 // 'delete' '}'
16602 && lk != 144495 // 'descendant' '}'
16603 && lk != 144496 // 'descendant-or-self' '}'
16604 && lk != 144497 // 'descending' '}'
16605 && lk != 144502 // 'div' '}'
16606 && lk != 144503 // 'document' '}'
16607 && lk != 144504 // 'document-node' '}'
16608 && lk != 144505 // 'element' '}'
16609 && lk != 144506 // 'else' '}'
16610 && lk != 144507 // 'empty' '}'
16611 && lk != 144508 // 'empty-sequence' '}'
16612 && lk != 144509 // 'encoding' '}'
16613 && lk != 144510 // 'end' '}'
16614 && lk != 144512 // 'eq' '}'
16615 && lk != 144513 // 'every' '}'
16616 && lk != 144515 // 'except' '}'
16617 && lk != 144516 // 'exit' '}'
16618 && lk != 144517 // 'external' '}'
16619 && lk != 144518 // 'first' '}'
16620 && lk != 144519 // 'following' '}'
16621 && lk != 144520 // 'following-sibling' '}'
16622 && lk != 144521 // 'for' '}'
16623 && lk != 144525 // 'ft-option' '}'
16624 && lk != 144529 // 'function' '}'
16625 && lk != 144530 // 'ge' '}'
16626 && lk != 144532 // 'group' '}'
16627 && lk != 144534 // 'gt' '}'
16628 && lk != 144535 // 'idiv' '}'
16629 && lk != 144536 // 'if' '}'
16630 && lk != 144537 // 'import' '}'
16631 && lk != 144538 // 'in' '}'
16632 && lk != 144539 // 'index' '}'
16633 && lk != 144543 // 'insert' '}'
16634 && lk != 144544 // 'instance' '}'
16635 && lk != 144545 // 'integrity' '}'
16636 && lk != 144546 // 'intersect' '}'
16637 && lk != 144547 // 'into' '}'
16638 && lk != 144548 // 'is' '}'
16639 && lk != 144549 // 'item' '}'
16640 && lk != 144551 // 'json-item' '}'
16641 && lk != 144554 // 'last' '}'
16642 && lk != 144555 // 'lax' '}'
16643 && lk != 144556 // 'le' '}'
16644 && lk != 144558 // 'let' '}'
16645 && lk != 144560 // 'loop' '}'
16646 && lk != 144562 // 'lt' '}'
16647 && lk != 144564 // 'mod' '}'
16648 && lk != 144565 // 'modify' '}'
16649 && lk != 144566 // 'module' '}'
16650 && lk != 144568 // 'namespace' '}'
16651 && lk != 144569 // 'namespace-node' '}'
16652 && lk != 144570 // 'ne' '}'
16653 && lk != 144575 // 'node' '}'
16654 && lk != 144576 // 'nodes' '}'
16655 && lk != 144578 // 'object' '}'
16656 && lk != 144582 // 'only' '}'
16657 && lk != 144583 // 'option' '}'
16658 && lk != 144584 // 'or' '}'
16659 && lk != 144585 // 'order' '}'
16660 && lk != 144586 // 'ordered' '}'
16661 && lk != 144587 // 'ordering' '}'
16662 && lk != 144590 // 'parent' '}'
16663 && lk != 144596 // 'preceding' '}'
16664 && lk != 144597 // 'preceding-sibling' '}'
16665 && lk != 144600 // 'processing-instruction' '}'
16666 && lk != 144602 // 'rename' '}'
16667 && lk != 144603 // 'replace' '}'
16668 && lk != 144604 // 'return' '}'
16669 && lk != 144605 // 'returning' '}'
16670 && lk != 144606 // 'revalidation' '}'
16671 && lk != 144608 // 'satisfies' '}'
16672 && lk != 144609 // 'schema' '}'
16673 && lk != 144610 // 'schema-attribute' '}'
16674 && lk != 144611 // 'schema-element' '}'
16675 && lk != 144612 // 'score' '}'
16676 && lk != 144613 // 'self' '}'
16677 && lk != 144618 // 'sliding' '}'
16678 && lk != 144619 // 'some' '}'
16679 && lk != 144620 // 'stable' '}'
16680 && lk != 144621 // 'start' '}'
16681 && lk != 144624 // 'strict' '}'
16682 && lk != 144627 // 'switch' '}'
16683 && lk != 144628 // 'text' '}'
16684 && lk != 144632 // 'to' '}'
16685 && lk != 144633 // 'treat' '}'
16686 && lk != 144634 // 'try' '}'
16687 && lk != 144635 // 'tumbling' '}'
16688 && lk != 144636 // 'type' '}'
16689 && lk != 144637 // 'typeswitch' '}'
16690 && lk != 144638 // 'union' '}'
16691 && lk != 144640 // 'unordered' '}'
16692 && lk != 144641 // 'updating' '}'
16693 && lk != 144644 // 'validate' '}'
16694 && lk != 144645 // 'value' '}'
16695 && lk != 144646 // 'variable' '}'
16696 && lk != 144647 // 'version' '}'
16697 && lk != 144650 // 'where' '}'
16698 && lk != 144651 // 'while' '}'
16699 && lk != 144654 // 'with' '}'
16700 && lk != 144658) // 'xquery' '}'
16701 {
16702 lk = memoized(6, e0);
16703 if (lk == 0)
16704 {
16705 var b0A = b0; var e0A = e0; var l1A = l1;
16706 var b1A = b1; var e1A = e1; var l2A = l2;
16707 var b2A = b2; var e2A = e2;
16708 try
16709 {
16710 try_Statement();
16711 memoize(6, e0A, -1);
16712 continue;
16713 }
16714 catch (p1A)
16715 {
16716 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
16717 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
16718 b2 = b2A; e2 = e2A; end = e2A; }}
16719 memoize(6, e0A, -2);
16720 break;
16721 }
16722 }
16723 }
16724 if (lk != -1
16725 && lk != 16134 // 'variable' '$'
16726 && lk != 27141 // Wildcard ';'
16727 && lk != 27142 // EQName^Token ';'
16728 && lk != 27144 // IntegerLiteral ';'
16729 && lk != 27145 // DecimalLiteral ';'
16730 && lk != 27146 // DoubleLiteral ';'
16731 && lk != 27147 // StringLiteral ';'
16732 && lk != 27180 // '.' ';'
16733 && lk != 27181 // '..' ';'
16734 && lk != 27182 // '/' ';'
16735 && lk != 27206 // 'after' ';'
16736 && lk != 27208 // 'allowing' ';'
16737 && lk != 27209 // 'ancestor' ';'
16738 && lk != 27210 // 'ancestor-or-self' ';'
16739 && lk != 27211 // 'and' ';'
16740 && lk != 27214 // 'array' ';'
16741 && lk != 27215 // 'as' ';'
16742 && lk != 27216 // 'ascending' ';'
16743 && lk != 27217 // 'at' ';'
16744 && lk != 27218 // 'attribute' ';'
16745 && lk != 27219 // 'base-uri' ';'
16746 && lk != 27220 // 'before' ';'
16747 && lk != 27221 // 'boundary-space' ';'
16748 && lk != 27222 // 'break' ';'
16749 && lk != 27224 // 'case' ';'
16750 && lk != 27225 // 'cast' ';'
16751 && lk != 27226 // 'castable' ';'
16752 && lk != 27227 // 'catch' ';'
16753 && lk != 27229 // 'child' ';'
16754 && lk != 27230 // 'collation' ';'
16755 && lk != 27232 // 'comment' ';'
16756 && lk != 27233 // 'constraint' ';'
16757 && lk != 27234 // 'construction' ';'
16758 && lk != 27237 // 'context' ';'
16759 && lk != 27238 // 'continue' ';'
16760 && lk != 27239 // 'copy' ';'
16761 && lk != 27240 // 'copy-namespaces' ';'
16762 && lk != 27241 // 'count' ';'
16763 && lk != 27242 // 'decimal-format' ';'
16764 && lk != 27244 // 'declare' ';'
16765 && lk != 27245 // 'default' ';'
16766 && lk != 27246 // 'delete' ';'
16767 && lk != 27247 // 'descendant' ';'
16768 && lk != 27248 // 'descendant-or-self' ';'
16769 && lk != 27249 // 'descending' ';'
16770 && lk != 27254 // 'div' ';'
16771 && lk != 27255 // 'document' ';'
16772 && lk != 27256 // 'document-node' ';'
16773 && lk != 27257 // 'element' ';'
16774 && lk != 27258 // 'else' ';'
16775 && lk != 27259 // 'empty' ';'
16776 && lk != 27260 // 'empty-sequence' ';'
16777 && lk != 27261 // 'encoding' ';'
16778 && lk != 27262 // 'end' ';'
16779 && lk != 27264 // 'eq' ';'
16780 && lk != 27265 // 'every' ';'
16781 && lk != 27267 // 'except' ';'
16782 && lk != 27268 // 'exit' ';'
16783 && lk != 27269 // 'external' ';'
16784 && lk != 27270 // 'first' ';'
16785 && lk != 27271 // 'following' ';'
16786 && lk != 27272 // 'following-sibling' ';'
16787 && lk != 27273 // 'for' ';'
16788 && lk != 27277 // 'ft-option' ';'
16789 && lk != 27281 // 'function' ';'
16790 && lk != 27282 // 'ge' ';'
16791 && lk != 27284 // 'group' ';'
16792 && lk != 27286 // 'gt' ';'
16793 && lk != 27287 // 'idiv' ';'
16794 && lk != 27288 // 'if' ';'
16795 && lk != 27289 // 'import' ';'
16796 && lk != 27290 // 'in' ';'
16797 && lk != 27291 // 'index' ';'
16798 && lk != 27295 // 'insert' ';'
16799 && lk != 27296 // 'instance' ';'
16800 && lk != 27297 // 'integrity' ';'
16801 && lk != 27298 // 'intersect' ';'
16802 && lk != 27299 // 'into' ';'
16803 && lk != 27300 // 'is' ';'
16804 && lk != 27301 // 'item' ';'
16805 && lk != 27303 // 'json-item' ';'
16806 && lk != 27306 // 'last' ';'
16807 && lk != 27307 // 'lax' ';'
16808 && lk != 27308 // 'le' ';'
16809 && lk != 27310 // 'let' ';'
16810 && lk != 27312 // 'loop' ';'
16811 && lk != 27314 // 'lt' ';'
16812 && lk != 27316 // 'mod' ';'
16813 && lk != 27317 // 'modify' ';'
16814 && lk != 27318 // 'module' ';'
16815 && lk != 27320 // 'namespace' ';'
16816 && lk != 27321 // 'namespace-node' ';'
16817 && lk != 27322 // 'ne' ';'
16818 && lk != 27327 // 'node' ';'
16819 && lk != 27328 // 'nodes' ';'
16820 && lk != 27330 // 'object' ';'
16821 && lk != 27334 // 'only' ';'
16822 && lk != 27335 // 'option' ';'
16823 && lk != 27336 // 'or' ';'
16824 && lk != 27337 // 'order' ';'
16825 && lk != 27338 // 'ordered' ';'
16826 && lk != 27339 // 'ordering' ';'
16827 && lk != 27342 // 'parent' ';'
16828 && lk != 27348 // 'preceding' ';'
16829 && lk != 27349 // 'preceding-sibling' ';'
16830 && lk != 27352 // 'processing-instruction' ';'
16831 && lk != 27354 // 'rename' ';'
16832 && lk != 27355 // 'replace' ';'
16833 && lk != 27356 // 'return' ';'
16834 && lk != 27357 // 'returning' ';'
16835 && lk != 27358 // 'revalidation' ';'
16836 && lk != 27360 // 'satisfies' ';'
16837 && lk != 27361 // 'schema' ';'
16838 && lk != 27362 // 'schema-attribute' ';'
16839 && lk != 27363 // 'schema-element' ';'
16840 && lk != 27364 // 'score' ';'
16841 && lk != 27365 // 'self' ';'
16842 && lk != 27370 // 'sliding' ';'
16843 && lk != 27371 // 'some' ';'
16844 && lk != 27372 // 'stable' ';'
16845 && lk != 27373 // 'start' ';'
16846 && lk != 27376 // 'strict' ';'
16847 && lk != 27379 // 'switch' ';'
16848 && lk != 27380 // 'text' ';'
16849 && lk != 27384 // 'to' ';'
16850 && lk != 27385 // 'treat' ';'
16851 && lk != 27386 // 'try' ';'
16852 && lk != 27387 // 'tumbling' ';'
16853 && lk != 27388 // 'type' ';'
16854 && lk != 27389 // 'typeswitch' ';'
16855 && lk != 27390 // 'union' ';'
16856 && lk != 27392 // 'unordered' ';'
16857 && lk != 27393 // 'updating' ';'
16858 && lk != 27396 // 'validate' ';'
16859 && lk != 27397 // 'value' ';'
16860 && lk != 27398 // 'variable' ';'
16861 && lk != 27399 // 'version' ';'
16862 && lk != 27402 // 'where' ';'
16863 && lk != 27403 // 'while' ';'
16864 && lk != 27406 // 'with' ';'
16865 && lk != 27410 // 'xquery' ';'
16866 && lk != 90198 // 'break' 'loop'
16867 && lk != 90214 // 'continue' 'loop'
16868 && lk != 113284) // 'exit' 'returning'
16869 {
16870 break;
16871 }
16872 try_Statement();
16873 }
16874 }
16875
16876 function parse_StatementsAndExpr()
16877 {
16878 eventHandler.startNonterminal("StatementsAndExpr", e0);
16879 parse_Statements();
16880 whitespace();
16881 parse_Expr();
16882 eventHandler.endNonterminal("StatementsAndExpr", e0);
16883 }
16884
16885 function try_StatementsAndExpr()
16886 {
16887 try_Statements();
16888 try_Expr();
16889 }
16890
16891 function parse_StatementsAndOptionalExpr()
16892 {
16893 eventHandler.startNonterminal("StatementsAndOptionalExpr", e0);
16894 parse_Statements();
16895 if (l1 != 25 // EOF
16896 && l1 != 282) // '}'
16897 {
16898 whitespace();
16899 parse_Expr();
16900 }
16901 eventHandler.endNonterminal("StatementsAndOptionalExpr", e0);
16902 }
16903
16904 function try_StatementsAndOptionalExpr()
16905 {
16906 try_Statements();
16907 if (l1 != 25 // EOF
16908 && l1 != 282) // '}'
16909 {
16910 try_Expr();
16911 }
16912 }
16913
16914 function parse_Statement()
16915 {
16916 eventHandler.startNonterminal("Statement", e0);
16917 switch (l1)
16918 {
16919 case 132: // 'exit'
16920 lookahead2W(189); // S^WS | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' | '<' |
16921 break;
16922 case 137: // 'for'
16923 lookahead2W(196); // S^WS | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' |
16924 break;
16925 case 174: // 'let'
16926 lookahead2W(193); // S^WS | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' |
16927 break;
16928 case 250: // 'try'
16929 lookahead2W(190); // S^WS | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' | '<' |
16930 break;
16931 case 262: // 'variable'
16932 lookahead2W(187); // S^WS | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' |
16933 break;
16934 case 276: // '{'
16935 lookahead2W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
16936 break;
16937 case 31: // '$'
16938 case 32: // '%'
16939 lookahead2W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
16940 break;
16941 case 86: // 'break'
16942 case 102: // 'continue'
16943 lookahead2W(188); // S^WS | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' | '<' |
16944 break;
16945 case 152: // 'if'
16946 case 243: // 'switch'
16947 case 253: // 'typeswitch'
16948 case 267: // 'while'
16949 lookahead2W(185); // S^WS | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' | '<' |
16950 break;
16951 default:
16952 lk = l1;
16953 }
16954 if (lk == 2836 // '{' Wildcard
16955 || lk == 3103 // '$' EQName^Token
16956 || lk == 3104 // '%' EQName^Token
16957 || lk == 3348 // '{' EQName^Token
16958 || lk == 4372 // '{' IntegerLiteral
16959 || lk == 4884 // '{' DecimalLiteral
16960 || lk == 5396 // '{' DoubleLiteral
16961 || lk == 5908 // '{' StringLiteral
16962 || lk == 16148 // '{' '$'
16963 || lk == 16660 // '{' '%'
16964 || lk == 17675 // 'while' '('
16965 || lk == 17684 // '{' '('
16966 || lk == 18196 // '{' '(#'
16967 || lk == 20756 // '{' '+'
16968 || lk == 21780 // '{' '-'
16969 || lk == 22804 // '{' '.'
16970 || lk == 23316 // '{' '..'
16971 || lk == 23828 // '{' '/'
16972 || lk == 24340 // '{' '//'
16973 || lk == 27924 // '{' '<'
16974 || lk == 28436 // '{' '<!--'
16975 || lk == 30484 // '{' '<?'
16976 || lk == 34068 // '{' '@'
16977 || lk == 35092 // '{' '['
16978 || lk == 35871 // '$' 'after'
16979 || lk == 35872 // '%' 'after'
16980 || lk == 36116 // '{' 'after'
16981 || lk == 36895 // '$' 'allowing'
16982 || lk == 36896 // '%' 'allowing'
16983 || lk == 37140 // '{' 'allowing'
16984 || lk == 37407 // '$' 'ancestor'
16985 || lk == 37408 // '%' 'ancestor'
16986 || lk == 37652 // '{' 'ancestor'
16987 || lk == 37919 // '$' 'ancestor-or-self'
16988 || lk == 37920 // '%' 'ancestor-or-self'
16989 || lk == 38164 // '{' 'ancestor-or-self'
16990 || lk == 38431 // '$' 'and'
16991 || lk == 38432 // '%' 'and'
16992 || lk == 38676 // '{' 'and'
16993 || lk == 39700 // '{' 'append'
16994 || lk == 39967 // '$' 'array'
16995 || lk == 39968 // '%' 'array'
16996 || lk == 40212 // '{' 'array'
16997 || lk == 40479 // '$' 'as'
16998 || lk == 40480 // '%' 'as'
16999 || lk == 40724 // '{' 'as'
17000 || lk == 40991 // '$' 'ascending'
17001 || lk == 40992 // '%' 'ascending'
17002 || lk == 41236 // '{' 'ascending'
17003 || lk == 41503 // '$' 'at'
17004 || lk == 41504 // '%' 'at'
17005 || lk == 41748 // '{' 'at'
17006 || lk == 42015 // '$' 'attribute'
17007 || lk == 42016 // '%' 'attribute'
17008 || lk == 42260 // '{' 'attribute'
17009 || lk == 42527 // '$' 'base-uri'
17010 || lk == 42528 // '%' 'base-uri'
17011 || lk == 42772 // '{' 'base-uri'
17012 || lk == 43039 // '$' 'before'
17013 || lk == 43040 // '%' 'before'
17014 || lk == 43284 // '{' 'before'
17015 || lk == 43551 // '$' 'boundary-space'
17016 || lk == 43552 // '%' 'boundary-space'
17017 || lk == 43796 // '{' 'boundary-space'
17018 || lk == 44063 // '$' 'break'
17019 || lk == 44064 // '%' 'break'
17020 || lk == 44308 // '{' 'break'
17021 || lk == 45087 // '$' 'case'
17022 || lk == 45088 // '%' 'case'
17023 || lk == 45332 // '{' 'case'
17024 || lk == 45599 // '$' 'cast'
17025 || lk == 45600 // '%' 'cast'
17026 || lk == 45844 // '{' 'cast'
17027 || lk == 46111 // '$' 'castable'
17028 || lk == 46112 // '%' 'castable'
17029 || lk == 46356 // '{' 'castable'
17030 || lk == 46623 // '$' 'catch'
17031 || lk == 46624 // '%' 'catch'
17032 || lk == 46868 // '{' 'catch'
17033 || lk == 47647 // '$' 'child'
17034 || lk == 47648 // '%' 'child'
17035 || lk == 47892 // '{' 'child'
17036 || lk == 48159 // '$' 'collation'
17037 || lk == 48160 // '%' 'collation'
17038 || lk == 48404 // '{' 'collation'
17039 || lk == 49183 // '$' 'comment'
17040 || lk == 49184 // '%' 'comment'
17041 || lk == 49428 // '{' 'comment'
17042 || lk == 49695 // '$' 'constraint'
17043 || lk == 49696 // '%' 'constraint'
17044 || lk == 49940 // '{' 'constraint'
17045 || lk == 50207 // '$' 'construction'
17046 || lk == 50208 // '%' 'construction'
17047 || lk == 50452 // '{' 'construction'
17048 || lk == 51743 // '$' 'context'
17049 || lk == 51744 // '%' 'context'
17050 || lk == 51988 // '{' 'context'
17051 || lk == 52255 // '$' 'continue'
17052 || lk == 52256 // '%' 'continue'
17053 || lk == 52500 // '{' 'continue'
17054 || lk == 52767 // '$' 'copy'
17055 || lk == 52768 // '%' 'copy'
17056 || lk == 53012 // '{' 'copy'
17057 || lk == 53279 // '$' 'copy-namespaces'
17058 || lk == 53280 // '%' 'copy-namespaces'
17059 || lk == 53524 // '{' 'copy-namespaces'
17060 || lk == 53791 // '$' 'count'
17061 || lk == 53792 // '%' 'count'
17062 || lk == 54036 // '{' 'count'
17063 || lk == 54303 // '$' 'decimal-format'
17064 || lk == 54304 // '%' 'decimal-format'
17065 || lk == 54548 // '{' 'decimal-format'
17066 || lk == 55327 // '$' 'declare'
17067 || lk == 55328 // '%' 'declare'
17068 || lk == 55572 // '{' 'declare'
17069 || lk == 55839 // '$' 'default'
17070 || lk == 55840 // '%' 'default'
17071 || lk == 56084 // '{' 'default'
17072 || lk == 56351 // '$' 'delete'
17073 || lk == 56352 // '%' 'delete'
17074 || lk == 56596 // '{' 'delete'
17075 || lk == 56863 // '$' 'descendant'
17076 || lk == 56864 // '%' 'descendant'
17077 || lk == 57108 // '{' 'descendant'
17078 || lk == 57375 // '$' 'descendant-or-self'
17079 || lk == 57376 // '%' 'descendant-or-self'
17080 || lk == 57620 // '{' 'descendant-or-self'
17081 || lk == 57887 // '$' 'descending'
17082 || lk == 57888 // '%' 'descending'
17083 || lk == 58132 // '{' 'descending'
17084 || lk == 60447 // '$' 'div'
17085 || lk == 60448 // '%' 'div'
17086 || lk == 60692 // '{' 'div'
17087 || lk == 60959 // '$' 'document'
17088 || lk == 60960 // '%' 'document'
17089 || lk == 61204 // '{' 'document'
17090 || lk == 61471 // '$' 'document-node'
17091 || lk == 61472 // '%' 'document-node'
17092 || lk == 61716 // '{' 'document-node'
17093 || lk == 61983 // '$' 'element'
17094 || lk == 61984 // '%' 'element'
17095 || lk == 62228 // '{' 'element'
17096 || lk == 62495 // '$' 'else'
17097 || lk == 62496 // '%' 'else'
17098 || lk == 62740 // '{' 'else'
17099 || lk == 63007 // '$' 'empty'
17100 || lk == 63008 // '%' 'empty'
17101 || lk == 63252 // '{' 'empty'
17102 || lk == 63519 // '$' 'empty-sequence'
17103 || lk == 63520 // '%' 'empty-sequence'
17104 || lk == 63764 // '{' 'empty-sequence'
17105 || lk == 64031 // '$' 'encoding'
17106 || lk == 64032 // '%' 'encoding'
17107 || lk == 64276 // '{' 'encoding'
17108 || lk == 64543 // '$' 'end'
17109 || lk == 64544 // '%' 'end'
17110 || lk == 64788 // '{' 'end'
17111 || lk == 65567 // '$' 'eq'
17112 || lk == 65568 // '%' 'eq'
17113 || lk == 65812 // '{' 'eq'
17114 || lk == 66079 // '$' 'every'
17115 || lk == 66080 // '%' 'every'
17116 || lk == 66324 // '{' 'every'
17117 || lk == 67103 // '$' 'except'
17118 || lk == 67104 // '%' 'except'
17119 || lk == 67348 // '{' 'except'
17120 || lk == 67615 // '$' 'exit'
17121 || lk == 67616 // '%' 'exit'
17122 || lk == 67860 // '{' 'exit'
17123 || lk == 68127 // '$' 'external'
17124 || lk == 68128 // '%' 'external'
17125 || lk == 68372 // '{' 'external'
17126 || lk == 68639 // '$' 'first'
17127 || lk == 68640 // '%' 'first'
17128 || lk == 68884 // '{' 'first'
17129 || lk == 69151 // '$' 'following'
17130 || lk == 69152 // '%' 'following'
17131 || lk == 69396 // '{' 'following'
17132 || lk == 69663 // '$' 'following-sibling'
17133 || lk == 69664 // '%' 'following-sibling'
17134 || lk == 69908 // '{' 'following-sibling'
17135 || lk == 70175 // '$' 'for'
17136 || lk == 70176 // '%' 'for'
17137 || lk == 70420 // '{' 'for'
17138 || lk == 72223 // '$' 'ft-option'
17139 || lk == 72224 // '%' 'ft-option'
17140 || lk == 72468 // '{' 'ft-option'
17141 || lk == 74271 // '$' 'function'
17142 || lk == 74272 // '%' 'function'
17143 || lk == 74516 // '{' 'function'
17144 || lk == 74783 // '$' 'ge'
17145 || lk == 74784 // '%' 'ge'
17146 || lk == 75028 // '{' 'ge'
17147 || lk == 75807 // '$' 'group'
17148 || lk == 75808 // '%' 'group'
17149 || lk == 76052 // '{' 'group'
17150 || lk == 76831 // '$' 'gt'
17151 || lk == 76832 // '%' 'gt'
17152 || lk == 77076 // '{' 'gt'
17153 || lk == 77343 // '$' 'idiv'
17154 || lk == 77344 // '%' 'idiv'
17155 || lk == 77588 // '{' 'idiv'
17156 || lk == 77855 // '$' 'if'
17157 || lk == 77856 // '%' 'if'
17158 || lk == 78100 // '{' 'if'
17159 || lk == 78367 // '$' 'import'
17160 || lk == 78368 // '%' 'import'
17161 || lk == 78612 // '{' 'import'
17162 || lk == 78879 // '$' 'in'
17163 || lk == 78880 // '%' 'in'
17164 || lk == 79124 // '{' 'in'
17165 || lk == 79391 // '$' 'index'
17166 || lk == 79392 // '%' 'index'
17167 || lk == 79636 // '{' 'index'
17168 || lk == 81439 // '$' 'insert'
17169 || lk == 81440 // '%' 'insert'
17170 || lk == 81684 // '{' 'insert'
17171 || lk == 81951 // '$' 'instance'
17172 || lk == 81952 // '%' 'instance'
17173 || lk == 82196 // '{' 'instance'
17174 || lk == 82463 // '$' 'integrity'
17175 || lk == 82464 // '%' 'integrity'
17176 || lk == 82708 // '{' 'integrity'
17177 || lk == 82975 // '$' 'intersect'
17178 || lk == 82976 // '%' 'intersect'
17179 || lk == 83220 // '{' 'intersect'
17180 || lk == 83487 // '$' 'into'
17181 || lk == 83488 // '%' 'into'
17182 || lk == 83732 // '{' 'into'
17183 || lk == 83999 // '$' 'is'
17184 || lk == 84000 // '%' 'is'
17185 || lk == 84244 // '{' 'is'
17186 || lk == 84511 // '$' 'item'
17187 || lk == 84512 // '%' 'item'
17188 || lk == 84756 // '{' 'item'
17189 || lk == 85535 // '$' 'json-item'
17190 || lk == 85536 // '%' 'json-item'
17191 || lk == 85780 // '{' 'json-item'
17192 || lk == 87071 // '$' 'last'
17193 || lk == 87072 // '%' 'last'
17194 || lk == 87316 // '{' 'last'
17195 || lk == 87583 // '$' 'lax'
17196 || lk == 87584 // '%' 'lax'
17197 || lk == 87828 // '{' 'lax'
17198 || lk == 88095 // '$' 'le'
17199 || lk == 88096 // '%' 'le'
17200 || lk == 88340 // '{' 'le'
17201 || lk == 89119 // '$' 'let'
17202 || lk == 89120 // '%' 'let'
17203 || lk == 89364 // '{' 'let'
17204 || lk == 90143 // '$' 'loop'
17205 || lk == 90144 // '%' 'loop'
17206 || lk == 90388 // '{' 'loop'
17207 || lk == 91167 // '$' 'lt'
17208 || lk == 91168 // '%' 'lt'
17209 || lk == 91412 // '{' 'lt'
17210 || lk == 92191 // '$' 'mod'
17211 || lk == 92192 // '%' 'mod'
17212 || lk == 92436 // '{' 'mod'
17213 || lk == 92703 // '$' 'modify'
17214 || lk == 92704 // '%' 'modify'
17215 || lk == 92948 // '{' 'modify'
17216 || lk == 93215 // '$' 'module'
17217 || lk == 93216 // '%' 'module'
17218 || lk == 93460 // '{' 'module'
17219 || lk == 94239 // '$' 'namespace'
17220 || lk == 94240 // '%' 'namespace'
17221 || lk == 94484 // '{' 'namespace'
17222 || lk == 94751 // '$' 'namespace-node'
17223 || lk == 94752 // '%' 'namespace-node'
17224 || lk == 94996 // '{' 'namespace-node'
17225 || lk == 95263 // '$' 'ne'
17226 || lk == 95264 // '%' 'ne'
17227 || lk == 95508 // '{' 'ne'
17228 || lk == 97823 // '$' 'node'
17229 || lk == 97824 // '%' 'node'
17230 || lk == 98068 // '{' 'node'
17231 || lk == 98335 // '$' 'nodes'
17232 || lk == 98336 // '%' 'nodes'
17233 || lk == 98580 // '{' 'nodes'
17234 || lk == 99359 // '$' 'object'
17235 || lk == 99360 // '%' 'object'
17236 || lk == 99604 // '{' 'object'
17237 || lk == 101407 // '$' 'only'
17238 || lk == 101408 // '%' 'only'
17239 || lk == 101652 // '{' 'only'
17240 || lk == 101919 // '$' 'option'
17241 || lk == 101920 // '%' 'option'
17242 || lk == 102164 // '{' 'option'
17243 || lk == 102431 // '$' 'or'
17244 || lk == 102432 // '%' 'or'
17245 || lk == 102676 // '{' 'or'
17246 || lk == 102943 // '$' 'order'
17247 || lk == 102944 // '%' 'order'
17248 || lk == 103188 // '{' 'order'
17249 || lk == 103455 // '$' 'ordered'
17250 || lk == 103456 // '%' 'ordered'
17251 || lk == 103700 // '{' 'ordered'
17252 || lk == 103967 // '$' 'ordering'
17253 || lk == 103968 // '%' 'ordering'
17254 || lk == 104212 // '{' 'ordering'
17255 || lk == 105503 // '$' 'parent'
17256 || lk == 105504 // '%' 'parent'
17257 || lk == 105748 // '{' 'parent'
17258 || lk == 108575 // '$' 'preceding'
17259 || lk == 108576 // '%' 'preceding'
17260 || lk == 108820 // '{' 'preceding'
17261 || lk == 109087 // '$' 'preceding-sibling'
17262 || lk == 109088 // '%' 'preceding-sibling'
17263 || lk == 109332 // '{' 'preceding-sibling'
17264 || lk == 110623 // '$' 'processing-instruction'
17265 || lk == 110624 // '%' 'processing-instruction'
17266 || lk == 110868 // '{' 'processing-instruction'
17267 || lk == 111647 // '$' 'rename'
17268 || lk == 111648 // '%' 'rename'
17269 || lk == 111892 // '{' 'rename'
17270 || lk == 112159 // '$' 'replace'
17271 || lk == 112160 // '%' 'replace'
17272 || lk == 112404 // '{' 'replace'
17273 || lk == 112671 // '$' 'return'
17274 || lk == 112672 // '%' 'return'
17275 || lk == 112916 // '{' 'return'
17276 || lk == 113183 // '$' 'returning'
17277 || lk == 113184 // '%' 'returning'
17278 || lk == 113428 // '{' 'returning'
17279 || lk == 113695 // '$' 'revalidation'
17280 || lk == 113696 // '%' 'revalidation'
17281 || lk == 113940 // '{' 'revalidation'
17282 || lk == 114719 // '$' 'satisfies'
17283 || lk == 114720 // '%' 'satisfies'
17284 || lk == 114964 // '{' 'satisfies'
17285 || lk == 115231 // '$' 'schema'
17286 || lk == 115232 // '%' 'schema'
17287 || lk == 115476 // '{' 'schema'
17288 || lk == 115743 // '$' 'schema-attribute'
17289 || lk == 115744 // '%' 'schema-attribute'
17290 || lk == 115988 // '{' 'schema-attribute'
17291 || lk == 116255 // '$' 'schema-element'
17292 || lk == 116256 // '%' 'schema-element'
17293 || lk == 116500 // '{' 'schema-element'
17294 || lk == 116767 // '$' 'score'
17295 || lk == 116768 // '%' 'score'
17296 || lk == 117012 // '{' 'score'
17297 || lk == 117279 // '$' 'self'
17298 || lk == 117280 // '%' 'self'
17299 || lk == 117524 // '{' 'self'
17300 || lk == 119839 // '$' 'sliding'
17301 || lk == 119840 // '%' 'sliding'
17302 || lk == 120084 // '{' 'sliding'
17303 || lk == 120351 // '$' 'some'
17304 || lk == 120352 // '%' 'some'
17305 || lk == 120596 // '{' 'some'
17306 || lk == 120863 // '$' 'stable'
17307 || lk == 120864 // '%' 'stable'
17308 || lk == 121108 // '{' 'stable'
17309 || lk == 121375 // '$' 'start'
17310 || lk == 121376 // '%' 'start'
17311 || lk == 121620 // '{' 'start'
17312 || lk == 122911 // '$' 'strict'
17313 || lk == 122912 // '%' 'strict'
17314 || lk == 123156 // '{' 'strict'
17315 || lk == 124447 // '$' 'switch'
17316 || lk == 124448 // '%' 'switch'
17317 || lk == 124692 // '{' 'switch'
17318 || lk == 124959 // '$' 'text'
17319 || lk == 124960 // '%' 'text'
17320 || lk == 125204 // '{' 'text'
17321 || lk == 127007 // '$' 'to'
17322 || lk == 127008 // '%' 'to'
17323 || lk == 127252 // '{' 'to'
17324 || lk == 127519 // '$' 'treat'
17325 || lk == 127520 // '%' 'treat'
17326 || lk == 127764 // '{' 'treat'
17327 || lk == 128031 // '$' 'try'
17328 || lk == 128032 // '%' 'try'
17329 || lk == 128276 // '{' 'try'
17330 || lk == 128543 // '$' 'tumbling'
17331 || lk == 128544 // '%' 'tumbling'
17332 || lk == 128788 // '{' 'tumbling'
17333 || lk == 129055 // '$' 'type'
17334 || lk == 129056 // '%' 'type'
17335 || lk == 129300 // '{' 'type'
17336 || lk == 129567 // '$' 'typeswitch'
17337 || lk == 129568 // '%' 'typeswitch'
17338 || lk == 129812 // '{' 'typeswitch'
17339 || lk == 130079 // '$' 'union'
17340 || lk == 130080 // '%' 'union'
17341 || lk == 130324 // '{' 'union'
17342 || lk == 131103 // '$' 'unordered'
17343 || lk == 131104 // '%' 'unordered'
17344 || lk == 131348 // '{' 'unordered'
17345 || lk == 131615 // '$' 'updating'
17346 || lk == 131616 // '%' 'updating'
17347 || lk == 131860 // '{' 'updating'
17348 || lk == 133151 // '$' 'validate'
17349 || lk == 133152 // '%' 'validate'
17350 || lk == 133396 // '{' 'validate'
17351 || lk == 133663 // '$' 'value'
17352 || lk == 133664 // '%' 'value'
17353 || lk == 133908 // '{' 'value'
17354 || lk == 134175 // '$' 'variable'
17355 || lk == 134176 // '%' 'variable'
17356 || lk == 134420 // '{' 'variable'
17357 || lk == 134687 // '$' 'version'
17358 || lk == 134688 // '%' 'version'
17359 || lk == 134932 // '{' 'version'
17360 || lk == 136223 // '$' 'where'
17361 || lk == 136224 // '%' 'where'
17362 || lk == 136468 // '{' 'where'
17363 || lk == 136735 // '$' 'while'
17364 || lk == 136736 // '%' 'while'
17365 || lk == 136980 // '{' 'while'
17366 || lk == 138271 // '$' 'with'
17367 || lk == 138272 // '%' 'with'
17368 || lk == 138516 // '{' 'with'
17369 || lk == 140319 // '$' 'xquery'
17370 || lk == 140320 // '%' 'xquery'
17371 || lk == 140564 // '{' 'xquery'
17372 || lk == 141588 // '{' '{'
17373 || lk == 142612 // '{' '{|'
17374 || lk == 144660) // '{' '}'
17375 {
17376 lk = memoized(7, e0);
17377 if (lk == 0)
17378 {
17379 var b0A = b0; var e0A = e0; var l1A = l1;
17380 var b1A = b1; var e1A = e1; var l2A = l2;
17381 var b2A = b2; var e2A = e2;
17382 try
17383 {
17384 try_ApplyStatement();
17385 lk = -1;
17386 }
17387 catch (p1A)
17388 {
17389 try
17390 {
17391 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
17392 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
17393 b2 = b2A; e2 = e2A; end = e2A; }}
17394 try_AssignStatement();
17395 lk = -2;
17396 }
17397 catch (p2A)
17398 {
17399 try
17400 {
17401 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
17402 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
17403 b2 = b2A; e2 = e2A; end = e2A; }}
17404 try_BlockStatement();
17405 lk = -3;
17406 }
17407 catch (p3A)
17408 {
17409 try
17410 {
17411 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
17412 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
17413 b2 = b2A; e2 = e2A; end = e2A; }}
17414 try_VarDeclStatement();
17415 lk = -12;
17416 }
17417 catch (p12A)
17418 {
17419 lk = -13;
17420 }
17421 }
17422 }
17423 }
17424 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
17425 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
17426 b2 = b2A; e2 = e2A; end = e2A; }}
17427 memoize(7, e0, lk);
17428 }
17429 }
17430 switch (lk)
17431 {
17432 case -2:
17433 parse_AssignStatement();
17434 break;
17435 case -3:
17436 parse_BlockStatement();
17437 break;
17438 case 90198: // 'break' 'loop'
17439 parse_BreakStatement();
17440 break;
17441 case 90214: // 'continue' 'loop'
17442 parse_ContinueStatement();
17443 break;
17444 case 113284: // 'exit' 'returning'
17445 parse_ExitStatement();
17446 break;
17447 case 16009: // 'for' '$'
17448 case 16046: // 'let' '$'
17449 case 116910: // 'let' 'score'
17450 case 119945: // 'for' 'sliding'
17451 case 128649: // 'for' 'tumbling'
17452 parse_FLWORStatement();
17453 break;
17454 case 17560: // 'if' '('
17455 parse_IfStatement();
17456 break;
17457 case 17651: // 'switch' '('
17458 parse_SwitchStatement();
17459 break;
17460 case 141562: // 'try' '{'
17461 parse_TryCatchStatement();
17462 break;
17463 case 17661: // 'typeswitch' '('
17464 parse_TypeswitchStatement();
17465 break;
17466 case -12:
17467 case 16134: // 'variable' '$'
17468 parse_VarDeclStatement();
17469 break;
17470 case -13:
17471 parse_WhileStatement();
17472 break;
17473 default:
17474 parse_ApplyStatement();
17475 }
17476 eventHandler.endNonterminal("Statement", e0);
17477 }
17478
17479 function try_Statement()
17480 {
17481 switch (l1)
17482 {
17483 case 132: // 'exit'
17484 lookahead2W(189); // S^WS | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' | '<' |
17485 break;
17486 case 137: // 'for'
17487 lookahead2W(196); // S^WS | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' |
17488 break;
17489 case 174: // 'let'
17490 lookahead2W(193); // S^WS | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' |
17491 break;
17492 case 250: // 'try'
17493 lookahead2W(190); // S^WS | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' | '<' |
17494 break;
17495 case 262: // 'variable'
17496 lookahead2W(187); // S^WS | '!' | '!=' | '#' | '$' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' |
17497 break;
17498 case 276: // '{'
17499 lookahead2W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
17500 break;
17501 case 31: // '$'
17502 case 32: // '%'
17503 lookahead2W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
17504 break;
17505 case 86: // 'break'
17506 case 102: // 'continue'
17507 lookahead2W(188); // S^WS | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' | '<' |
17508 break;
17509 case 152: // 'if'
17510 case 243: // 'switch'
17511 case 253: // 'typeswitch'
17512 case 267: // 'while'
17513 lookahead2W(185); // S^WS | '!' | '!=' | '#' | '(' | '(:' | '*' | '+' | '-' | '/' | '//' | ';' | '<' |
17514 break;
17515 default:
17516 lk = l1;
17517 }
17518 if (lk == 2836 // '{' Wildcard
17519 || lk == 3103 // '$' EQName^Token
17520 || lk == 3104 // '%' EQName^Token
17521 || lk == 3348 // '{' EQName^Token
17522 || lk == 4372 // '{' IntegerLiteral
17523 || lk == 4884 // '{' DecimalLiteral
17524 || lk == 5396 // '{' DoubleLiteral
17525 || lk == 5908 // '{' StringLiteral
17526 || lk == 16148 // '{' '$'
17527 || lk == 16660 // '{' '%'
17528 || lk == 17675 // 'while' '('
17529 || lk == 17684 // '{' '('
17530 || lk == 18196 // '{' '(#'
17531 || lk == 20756 // '{' '+'
17532 || lk == 21780 // '{' '-'
17533 || lk == 22804 // '{' '.'
17534 || lk == 23316 // '{' '..'
17535 || lk == 23828 // '{' '/'
17536 || lk == 24340 // '{' '//'
17537 || lk == 27924 // '{' '<'
17538 || lk == 28436 // '{' '<!--'
17539 || lk == 30484 // '{' '<?'
17540 || lk == 34068 // '{' '@'
17541 || lk == 35092 // '{' '['
17542 || lk == 35871 // '$' 'after'
17543 || lk == 35872 // '%' 'after'
17544 || lk == 36116 // '{' 'after'
17545 || lk == 36895 // '$' 'allowing'
17546 || lk == 36896 // '%' 'allowing'
17547 || lk == 37140 // '{' 'allowing'
17548 || lk == 37407 // '$' 'ancestor'
17549 || lk == 37408 // '%' 'ancestor'
17550 || lk == 37652 // '{' 'ancestor'
17551 || lk == 37919 // '$' 'ancestor-or-self'
17552 || lk == 37920 // '%' 'ancestor-or-self'
17553 || lk == 38164 // '{' 'ancestor-or-self'
17554 || lk == 38431 // '$' 'and'
17555 || lk == 38432 // '%' 'and'
17556 || lk == 38676 // '{' 'and'
17557 || lk == 39700 // '{' 'append'
17558 || lk == 39967 // '$' 'array'
17559 || lk == 39968 // '%' 'array'
17560 || lk == 40212 // '{' 'array'
17561 || lk == 40479 // '$' 'as'
17562 || lk == 40480 // '%' 'as'
17563 || lk == 40724 // '{' 'as'
17564 || lk == 40991 // '$' 'ascending'
17565 || lk == 40992 // '%' 'ascending'
17566 || lk == 41236 // '{' 'ascending'
17567 || lk == 41503 // '$' 'at'
17568 || lk == 41504 // '%' 'at'
17569 || lk == 41748 // '{' 'at'
17570 || lk == 42015 // '$' 'attribute'
17571 || lk == 42016 // '%' 'attribute'
17572 || lk == 42260 // '{' 'attribute'
17573 || lk == 42527 // '$' 'base-uri'
17574 || lk == 42528 // '%' 'base-uri'
17575 || lk == 42772 // '{' 'base-uri'
17576 || lk == 43039 // '$' 'before'
17577 || lk == 43040 // '%' 'before'
17578 || lk == 43284 // '{' 'before'
17579 || lk == 43551 // '$' 'boundary-space'
17580 || lk == 43552 // '%' 'boundary-space'
17581 || lk == 43796 // '{' 'boundary-space'
17582 || lk == 44063 // '$' 'break'
17583 || lk == 44064 // '%' 'break'
17584 || lk == 44308 // '{' 'break'
17585 || lk == 45087 // '$' 'case'
17586 || lk == 45088 // '%' 'case'
17587 || lk == 45332 // '{' 'case'
17588 || lk == 45599 // '$' 'cast'
17589 || lk == 45600 // '%' 'cast'
17590 || lk == 45844 // '{' 'cast'
17591 || lk == 46111 // '$' 'castable'
17592 || lk == 46112 // '%' 'castable'
17593 || lk == 46356 // '{' 'castable'
17594 || lk == 46623 // '$' 'catch'
17595 || lk == 46624 // '%' 'catch'
17596 || lk == 46868 // '{' 'catch'
17597 || lk == 47647 // '$' 'child'
17598 || lk == 47648 // '%' 'child'
17599 || lk == 47892 // '{' 'child'
17600 || lk == 48159 // '$' 'collation'
17601 || lk == 48160 // '%' 'collation'
17602 || lk == 48404 // '{' 'collation'
17603 || lk == 49183 // '$' 'comment'
17604 || lk == 49184 // '%' 'comment'
17605 || lk == 49428 // '{' 'comment'
17606 || lk == 49695 // '$' 'constraint'
17607 || lk == 49696 // '%' 'constraint'
17608 || lk == 49940 // '{' 'constraint'
17609 || lk == 50207 // '$' 'construction'
17610 || lk == 50208 // '%' 'construction'
17611 || lk == 50452 // '{' 'construction'
17612 || lk == 51743 // '$' 'context'
17613 || lk == 51744 // '%' 'context'
17614 || lk == 51988 // '{' 'context'
17615 || lk == 52255 // '$' 'continue'
17616 || lk == 52256 // '%' 'continue'
17617 || lk == 52500 // '{' 'continue'
17618 || lk == 52767 // '$' 'copy'
17619 || lk == 52768 // '%' 'copy'
17620 || lk == 53012 // '{' 'copy'
17621 || lk == 53279 // '$' 'copy-namespaces'
17622 || lk == 53280 // '%' 'copy-namespaces'
17623 || lk == 53524 // '{' 'copy-namespaces'
17624 || lk == 53791 // '$' 'count'
17625 || lk == 53792 // '%' 'count'
17626 || lk == 54036 // '{' 'count'
17627 || lk == 54303 // '$' 'decimal-format'
17628 || lk == 54304 // '%' 'decimal-format'
17629 || lk == 54548 // '{' 'decimal-format'
17630 || lk == 55327 // '$' 'declare'
17631 || lk == 55328 // '%' 'declare'
17632 || lk == 55572 // '{' 'declare'
17633 || lk == 55839 // '$' 'default'
17634 || lk == 55840 // '%' 'default'
17635 || lk == 56084 // '{' 'default'
17636 || lk == 56351 // '$' 'delete'
17637 || lk == 56352 // '%' 'delete'
17638 || lk == 56596 // '{' 'delete'
17639 || lk == 56863 // '$' 'descendant'
17640 || lk == 56864 // '%' 'descendant'
17641 || lk == 57108 // '{' 'descendant'
17642 || lk == 57375 // '$' 'descendant-or-self'
17643 || lk == 57376 // '%' 'descendant-or-self'
17644 || lk == 57620 // '{' 'descendant-or-self'
17645 || lk == 57887 // '$' 'descending'
17646 || lk == 57888 // '%' 'descending'
17647 || lk == 58132 // '{' 'descending'
17648 || lk == 60447 // '$' 'div'
17649 || lk == 60448 // '%' 'div'
17650 || lk == 60692 // '{' 'div'
17651 || lk == 60959 // '$' 'document'
17652 || lk == 60960 // '%' 'document'
17653 || lk == 61204 // '{' 'document'
17654 || lk == 61471 // '$' 'document-node'
17655 || lk == 61472 // '%' 'document-node'
17656 || lk == 61716 // '{' 'document-node'
17657 || lk == 61983 // '$' 'element'
17658 || lk == 61984 // '%' 'element'
17659 || lk == 62228 // '{' 'element'
17660 || lk == 62495 // '$' 'else'
17661 || lk == 62496 // '%' 'else'
17662 || lk == 62740 // '{' 'else'
17663 || lk == 63007 // '$' 'empty'
17664 || lk == 63008 // '%' 'empty'
17665 || lk == 63252 // '{' 'empty'
17666 || lk == 63519 // '$' 'empty-sequence'
17667 || lk == 63520 // '%' 'empty-sequence'
17668 || lk == 63764 // '{' 'empty-sequence'
17669 || lk == 64031 // '$' 'encoding'
17670 || lk == 64032 // '%' 'encoding'
17671 || lk == 64276 // '{' 'encoding'
17672 || lk == 64543 // '$' 'end'
17673 || lk == 64544 // '%' 'end'
17674 || lk == 64788 // '{' 'end'
17675 || lk == 65567 // '$' 'eq'
17676 || lk == 65568 // '%' 'eq'
17677 || lk == 65812 // '{' 'eq'
17678 || lk == 66079 // '$' 'every'
17679 || lk == 66080 // '%' 'every'
17680 || lk == 66324 // '{' 'every'
17681 || lk == 67103 // '$' 'except'
17682 || lk == 67104 // '%' 'except'
17683 || lk == 67348 // '{' 'except'
17684 || lk == 67615 // '$' 'exit'
17685 || lk == 67616 // '%' 'exit'
17686 || lk == 67860 // '{' 'exit'
17687 || lk == 68127 // '$' 'external'
17688 || lk == 68128 // '%' 'external'
17689 || lk == 68372 // '{' 'external'
17690 || lk == 68639 // '$' 'first'
17691 || lk == 68640 // '%' 'first'
17692 || lk == 68884 // '{' 'first'
17693 || lk == 69151 // '$' 'following'
17694 || lk == 69152 // '%' 'following'
17695 || lk == 69396 // '{' 'following'
17696 || lk == 69663 // '$' 'following-sibling'
17697 || lk == 69664 // '%' 'following-sibling'
17698 || lk == 69908 // '{' 'following-sibling'
17699 || lk == 70175 // '$' 'for'
17700 || lk == 70176 // '%' 'for'
17701 || lk == 70420 // '{' 'for'
17702 || lk == 72223 // '$' 'ft-option'
17703 || lk == 72224 // '%' 'ft-option'
17704 || lk == 72468 // '{' 'ft-option'
17705 || lk == 74271 // '$' 'function'
17706 || lk == 74272 // '%' 'function'
17707 || lk == 74516 // '{' 'function'
17708 || lk == 74783 // '$' 'ge'
17709 || lk == 74784 // '%' 'ge'
17710 || lk == 75028 // '{' 'ge'
17711 || lk == 75807 // '$' 'group'
17712 || lk == 75808 // '%' 'group'
17713 || lk == 76052 // '{' 'group'
17714 || lk == 76831 // '$' 'gt'
17715 || lk == 76832 // '%' 'gt'
17716 || lk == 77076 // '{' 'gt'
17717 || lk == 77343 // '$' 'idiv'
17718 || lk == 77344 // '%' 'idiv'
17719 || lk == 77588 // '{' 'idiv'
17720 || lk == 77855 // '$' 'if'
17721 || lk == 77856 // '%' 'if'
17722 || lk == 78100 // '{' 'if'
17723 || lk == 78367 // '$' 'import'
17724 || lk == 78368 // '%' 'import'
17725 || lk == 78612 // '{' 'import'
17726 || lk == 78879 // '$' 'in'
17727 || lk == 78880 // '%' 'in'
17728 || lk == 79124 // '{' 'in'
17729 || lk == 79391 // '$' 'index'
17730 || lk == 79392 // '%' 'index'
17731 || lk == 79636 // '{' 'index'
17732 || lk == 81439 // '$' 'insert'
17733 || lk == 81440 // '%' 'insert'
17734 || lk == 81684 // '{' 'insert'
17735 || lk == 81951 // '$' 'instance'
17736 || lk == 81952 // '%' 'instance'
17737 || lk == 82196 // '{' 'instance'
17738 || lk == 82463 // '$' 'integrity'
17739 || lk == 82464 // '%' 'integrity'
17740 || lk == 82708 // '{' 'integrity'
17741 || lk == 82975 // '$' 'intersect'
17742 || lk == 82976 // '%' 'intersect'
17743 || lk == 83220 // '{' 'intersect'
17744 || lk == 83487 // '$' 'into'
17745 || lk == 83488 // '%' 'into'
17746 || lk == 83732 // '{' 'into'
17747 || lk == 83999 // '$' 'is'
17748 || lk == 84000 // '%' 'is'
17749 || lk == 84244 // '{' 'is'
17750 || lk == 84511 // '$' 'item'
17751 || lk == 84512 // '%' 'item'
17752 || lk == 84756 // '{' 'item'
17753 || lk == 85535 // '$' 'json-item'
17754 || lk == 85536 // '%' 'json-item'
17755 || lk == 85780 // '{' 'json-item'
17756 || lk == 87071 // '$' 'last'
17757 || lk == 87072 // '%' 'last'
17758 || lk == 87316 // '{' 'last'
17759 || lk == 87583 // '$' 'lax'
17760 || lk == 87584 // '%' 'lax'
17761 || lk == 87828 // '{' 'lax'
17762 || lk == 88095 // '$' 'le'
17763 || lk == 88096 // '%' 'le'
17764 || lk == 88340 // '{' 'le'
17765 || lk == 89119 // '$' 'let'
17766 || lk == 89120 // '%' 'let'
17767 || lk == 89364 // '{' 'let'
17768 || lk == 90143 // '$' 'loop'
17769 || lk == 90144 // '%' 'loop'
17770 || lk == 90388 // '{' 'loop'
17771 || lk == 91167 // '$' 'lt'
17772 || lk == 91168 // '%' 'lt'
17773 || lk == 91412 // '{' 'lt'
17774 || lk == 92191 // '$' 'mod'
17775 || lk == 92192 // '%' 'mod'
17776 || lk == 92436 // '{' 'mod'
17777 || lk == 92703 // '$' 'modify'
17778 || lk == 92704 // '%' 'modify'
17779 || lk == 92948 // '{' 'modify'
17780 || lk == 93215 // '$' 'module'
17781 || lk == 93216 // '%' 'module'
17782 || lk == 93460 // '{' 'module'
17783 || lk == 94239 // '$' 'namespace'
17784 || lk == 94240 // '%' 'namespace'
17785 || lk == 94484 // '{' 'namespace'
17786 || lk == 94751 // '$' 'namespace-node'
17787 || lk == 94752 // '%' 'namespace-node'
17788 || lk == 94996 // '{' 'namespace-node'
17789 || lk == 95263 // '$' 'ne'
17790 || lk == 95264 // '%' 'ne'
17791 || lk == 95508 // '{' 'ne'
17792 || lk == 97823 // '$' 'node'
17793 || lk == 97824 // '%' 'node'
17794 || lk == 98068 // '{' 'node'
17795 || lk == 98335 // '$' 'nodes'
17796 || lk == 98336 // '%' 'nodes'
17797 || lk == 98580 // '{' 'nodes'
17798 || lk == 99359 // '$' 'object'
17799 || lk == 99360 // '%' 'object'
17800 || lk == 99604 // '{' 'object'
17801 || lk == 101407 // '$' 'only'
17802 || lk == 101408 // '%' 'only'
17803 || lk == 101652 // '{' 'only'
17804 || lk == 101919 // '$' 'option'
17805 || lk == 101920 // '%' 'option'
17806 || lk == 102164 // '{' 'option'
17807 || lk == 102431 // '$' 'or'
17808 || lk == 102432 // '%' 'or'
17809 || lk == 102676 // '{' 'or'
17810 || lk == 102943 // '$' 'order'
17811 || lk == 102944 // '%' 'order'
17812 || lk == 103188 // '{' 'order'
17813 || lk == 103455 // '$' 'ordered'
17814 || lk == 103456 // '%' 'ordered'
17815 || lk == 103700 // '{' 'ordered'
17816 || lk == 103967 // '$' 'ordering'
17817 || lk == 103968 // '%' 'ordering'
17818 || lk == 104212 // '{' 'ordering'
17819 || lk == 105503 // '$' 'parent'
17820 || lk == 105504 // '%' 'parent'
17821 || lk == 105748 // '{' 'parent'
17822 || lk == 108575 // '$' 'preceding'
17823 || lk == 108576 // '%' 'preceding'
17824 || lk == 108820 // '{' 'preceding'
17825 || lk == 109087 // '$' 'preceding-sibling'
17826 || lk == 109088 // '%' 'preceding-sibling'
17827 || lk == 109332 // '{' 'preceding-sibling'
17828 || lk == 110623 // '$' 'processing-instruction'
17829 || lk == 110624 // '%' 'processing-instruction'
17830 || lk == 110868 // '{' 'processing-instruction'
17831 || lk == 111647 // '$' 'rename'
17832 || lk == 111648 // '%' 'rename'
17833 || lk == 111892 // '{' 'rename'
17834 || lk == 112159 // '$' 'replace'
17835 || lk == 112160 // '%' 'replace'
17836 || lk == 112404 // '{' 'replace'
17837 || lk == 112671 // '$' 'return'
17838 || lk == 112672 // '%' 'return'
17839 || lk == 112916 // '{' 'return'
17840 || lk == 113183 // '$' 'returning'
17841 || lk == 113184 // '%' 'returning'
17842 || lk == 113428 // '{' 'returning'
17843 || lk == 113695 // '$' 'revalidation'
17844 || lk == 113696 // '%' 'revalidation'
17845 || lk == 113940 // '{' 'revalidation'
17846 || lk == 114719 // '$' 'satisfies'
17847 || lk == 114720 // '%' 'satisfies'
17848 || lk == 114964 // '{' 'satisfies'
17849 || lk == 115231 // '$' 'schema'
17850 || lk == 115232 // '%' 'schema'
17851 || lk == 115476 // '{' 'schema'
17852 || lk == 115743 // '$' 'schema-attribute'
17853 || lk == 115744 // '%' 'schema-attribute'
17854 || lk == 115988 // '{' 'schema-attribute'
17855 || lk == 116255 // '$' 'schema-element'
17856 || lk == 116256 // '%' 'schema-element'
17857 || lk == 116500 // '{' 'schema-element'
17858 || lk == 116767 // '$' 'score'
17859 || lk == 116768 // '%' 'score'
17860 || lk == 117012 // '{' 'score'
17861 || lk == 117279 // '$' 'self'
17862 || lk == 117280 // '%' 'self'
17863 || lk == 117524 // '{' 'self'
17864 || lk == 119839 // '$' 'sliding'
17865 || lk == 119840 // '%' 'sliding'
17866 || lk == 120084 // '{' 'sliding'
17867 || lk == 120351 // '$' 'some'
17868 || lk == 120352 // '%' 'some'
17869 || lk == 120596 // '{' 'some'
17870 || lk == 120863 // '$' 'stable'
17871 || lk == 120864 // '%' 'stable'
17872 || lk == 121108 // '{' 'stable'
17873 || lk == 121375 // '$' 'start'
17874 || lk == 121376 // '%' 'start'
17875 || lk == 121620 // '{' 'start'
17876 || lk == 122911 // '$' 'strict'
17877 || lk == 122912 // '%' 'strict'
17878 || lk == 123156 // '{' 'strict'
17879 || lk == 124447 // '$' 'switch'
17880 || lk == 124448 // '%' 'switch'
17881 || lk == 124692 // '{' 'switch'
17882 || lk == 124959 // '$' 'text'
17883 || lk == 124960 // '%' 'text'
17884 || lk == 125204 // '{' 'text'
17885 || lk == 127007 // '$' 'to'
17886 || lk == 127008 // '%' 'to'
17887 || lk == 127252 // '{' 'to'
17888 || lk == 127519 // '$' 'treat'
17889 || lk == 127520 // '%' 'treat'
17890 || lk == 127764 // '{' 'treat'
17891 || lk == 128031 // '$' 'try'
17892 || lk == 128032 // '%' 'try'
17893 || lk == 128276 // '{' 'try'
17894 || lk == 128543 // '$' 'tumbling'
17895 || lk == 128544 // '%' 'tumbling'
17896 || lk == 128788 // '{' 'tumbling'
17897 || lk == 129055 // '$' 'type'
17898 || lk == 129056 // '%' 'type'
17899 || lk == 129300 // '{' 'type'
17900 || lk == 129567 // '$' 'typeswitch'
17901 || lk == 129568 // '%' 'typeswitch'
17902 || lk == 129812 // '{' 'typeswitch'
17903 || lk == 130079 // '$' 'union'
17904 || lk == 130080 // '%' 'union'
17905 || lk == 130324 // '{' 'union'
17906 || lk == 131103 // '$' 'unordered'
17907 || lk == 131104 // '%' 'unordered'
17908 || lk == 131348 // '{' 'unordered'
17909 || lk == 131615 // '$' 'updating'
17910 || lk == 131616 // '%' 'updating'
17911 || lk == 131860 // '{' 'updating'
17912 || lk == 133151 // '$' 'validate'
17913 || lk == 133152 // '%' 'validate'
17914 || lk == 133396 // '{' 'validate'
17915 || lk == 133663 // '$' 'value'
17916 || lk == 133664 // '%' 'value'
17917 || lk == 133908 // '{' 'value'
17918 || lk == 134175 // '$' 'variable'
17919 || lk == 134176 // '%' 'variable'
17920 || lk == 134420 // '{' 'variable'
17921 || lk == 134687 // '$' 'version'
17922 || lk == 134688 // '%' 'version'
17923 || lk == 134932 // '{' 'version'
17924 || lk == 136223 // '$' 'where'
17925 || lk == 136224 // '%' 'where'
17926 || lk == 136468 // '{' 'where'
17927 || lk == 136735 // '$' 'while'
17928 || lk == 136736 // '%' 'while'
17929 || lk == 136980 // '{' 'while'
17930 || lk == 138271 // '$' 'with'
17931 || lk == 138272 // '%' 'with'
17932 || lk == 138516 // '{' 'with'
17933 || lk == 140319 // '$' 'xquery'
17934 || lk == 140320 // '%' 'xquery'
17935 || lk == 140564 // '{' 'xquery'
17936 || lk == 141588 // '{' '{'
17937 || lk == 142612 // '{' '{|'
17938 || lk == 144660) // '{' '}'
17939 {
17940 lk = memoized(7, e0);
17941 if (lk == 0)
17942 {
17943 var b0A = b0; var e0A = e0; var l1A = l1;
17944 var b1A = b1; var e1A = e1; var l2A = l2;
17945 var b2A = b2; var e2A = e2;
17946 try
17947 {
17948 try_ApplyStatement();
17949 memoize(7, e0A, -1);
17950 lk = -14;
17951 }
17952 catch (p1A)
17953 {
17954 try
17955 {
17956 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
17957 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
17958 b2 = b2A; e2 = e2A; end = e2A; }}
17959 try_AssignStatement();
17960 memoize(7, e0A, -2);
17961 lk = -14;
17962 }
17963 catch (p2A)
17964 {
17965 try
17966 {
17967 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
17968 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
17969 b2 = b2A; e2 = e2A; end = e2A; }}
17970 try_BlockStatement();
17971 memoize(7, e0A, -3);
17972 lk = -14;
17973 }
17974 catch (p3A)
17975 {
17976 try
17977 {
17978 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
17979 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
17980 b2 = b2A; e2 = e2A; end = e2A; }}
17981 try_VarDeclStatement();
17982 memoize(7, e0A, -12);
17983 lk = -14;
17984 }
17985 catch (p12A)
17986 {
17987 lk = -13;
17988 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
17989 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
17990 b2 = b2A; e2 = e2A; end = e2A; }}
17991 memoize(7, e0A, -13);
17992 }
17993 }
17994 }
17995 }
17996 }
17997 }
17998 switch (lk)
17999 {
18000 case -2:
18001 try_AssignStatement();
18002 break;
18003 case -3:
18004 try_BlockStatement();
18005 break;
18006 case 90198: // 'break' 'loop'
18007 try_BreakStatement();
18008 break;
18009 case 90214: // 'continue' 'loop'
18010 try_ContinueStatement();
18011 break;
18012 case 113284: // 'exit' 'returning'
18013 try_ExitStatement();
18014 break;
18015 case 16009: // 'for' '$'
18016 case 16046: // 'let' '$'
18017 case 116910: // 'let' 'score'
18018 case 119945: // 'for' 'sliding'
18019 case 128649: // 'for' 'tumbling'
18020 try_FLWORStatement();
18021 break;
18022 case 17560: // 'if' '('
18023 try_IfStatement();
18024 break;
18025 case 17651: // 'switch' '('
18026 try_SwitchStatement();
18027 break;
18028 case 141562: // 'try' '{'
18029 try_TryCatchStatement();
18030 break;
18031 case 17661: // 'typeswitch' '('
18032 try_TypeswitchStatement();
18033 break;
18034 case -12:
18035 case 16134: // 'variable' '$'
18036 try_VarDeclStatement();
18037 break;
18038 case -13:
18039 try_WhileStatement();
18040 break;
18041 case -14:
18042 break;
18043 default:
18044 try_ApplyStatement();
18045 }
18046 }
18047
18048 function parse_ApplyStatement()
18049 {
18050 eventHandler.startNonterminal("ApplyStatement", e0);
18051 parse_ExprSimple();
18052 shift(53); // ';'
18053 eventHandler.endNonterminal("ApplyStatement", e0);
18054 }
18055
18056 function try_ApplyStatement()
18057 {
18058 try_ExprSimple();
18059 shiftT(53); // ';'
18060 }
18061
18062 function parse_AssignStatement()
18063 {
18064 eventHandler.startNonterminal("AssignStatement", e0);
18065 shift(31); // '$'
18066 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18067 whitespace();
18068 parse_VarName();
18069 lookahead1W(27); // S^WS | '(:' | ':='
18070 shift(52); // ':='
18071 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18072 whitespace();
18073 parse_ExprSingle();
18074 shift(53); // ';'
18075 eventHandler.endNonterminal("AssignStatement", e0);
18076 }
18077
18078 function try_AssignStatement()
18079 {
18080 shiftT(31); // '$'
18081 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18082 try_VarName();
18083 lookahead1W(27); // S^WS | '(:' | ':='
18084 shiftT(52); // ':='
18085 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18086 try_ExprSingle();
18087 shiftT(53); // ';'
18088 }
18089
18090 function parse_BlockStatement()
18091 {
18092 eventHandler.startNonterminal("BlockStatement", e0);
18093 shift(276); // '{'
18094 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18095 whitespace();
18096 parse_Statements();
18097 shift(282); // '}'
18098 eventHandler.endNonterminal("BlockStatement", e0);
18099 }
18100
18101 function try_BlockStatement()
18102 {
18103 shiftT(276); // '{'
18104 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18105 try_Statements();
18106 shiftT(282); // '}'
18107 }
18108
18109 function parse_BreakStatement()
18110 {
18111 eventHandler.startNonterminal("BreakStatement", e0);
18112 shift(86); // 'break'
18113 lookahead1W(59); // S^WS | '(:' | 'loop'
18114 shift(176); // 'loop'
18115 lookahead1W(28); // S^WS | '(:' | ';'
18116 shift(53); // ';'
18117 eventHandler.endNonterminal("BreakStatement", e0);
18118 }
18119
18120 function try_BreakStatement()
18121 {
18122 shiftT(86); // 'break'
18123 lookahead1W(59); // S^WS | '(:' | 'loop'
18124 shiftT(176); // 'loop'
18125 lookahead1W(28); // S^WS | '(:' | ';'
18126 shiftT(53); // ';'
18127 }
18128
18129 function parse_ContinueStatement()
18130 {
18131 eventHandler.startNonterminal("ContinueStatement", e0);
18132 shift(102); // 'continue'
18133 lookahead1W(59); // S^WS | '(:' | 'loop'
18134 shift(176); // 'loop'
18135 lookahead1W(28); // S^WS | '(:' | ';'
18136 shift(53); // ';'
18137 eventHandler.endNonterminal("ContinueStatement", e0);
18138 }
18139
18140 function try_ContinueStatement()
18141 {
18142 shiftT(102); // 'continue'
18143 lookahead1W(59); // S^WS | '(:' | 'loop'
18144 shiftT(176); // 'loop'
18145 lookahead1W(28); // S^WS | '(:' | ';'
18146 shiftT(53); // ';'
18147 }
18148
18149 function parse_ExitStatement()
18150 {
18151 eventHandler.startNonterminal("ExitStatement", e0);
18152 shift(132); // 'exit'
18153 lookahead1W(71); // S^WS | '(:' | 'returning'
18154 shift(221); // 'returning'
18155 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18156 whitespace();
18157 parse_ExprSingle();
18158 shift(53); // ';'
18159 eventHandler.endNonterminal("ExitStatement", e0);
18160 }
18161
18162 function try_ExitStatement()
18163 {
18164 shiftT(132); // 'exit'
18165 lookahead1W(71); // S^WS | '(:' | 'returning'
18166 shiftT(221); // 'returning'
18167 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18168 try_ExprSingle();
18169 shiftT(53); // ';'
18170 }
18171
18172 function parse_FLWORStatement()
18173 {
18174 eventHandler.startNonterminal("FLWORStatement", e0);
18175 parse_InitialClause();
18176 for (;;)
18177 {
18178 lookahead1W(173); // S^WS | '(:' | 'count' | 'for' | 'group' | 'let' | 'order' | 'return' | 'stable' |
18179 if (l1 == 220) // 'return'
18180 {
18181 break;
18182 }
18183 whitespace();
18184 parse_IntermediateClause();
18185 }
18186 whitespace();
18187 parse_ReturnStatement();
18188 eventHandler.endNonterminal("FLWORStatement", e0);
18189 }
18190
18191 function try_FLWORStatement()
18192 {
18193 try_InitialClause();
18194 for (;;)
18195 {
18196 lookahead1W(173); // S^WS | '(:' | 'count' | 'for' | 'group' | 'let' | 'order' | 'return' | 'stable' |
18197 if (l1 == 220) // 'return'
18198 {
18199 break;
18200 }
18201 try_IntermediateClause();
18202 }
18203 try_ReturnStatement();
18204 }
18205
18206 function parse_ReturnStatement()
18207 {
18208 eventHandler.startNonterminal("ReturnStatement", e0);
18209 shift(220); // 'return'
18210 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18211 whitespace();
18212 parse_Statement();
18213 eventHandler.endNonterminal("ReturnStatement", e0);
18214 }
18215
18216 function try_ReturnStatement()
18217 {
18218 shiftT(220); // 'return'
18219 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18220 try_Statement();
18221 }
18222
18223 function parse_IfStatement()
18224 {
18225 eventHandler.startNonterminal("IfStatement", e0);
18226 shift(152); // 'if'
18227 lookahead1W(22); // S^WS | '(' | '(:'
18228 shift(34); // '('
18229 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18230 whitespace();
18231 parse_Expr();
18232 shift(37); // ')'
18233 lookahead1W(77); // S^WS | '(:' | 'then'
18234 shift(245); // 'then'
18235 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18236 whitespace();
18237 parse_Statement();
18238 lookahead1W(48); // S^WS | '(:' | 'else'
18239 shift(122); // 'else'
18240 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18241 whitespace();
18242 parse_Statement();
18243 eventHandler.endNonterminal("IfStatement", e0);
18244 }
18245
18246 function try_IfStatement()
18247 {
18248 shiftT(152); // 'if'
18249 lookahead1W(22); // S^WS | '(' | '(:'
18250 shiftT(34); // '('
18251 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18252 try_Expr();
18253 shiftT(37); // ')'
18254 lookahead1W(77); // S^WS | '(:' | 'then'
18255 shiftT(245); // 'then'
18256 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18257 try_Statement();
18258 lookahead1W(48); // S^WS | '(:' | 'else'
18259 shiftT(122); // 'else'
18260 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18261 try_Statement();
18262 }
18263
18264 function parse_SwitchStatement()
18265 {
18266 eventHandler.startNonterminal("SwitchStatement", e0);
18267 shift(243); // 'switch'
18268 lookahead1W(22); // S^WS | '(' | '(:'
18269 shift(34); // '('
18270 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18271 whitespace();
18272 parse_Expr();
18273 shift(37); // ')'
18274 for (;;)
18275 {
18276 lookahead1W(35); // S^WS | '(:' | 'case'
18277 whitespace();
18278 parse_SwitchCaseStatement();
18279 lookahead1W(113); // S^WS | '(:' | 'case' | 'default'
18280 if (l1 != 88) // 'case'
18281 {
18282 break;
18283 }
18284 }
18285 shift(109); // 'default'
18286 lookahead1W(70); // S^WS | '(:' | 'return'
18287 shift(220); // 'return'
18288 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18289 whitespace();
18290 parse_Statement();
18291 eventHandler.endNonterminal("SwitchStatement", e0);
18292 }
18293
18294 function try_SwitchStatement()
18295 {
18296 shiftT(243); // 'switch'
18297 lookahead1W(22); // S^WS | '(' | '(:'
18298 shiftT(34); // '('
18299 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18300 try_Expr();
18301 shiftT(37); // ')'
18302 for (;;)
18303 {
18304 lookahead1W(35); // S^WS | '(:' | 'case'
18305 try_SwitchCaseStatement();
18306 lookahead1W(113); // S^WS | '(:' | 'case' | 'default'
18307 if (l1 != 88) // 'case'
18308 {
18309 break;
18310 }
18311 }
18312 shiftT(109); // 'default'
18313 lookahead1W(70); // S^WS | '(:' | 'return'
18314 shiftT(220); // 'return'
18315 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18316 try_Statement();
18317 }
18318
18319 function parse_SwitchCaseStatement()
18320 {
18321 eventHandler.startNonterminal("SwitchCaseStatement", e0);
18322 for (;;)
18323 {
18324 shift(88); // 'case'
18325 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18326 whitespace();
18327 parse_SwitchCaseOperand();
18328 if (l1 != 88) // 'case'
18329 {
18330 break;
18331 }
18332 }
18333 shift(220); // 'return'
18334 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18335 whitespace();
18336 parse_Statement();
18337 eventHandler.endNonterminal("SwitchCaseStatement", e0);
18338 }
18339
18340 function try_SwitchCaseStatement()
18341 {
18342 for (;;)
18343 {
18344 shiftT(88); // 'case'
18345 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18346 try_SwitchCaseOperand();
18347 if (l1 != 88) // 'case'
18348 {
18349 break;
18350 }
18351 }
18352 shiftT(220); // 'return'
18353 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18354 try_Statement();
18355 }
18356
18357 function parse_TryCatchStatement()
18358 {
18359 eventHandler.startNonterminal("TryCatchStatement", e0);
18360 shift(250); // 'try'
18361 lookahead1W(87); // S^WS | '(:' | '{'
18362 whitespace();
18363 parse_BlockStatement();
18364 for (;;)
18365 {
18366 lookahead1W(36); // S^WS | '(:' | 'catch'
18367 shift(91); // 'catch'
18368 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18369 whitespace();
18370 parse_CatchErrorList();
18371 whitespace();
18372 parse_BlockStatement();
18373 lookahead1W(274); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18374 switch (l1)
18375 {
18376 case 91: // 'catch'
18377 lookahead2W(276); // Wildcard | EQName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' |
18378 break;
18379 default:
18380 lk = l1;
18381 }
18382 if (lk == 38491 // 'catch' 'and'
18383 || lk == 45659 // 'catch' 'cast'
18384 || lk == 46171 // 'catch' 'castable'
18385 || lk == 60507 // 'catch' 'div'
18386 || lk == 65627 // 'catch' 'eq'
18387 || lk == 67163 // 'catch' 'except'
18388 || lk == 74843 // 'catch' 'ge'
18389 || lk == 76891 // 'catch' 'gt'
18390 || lk == 77403 // 'catch' 'idiv'
18391 || lk == 82011 // 'catch' 'instance'
18392 || lk == 83035 // 'catch' 'intersect'
18393 || lk == 84059 // 'catch' 'is'
18394 || lk == 88155 // 'catch' 'le'
18395 || lk == 91227 // 'catch' 'lt'
18396 || lk == 92251 // 'catch' 'mod'
18397 || lk == 95323 // 'catch' 'ne'
18398 || lk == 102491 // 'catch' 'or'
18399 || lk == 127067 // 'catch' 'to'
18400 || lk == 127579 // 'catch' 'treat'
18401 || lk == 130139) // 'catch' 'union'
18402 {
18403 lk = memoized(8, e0);
18404 if (lk == 0)
18405 {
18406 var b0A = b0; var e0A = e0; var l1A = l1;
18407 var b1A = b1; var e1A = e1; var l2A = l2;
18408 var b2A = b2; var e2A = e2;
18409 try
18410 {
18411 lookahead1W(36); // S^WS | '(:' | 'catch'
18412 shiftT(91); // 'catch'
18413 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18414 try_CatchErrorList();
18415 try_BlockStatement();
18416 lk = -1;
18417 }
18418 catch (p1A)
18419 {
18420 lk = -2;
18421 }
18422 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
18423 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
18424 b2 = b2A; e2 = e2A; end = e2A; }}
18425 memoize(8, e0, lk);
18426 }
18427 }
18428 if (lk != -1
18429 && lk != 2651 // 'catch' Wildcard
18430 && lk != 3163 // 'catch' EQName^Token
18431 && lk != 35931 // 'catch' 'after'
18432 && lk != 36955 // 'catch' 'allowing'
18433 && lk != 37467 // 'catch' 'ancestor'
18434 && lk != 37979 // 'catch' 'ancestor-or-self'
18435 && lk != 40027 // 'catch' 'array'
18436 && lk != 40539 // 'catch' 'as'
18437 && lk != 41051 // 'catch' 'ascending'
18438 && lk != 41563 // 'catch' 'at'
18439 && lk != 42075 // 'catch' 'attribute'
18440 && lk != 42587 // 'catch' 'base-uri'
18441 && lk != 43099 // 'catch' 'before'
18442 && lk != 43611 // 'catch' 'boundary-space'
18443 && lk != 44123 // 'catch' 'break'
18444 && lk != 45147 // 'catch' 'case'
18445 && lk != 46683 // 'catch' 'catch'
18446 && lk != 47707 // 'catch' 'child'
18447 && lk != 48219 // 'catch' 'collation'
18448 && lk != 49243 // 'catch' 'comment'
18449 && lk != 49755 // 'catch' 'constraint'
18450 && lk != 50267 // 'catch' 'construction'
18451 && lk != 51803 // 'catch' 'context'
18452 && lk != 52315 // 'catch' 'continue'
18453 && lk != 52827 // 'catch' 'copy'
18454 && lk != 53339 // 'catch' 'copy-namespaces'
18455 && lk != 53851 // 'catch' 'count'
18456 && lk != 54363 // 'catch' 'decimal-format'
18457 && lk != 55387 // 'catch' 'declare'
18458 && lk != 55899 // 'catch' 'default'
18459 && lk != 56411 // 'catch' 'delete'
18460 && lk != 56923 // 'catch' 'descendant'
18461 && lk != 57435 // 'catch' 'descendant-or-self'
18462 && lk != 57947 // 'catch' 'descending'
18463 && lk != 61019 // 'catch' 'document'
18464 && lk != 61531 // 'catch' 'document-node'
18465 && lk != 62043 // 'catch' 'element'
18466 && lk != 62555 // 'catch' 'else'
18467 && lk != 63067 // 'catch' 'empty'
18468 && lk != 63579 // 'catch' 'empty-sequence'
18469 && lk != 64091 // 'catch' 'encoding'
18470 && lk != 64603 // 'catch' 'end'
18471 && lk != 66139 // 'catch' 'every'
18472 && lk != 67675 // 'catch' 'exit'
18473 && lk != 68187 // 'catch' 'external'
18474 && lk != 68699 // 'catch' 'first'
18475 && lk != 69211 // 'catch' 'following'
18476 && lk != 69723 // 'catch' 'following-sibling'
18477 && lk != 70235 // 'catch' 'for'
18478 && lk != 72283 // 'catch' 'ft-option'
18479 && lk != 74331 // 'catch' 'function'
18480 && lk != 75867 // 'catch' 'group'
18481 && lk != 77915 // 'catch' 'if'
18482 && lk != 78427 // 'catch' 'import'
18483 && lk != 78939 // 'catch' 'in'
18484 && lk != 79451 // 'catch' 'index'
18485 && lk != 81499 // 'catch' 'insert'
18486 && lk != 82523 // 'catch' 'integrity'
18487 && lk != 83547 // 'catch' 'into'
18488 && lk != 84571 // 'catch' 'item'
18489 && lk != 85595 // 'catch' 'json-item'
18490 && lk != 87131 // 'catch' 'last'
18491 && lk != 87643 // 'catch' 'lax'
18492 && lk != 89179 // 'catch' 'let'
18493 && lk != 90203 // 'catch' 'loop'
18494 && lk != 92763 // 'catch' 'modify'
18495 && lk != 93275 // 'catch' 'module'
18496 && lk != 94299 // 'catch' 'namespace'
18497 && lk != 94811 // 'catch' 'namespace-node'
18498 && lk != 97883 // 'catch' 'node'
18499 && lk != 98395 // 'catch' 'nodes'
18500 && lk != 99419 // 'catch' 'object'
18501 && lk != 101467 // 'catch' 'only'
18502 && lk != 101979 // 'catch' 'option'
18503 && lk != 103003 // 'catch' 'order'
18504 && lk != 103515 // 'catch' 'ordered'
18505 && lk != 104027 // 'catch' 'ordering'
18506 && lk != 105563 // 'catch' 'parent'
18507 && lk != 108635 // 'catch' 'preceding'
18508 && lk != 109147 // 'catch' 'preceding-sibling'
18509 && lk != 110683 // 'catch' 'processing-instruction'
18510 && lk != 111707 // 'catch' 'rename'
18511 && lk != 112219 // 'catch' 'replace'
18512 && lk != 112731 // 'catch' 'return'
18513 && lk != 113243 // 'catch' 'returning'
18514 && lk != 113755 // 'catch' 'revalidation'
18515 && lk != 114779 // 'catch' 'satisfies'
18516 && lk != 115291 // 'catch' 'schema'
18517 && lk != 115803 // 'catch' 'schema-attribute'
18518 && lk != 116315 // 'catch' 'schema-element'
18519 && lk != 116827 // 'catch' 'score'
18520 && lk != 117339 // 'catch' 'self'
18521 && lk != 119899 // 'catch' 'sliding'
18522 && lk != 120411 // 'catch' 'some'
18523 && lk != 120923 // 'catch' 'stable'
18524 && lk != 121435 // 'catch' 'start'
18525 && lk != 122971 // 'catch' 'strict'
18526 && lk != 124507 // 'catch' 'switch'
18527 && lk != 125019 // 'catch' 'text'
18528 && lk != 128091 // 'catch' 'try'
18529 && lk != 128603 // 'catch' 'tumbling'
18530 && lk != 129115 // 'catch' 'type'
18531 && lk != 129627 // 'catch' 'typeswitch'
18532 && lk != 131163 // 'catch' 'unordered'
18533 && lk != 131675 // 'catch' 'updating'
18534 && lk != 133211 // 'catch' 'validate'
18535 && lk != 133723 // 'catch' 'value'
18536 && lk != 134235 // 'catch' 'variable'
18537 && lk != 134747 // 'catch' 'version'
18538 && lk != 136283 // 'catch' 'where'
18539 && lk != 136795 // 'catch' 'while'
18540 && lk != 138331 // 'catch' 'with'
18541 && lk != 140379) // 'catch' 'xquery'
18542 {
18543 break;
18544 }
18545 }
18546 eventHandler.endNonterminal("TryCatchStatement", e0);
18547 }
18548
18549 function try_TryCatchStatement()
18550 {
18551 shiftT(250); // 'try'
18552 lookahead1W(87); // S^WS | '(:' | '{'
18553 try_BlockStatement();
18554 lookahead1W(36); // S^WS | '(:' | 'catch'
18555 shiftT(91); // 'catch'
18556 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18557 try_CatchErrorList();
18558 try_BlockStatement();
18559 for (;;)
18560 {
18561 lookahead1W(274); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18562 switch (l1)
18563 {
18564 case 91: // 'catch'
18565 lookahead2W(276); // Wildcard | EQName^Token | S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | '*' |
18566 break;
18567 default:
18568 lk = l1;
18569 }
18570 if (lk == 38491 // 'catch' 'and'
18571 || lk == 45659 // 'catch' 'cast'
18572 || lk == 46171 // 'catch' 'castable'
18573 || lk == 60507 // 'catch' 'div'
18574 || lk == 65627 // 'catch' 'eq'
18575 || lk == 67163 // 'catch' 'except'
18576 || lk == 74843 // 'catch' 'ge'
18577 || lk == 76891 // 'catch' 'gt'
18578 || lk == 77403 // 'catch' 'idiv'
18579 || lk == 82011 // 'catch' 'instance'
18580 || lk == 83035 // 'catch' 'intersect'
18581 || lk == 84059 // 'catch' 'is'
18582 || lk == 88155 // 'catch' 'le'
18583 || lk == 91227 // 'catch' 'lt'
18584 || lk == 92251 // 'catch' 'mod'
18585 || lk == 95323 // 'catch' 'ne'
18586 || lk == 102491 // 'catch' 'or'
18587 || lk == 127067 // 'catch' 'to'
18588 || lk == 127579 // 'catch' 'treat'
18589 || lk == 130139) // 'catch' 'union'
18590 {
18591 lk = memoized(8, e0);
18592 if (lk == 0)
18593 {
18594 var b0A = b0; var e0A = e0; var l1A = l1;
18595 var b1A = b1; var e1A = e1; var l2A = l2;
18596 var b2A = b2; var e2A = e2;
18597 try
18598 {
18599 lookahead1W(36); // S^WS | '(:' | 'catch'
18600 shiftT(91); // 'catch'
18601 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18602 try_CatchErrorList();
18603 try_BlockStatement();
18604 memoize(8, e0A, -1);
18605 continue;
18606 }
18607 catch (p1A)
18608 {
18609 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
18610 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
18611 b2 = b2A; e2 = e2A; end = e2A; }}
18612 memoize(8, e0A, -2);
18613 break;
18614 }
18615 }
18616 }
18617 if (lk != -1
18618 && lk != 2651 // 'catch' Wildcard
18619 && lk != 3163 // 'catch' EQName^Token
18620 && lk != 35931 // 'catch' 'after'
18621 && lk != 36955 // 'catch' 'allowing'
18622 && lk != 37467 // 'catch' 'ancestor'
18623 && lk != 37979 // 'catch' 'ancestor-or-self'
18624 && lk != 40027 // 'catch' 'array'
18625 && lk != 40539 // 'catch' 'as'
18626 && lk != 41051 // 'catch' 'ascending'
18627 && lk != 41563 // 'catch' 'at'
18628 && lk != 42075 // 'catch' 'attribute'
18629 && lk != 42587 // 'catch' 'base-uri'
18630 && lk != 43099 // 'catch' 'before'
18631 && lk != 43611 // 'catch' 'boundary-space'
18632 && lk != 44123 // 'catch' 'break'
18633 && lk != 45147 // 'catch' 'case'
18634 && lk != 46683 // 'catch' 'catch'
18635 && lk != 47707 // 'catch' 'child'
18636 && lk != 48219 // 'catch' 'collation'
18637 && lk != 49243 // 'catch' 'comment'
18638 && lk != 49755 // 'catch' 'constraint'
18639 && lk != 50267 // 'catch' 'construction'
18640 && lk != 51803 // 'catch' 'context'
18641 && lk != 52315 // 'catch' 'continue'
18642 && lk != 52827 // 'catch' 'copy'
18643 && lk != 53339 // 'catch' 'copy-namespaces'
18644 && lk != 53851 // 'catch' 'count'
18645 && lk != 54363 // 'catch' 'decimal-format'
18646 && lk != 55387 // 'catch' 'declare'
18647 && lk != 55899 // 'catch' 'default'
18648 && lk != 56411 // 'catch' 'delete'
18649 && lk != 56923 // 'catch' 'descendant'
18650 && lk != 57435 // 'catch' 'descendant-or-self'
18651 && lk != 57947 // 'catch' 'descending'
18652 && lk != 61019 // 'catch' 'document'
18653 && lk != 61531 // 'catch' 'document-node'
18654 && lk != 62043 // 'catch' 'element'
18655 && lk != 62555 // 'catch' 'else'
18656 && lk != 63067 // 'catch' 'empty'
18657 && lk != 63579 // 'catch' 'empty-sequence'
18658 && lk != 64091 // 'catch' 'encoding'
18659 && lk != 64603 // 'catch' 'end'
18660 && lk != 66139 // 'catch' 'every'
18661 && lk != 67675 // 'catch' 'exit'
18662 && lk != 68187 // 'catch' 'external'
18663 && lk != 68699 // 'catch' 'first'
18664 && lk != 69211 // 'catch' 'following'
18665 && lk != 69723 // 'catch' 'following-sibling'
18666 && lk != 70235 // 'catch' 'for'
18667 && lk != 72283 // 'catch' 'ft-option'
18668 && lk != 74331 // 'catch' 'function'
18669 && lk != 75867 // 'catch' 'group'
18670 && lk != 77915 // 'catch' 'if'
18671 && lk != 78427 // 'catch' 'import'
18672 && lk != 78939 // 'catch' 'in'
18673 && lk != 79451 // 'catch' 'index'
18674 && lk != 81499 // 'catch' 'insert'
18675 && lk != 82523 // 'catch' 'integrity'
18676 && lk != 83547 // 'catch' 'into'
18677 && lk != 84571 // 'catch' 'item'
18678 && lk != 85595 // 'catch' 'json-item'
18679 && lk != 87131 // 'catch' 'last'
18680 && lk != 87643 // 'catch' 'lax'
18681 && lk != 89179 // 'catch' 'let'
18682 && lk != 90203 // 'catch' 'loop'
18683 && lk != 92763 // 'catch' 'modify'
18684 && lk != 93275 // 'catch' 'module'
18685 && lk != 94299 // 'catch' 'namespace'
18686 && lk != 94811 // 'catch' 'namespace-node'
18687 && lk != 97883 // 'catch' 'node'
18688 && lk != 98395 // 'catch' 'nodes'
18689 && lk != 99419 // 'catch' 'object'
18690 && lk != 101467 // 'catch' 'only'
18691 && lk != 101979 // 'catch' 'option'
18692 && lk != 103003 // 'catch' 'order'
18693 && lk != 103515 // 'catch' 'ordered'
18694 && lk != 104027 // 'catch' 'ordering'
18695 && lk != 105563 // 'catch' 'parent'
18696 && lk != 108635 // 'catch' 'preceding'
18697 && lk != 109147 // 'catch' 'preceding-sibling'
18698 && lk != 110683 // 'catch' 'processing-instruction'
18699 && lk != 111707 // 'catch' 'rename'
18700 && lk != 112219 // 'catch' 'replace'
18701 && lk != 112731 // 'catch' 'return'
18702 && lk != 113243 // 'catch' 'returning'
18703 && lk != 113755 // 'catch' 'revalidation'
18704 && lk != 114779 // 'catch' 'satisfies'
18705 && lk != 115291 // 'catch' 'schema'
18706 && lk != 115803 // 'catch' 'schema-attribute'
18707 && lk != 116315 // 'catch' 'schema-element'
18708 && lk != 116827 // 'catch' 'score'
18709 && lk != 117339 // 'catch' 'self'
18710 && lk != 119899 // 'catch' 'sliding'
18711 && lk != 120411 // 'catch' 'some'
18712 && lk != 120923 // 'catch' 'stable'
18713 && lk != 121435 // 'catch' 'start'
18714 && lk != 122971 // 'catch' 'strict'
18715 && lk != 124507 // 'catch' 'switch'
18716 && lk != 125019 // 'catch' 'text'
18717 && lk != 128091 // 'catch' 'try'
18718 && lk != 128603 // 'catch' 'tumbling'
18719 && lk != 129115 // 'catch' 'type'
18720 && lk != 129627 // 'catch' 'typeswitch'
18721 && lk != 131163 // 'catch' 'unordered'
18722 && lk != 131675 // 'catch' 'updating'
18723 && lk != 133211 // 'catch' 'validate'
18724 && lk != 133723 // 'catch' 'value'
18725 && lk != 134235 // 'catch' 'variable'
18726 && lk != 134747 // 'catch' 'version'
18727 && lk != 136283 // 'catch' 'where'
18728 && lk != 136795 // 'catch' 'while'
18729 && lk != 138331 // 'catch' 'with'
18730 && lk != 140379) // 'catch' 'xquery'
18731 {
18732 break;
18733 }
18734 lookahead1W(36); // S^WS | '(:' | 'catch'
18735 shiftT(91); // 'catch'
18736 lookahead1W(255); // Wildcard | EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18737 try_CatchErrorList();
18738 try_BlockStatement();
18739 }
18740 }
18741
18742 function parse_TypeswitchStatement()
18743 {
18744 eventHandler.startNonterminal("TypeswitchStatement", e0);
18745 shift(253); // 'typeswitch'
18746 lookahead1W(22); // S^WS | '(' | '(:'
18747 shift(34); // '('
18748 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18749 whitespace();
18750 parse_Expr();
18751 shift(37); // ')'
18752 for (;;)
18753 {
18754 lookahead1W(35); // S^WS | '(:' | 'case'
18755 whitespace();
18756 parse_CaseStatement();
18757 lookahead1W(113); // S^WS | '(:' | 'case' | 'default'
18758 if (l1 != 88) // 'case'
18759 {
18760 break;
18761 }
18762 }
18763 shift(109); // 'default'
18764 lookahead1W(95); // S^WS | '$' | '(:' | 'return'
18765 if (l1 == 31) // '$'
18766 {
18767 shift(31); // '$'
18768 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18769 whitespace();
18770 parse_VarName();
18771 }
18772 lookahead1W(70); // S^WS | '(:' | 'return'
18773 shift(220); // 'return'
18774 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18775 whitespace();
18776 parse_Statement();
18777 eventHandler.endNonterminal("TypeswitchStatement", e0);
18778 }
18779
18780 function try_TypeswitchStatement()
18781 {
18782 shiftT(253); // 'typeswitch'
18783 lookahead1W(22); // S^WS | '(' | '(:'
18784 shiftT(34); // '('
18785 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18786 try_Expr();
18787 shiftT(37); // ')'
18788 for (;;)
18789 {
18790 lookahead1W(35); // S^WS | '(:' | 'case'
18791 try_CaseStatement();
18792 lookahead1W(113); // S^WS | '(:' | 'case' | 'default'
18793 if (l1 != 88) // 'case'
18794 {
18795 break;
18796 }
18797 }
18798 shiftT(109); // 'default'
18799 lookahead1W(95); // S^WS | '$' | '(:' | 'return'
18800 if (l1 == 31) // '$'
18801 {
18802 shiftT(31); // '$'
18803 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18804 try_VarName();
18805 }
18806 lookahead1W(70); // S^WS | '(:' | 'return'
18807 shiftT(220); // 'return'
18808 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18809 try_Statement();
18810 }
18811
18812 function parse_CaseStatement()
18813 {
18814 eventHandler.startNonterminal("CaseStatement", e0);
18815 shift(88); // 'case'
18816 lookahead1W(260); // EQName^Token | S^WS | '$' | '%' | '(' | '(:' | 'after' | 'allowing' |
18817 if (l1 == 31) // '$'
18818 {
18819 shift(31); // '$'
18820 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18821 whitespace();
18822 parse_VarName();
18823 lookahead1W(30); // S^WS | '(:' | 'as'
18824 shift(79); // 'as'
18825 }
18826 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
18827 whitespace();
18828 parse_SequenceType();
18829 lookahead1W(70); // S^WS | '(:' | 'return'
18830 shift(220); // 'return'
18831 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18832 whitespace();
18833 parse_Statement();
18834 eventHandler.endNonterminal("CaseStatement", e0);
18835 }
18836
18837 function try_CaseStatement()
18838 {
18839 shiftT(88); // 'case'
18840 lookahead1W(260); // EQName^Token | S^WS | '$' | '%' | '(' | '(:' | 'after' | 'allowing' |
18841 if (l1 == 31) // '$'
18842 {
18843 shiftT(31); // '$'
18844 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18845 try_VarName();
18846 lookahead1W(30); // S^WS | '(:' | 'as'
18847 shiftT(79); // 'as'
18848 }
18849 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
18850 try_SequenceType();
18851 lookahead1W(70); // S^WS | '(:' | 'return'
18852 shiftT(220); // 'return'
18853 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18854 try_Statement();
18855 }
18856
18857 function parse_VarDeclStatement()
18858 {
18859 eventHandler.startNonterminal("VarDeclStatement", e0);
18860 for (;;)
18861 {
18862 lookahead1W(98); // S^WS | '%' | '(:' | 'variable'
18863 if (l1 != 32) // '%'
18864 {
18865 break;
18866 }
18867 whitespace();
18868 parse_Annotation();
18869 }
18870 shift(262); // 'variable'
18871 lookahead1W(21); // S^WS | '$' | '(:'
18872 shift(31); // '$'
18873 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18874 whitespace();
18875 parse_VarName();
18876 lookahead1W(157); // S^WS | '(:' | ',' | ':=' | ';' | 'as'
18877 if (l1 == 79) // 'as'
18878 {
18879 whitespace();
18880 parse_TypeDeclaration();
18881 }
18882 lookahead1W(145); // S^WS | '(:' | ',' | ':=' | ';'
18883 if (l1 == 52) // ':='
18884 {
18885 shift(52); // ':='
18886 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18887 whitespace();
18888 parse_ExprSingle();
18889 }
18890 for (;;)
18891 {
18892 if (l1 != 41) // ','
18893 {
18894 break;
18895 }
18896 shift(41); // ','
18897 lookahead1W(21); // S^WS | '$' | '(:'
18898 shift(31); // '$'
18899 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18900 whitespace();
18901 parse_VarName();
18902 lookahead1W(157); // S^WS | '(:' | ',' | ':=' | ';' | 'as'
18903 if (l1 == 79) // 'as'
18904 {
18905 whitespace();
18906 parse_TypeDeclaration();
18907 }
18908 lookahead1W(145); // S^WS | '(:' | ',' | ':=' | ';'
18909 if (l1 == 52) // ':='
18910 {
18911 shift(52); // ':='
18912 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18913 whitespace();
18914 parse_ExprSingle();
18915 }
18916 }
18917 shift(53); // ';'
18918 eventHandler.endNonterminal("VarDeclStatement", e0);
18919 }
18920
18921 function try_VarDeclStatement()
18922 {
18923 for (;;)
18924 {
18925 lookahead1W(98); // S^WS | '%' | '(:' | 'variable'
18926 if (l1 != 32) // '%'
18927 {
18928 break;
18929 }
18930 try_Annotation();
18931 }
18932 shiftT(262); // 'variable'
18933 lookahead1W(21); // S^WS | '$' | '(:'
18934 shiftT(31); // '$'
18935 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18936 try_VarName();
18937 lookahead1W(157); // S^WS | '(:' | ',' | ':=' | ';' | 'as'
18938 if (l1 == 79) // 'as'
18939 {
18940 try_TypeDeclaration();
18941 }
18942 lookahead1W(145); // S^WS | '(:' | ',' | ':=' | ';'
18943 if (l1 == 52) // ':='
18944 {
18945 shiftT(52); // ':='
18946 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18947 try_ExprSingle();
18948 }
18949 for (;;)
18950 {
18951 if (l1 != 41) // ','
18952 {
18953 break;
18954 }
18955 shiftT(41); // ','
18956 lookahead1W(21); // S^WS | '$' | '(:'
18957 shiftT(31); // '$'
18958 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
18959 try_VarName();
18960 lookahead1W(157); // S^WS | '(:' | ',' | ':=' | ';' | 'as'
18961 if (l1 == 79) // 'as'
18962 {
18963 try_TypeDeclaration();
18964 }
18965 lookahead1W(145); // S^WS | '(:' | ',' | ':=' | ';'
18966 if (l1 == 52) // ':='
18967 {
18968 shiftT(52); // ':='
18969 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18970 try_ExprSingle();
18971 }
18972 }
18973 shiftT(53); // ';'
18974 }
18975
18976 function parse_WhileStatement()
18977 {
18978 eventHandler.startNonterminal("WhileStatement", e0);
18979 shift(267); // 'while'
18980 lookahead1W(22); // S^WS | '(' | '(:'
18981 shift(34); // '('
18982 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18983 whitespace();
18984 parse_Expr();
18985 shift(37); // ')'
18986 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18987 whitespace();
18988 parse_Statement();
18989 eventHandler.endNonterminal("WhileStatement", e0);
18990 }
18991
18992 function try_WhileStatement()
18993 {
18994 shiftT(267); // 'while'
18995 lookahead1W(22); // S^WS | '(' | '(:'
18996 shiftT(34); // '('
18997 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
18998 try_Expr();
18999 shiftT(37); // ')'
19000 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19001 try_Statement();
19002 }
19003
19004 function parse_ExprSingle()
19005 {
19006 eventHandler.startNonterminal("ExprSingle", e0);
19007 switch (l1)
19008 {
19009 case 137: // 'for'
19010 lookahead2W(233); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' |
19011 break;
19012 case 174: // 'let'
19013 lookahead2W(231); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' |
19014 break;
19015 case 250: // 'try'
19016 lookahead2W(230); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
19017 break;
19018 case 152: // 'if'
19019 case 243: // 'switch'
19020 case 253: // 'typeswitch'
19021 lookahead2W(228); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
19022 break;
19023 default:
19024 lk = l1;
19025 }
19026 switch (lk)
19027 {
19028 case 16009: // 'for' '$'
19029 case 16046: // 'let' '$'
19030 case 116910: // 'let' 'score'
19031 case 119945: // 'for' 'sliding'
19032 case 128649: // 'for' 'tumbling'
19033 parse_FLWORExpr();
19034 break;
19035 case 17560: // 'if' '('
19036 parse_IfExpr();
19037 break;
19038 case 17651: // 'switch' '('
19039 parse_SwitchExpr();
19040 break;
19041 case 141562: // 'try' '{'
19042 parse_TryCatchExpr();
19043 break;
19044 case 17661: // 'typeswitch' '('
19045 parse_TypeswitchExpr();
19046 break;
19047 default:
19048 parse_ExprSimple();
19049 }
19050 eventHandler.endNonterminal("ExprSingle", e0);
19051 }
19052
19053 function try_ExprSingle()
19054 {
19055 switch (l1)
19056 {
19057 case 137: // 'for'
19058 lookahead2W(233); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' |
19059 break;
19060 case 174: // 'let'
19061 lookahead2W(231); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' |
19062 break;
19063 case 250: // 'try'
19064 lookahead2W(230); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
19065 break;
19066 case 152: // 'if'
19067 case 243: // 'switch'
19068 case 253: // 'typeswitch'
19069 lookahead2W(228); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
19070 break;
19071 default:
19072 lk = l1;
19073 }
19074 switch (lk)
19075 {
19076 case 16009: // 'for' '$'
19077 case 16046: // 'let' '$'
19078 case 116910: // 'let' 'score'
19079 case 119945: // 'for' 'sliding'
19080 case 128649: // 'for' 'tumbling'
19081 try_FLWORExpr();
19082 break;
19083 case 17560: // 'if' '('
19084 try_IfExpr();
19085 break;
19086 case 17651: // 'switch' '('
19087 try_SwitchExpr();
19088 break;
19089 case 141562: // 'try' '{'
19090 try_TryCatchExpr();
19091 break;
19092 case 17661: // 'typeswitch' '('
19093 try_TypeswitchExpr();
19094 break;
19095 default:
19096 try_ExprSimple();
19097 }
19098 }
19099
19100 function parse_ExprSimple()
19101 {
19102 eventHandler.startNonterminal("ExprSimple", e0);
19103 switch (l1)
19104 {
19105 case 218: // 'rename'
19106 lookahead2W(232); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
19107 break;
19108 case 219: // 'replace'
19109 lookahead2W(235); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
19110 break;
19111 case 110: // 'delete'
19112 case 159: // 'insert'
19113 lookahead2W(234); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
19114 break;
19115 case 103: // 'copy'
19116 case 129: // 'every'
19117 case 235: // 'some'
19118 lookahead2W(229); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' |
19119 break;
19120 default:
19121 lk = l1;
19122 }
19123 switch (lk)
19124 {
19125 case 16001: // 'every' '$'
19126 case 16107: // 'some' '$'
19127 parse_QuantifiedExpr();
19128 break;
19129 case 97951: // 'insert' 'node'
19130 case 98463: // 'insert' 'nodes'
19131 parse_InsertExpr();
19132 break;
19133 case 97902: // 'delete' 'node'
19134 case 98414: // 'delete' 'nodes'
19135 parse_DeleteExpr();
19136 break;
19137 case 98010: // 'rename' 'node'
19138 parse_RenameExpr();
19139 break;
19140 case 98011: // 'replace' 'node'
19141 case 133851: // 'replace' 'value'
19142 parse_ReplaceExpr();
19143 break;
19144 case 15975: // 'copy' '$'
19145 parse_TransformExpr();
19146 break;
19147 case 85102: // 'delete' 'json'
19148 parse_JSONDeleteExpr();
19149 break;
19150 case 85151: // 'insert' 'json'
19151 parse_JSONInsertExpr();
19152 break;
19153 case 85210: // 'rename' 'json'
19154 parse_JSONRenameExpr();
19155 break;
19156 case 85211: // 'replace' 'json'
19157 parse_JSONReplaceExpr();
19158 break;
19159 case 77: // 'append'
19160 parse_JSONAppendExpr();
19161 break;
19162 default:
19163 parse_OrExpr();
19164 }
19165 eventHandler.endNonterminal("ExprSimple", e0);
19166 }
19167
19168 function try_ExprSimple()
19169 {
19170 switch (l1)
19171 {
19172 case 218: // 'rename'
19173 lookahead2W(232); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
19174 break;
19175 case 219: // 'replace'
19176 lookahead2W(235); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
19177 break;
19178 case 110: // 'delete'
19179 case 159: // 'insert'
19180 lookahead2W(234); // S^WS | EOF | '!' | '!=' | '#' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' | '/' |
19181 break;
19182 case 103: // 'copy'
19183 case 129: // 'every'
19184 case 235: // 'some'
19185 lookahead2W(229); // S^WS | EOF | '!' | '!=' | '#' | '$' | '(' | '(:' | ')' | '*' | '+' | ',' | '-' |
19186 break;
19187 default:
19188 lk = l1;
19189 }
19190 switch (lk)
19191 {
19192 case 16001: // 'every' '$'
19193 case 16107: // 'some' '$'
19194 try_QuantifiedExpr();
19195 break;
19196 case 97951: // 'insert' 'node'
19197 case 98463: // 'insert' 'nodes'
19198 try_InsertExpr();
19199 break;
19200 case 97902: // 'delete' 'node'
19201 case 98414: // 'delete' 'nodes'
19202 try_DeleteExpr();
19203 break;
19204 case 98010: // 'rename' 'node'
19205 try_RenameExpr();
19206 break;
19207 case 98011: // 'replace' 'node'
19208 case 133851: // 'replace' 'value'
19209 try_ReplaceExpr();
19210 break;
19211 case 15975: // 'copy' '$'
19212 try_TransformExpr();
19213 break;
19214 case 85102: // 'delete' 'json'
19215 try_JSONDeleteExpr();
19216 break;
19217 case 85151: // 'insert' 'json'
19218 try_JSONInsertExpr();
19219 break;
19220 case 85210: // 'rename' 'json'
19221 try_JSONRenameExpr();
19222 break;
19223 case 85211: // 'replace' 'json'
19224 try_JSONReplaceExpr();
19225 break;
19226 case 77: // 'append'
19227 try_JSONAppendExpr();
19228 break;
19229 default:
19230 try_OrExpr();
19231 }
19232 }
19233
19234 function parse_JSONDeleteExpr()
19235 {
19236 eventHandler.startNonterminal("JSONDeleteExpr", e0);
19237 shift(110); // 'delete'
19238 lookahead1W(56); // S^WS | '(:' | 'json'
19239 shift(166); // 'json'
19240 lookahead1W(262); // EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral | StringLiteral |
19241 whitespace();
19242 parse_PostfixExpr();
19243 eventHandler.endNonterminal("JSONDeleteExpr", e0);
19244 }
19245
19246 function try_JSONDeleteExpr()
19247 {
19248 shiftT(110); // 'delete'
19249 lookahead1W(56); // S^WS | '(:' | 'json'
19250 shiftT(166); // 'json'
19251 lookahead1W(262); // EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral | StringLiteral |
19252 try_PostfixExpr();
19253 }
19254
19255 function parse_JSONInsertExpr()
19256 {
19257 eventHandler.startNonterminal("JSONInsertExpr", e0);
19258 shift(159); // 'insert'
19259 lookahead1W(56); // S^WS | '(:' | 'json'
19260 shift(166); // 'json'
19261 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19262 whitespace();
19263 parse_ExprSingle();
19264 shift(163); // 'into'
19265 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19266 whitespace();
19267 parse_ExprSingle();
19268 switch (l1)
19269 {
19270 case 81: // 'at'
19271 lookahead2W(69); // S^WS | '(:' | 'position'
19272 break;
19273 default:
19274 lk = l1;
19275 }
19276 if (lk == 108113) // 'at' 'position'
19277 {
19278 lk = memoized(9, e0);
19279 if (lk == 0)
19280 {
19281 var b0A = b0; var e0A = e0; var l1A = l1;
19282 var b1A = b1; var e1A = e1; var l2A = l2;
19283 var b2A = b2; var e2A = e2;
19284 try
19285 {
19286 shiftT(81); // 'at'
19287 lookahead1W(69); // S^WS | '(:' | 'position'
19288 shiftT(211); // 'position'
19289 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19290 try_ExprSingle();
19291 lk = -1;
19292 }
19293 catch (p1A)
19294 {
19295 lk = -2;
19296 }
19297 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
19298 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
19299 b2 = b2A; e2 = e2A; end = e2A; }}
19300 memoize(9, e0, lk);
19301 }
19302 }
19303 if (lk == -1)
19304 {
19305 shift(81); // 'at'
19306 lookahead1W(69); // S^WS | '(:' | 'position'
19307 shift(211); // 'position'
19308 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19309 whitespace();
19310 parse_ExprSingle();
19311 }
19312 eventHandler.endNonterminal("JSONInsertExpr", e0);
19313 }
19314
19315 function try_JSONInsertExpr()
19316 {
19317 shiftT(159); // 'insert'
19318 lookahead1W(56); // S^WS | '(:' | 'json'
19319 shiftT(166); // 'json'
19320 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19321 try_ExprSingle();
19322 shiftT(163); // 'into'
19323 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19324 try_ExprSingle();
19325 switch (l1)
19326 {
19327 case 81: // 'at'
19328 lookahead2W(69); // S^WS | '(:' | 'position'
19329 break;
19330 default:
19331 lk = l1;
19332 }
19333 if (lk == 108113) // 'at' 'position'
19334 {
19335 lk = memoized(9, e0);
19336 if (lk == 0)
19337 {
19338 var b0A = b0; var e0A = e0; var l1A = l1;
19339 var b1A = b1; var e1A = e1; var l2A = l2;
19340 var b2A = b2; var e2A = e2;
19341 try
19342 {
19343 shiftT(81); // 'at'
19344 lookahead1W(69); // S^WS | '(:' | 'position'
19345 shiftT(211); // 'position'
19346 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19347 try_ExprSingle();
19348 memoize(9, e0A, -1);
19349 }
19350 catch (p1A)
19351 {
19352 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
19353 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
19354 b2 = b2A; e2 = e2A; end = e2A; }}
19355 memoize(9, e0A, -2);
19356 }
19357 lk = -2;
19358 }
19359 }
19360 if (lk == -1)
19361 {
19362 shiftT(81); // 'at'
19363 lookahead1W(69); // S^WS | '(:' | 'position'
19364 shiftT(211); // 'position'
19365 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19366 try_ExprSingle();
19367 }
19368 }
19369
19370 function parse_JSONRenameExpr()
19371 {
19372 eventHandler.startNonterminal("JSONRenameExpr", e0);
19373 shift(218); // 'rename'
19374 lookahead1W(56); // S^WS | '(:' | 'json'
19375 shift(166); // 'json'
19376 lookahead1W(262); // EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral | StringLiteral |
19377 whitespace();
19378 parse_PostfixExpr();
19379 shift(79); // 'as'
19380 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19381 whitespace();
19382 parse_ExprSingle();
19383 eventHandler.endNonterminal("JSONRenameExpr", e0);
19384 }
19385
19386 function try_JSONRenameExpr()
19387 {
19388 shiftT(218); // 'rename'
19389 lookahead1W(56); // S^WS | '(:' | 'json'
19390 shiftT(166); // 'json'
19391 lookahead1W(262); // EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral | StringLiteral |
19392 try_PostfixExpr();
19393 shiftT(79); // 'as'
19394 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19395 try_ExprSingle();
19396 }
19397
19398 function parse_JSONReplaceExpr()
19399 {
19400 eventHandler.startNonterminal("JSONReplaceExpr", e0);
19401 shift(219); // 'replace'
19402 lookahead1W(56); // S^WS | '(:' | 'json'
19403 shift(166); // 'json'
19404 lookahead1W(82); // S^WS | '(:' | 'value'
19405 shift(261); // 'value'
19406 lookahead1W(64); // S^WS | '(:' | 'of'
19407 shift(196); // 'of'
19408 lookahead1W(262); // EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral | StringLiteral |
19409 whitespace();
19410 parse_PostfixExpr();
19411 shift(270); // 'with'
19412 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19413 whitespace();
19414 parse_ExprSingle();
19415 eventHandler.endNonterminal("JSONReplaceExpr", e0);
19416 }
19417
19418 function try_JSONReplaceExpr()
19419 {
19420 shiftT(219); // 'replace'
19421 lookahead1W(56); // S^WS | '(:' | 'json'
19422 shiftT(166); // 'json'
19423 lookahead1W(82); // S^WS | '(:' | 'value'
19424 shiftT(261); // 'value'
19425 lookahead1W(64); // S^WS | '(:' | 'of'
19426 shiftT(196); // 'of'
19427 lookahead1W(262); // EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral | StringLiteral |
19428 try_PostfixExpr();
19429 shiftT(270); // 'with'
19430 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19431 try_ExprSingle();
19432 }
19433
19434 function parse_JSONAppendExpr()
19435 {
19436 eventHandler.startNonterminal("JSONAppendExpr", e0);
19437 shift(77); // 'append'
19438 lookahead1W(56); // S^WS | '(:' | 'json'
19439 shift(166); // 'json'
19440 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19441 whitespace();
19442 parse_ExprSingle();
19443 shift(163); // 'into'
19444 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19445 whitespace();
19446 parse_ExprSingle();
19447 eventHandler.endNonterminal("JSONAppendExpr", e0);
19448 }
19449
19450 function try_JSONAppendExpr()
19451 {
19452 shiftT(77); // 'append'
19453 lookahead1W(56); // S^WS | '(:' | 'json'
19454 shiftT(166); // 'json'
19455 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19456 try_ExprSingle();
19457 shiftT(163); // 'into'
19458 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19459 try_ExprSingle();
19460 }
19461
19462 function parse_CommonContent()
19463 {
19464 eventHandler.startNonterminal("CommonContent", e0);
19465 switch (l1)
19466 {
19467 case 12: // PredefinedEntityRef
19468 shift(12); // PredefinedEntityRef
19469 break;
19470 case 23: // CharRef
19471 shift(23); // CharRef
19472 break;
19473 case 277: // '{{'
19474 shift(277); // '{{'
19475 break;
19476 case 283: // '}}'
19477 shift(283); // '}}'
19478 break;
19479 default:
19480 parse_BlockExpr();
19481 }
19482 eventHandler.endNonterminal("CommonContent", e0);
19483 }
19484
19485 function try_CommonContent()
19486 {
19487 switch (l1)
19488 {
19489 case 12: // PredefinedEntityRef
19490 shiftT(12); // PredefinedEntityRef
19491 break;
19492 case 23: // CharRef
19493 shiftT(23); // CharRef
19494 break;
19495 case 277: // '{{'
19496 shiftT(277); // '{{'
19497 break;
19498 case 283: // '}}'
19499 shiftT(283); // '}}'
19500 break;
19501 default:
19502 try_BlockExpr();
19503 }
19504 }
19505
19506 function parse_ContentExpr()
19507 {
19508 eventHandler.startNonterminal("ContentExpr", e0);
19509 parse_StatementsAndExpr();
19510 eventHandler.endNonterminal("ContentExpr", e0);
19511 }
19512
19513 function try_ContentExpr()
19514 {
19515 try_StatementsAndExpr();
19516 }
19517
19518 function parse_CompDocConstructor()
19519 {
19520 eventHandler.startNonterminal("CompDocConstructor", e0);
19521 shift(119); // 'document'
19522 lookahead1W(87); // S^WS | '(:' | '{'
19523 whitespace();
19524 parse_BlockExpr();
19525 eventHandler.endNonterminal("CompDocConstructor", e0);
19526 }
19527
19528 function try_CompDocConstructor()
19529 {
19530 shiftT(119); // 'document'
19531 lookahead1W(87); // S^WS | '(:' | '{'
19532 try_BlockExpr();
19533 }
19534
19535 function parse_CompAttrConstructor()
19536 {
19537 eventHandler.startNonterminal("CompAttrConstructor", e0);
19538 shift(82); // 'attribute'
19539 lookahead1W(256); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
19540 switch (l1)
19541 {
19542 case 276: // '{'
19543 shift(276); // '{'
19544 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19545 whitespace();
19546 parse_Expr();
19547 shift(282); // '}'
19548 break;
19549 default:
19550 whitespace();
19551 parse_EQName();
19552 }
19553 lookahead1W(87); // S^WS | '(:' | '{'
19554 switch (l1)
19555 {
19556 case 276: // '{'
19557 lookahead2W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19558 break;
19559 default:
19560 lk = l1;
19561 }
19562 if (lk == 144660) // '{' '}'
19563 {
19564 lk = memoized(10, e0);
19565 if (lk == 0)
19566 {
19567 var b0A = b0; var e0A = e0; var l1A = l1;
19568 var b1A = b1; var e1A = e1; var l2A = l2;
19569 var b2A = b2; var e2A = e2;
19570 try
19571 {
19572 shiftT(276); // '{'
19573 lookahead1W(88); // S^WS | '(:' | '}'
19574 shiftT(282); // '}'
19575 lk = -1;
19576 }
19577 catch (p1A)
19578 {
19579 lk = -2;
19580 }
19581 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
19582 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
19583 b2 = b2A; e2 = e2A; end = e2A; }}
19584 memoize(10, e0, lk);
19585 }
19586 }
19587 switch (lk)
19588 {
19589 case -1:
19590 shift(276); // '{'
19591 lookahead1W(88); // S^WS | '(:' | '}'
19592 shift(282); // '}'
19593 break;
19594 default:
19595 whitespace();
19596 parse_BlockExpr();
19597 }
19598 eventHandler.endNonterminal("CompAttrConstructor", e0);
19599 }
19600
19601 function try_CompAttrConstructor()
19602 {
19603 shiftT(82); // 'attribute'
19604 lookahead1W(256); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
19605 switch (l1)
19606 {
19607 case 276: // '{'
19608 shiftT(276); // '{'
19609 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19610 try_Expr();
19611 shiftT(282); // '}'
19612 break;
19613 default:
19614 try_EQName();
19615 }
19616 lookahead1W(87); // S^WS | '(:' | '{'
19617 switch (l1)
19618 {
19619 case 276: // '{'
19620 lookahead2W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19621 break;
19622 default:
19623 lk = l1;
19624 }
19625 if (lk == 144660) // '{' '}'
19626 {
19627 lk = memoized(10, e0);
19628 if (lk == 0)
19629 {
19630 var b0A = b0; var e0A = e0; var l1A = l1;
19631 var b1A = b1; var e1A = e1; var l2A = l2;
19632 var b2A = b2; var e2A = e2;
19633 try
19634 {
19635 shiftT(276); // '{'
19636 lookahead1W(88); // S^WS | '(:' | '}'
19637 shiftT(282); // '}'
19638 memoize(10, e0A, -1);
19639 lk = -3;
19640 }
19641 catch (p1A)
19642 {
19643 lk = -2;
19644 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
19645 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
19646 b2 = b2A; e2 = e2A; end = e2A; }}
19647 memoize(10, e0A, -2);
19648 }
19649 }
19650 }
19651 switch (lk)
19652 {
19653 case -1:
19654 shiftT(276); // '{'
19655 lookahead1W(88); // S^WS | '(:' | '}'
19656 shiftT(282); // '}'
19657 break;
19658 case -3:
19659 break;
19660 default:
19661 try_BlockExpr();
19662 }
19663 }
19664
19665 function parse_CompPIConstructor()
19666 {
19667 eventHandler.startNonterminal("CompPIConstructor", e0);
19668 shift(216); // 'processing-instruction'
19669 lookahead1W(249); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
19670 switch (l1)
19671 {
19672 case 276: // '{'
19673 shift(276); // '{'
19674 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19675 whitespace();
19676 parse_Expr();
19677 shift(282); // '}'
19678 break;
19679 default:
19680 whitespace();
19681 parse_NCName();
19682 }
19683 lookahead1W(87); // S^WS | '(:' | '{'
19684 switch (l1)
19685 {
19686 case 276: // '{'
19687 lookahead2W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19688 break;
19689 default:
19690 lk = l1;
19691 }
19692 if (lk == 144660) // '{' '}'
19693 {
19694 lk = memoized(11, e0);
19695 if (lk == 0)
19696 {
19697 var b0A = b0; var e0A = e0; var l1A = l1;
19698 var b1A = b1; var e1A = e1; var l2A = l2;
19699 var b2A = b2; var e2A = e2;
19700 try
19701 {
19702 shiftT(276); // '{'
19703 lookahead1W(88); // S^WS | '(:' | '}'
19704 shiftT(282); // '}'
19705 lk = -1;
19706 }
19707 catch (p1A)
19708 {
19709 lk = -2;
19710 }
19711 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
19712 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
19713 b2 = b2A; e2 = e2A; end = e2A; }}
19714 memoize(11, e0, lk);
19715 }
19716 }
19717 switch (lk)
19718 {
19719 case -1:
19720 shift(276); // '{'
19721 lookahead1W(88); // S^WS | '(:' | '}'
19722 shift(282); // '}'
19723 break;
19724 default:
19725 whitespace();
19726 parse_BlockExpr();
19727 }
19728 eventHandler.endNonterminal("CompPIConstructor", e0);
19729 }
19730
19731 function try_CompPIConstructor()
19732 {
19733 shiftT(216); // 'processing-instruction'
19734 lookahead1W(249); // NCName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
19735 switch (l1)
19736 {
19737 case 276: // '{'
19738 shiftT(276); // '{'
19739 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19740 try_Expr();
19741 shiftT(282); // '}'
19742 break;
19743 default:
19744 try_NCName();
19745 }
19746 lookahead1W(87); // S^WS | '(:' | '{'
19747 switch (l1)
19748 {
19749 case 276: // '{'
19750 lookahead2W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19751 break;
19752 default:
19753 lk = l1;
19754 }
19755 if (lk == 144660) // '{' '}'
19756 {
19757 lk = memoized(11, e0);
19758 if (lk == 0)
19759 {
19760 var b0A = b0; var e0A = e0; var l1A = l1;
19761 var b1A = b1; var e1A = e1; var l2A = l2;
19762 var b2A = b2; var e2A = e2;
19763 try
19764 {
19765 shiftT(276); // '{'
19766 lookahead1W(88); // S^WS | '(:' | '}'
19767 shiftT(282); // '}'
19768 memoize(11, e0A, -1);
19769 lk = -3;
19770 }
19771 catch (p1A)
19772 {
19773 lk = -2;
19774 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
19775 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
19776 b2 = b2A; e2 = e2A; end = e2A; }}
19777 memoize(11, e0A, -2);
19778 }
19779 }
19780 }
19781 switch (lk)
19782 {
19783 case -1:
19784 shiftT(276); // '{'
19785 lookahead1W(88); // S^WS | '(:' | '}'
19786 shiftT(282); // '}'
19787 break;
19788 case -3:
19789 break;
19790 default:
19791 try_BlockExpr();
19792 }
19793 }
19794
19795 function parse_CompCommentConstructor()
19796 {
19797 eventHandler.startNonterminal("CompCommentConstructor", e0);
19798 shift(96); // 'comment'
19799 lookahead1W(87); // S^WS | '(:' | '{'
19800 whitespace();
19801 parse_BlockExpr();
19802 eventHandler.endNonterminal("CompCommentConstructor", e0);
19803 }
19804
19805 function try_CompCommentConstructor()
19806 {
19807 shiftT(96); // 'comment'
19808 lookahead1W(87); // S^WS | '(:' | '{'
19809 try_BlockExpr();
19810 }
19811
19812 function parse_CompTextConstructor()
19813 {
19814 eventHandler.startNonterminal("CompTextConstructor", e0);
19815 shift(244); // 'text'
19816 lookahead1W(87); // S^WS | '(:' | '{'
19817 whitespace();
19818 parse_BlockExpr();
19819 eventHandler.endNonterminal("CompTextConstructor", e0);
19820 }
19821
19822 function try_CompTextConstructor()
19823 {
19824 shiftT(244); // 'text'
19825 lookahead1W(87); // S^WS | '(:' | '{'
19826 try_BlockExpr();
19827 }
19828
19829 function parse_PrimaryExpr()
19830 {
19831 eventHandler.startNonterminal("PrimaryExpr", e0);
19832 switch (l1)
19833 {
19834 case 184: // 'namespace'
19835 lookahead2W(254); // NCName^Token | S^WS | '#' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
19836 break;
19837 case 216: // 'processing-instruction'
19838 lookahead2W(252); // NCName^Token | S^WS | '#' | '(:' | 'after' | 'allowing' | 'ancestor' |
19839 break;
19840 case 276: // '{'
19841 lookahead2W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
19842 break;
19843 case 82: // 'attribute'
19844 case 121: // 'element'
19845 lookahead2W(257); // EQName^Token | S^WS | '#' | '(:' | 'after' | 'allowing' | 'ancestor' |
19846 break;
19847 case 96: // 'comment'
19848 case 244: // 'text'
19849 lookahead2W(93); // S^WS | '#' | '(:' | '{'
19850 break;
19851 case 119: // 'document'
19852 case 202: // 'ordered'
19853 case 256: // 'unordered'
19854 lookahead2W(139); // S^WS | '#' | '(' | '(:' | '{'
19855 break;
19856 case 6: // EQName^Token
19857 case 70: // 'after'
19858 case 72: // 'allowing'
19859 case 73: // 'ancestor'
19860 case 74: // 'ancestor-or-self'
19861 case 75: // 'and'
19862 case 78: // 'array'
19863 case 79: // 'as'
19864 case 80: // 'ascending'
19865 case 81: // 'at'
19866 case 83: // 'base-uri'
19867 case 84: // 'before'
19868 case 85: // 'boundary-space'
19869 case 86: // 'break'
19870 case 88: // 'case'
19871 case 89: // 'cast'
19872 case 90: // 'castable'
19873 case 91: // 'catch'
19874 case 93: // 'child'
19875 case 94: // 'collation'
19876 case 97: // 'constraint'
19877 case 98: // 'construction'
19878 case 101: // 'context'
19879 case 102: // 'continue'
19880 case 103: // 'copy'
19881 case 104: // 'copy-namespaces'
19882 case 105: // 'count'
19883 case 106: // 'decimal-format'
19884 case 108: // 'declare'
19885 case 109: // 'default'
19886 case 110: // 'delete'
19887 case 111: // 'descendant'
19888 case 112: // 'descendant-or-self'
19889 case 113: // 'descending'
19890 case 118: // 'div'
19891 case 122: // 'else'
19892 case 123: // 'empty'
19893 case 125: // 'encoding'
19894 case 126: // 'end'
19895 case 128: // 'eq'
19896 case 129: // 'every'
19897 case 131: // 'except'
19898 case 132: // 'exit'
19899 case 133: // 'external'
19900 case 134: // 'first'
19901 case 135: // 'following'
19902 case 136: // 'following-sibling'
19903 case 137: // 'for'
19904 case 141: // 'ft-option'
19905 case 146: // 'ge'
19906 case 148: // 'group'
19907 case 150: // 'gt'
19908 case 151: // 'idiv'
19909 case 153: // 'import'
19910 case 154: // 'in'
19911 case 155: // 'index'
19912 case 159: // 'insert'
19913 case 160: // 'instance'
19914 case 161: // 'integrity'
19915 case 162: // 'intersect'
19916 case 163: // 'into'
19917 case 164: // 'is'
19918 case 167: // 'json-item'
19919 case 170: // 'last'
19920 case 171: // 'lax'
19921 case 172: // 'le'
19922 case 174: // 'let'
19923 case 176: // 'loop'
19924 case 178: // 'lt'
19925 case 180: // 'mod'
19926 case 181: // 'modify'
19927 case 182: // 'module'
19928 case 186: // 'ne'
19929 case 192: // 'nodes'
19930 case 194: // 'object'
19931 case 198: // 'only'
19932 case 199: // 'option'
19933 case 200: // 'or'
19934 case 201: // 'order'
19935 case 203: // 'ordering'
19936 case 206: // 'parent'
19937 case 212: // 'preceding'
19938 case 213: // 'preceding-sibling'
19939 case 218: // 'rename'
19940 case 219: // 'replace'
19941 case 220: // 'return'
19942 case 221: // 'returning'
19943 case 222: // 'revalidation'
19944 case 224: // 'satisfies'
19945 case 225: // 'schema'
19946 case 228: // 'score'
19947 case 229: // 'self'
19948 case 234: // 'sliding'
19949 case 235: // 'some'
19950 case 236: // 'stable'
19951 case 237: // 'start'
19952 case 240: // 'strict'
19953 case 248: // 'to'
19954 case 249: // 'treat'
19955 case 250: // 'try'
19956 case 251: // 'tumbling'
19957 case 252: // 'type'
19958 case 254: // 'union'
19959 case 257: // 'updating'
19960 case 260: // 'validate'
19961 case 261: // 'value'
19962 case 262: // 'variable'
19963 case 263: // 'version'
19964 case 266: // 'where'
19965 case 267: // 'while'
19966 case 270: // 'with'
19967 case 274: // 'xquery'
19968 lookahead2W(92); // S^WS | '#' | '(' | '(:'
19969 break;
19970 default:
19971 lk = l1;
19972 }
19973 if (lk == 2836 // '{' Wildcard
19974 || lk == 3348 // '{' EQName^Token
19975 || lk == 4372 // '{' IntegerLiteral
19976 || lk == 4884 // '{' DecimalLiteral
19977 || lk == 5396 // '{' DoubleLiteral
19978 || lk == 5908 // '{' StringLiteral
19979 || lk == 16148 // '{' '$'
19980 || lk == 16660 // '{' '%'
19981 || lk == 17684 // '{' '('
19982 || lk == 18196 // '{' '(#'
19983 || lk == 20756 // '{' '+'
19984 || lk == 21780 // '{' '-'
19985 || lk == 22804 // '{' '.'
19986 || lk == 23316 // '{' '..'
19987 || lk == 23828 // '{' '/'
19988 || lk == 24340 // '{' '//'
19989 || lk == 27924 // '{' '<'
19990 || lk == 28436 // '{' '<!--'
19991 || lk == 30484 // '{' '<?'
19992 || lk == 34068 // '{' '@'
19993 || lk == 35092 // '{' '['
19994 || lk == 36116 // '{' 'after'
19995 || lk == 37140 // '{' 'allowing'
19996 || lk == 37652 // '{' 'ancestor'
19997 || lk == 38164 // '{' 'ancestor-or-self'
19998 || lk == 38676 // '{' 'and'
19999 || lk == 39700 // '{' 'append'
20000 || lk == 40212 // '{' 'array'
20001 || lk == 40724 // '{' 'as'
20002 || lk == 41236 // '{' 'ascending'
20003 || lk == 41748 // '{' 'at'
20004 || lk == 42260 // '{' 'attribute'
20005 || lk == 42772 // '{' 'base-uri'
20006 || lk == 43284 // '{' 'before'
20007 || lk == 43796 // '{' 'boundary-space'
20008 || lk == 44308 // '{' 'break'
20009 || lk == 45332 // '{' 'case'
20010 || lk == 45844 // '{' 'cast'
20011 || lk == 46356 // '{' 'castable'
20012 || lk == 46868 // '{' 'catch'
20013 || lk == 47892 // '{' 'child'
20014 || lk == 48404 // '{' 'collation'
20015 || lk == 49428 // '{' 'comment'
20016 || lk == 49940 // '{' 'constraint'
20017 || lk == 50452 // '{' 'construction'
20018 || lk == 51988 // '{' 'context'
20019 || lk == 52500 // '{' 'continue'
20020 || lk == 53012 // '{' 'copy'
20021 || lk == 53524 // '{' 'copy-namespaces'
20022 || lk == 54036 // '{' 'count'
20023 || lk == 54548 // '{' 'decimal-format'
20024 || lk == 55572 // '{' 'declare'
20025 || lk == 56084 // '{' 'default'
20026 || lk == 56596 // '{' 'delete'
20027 || lk == 57108 // '{' 'descendant'
20028 || lk == 57620 // '{' 'descendant-or-self'
20029 || lk == 58132 // '{' 'descending'
20030 || lk == 60692 // '{' 'div'
20031 || lk == 61204 // '{' 'document'
20032 || lk == 61716 // '{' 'document-node'
20033 || lk == 62228 // '{' 'element'
20034 || lk == 62740 // '{' 'else'
20035 || lk == 63252 // '{' 'empty'
20036 || lk == 63764 // '{' 'empty-sequence'
20037 || lk == 64276 // '{' 'encoding'
20038 || lk == 64788 // '{' 'end'
20039 || lk == 65812 // '{' 'eq'
20040 || lk == 66324 // '{' 'every'
20041 || lk == 67348 // '{' 'except'
20042 || lk == 67860 // '{' 'exit'
20043 || lk == 68372 // '{' 'external'
20044 || lk == 68884 // '{' 'first'
20045 || lk == 69396 // '{' 'following'
20046 || lk == 69908 // '{' 'following-sibling'
20047 || lk == 70420 // '{' 'for'
20048 || lk == 72468 // '{' 'ft-option'
20049 || lk == 74516 // '{' 'function'
20050 || lk == 75028 // '{' 'ge'
20051 || lk == 76052 // '{' 'group'
20052 || lk == 77076 // '{' 'gt'
20053 || lk == 77588 // '{' 'idiv'
20054 || lk == 78100 // '{' 'if'
20055 || lk == 78612 // '{' 'import'
20056 || lk == 79124 // '{' 'in'
20057 || lk == 79636 // '{' 'index'
20058 || lk == 81684 // '{' 'insert'
20059 || lk == 82196 // '{' 'instance'
20060 || lk == 82708 // '{' 'integrity'
20061 || lk == 83220 // '{' 'intersect'
20062 || lk == 83732 // '{' 'into'
20063 || lk == 84244 // '{' 'is'
20064 || lk == 84756 // '{' 'item'
20065 || lk == 85780 // '{' 'json-item'
20066 || lk == 87316 // '{' 'last'
20067 || lk == 87828 // '{' 'lax'
20068 || lk == 88340 // '{' 'le'
20069 || lk == 89364 // '{' 'let'
20070 || lk == 90388 // '{' 'loop'
20071 || lk == 91412 // '{' 'lt'
20072 || lk == 92436 // '{' 'mod'
20073 || lk == 92948 // '{' 'modify'
20074 || lk == 93460 // '{' 'module'
20075 || lk == 94484 // '{' 'namespace'
20076 || lk == 94996 // '{' 'namespace-node'
20077 || lk == 95508 // '{' 'ne'
20078 || lk == 98068 // '{' 'node'
20079 || lk == 98580 // '{' 'nodes'
20080 || lk == 99604 // '{' 'object'
20081 || lk == 101652 // '{' 'only'
20082 || lk == 102164 // '{' 'option'
20083 || lk == 102676 // '{' 'or'
20084 || lk == 103188 // '{' 'order'
20085 || lk == 103700 // '{' 'ordered'
20086 || lk == 104212 // '{' 'ordering'
20087 || lk == 105748 // '{' 'parent'
20088 || lk == 108820 // '{' 'preceding'
20089 || lk == 109332 // '{' 'preceding-sibling'
20090 || lk == 110868 // '{' 'processing-instruction'
20091 || lk == 111892 // '{' 'rename'
20092 || lk == 112404 // '{' 'replace'
20093 || lk == 112916 // '{' 'return'
20094 || lk == 113428 // '{' 'returning'
20095 || lk == 113940 // '{' 'revalidation'
20096 || lk == 114964 // '{' 'satisfies'
20097 || lk == 115476 // '{' 'schema'
20098 || lk == 115988 // '{' 'schema-attribute'
20099 || lk == 116500 // '{' 'schema-element'
20100 || lk == 117012 // '{' 'score'
20101 || lk == 117524 // '{' 'self'
20102 || lk == 120084 // '{' 'sliding'
20103 || lk == 120596 // '{' 'some'
20104 || lk == 121108 // '{' 'stable'
20105 || lk == 121620 // '{' 'start'
20106 || lk == 123156 // '{' 'strict'
20107 || lk == 124692 // '{' 'switch'
20108 || lk == 125204 // '{' 'text'
20109 || lk == 127252 // '{' 'to'
20110 || lk == 127764 // '{' 'treat'
20111 || lk == 128276 // '{' 'try'
20112 || lk == 128788 // '{' 'tumbling'
20113 || lk == 129300 // '{' 'type'
20114 || lk == 129812 // '{' 'typeswitch'
20115 || lk == 130324 // '{' 'union'
20116 || lk == 131348 // '{' 'unordered'
20117 || lk == 131860 // '{' 'updating'
20118 || lk == 133396 // '{' 'validate'
20119 || lk == 133908 // '{' 'value'
20120 || lk == 134420 // '{' 'variable'
20121 || lk == 134932 // '{' 'version'
20122 || lk == 136468 // '{' 'where'
20123 || lk == 136980 // '{' 'while'
20124 || lk == 138516 // '{' 'with'
20125 || lk == 140564 // '{' 'xquery'
20126 || lk == 141588 // '{' '{'
20127 || lk == 142612 // '{' '{|'
20128 || lk == 144660) // '{' '}'
20129 {
20130 lk = memoized(12, e0);
20131 if (lk == 0)
20132 {
20133 var b0A = b0; var e0A = e0; var l1A = l1;
20134 var b1A = b1; var e1A = e1; var l2A = l2;
20135 var b2A = b2; var e2A = e2;
20136 try
20137 {
20138 try_BlockExpr();
20139 lk = -10;
20140 }
20141 catch (p10A)
20142 {
20143 lk = -11;
20144 }
20145 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
20146 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
20147 b2 = b2A; e2 = e2A; end = e2A; }}
20148 memoize(12, e0, lk);
20149 }
20150 }
20151 switch (lk)
20152 {
20153 case 8: // IntegerLiteral
20154 case 9: // DecimalLiteral
20155 case 10: // DoubleLiteral
20156 case 11: // StringLiteral
20157 parse_Literal();
20158 break;
20159 case 31: // '$'
20160 parse_VarRef();
20161 break;
20162 case 34: // '('
20163 parse_ParenthesizedExpr();
20164 break;
20165 case 44: // '.'
20166 parse_ContextItemExpr();
20167 break;
20168 case 17414: // EQName^Token '('
20169 case 17478: // 'after' '('
20170 case 17480: // 'allowing' '('
20171 case 17481: // 'ancestor' '('
20172 case 17482: // 'ancestor-or-self' '('
20173 case 17483: // 'and' '('
20174 case 17486: // 'array' '('
20175 case 17487: // 'as' '('
20176 case 17488: // 'ascending' '('
20177 case 17489: // 'at' '('
20178 case 17491: // 'base-uri' '('
20179 case 17492: // 'before' '('
20180 case 17493: // 'boundary-space' '('
20181 case 17494: // 'break' '('
20182 case 17496: // 'case' '('
20183 case 17497: // 'cast' '('
20184 case 17498: // 'castable' '('
20185 case 17499: // 'catch' '('
20186 case 17501: // 'child' '('
20187 case 17502: // 'collation' '('
20188 case 17505: // 'constraint' '('
20189 case 17506: // 'construction' '('
20190 case 17509: // 'context' '('
20191 case 17510: // 'continue' '('
20192 case 17511: // 'copy' '('
20193 case 17512: // 'copy-namespaces' '('
20194 case 17513: // 'count' '('
20195 case 17514: // 'decimal-format' '('
20196 case 17516: // 'declare' '('
20197 case 17517: // 'default' '('
20198 case 17518: // 'delete' '('
20199 case 17519: // 'descendant' '('
20200 case 17520: // 'descendant-or-self' '('
20201 case 17521: // 'descending' '('
20202 case 17526: // 'div' '('
20203 case 17527: // 'document' '('
20204 case 17530: // 'else' '('
20205 case 17531: // 'empty' '('
20206 case 17533: // 'encoding' '('
20207 case 17534: // 'end' '('
20208 case 17536: // 'eq' '('
20209 case 17537: // 'every' '('
20210 case 17539: // 'except' '('
20211 case 17540: // 'exit' '('
20212 case 17541: // 'external' '('
20213 case 17542: // 'first' '('
20214 case 17543: // 'following' '('
20215 case 17544: // 'following-sibling' '('
20216 case 17545: // 'for' '('
20217 case 17549: // 'ft-option' '('
20218 case 17554: // 'ge' '('
20219 case 17556: // 'group' '('
20220 case 17558: // 'gt' '('
20221 case 17559: // 'idiv' '('
20222 case 17561: // 'import' '('
20223 case 17562: // 'in' '('
20224 case 17563: // 'index' '('
20225 case 17567: // 'insert' '('
20226 case 17568: // 'instance' '('
20227 case 17569: // 'integrity' '('
20228 case 17570: // 'intersect' '('
20229 case 17571: // 'into' '('
20230 case 17572: // 'is' '('
20231 case 17575: // 'json-item' '('
20232 case 17578: // 'last' '('
20233 case 17579: // 'lax' '('
20234 case 17580: // 'le' '('
20235 case 17582: // 'let' '('
20236 case 17584: // 'loop' '('
20237 case 17586: // 'lt' '('
20238 case 17588: // 'mod' '('
20239 case 17589: // 'modify' '('
20240 case 17590: // 'module' '('
20241 case 17592: // 'namespace' '('
20242 case 17594: // 'ne' '('
20243 case 17600: // 'nodes' '('
20244 case 17602: // 'object' '('
20245 case 17606: // 'only' '('
20246 case 17607: // 'option' '('
20247 case 17608: // 'or' '('
20248 case 17609: // 'order' '('
20249 case 17610: // 'ordered' '('
20250 case 17611: // 'ordering' '('
20251 case 17614: // 'parent' '('
20252 case 17620: // 'preceding' '('
20253 case 17621: // 'preceding-sibling' '('
20254 case 17626: // 'rename' '('
20255 case 17627: // 'replace' '('
20256 case 17628: // 'return' '('
20257 case 17629: // 'returning' '('
20258 case 17630: // 'revalidation' '('
20259 case 17632: // 'satisfies' '('
20260 case 17633: // 'schema' '('
20261 case 17636: // 'score' '('
20262 case 17637: // 'self' '('
20263 case 17642: // 'sliding' '('
20264 case 17643: // 'some' '('
20265 case 17644: // 'stable' '('
20266 case 17645: // 'start' '('
20267 case 17648: // 'strict' '('
20268 case 17656: // 'to' '('
20269 case 17657: // 'treat' '('
20270 case 17658: // 'try' '('
20271 case 17659: // 'tumbling' '('
20272 case 17660: // 'type' '('
20273 case 17662: // 'union' '('
20274 case 17664: // 'unordered' '('
20275 case 17665: // 'updating' '('
20276 case 17668: // 'validate' '('
20277 case 17669: // 'value' '('
20278 case 17670: // 'variable' '('
20279 case 17671: // 'version' '('
20280 case 17674: // 'where' '('
20281 case 17675: // 'while' '('
20282 case 17678: // 'with' '('
20283 case 17682: // 'xquery' '('
20284 parse_FunctionCall();
20285 break;
20286 case 141514: // 'ordered' '{'
20287 parse_OrderedExpr();
20288 break;
20289 case 141568: // 'unordered' '{'
20290 parse_UnorderedExpr();
20291 break;
20292 case 32: // '%'
20293 case 120: // 'document-node'
20294 case 124: // 'empty-sequence'
20295 case 145: // 'function'
20296 case 152: // 'if'
20297 case 165: // 'item'
20298 case 185: // 'namespace-node'
20299 case 191: // 'node'
20300 case 226: // 'schema-attribute'
20301 case 227: // 'schema-element'
20302 case 243: // 'switch'
20303 case 253: // 'typeswitch'
20304 case 14854: // EQName^Token '#'
20305 case 14918: // 'after' '#'
20306 case 14920: // 'allowing' '#'
20307 case 14921: // 'ancestor' '#'
20308 case 14922: // 'ancestor-or-self' '#'
20309 case 14923: // 'and' '#'
20310 case 14926: // 'array' '#'
20311 case 14927: // 'as' '#'
20312 case 14928: // 'ascending' '#'
20313 case 14929: // 'at' '#'
20314 case 14930: // 'attribute' '#'
20315 case 14931: // 'base-uri' '#'
20316 case 14932: // 'before' '#'
20317 case 14933: // 'boundary-space' '#'
20318 case 14934: // 'break' '#'
20319 case 14936: // 'case' '#'
20320 case 14937: // 'cast' '#'
20321 case 14938: // 'castable' '#'
20322 case 14939: // 'catch' '#'
20323 case 14941: // 'child' '#'
20324 case 14942: // 'collation' '#'
20325 case 14944: // 'comment' '#'
20326 case 14945: // 'constraint' '#'
20327 case 14946: // 'construction' '#'
20328 case 14949: // 'context' '#'
20329 case 14950: // 'continue' '#'
20330 case 14951: // 'copy' '#'
20331 case 14952: // 'copy-namespaces' '#'
20332 case 14953: // 'count' '#'
20333 case 14954: // 'decimal-format' '#'
20334 case 14956: // 'declare' '#'
20335 case 14957: // 'default' '#'
20336 case 14958: // 'delete' '#'
20337 case 14959: // 'descendant' '#'
20338 case 14960: // 'descendant-or-self' '#'
20339 case 14961: // 'descending' '#'
20340 case 14966: // 'div' '#'
20341 case 14967: // 'document' '#'
20342 case 14969: // 'element' '#'
20343 case 14970: // 'else' '#'
20344 case 14971: // 'empty' '#'
20345 case 14973: // 'encoding' '#'
20346 case 14974: // 'end' '#'
20347 case 14976: // 'eq' '#'
20348 case 14977: // 'every' '#'
20349 case 14979: // 'except' '#'
20350 case 14980: // 'exit' '#'
20351 case 14981: // 'external' '#'
20352 case 14982: // 'first' '#'
20353 case 14983: // 'following' '#'
20354 case 14984: // 'following-sibling' '#'
20355 case 14985: // 'for' '#'
20356 case 14989: // 'ft-option' '#'
20357 case 14994: // 'ge' '#'
20358 case 14996: // 'group' '#'
20359 case 14998: // 'gt' '#'
20360 case 14999: // 'idiv' '#'
20361 case 15001: // 'import' '#'
20362 case 15002: // 'in' '#'
20363 case 15003: // 'index' '#'
20364 case 15007: // 'insert' '#'
20365 case 15008: // 'instance' '#'
20366 case 15009: // 'integrity' '#'
20367 case 15010: // 'intersect' '#'
20368 case 15011: // 'into' '#'
20369 case 15012: // 'is' '#'
20370 case 15015: // 'json-item' '#'
20371 case 15018: // 'last' '#'
20372 case 15019: // 'lax' '#'
20373 case 15020: // 'le' '#'
20374 case 15022: // 'let' '#'
20375 case 15024: // 'loop' '#'
20376 case 15026: // 'lt' '#'
20377 case 15028: // 'mod' '#'
20378 case 15029: // 'modify' '#'
20379 case 15030: // 'module' '#'
20380 case 15032: // 'namespace' '#'
20381 case 15034: // 'ne' '#'
20382 case 15040: // 'nodes' '#'
20383 case 15042: // 'object' '#'
20384 case 15046: // 'only' '#'
20385 case 15047: // 'option' '#'
20386 case 15048: // 'or' '#'
20387 case 15049: // 'order' '#'
20388 case 15050: // 'ordered' '#'
20389 case 15051: // 'ordering' '#'
20390 case 15054: // 'parent' '#'
20391 case 15060: // 'preceding' '#'
20392 case 15061: // 'preceding-sibling' '#'
20393 case 15064: // 'processing-instruction' '#'
20394 case 15066: // 'rename' '#'
20395 case 15067: // 'replace' '#'
20396 case 15068: // 'return' '#'
20397 case 15069: // 'returning' '#'
20398 case 15070: // 'revalidation' '#'
20399 case 15072: // 'satisfies' '#'
20400 case 15073: // 'schema' '#'
20401 case 15076: // 'score' '#'
20402 case 15077: // 'self' '#'
20403 case 15082: // 'sliding' '#'
20404 case 15083: // 'some' '#'
20405 case 15084: // 'stable' '#'
20406 case 15085: // 'start' '#'
20407 case 15088: // 'strict' '#'
20408 case 15092: // 'text' '#'
20409 case 15096: // 'to' '#'
20410 case 15097: // 'treat' '#'
20411 case 15098: // 'try' '#'
20412 case 15099: // 'tumbling' '#'
20413 case 15100: // 'type' '#'
20414 case 15102: // 'union' '#'
20415 case 15104: // 'unordered' '#'
20416 case 15105: // 'updating' '#'
20417 case 15108: // 'validate' '#'
20418 case 15109: // 'value' '#'
20419 case 15110: // 'variable' '#'
20420 case 15111: // 'version' '#'
20421 case 15114: // 'where' '#'
20422 case 15115: // 'while' '#'
20423 case 15118: // 'with' '#'
20424 case 15122: // 'xquery' '#'
20425 parse_FunctionItemExpr();
20426 break;
20427 case -10:
20428 parse_BlockExpr();
20429 break;
20430 case -11:
20431 parse_ObjectConstructor();
20432 break;
20433 case 68: // '['
20434 parse_ArrayConstructor();
20435 break;
20436 case 278: // '{|'
20437 parse_JSONSimpleObjectUnion();
20438 break;
20439 default:
20440 parse_Constructor();
20441 }
20442 eventHandler.endNonterminal("PrimaryExpr", e0);
20443 }
20444
20445 function try_PrimaryExpr()
20446 {
20447 switch (l1)
20448 {
20449 case 184: // 'namespace'
20450 lookahead2W(254); // NCName^Token | S^WS | '#' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
20451 break;
20452 case 216: // 'processing-instruction'
20453 lookahead2W(252); // NCName^Token | S^WS | '#' | '(:' | 'after' | 'allowing' | 'ancestor' |
20454 break;
20455 case 276: // '{'
20456 lookahead2W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
20457 break;
20458 case 82: // 'attribute'
20459 case 121: // 'element'
20460 lookahead2W(257); // EQName^Token | S^WS | '#' | '(:' | 'after' | 'allowing' | 'ancestor' |
20461 break;
20462 case 96: // 'comment'
20463 case 244: // 'text'
20464 lookahead2W(93); // S^WS | '#' | '(:' | '{'
20465 break;
20466 case 119: // 'document'
20467 case 202: // 'ordered'
20468 case 256: // 'unordered'
20469 lookahead2W(139); // S^WS | '#' | '(' | '(:' | '{'
20470 break;
20471 case 6: // EQName^Token
20472 case 70: // 'after'
20473 case 72: // 'allowing'
20474 case 73: // 'ancestor'
20475 case 74: // 'ancestor-or-self'
20476 case 75: // 'and'
20477 case 78: // 'array'
20478 case 79: // 'as'
20479 case 80: // 'ascending'
20480 case 81: // 'at'
20481 case 83: // 'base-uri'
20482 case 84: // 'before'
20483 case 85: // 'boundary-space'
20484 case 86: // 'break'
20485 case 88: // 'case'
20486 case 89: // 'cast'
20487 case 90: // 'castable'
20488 case 91: // 'catch'
20489 case 93: // 'child'
20490 case 94: // 'collation'
20491 case 97: // 'constraint'
20492 case 98: // 'construction'
20493 case 101: // 'context'
20494 case 102: // 'continue'
20495 case 103: // 'copy'
20496 case 104: // 'copy-namespaces'
20497 case 105: // 'count'
20498 case 106: // 'decimal-format'
20499 case 108: // 'declare'
20500 case 109: // 'default'
20501 case 110: // 'delete'
20502 case 111: // 'descendant'
20503 case 112: // 'descendant-or-self'
20504 case 113: // 'descending'
20505 case 118: // 'div'
20506 case 122: // 'else'
20507 case 123: // 'empty'
20508 case 125: // 'encoding'
20509 case 126: // 'end'
20510 case 128: // 'eq'
20511 case 129: // 'every'
20512 case 131: // 'except'
20513 case 132: // 'exit'
20514 case 133: // 'external'
20515 case 134: // 'first'
20516 case 135: // 'following'
20517 case 136: // 'following-sibling'
20518 case 137: // 'for'
20519 case 141: // 'ft-option'
20520 case 146: // 'ge'
20521 case 148: // 'group'
20522 case 150: // 'gt'
20523 case 151: // 'idiv'
20524 case 153: // 'import'
20525 case 154: // 'in'
20526 case 155: // 'index'
20527 case 159: // 'insert'
20528 case 160: // 'instance'
20529 case 161: // 'integrity'
20530 case 162: // 'intersect'
20531 case 163: // 'into'
20532 case 164: // 'is'
20533 case 167: // 'json-item'
20534 case 170: // 'last'
20535 case 171: // 'lax'
20536 case 172: // 'le'
20537 case 174: // 'let'
20538 case 176: // 'loop'
20539 case 178: // 'lt'
20540 case 180: // 'mod'
20541 case 181: // 'modify'
20542 case 182: // 'module'
20543 case 186: // 'ne'
20544 case 192: // 'nodes'
20545 case 194: // 'object'
20546 case 198: // 'only'
20547 case 199: // 'option'
20548 case 200: // 'or'
20549 case 201: // 'order'
20550 case 203: // 'ordering'
20551 case 206: // 'parent'
20552 case 212: // 'preceding'
20553 case 213: // 'preceding-sibling'
20554 case 218: // 'rename'
20555 case 219: // 'replace'
20556 case 220: // 'return'
20557 case 221: // 'returning'
20558 case 222: // 'revalidation'
20559 case 224: // 'satisfies'
20560 case 225: // 'schema'
20561 case 228: // 'score'
20562 case 229: // 'self'
20563 case 234: // 'sliding'
20564 case 235: // 'some'
20565 case 236: // 'stable'
20566 case 237: // 'start'
20567 case 240: // 'strict'
20568 case 248: // 'to'
20569 case 249: // 'treat'
20570 case 250: // 'try'
20571 case 251: // 'tumbling'
20572 case 252: // 'type'
20573 case 254: // 'union'
20574 case 257: // 'updating'
20575 case 260: // 'validate'
20576 case 261: // 'value'
20577 case 262: // 'variable'
20578 case 263: // 'version'
20579 case 266: // 'where'
20580 case 267: // 'while'
20581 case 270: // 'with'
20582 case 274: // 'xquery'
20583 lookahead2W(92); // S^WS | '#' | '(' | '(:'
20584 break;
20585 default:
20586 lk = l1;
20587 }
20588 if (lk == 2836 // '{' Wildcard
20589 || lk == 3348 // '{' EQName^Token
20590 || lk == 4372 // '{' IntegerLiteral
20591 || lk == 4884 // '{' DecimalLiteral
20592 || lk == 5396 // '{' DoubleLiteral
20593 || lk == 5908 // '{' StringLiteral
20594 || lk == 16148 // '{' '$'
20595 || lk == 16660 // '{' '%'
20596 || lk == 17684 // '{' '('
20597 || lk == 18196 // '{' '(#'
20598 || lk == 20756 // '{' '+'
20599 || lk == 21780 // '{' '-'
20600 || lk == 22804 // '{' '.'
20601 || lk == 23316 // '{' '..'
20602 || lk == 23828 // '{' '/'
20603 || lk == 24340 // '{' '//'
20604 || lk == 27924 // '{' '<'
20605 || lk == 28436 // '{' '<!--'
20606 || lk == 30484 // '{' '<?'
20607 || lk == 34068 // '{' '@'
20608 || lk == 35092 // '{' '['
20609 || lk == 36116 // '{' 'after'
20610 || lk == 37140 // '{' 'allowing'
20611 || lk == 37652 // '{' 'ancestor'
20612 || lk == 38164 // '{' 'ancestor-or-self'
20613 || lk == 38676 // '{' 'and'
20614 || lk == 39700 // '{' 'append'
20615 || lk == 40212 // '{' 'array'
20616 || lk == 40724 // '{' 'as'
20617 || lk == 41236 // '{' 'ascending'
20618 || lk == 41748 // '{' 'at'
20619 || lk == 42260 // '{' 'attribute'
20620 || lk == 42772 // '{' 'base-uri'
20621 || lk == 43284 // '{' 'before'
20622 || lk == 43796 // '{' 'boundary-space'
20623 || lk == 44308 // '{' 'break'
20624 || lk == 45332 // '{' 'case'
20625 || lk == 45844 // '{' 'cast'
20626 || lk == 46356 // '{' 'castable'
20627 || lk == 46868 // '{' 'catch'
20628 || lk == 47892 // '{' 'child'
20629 || lk == 48404 // '{' 'collation'
20630 || lk == 49428 // '{' 'comment'
20631 || lk == 49940 // '{' 'constraint'
20632 || lk == 50452 // '{' 'construction'
20633 || lk == 51988 // '{' 'context'
20634 || lk == 52500 // '{' 'continue'
20635 || lk == 53012 // '{' 'copy'
20636 || lk == 53524 // '{' 'copy-namespaces'
20637 || lk == 54036 // '{' 'count'
20638 || lk == 54548 // '{' 'decimal-format'
20639 || lk == 55572 // '{' 'declare'
20640 || lk == 56084 // '{' 'default'
20641 || lk == 56596 // '{' 'delete'
20642 || lk == 57108 // '{' 'descendant'
20643 || lk == 57620 // '{' 'descendant-or-self'
20644 || lk == 58132 // '{' 'descending'
20645 || lk == 60692 // '{' 'div'
20646 || lk == 61204 // '{' 'document'
20647 || lk == 61716 // '{' 'document-node'
20648 || lk == 62228 // '{' 'element'
20649 || lk == 62740 // '{' 'else'
20650 || lk == 63252 // '{' 'empty'
20651 || lk == 63764 // '{' 'empty-sequence'
20652 || lk == 64276 // '{' 'encoding'
20653 || lk == 64788 // '{' 'end'
20654 || lk == 65812 // '{' 'eq'
20655 || lk == 66324 // '{' 'every'
20656 || lk == 67348 // '{' 'except'
20657 || lk == 67860 // '{' 'exit'
20658 || lk == 68372 // '{' 'external'
20659 || lk == 68884 // '{' 'first'
20660 || lk == 69396 // '{' 'following'
20661 || lk == 69908 // '{' 'following-sibling'
20662 || lk == 70420 // '{' 'for'
20663 || lk == 72468 // '{' 'ft-option'
20664 || lk == 74516 // '{' 'function'
20665 || lk == 75028 // '{' 'ge'
20666 || lk == 76052 // '{' 'group'
20667 || lk == 77076 // '{' 'gt'
20668 || lk == 77588 // '{' 'idiv'
20669 || lk == 78100 // '{' 'if'
20670 || lk == 78612 // '{' 'import'
20671 || lk == 79124 // '{' 'in'
20672 || lk == 79636 // '{' 'index'
20673 || lk == 81684 // '{' 'insert'
20674 || lk == 82196 // '{' 'instance'
20675 || lk == 82708 // '{' 'integrity'
20676 || lk == 83220 // '{' 'intersect'
20677 || lk == 83732 // '{' 'into'
20678 || lk == 84244 // '{' 'is'
20679 || lk == 84756 // '{' 'item'
20680 || lk == 85780 // '{' 'json-item'
20681 || lk == 87316 // '{' 'last'
20682 || lk == 87828 // '{' 'lax'
20683 || lk == 88340 // '{' 'le'
20684 || lk == 89364 // '{' 'let'
20685 || lk == 90388 // '{' 'loop'
20686 || lk == 91412 // '{' 'lt'
20687 || lk == 92436 // '{' 'mod'
20688 || lk == 92948 // '{' 'modify'
20689 || lk == 93460 // '{' 'module'
20690 || lk == 94484 // '{' 'namespace'
20691 || lk == 94996 // '{' 'namespace-node'
20692 || lk == 95508 // '{' 'ne'
20693 || lk == 98068 // '{' 'node'
20694 || lk == 98580 // '{' 'nodes'
20695 || lk == 99604 // '{' 'object'
20696 || lk == 101652 // '{' 'only'
20697 || lk == 102164 // '{' 'option'
20698 || lk == 102676 // '{' 'or'
20699 || lk == 103188 // '{' 'order'
20700 || lk == 103700 // '{' 'ordered'
20701 || lk == 104212 // '{' 'ordering'
20702 || lk == 105748 // '{' 'parent'
20703 || lk == 108820 // '{' 'preceding'
20704 || lk == 109332 // '{' 'preceding-sibling'
20705 || lk == 110868 // '{' 'processing-instruction'
20706 || lk == 111892 // '{' 'rename'
20707 || lk == 112404 // '{' 'replace'
20708 || lk == 112916 // '{' 'return'
20709 || lk == 113428 // '{' 'returning'
20710 || lk == 113940 // '{' 'revalidation'
20711 || lk == 114964 // '{' 'satisfies'
20712 || lk == 115476 // '{' 'schema'
20713 || lk == 115988 // '{' 'schema-attribute'
20714 || lk == 116500 // '{' 'schema-element'
20715 || lk == 117012 // '{' 'score'
20716 || lk == 117524 // '{' 'self'
20717 || lk == 120084 // '{' 'sliding'
20718 || lk == 120596 // '{' 'some'
20719 || lk == 121108 // '{' 'stable'
20720 || lk == 121620 // '{' 'start'
20721 || lk == 123156 // '{' 'strict'
20722 || lk == 124692 // '{' 'switch'
20723 || lk == 125204 // '{' 'text'
20724 || lk == 127252 // '{' 'to'
20725 || lk == 127764 // '{' 'treat'
20726 || lk == 128276 // '{' 'try'
20727 || lk == 128788 // '{' 'tumbling'
20728 || lk == 129300 // '{' 'type'
20729 || lk == 129812 // '{' 'typeswitch'
20730 || lk == 130324 // '{' 'union'
20731 || lk == 131348 // '{' 'unordered'
20732 || lk == 131860 // '{' 'updating'
20733 || lk == 133396 // '{' 'validate'
20734 || lk == 133908 // '{' 'value'
20735 || lk == 134420 // '{' 'variable'
20736 || lk == 134932 // '{' 'version'
20737 || lk == 136468 // '{' 'where'
20738 || lk == 136980 // '{' 'while'
20739 || lk == 138516 // '{' 'with'
20740 || lk == 140564 // '{' 'xquery'
20741 || lk == 141588 // '{' '{'
20742 || lk == 142612 // '{' '{|'
20743 || lk == 144660) // '{' '}'
20744 {
20745 lk = memoized(12, e0);
20746 if (lk == 0)
20747 {
20748 var b0A = b0; var e0A = e0; var l1A = l1;
20749 var b1A = b1; var e1A = e1; var l2A = l2;
20750 var b2A = b2; var e2A = e2;
20751 try
20752 {
20753 try_BlockExpr();
20754 memoize(12, e0A, -10);
20755 lk = -14;
20756 }
20757 catch (p10A)
20758 {
20759 lk = -11;
20760 b0 = b0A; e0 = e0A; l1 = l1A; if (l1 == 0) {end = e0A;} else {
20761 b1 = b1A; e1 = e1A; l2 = l2A; if (l2 == 0) {end = e1A;} else {
20762 b2 = b2A; e2 = e2A; end = e2A; }}
20763 memoize(12, e0A, -11);
20764 }
20765 }
20766 }
20767 switch (lk)
20768 {
20769 case 8: // IntegerLiteral
20770 case 9: // DecimalLiteral
20771 case 10: // DoubleLiteral
20772 case 11: // StringLiteral
20773 try_Literal();
20774 break;
20775 case 31: // '$'
20776 try_VarRef();
20777 break;
20778 case 34: // '('
20779 try_ParenthesizedExpr();
20780 break;
20781 case 44: // '.'
20782 try_ContextItemExpr();
20783 break;
20784 case 17414: // EQName^Token '('
20785 case 17478: // 'after' '('
20786 case 17480: // 'allowing' '('
20787 case 17481: // 'ancestor' '('
20788 case 17482: // 'ancestor-or-self' '('
20789 case 17483: // 'and' '('
20790 case 17486: // 'array' '('
20791 case 17487: // 'as' '('
20792 case 17488: // 'ascending' '('
20793 case 17489: // 'at' '('
20794 case 17491: // 'base-uri' '('
20795 case 17492: // 'before' '('
20796 case 17493: // 'boundary-space' '('
20797 case 17494: // 'break' '('
20798 case 17496: // 'case' '('
20799 case 17497: // 'cast' '('
20800 case 17498: // 'castable' '('
20801 case 17499: // 'catch' '('
20802 case 17501: // 'child' '('
20803 case 17502: // 'collation' '('
20804 case 17505: // 'constraint' '('
20805 case 17506: // 'construction' '('
20806 case 17509: // 'context' '('
20807 case 17510: // 'continue' '('
20808 case 17511: // 'copy' '('
20809 case 17512: // 'copy-namespaces' '('
20810 case 17513: // 'count' '('
20811 case 17514: // 'decimal-format' '('
20812 case 17516: // 'declare' '('
20813 case 17517: // 'default' '('
20814 case 17518: // 'delete' '('
20815 case 17519: // 'descendant' '('
20816 case 17520: // 'descendant-or-self' '('
20817 case 17521: // 'descending' '('
20818 case 17526: // 'div' '('
20819 case 17527: // 'document' '('
20820 case 17530: // 'else' '('
20821 case 17531: // 'empty' '('
20822 case 17533: // 'encoding' '('
20823 case 17534: // 'end' '('
20824 case 17536: // 'eq' '('
20825 case 17537: // 'every' '('
20826 case 17539: // 'except' '('
20827 case 17540: // 'exit' '('
20828 case 17541: // 'external' '('
20829 case 17542: // 'first' '('
20830 case 17543: // 'following' '('
20831 case 17544: // 'following-sibling' '('
20832 case 17545: // 'for' '('
20833 case 17549: // 'ft-option' '('
20834 case 17554: // 'ge' '('
20835 case 17556: // 'group' '('
20836 case 17558: // 'gt' '('
20837 case 17559: // 'idiv' '('
20838 case 17561: // 'import' '('
20839 case 17562: // 'in' '('
20840 case 17563: // 'index' '('
20841 case 17567: // 'insert' '('
20842 case 17568: // 'instance' '('
20843 case 17569: // 'integrity' '('
20844 case 17570: // 'intersect' '('
20845 case 17571: // 'into' '('
20846 case 17572: // 'is' '('
20847 case 17575: // 'json-item' '('
20848 case 17578: // 'last' '('
20849 case 17579: // 'lax' '('
20850 case 17580: // 'le' '('
20851 case 17582: // 'let' '('
20852 case 17584: // 'loop' '('
20853 case 17586: // 'lt' '('
20854 case 17588: // 'mod' '('
20855 case 17589: // 'modify' '('
20856 case 17590: // 'module' '('
20857 case 17592: // 'namespace' '('
20858 case 17594: // 'ne' '('
20859 case 17600: // 'nodes' '('
20860 case 17602: // 'object' '('
20861 case 17606: // 'only' '('
20862 case 17607: // 'option' '('
20863 case 17608: // 'or' '('
20864 case 17609: // 'order' '('
20865 case 17610: // 'ordered' '('
20866 case 17611: // 'ordering' '('
20867 case 17614: // 'parent' '('
20868 case 17620: // 'preceding' '('
20869 case 17621: // 'preceding-sibling' '('
20870 case 17626: // 'rename' '('
20871 case 17627: // 'replace' '('
20872 case 17628: // 'return' '('
20873 case 17629: // 'returning' '('
20874 case 17630: // 'revalidation' '('
20875 case 17632: // 'satisfies' '('
20876 case 17633: // 'schema' '('
20877 case 17636: // 'score' '('
20878 case 17637: // 'self' '('
20879 case 17642: // 'sliding' '('
20880 case 17643: // 'some' '('
20881 case 17644: // 'stable' '('
20882 case 17645: // 'start' '('
20883 case 17648: // 'strict' '('
20884 case 17656: // 'to' '('
20885 case 17657: // 'treat' '('
20886 case 17658: // 'try' '('
20887 case 17659: // 'tumbling' '('
20888 case 17660: // 'type' '('
20889 case 17662: // 'union' '('
20890 case 17664: // 'unordered' '('
20891 case 17665: // 'updating' '('
20892 case 17668: // 'validate' '('
20893 case 17669: // 'value' '('
20894 case 17670: // 'variable' '('
20895 case 17671: // 'version' '('
20896 case 17674: // 'where' '('
20897 case 17675: // 'while' '('
20898 case 17678: // 'with' '('
20899 case 17682: // 'xquery' '('
20900 try_FunctionCall();
20901 break;
20902 case 141514: // 'ordered' '{'
20903 try_OrderedExpr();
20904 break;
20905 case 141568: // 'unordered' '{'
20906 try_UnorderedExpr();
20907 break;
20908 case 32: // '%'
20909 case 120: // 'document-node'
20910 case 124: // 'empty-sequence'
20911 case 145: // 'function'
20912 case 152: // 'if'
20913 case 165: // 'item'
20914 case 185: // 'namespace-node'
20915 case 191: // 'node'
20916 case 226: // 'schema-attribute'
20917 case 227: // 'schema-element'
20918 case 243: // 'switch'
20919 case 253: // 'typeswitch'
20920 case 14854: // EQName^Token '#'
20921 case 14918: // 'after' '#'
20922 case 14920: // 'allowing' '#'
20923 case 14921: // 'ancestor' '#'
20924 case 14922: // 'ancestor-or-self' '#'
20925 case 14923: // 'and' '#'
20926 case 14926: // 'array' '#'
20927 case 14927: // 'as' '#'
20928 case 14928: // 'ascending' '#'
20929 case 14929: // 'at' '#'
20930 case 14930: // 'attribute' '#'
20931 case 14931: // 'base-uri' '#'
20932 case 14932: // 'before' '#'
20933 case 14933: // 'boundary-space' '#'
20934 case 14934: // 'break' '#'
20935 case 14936: // 'case' '#'
20936 case 14937: // 'cast' '#'
20937 case 14938: // 'castable' '#'
20938 case 14939: // 'catch' '#'
20939 case 14941: // 'child' '#'
20940 case 14942: // 'collation' '#'
20941 case 14944: // 'comment' '#'
20942 case 14945: // 'constraint' '#'
20943 case 14946: // 'construction' '#'
20944 case 14949: // 'context' '#'
20945 case 14950: // 'continue' '#'
20946 case 14951: // 'copy' '#'
20947 case 14952: // 'copy-namespaces' '#'
20948 case 14953: // 'count' '#'
20949 case 14954: // 'decimal-format' '#'
20950 case 14956: // 'declare' '#'
20951 case 14957: // 'default' '#'
20952 case 14958: // 'delete' '#'
20953 case 14959: // 'descendant' '#'
20954 case 14960: // 'descendant-or-self' '#'
20955 case 14961: // 'descending' '#'
20956 case 14966: // 'div' '#'
20957 case 14967: // 'document' '#'
20958 case 14969: // 'element' '#'
20959 case 14970: // 'else' '#'
20960 case 14971: // 'empty' '#'
20961 case 14973: // 'encoding' '#'
20962 case 14974: // 'end' '#'
20963 case 14976: // 'eq' '#'
20964 case 14977: // 'every' '#'
20965 case 14979: // 'except' '#'
20966 case 14980: // 'exit' '#'
20967 case 14981: // 'external' '#'
20968 case 14982: // 'first' '#'
20969 case 14983: // 'following' '#'
20970 case 14984: // 'following-sibling' '#'
20971 case 14985: // 'for' '#'
20972 case 14989: // 'ft-option' '#'
20973 case 14994: // 'ge' '#'
20974 case 14996: // 'group' '#'
20975 case 14998: // 'gt' '#'
20976 case 14999: // 'idiv' '#'
20977 case 15001: // 'import' '#'
20978 case 15002: // 'in' '#'
20979 case 15003: // 'index' '#'
20980 case 15007: // 'insert' '#'
20981 case 15008: // 'instance' '#'
20982 case 15009: // 'integrity' '#'
20983 case 15010: // 'intersect' '#'
20984 case 15011: // 'into' '#'
20985 case 15012: // 'is' '#'
20986 case 15015: // 'json-item' '#'
20987 case 15018: // 'last' '#'
20988 case 15019: // 'lax' '#'
20989 case 15020: // 'le' '#'
20990 case 15022: // 'let' '#'
20991 case 15024: // 'loop' '#'
20992 case 15026: // 'lt' '#'
20993 case 15028: // 'mod' '#'
20994 case 15029: // 'modify' '#'
20995 case 15030: // 'module' '#'
20996 case 15032: // 'namespace' '#'
20997 case 15034: // 'ne' '#'
20998 case 15040: // 'nodes' '#'
20999 case 15042: // 'object' '#'
21000 case 15046: // 'only' '#'
21001 case 15047: // 'option' '#'
21002 case 15048: // 'or' '#'
21003 case 15049: // 'order' '#'
21004 case 15050: // 'ordered' '#'
21005 case 15051: // 'ordering' '#'
21006 case 15054: // 'parent' '#'
21007 case 15060: // 'preceding' '#'
21008 case 15061: // 'preceding-sibling' '#'
21009 case 15064: // 'processing-instruction' '#'
21010 case 15066: // 'rename' '#'
21011 case 15067: // 'replace' '#'
21012 case 15068: // 'return' '#'
21013 case 15069: // 'returning' '#'
21014 case 15070: // 'revalidation' '#'
21015 case 15072: // 'satisfies' '#'
21016 case 15073: // 'schema' '#'
21017 case 15076: // 'score' '#'
21018 case 15077: // 'self' '#'
21019 case 15082: // 'sliding' '#'
21020 case 15083: // 'some' '#'
21021 case 15084: // 'stable' '#'
21022 case 15085: // 'start' '#'
21023 case 15088: // 'strict' '#'
21024 case 15092: // 'text' '#'
21025 case 15096: // 'to' '#'
21026 case 15097: // 'treat' '#'
21027 case 15098: // 'try' '#'
21028 case 15099: // 'tumbling' '#'
21029 case 15100: // 'type' '#'
21030 case 15102: // 'union' '#'
21031 case 15104: // 'unordered' '#'
21032 case 15105: // 'updating' '#'
21033 case 15108: // 'validate' '#'
21034 case 15109: // 'value' '#'
21035 case 15110: // 'variable' '#'
21036 case 15111: // 'version' '#'
21037 case 15114: // 'where' '#'
21038 case 15115: // 'while' '#'
21039 case 15118: // 'with' '#'
21040 case 15122: // 'xquery' '#'
21041 try_FunctionItemExpr();
21042 break;
21043 case -10:
21044 try_BlockExpr();
21045 break;
21046 case -11:
21047 try_ObjectConstructor();
21048 break;
21049 case 68: // '['
21050 try_ArrayConstructor();
21051 break;
21052 case 278: // '{|'
21053 try_JSONSimpleObjectUnion();
21054 break;
21055 case -14:
21056 break;
21057 default:
21058 try_Constructor();
21059 }
21060 }
21061
21062 function parse_JSONSimpleObjectUnion()
21063 {
21064 eventHandler.startNonterminal("JSONSimpleObjectUnion", e0);
21065 shift(278); // '{|'
21066 lookahead1W(272); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21067 if (l1 != 281) // '|}'
21068 {
21069 whitespace();
21070 parse_Expr();
21071 }
21072 shift(281); // '|}'
21073 eventHandler.endNonterminal("JSONSimpleObjectUnion", e0);
21074 }
21075
21076 function try_JSONSimpleObjectUnion()
21077 {
21078 shiftT(278); // '{|'
21079 lookahead1W(272); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21080 if (l1 != 281) // '|}'
21081 {
21082 try_Expr();
21083 }
21084 shiftT(281); // '|}'
21085 }
21086
21087 function parse_ObjectConstructor()
21088 {
21089 eventHandler.startNonterminal("ObjectConstructor", e0);
21090 shift(276); // '{'
21091 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21092 if (l1 != 282) // '}'
21093 {
21094 whitespace();
21095 parse_PairConstructor();
21096 for (;;)
21097 {
21098 if (l1 != 41) // ','
21099 {
21100 break;
21101 }
21102 shift(41); // ','
21103 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21104 whitespace();
21105 parse_PairConstructor();
21106 }
21107 }
21108 shift(282); // '}'
21109 eventHandler.endNonterminal("ObjectConstructor", e0);
21110 }
21111
21112 function try_ObjectConstructor()
21113 {
21114 shiftT(276); // '{'
21115 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21116 if (l1 != 282) // '}'
21117 {
21118 try_PairConstructor();
21119 for (;;)
21120 {
21121 if (l1 != 41) // ','
21122 {
21123 break;
21124 }
21125 shiftT(41); // ','
21126 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21127 try_PairConstructor();
21128 }
21129 }
21130 shiftT(282); // '}'
21131 }
21132
21133 function parse_PairConstructor()
21134 {
21135 eventHandler.startNonterminal("PairConstructor", e0);
21136 parse_ExprSingle();
21137 shift(49); // ':'
21138 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21139 whitespace();
21140 parse_ExprSingle();
21141 eventHandler.endNonterminal("PairConstructor", e0);
21142 }
21143
21144 function try_PairConstructor()
21145 {
21146 try_ExprSingle();
21147 shiftT(49); // ':'
21148 lookahead1W(267); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21149 try_ExprSingle();
21150 }
21151
21152 function parse_ArrayConstructor()
21153 {
21154 eventHandler.startNonterminal("ArrayConstructor", e0);
21155 shift(68); // '['
21156 lookahead1W(271); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21157 if (l1 != 69) // ']'
21158 {
21159 whitespace();
21160 parse_Expr();
21161 }
21162 shift(69); // ']'
21163 eventHandler.endNonterminal("ArrayConstructor", e0);
21164 }
21165
21166 function try_ArrayConstructor()
21167 {
21168 shiftT(68); // '['
21169 lookahead1W(271); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21170 if (l1 != 69) // ']'
21171 {
21172 try_Expr();
21173 }
21174 shiftT(69); // ']'
21175 }
21176
21177 function parse_BlockExpr()
21178 {
21179 eventHandler.startNonterminal("BlockExpr", e0);
21180 shift(276); // '{'
21181 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21182 whitespace();
21183 parse_StatementsAndOptionalExpr();
21184 shift(282); // '}'
21185 eventHandler.endNonterminal("BlockExpr", e0);
21186 }
21187
21188 function try_BlockExpr()
21189 {
21190 shiftT(276); // '{'
21191 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21192 try_StatementsAndOptionalExpr();
21193 shiftT(282); // '}'
21194 }
21195
21196 function parse_FunctionDecl()
21197 {
21198 eventHandler.startNonterminal("FunctionDecl", e0);
21199 shift(145); // 'function'
21200 lookahead1W(253); // EQName^Token | S^WS | '(:' | 'after' | 'allowing' | 'ancestor' |
21201 whitespace();
21202 parse_EQName();
21203 lookahead1W(22); // S^WS | '(' | '(:'
21204 shift(34); // '('
21205 lookahead1W(94); // S^WS | '$' | '(:' | ')'
21206 if (l1 == 31) // '$'
21207 {
21208 whitespace();
21209 parse_ParamList();
21210 }
21211 shift(37); // ')'
21212 lookahead1W(148); // S^WS | '(:' | 'as' | 'external' | '{'
21213 if (l1 == 79) // 'as'
21214 {
21215 shift(79); // 'as'
21216 lookahead1W(259); // EQName^Token | S^WS | '%' | '(' | '(:' | 'after' | 'allowing' | 'ancestor' |
21217 whitespace();
21218 parse_SequenceType();
21219 }
21220 lookahead1W(118); // S^WS | '(:' | 'external' | '{'
21221 switch (l1)
21222 {
21223 case 276: // '{'
21224 shift(276); // '{'
21225 lookahead1W(273); // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
21226 whitespace();
21227 parse_StatementsAndOptionalExpr();
21228 shift(282); // '}'
21229 break;
21230 default:
21231 shift(133); // 'external'
21232 }
21233 eventHandler.endNonterminal("FunctionDecl", e0);
21234 }
21235
21236 var lk, b0, e0;
21237 var l1, b1, e1;
21238 var l2, b2, e2;
21239 var bx, ex, sx, lx, tx;
21240 var eventHandler;
21241 var memo;
21242
21243 function memoize(i, e, v)
21244 {
21245 memo[(e << 4) + i] = v;
21246 }
21247
21248 function memoized(i, e)
21249 {
21250 var v = memo[(e << 4) + i];
21251 return typeof v != "undefined" ? v : 0;
21252 }
21253
21254 function error(b, e, s, l, t)
21255 {
21256 if (e > ex)
21257 {
21258 bx = b;
21259 ex = e;
21260 sx = s;
21261 lx = l;
21262 tx = t;
21263 }
21264 throw new self.ParseException(bx, ex, sx, lx, tx);
21265 }
21266
21267 function shift(t)
21268 {
21269 if (l1 == t)
21270 {
21271 whitespace();
21272 eventHandler.terminal(XQueryParser.TOKEN[l1], b1, e1 > size ? size : e1);
21273 b0 = b1; e0 = e1; l1 = l2; if (l1 != 0) {
21274 b1 = b2; e1 = e2; l2 = 0; }
21275 }
21276 else
21277 {
21278 error(b1, e1, 0, l1, t);
21279 }
21280 }
21281
21282 function shiftT(t)
21283 {
21284 if (l1 == t)
21285 {
21286 b0 = b1; e0 = e1; l1 = l2; if (l1 != 0) {
21287 b1 = b2; e1 = e2; l2 = 0; }
21288 }
21289 else
21290 {
21291 error(b1, e1, 0, l1, t);
21292 }
21293 }
21294
21295 function skip(code)
21296 {
21297 var b0W = b0; var e0W = e0; var l1W = l1;
21298 var b1W = b1; var e1W = e1;
21299
21300 l1 = code; b1 = begin; e1 = end;
21301 l2 = 0;
21302
21303 try_Whitespace();
21304
21305 b0 = b0W; e0 = e0W; l1 = l1W; if (l1 != 0) {
21306 b1 = b1W; e1 = e1W; }
21307 }
21308
21309 function whitespace()
21310 {
21311 if (e0 != b1)
21312 {
21313 b0 = e0;
21314 e0 = b1;
21315 eventHandler.whitespace(b0, e0);
21316 }
21317 }
21318
21319 function matchW(set)
21320 {
21321 var code;
21322 for (;;)
21323 {
21324 code = match(set);
21325 if (code != 22) // S^WS
21326 {
21327 if (code != 36) // '(:'
21328 {
21329 break;
21330 }
21331 skip(code);
21332 }
21333 }
21334 return code;
21335 }
21336
21337 function lookahead1W(set)
21338 {
21339 if (l1 == 0)
21340 {
21341 l1 = matchW(set);
21342 b1 = begin;
21343 e1 = end;
21344 }
21345 }
21346
21347 function lookahead2W(set)
21348 {
21349 if (l2 == 0)
21350 {
21351 l2 = matchW(set);
21352 b2 = begin;
21353 e2 = end;
21354 }
21355 lk = (l2 << 9) | l1;
21356 }
21357
21358 function lookahead1(set)
21359 {
21360 if (l1 == 0)
21361 {
21362 l1 = match(set);
21363 b1 = begin;
21364 e1 = end;
21365 }
21366 }
21367
21368 function lookahead2(set)
21369 {
21370 if (l2 == 0)
21371 {
21372 l2 = match(set);
21373 b2 = begin;
21374 e2 = end;
21375 }
21376 lk = (l2 << 9) | l1;
21377 }
21378
21379 var input;
21380 var size;
21381 var begin;
21382 var end;
21383
21384 function match(tokenSetId)
21385 {
21386 var nonbmp = false;
21387 begin = end;
21388 var current = end;
21389 var result = XQueryParser.INITIAL[tokenSetId];
21390 var state = 0;
21391
21392 for (var code = result & 4095; code != 0; )
21393 {
21394 var charclass;
21395 var c0 = current < size ? input.charCodeAt(current) : 0;
21396 ++current;
21397 if (c0 < 0x80)
21398 {
21399 charclass = XQueryParser.MAP0[c0];
21400 }
21401 else if (c0 < 0xd800)
21402 {
21403 var c1 = c0 >> 4;
21404 charclass = XQueryParser.MAP1[(c0 & 15) + XQueryParser.MAP1[(c1 & 31) + XQueryParser.MAP1[c1 >> 5]]];
21405 }
21406 else
21407 {
21408 if (c0 < 0xdc00)
21409 {
21410 var c1 = current < size ? input.charCodeAt(current) : 0;
21411 if (c1 >= 0xdc00 && c1 < 0xe000)
21412 {
21413 ++current;
21414 c0 = ((c0 & 0x3ff) << 10) + (c1 & 0x3ff) + 0x10000;
21415 nonbmp = true;
21416 }
21417 }
21418 var lo = 0, hi = 5;
21419 for (var m = 3; ; m = (hi + lo) >> 1)
21420 {
21421 if (XQueryParser.MAP2[m] > c0) hi = m - 1;
21422 else if (XQueryParser.MAP2[6 + m] < c0) lo = m + 1;
21423 else {charclass = XQueryParser.MAP2[12 + m]; break;}
21424 if (lo > hi) {charclass = 0; break;}
21425 }
21426 }
21427
21428 state = code;
21429 var i0 = (charclass << 12) + code - 1;
21430 code = XQueryParser.TRANSITION[(i0 & 15) + XQueryParser.TRANSITION[i0 >> 4]];
21431
21432 if (code > 4095)
21433 {
21434 result = code;
21435 code &= 4095;
21436 end = current;
21437 }
21438 }
21439
21440 result >>= 12;
21441 if (result == 0)
21442 {
21443 end = current - 1;
21444 var c1 = end < size ? input.charCodeAt(end) : 0;
21445 if (c1 >= 0xdc00 && c1 < 0xe000) --end;
21446 return error(begin, end, state, -1, -1);
21447 }
21448
21449 if (nonbmp)
21450 {
21451 for (var i = result >> 9; i > 0; --i)
21452 {
21453 --end;
21454 var c1 = end < size ? input.charCodeAt(end) : 0;
21455 if (c1 >= 0xdc00 && c1 < 0xe000) --end;
21456 }
21457 }
21458 else
21459 {
21460 end -= result >> 9;
21461 }
21462
21463 return (result & 511) - 1;
21464 }
21465 }
21466
21467 XQueryParser.getTokenSet = function(tokenSetId)
21468 {
21469 var set = [];
21470 var s = tokenSetId < 0 ? - tokenSetId : INITIAL[tokenSetId] & 4095;
21471 for (var i = 0; i < 284; i += 32)
21472 {
21473 var j = i;
21474 var i0 = (i >> 5) * 3684 + s - 1;
21475 var i1 = i0 >> 2;
21476 var i2 = i1 >> 2;
21477 var f = XQueryParser.EXPECTED[(i0 & 3) + XQueryParser.EXPECTED[(i1 & 3) + XQueryParser.EXPECTED[(i2 & 7) + XQueryParser.EXPECTED[i2 >> 3]]]];
21478 for ( ; f != 0; f >>>= 1, ++j)
21479 {
21480 if ((f & 1) != 0)
21481 {
21482 set.push(XQueryParser.TOKEN[j]);
21483 }
21484 }
21485 }
21486 return set;
21487 };
21488
21489 XQueryParser.MAP0 =
21490 [ 70, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 26, 30, 30, 30, 30, 30, 31, 32, 33, 30, 30, 34, 30, 30, 35, 30, 30, 30, 36, 30, 30, 37, 38, 39, 38, 30, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 38, 38
21491 ];
21492
21493 XQueryParser.MAP1 =
21494 [ 108, 124, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 156, 181, 181, 181, 181, 181, 214, 215, 213, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 247, 261, 277, 293, 309, 355, 371, 387, 423, 423, 423, 415, 339, 331, 339, 331, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 440, 440, 440, 440, 440, 440, 440, 324, 339, 339, 339, 339, 339, 339, 339, 339, 401, 423, 423, 424, 422, 423, 423, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, 338, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 423, 70, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 26, 30, 30, 30, 30, 30, 31, 32, 33, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 38, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 34, 30, 30, 35, 30, 30, 30, 36, 30, 30, 37, 38, 39, 38, 30, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 30, 30, 38, 38, 38, 38, 38, 38, 38, 69, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69
21495 ];
21496
21497 XQueryParser.MAP2 =
21498 [ 57344, 63744, 64976, 65008, 65536, 983040, 63743, 64975, 65007, 65533, 983039, 1114111, 38, 30, 38, 30, 30, 38
21499 ];
21500
21501 XQueryParser.INITIAL =
21502 [ 1, 12290, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284
21503 ];
21504
21505 XQueryParser.TRANSITION =
21506 [ 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22007, 18176, 18196, 18196, 18196, 18203, 18196, 18196, 18196, 18196, 18230, 18196, 18196, 18196, 18196, 18219, 18196, 18180, 18246, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23546, 21369, 18411, 20907, 20920, 20932, 20944, 22539, 18416, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 37625, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 21008, 21032, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21632, 21055, 23546, 23546, 23546, 21178, 23546, 23546, 23916, 42362, 21241, 23546, 23546, 23546, 23546, 19298, 47203, 21077, 21110, 23546, 23546, 23546, 35799, 23546, 23546, 21194, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 21229, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21358, 21323, 23546, 23546, 23546, 26152, 23546, 23546, 27593, 23546, 21369, 29482, 21257, 21282, 21273, 21304, 21317, 21346, 20967, 23546, 23546, 23546, 28947, 23546, 23546, 21385, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 20711, 21423, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 21446, 26048, 18745, 18766, 18771, 20561, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23540, 23546, 23546, 23546, 25880, 23545, 23546, 31245, 23546, 21468, 23534, 21504, 23546, 21511, 23546, 21527, 21539, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 21567, 23546, 23546, 23546, 31874, 23546, 23546, 21586, 23546, 23546, 21608, 21620, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23546, 35211, 23546, 23546, 23546, 23546, 23546, 23546, 23424, 21648, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 21681, 18544, 18567, 18590, 50977, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21736, 21705, 23546, 23546, 23546, 44539, 23546, 23546, 24265, 25689, 25607, 23546, 23546, 23546, 23546, 26450, 47502, 21724, 21752, 23546, 23546, 23546, 35799, 23546, 23546, 21783, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 20237, 21819, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21551, 21857, 21913, 21913, 21913, 21864, 21908, 21913, 21918, 21967, 21842, 21949, 21880, 21961, 21896, 21934, 21983, 21995, 20967, 23546, 23546, 23546, 26225, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 22023, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 28636, 23546, 23546, 23546, 25912, 50946, 23546, 50080, 50952, 21369, 28635, 23546, 22054, 22060, 22076, 22111, 22121, 22137, 23546, 23546, 23546, 30755, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 22183, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 27655, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 51066, 39748, 22869, 22242, 22228, 22245, 22261, 22277, 22288, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 20285, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 18648, 40763, 24585, 22304, 22324, 22304, 22338, 24585, 22308, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 22361, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 22386, 23546, 23546, 23546, 25841, 18403, 23546, 19576, 22382, 44281, 22402, 22429, 22434, 22434, 22450, 22385, 22413, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22473, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23546, 21369, 25653, 22498, 22518, 22498, 22532, 25653, 22502, 22555, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27132, 23546, 42897, 23546, 44844, 38626, 22584, 22361, 37471, 23546, 23546, 23546, 23546, 22587, 47563, 46856, 47563, 47563, 22603, 35356, 22824, 22824, 34828, 22804, 22621, 22804, 22804, 33187, 36943, 23546, 23546, 23546, 23546, 23546, 26071, 23546, 22641, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 43701, 32739, 23546, 23546, 23546, 23546, 23546, 29474, 22702, 23546, 33124, 44563, 47563, 47563, 47563, 47564, 22719, 35350, 22824, 22764, 22824, 22767, 35689, 22783, 22804, 22803, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 27587, 23546, 23546, 47562, 46826, 47563, 47563, 27195, 22821, 42846, 22824, 22824, 22824, 30376, 22804, 22841, 22804, 22804, 29883, 33199, 23546, 23546, 21430, 23546, 49502, 48973, 47563, 47563, 36153, 45209, 22824, 22824, 39816, 27834, 22804, 22804, 43796, 30403, 39964, 23546, 23546, 22861, 23546, 47560, 22885, 47563, 23113, 22903, 22824, 33078, 22920, 22804, 38116, 23546, 23546, 22937, 29174, 22980, 47563, 34384, 42527, 22825, 23019, 22804, 31964, 47447, 46606, 23083, 36624, 23105, 32340, 30673, 23131, 36549, 23164, 40907, 43074, 23200, 23229, 23275, 36645, 36686, 33550, 48975, 23107, 30672, 23141, 39417, 23313, 23334, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 24855, 21369, 23546, 23546, 23546, 23546, 23546, 20980, 20992, 23383, 23546, 23546, 23546, 35799, 23546, 23546, 23420, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 23440, 27132, 23546, 23546, 23546, 44844, 23546, 23546, 18368, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 22603, 22824, 22824, 22824, 34828, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 26071, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23485, 23546, 23546, 23546, 26606, 23546, 23546, 23546, 23546, 21369, 28080, 23505, 23528, 23563, 23575, 28081, 23512, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 30821, 23546, 37478, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23598, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23184, 21369, 23546, 23546, 23546, 23546, 23546, 22653, 22665, 23615, 23546, 23546, 23546, 35799, 23546, 23546, 23644, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 23664, 27132, 23546, 23546, 23546, 44844, 23546, 23546, 23688, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 22603, 22824, 22824, 22824, 34828, 22804, 22804, 22804, 22804, 39677, 48779, 23733, 23546, 23546, 23546, 23546, 34921, 23753, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 23777, 48792, 23546, 23546, 23546, 23546, 23546, 50620, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 41753, 22821, 22824, 22824, 22824, 22824, 44122, 35849, 22804, 22804, 22804, 22804, 29879, 23672, 23807, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 34866, 22821, 22824, 22824, 22824, 22824, 23826, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 41728, 22824, 22824, 22824, 41433, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 39721, 23546, 23546, 23546, 30797, 25982, 23546, 23546, 23849, 21369, 20313, 44188, 23887, 23893, 23909, 23546, 49114, 23932, 23546, 23546, 23546, 36603, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 24187, 24465, 24820, 25200, 24258, 18282, 18849, 18305, 23964, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 23993, 24116, 24017, 24046, 24001, 24088, 25090, 24132, 24812, 24103, 24159, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 24182, 25436, 24884, 24206, 24190, 24890, 24819, 24363, 24227, 24819, 24414, 24143, 25214, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 24243, 24030, 25425, 24281, 24706, 24308, 24337, 24350, 24389, 24405, 24517, 24423, 25208, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 24439, 19364, 24455, 25063, 24489, 24505, 24533, 25266, 24373, 24545, 24561, 24577, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 19809, 24679, 24601, 25048, 19406, 24473, 24617, 25251, 25017, 24736, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 24633, 24673, 24695, 24722, 24779, 24801, 24836, 23977, 20842, 20016, 18679, 20827, 20042, 24871, 24906, 24935, 24951, 25006, 25411, 25295, 20159, 20175, 20206, 25033, 24292, 25079, 25281, 25106, 20376, 20392, 19394, 24919, 24657, 20462, 19676, 24211, 24785, 32258, 19353, 24647, 24966, 20473, 24060, 25136, 20616, 25172, 25188, 25236, 24072, 25311, 25362, 25396, 25452, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 21328, 23546, 23546, 23546, 25841, 25477, 23546, 23546, 25472, 32915, 25493, 25501, 25501, 25501, 25517, 21330, 25540, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 25581, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20499, 25597, 18792, 18808, 18830, 23628, 18814, 25623, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 21016, 25645, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 25669, 25705, 25721, 19477, 25754, 19498, 25737, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 18708, 21452, 19692, 19708, 20143, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23546, 50535, 23259, 25770, 25770, 25770, 25779, 21123, 21135, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 25220, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 25802, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21147, 20888, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23546, 21369, 22959, 25825, 25825, 25825, 25834, 20891, 22964, 25857, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 27140, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 25873, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25552, 25561, 23546, 23546, 23546, 26852, 23546, 23546, 23546, 23546, 21369, 33245, 25896, 25896, 25896, 25905, 36950, 33250, 25928, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 22366, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 25964, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 25998, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 26099, 23546, 23546, 23546, 23546, 25841, 21661, 23546, 23546, 21094, 43925, 23546, 23546, 23546, 21665, 26069, 21092, 26087, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 31389, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 26115, 26145, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 23546, 43987, 26168, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 50621, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 40883, 26241, 23546, 23546, 23546, 23546, 23546, 50620, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 23672, 23807, 23546, 23546, 23546, 23546, 26285, 23546, 23546, 47562, 47563, 47563, 47563, 29369, 22821, 22824, 22824, 22824, 22824, 28821, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 41728, 22824, 22824, 22824, 41433, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 26302, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 50621, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 40883, 26241, 23546, 23546, 23546, 23546, 23546, 50620, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 23672, 23807, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 29369, 22821, 22824, 22824, 22824, 22824, 28821, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 41728, 22824, 22824, 22824, 41433, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 50621, 26321, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 40883, 26241, 23546, 23546, 23546, 23546, 23546, 50620, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 23672, 23807, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 29369, 22821, 22824, 22824, 22824, 22824, 28821, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 41728, 22824, 22824, 22824, 41433, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 50621, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 40883, 26241, 23546, 23546, 23546, 23546, 23546, 19867, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 23672, 23807, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 29369, 22821, 22824, 22824, 22824, 22824, 28821, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 41728, 22824, 22824, 22824, 41433, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 26341, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 26341, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 50621, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 40883, 26241, 23546, 23546, 23546, 23546, 23546, 50620, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 23672, 23807, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 29369, 22821, 22824, 22824, 22824, 22824, 28821, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 41728, 22824, 22824, 22824, 41433, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 23049, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26364, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 19293, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 31312, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 37937, 26399, 26410, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 26426, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 26445, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23546, 21369, 41698, 26466, 26486, 26508, 26520, 41701, 26470, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 38227, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 26543, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 23546, 23546, 23424, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23546, 21369, 28554, 23546, 26577, 26583, 26599, 47449, 44239, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 26622, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 26638, 20392, 51127, 20418, 50802, 26654, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 27306, 23546, 23546, 23546, 26527, 26683, 26714, 28322, 26699, 26731, 50814, 50823, 26775, 26789, 26801, 26817, 26829, 26204, 26845, 23599, 23546, 25326, 21171, 35898, 34903, 26868, 26909, 26948, 33311, 26979, 26959, 26995, 27011, 45967, 27047, 27063, 27101, 27117, 34536, 27156, 23546, 23546, 44844, 41240, 34846, 23546, 42415, 27173, 27664, 23546, 42356, 28101, 47563, 47563, 47563, 27192, 27418, 22824, 22824, 42533, 43762, 22804, 22804, 22804, 27211, 27231, 36943, 23546, 44839, 40944, 23546, 27267, 27287, 46640, 23546, 27304, 35519, 43402, 27322, 27344, 47563, 47563, 27380, 27403, 27436, 31453, 22824, 33011, 27464, 27493, 27533, 27556, 22804, 38069, 35418, 30315, 27573, 26241, 27609, 23546, 44532, 27629, 39107, 50620, 23546, 45009, 27646, 31107, 27698, 47563, 27746, 27765, 23297, 27785, 27825, 36368, 22824, 27859, 48139, 23833, 27991, 44504, 49256, 22804, 43572, 23672, 27877, 42988, 25683, 23546, 27893, 27913, 46094, 23546, 21213, 44018, 47563, 30489, 32462, 27941, 34820, 22824, 45399, 49012, 28821, 27978, 22804, 22804, 28014, 28034, 49064, 28072, 35792, 28097, 51046, 28117, 50856, 22994, 28137, 47563, 41728, 28206, 28229, 22824, 41433, 28267, 28290, 22804, 34572, 28320, 28338, 23546, 23546, 39715, 47560, 28358, 45550, 23113, 28379, 35308, 33078, 28399, 36714, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 41649, 28419, 28455, 40472, 38341, 28471, 38828, 40452, 28791, 24756, 33030, 27540, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 28526, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 34078, 28545, 23546, 28652, 28658, 28674, 28690, 28701, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 26963, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22605, 35842, 45303, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 46230, 50621, 28718, 23546, 28717, 23546, 48975, 47563, 47563, 47563, 27769, 28735, 22823, 22824, 22824, 22824, 49361, 49439, 22804, 22804, 22804, 22804, 28781, 29885, 40883, 26241, 23546, 23546, 23546, 23546, 23546, 50620, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 23672, 23807, 23546, 18289, 23546, 23546, 44779, 49528, 23546, 36898, 47563, 47563, 47563, 40417, 28807, 22824, 22824, 22824, 50340, 31197, 28844, 22804, 22804, 22804, 28863, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 41728, 22824, 22824, 22824, 41433, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 21205, 28900, 28924, 28940, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 28963, 23546, 23546, 26527, 23546, 28992, 23546, 29010, 36977, 29029, 29038, 29054, 29069, 29081, 29097, 29109, 26204, 23546, 23546, 33645, 49739, 23546, 28529, 23546, 23546, 31365, 23546, 23546, 23546, 35995, 23546, 29125, 31167, 22824, 29149, 40337, 48749, 32108, 23546, 29172, 23546, 44844, 29190, 42384, 23546, 31347, 50774, 29209, 23546, 25948, 29214, 29230, 29291, 47563, 47563, 29309, 29325, 22824, 22824, 45608, 49036, 29349, 22804, 22804, 39677, 36943, 30220, 23546, 23546, 47099, 23546, 22095, 50621, 37205, 27682, 23546, 23546, 48975, 28152, 40051, 47563, 29366, 37135, 45217, 46920, 46953, 36665, 22824, 49439, 49901, 29385, 29404, 34563, 22804, 29885, 40883, 26241, 23546, 23546, 47600, 23546, 23546, 29423, 23546, 29445, 23546, 48976, 47563, 47563, 47563, 44406, 47564, 22821, 22824, 22824, 49328, 42575, 22767, 35849, 22804, 22804, 39288, 28274, 50448, 23672, 29464, 23546, 23546, 23546, 29498, 42828, 23546, 23546, 47562, 47563, 47563, 46820, 29369, 22821, 22824, 22824, 37856, 22824, 28821, 22804, 22804, 30184, 22804, 29883, 33199, 23546, 23546, 29517, 23546, 47519, 29538, 47563, 46768, 47563, 41728, 22824, 49353, 22824, 41433, 22804, 41641, 22804, 27843, 29565, 23546, 23546, 23546, 29581, 33988, 49629, 29610, 50265, 49148, 29627, 30732, 37573, 29644, 31970, 23546, 23546, 28626, 22586, 47563, 47563, 29661, 22824, 47375, 22804, 22804, 29679, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 45087, 23089, 29701, 47077, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 27251, 29717, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 21570, 23546, 23546, 26527, 23546, 29745, 24166, 23546, 32508, 29764, 29773, 29789, 29803, 29812, 29828, 29839, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 34673, 34671, 23546, 38486, 38493, 29855, 28213, 35842, 29875, 43066, 27800, 23546, 40629, 29901, 44844, 23546, 29926, 30774, 23546, 23546, 41541, 20026, 29946, 29989, 29293, 38320, 30005, 40270, 30031, 42116, 30052, 30082, 30100, 49972, 39453, 30135, 41942, 39677, 36943, 23546, 23546, 23546, 42078, 23546, 30162, 50621, 23546, 23546, 23546, 39564, 48975, 47563, 47563, 47563, 48721, 37135, 22823, 22824, 22824, 22824, 42777, 49439, 22804, 22804, 22804, 22804, 30182, 30146, 30200, 30236, 23546, 23546, 23546, 30252, 30271, 50620, 23546, 23546, 45468, 23469, 31420, 34156, 47563, 47563, 45201, 30292, 30331, 30348, 22824, 22824, 30365, 29156, 29407, 22804, 22804, 22804, 30399, 23672, 23807, 23546, 23546, 23546, 23546, 45523, 28572, 23546, 33872, 47563, 47563, 30419, 29369, 30438, 22824, 22824, 48645, 22824, 31904, 22804, 22804, 50360, 22804, 30539, 33199, 49920, 23546, 30462, 23546, 50724, 48973, 36270, 47563, 30480, 41728, 35391, 22824, 30505, 41433, 50493, 22804, 30530, 30403, 47447, 49732, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23251, 23546, 22586, 47563, 47563, 30555, 22824, 36108, 22804, 22804, 30575, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 30597, 46609, 47561, 23111, 30673, 39296, 30622, 30648, 30668, 30689, 19013, 30707, 30727, 30748, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23547, 30771, 23546, 26527, 25156, 30790, 23546, 30813, 24321, 30837, 30846, 30862, 30876, 30888, 30904, 30915, 26204, 22703, 30931, 26561, 35799, 30978, 26921, 26341, 27925, 30994, 31013, 31032, 31061, 31045, 31097, 31131, 31147, 31183, 31227, 31261, 31277, 39237, 39476, 31293, 33748, 31328, 22212, 31363, 31381, 41158, 23546, 23546, 40033, 23546, 22587, 32449, 31405, 47817, 28510, 31441, 31475, 46890, 31498, 30304, 31538, 22625, 36744, 47681, 39677, 36943, 23698, 29973, 31554, 29930, 31590, 23708, 31634, 39997, 31661, 48812, 31689, 31711, 31727, 31763, 31798, 31814, 29245, 31850, 40093, 31890, 34721, 31940, 35662, 31956, 31986, 27076, 32035, 32066, 32093, 32133, 26241, 50755, 23546, 43683, 23546, 32169, 19239, 32192, 32249, 22951, 24750, 43255, 32274, 47563, 32292, 45560, 22821, 32317, 22824, 42593, 48588, 50230, 35849, 32356, 22804, 45665, 32384, 32405, 32421, 23807, 25150, 32478, 32497, 47176, 23546, 32524, 45835, 36145, 40407, 31425, 32550, 44054, 32586, 34739, 22824, 32631, 32657, 30066, 33080, 32683, 47042, 40501, 29883, 33199, 23546, 45717, 33237, 23546, 23546, 32701, 31115, 42955, 32563, 41728, 45894, 41614, 32608, 41433, 33712, 42499, 35727, 30403, 47447, 28590, 32719, 48060, 32755, 32790, 42232, 33671, 32806, 37745, 39609, 32837, 40736, 33730, 32892, 32931, 32953, 19435, 22586, 32974, 48106, 28046, 33009, 33027, 33047, 48381, 35461, 47447, 40617, 22585, 47563, 50257, 22824, 33074, 36473, 36549, 33096, 40786, 36807, 32667, 39296, 33119, 43227, 48451, 49953, 33140, 24763, 23318, 45645, 33156, 33172, 33217, 47559, 33030, 30691, 33266, 33282, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 33306, 23546, 26527, 33327, 33345, 25456, 24849, 33370, 33400, 23546, 33386, 33428, 33437, 33453, 33464, 26204, 23546, 23546, 33480, 35799, 23546, 23546, 23546, 23546, 27288, 23546, 23546, 34477, 23546, 34484, 31605, 33499, 33519, 43660, 33545, 33568, 27800, 23546, 33621, 23546, 44844, 33621, 23546, 23546, 30997, 23546, 33640, 34051, 23546, 22587, 33661, 47563, 47563, 47563, 33687, 22824, 22824, 22824, 43762, 33703, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 50621, 23546, 23546, 23546, 33746, 48975, 47563, 47563, 47563, 43863, 37135, 22823, 22824, 22824, 22824, 34733, 49439, 22804, 22804, 22804, 22804, 33764, 29885, 40883, 26241, 23546, 23546, 23546, 23546, 23546, 50620, 23546, 20258, 23546, 48976, 47563, 47563, 46759, 47563, 47564, 22821, 22824, 22824, 37850, 22824, 22767, 35849, 22804, 22804, 33781, 22804, 29879, 23672, 23807, 23546, 23546, 23546, 23546, 23546, 43159, 23546, 47562, 47563, 47563, 31773, 29369, 22821, 22824, 22824, 49239, 22824, 28821, 22804, 22804, 22804, 33801, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 41728, 22824, 22824, 22824, 41433, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 33820, 23546, 23546, 22586, 44762, 47563, 23109, 33840, 22825, 34299, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 23335, 32233, 42307, 22729, 33859, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 32176, 23546, 23546, 41552, 33893, 33902, 33918, 33924, 33940, 33956, 33967, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 37894, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 28765, 41920, 23546, 23546, 44844, 23546, 23546, 23546, 39585, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 43177, 23546, 23546, 45738, 48975, 47563, 47563, 47563, 47563, 37135, 41960, 22824, 22824, 22824, 22824, 47410, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 20340, 23546, 23178, 20358, 23546, 23546, 20360, 33983, 47563, 47563, 34004, 47563, 47564, 22821, 22824, 36824, 22824, 22824, 22767, 35849, 22804, 33785, 22804, 22804, 29879, 34024, 23546, 23546, 23546, 34050, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 32147, 47539, 23546, 48973, 47563, 47563, 39206, 45209, 22824, 22824, 43898, 27834, 22804, 22804, 34943, 30403, 47447, 34067, 47158, 34094, 23546, 34121, 32984, 34141, 34177, 43533, 34196, 34244, 36447, 34263, 31970, 28608, 23546, 34315, 34336, 34355, 34372, 28875, 33605, 34412, 34436, 34454, 31964, 47447, 46606, 43054, 32993, 34501, 34521, 30673, 34552, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 43326, 34588, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 41690, 23546, 26286, 34628, 23546, 23546, 23546, 34692, 23546, 34693, 23546, 23546, 34656, 34689, 40521, 22887, 37164, 34396, 43815, 34709, 34755, 23546, 23546, 29501, 44844, 26383, 30255, 23546, 23546, 41921, 23546, 23546, 23546, 22587, 47563, 47563, 32276, 47563, 27418, 22824, 22824, 35655, 43762, 22804, 22804, 35850, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 34780, 43953, 48975, 47563, 47563, 47563, 47563, 29859, 22823, 22824, 22824, 22824, 22824, 30446, 22804, 22804, 22804, 22804, 22804, 34799, 33201, 23546, 34844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 42714, 48976, 34862, 47563, 47563, 47563, 47564, 34882, 22824, 22824, 22824, 22824, 22767, 30383, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 34898, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 49594, 27195, 22821, 22824, 22824, 22824, 49007, 30376, 22804, 22804, 22804, 28251, 29883, 33199, 23546, 23546, 45156, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 28617, 23546, 48860, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 48020, 34919, 46606, 50168, 47563, 35289, 22824, 34937, 22804, 34959, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 26217, 23546, 26527, 28994, 29429, 32937, 21397, 21407, 19607, 19616, 34984, 34999, 35011, 35027, 35038, 26204, 23546, 23546, 23546, 21159, 35548, 23546, 23546, 29013, 35054, 32876, 23546, 35263, 35074, 35112, 39498, 35166, 47961, 27448, 49402, 46199, 35202, 23546, 23546, 23546, 38910, 23546, 47123, 35227, 23546, 23546, 23546, 35244, 44990, 22587, 44754, 35279, 47563, 35324, 35372, 48187, 22824, 29333, 35407, 49176, 35434, 22804, 35477, 39677, 36943, 23546, 35515, 50019, 41319, 42187, 35535, 23546, 19253, 43384, 35575, 35592, 35612, 35186, 47563, 42920, 37391, 20600, 22823, 35386, 22824, 40181, 35635, 35678, 29350, 22804, 33765, 35713, 35750, 48433, 33201, 23546, 23546, 23546, 23546, 35766, 20349, 35815, 44388, 23546, 23546, 40380, 47253, 47563, 47563, 41209, 36250, 35833, 43893, 22824, 22824, 48653, 43541, 43789, 35866, 22804, 22804, 31917, 36853, 33195, 23546, 19730, 35885, 35914, 32534, 35930, 35957, 45488, 36011, 28363, 36030, 36050, 36074, 36103, 39870, 50408, 42260, 32597, 45635, 22804, 36124, 36169, 36204, 27085, 31863, 36220, 46659, 44955, 21826, 38142, 32958, 36266, 47872, 36286, 36321, 36366, 36384, 36409, 36435, 36471, 36489, 36514, 36540, 36572, 23546, 23546, 18340, 36595, 30632, 36619, 36640, 39370, 36661, 36681, 36702, 36740, 36760, 31970, 23546, 36781, 18841, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 34034, 46606, 22585, 31741, 36801, 36823, 36840, 38424, 36549, 46609, 36869, 23111, 30673, 39296, 36886, 35338, 36933, 36966, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 42313, 47646, 36993, 39426, 42307, 22729, 23448, 37021, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 39988, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 50028, 21708, 39996, 40225, 24990, 37071, 37082, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 31016, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 27420, 22824, 43762, 22804, 22804, 48012, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 25524, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 37098, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 37115, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 37134, 47563, 47563, 47563, 47564, 37151, 22824, 22824, 22824, 22824, 22767, 28828, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 41164, 23546, 26527, 23546, 34764, 23546, 19155, 37185, 37221, 37234, 37250, 37256, 37272, 37288, 37299, 26204, 23546, 37315, 23546, 35799, 23546, 43426, 26746, 23546, 23546, 37335, 23546, 32153, 42194, 37334, 37351, 37380, 37407, 37443, 40833, 37430, 32821, 37459, 23546, 23546, 34612, 23546, 23546, 40581, 34220, 23546, 41122, 29193, 49795, 34228, 47262, 37494, 29549, 41774, 37514, 42784, 22904, 45886, 37530, 38036, 37570, 36188, 37589, 23034, 37618, 28342, 23546, 23546, 23546, 23546, 50126, 23546, 23546, 23546, 23546, 23546, 48975, 28498, 44484, 47563, 28434, 44023, 37641, 37671, 39810, 30349, 22824, 39853, 47704, 29645, 22804, 49383, 22804, 37657, 33201, 23546, 23546, 50909, 37693, 23546, 32019, 38379, 23546, 23546, 23546, 48976, 47563, 47563, 46474, 32220, 37710, 22821, 22824, 22824, 49321, 37734, 37761, 35849, 22804, 22804, 37788, 37809, 29879, 33195, 23546, 37872, 23546, 23546, 37889, 23546, 23546, 23546, 47562, 27357, 47563, 47563, 27195, 22821, 40293, 22824, 22824, 22824, 30376, 34247, 22804, 22804, 22804, 29883, 33199, 37910, 31075, 23546, 37928, 47744, 48973, 37953, 47563, 47563, 37979, 38003, 22824, 22824, 38027, 38061, 22804, 22804, 38085, 47447, 23404, 23546, 28599, 23546, 47560, 31782, 47563, 23113, 38011, 22824, 33078, 33721, 22804, 31970, 23546, 21592, 23546, 22586, 47563, 50097, 23109, 22824, 40810, 22804, 22804, 38110, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 33290, 45056, 38132, 38158, 38179, 33552, 39426, 27505, 38215, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23648, 23546, 26527, 23546, 26305, 23546, 23546, 29594, 20530, 20539, 38250, 38264, 38273, 38289, 38300, 26364, 23546, 23948, 23546, 35799, 23546, 34320, 23546, 23546, 23546, 23948, 23546, 35554, 36579, 23947, 35559, 38316, 33588, 36393, 38336, 43066, 27800, 23546, 23546, 38357, 44844, 23546, 39344, 42555, 23546, 39071, 23546, 23546, 38375, 41192, 48530, 47563, 47812, 38395, 28750, 22824, 42121, 31482, 43762, 38449, 22804, 38419, 38440, 32050, 38473, 38509, 46688, 34783, 23546, 23546, 23546, 23546, 23546, 38530, 23546, 23546, 48975, 47883, 38550, 42949, 47563, 37135, 22823, 38568, 30084, 22824, 22824, 49439, 42031, 34293, 41837, 22804, 22804, 29885, 33201, 23546, 38929, 23546, 38602, 23546, 44369, 37873, 23791, 38621, 23546, 48976, 27031, 38642, 47563, 38659, 47564, 38683, 47916, 22824, 22824, 38702, 33843, 35849, 39277, 22804, 33804, 38724, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 36556, 23546, 23546, 23546, 23546, 47560, 38744, 47563, 30559, 22824, 22824, 46066, 22804, 22804, 31970, 23546, 23546, 49685, 22586, 47563, 47563, 23109, 47427, 22825, 22804, 35452, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 38761, 47561, 38782, 38802, 43621, 23464, 38824, 38844, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 38045, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23810, 23546, 46101, 23546, 29522, 38860, 33103, 38895, 38945, 38984, 38970, 38989, 38954, 39005, 39016, 26204, 23546, 24981, 39032, 39052, 39135, 26183, 26715, 27157, 23546, 39087, 39123, 35972, 23871, 39151, 32436, 39187, 39222, 39262, 39312, 39360, 27800, 27271, 23546, 23546, 40856, 29748, 35256, 26269, 47340, 39386, 28121, 33483, 41086, 39406, 48539, 39200, 45029, 47563, 29260, 30036, 22824, 47369, 43762, 41883, 39448, 22787, 22804, 32852, 39469, 27673, 33624, 23546, 39492, 23546, 23546, 30166, 23546, 19760, 23546, 25974, 48975, 39514, 47563, 47563, 47563, 37135, 37987, 39541, 30332, 22824, 22824, 49439, 34278, 22804, 48403, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 49277, 23546, 23546, 39561, 44662, 39580, 20000, 47563, 47563, 38745, 47563, 41583, 39601, 22824, 22824, 42751, 22824, 39625, 36344, 22804, 22804, 49650, 22804, 39663, 33195, 39390, 39701, 21803, 40964, 23546, 28563, 39737, 39764, 42864, 39780, 30015, 27711, 27195, 22821, 39796, 39832, 37838, 39869, 30376, 37543, 39886, 39910, 39936, 47724, 39958, 49087, 33227, 48840, 39980, 40013, 20680, 50204, 40049, 40067, 40083, 45419, 22824, 40109, 40125, 36765, 22804, 40151, 40167, 47447, 40217, 23546, 23546, 19121, 40241, 48114, 40263, 48445, 44596, 40286, 40309, 42808, 40330, 30581, 40353, 23546, 23546, 40374, 28485, 40396, 27517, 40433, 40468, 40722, 40488, 31964, 30114, 48477, 40517, 36058, 24761, 45115, 30673, 40537, 36549, 40555, 19020, 29663, 30673, 40603, 40652, 40668, 40708, 40752, 40779, 40802, 40826, 40849, 24756, 33030, 33551, 47559, 33030, 33552, 40872, 40899, 22729, 23448, 40923, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 40939, 26527, 23546, 35150, 40960, 23546, 26932, 40980, 40989, 41005, 41019, 41028, 41044, 41055, 26204, 41071, 27176, 35142, 41110, 22748, 41145, 23546, 41180, 29961, 41225, 35127, 41274, 41299, 41335, 41350, 41366, 41401, 41487, 41458, 41474, 41503, 23546, 18442, 27630, 46235, 23546, 41314, 19147, 41528, 40358, 23546, 23546, 45375, 22587, 47563, 36909, 41568, 47891, 27418, 38686, 27953, 41607, 41630, 22804, 23213, 41665, 46983, 39677, 36943, 23546, 45937, 23546, 37118, 23546, 39337, 41681, 33824, 35058, 38605, 23546, 41717, 41752, 28167, 41769, 47563, 43475, 41790, 42050, 41800, 22824, 22824, 41816, 41853, 50302, 41874, 22804, 49204, 29885, 47656, 41907, 23546, 38879, 36785, 23546, 23546, 23546, 23546, 23546, 39036, 48976, 47563, 46791, 34008, 47563, 47564, 22821, 22824, 44589, 46895, 22824, 22767, 35849, 22804, 41937, 38457, 22804, 29879, 33195, 23546, 23546, 49550, 23546, 45766, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 32301, 41958, 22824, 22824, 22824, 46046, 28243, 22804, 22804, 22804, 22804, 41977, 33199, 20951, 42005, 23546, 23546, 23546, 44350, 47563, 31827, 47563, 41591, 22824, 49433, 22824, 28884, 22804, 42026, 22804, 30403, 31211, 23546, 23546, 23546, 23546, 27328, 40247, 47563, 27241, 38708, 22824, 42285, 31924, 22804, 29685, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 22739, 46606, 49667, 46712, 38403, 42047, 44103, 22804, 44463, 42066, 42221, 42103, 42137, 42175, 42210, 42248, 42276, 42301, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 35697, 39426, 36136, 22729, 23448, 42329, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 26377, 26527, 23546, 23546, 42378, 33354, 42400, 20758, 23546, 26429, 42436, 42448, 42464, 42475, 26204, 23546, 23546, 25120, 35799, 23546, 23546, 23546, 31573, 31305, 23546, 23546, 31567, 25118, 23546, 48973, 37963, 23115, 42491, 47011, 42515, 27800, 23546, 42549, 23546, 44844, 23546, 38766, 18352, 23546, 39064, 23546, 23546, 22159, 22587, 48548, 38163, 45793, 48521, 47316, 42571, 42591, 47404, 42609, 44147, 39942, 22845, 35499, 47057, 42343, 42636, 23546, 42657, 23546, 42010, 42641, 26759, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 36917, 47563, 37135, 22823, 22824, 22824, 42693, 22824, 49439, 22804, 22804, 28847, 22804, 22804, 29885, 45066, 44270, 23546, 42713, 23546, 23546, 26553, 42677, 42730, 31574, 23546, 48976, 47563, 48931, 47563, 47563, 47564, 42748, 22824, 42767, 22824, 22824, 34180, 35849, 22804, 42800, 22804, 22804, 29879, 33195, 23546, 44983, 23546, 23546, 23546, 23546, 42824, 23546, 47562, 47563, 36034, 47563, 27749, 22821, 22824, 22824, 42844, 22824, 48373, 22804, 22804, 38192, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 18259, 23546, 23546, 42862, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 39325, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 48281, 42880, 42913, 28181, 33529, 39296, 42936, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 38514, 23546, 23546, 23546, 44073, 44076, 50916, 44069, 36233, 42971, 33598, 40201, 40539, 43066, 29275, 42987, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 43004, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 43023, 22824, 22824, 22824, 22824, 43497, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 30422, 47563, 23109, 38579, 22825, 32685, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 22195, 38234, 23546, 23546, 22088, 23546, 31645, 43040, 31695, 43090, 43103, 43112, 43128, 43139, 26204, 23546, 31341, 32732, 35799, 43366, 43155, 43175, 36087, 40692, 50768, 31673, 43193, 32904, 31522, 31081, 43243, 43271, 43287, 43315, 43342, 40683, 23546, 23546, 23546, 45381, 43358, 40568, 43382, 43400, 43418, 23546, 23546, 30119, 43208, 47563, 43442, 27364, 43462, 43491, 28908, 22824, 43513, 43557, 22804, 43588, 41858, 43607, 43637, 43676, 23546, 23546, 23546, 18266, 35576, 23546, 23546, 43699, 43717, 43736, 20331, 32703, 47563, 41378, 47563, 46720, 41989, 43754, 29628, 22824, 22824, 43651, 43778, 43812, 46171, 22804, 44212, 43831, 43879, 33201, 23546, 23546, 45346, 23546, 43914, 43941, 23546, 27809, 23863, 43976, 44003, 47563, 48620, 44039, 35181, 49990, 44092, 22824, 45449, 39545, 44119, 42697, 44138, 22804, 44163, 27998, 44211, 35734, 33195, 39171, 23546, 23546, 23067, 44228, 32012, 23546, 44255, 36870, 46433, 23003, 47563, 27195, 22821, 44297, 46134, 22824, 22824, 30376, 39647, 22804, 44322, 22804, 41442, 44340, 23546, 44366, 44385, 23546, 23546, 34339, 44404, 47563, 47563, 44422, 22824, 22824, 22824, 44438, 22804, 22804, 22804, 44454, 47447, 48298, 23546, 23546, 23546, 44479, 47563, 47563, 46130, 22824, 22824, 44500, 22804, 22804, 44520, 23546, 40027, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 38094, 49704, 44555, 44579, 44612, 44650, 23464, 24759, 33031, 33550, 44685, 30652, 34420, 36724, 24756, 33030, 33551, 47559, 33030, 45310, 44716, 44744, 32641, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 25786, 26527, 44778, 28976, 18999, 44795, 44824, 44860, 44808, 44885, 44899, 44911, 44927, 44938, 26204, 44954, 40587, 23546, 44971, 23546, 23546, 43960, 23546, 50132, 23546, 45006, 35089, 26325, 35096, 32207, 45025, 45045, 44306, 45082, 45103, 27800, 35987, 37200, 44669, 44844, 34640, 23546, 23546, 23546, 23546, 45137, 45172, 23546, 19324, 45188, 43446, 47563, 47563, 45233, 45249, 45268, 22824, 43762, 45291, 40314, 22804, 22804, 39677, 36943, 37912, 23546, 23546, 45326, 45362, 23546, 23546, 23546, 23546, 23546, 37055, 48975, 48512, 31834, 47563, 47563, 46028, 22823, 45397, 45415, 22824, 22824, 36333, 38728, 44324, 22804, 22804, 22804, 45435, 33201, 23546, 23546, 26251, 43720, 23546, 45465, 26758, 45484, 45504, 23546, 45539, 47563, 47563, 47285, 43856, 45576, 45600, 22824, 22824, 47994, 48169, 45624, 45661, 22804, 22804, 42152, 45681, 29879, 45697, 45713, 45733, 23546, 25942, 23546, 23546, 30214, 45754, 47562, 47563, 27730, 45789, 27195, 22821, 22824, 47619, 47969, 22824, 30376, 22804, 22804, 45809, 22804, 29883, 33199, 23546, 21039, 23546, 49467, 37049, 48973, 47563, 45851, 48716, 45584, 47934, 22824, 45868, 48003, 35869, 22804, 45910, 30403, 47447, 23546, 48332, 18869, 22345, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 32000, 21288, 23546, 45931, 45953, 47563, 37498, 23109, 22824, 40444, 22804, 34438, 36455, 45997, 44634, 19558, 46021, 50382, 46044, 28056, 22804, 34468, 46609, 35619, 30711, 46062, 46082, 23464, 24759, 33031, 33550, 19538, 36296, 49945, 23141, 46117, 38586, 45823, 48503, 46150, 46187, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23737, 26527, 23546, 23546, 34968, 23546, 46215, 26881, 26893, 46251, 46267, 46279, 46295, 46306, 26204, 46322, 23241, 25565, 35799, 25341, 42889, 46340, 22204, 44869, 46352, 46368, 46377, 46393, 46349, 46420, 46455, 46490, 46547, 46518, 46534, 32867, 46005, 19766, 34600, 44844, 46563, 23546, 26188, 46580, 41258, 46596, 46625, 46675, 46736, 46784, 46807, 46842, 38552, 46877, 45877, 46911, 46944, 36419, 46977, 46999, 47027, 27557, 39677, 37035, 47093, 47115, 35228, 23546, 47139, 47174, 23546, 47766, 23546, 49770, 47192, 20591, 47219, 47244, 47278, 38643, 47301, 41736, 47356, 47391, 47426, 31459, 49439, 36524, 39920, 40135, 22804, 35492, 33058, 47443, 23546, 20251, 43007, 37694, 47465, 46324, 47491, 47518, 23546, 47535, 47555, 39525, 47841, 47563, 34125, 47580, 47616, 47635, 39844, 22824, 37169, 48362, 35849, 47672, 47697, 22804, 41891, 47720, 33195, 23058, 47740, 23546, 45516, 47760, 23546, 47782, 18627, 47798, 50186, 47833, 47857, 27195, 47907, 47932, 47950, 47985, 48036, 39636, 46165, 37602, 50472, 50517, 37554, 27477, 48056, 18311, 23546, 35780, 48076, 48095, 44700, 47563, 47563, 48130, 48155, 37677, 22824, 48203, 48236, 49183, 22804, 48272, 47447, 18372, 48297, 48314, 48330, 41202, 45981, 33877, 34811, 48348, 48040, 48397, 48419, 37793, 31970, 48467, 23546, 23546, 48493, 46466, 31618, 34505, 49612, 47069, 35443, 43299, 48564, 28304, 47475, 19993, 48611, 37364, 48636, 48669, 43591, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 44177, 29729, 48685, 36498, 48701, 45275, 48737, 39426, 42307, 22729, 39685, 48765, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 48828, 23546, 23546, 48856, 23546, 35941, 30944, 30953, 48876, 30953, 30962, 48892, 48903, 26204, 23546, 23546, 23546, 40636, 23546, 26348, 23546, 23546, 23546, 23546, 26345, 23546, 38923, 23546, 48973, 48919, 48178, 48947, 38808, 37005, 31513, 38873, 23546, 23546, 44844, 23546, 23546, 27897, 48963, 23546, 23546, 23546, 23546, 48971, 46750, 47563, 47563, 34356, 48992, 22824, 22824, 22824, 36305, 49028, 22804, 22804, 22804, 49052, 44728, 49080, 23546, 49103, 45341, 23546, 23546, 42732, 48802, 47595, 38359, 35596, 48975, 47563, 49130, 41385, 43221, 47228, 22823, 48595, 46928, 41415, 49146, 49164, 22804, 49199, 49220, 45915, 29388, 37824, 33201, 23546, 25346, 23546, 26261, 23546, 23546, 23546, 49474, 23546, 23546, 48976, 33503, 47563, 47563, 47563, 47564, 49236, 37414, 22824, 22824, 22824, 22767, 49255, 36180, 22804, 22804, 22804, 29879, 33195, 49272, 23546, 49293, 23546, 23546, 23546, 23546, 28581, 36243, 47563, 47563, 47563, 27195, 49311, 22824, 22824, 22824, 22824, 37772, 22804, 22804, 22804, 22804, 29883, 46502, 23546, 23546, 50321, 46564, 23546, 30276, 23289, 47563, 47563, 37718, 49344, 22824, 22824, 30514, 49377, 22804, 22804, 42620, 47447, 39101, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 46439, 24761, 43524, 30673, 49399, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 49418, 45121, 44624, 47559, 33030, 33552, 39426, 32368, 49455, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 49490, 49547, 33412, 49525, 23546, 34105, 23546, 33409, 49544, 42420, 41283, 49566, 49577, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 49593, 35299, 27962, 22805, 43066, 27800, 23546, 33329, 27613, 44844, 23546, 23546, 23546, 23546, 23546, 32481, 23546, 23546, 22587, 32570, 47563, 46861, 47563, 27418, 49610, 22824, 32331, 43762, 42159, 22804, 27215, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 37318, 23546, 23546, 23546, 20322, 23546, 48975, 47563, 47563, 49628, 47563, 37135, 22823, 22824, 32615, 22824, 22824, 49439, 22804, 22804, 49645, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 49666, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 49683, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 49701, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 49720, 23546, 50953, 23546, 25809, 49755, 49786, 23546, 49811, 49825, 49837, 49853, 49864, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 27387, 22824, 49893, 38199, 49880, 34211, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 42672, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 49917, 23546, 23546, 23546, 22167, 47563, 47563, 47563, 47563, 47564, 49936, 22824, 22824, 22824, 22824, 22767, 49969, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 45149, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 49988, 47563, 50006, 22821, 22824, 48578, 22824, 41424, 30376, 22804, 39894, 22804, 32389, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 26445, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 41512, 50052, 50063, 26204, 23546, 23546, 23546, 35799, 50079, 30464, 23546, 23546, 23546, 23546, 32774, 23546, 41129, 32770, 46701, 50096, 40191, 28190, 22805, 43066, 27800, 23546, 23546, 23546, 50113, 28719, 34485, 45773, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 29611, 47563, 27026, 27418, 22824, 35645, 28383, 43762, 22804, 22921, 22804, 48250, 39677, 50148, 50164, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 41250, 23546, 23546, 23546, 48976, 47563, 47563, 50184, 47563, 45852, 22821, 22824, 38786, 22824, 22824, 45252, 35849, 22804, 48256, 22804, 22804, 29879, 33195, 48079, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 50202, 47563, 47563, 27195, 22821, 50220, 22824, 22824, 22824, 30376, 48220, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 21798, 23546, 23546, 35799, 23546, 23546, 46652, 23546, 23546, 23546, 23546, 46656, 23546, 23546, 50246, 28439, 22824, 50294, 36350, 50281, 47331, 23546, 29448, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 35817, 22587, 47563, 47563, 47563, 27723, 27418, 22824, 22824, 27861, 43762, 22804, 22804, 22804, 48212, 39677, 36943, 23546, 50318, 23546, 23546, 23546, 23546, 23546, 23546, 37099, 23546, 23546, 48975, 38667, 47563, 36014, 47563, 37135, 22823, 50337, 22824, 46961, 22824, 49439, 28018, 22804, 22804, 50356, 22804, 29885, 33201, 23546, 43738, 23546, 23546, 23546, 23546, 23546, 38534, 23546, 23546, 48976, 47563, 50376, 47563, 47563, 47564, 50398, 41961, 50424, 22824, 22824, 22767, 50443, 28403, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 21488, 23546, 47562, 47563, 31747, 47563, 34161, 22821, 22824, 43024, 22824, 22824, 50464, 22804, 22804, 50488, 22804, 43844, 33199, 23546, 23546, 18921, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 31241, 23546, 23546, 39165, 23546, 29133, 47563, 47563, 33578, 22824, 22824, 50509, 22804, 22804, 31970, 23546, 49295, 23546, 22586, 47563, 31161, 23109, 50427, 22825, 22804, 41830, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22677, 23546, 23546, 23546, 23546, 26527, 23546, 23546, 23546, 23546, 21369, 21483, 23546, 23546, 23546, 19262, 39432, 32077, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27800, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 27418, 22824, 22824, 22824, 43762, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 46404, 21767, 21765, 32117, 22038, 50563, 21058, 21061, 50533, 22036, 50551, 50579, 50591, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 50607, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50637, 19916, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 50655, 18544, 18567, 18590, 19934, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 22150, 23546, 21369, 20766, 50679, 50692, 50708, 50717, 49509, 50740, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 51042, 23546, 23546, 23546, 23761, 23546, 23546, 23758, 25629, 19208, 50639, 19926, 50639, 50790, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 18521, 18544, 18567, 18590, 50663, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 42087, 23546, 23546, 23546, 23546, 22568, 29910, 50839, 50872, 50878, 50849, 23148, 50894, 20967, 23546, 23546, 23546, 35799, 23546, 23546, 50932, 23546, 23546, 22686, 23546, 23546, 23546, 22682, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 18327, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 50969, 18544, 18567, 18590, 21689, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 20159, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 20376, 20392, 51127, 20418, 50802, 20462, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 21089, 23546, 23546, 23546, 23546, 25841, 23546, 23546, 23546, 23546, 21369, 23546, 23546, 23546, 23546, 23546, 23546, 23489, 26204, 23546, 23546, 23546, 35799, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 22824, 35842, 22805, 43066, 27132, 23546, 23546, 23546, 44844, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22587, 47563, 47563, 47563, 47563, 22603, 22824, 22824, 22824, 34828, 22804, 22804, 22804, 22804, 39677, 36943, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48975, 47563, 47563, 47563, 47563, 37135, 22823, 22824, 22824, 22824, 22824, 49439, 22804, 22804, 22804, 22804, 22804, 29885, 33201, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 48976, 47563, 47563, 47563, 47563, 47564, 22821, 22824, 22824, 22824, 22824, 22767, 35849, 22804, 22804, 22804, 22804, 29879, 33195, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 47562, 47563, 47563, 47563, 27195, 22821, 22824, 22824, 22824, 22824, 30376, 22804, 22804, 22804, 22804, 29883, 33199, 23546, 23546, 23546, 23546, 23546, 48973, 47563, 47563, 47563, 45209, 22824, 22824, 22824, 27834, 22804, 22804, 22804, 30403, 47447, 23546, 23546, 23546, 23546, 47560, 47563, 47563, 23113, 22824, 22824, 33078, 22804, 22804, 31970, 23546, 23546, 23546, 22586, 47563, 47563, 23109, 22824, 22825, 22804, 22804, 31964, 47447, 46606, 22585, 47563, 24761, 22824, 30673, 22804, 36549, 46609, 47561, 23111, 30673, 39296, 23464, 24759, 33031, 33550, 48975, 23107, 30672, 23141, 24756, 33030, 33551, 47559, 33030, 33552, 39426, 42307, 22729, 23448, 23351, 23363, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 22457, 23546, 23546, 22482, 50993, 50998, 50998, 51019, 22480, 51014, 51035, 23546, 23546, 23546, 23546, 23546, 23546, 51042, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 25629, 19208, 50639, 19926, 50639, 20660, 19723, 18282, 18849, 18305, 51062, 23546, 23546, 18368, 23546, 18915, 18388, 18432, 18458, 18463, 18479, 18968, 18495, 19670, 50655, 18544, 18567, 18590, 19934, 18528, 18551, 18574, 18597, 20868, 18620, 23546, 30606, 23546, 23546, 23546, 23582, 23367, 18643, 23546, 18664, 50036, 18695, 19209, 26024, 18505, 19208, 25377, 18724, 26048, 18745, 18766, 18771, 19889, 50639, 26053, 18750, 50639, 18776, 19839, 20674, 23546, 18792, 18808, 18830, 23628, 18814, 18865, 23546, 44195, 18885, 18937, 18958, 20812, 26011, 20051, 18984, 19036, 19054, 19072, 19090, 26127, 19108, 19038, 19056, 19074, 19092, 26129, 18604, 20668, 23396, 19137, 19171, 19225, 39246, 19278, 47150, 19314, 19340, 26667, 19186, 19380, 19422, 19456, 25721, 19477, 25754, 19498, 19451, 25716, 19472, 25749, 19493, 19514, 19530, 18900, 19554, 23717, 19574, 19592, 19632, 19657, 20190, 20797, 20402, 21452, 19692, 19708, 19964, 21452, 19692, 19708, 20432, 19853, 26492, 19746, 41094, 19782, 18942, 19201, 19798, 19825, 19883, 19905, 19950, 19883, 19905, 19980, 23977, 20842, 20016, 18679, 20827, 20042, 20067, 20090, 20113, 20074, 20097, 20129, 20446, 51082, 20175, 20206, 20222, 51139, 20274, 51143, 20301, 51098, 20392, 51127, 20418, 50802, 51114, 25380, 50639, 18729, 32258, 26037, 20489, 20515, 19641, 20555, 20577, 20616, 20632, 20648, 20696, 20727, 20743, 20782, 20858, 20884, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 23546, 94503, 94503, 90406, 90406, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 1, 12290, 3, 0, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 362, 94503, 90406, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 0, 94503, 90406, 94503, 94503, 94503, 94503, 94503, 94503, 94503, 69632, 73728, 94503, 94503, 94503, 94503, 94503, 65536, 94503, 0, 2183168, 0, 0, 0, 90406, 94503, 296, 297, 0, 2134016, 300, 301, 0, 0, 0, 0, 0, 0, 2985, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1631, 0, 0, 0, 0, 0, 1637, 0, 0, 2424832, 2433024, 0, 0, 2457600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2904064, 2908160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2751, 0, 0, 0, 0, 0, 0, 0, 3117056, 0, 0, 0, 0, 0, 0, 0, 362, 362, 0, 0, 0, 0, 0, 0, 2997, 0, 0, 0, 0, 3001, 0, 0, 0, 0, 0, 0, 1186, 0, 0, 0, 1191, 0, 0, 0, 0, 1107, 0, 0, 0, 2138112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2978, 0, 0, 0, 2424832, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2625536, 0, 0, 0, 0, 0, 172032, 0, 172032, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 1, 12290, 3, 0, 2699264, 2715648, 0, 0, 2772992, 2805760, 2830336, 0, 2863104, 2920448, 0, 0, 0, 0, 0, 0, 0, 1114, 0, 0, 0, 0, 1118, 0, 0, 1121, 0, 2805760, 2920448, 0, 0, 0, 0, 0, 2920448, 0, 0, 0, 0, 0, 0, 0, 2732032, 0, 2179072, 2179072, 2179072, 2424832, 2433024, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2625536, 2805760, 2179072, 2830336, 2179072, 2179072, 2863104, 2179072, 2179072, 2179072, 2920448, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2801664, 2813952, 2179072, 2838528, 2179072, 2179072, 2179072, 2179072, 2179072, 0, 914, 2125824, 2125824, 2125824, 2125824, 2424832, 2433024, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2625536, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2625536, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2699264, 2125824, 2715648, 2125824, 2723840, 2125824, 2732032, 2772992, 2125824, 2125824, 2125824, 2723840, 2125824, 2732032, 2772992, 2125824, 2125824, 2125824, 2805760, 2125824, 2830336, 2125824, 2125824, 2863104, 2125824, 2125824, 2125824, 2125824, 2920448, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2920448, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3117056, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3207168, 2125824, 2125824, 2179072, 2125824, 2125824, 2125824, 2125824, 2457600, 2125824, 2125824, 2125824, 2125824, 2183168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2518, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2375680, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 167936, 0, 0, 0, 0, 0, 0, 2408448, 0, 0, 2584576, 0, 0, 0, 0, 2838528, 0, 0, 2838528, 0, 0, 0, 0, 0, 2469888, 2506752, 2756608, 0, 0, 2580480, 0, 0, 0, 2396160, 2400256, 2412544, 0, 0, 2838528, 0, 0, 0, 0, 0, 2179072, 2179072, 2179072, 2408448, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 3223552, 914, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 2445312, 2125824, 0, 2125824, 2125824, 2125824, 2408448, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 2502656, 0, 0, 3010560, 2125824, 2125824, 2125824, 2125824, 2125824, 2662400, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2801664, 2813952, 2125824, 2838528, 2125824, 2801664, 2813952, 2125824, 2838528, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3125248, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2461696, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2600960, 0, 2674688, 0, 2768896, 2777088, 2781184, 0, 2822144, 0, 0, 2883584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3055616, 0, 0, 0, 3080192, 3100672, 3104768, 0, 0, 0, 0, 3186688, 0, 0, 0, 0, 0, 0, 0, 3182, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2732032, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3133440, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3003, 3004, 0, 2719744, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3014656, 3207168, 0, 2691072, 0, 0, 0, 0, 0, 2818048, 2846720, 0, 2916352, 0, 0, 3002368, 0, 0, 3022848, 0, 0, 0, 0, 0, 2871296, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2766, 0, 0, 0, 0, 0, 3215360, 0, 0, 0, 0, 0, 0, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2494464, 2179072, 2179072, 2514944, 2179072, 2179072, 2461696, 2465792, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2523136, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2699264, 2179072, 2715648, 2179072, 2723840, 2179072, 2732032, 2772992, 2179072, 2179072, 3100672, 2179072, 2179072, 3133440, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 3207168, 2179072, 0, 0, 0, 0, 391, 392, 0, 393, 0, 0, 0, 0, 0, 393, 0, 0, 0, 0, 0, 3504, 0, 0, 0, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3399, 540, 540, 0, 0, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2461696, 2465792, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2523136, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2600960, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2641920, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2719744, 2125824, 2125824, 2125824, 2125824, 2125824, 2768896, 2777088, 2768896, 2777088, 2125824, 2797568, 2822144, 2125824, 2125824, 2125824, 2883584, 2125824, 2912256, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3133440, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3207168, 2125824, 0, 0, 0, 0, 0, 0, 3011, 0, 0, 0, 0, 0, 0, 3018, 0, 0, 0, 0, 2605056, 0, 0, 0, 0, 2887680, 0, 2924544, 0, 0, 0, 0, 0, 0, 0, 1135, 0, 0, 0, 0, 0, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3162112, 3170304, 0, 0, 3219456, 3035136, 0, 0, 0, 0, 0, 3072000, 2650112, 2179072, 2179072, 2179072, 2707456, 2179072, 2736128, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2887680, 2179072, 2179072, 2543616, 2547712, 2179072, 2179072, 2596864, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2584576, 0, 0, 2809856, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3088384, 0, 0, 0, 0, 0, 1670, 0, 0, 0, 0, 0, 0, 0, 2112, 0, 0, 0, 0, 0, 1680, 1681, 0, 1683, 0, 0, 0, 0, 0, 0, 0, 540, 561, 540, 561, 540, 540, 561, 540, 585, 0, 0, 2576384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2420736, 0, 0, 0, 0, 429, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 300, 0, 0, 0, 0, 0, 0, 3121152, 3141632, 0, 0, 0, 2924544, 0, 2682880, 0, 0, 0, 0, 0, 0, 0, 1242, 1272, 1273, 0, 1242, 0, 540, 540, 540, 3112960, 2387968, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2453504, 2179072, 2473984, 2482176, 2179072, 2179072, 2179072, 2179072, 2179072, 3010560, 2179072, 2179072, 2126737, 2126737, 2503569, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2532241, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2605969, 2126737, 2924544, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 3035136, 2179072, 2179072, 3072000, 2179072, 2179072, 2179072, 3137536, 2126737, 2126737, 2499473, 2126737, 2126737, 2126737, 2556817, 2565009, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 3224465, 0, 0, 2126810, 2126810, 2126810, 2126810, 2126810, 2446298, 2126810, 3121152, 2179072, 2179072, 3141632, 2179072, 2179072, 2179072, 3170304, 2179072, 2179072, 3190784, 3194880, 2179072, 0, 0, 0, 0, 0, 0, 3181, 0, 0, 0, 3184, 3185, 3186, 0, 0, 3189, 3194880, 2125824, 0, 0, 0, 0, 0, 0, 2387968, 2125824, 2125824, 2420736, 2125824, 2125824, 2125824, 2125824, 2125824, 2453504, 2125824, 2473984, 2482176, 2125824, 2125824, 2125824, 2605056, 2125824, 2629632, 2125824, 2125824, 2650112, 2125824, 2125824, 2125824, 2707456, 2125824, 2736128, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3035136, 2125824, 2125824, 3072000, 2125824, 2125824, 3121152, 2125824, 2125824, 3141632, 2125824, 2125824, 2125824, 3170304, 2125824, 2125824, 3190784, 2125824, 3170304, 2125824, 2125824, 3190784, 3194880, 2125824, 2125824, 2179072, 2125824, 2125824, 2125824, 2179072, 2179072, 3112960, 3219456, 2125824, 2125824, 3112960, 3219456, 2125824, 2125824, 3112960, 3219456, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3507, 540, 540, 540, 540, 540, 540, 0, 3145728, 0, 3203072, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3314, 0, 540, 0, 3067904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172032, 0, 0, 0, 0, 2895872, 0, 0, 0, 2445312, 0, 2842624, 0, 0, 0, 2637824, 0, 0, 0, 0, 432, 0, 0, 0, 329, 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, 0, 0, 0, 2621440, 0, 3182592, 2899968, 0, 2961408, 0, 0, 2179072, 2179072, 2179072, 2179072, 2179072, 2592768, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2125824, 2445312, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2551808, 2179072, 2179072, 2179072, 2179072, 2179072, 3117056, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2126737, 2126737, 2126737, 2126737, 2637824, 2125824, 2125824, 2125824, 2125824, 2727936, 2752512, 2125824, 2125824, 2125824, 2125824, 2842624, 2846720, 2125824, 2895872, 2916352, 2125824, 2125824, 2945024, 2125824, 2125824, 2994176, 2125824, 3002368, 2125824, 2125824, 3022848, 2125824, 3067904, 3084288, 3096576, 2125824, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2442, 2443, 0, 0, 2446, 0, 0, 0, 0, 0, 2928640, 0, 0, 0, 3059712, 0, 2543616, 2666496, 0, 2633728, 0, 0, 0, 0, 0, 1697, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1116, 0, 0, 0, 0, 0, 2494464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3211264, 2179072, 2928640, 2179072, 2179072, 2179072, 2998272, 2179072, 2179072, 2179072, 2179072, 3059712, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 3223552, 0, 0, 2126737, 2126737, 2126737, 2126737, 2126737, 2446225, 2126737, 2179072, 3178496, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2494464, 2125824, 2125824, 2514944, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2179072, 2125824, 2125824, 2125824, 2179072, 2179072, 2179072, 2179072, 2125824, 2125824, 0, 0, 0, 0, 0, 0, 2510848, 2514944, 0, 0, 2547712, 2596864, 0, 0, 0, 0, 0, 1670, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 0, 2125824, 2543616, 2547712, 2125824, 2125824, 2596864, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 2125824, 2125824, 2125824, 2408448, 2125824, 2928640, 2125824, 2125824, 2125824, 2998272, 2125824, 2125824, 2125824, 2125824, 3059712, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 2125824, 2126811, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 2125824, 2125824, 2125824, 2125824, 2424832, 2125824, 3178496, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2494464, 2125824, 2125824, 2514944, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3223552, 0, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 2445312, 2125824, 2125824, 3178496, 2125824, 2179072, 2125824, 2125824, 2179072, 2179072, 2125824, 2125824, 2125824, 2125824, 2441216, 0, 0, 0, 0, 0, 0, 3311, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 2165, 540, 540, 540, 540, 0, 0, 0, 2740224, 0, 0, 0, 0, 0, 2793472, 0, 0, 0, 0, 0, 0, 0, 1244, 0, 0, 0, 0, 1247, 0, 1194, 0, 2646016, 2179072, 2179072, 2695168, 2756608, 2179072, 2179072, 2179072, 2932736, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 3039232, 2179072, 3063808, 2179072, 2179072, 2179072, 2179072, 3129344, 2179072, 2179072, 3153920, 3166208, 3174400, 2396160, 2400256, 2125824, 2125824, 2441216, 2125824, 2469888, 2125824, 2125824, 2125824, 2519040, 2125824, 2125824, 2125824, 2125824, 2588672, 2125824, 2519040, 2125824, 2125824, 2125824, 2125824, 2588672, 2125824, 2613248, 2646016, 2125824, 2125824, 2695168, 2756608, 2125824, 2125824, 2125824, 2125824, 2932736, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2932736, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3129344, 2125824, 2125824, 3153920, 3166208, 3174400, 2396160, 2125824, 2125824, 3129344, 2125824, 2125824, 3153920, 3166208, 3174400, 2125824, 2506752, 2506752, 2506752, 2179072, 2179072, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3223552, 987, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 2445312, 2125824, 0, 3043328, 0, 3149824, 2936832, 0, 2760704, 3176, 0, 0, 0, 0, 2953216, 0, 0, 2826240, 3158016, 2437120, 0, 2785280, 0, 0, 0, 2428928, 0, 3018752, 2764800, 2572288, 0, 0, 3051520, 2179072, 2179072, 2637824, 2179072, 2179072, 2179072, 2179072, 2727936, 2752512, 2179072, 2179072, 2179072, 2842624, 2846720, 2179072, 2916352, 2428928, 2437120, 2179072, 2486272, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2654208, 2678784, 2760704, 2764800, 2854912, 2969600, 2179072, 3006464, 2179072, 3018752, 2179072, 2179072, 2179072, 3149824, 2125824, 2428928, 2437120, 2125824, 2486272, 2125824, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 0, 0, 0, 297, 0, 0, 0, 0, 0, 2043, 2044, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2140, 0, 0, 0, 0, 0, 0, 2125824, 3018752, 2125824, 2125824, 2125824, 3149824, 2125824, 2428928, 2437120, 2125824, 2486272, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 24576, 987, 2125824, 2125824, 2125824, 2125824, 2424832, 2125824, 3149824, 2125824, 2179072, 3051520, 2125824, 3051520, 2125824, 3051520, 0, 2490368, 2498560, 0, 0, 0, 0, 0, 0, 304, 0, 204800, 0, 0, 0, 0, 0, 0, 0, 0, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 1727, 0, 0, 0, 0, 0, 0, 0, 0, 2068, 0, 0, 0, 0, 0, 0, 0, 0, 2095, 0, 0, 0, 0, 0, 0, 0, 0, 2107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2875392, 0, 0, 0, 3176, 0, 0, 2834432, 0, 3227648, 2568192, 0, 0, 0, 0, 2564096, 0, 2940928, 2179072, 2179072, 2498560, 2179072, 2179072, 2179072, 2555904, 2564096, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 3223552, 0, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 2445312, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3137536, 2125824, 2125824, 2498560, 2125824, 2125824, 2125824, 2555904, 2564096, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3223552, 2125824, 2179072, 2416640, 2125824, 2125824, 2179072, 2179072, 2125824, 2125824, 0, 2486272, 0, 0, 0, 0, 0, 2678784, 2854912, 3006464, 0, 3108864, 3198976, 0, 0, 2748416, 2879488, 0, 3176, 0, 0, 0, 0, 0, 0, 0, 0, 2179072, 2179072, 2179072, 2179072, 2179072, 2592768, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2126737, 2125824, 2125824, 2125824, 2125824, 3010560, 2125824, 2125824, 2125824, 2125824, 2502656, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 296, 0, 0, 0, 296, 0, 297, 0, 0, 0, 2125824, 2125824, 2125824, 3010560, 2125824, 2125824, 2125824, 0, 0, 0, 0, 0, 0, 0, 2592768, 0, 0, 0, 0, 433, 0, 0, 0, 453, 469, 469, 469, 469, 469, 469, 469, 469, 469, 479, 469, 469, 469, 469, 469, 469, 2125824, 2125824, 2125824, 2125824, 2592768, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 1918, 2125824, 2125824, 2125824, 2408448, 2125824, 2592768, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2449408, 0, 2535424, 3031040, 0, 0, 0, 0, 0, 1734, 0, 1736, 1710, 540, 540, 540, 540, 540, 540, 540, 540, 1816, 1818, 540, 540, 540, 540, 540, 1360, 0, 2859008, 0, 0, 2179072, 2449408, 2179072, 2535424, 2179072, 2609152, 2179072, 2859008, 2179072, 2179072, 2179072, 3031040, 2125824, 2449408, 2125824, 2535424, 2125824, 2609152, 2125824, 2859008, 2125824, 2125824, 2125824, 3031040, 2125824, 2449408, 2125824, 2535424, 2125824, 2609152, 2125824, 2859008, 2125824, 2125824, 2125824, 3031040, 2125824, 2527232, 0, 0, 0, 0, 0, 2179072, 2125824, 2125824, 2125824, 2179072, 2179072, 2179072, 2179072, 2179072, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2804, 540, 540, 540, 540, 2527232, 2179072, 2179072, 2179072, 2179072, 2179072, 2125824, 2527232, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2527232, 2125824, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 0, 1080, 1084, 0, 0, 1088, 2125824, 2125824, 2125824, 2125824, 3092480, 0, 0, 0, 0, 3026944, 2404352, 2179072, 2179072, 2179072, 2179072, 3026944, 2404352, 2125824, 2125824, 2125824, 2125824, 3026944, 2404352, 2125824, 2125824, 2125824, 2125824, 3026944, 2539520, 0, 2949120, 0, 0, 0, 0, 434, 0, 0, 446, 0, 0, 0, 0, 0, 0, 0, 0, 457, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 2179072, 2658304, 2973696, 2179072, 2125824, 2658304, 2973696, 2125824, 2125824, 2658304, 2973696, 2125824, 2711552, 0, 2560000, 2179072, 2179072, 2945024, 2179072, 2179072, 2994176, 2179072, 3002368, 2179072, 2179072, 3022848, 2179072, 3067904, 3084288, 3096576, 2179072, 2179072, 2600960, 2179072, 2179072, 2179072, 2179072, 2641920, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2719744, 2179072, 2179072, 2441216, 2179072, 2469888, 2179072, 2179072, 2179072, 2519040, 2179072, 2179072, 2179072, 2179072, 2588672, 2179072, 2613248, 2703360, 0, 0, 0, 0, 2977792, 0, 0, 3047424, 3129344, 0, 2981888, 2396160, 0, 3153920, 2560000, 2125824, 2560000, 2125824, 0, 2179072, 2125824, 2125824, 0, 2179072, 2125824, 2125824, 0, 2179072, 2125824, 2125824, 2125824, 2457600, 2179072, 2179072, 2179072, 2179072, 2457600, 2125824, 2125824, 2125824, 2985984, 2985984, 2985984, 2985984, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 249856, 0, 0, 0, 0, 0, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 458, 458, 111050, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 111050, 458, 111050, 111050, 111050, 111050, 111050, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2738, 0, 0, 0, 0, 0, 0, 2183168, 0, 0, 0, 0, 0, 296, 297, 0, 2134016, 300, 301, 0, 0, 0, 0, 0, 0, 184723, 184931, 184931, 184931, 0, 184931, 184931, 184931, 184931, 184931, 0, 0, 0, 0, 0, 184931, 0, 184931, 1, 12290, 3, 78112, 1059, 0, 0, 2179072, 2125824, 2125824, 2125824, 2179072, 2179072, 2179072, 2179072, 2179072, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 296, 0, 297, 0, 2125824, 1059, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2750, 0, 0, 0, 0, 2755, 0, 300, 118784, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1134592, 0, 0, 0, 0, 300, 300, 300, 300, 0, 0, 0, 0, 0, 300, 0, 300, 1, 12290, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 266240, 0, 0, 0, 0, 2183168, 0, 0, 0, 0, 0, 33403, 297, 0, 2134016, 49791, 301, 0, 0, 0, 0, 0, 0, 225889, 225889, 225889, 225889, 225740, 225889, 225889, 225889, 225889, 225889, 225740, 225740, 225740, 225740, 225740, 225906, 225740, 225906, 1, 12290, 3, 0, 0, 0, 0, 249856, 0, 0, 0, 249856, 0, 0, 0, 0, 0, 0, 697, 698, 0, 362, 362, 362, 0, 0, 0, 0, 0, 0, 711, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 296, 0, 0, 0, 0, 0, 0, 0, 0, 2134016, 0, 0, 0, 0, 0, 0, 57344, 0, 0, 0, 0, 0, 0, 0, 3506, 0, 540, 540, 540, 540, 540, 540, 540, 2530, 540, 540, 540, 540, 540, 540, 540, 2125824, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 296, 0, 0, 0, 300, 0, 0, 0, 300, 119195, 73728, 0, 0, 0, 0, 0, 65536, 0, 0, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 0, 0, 0, 0, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 122880, 0, 0, 122880, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3166, 3167, 0, 0, 0, 0, 0, 122880, 0, 122880, 122880, 122880, 0, 0, 0, 0, 0, 122880, 0, 122880, 0, 0, 0, 0, 0, 0, 0, 0, 122880, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 221184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122880, 122880, 122880, 122880, 122880, 0, 122880, 0, 2105629, 12290, 3, 0, 0, 291, 0, 0, 0, 0, 291, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 0, 0, 0, 0, 0, 65536, 0, 0, 0, 0, 2134016, 0, 0, 0, 0, 0, 0, 0, 746, 0, 0, 0, 0, 0, 0, 328, 0, 0, 0, 0, 0, 0, 0, 328, 0, 0, 69632, 73728, 0, 416, 416, 0, 0, 65536, 416, 1092, 0, 2424832, 2433024, 0, 0, 2457600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2765, 0, 0, 0, 0, 0, 1824, 2125824, 2125824, 2125824, 2408448, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2551808, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 131072, 0, 0, 0, 69632, 73728, 0, 0, 0, 0, 0, 65536, 0, 0, 0, 0, 435, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2507, 0, 0, 0, 0, 0, 131072, 0, 0, 131072, 131072, 0, 0, 0, 0, 0, 0, 131072, 0, 131072, 0, 131072, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131072, 0, 131072, 131072, 131072, 131072, 0, 131072, 131072, 131072, 131072, 131072, 0, 0, 0, 0, 0, 131072, 0, 131072, 1, 12290, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 298, 0, 135168, 135168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 320, 321, 0, 0, 0, 135168, 0, 0, 135168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3174, 0, 0, 0, 0, 0, 0, 0, 135168, 135168, 135168, 135168, 135168, 135168, 135168, 0, 135168, 135168, 135168, 135168, 135168, 0, 0, 0, 0, 0, 135168, 0, 135168, 1, 12290, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 118784, 296, 0, 2183168, 0, 0, 0, 0, 0, 636, 637, 0, 2134016, 640, 641, 0, 0, 0, 0, 0, 0, 266240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 266240, 0, 0, 0, 1361, 2125824, 2125824, 2125824, 2125824, 2424832, 2433024, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 986, 2125824, 2125824, 2125824, 2125824, 2424832, 0, 301, 139264, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 331, 0, 331, 301, 301, 301, 301, 0, 0, 0, 0, 0, 301, 0, 301, 1, 12290, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 139264, 297, 0, 2183168, 0, 0, 0, 0, 0, 296, 33406, 0, 2134016, 300, 49794, 0, 0, 0, 0, 0, 0, 1134592, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1134592, 0, 0, 0, 2134016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61440, 0, 0, 0, 0, 647, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2455, 0, 0, 0, 0, 0, 301, 2424832, 2433024, 0, 0, 2457600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2779, 0, 0, 0, 0, 0, 298, 298, 143728, 298, 298, 298, 143728, 69632, 73728, 298, 298, 143658, 298, 298, 65536, 298, 298, 0, 0, 298, 298, 143658, 298, 298, 298, 298, 298, 298, 298, 298, 298, 363, 298, 0, 143658, 298, 298, 298, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 298, 298, 298, 298, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 298, 298, 298, 143658, 368, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 143658, 298, 298, 143658, 298, 298, 143658, 143658, 143658, 143658, 143658, 143658, 298, 0, 298, 0, 298, 298, 298, 143658, 298, 298, 298, 298, 298, 298, 298, 298, 298, 143658, 298, 143658, 143658, 143658, 143658, 298, 298, 143658, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 143728, 298, 298, 298, 298, 298, 298, 298, 143658, 143658, 143658, 143658, 143658, 143658, 143728, 143658, 143728, 143728, 143728, 143728, 143728, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 143658, 1, 12290, 3, 0, 0, 0, 0, 0, 0, 0, 90406, 90406, 90406, 90406, 0, 94503, 0, 0, 0, 3117056, 0, 0, 0, 0, 0, 0, 0, 2200252, 2200252, 0, 0, 0, 0, 0, 0, 1134592, 0, 0, 0, 0, 0, 0, 1134592, 0, 0, 0, 0, 0, 0, 0, 155648, 155648, 0, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 155648, 0, 0, 0, 0, 155648, 0, 0, 0, 0, 0, 0, 345, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1663, 0, 0, 0, 0, 0, 0, 0, 0, 155648, 0, 0, 155648, 0, 0, 0, 0, 0, 0, 0, 155648, 0, 0, 0, 155648, 155648, 0, 155648, 155648, 0, 12290, 3, 0, 0, 2183168, 126976, 0, 0, 0, 0, 296, 297, 0, 2134016, 300, 301, 0, 0, 0, 0, 0, 0, 1146880, 0, 1146880, 0, 0, 0, 0, 0, 0, 0, 1107, 0, 0, 0, 0, 0, 0, 0, 0, 540, 2163, 540, 540, 540, 540, 540, 540, 0, 0, 0, 3117056, 0, 0, 0, 0, 0, 0, 0, 362, 0, 0, 0, 0, 0, 0, 345, 346, 347, 0, 0, 0, 0, 0, 0, 0, 757, 0, 0, 0, 0, 0, 0, 0, 0, 1156, 0, 0, 0, 0, 0, 0, 0, 159744, 159744, 159744, 0, 0, 159744, 0, 0, 0, 0, 0, 0, 0, 0, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 163840, 159744, 159744, 159744, 163840, 159744, 159744, 159744, 159744, 159744, 0, 0, 0, 0, 0, 0, 0, 0, 25160, 0, 0, 159744, 0, 0, 0, 0, 25160, 25160, 25160, 159744, 25160, 25160, 25160, 25160, 25160, 159744, 159744, 159744, 159744, 25160, 159744, 25160, 1, 12290, 3, 0, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 1, 12290, 3, 0, 167936, 167936, 167936, 0, 0, 167936, 0, 0, 0, 0, 0, 0, 0, 0, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3015, 0, 0, 0, 0, 0, 0, 0, 0, 2138112, 1183, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 262144, 0, 0, 0, 0, 172032, 172032, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172032, 0, 0, 0, 0, 0, 0, 172032, 172032, 0, 172032, 0, 0, 172032, 0, 172032, 0, 172032, 0, 0, 0, 0, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 1, 12290, 3, 0, 172032, 0, 172032, 172032, 0, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 172032, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 106496, 0, 0, 0, 0, 0, 1, 286, 3, 0, 0, 0, 292, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 106496, 0, 106496, 0, 0, 0, 0, 106496, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 1, 0, 3, 78112, 176128, 176128, 176128, 0, 0, 176128, 0, 0, 0, 0, 0, 0, 0, 0, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111050, 0, 0, 0, 0, 0, 78112, 290, 0, 634, 0, 0, 0, 296, 297, 0, 2134016, 300, 301, 0, 0, 0, 0, 0, 0, 1159168, 414, 414, 0, 0, 0, 0, 0, 414, 0, 1164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 0, 914, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 959, 561, 585, 585, 585, 1490, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1498, 585, 585, 0, 0, 229376, 0, 0, 0, 0, 0, 0, 0, 0, 1686, 0, 0, 0, 0, 0, 0, 404, 404, 404, 404, 0, 404, 404, 404, 404, 404, 0, 0, 0, 0, 0, 404, 0, 404, 1, 12290, 3, 78112, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1155072, 0, 0, 0, 0, 0, 0, 0, 2131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 658, 0, 0, 0, 561, 561, 561, 561, 561, 561, 2250, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 0, 0, 0, 0, 0, 0, 3295, 0, 0, 0, 0, 0, 0, 0, 712, 0, 0, 0, 716, 0, 0, 719, 0, 561, 561, 2287, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 0, 0, 0, 585, 585, 585, 2347, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1514, 585, 585, 2372, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 2671, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1515, 585, 585, 0, 0, 0, 2994, 0, 0, 0, 2998, 0, 0, 0, 0, 0, 0, 0, 0, 0, 159744, 159744, 159744, 159744, 159744, 159744, 159744, 540, 3035, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 910, 540, 3075, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1417, 3116, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1501, 0, 0, 3178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3187, 0, 0, 0, 0, 0, 2046, 0, 2149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 1, 12290, 3, 0, 540, 540, 540, 3203, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3211, 540, 540, 540, 540, 540, 2813, 540, 540, 2817, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2555, 540, 540, 540, 540, 540, 540, 3255, 585, 585, 585, 3258, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3266, 585, 561, 0, 1287, 585, 1467, 1376, 540, 540, 1339, 540, 540, 561, 561, 1430, 561, 0, 585, 585, 585, 585, 585, 288, 1079, 0, 0, 0, 0, 0, 0, 0, 0, 2427, 0, 0, 0, 0, 0, 0, 0, 0, 2465, 0, 0, 2468, 0, 0, 0, 0, 0, 0, 0, 0, 3309, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 3508, 540, 3509, 540, 540, 540, 3326, 3327, 540, 540, 540, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 961, 561, 585, 585, 585, 3361, 585, 585, 585, 585, 3362, 3363, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1159168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3176, 0, 0, 0, 0, 0, 0, 0, 0, 3387, 0, 0, 0, 0, 0, 2092, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 404, 0, 0, 0, 0, 0, 561, 3416, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 3425, 585, 585, 585, 585, 585, 585, 1492, 585, 585, 585, 585, 585, 585, 585, 1499, 585, 585, 585, 585, 3431, 585, 585, 585, 585, 3435, 540, 561, 585, 0, 0, 0, 0, 0, 0, 665, 0, 0, 668, 0, 0, 0, 0, 0, 0, 0, 3172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 0, 0, 0, 0, 3176, 0, 0, 0, 0, 0, 0, 0, 0, 3450, 540, 540, 540, 540, 540, 2814, 540, 2816, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2233, 540, 540, 540, 540, 540, 0, 561, 561, 561, 3573, 561, 561, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 3538, 585, 585, 3585, 585, 585, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 0, 3627, 561, 561, 585, 585, 0, 540, 561, 585, 0, 540, 561, 585, 0, 540, 561, 585, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2662400, 0, 2813952, 78112, 290, 0, 0, 0, 0, 0, 296, 297, 0, 2134016, 300, 301, 0, 0, 0, 0, 0, 0, 2473984, 2478080, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2976, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2134756, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12290, 3, 0, 0, 0, 188416, 540, 585, 585, 561, 540, 540, 540, 540, 540, 561, 561, 561, 561, 585, 585, 585, 585, 0, 0, 540, 540, 0, 0, 0, 0, 3176, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 540, 2169, 0, 0, 0, 302, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12290, 3, 78112, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 0, 192971, 0, 1, 12290, 3, 0, 192971, 192971, 192971, 0, 0, 192971, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131072, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 322, 0, 0, 0, 0, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 0, 192971, 192971, 192971, 192971, 192971, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2801664, 0, 0, 0, 0, 2142208, 299, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 674, 78112, 290, 0, 0, 0, 0, 0, 296, 297, 0, 299, 300, 301, 0, 0, 0, 0, 0, 0, 2797568, 0, 0, 0, 0, 0, 0, 0, 2850816, 2867200, 0, 0, 740, 404, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 335, 0, 0, 0, 0, 0, 740, 540, 585, 585, 561, 540, 540, 540, 540, 540, 561, 561, 561, 561, 585, 585, 585, 585, 2029, 0, 2031, 0, 0, 0, 0, 740, 1184, 0, 0, 0, 0, 1188, 0, 0, 0, 0, 0, 0, 0, 1583, 0, 1585, 0, 0, 0, 0, 0, 0, 0, 1661, 1662, 0, 0, 0, 0, 0, 0, 0, 0, 2727936, 0, 0, 0, 3084288, 0, 0, 0, 0, 0, 0, 1577, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 351, 352, 353, 354, 0, 0, 0, 1188, 1670, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1150976, 0, 0, 0, 0, 0, 0, 561, 561, 585, 585, 585, 585, 1559, 2029, 0, 0, 0, 0, 1565, 2031, 0, 0, 0, 0, 0, 2120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2130, 2033, 0, 2035, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 336, 337, 338, 561, 561, 2323, 2648, 0, 0, 0, 0, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2339, 585, 585, 2342, 0, 304, 0, 304, 0, 0, 0, 0, 0, 0, 0, 0, 0, 304, 0, 0, 0, 0, 0, 2136, 0, 2138, 0, 0, 0, 0, 0, 0, 0, 0, 791, 817, 0, 817, 812, 0, 0, 0, 0, 0, 0, 204800, 204800, 0, 204800, 204800, 204800, 204800, 204800, 204800, 204800, 204800, 204800, 204800, 204800, 204800, 204800, 205104, 204800, 204800, 205103, 205104, 204800, 205103, 205103, 204800, 204800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 296, 0, 0, 0, 0, 0, 0, 0, 2183801, 0, 0, 0, 0, 0, 296, 297, 151552, 2134016, 300, 301, 0, 212992, 0, 0, 0, 0, 662, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3117056, 0, 0, 0, 0, 0, 0, 0, 0, 2200253, 0, 0, 0, 0, 0, 0, 2932736, 2965504, 0, 0, 3076096, 0, 0, 2695168, 3174400, 2646016, 0, 914, 2126737, 2126737, 2126737, 2126737, 2425745, 2433937, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 0, 0, 987, 2126810, 2126810, 2126810, 2126810, 2425818, 2724753, 2126737, 2732945, 2773905, 2126737, 2126737, 2126737, 2806673, 2126737, 2831249, 2126737, 2126737, 2864017, 2126737, 2126737, 2126737, 2126737, 2126737, 2524049, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2601873, 2126737, 2126737, 2921361, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 3117969, 2126737, 2126737, 2126737, 2126737, 2593681, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126810, 2126810, 2126810, 2126810, 3093393, 0, 0, 0, 0, 3026944, 2404352, 2179072, 2179072, 2179072, 2179072, 3026944, 2434010, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2626522, 2126810, 2126737, 0, 2179072, 2126810, 2126810, 2126737, 2457600, 2179072, 2179072, 2179072, 2179072, 2458513, 2126737, 2126737, 2126737, 2126737, 2126737, 2626449, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2700177, 2126737, 2716561, 2126737, 2806746, 2126810, 2831322, 2126810, 2126810, 2864090, 2126810, 2126810, 2126810, 2126810, 2921434, 2126810, 2126810, 2126810, 2126810, 2126810, 2126737, 2179072, 2126810, 2126810, 2126737, 2179072, 2179072, 2179072, 2179072, 2126737, 2126737, 2126737, 2458586, 2126810, 2126810, 2126810, 2126810, 2183168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 395, 0, 0, 0, 321, 0, 0, 2126737, 2126737, 2126737, 2409361, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 3126161, 2126737, 2126737, 2126737, 2802577, 2814865, 2126737, 2839441, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126810, 2126810, 2126810, 2126810, 2126810, 2663386, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2802650, 2814938, 2126810, 2839514, 0, 0, 0, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2462609, 2466705, 2126737, 0, 2126810, 2126810, 2126810, 2126810, 2126810, 0, 0, 0, 0, 0, 0, 0, 0, 0, 297, 0, 0, 0, 0, 0, 0, 2769809, 2778001, 2126737, 2798481, 2823057, 2126737, 2126737, 2126737, 2884497, 2126737, 2913169, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2655121, 2679697, 2761617, 2765713, 2786193, 2855825, 2970513, 2126737, 3007377, 2126737, 3134353, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 3208081, 2126737, 0, 0, 0, 0, 0, 325, 0, 69632, 73728, 0, 0, 0, 0, 0, 65536, 0, 0, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2462682, 2466778, 2126810, 2126810, 2126810, 2524122, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2601946, 2126810, 2126810, 2126810, 2585562, 2126810, 2126810, 2126810, 2126810, 2126810, 2618330, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2888666, 2126810, 2126810, 2925530, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2642906, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2720730, 2126810, 2126810, 2126810, 2126810, 2126810, 2769882, 2778074, 2126810, 2798554, 2823130, 2126810, 2126810, 2126810, 2884570, 2126810, 2913242, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 3126234, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 3208154, 2126810, 2126737, 2179072, 2126810, 2126810, 2126737, 0, 0, 0, 2388881, 2126737, 2126737, 2421649, 2126737, 2126737, 2126737, 2126737, 2126737, 2454417, 2126737, 2474897, 2483089, 2630545, 2126737, 2126737, 2651025, 2126737, 2126737, 2126737, 2708369, 2126737, 2737041, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 985, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2552794, 2126810, 2126810, 2126810, 2126810, 2126810, 2126737, 2126737, 3072913, 2126737, 2126737, 3122065, 2126737, 2126737, 3142545, 2126737, 2126737, 2126737, 3171217, 2126737, 2126737, 3191697, 3195793, 2126737, 0, 0, 0, 0, 0, 0, 2388954, 2126810, 2126810, 2421722, 2126810, 2126810, 2126810, 2126810, 2126810, 3040218, 2126810, 3064794, 2126810, 2126810, 2126810, 2126810, 3101658, 2126810, 2126810, 3134426, 2126810, 2454490, 2126810, 2474970, 2483162, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2532314, 2126810, 2126810, 2126810, 2126810, 3036122, 2126810, 2126810, 3072986, 2126810, 2126810, 3122138, 2126810, 2126810, 3142618, 2126810, 2126810, 2126810, 3171290, 2126810, 2126810, 3191770, 3195866, 2126810, 2126737, 2179072, 2126810, 2126810, 2126737, 2179072, 2179072, 3112960, 3219456, 2126737, 2126737, 3113873, 3220369, 2126810, 2126810, 3113946, 3220442, 0, 0, 0, 0, 0, 0, 0, 0, 0, 167936, 167936, 167936, 167936, 167936, 167936, 167936, 2638737, 2126737, 2126737, 2126737, 2126737, 2728849, 2753425, 2126737, 2126737, 2126737, 2126737, 2843537, 2847633, 2126737, 2896785, 2917265, 2638810, 2126810, 2126810, 2126810, 2126810, 2728922, 2753498, 2126810, 2126810, 2126810, 2126810, 2843610, 2847706, 2126810, 2896858, 2917338, 2179072, 3178496, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2495377, 2126737, 2126737, 2515857, 2126737, 2126737, 2126737, 2126737, 3011473, 2126737, 2126737, 2126810, 2126810, 2503642, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 3138522, 2126737, 2940928, 2941841, 2941914, 0, 0, 0, 0, 2126737, 2544529, 2548625, 2126737, 2126737, 2597777, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2552721, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2929553, 2126737, 2126737, 2126737, 2999185, 2126737, 2126737, 2126737, 2126737, 3060625, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 3040145, 2126737, 3064721, 2126737, 2126737, 2126737, 2126737, 3101585, 2126737, 2126737, 3179409, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2495450, 2126810, 2126810, 2515930, 2126810, 2126810, 0, 0, 0, 0, 0, 0, 2510848, 2514944, 0, 0, 2547712, 2596864, 0, 0, 0, 0, 0, 2160, 0, 0, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 561, 3525, 561, 2126810, 2544602, 2548698, 2126810, 2126810, 2597850, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126737, 0, 2502656, 0, 0, 3010560, 2126810, 2929626, 2126810, 2126810, 2126810, 2999258, 2126810, 2126810, 2126810, 2126810, 3060698, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 3118042, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126737, 2126810, 3179482, 2126737, 2179072, 2126810, 2126737, 2179072, 2179072, 2126737, 2126737, 2126810, 2126810, 2441216, 0, 0, 0, 0, 0, 326, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 403, 0, 0, 0, 0, 0, 3129344, 2179072, 2179072, 3153920, 3166208, 3174400, 2397073, 2401169, 2126737, 2126737, 2442129, 2126737, 2470801, 2126737, 2126737, 2126737, 2126737, 2126737, 2663313, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 0, 0, 2126810, 2126810, 2126810, 2409434, 2519953, 2126737, 2126737, 2126737, 2126737, 2589585, 2126737, 2614161, 2646929, 2126737, 2126737, 2696081, 2757521, 2126737, 2126737, 2126737, 2126737, 2126737, 3138449, 2126810, 2126810, 2499546, 2126810, 2126810, 2126810, 2556890, 2565082, 2126810, 2126810, 2126737, 2933649, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 3130257, 2126737, 2126737, 3154833, 3167121, 3175313, 2397146, 2401242, 2126810, 2126810, 2442202, 2126810, 2470874, 2126810, 2126810, 2126810, 2520026, 2126810, 2126810, 2126810, 2126810, 2589658, 2126810, 2126810, 2126810, 3011546, 2126810, 2126810, 2126737, 0, 0, 0, 0, 0, 0, 0, 2592768, 0, 0, 0, 0, 663, 0, 0, 666, 667, 0, 0, 0, 0, 0, 0, 0, 540, 571, 540, 571, 540, 540, 571, 540, 595, 2614234, 2647002, 2126810, 2126810, 2696154, 2757594, 2126810, 2126810, 2126810, 2126810, 2933722, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 3224538, 2126737, 2179072, 2417626, 2126810, 2126737, 2179072, 2179072, 2126737, 2126737, 2854912, 2969600, 2179072, 3006464, 2179072, 3018752, 2179072, 2179072, 2179072, 3149824, 2126737, 2429841, 2438033, 2126737, 2487185, 2126737, 2126737, 2945937, 2126737, 2126737, 2995089, 2126737, 3003281, 2126737, 2126737, 3023761, 2126737, 3068817, 3085201, 3097489, 2126737, 2126737, 2888593, 2126737, 2126737, 2925457, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 3036049, 2126737, 3019665, 2126737, 2126737, 2126737, 3150737, 2126810, 2429914, 2438106, 2126810, 2487258, 2126810, 2126810, 2126810, 2126810, 2126810, 2700250, 2126810, 2716634, 2126810, 2724826, 2126810, 2733018, 2773978, 2126810, 2126810, 2126810, 2126810, 3150810, 2126737, 2179072, 3051520, 2126737, 3052433, 2126810, 3052506, 0, 2490368, 2498560, 0, 0, 0, 0, 0, 0, 679, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2126810, 2593754, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126810, 2126737, 2449408, 0, 2535424, 3031040, 0, 0, 0, 0, 0, 2439, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 369, 0, 0, 370, 0, 0, 2126737, 2450321, 2126737, 2536337, 2126737, 2610065, 2126737, 2859921, 2126737, 2126737, 2126737, 3031953, 2126810, 2450394, 2126810, 2536410, 2126810, 2610138, 2126810, 2859994, 2126810, 2126810, 2126810, 3032026, 2126737, 2527232, 0, 0, 0, 0, 0, 2179072, 2126810, 2126810, 2126737, 2179072, 2179072, 2179072, 2179072, 2179072, 2126737, 2126737, 2126737, 2126737, 2126810, 2126810, 2126810, 2126810, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 237568, 0, 0, 0, 0, 2527232, 2179072, 2179072, 2179072, 2179072, 2179072, 2126737, 2528145, 2126737, 2126737, 2126737, 2126737, 2126737, 2126810, 2528218, 2126810, 2126810, 2946010, 2126810, 2126810, 2995162, 2126810, 3003354, 2126810, 2126810, 3023834, 2126810, 3068890, 3085274, 3097562, 2126810, 2126810, 2126810, 2606042, 2126810, 2630618, 2126810, 2126810, 2651098, 2126810, 2126810, 2126810, 2708442, 2126810, 2737114, 2126810, 2126810, 2126810, 2655194, 2679770, 2761690, 2765786, 2786266, 2855898, 2970586, 2126810, 3007450, 2126810, 3019738, 2126810, 2126810, 0, 2486272, 0, 0, 0, 0, 0, 2678784, 2854912, 3006464, 0, 3108864, 3198976, 0, 2405265, 2126737, 2126737, 2126737, 2126737, 3027857, 2405338, 2126810, 2126810, 2126810, 2126810, 3027930, 2539520, 0, 2949120, 0, 0, 0, 0, 695, 0, 0, 0, 0, 362, 362, 362, 0, 0, 704, 0, 0, 0, 0, 709, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2049, 0, 0, 0, 0, 2179072, 2658304, 2973696, 2179072, 2126737, 2659217, 2974609, 2126737, 2126810, 2659290, 2974682, 2126810, 2711552, 0, 2560000, 2179072, 2179072, 3125248, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2125824, 2125824, 2125824, 2125824, 2560913, 2126737, 2560986, 2126810, 0, 2179072, 2126737, 2126810, 0, 2179072, 2126737, 2126810, 0, 2179072, 2126737, 2126810, 2126810, 3130330, 2126810, 2126810, 3154906, 3167194, 3175386, 2126737, 2506752, 2507738, 2507665, 2179072, 2179072, 2126737, 2126737, 2126737, 2642833, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2720657, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2126737, 2585489, 2126737, 2126737, 2126737, 2126737, 2126737, 2618257, 2126737, 2985984, 2985984, 2986897, 2986970, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 397, 0, 0, 0, 0, 221184, 221184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 221184, 221184, 0, 0, 221184, 221184, 221184, 0, 0, 0, 0, 0, 0, 221184, 0, 0, 0, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 332, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 221184, 1, 12290, 3, 0, 0, 0, 0, 0, 253952, 0, 0, 0, 253952, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 687, 688, 0, 0, 0, 0, 0, 98304, 0, 0, 0, 53248, 0, 0, 0, 0, 0, 2662400, 0, 2813952, 297, 0, 300, 0, 0, 0, 300, 0, 301, 0, 0, 0, 301, 0, 0, 0, 301, 69632, 139679, 0, 0, 0, 0, 0, 65536, 0, 0, 0, 0, 3133440, 0, 98304, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2179072, 2179072, 2179072, 2179072, 2179072, 300, 0, 301, 0, 0, 0, 2473984, 2478080, 0, 0, 0, 0, 0, 0, 0, 0, 0, 176128, 176128, 176128, 176128, 176128, 176128, 176128, 3121152, 2179072, 2179072, 3141632, 2179072, 2179072, 2179072, 3170304, 2179072, 2179072, 3190784, 3194880, 2179072, 914, 0, 0, 0, 0, 0, 2451, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 301, 301, 0, 0, 0, 0, 0, 914, 0, 2387968, 2125824, 2125824, 2420736, 2125824, 2125824, 2125824, 2125824, 2125824, 2453504, 2125824, 2473984, 2482176, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2531328, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2605056, 2125824, 3194880, 2125824, 987, 0, 0, 0, 987, 0, 2387968, 2125824, 2125824, 2420736, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2887680, 2125824, 2125824, 2924544, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3035136, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 225740, 0, 0, 0, 0, 0, 0, 0, 0, 0, 348, 349, 350, 0, 0, 0, 0, 2125824, 237568, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 0, 0, 0, 0, 0, 0, 358, 0, 0, 0, 0, 0, 358, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 249856, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 0, 0, 0, 0, 0, 0, 0, 2183168, 0, 0, 0, 0, 0, 296, 297, 0, 2134016, 300, 301, 0, 0, 217088, 2125824, 241664, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 0, 0, 0, 0, 131072, 131072, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 0, 0, 0, 0, 155648, 0, 0, 2183168, 0, 0, 270336, 0, 0, 296, 297, 0, 2134016, 300, 301, 200704, 0, 0, 0, 0, 0, 2462, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1261, 0, 0, 0, 0, 0, 2125824, 0, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 180224, 0, 0, 0, 0, 0, 0, 0, 1726, 0, 0, 0, 0, 0, 0, 0, 0, 304, 304, 304, 0, 0, 0, 0, 0, 0, 2748416, 2879488, 0, 20480, 0, 0, 0, 0, 0, 0, 0, 0, 2179072, 2179072, 2179072, 2179072, 2768896, 2777088, 2797568, 2822144, 2179072, 2179072, 2179072, 2883584, 2912256, 2179072, 2179072, 2179072, 2179072, 2179072, 2617344, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2662400, 2179072, 2179072, 2179072, 2179072, 2179072, 3010560, 2179072, 2179072, 2125824, 2125824, 2502656, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2584576, 2125824, 2125824, 2125824, 2125824, 2125824, 2617344, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 266240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2142208, 0, 0, 0, 266240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12290, 2113823, 0, 0, 0, 0, 0, 0, 293, 0, 0, 0, 293, 0, 0, 245760, 0, 0, 2179072, 2125824, 2125824, 2125824, 2179072, 2179072, 2179072, 2179072, 2179072, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3039232, 2125824, 3063808, 2125824, 2125824, 2125824, 2125824, 3100672, 2125824, 2125824, 3133440, 2125824, 245760, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 0, 0, 122880, 122880, 0, 0, 274432, 274432, 274432, 274432, 0, 0, 0, 0, 0, 274432, 0, 274432, 1, 12290, 3, 0, 0, 0, 0, 725, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1192, 0, 1195, 0, 0, 78112, 290, 0, 0, 0, 0, 0, 296, 297, 0, 0, 300, 301, 0, 0, 0, 0, 0, 328, 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2200252, 2200252, 2200252, 0, 0, 0, 0, 0, 0, 0, 2033, 0, 0, 0, 0, 0, 2035, 0, 0, 0, 0, 0, 0, 0, 2055, 0, 2056, 0, 0, 0, 0, 0, 0, 0, 2067, 0, 0, 0, 0, 0, 0, 0, 0, 1187, 0, 0, 0, 0, 0, 0, 1104, 2483, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 690, 0, 0, 2993, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 383, 335, 0, 0, 0, 0, 1679, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 694, 0, 0, 0, 0, 0, 0, 741, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 730, 0, 0, 0, 0, 0, 0, 78456, 290, 0, 0, 0, 0, 0, 296, 297, 0, 0, 300, 301, 0, 0, 0, 0, 0, 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1158, 0, 0, 0, 0, 0, 562, 562, 562, 562, 562, 562, 562, 586, 586, 586, 540, 586, 586, 586, 586, 586, 562, 562, 540, 562, 586, 562, 586, 1, 12290, 3, 78112, 0, 0, 2771, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 521, 521, 1, 12290, 3, 78113, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 301, 0, 0, 0, 0, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 1, 12290, 3, 0, 282624, 282624, 282624, 0, 0, 282624, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3178496, 2670592, 0, 2744320, 0, 0, 0, 0, 0, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 0, 282624, 282624, 282624, 282624, 282624, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 0, 290, 0, 0, 0, 0, 3176, 0, 0, 2740224, 0, 0, 0, 0, 0, 2793472, 0, 0, 0, 0, 0, 0, 0, 2094, 0, 0, 0, 0, 0, 0, 0, 0, 683, 684, 685, 0, 0, 0, 689, 0, 0, 0, 0, 286720, 286720, 0, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 286720, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 0, 302, 0, 0, 0, 0, 0, 3043328, 0, 3149824, 2936832, 0, 2760704, 3301, 0, 0, 0, 0, 2953216, 0, 0, 2826240, 2875392, 0, 0, 0, 3381, 0, 0, 2834432, 0, 3227648, 2568192, 0, 0, 0, 0, 2564096, 0, 2748416, 2879488, 0, 3381, 0, 0, 0, 0, 0, 0, 0, 0, 2179072, 2179072, 2179072, 2531328, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2179072, 2605056, 2179072, 2629632, 2179072, 2179072, 0, 0, 0, 306, 0, 0, 0, 0, 0, 305, 0, 305, 306, 0, 305, 305, 0, 0, 0, 305, 305, 306, 306, 0, 0, 0, 0, 0, 0, 305, 405, 306, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 750, 0, 0, 0, 306, 410, 0, 0, 69632, 73728, 0, 0, 0, 0, 0, 65536, 0, 0, 0, 0, 742, 0, 0, 0, 0, 742, 0, 748, 0, 0, 0, 0, 0, 0, 1192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 462, 462, 462, 488, 488, 462, 488, 488, 488, 488, 488, 488, 488, 513, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 533, 488, 488, 488, 488, 488, 541, 563, 541, 563, 541, 541, 563, 541, 587, 563, 563, 563, 563, 563, 563, 563, 587, 587, 587, 541, 613, 613, 613, 613, 613, 587, 563, 563, 541, 563, 587, 563, 587, 1, 12290, 3, 78112, 0, 0, 645, 0, 0, 648, 649, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 0, 253952, 0, 0, 0, 0, 0, 645, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 762, 0, 0, 0, 0, 0, 353, 0, 351, 0, 472, 472, 472, 472, 472, 472, 472, 477, 472, 472, 472, 472, 472, 472, 472, 472, 472, 477, 472, 0, 768, 0, 0, 772, 0, 0, 0, 0, 0, 0, 781, 0, 0, 0, 0, 0, 0, 727, 0, 0, 0, 731, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 0, 0, 0, 343, 342, 65536, 341, 0, 788, 0, 0, 0, 0, 792, 0, 0, 0, 0, 0, 0, 0, 796, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 782, 0, 0, 0, 0, 736, 0, 796, 0, 0, 0, 0, 648, 0, 0, 0, 0, 0, 0, 820, 0, 0, 648, 0, 0, 0, 0, 0, 837, 792, 0, 0, 0, 0, 0, 841, 842, 792, 792, 0, 0, 0, 0, 792, 736, 792, 0, 540, 540, 851, 855, 540, 540, 540, 540, 1345, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2181, 540, 540, 540, 540, 561, 561, 561, 921, 925, 561, 561, 561, 561, 561, 561, 951, 561, 956, 561, 963, 561, 966, 561, 561, 980, 561, 561, 0, 585, 585, 585, 994, 998, 585, 585, 585, 585, 585, 585, 1963, 1964, 1966, 585, 585, 585, 585, 585, 585, 585, 561, 2713, 585, 2715, 2716, 540, 540, 540, 540, 585, 585, 585, 1024, 585, 1029, 585, 1036, 585, 1039, 585, 585, 1053, 585, 585, 966, 0, 0, 0, 855, 585, 998, 925, 851, 1065, 894, 540, 540, 921, 1070, 966, 561, 0, 585, 585, 585, 585, 585, 78112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 114688, 0, 241664, 258048, 0, 0, 0, 1093, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 766, 0, 0, 1214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 672, 673, 0, 540, 540, 1342, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 0, 0, 0, 585, 585, 585, 1524, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1517, 585, 585, 585, 1433, 0, 540, 585, 585, 561, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 561, 561, 3070, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 0, 0, 0, 3662, 0, 0, 0, 1641, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1103, 1104, 1105, 1106, 1654, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 785, 0, 1693, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 305, 306, 0, 1732, 0, 0, 1733, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 540, 3030, 540, 540, 540, 540, 540, 540, 540, 1745, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1758, 540, 540, 540, 540, 540, 540, 2540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1329, 540, 540, 540, 540, 540, 540, 540, 540, 1795, 540, 540, 1798, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 900, 540, 540, 540, 540, 540, 540, 1810, 540, 540, 540, 540, 540, 1815, 540, 540, 540, 540, 540, 540, 540, 1360, 914, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1416, 561, 1825, 561, 561, 561, 561, 1831, 561, 561, 561, 561, 561, 1837, 561, 561, 561, 561, 561, 983, 561, 0, 585, 585, 585, 585, 585, 1002, 585, 1010, 561, 1892, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1904, 561, 561, 561, 561, 585, 585, 585, 585, 0, 0, 0, 2726, 0, 0, 2729, 2730, 561, 561, 1909, 561, 561, 561, 561, 561, 561, 561, 26027, 1919, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 540, 3649, 540, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 561, 561, 3231, 3232, 561, 1925, 585, 585, 585, 585, 585, 1931, 585, 585, 585, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 3596, 1944, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1540, 561, 561, 2025, 585, 585, 585, 0, 2029, 0, 0, 0, 0, 0, 2031, 0, 0, 0, 0, 0, 2487, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122880, 0, 0, 0, 0, 0, 0, 0, 2041, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1132, 0, 0, 0, 2075, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1135, 0, 2145, 0, 0, 0, 2143, 0, 0, 2150, 0, 0, 0, 0, 0, 0, 0, 0, 159744, 0, 0, 0, 0, 0, 0, 0, 0, 1234, 0, 0, 0, 0, 0, 0, 0, 0, 1584, 0, 0, 0, 0, 0, 0, 0, 0, 1700, 0, 0, 0, 0, 1705, 0, 0, 540, 540, 2171, 540, 540, 2174, 540, 540, 540, 540, 540, 540, 2182, 540, 540, 540, 540, 540, 540, 2568, 540, 540, 540, 540, 2572, 540, 540, 540, 540, 540, 540, 1347, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2556, 540, 540, 540, 540, 540, 540, 540, 2201, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 0, 0, 2242, 540, 540, 540, 2214, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1805, 540, 540, 0, 0, 0, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2254, 561, 0, 585, 585, 585, 585, 585, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 0, 2123, 0, 2125, 2126, 0, 0, 0, 0, 561, 2257, 561, 561, 561, 561, 561, 561, 2265, 561, 561, 561, 561, 561, 561, 561, 0, 0, 585, 585, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 540, 2952, 561, 2954, 561, 2299, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1438, 561, 2033, 0, 2035, 0, 0, 2426, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2434, 0, 0, 0, 2475, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1193, 0, 0, 0, 0, 2484, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2493, 0, 0, 0, 0, 0, 0, 756, 0, 0, 0, 0, 0, 0, 763, 0, 0, 0, 0, 0, 561, 561, 561, 561, 561, 561, 561, 561, 2592, 561, 561, 561, 561, 561, 1408, 561, 561, 1412, 561, 561, 561, 561, 561, 561, 561, 0, 585, 585, 585, 585, 585, 585, 1008, 585, 2656, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2664, 585, 585, 585, 585, 585, 585, 2350, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2379, 585, 585, 585, 585, 585, 585, 585, 585, 2699, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1940, 585, 585, 2708, 585, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 540, 540, 540, 540, 540, 540, 561, 561, 561, 3229, 561, 561, 561, 561, 561, 561, 585, 585, 585, 3352, 585, 585, 585, 3355, 585, 585, 2731, 0, 0, 0, 0, 0, 0, 2736, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 192971, 0, 0, 0, 2759, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1234, 540, 540, 540, 0, 0, 0, 2788, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1238, 0, 0, 0, 540, 540, 540, 2826, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2833, 540, 540, 540, 540, 1748, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1760, 540, 540, 540, 540, 1765, 540, 540, 540, 540, 540, 540, 540, 540, 1772, 540, 540, 540, 540, 561, 3406, 561, 561, 3408, 561, 561, 561, 561, 561, 561, 561, 0, 585, 585, 585, 585, 585, 585, 1009, 585, 561, 561, 561, 2860, 561, 561, 2864, 561, 561, 561, 561, 561, 561, 561, 561, 561, 944, 561, 561, 561, 561, 561, 561, 561, 2873, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2881, 561, 561, 0, 0, 0, 2649, 0, 1920, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2703, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2908, 585, 585, 2912, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2393, 2394, 585, 585, 585, 585, 585, 2921, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2929, 585, 585, 0, 0, 0, 3292, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3297, 2955, 585, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 306, 305, 0, 0, 0, 2970, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1588, 1589, 0, 0, 540, 540, 540, 540, 3036, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2546, 540, 540, 540, 561, 561, 561, 3076, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1436, 561, 561, 561, 585, 585, 585, 3117, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2356, 585, 2358, 0, 0, 0, 0, 3176, 3442, 0, 3444, 0, 0, 0, 0, 0, 540, 3451, 540, 540, 540, 540, 1796, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 905, 540, 540, 540, 540, 3453, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 561, 3466, 561, 3468, 0, 0, 3501, 0, 0, 0, 0, 0, 0, 540, 540, 540, 540, 3510, 540, 540, 540, 540, 540, 3204, 3205, 540, 540, 540, 540, 3209, 3210, 540, 540, 540, 540, 540, 1749, 1750, 540, 540, 540, 540, 1757, 540, 540, 540, 540, 540, 540, 1346, 540, 540, 540, 540, 540, 540, 1356, 540, 540, 307, 308, 309, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 734, 0, 0, 0, 0, 418, 0, 0, 0, 0, 0, 449, 0, 0, 0, 0, 0, 0, 0, 0, 286720, 0, 0, 0, 0, 0, 0, 0, 0, 2490, 0, 0, 0, 0, 0, 0, 0, 0, 2504, 0, 0, 0, 0, 0, 0, 0, 0, 2517, 0, 0, 0, 0, 0, 0, 0, 0, 2975, 0, 0, 0, 0, 0, 0, 0, 0, 2999, 0, 0, 0, 0, 0, 0, 0, 0, 3164, 0, 0, 0, 0, 0, 0, 0, 0, 3173, 0, 0, 0, 0, 0, 0, 0, 0, 3183, 0, 0, 0, 0, 0, 0, 0, 0, 155648, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 449, 449, 418, 449, 449, 449, 449, 449, 449, 449, 449, 449, 449, 449, 449, 532, 449, 532, 532, 532, 449, 532, 532, 532, 532, 449, 542, 564, 542, 564, 542, 542, 564, 542, 588, 564, 564, 564, 564, 564, 564, 564, 588, 588, 588, 542, 588, 588, 588, 588, 588, 564, 564, 616, 621, 588, 621, 627, 1, 12290, 3, 78112, 0, 1677, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1163, 540, 540, 540, 1811, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1360, 914, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1377, 561, 0, 585, 585, 585, 585, 585, 78112, 1079, 0, 0, 1082, 1086, 0, 0, 1090, 585, 585, 585, 1993, 585, 585, 585, 585, 585, 1999, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 3551, 0, 3553, 0, 0, 0, 0, 0, 561, 561, 561, 561, 561, 2589, 561, 561, 561, 561, 2593, 561, 561, 0, 2648, 0, 0, 0, 0, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2338, 585, 585, 585, 585, 585, 585, 585, 2657, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1971, 585, 585, 585, 2709, 585, 585, 585, 585, 561, 540, 585, 585, 561, 540, 540, 540, 540, 540, 540, 561, 561, 3228, 561, 561, 561, 561, 561, 561, 561, 0, 0, 585, 2900, 585, 585, 585, 585, 585, 540, 3514, 540, 3516, 540, 540, 3518, 540, 561, 561, 561, 561, 561, 561, 561, 561, 1396, 1398, 561, 561, 561, 561, 561, 561, 3527, 561, 3529, 561, 561, 3531, 561, 585, 585, 585, 585, 585, 585, 585, 585, 3540, 585, 3542, 585, 585, 3544, 585, 561, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 362, 362, 0, 0, 0, 147456, 0, 0, 0, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 0, 0, 0, 0, 0, 373, 0, 0, 0, 0, 365, 0, 382, 0, 348, 0, 0, 310, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 328, 0, 0, 0, 313, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 764, 0, 0, 420, 428, 419, 428, 0, 310, 428, 441, 450, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 484, 489, 489, 500, 489, 489, 489, 489, 489, 489, 489, 489, 515, 515, 528, 528, 529, 529, 529, 529, 529, 529, 529, 529, 529, 529, 515, 529, 529, 529, 529, 529, 543, 565, 543, 565, 543, 543, 565, 543, 589, 565, 565, 565, 565, 565, 565, 565, 589, 589, 589, 612, 589, 589, 589, 589, 589, 614, 615, 615, 612, 615, 614, 615, 614, 1, 12290, 3, 78112, 0, 702, 0, 0, 0, 0, 0, 702, 0, 0, 0, 540, 540, 540, 540, 540, 3028, 540, 540, 540, 540, 540, 540, 540, 561, 967, 561, 561, 561, 561, 561, 0, 585, 585, 585, 585, 585, 585, 585, 585, 2337, 585, 585, 585, 585, 2341, 585, 0, 1108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 3200, 0, 1150, 1108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1102, 0, 0, 0, 1228, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1240, 0, 0, 540, 540, 1276, 1278, 540, 540, 540, 540, 540, 540, 540, 540, 1292, 540, 1297, 540, 540, 1301, 540, 540, 540, 540, 1812, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1823, 1360, 914, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1378, 561, 0, 585, 585, 585, 585, 585, 78112, 1079, 0, 0, 1083, 1087, 0, 0, 1091, 540, 1304, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1302, 540, 1360, 914, 561, 561, 1364, 561, 1367, 561, 561, 561, 561, 561, 561, 561, 561, 1381, 561, 1386, 561, 561, 1390, 561, 561, 1393, 561, 561, 561, 561, 561, 561, 561, 561, 1431, 561, 561, 1435, 561, 561, 561, 561, 1484, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1942, 540, 1793, 1794, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 0, 2584, 0, 585, 585, 1946, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2005, 585, 585, 585, 1959, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2357, 585, 2102, 0, 0, 0, 0, 1670, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 328, 379, 381, 0, 0, 0, 0, 0, 2133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1119, 0, 0, 2033, 0, 2035, 0, 0, 0, 0, 0, 0, 2428, 0, 0, 0, 0, 0, 0, 0, 2122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122880, 0, 122880, 122880, 122880, 122880, 122880, 0, 0, 2474, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1133, 0, 0, 0, 0, 0, 0, 2760, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 380, 0, 0, 0, 384, 0, 0, 2799, 0, 0, 0, 0, 0, 0, 0, 2803, 540, 540, 540, 540, 540, 540, 540, 1326, 540, 540, 540, 540, 540, 540, 540, 1339, 585, 2956, 0, 0, 0, 0, 0, 2962, 0, 0, 0, 0, 0, 0, 0, 2966, 0, 0, 0, 3008, 0, 0, 0, 0, 0, 0, 0, 0, 3017, 0, 0, 0, 0, 0, 383, 0, 69632, 73728, 0, 0, 0, 0, 0, 65536, 0, 3048, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1320, 3089, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1858, 3130, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1957, 540, 3225, 540, 540, 540, 540, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3414, 585, 585, 585, 3281, 585, 585, 585, 585, 561, 540, 585, 561, 540, 540, 561, 561, 585, 585, 0, 0, 0, 3157, 3513, 540, 540, 540, 540, 540, 540, 540, 561, 3521, 561, 3522, 561, 561, 561, 3526, 540, 540, 540, 3664, 561, 561, 561, 3666, 585, 585, 585, 3668, 0, 0, 540, 540, 540, 3560, 540, 540, 540, 540, 540, 540, 540, 540, 3568, 561, 321, 321, 371, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1161, 0, 0, 0, 0, 371, 0, 430, 436, 0, 442, 451, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, 490, 490, 501, 490, 490, 490, 490, 490, 490, 490, 490, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, 544, 566, 544, 566, 544, 544, 566, 544, 590, 566, 566, 566, 566, 566, 566, 566, 590, 590, 590, 544, 590, 590, 590, 590, 590, 566, 566, 544, 566, 590, 566, 590, 1, 12290, 3, 78112, 540, 540, 540, 874, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1822, 540, 1360, 585, 1017, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 540, 540, 540, 540, 561, 561, 1122, 0, 1124, 1125, 0, 0, 0, 1127, 1128, 0, 0, 0, 0, 0, 0, 0, 0, 1159168, 0, 1159168, 0, 0, 0, 0, 1159168, 0, 0, 1166, 1167, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1634, 0, 0, 0, 1113, 0, 1253, 0, 0, 0, 0, 0, 1128, 0, 0, 0, 0, 0, 1236, 0, 0, 0, 0, 773, 774, 0, 0, 778, 779, 0, 675, 0, 0, 0, 0, 0, 0, 1598, 0, 0, 0, 0, 0, 0, 0, 0, 1605, 0, 0, 1268, 1127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 1277, 540, 540, 540, 1323, 540, 540, 1325, 540, 540, 1328, 540, 540, 540, 540, 540, 540, 540, 540, 2554, 540, 540, 540, 540, 540, 540, 2560, 1360, 914, 561, 561, 1365, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1400, 561, 561, 561, 561, 561, 561, 1404, 561, 561, 561, 561, 561, 561, 561, 1413, 561, 561, 1415, 561, 561, 0, 2648, 0, 0, 0, 0, 585, 585, 585, 585, 585, 585, 585, 2655, 561, 1419, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1874, 561, 561, 561, 1443, 561, 561, 561, 561, 561, 26027, 1360, 987, 585, 585, 1456, 585, 585, 0, 0, 3291, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1262, 0, 0, 0, 1266, 585, 585, 585, 1504, 585, 585, 1506, 585, 585, 585, 1510, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 540, 540, 540, 2020, 561, 561, 0, 0, 0, 1657, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1675, 0, 0, 0, 585, 1991, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2695, 561, 2024, 585, 585, 585, 2028, 0, 2029, 0, 0, 0, 0, 0, 2031, 0, 0, 0, 0, 0, 2502, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1586, 1587, 0, 0, 0, 0, 0, 0, 0, 2033, 0, 0, 0, 0, 0, 2035, 0, 0, 0, 0, 0, 2038, 0, 0, 2077, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1177, 0, 0, 0, 0, 0, 0, 2091, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 2807, 540, 0, 0, 0, 561, 561, 561, 561, 561, 561, 561, 561, 2252, 561, 561, 561, 561, 561, 1447, 561, 561, 26027, 1360, 987, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 2017, 540, 540, 540, 2021, 561, 2256, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1875, 2272, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1890, 561, 561, 561, 2314, 561, 2316, 561, 561, 561, 561, 561, 561, 561, 0, 0, 0, 0, 0, 0, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2340, 585, 585, 585, 2399, 585, 2401, 585, 585, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 540, 540, 561, 561, 540, 540, 2564, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3212, 540, 0, 0, 0, 561, 561, 561, 561, 2588, 561, 561, 561, 561, 561, 561, 561, 561, 1916, 561, 26027, 0, 585, 585, 585, 585, 0, 2757, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 735, 0, 2834, 540, 540, 540, 540, 540, 540, 540, 2840, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2571, 540, 540, 540, 540, 540, 540, 2882, 561, 561, 561, 561, 561, 561, 561, 2888, 561, 561, 561, 561, 561, 561, 561, 0, 0, 585, 585, 585, 2902, 585, 585, 585, 2930, 585, 585, 585, 585, 585, 585, 585, 2936, 585, 585, 585, 585, 585, 585, 585, 561, 540, 2714, 585, 561, 540, 540, 540, 540, 540, 540, 3226, 540, 540, 540, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3074, 585, 585, 585, 585, 3282, 585, 585, 585, 561, 540, 585, 561, 540, 540, 561, 561, 585, 585, 0, 0, 3156, 0, 585, 585, 3369, 540, 540, 561, 561, 585, 585, 0, 0, 0, 0, 0, 0, 0, 0, 2617344, 0, 0, 0, 0, 0, 2789376, 0, 0, 0, 0, 0, 3176, 0, 0, 0, 3445, 0, 0, 0, 0, 540, 540, 540, 540, 3027, 540, 540, 540, 540, 3031, 540, 540, 540, 540, 540, 540, 3456, 540, 540, 540, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 3524, 561, 561, 561, 561, 3471, 561, 561, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3486, 585, 585, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 3626, 540, 540, 540, 3515, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3413, 561, 561, 3528, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3113, 585, 585, 585, 3541, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 362, 208896, 0, 0, 0, 0, 323, 324, 325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1194, 1196, 0, 0, 0, 0, 322, 370, 325, 369, 0, 0, 0, 0, 0, 0, 0, 0, 0, 364, 0, 0, 0, 0, 0, 0, 322, 0, 0, 369, 369, 399, 0, 325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 233472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 324, 0, 0, 0, 322, 452, 465, 465, 465, 465, 465, 465, 465, 478, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 491, 491, 465, 491, 491, 506, 508, 491, 491, 506, 491, 517, 517, 517, 517, 517, 517, 517, 517, 517, 517, 517, 517, 517, 534, 517, 517, 517, 517, 517, 545, 567, 545, 567, 545, 545, 567, 545, 591, 567, 567, 567, 567, 567, 567, 567, 591, 591, 591, 545, 591, 591, 591, 591, 591, 567, 567, 545, 567, 591, 567, 591, 1, 12290, 3, 78112, 659, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 670, 671, 0, 0, 0, 0, 0, 439, 0, 0, 0, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 557, 580, 557, 580, 557, 557, 580, 557, 604, 0, 0, 707, 708, 0, 0, 0, 0, 0, 714, 0, 0, 0, 718, 0, 720, 0, 769, 770, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1209, 0, 0, 787, 0, 789, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1224, 0, 0, 0, 801, 0, 806, 0, 809, 0, 0, 0, 0, 806, 809, 0, 0, 0, 809, 0, 707, 0, 0, 826, 0, 0, 0, 0, 0, 826, 826, 829, 809, 806, 0, 0, 0, 0, 0, 0, 0, 789, 0, 801, 0, 818, 0, 0, 0, 0, 0, 2745, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 811, 540, 540, 854, 540, 540, 0, 0, 0, 789, 0, 0, 0, 0, 0, 838, 0, 0, 0, 0, 0, 0, 0, 2142, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2819, 540, 540, 540, 540, 540, 0, 0, 0, 787, 0, 0, 0, 838, 818, 838, 0, 540, 540, 852, 540, 858, 540, 540, 871, 540, 881, 540, 886, 540, 540, 893, 896, 901, 540, 909, 540, 540, 540, 540, 540, 3215, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 895, 540, 540, 540, 540, 540, 561, 561, 561, 922, 561, 928, 561, 561, 941, 561, 561, 952, 561, 957, 561, 561, 0, 2648, 0, 0, 0, 0, 585, 585, 585, 585, 585, 2653, 585, 585, 0, 0, 2959, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2965, 0, 965, 968, 973, 561, 981, 561, 561, 0, 585, 585, 585, 995, 585, 1001, 585, 585, 0, 2958, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131072, 131072, 0, 0, 1014, 585, 585, 1025, 585, 1030, 585, 585, 1038, 1041, 1046, 585, 1054, 585, 585, 968, 0, 0, 0, 540, 585, 585, 561, 852, 540, 1066, 901, 540, 922, 561, 1071, 973, 0, 0, 0, 1110, 0, 0, 0, 0, 0, 0, 0, 1117, 0, 0, 0, 0, 0, 0, 775, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1205, 0, 0, 0, 0, 0, 0, 0, 1137, 1138, 0, 0, 0, 0, 1142, 0, 0, 0, 362, 362, 0, 0, 0, 0, 0, 664, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1206, 0, 0, 0, 0, 0, 0, 1165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 784, 0, 0, 0, 1182, 741, 0, 0, 0, 1134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 245760, 0, 0, 0, 0, 0, 0, 1303, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1318, 540, 540, 540, 540, 2173, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2558, 540, 540, 540, 1360, 914, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1372, 561, 561, 561, 561, 561, 1850, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1902, 1903, 561, 561, 561, 561, 561, 561, 1387, 561, 561, 561, 1392, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1432, 561, 561, 561, 561, 561, 1439, 561, 561, 561, 1421, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1437, 561, 0, 585, 585, 585, 1049, 585, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 836, 0, 0, 0, 0, 0, 0, 811, 0, 585, 585, 585, 585, 1463, 585, 585, 585, 585, 585, 585, 1478, 585, 585, 585, 1483, 0, 0, 1608, 1609, 1610, 0, 1612, 1613, 0, 0, 0, 0, 1618, 0, 0, 0, 0, 0, 679, 751, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2144, 0, 0, 1640, 0, 0, 1643, 0, 1645, 0, 0, 0, 0, 0, 1651, 1652, 0, 0, 0, 0, 785, 0, 0, 0, 0, 0, 0, 540, 846, 540, 540, 540, 540, 540, 540, 3216, 540, 540, 540, 540, 540, 3221, 540, 3223, 540, 0, 1668, 0, 0, 1670, 0, 0, 0, 0, 1672, 1673, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 0, 0, 0, 347, 345, 65536, 0, 1692, 0, 0, 0, 0, 0, 1698, 1699, 0, 1701, 1702, 1703, 0, 0, 0, 0, 0, 0, 810, 811, 0, 0, 0, 0, 811, 0, 0, 0, 1719, 0, 0, 0, 1723, 1724, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 346, 0, 0, 0, 0, 0, 0, 0, 1715, 0, 0, 0, 1735, 1585, 1585, 1737, 540, 1739, 540, 1740, 540, 1742, 540, 540, 540, 1746, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1759, 540, 540, 540, 540, 540, 3318, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2557, 540, 540, 540, 540, 540, 540, 1763, 540, 540, 540, 540, 1767, 540, 1769, 540, 540, 540, 540, 540, 540, 540, 540, 2570, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3041, 540, 540, 540, 540, 540, 540, 540, 540, 1777, 1778, 1780, 540, 540, 540, 540, 540, 540, 1787, 1788, 540, 540, 1791, 1792, 540, 540, 540, 540, 540, 540, 540, 1800, 540, 540, 540, 1804, 540, 540, 540, 540, 540, 540, 2829, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1770, 540, 540, 540, 540, 540, 0, 1828, 561, 1830, 561, 561, 1832, 561, 1834, 561, 561, 561, 1838, 561, 561, 561, 561, 585, 585, 585, 585, 0, 0, 2725, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 0, 135168, 135168, 0, 0, 65536, 135168, 1859, 561, 1861, 561, 561, 561, 561, 561, 561, 561, 561, 1869, 1870, 1872, 561, 561, 0, 2648, 0, 0, 0, 0, 585, 585, 585, 585, 2652, 585, 585, 585, 585, 585, 585, 2390, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3124, 585, 585, 585, 585, 585, 561, 561, 561, 1894, 561, 561, 561, 1898, 561, 561, 561, 561, 561, 561, 561, 1906, 585, 1926, 585, 1928, 585, 585, 585, 1932, 585, 585, 585, 585, 585, 585, 585, 585, 561, 540, 585, 561, 540, 540, 561, 561, 585, 585, 0, 0, 0, 0, 585, 1945, 585, 585, 585, 585, 1949, 585, 585, 585, 585, 1953, 585, 1955, 585, 585, 561, 3146, 3147, 3148, 540, 540, 561, 561, 585, 585, 0, 0, 0, 0, 0, 0, 2488, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2096, 0, 0, 0, 0, 0, 0, 1974, 1975, 1976, 585, 585, 1979, 1980, 585, 585, 585, 585, 585, 585, 585, 1988, 585, 561, 0, 1288, 585, 1468, 1377, 540, 540, 540, 1549, 540, 561, 561, 561, 1553, 585, 585, 1992, 585, 585, 585, 585, 585, 585, 585, 2000, 585, 585, 585, 585, 585, 561, 561, 540, 561, 585, 561, 585, 1, 12290, 3, 78112, 585, 585, 585, 585, 2011, 561, 540, 2014, 585, 561, 1792, 540, 2019, 540, 1886, 561, 0, 585, 585, 1040, 585, 585, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 0, 1134592, 0, 0, 1134592, 0, 0, 0, 0, 2023, 561, 1980, 585, 2027, 585, 0, 2029, 0, 0, 0, 0, 0, 2031, 0, 0, 0, 0, 0, 2761, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 661, 0, 0, 0, 0, 0, 0, 2089, 0, 0, 0, 0, 2093, 0, 0, 0, 0, 0, 0, 0, 0, 0, 377, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2119, 0, 2121, 0, 0, 0, 0, 0, 0, 0, 2129, 0, 0, 0, 0, 786, 0, 805, 0, 0, 0, 0, 540, 849, 540, 540, 540, 540, 540, 2216, 540, 540, 540, 540, 540, 540, 2221, 540, 540, 540, 540, 540, 540, 3633, 561, 561, 561, 561, 561, 561, 3639, 585, 585, 0, 0, 0, 2134, 0, 0, 0, 0, 2139, 0, 0, 0, 0, 0, 0, 0, 0, 2990080, 2179072, 2179072, 2502656, 2179072, 2179072, 2179072, 2179072, 540, 2187, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1337, 540, 2211, 2212, 540, 540, 540, 540, 540, 540, 2219, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2582, 540, 540, 540, 0, 0, 0, 561, 561, 2258, 561, 2260, 561, 561, 561, 561, 561, 561, 2268, 561, 2270, 561, 561, 561, 561, 1426, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3343, 561, 561, 561, 561, 3344, 3345, 561, 561, 2343, 585, 2345, 585, 585, 585, 585, 585, 585, 2353, 585, 2355, 585, 585, 585, 585, 561, 0, 0, 0, 3648, 0, 540, 540, 540, 540, 3652, 540, 585, 585, 585, 585, 2389, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2705, 585, 585, 585, 585, 585, 585, 585, 2402, 585, 585, 2405, 2406, 585, 585, 561, 2177, 585, 2345, 2260, 540, 2414, 540, 540, 561, 2418, 561, 561, 585, 2422, 585, 585, 2029, 0, 2031, 0, 0, 0, 0, 795, 663, 844, 0, 0, 0, 0, 540, 848, 540, 540, 540, 540, 540, 1283, 540, 540, 540, 540, 540, 540, 1298, 540, 540, 540, 540, 540, 540, 2580, 540, 540, 540, 540, 540, 540, 0, 2584, 0, 0, 0, 2450, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1239, 0, 0, 0, 2459, 0, 0, 0, 0, 0, 2464, 0, 2466, 2467, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 0, 0, 0, 371, 0, 65536, 0, 0, 2498, 0, 0, 0, 0, 0, 0, 0, 2505, 0, 0, 0, 0, 0, 0, 0, 2479, 0, 0, 0, 2481, 0, 0, 0, 0, 2561, 540, 540, 540, 2566, 540, 540, 540, 540, 540, 540, 540, 2573, 540, 540, 540, 540, 540, 540, 2838, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1296, 540, 540, 540, 540, 540, 0, 0, 0, 561, 561, 561, 561, 561, 561, 561, 2591, 561, 561, 561, 561, 561, 561, 2640, 561, 561, 561, 2643, 561, 561, 561, 561, 561, 561, 2886, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1867, 561, 561, 561, 561, 561, 561, 2621, 561, 561, 561, 561, 2625, 561, 561, 561, 2630, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 0, 3661, 0, 0, 561, 2637, 561, 561, 561, 561, 561, 561, 561, 2642, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3427, 585, 2669, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3267, 2797, 2798, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 1741, 540, 0, 0, 2982, 2983, 0, 2984, 0, 2986, 0, 0, 0, 0, 2988, 0, 0, 0, 0, 0, 680, 681, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2047, 0, 0, 0, 0, 0, 0, 0, 0, 3007, 0, 0, 2988, 0, 0, 3013, 3014, 0, 3016, 0, 0, 3019, 0, 0, 0, 0, 800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 800, 0, 0, 0, 0, 3022, 540, 540, 540, 540, 540, 540, 3029, 540, 540, 540, 540, 540, 3033, 3062, 540, 561, 561, 561, 561, 561, 561, 3069, 561, 561, 561, 561, 561, 3073, 561, 0, 585, 585, 1042, 585, 585, 288, 1079, 0, 0, 1082, 1086, 0, 0, 1090, 3103, 561, 585, 585, 585, 585, 585, 585, 3110, 585, 585, 585, 585, 585, 3114, 585, 561, 0, 1543, 585, 1545, 1546, 540, 540, 1548, 540, 540, 561, 561, 1552, 561, 0, 585, 585, 1044, 585, 585, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 794, 0, 0, 0, 0, 0, 0, 0, 798, 3144, 585, 561, 540, 585, 561, 540, 3150, 561, 3152, 585, 3154, 0, 0, 0, 0, 0, 0, 825, 0, 819, 0, 664, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 221184, 0, 0, 0, 0, 65536, 0, 0, 0, 3160, 0, 0, 3163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 396, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 2806, 540, 540, 540, 3202, 540, 540, 540, 540, 540, 540, 540, 3207, 540, 540, 540, 540, 540, 540, 540, 540, 3040, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3322, 540, 540, 540, 540, 540, 540, 561, 3234, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1889, 561, 3245, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 585, 3257, 585, 585, 585, 585, 585, 585, 585, 3262, 585, 585, 585, 585, 585, 561, 2013, 585, 2015, 2016, 540, 2018, 540, 540, 561, 2022, 561, 561, 561, 3349, 561, 561, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2667, 0, 3378, 3379, 0, 3176, 0, 3383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 384, 0, 0, 0, 0, 0, 384, 0, 0, 0, 3441, 3176, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 2167, 540, 540, 0, 0, 0, 0, 3503, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 3512, 0, 0, 3557, 3558, 3559, 540, 540, 540, 3562, 540, 3564, 540, 540, 540, 540, 3569, 3570, 3571, 561, 561, 561, 3574, 561, 3576, 561, 561, 561, 561, 3581, 3582, 3583, 585, 561, 1203, 540, 585, 585, 561, 540, 540, 540, 540, 540, 561, 561, 561, 561, 585, 585, 585, 585, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 585, 585, 3586, 585, 3588, 585, 585, 585, 585, 3593, 0, 0, 0, 0, 0, 0, 0, 2747, 2748, 2749, 0, 0, 0, 0, 0, 0, 0, 2763, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 254413, 1, 12290, 0, 0, 540, 3628, 540, 540, 540, 3632, 561, 561, 3634, 561, 561, 561, 3638, 585, 585, 3640, 585, 585, 585, 3644, 561, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 540, 3563, 540, 3565, 540, 540, 540, 561, 0, 0, 0, 326, 327, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 674, 0, 0, 0, 0, 0, 366, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1120, 0, 0, 0, 0, 366, 0, 0, 0, 374, 376, 0, 0, 0, 0, 0, 0, 0, 344, 0, 402, 0, 0, 0, 0, 0, 402, 0, 0, 409, 0, 0, 0, 409, 69632, 73728, 0, 366, 366, 0, 421, 65536, 366, 0, 0, 366, 421, 498, 502, 498, 498, 507, 498, 498, 498, 507, 498, 421, 421, 327, 421, 0, 0, 421, 0, 421, 0, 0, 0, 0, 0, 0, 0, 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, 546, 568, 546, 568, 546, 546, 568, 546, 592, 568, 568, 568, 568, 568, 568, 568, 592, 592, 592, 546, 592, 592, 592, 592, 592, 568, 568, 546, 568, 592, 568, 592, 1, 12290, 3, 78112, 0, 0, 677, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1248, 0, 0, 540, 540, 540, 875, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2183, 540, 540, 561, 561, 915, 561, 561, 561, 561, 561, 561, 945, 561, 561, 561, 561, 561, 561, 585, 3421, 585, 585, 3423, 585, 585, 585, 585, 585, 585, 1018, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 0, 540, 0, 0, 0, 540, 988, 585, 561, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 3068, 561, 561, 561, 561, 561, 561, 561, 561, 932, 561, 561, 946, 561, 561, 561, 561, 561, 561, 934, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3240, 561, 561, 561, 561, 561, 561, 0, 0, 1109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1604, 0, 0, 0, 0, 1229, 0, 1109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 686, 0, 0, 0, 0, 540, 540, 540, 1281, 540, 540, 540, 540, 540, 1293, 540, 540, 540, 540, 540, 540, 540, 540, 3054, 3056, 540, 540, 540, 3059, 540, 3061, 1360, 914, 561, 561, 561, 561, 561, 561, 561, 1370, 561, 561, 561, 561, 561, 1382, 585, 585, 1461, 585, 585, 585, 585, 585, 1473, 585, 585, 585, 585, 585, 585, 585, 585, 2914, 585, 585, 585, 585, 585, 585, 585, 585, 3122, 585, 585, 585, 585, 585, 585, 585, 585, 3136, 3138, 585, 585, 585, 3141, 585, 3143, 0, 1720, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1134, 0, 1990, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1972, 585, 585, 585, 2373, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2370, 585, 585, 585, 585, 2698, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2383, 585, 0, 0, 0, 3161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1688, 0, 0, 0, 561, 561, 3235, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 0, 2325, 0, 3663, 540, 540, 540, 3665, 561, 561, 561, 3667, 585, 585, 585, 0, 0, 540, 540, 540, 2526, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3058, 540, 540, 540, 422, 422, 0, 422, 431, 0, 422, 0, 422, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 492, 492, 466, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 547, 569, 547, 569, 547, 547, 569, 547, 593, 569, 569, 569, 569, 569, 569, 569, 593, 593, 593, 547, 593, 593, 593, 593, 593, 569, 569, 547, 569, 593, 569, 593, 1, 12290, 3, 78112, 0, 0, 0, 0, 2159, 0, 0, 0, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3032, 540, 540, 540, 540, 540, 2202, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2208, 540, 540, 2413, 540, 540, 540, 2417, 561, 561, 561, 2421, 585, 585, 585, 0, 0, 0, 0, 3293, 0, 0, 0, 0, 0, 3296, 0, 0, 0, 2458, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1250, 2967, 0, 0, 0, 2971, 0, 0, 0, 0, 0, 2977, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 0, 0, 0, 418, 0, 65536, 0, 0, 2992, 0, 0, 2995, 0, 0, 0, 0, 0, 3000, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 0, 367, 367, 0, 0, 65536, 367, 0, 0, 0, 3023, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2222, 540, 540, 540, 540, 3049, 540, 540, 540, 540, 540, 540, 540, 540, 3057, 540, 540, 3060, 540, 540, 540, 540, 2189, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2583, 0, 0, 0, 540, 540, 3063, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 0, 2326, 0, 561, 561, 3090, 561, 561, 561, 561, 561, 561, 561, 561, 3098, 561, 561, 3101, 561, 0, 585, 585, 1045, 585, 585, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 1102, 1101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 1275, 540, 561, 561, 3104, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2666, 585, 585, 585, 3131, 585, 585, 585, 585, 585, 585, 585, 585, 3139, 585, 585, 3142, 585, 585, 585, 585, 585, 1930, 585, 585, 585, 585, 585, 585, 585, 585, 1941, 585, 585, 585, 585, 585, 1948, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3263, 585, 585, 585, 585, 0, 0, 0, 0, 3179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 732, 0, 0, 0, 0, 0, 0, 3192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 540, 2808, 3201, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1359, 540, 3213, 540, 540, 540, 540, 540, 540, 540, 3218, 540, 3220, 540, 540, 540, 540, 540, 540, 561, 3227, 561, 561, 561, 3230, 561, 561, 561, 561, 561, 982, 561, 0, 585, 585, 585, 585, 999, 585, 585, 585, 561, 561, 3246, 561, 3248, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 3537, 585, 585, 585, 585, 3256, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3278, 585, 585, 3268, 585, 585, 585, 585, 585, 585, 585, 585, 3274, 585, 3276, 585, 585, 561, 3370, 540, 3371, 561, 3372, 585, 0, 0, 0, 0, 0, 0, 0, 785, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1179, 540, 540, 3328, 540, 540, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3233, 561, 561, 561, 561, 3340, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3346, 561, 0, 994, 1075, 1039, 585, 585, 78112, 1079, 0, 0, 1081, 1085, 0, 0, 1089, 3358, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3364, 585, 585, 585, 585, 585, 585, 585, 1981, 1982, 585, 585, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 2951, 540, 2953, 561, 561, 561, 3654, 3655, 561, 561, 585, 585, 3658, 3659, 585, 585, 0, 0, 0, 0, 0, 0, 1126, 0, 0, 0, 1130, 1131, 0, 0, 0, 0, 0, 0, 1141, 0, 1143, 0, 0, 362, 362, 0, 0, 0, 691, 0, 0, 0, 0, 696, 0, 0, 0, 362, 362, 362, 0, 0, 0, 0, 0, 0, 1154, 0, 0, 0, 0, 0, 1160, 0, 1162, 0, 758, 0, 0, 0, 0, 0, 0, 758, 0, 0, 0, 0, 0, 758, 758, 0, 0, 0, 0, 803, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 832, 0, 0, 0, 0, 0, 0, 0, 0, 0, 758, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 856, 585, 999, 926, 540, 540, 540, 540, 910, 561, 561, 561, 561, 561, 1880, 1881, 1882, 561, 561, 1885, 1886, 561, 561, 561, 561, 561, 1896, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2603, 561, 2605, 561, 561, 561, 982, 0, 585, 585, 585, 585, 1055, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 375, 0, 378, 0, 0, 0, 378, 0, 0, 0, 0, 1709, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1619, 0, 0, 585, 585, 585, 2010, 585, 561, 540, 585, 585, 561, 540, 540, 540, 540, 561, 561, 561, 3066, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2600, 561, 561, 561, 561, 561, 561, 561, 561, 0, 0, 987, 585, 585, 585, 585, 585, 0, 2039, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1178, 0, 540, 540, 540, 2172, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2238, 2584, 0, 0, 0, 0, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2255, 0, 0, 0, 0, 2461, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 747, 0, 0, 0, 0, 3288, 585, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1184, 1184, 561, 561, 561, 561, 3350, 561, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2939, 585, 585, 585, 585, 3368, 585, 561, 540, 540, 561, 561, 585, 585, 0, 0, 0, 0, 0, 0, 0, 394, 0, 0, 0, 0, 0, 394, 0, 0, 467, 467, 485, 493, 493, 485, 493, 493, 493, 493, 493, 493, 493, 493, 518, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 526, 535, 526, 526, 526, 526, 526, 548, 570, 548, 570, 548, 548, 570, 548, 594, 570, 570, 570, 570, 570, 570, 570, 594, 594, 594, 548, 594, 594, 594, 594, 594, 570, 570, 548, 570, 594, 570, 594, 1, 12290, 3, 78112, 767, 0, 0, 771, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1704, 0, 0, 0, 821, 0, 0, 0, 798, 0, 0, 821, 0, 0, 0, 0, 0, 821, 821, 0, 0, 0, 0, 805, 0, 0, 786, 0, 0, 0, 0, 805, 0, 0, 0, 0, 0, 0, 0, 805, 0, 0, 0, 0, 0, 798, 0, 0, 0, 0, 0, 0, 839, 794, 0, 0, 839, 0, 0, 0, 0, 808, 0, 0, 692, 0, 0, 672, 0, 692, 0, 813, 675, 676, 0, 0, 0, 0, 0, 682, 0, 0, 0, 0, 0, 0, 0, 0, 340, 0, 0, 0, 0, 0, 0, 0, 540, 867, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 911, 540, 540, 540, 540, 2215, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1756, 540, 540, 540, 540, 983, 0, 585, 585, 585, 1077, 1056, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 412, 412, 0, 0, 0, 0, 0, 412, 0, 1180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1621, 0, 0, 1241, 0, 0, 0, 0, 0, 0, 0, 0, 1246, 0, 0, 0, 0, 0, 0, 1170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 816, 0, 0, 0, 0, 0, 0, 540, 1305, 540, 540, 540, 540, 540, 540, 540, 1313, 540, 540, 540, 540, 540, 540, 540, 540, 3332, 540, 561, 561, 561, 561, 561, 561, 935, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3094, 561, 3096, 561, 561, 561, 561, 561, 561, 1340, 540, 540, 1344, 540, 540, 540, 540, 540, 1350, 540, 540, 540, 1357, 540, 540, 540, 540, 540, 3458, 540, 3460, 3461, 540, 3463, 540, 561, 561, 561, 561, 561, 2262, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1399, 561, 561, 561, 561, 561, 1360, 914, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1375, 561, 561, 561, 561, 1848, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2868, 561, 561, 561, 561, 561, 1441, 561, 561, 561, 1448, 561, 561, 26027, 1360, 987, 585, 585, 585, 585, 585, 585, 585, 1998, 585, 585, 585, 585, 585, 2003, 585, 585, 1485, 585, 585, 585, 585, 585, 585, 585, 1493, 585, 585, 585, 585, 585, 585, 585, 585, 3261, 585, 585, 585, 585, 585, 585, 585, 585, 3272, 585, 585, 585, 585, 585, 585, 585, 585, 3283, 540, 585, 561, 540, 540, 561, 561, 585, 1522, 585, 585, 1526, 585, 585, 585, 585, 585, 1532, 585, 585, 585, 1539, 585, 585, 585, 585, 585, 1996, 1997, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1531, 585, 585, 585, 585, 585, 585, 0, 0, 0, 1595, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1716, 0, 0, 0, 0, 0, 1656, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1665, 0, 0, 0, 0, 0, 710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 662, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 1708, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1653, 0, 0, 0, 1722, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1729, 0, 0, 0, 0, 0, 0, 1706, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3398, 540, 3400, 540, 561, 561, 1893, 561, 561, 561, 561, 561, 561, 1901, 561, 561, 561, 561, 561, 561, 1410, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1428, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1917, 26027, 0, 1922, 585, 1924, 585, 561, 561, 561, 1910, 1912, 561, 561, 561, 561, 561, 26027, 0, 585, 585, 585, 585, 585, 585, 2335, 585, 585, 585, 585, 585, 585, 585, 585, 561, 0, 3622, 0, 3624, 0, 0, 540, 585, 585, 585, 585, 1978, 585, 585, 585, 585, 585, 585, 585, 585, 1987, 585, 585, 585, 585, 585, 585, 2934, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2407, 561, 540, 585, 585, 561, 585, 585, 585, 585, 1995, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2004, 2006, 0, 0, 0, 2078, 0, 0, 0, 2081, 0, 0, 0, 0, 0, 2087, 0, 0, 0, 0, 0, 2774, 0, 0, 0, 2778, 0, 2780, 0, 0, 0, 0, 0, 0, 2746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 362, 362, 0, 0, 0, 0, 0, 2103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1265, 0, 0, 0, 0, 561, 561, 561, 561, 561, 2249, 561, 561, 561, 561, 561, 561, 561, 0, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1519, 585, 585, 2346, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2919, 585, 2448, 0, 0, 0, 0, 0, 0, 0, 0, 2453, 0, 0, 2456, 0, 0, 0, 0, 0, 726, 0, 0, 0, 0, 0, 0, 0, 0, 0, 736, 0, 0, 0, 2460, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2471, 0, 0, 0, 2485, 2486, 0, 0, 2489, 0, 0, 2492, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 0, 417, 417, 0, 0, 65536, 417, 0, 0, 2499, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2510, 0, 0, 0, 0, 815, 0, 812, 795, 0, 0, 817, 0, 667, 0, 791, 0, 0, 0, 0, 1096, 0, 0, 1098, 0, 0, 0, 0, 0, 0, 0, 0, 827, 0, 0, 0, 0, 0, 0, 0, 0, 540, 2524, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1789, 540, 540, 540, 540, 540, 2551, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2559, 540, 540, 2562, 540, 540, 540, 540, 540, 540, 2569, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3323, 540, 540, 540, 540, 540, 540, 2576, 540, 540, 540, 2579, 540, 540, 540, 540, 540, 540, 540, 0, 0, 0, 0, 0, 755, 0, 0, 0, 0, 0, 0, 0, 0, 765, 0, 0, 0, 0, 561, 2586, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3254, 561, 561, 561, 585, 585, 585, 585, 585, 2672, 585, 585, 585, 585, 585, 585, 2677, 585, 585, 585, 585, 561, 0, 3646, 0, 0, 0, 540, 540, 540, 540, 540, 540, 2529, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2842, 540, 540, 540, 540, 540, 585, 585, 585, 2683, 585, 585, 585, 585, 585, 585, 2690, 585, 585, 585, 585, 585, 585, 585, 2351, 585, 585, 585, 585, 585, 585, 585, 585, 1508, 585, 585, 585, 585, 585, 585, 585, 585, 2697, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2704, 585, 585, 585, 2707, 0, 0, 0, 0, 2735, 0, 0, 0, 0, 0, 0, 0, 2739, 0, 0, 0, 0, 0, 799, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 2528, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2234, 540, 540, 540, 540, 0, 540, 540, 540, 2811, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2821, 540, 540, 540, 540, 540, 2836, 540, 540, 540, 2839, 540, 2841, 540, 540, 540, 540, 540, 540, 540, 540, 3520, 561, 561, 561, 561, 561, 561, 561, 1450, 26027, 1360, 987, 585, 585, 585, 585, 585, 2845, 540, 540, 540, 540, 540, 540, 0, 0, 561, 561, 2853, 561, 561, 561, 561, 561, 1913, 561, 561, 561, 561, 26027, 0, 585, 585, 585, 585, 2333, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1050, 585, 585, 585, 585, 561, 561, 2858, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2284, 561, 561, 561, 2874, 2875, 561, 561, 561, 561, 2878, 561, 561, 561, 561, 561, 561, 561, 0, 585, 585, 585, 585, 585, 585, 1005, 585, 561, 561, 561, 2884, 561, 561, 561, 2887, 561, 2889, 561, 561, 561, 561, 561, 561, 1449, 561, 26027, 1360, 987, 1453, 585, 585, 585, 585, 2893, 561, 561, 561, 561, 561, 561, 0, 0, 585, 585, 2901, 585, 585, 585, 585, 585, 585, 585, 3121, 585, 585, 585, 585, 585, 585, 585, 585, 561, 540, 585, 561, 540, 3285, 561, 3287, 585, 2906, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3367, 585, 585, 2922, 2923, 585, 585, 585, 585, 2926, 585, 585, 585, 585, 585, 585, 585, 585, 3592, 561, 0, 0, 0, 0, 3595, 0, 585, 585, 585, 2932, 585, 585, 585, 2935, 585, 2937, 585, 585, 585, 585, 585, 585, 585, 1933, 585, 585, 585, 585, 1939, 585, 585, 585, 2941, 585, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 540, 540, 561, 561, 585, 585, 0, 0, 0, 0, 0, 0, 0, 0, 2963, 0, 0, 0, 0, 0, 585, 585, 2957, 0, 0, 2960, 2961, 0, 0, 0, 0, 0, 0, 0, 0, 0, 662, 0, 662, 0, 0, 0, 0, 0, 0, 0, 0, 3009, 0, 0, 3012, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2200253, 151552, 2200253, 0, 0, 0, 151552, 540, 540, 540, 540, 3037, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3325, 540, 540, 540, 540, 540, 540, 540, 3051, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3465, 561, 561, 561, 561, 561, 561, 3077, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1887, 1888, 561, 561, 561, 561, 561, 561, 3092, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3480, 585, 585, 585, 585, 561, 561, 585, 585, 585, 585, 3108, 585, 585, 585, 585, 3112, 585, 585, 585, 585, 585, 585, 585, 3135, 585, 3137, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 3552, 0, 0, 0, 585, 585, 585, 3118, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1512, 585, 585, 585, 585, 585, 585, 585, 3133, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2917, 585, 585, 2920, 0, 0, 3168, 3169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2071, 0, 0, 0, 540, 540, 540, 540, 3329, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3412, 561, 561, 3336, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2285, 3347, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 3354, 585, 585, 585, 585, 585, 585, 2404, 585, 585, 585, 585, 561, 2178, 585, 2346, 2261, 3389, 0, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2534, 0, 0, 0, 0, 3176, 0, 0, 0, 0, 0, 3447, 3448, 0, 540, 540, 540, 540, 2527, 540, 540, 540, 540, 2531, 540, 540, 540, 540, 540, 540, 540, 1312, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1784, 540, 540, 540, 540, 540, 540, 561, 561, 561, 561, 3473, 561, 3475, 3476, 561, 3478, 561, 585, 585, 585, 585, 585, 1079, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254413, 0, 0, 0, 0, 0, 585, 585, 585, 3488, 585, 3490, 3491, 585, 3493, 585, 3495, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 313, 314, 314, 419, 420, 65536, 427, 585, 585, 3617, 585, 3618, 585, 585, 585, 561, 0, 0, 0, 0, 0, 0, 540, 585, 585, 561, 540, 540, 540, 904, 540, 561, 561, 561, 976, 561, 561, 585, 585, 3673, 3674, 3675, 3676, 0, 540, 561, 585, 0, 540, 561, 585, 585, 585, 585, 585, 1079, 0, 0, 1563, 0, 0, 0, 1569, 0, 0, 0, 0, 0, 2789, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1591, 0, 0, 0, 0, 0, 571, 571, 571, 571, 571, 571, 571, 595, 595, 595, 540, 595, 595, 595, 595, 595, 571, 571, 540, 571, 595, 571, 595, 1, 12290, 3, 78112, 737, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1707, 0, 0, 2040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1635, 0, 0, 2170, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1360, 0, 0, 0, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2253, 561, 561, 561, 561, 926, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2307, 561, 561, 561, 2310, 400, 0, 0, 0, 0, 378, 0, 69632, 73728, 0, 0, 0, 0, 423, 65536, 0, 0, 0, 0, 1111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1687, 0, 1689, 0, 0, 423, 423, 0, 423, 0, 437, 423, 0, 423, 468, 468, 468, 475, 468, 468, 468, 468, 468, 468, 468, 468, 475, 468, 468, 468, 468, 468, 468, 468, 468, 482, 468, 494, 494, 468, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 537, 549, 572, 549, 572, 549, 549, 572, 549, 596, 572, 572, 572, 572, 572, 572, 572, 596, 596, 596, 549, 596, 596, 596, 596, 596, 572, 572, 549, 572, 596, 572, 596, 1, 12290, 3, 78112, 0, 660, 661, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1666, 0, 0, 830, 0, 0, 0, 661, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 729, 0, 742, 661, 0, 0, 0, 0, 0, 540, 847, 540, 540, 540, 540, 540, 540, 3330, 540, 540, 540, 561, 561, 561, 561, 561, 3335, 861, 540, 540, 540, 540, 540, 540, 540, 540, 540, 897, 540, 540, 540, 540, 540, 540, 540, 1799, 540, 540, 540, 540, 540, 540, 1807, 540, 561, 561, 916, 561, 561, 561, 931, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2266, 561, 561, 561, 561, 561, 561, 0, 0, 0, 540, 989, 585, 561, 540, 540, 897, 540, 540, 561, 561, 969, 561, 561, 561, 561, 561, 0, 585, 585, 989, 585, 585, 585, 1004, 585, 1094, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1101, 1102, 0, 0, 0, 0, 0, 0, 1203, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 196608, 0, 0, 0, 0, 0, 540, 540, 540, 1308, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3222, 540, 540, 1360, 914, 561, 1363, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1376, 1383, 561, 561, 561, 1444, 561, 561, 561, 561, 26027, 1360, 987, 585, 1454, 585, 585, 585, 585, 585, 585, 2659, 585, 585, 2662, 2663, 585, 585, 585, 585, 585, 585, 585, 2712, 540, 585, 585, 561, 540, 540, 540, 540, 585, 585, 1488, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3128, 585, 1521, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1535, 585, 585, 585, 585, 585, 585, 2673, 585, 585, 585, 2676, 585, 585, 2678, 585, 2679, 561, 585, 585, 1521, 585, 585, 1079, 0, 0, 0, 0, 0, 0, 0, 0, 0, 759, 0, 0, 0, 0, 0, 0, 1826, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1841, 1842, 585, 585, 2009, 585, 585, 561, 540, 585, 585, 561, 540, 540, 540, 540, 561, 561, 561, 561, 1849, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2880, 561, 561, 561, 561, 561, 2063, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2074, 540, 540, 2226, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 0, 0, 561, 561, 561, 2854, 561, 561, 561, 561, 561, 561, 2301, 561, 561, 561, 561, 561, 561, 2306, 561, 561, 561, 561, 561, 561, 3079, 561, 561, 561, 561, 561, 3085, 561, 561, 3088, 2311, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 0, 0, 0, 0, 0, 0, 585, 585, 585, 585, 585, 585, 2654, 585, 585, 585, 585, 585, 2374, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3140, 585, 585, 585, 585, 2386, 585, 585, 585, 585, 585, 585, 2391, 585, 585, 585, 585, 585, 2396, 585, 585, 585, 585, 585, 2012, 540, 585, 585, 561, 540, 540, 540, 540, 561, 561, 561, 561, 2624, 561, 561, 561, 561, 561, 561, 2632, 561, 561, 561, 561, 561, 2288, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2631, 561, 561, 561, 561, 561, 2435, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2114, 0, 0, 0, 0, 2476, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 748, 0, 0, 0, 0, 0, 2732, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1590, 1591, 0, 0, 0, 2772, 0, 0, 0, 0, 2777, 0, 0, 0, 0, 0, 0, 0, 540, 562, 540, 562, 540, 540, 562, 540, 586, 540, 540, 2810, 540, 540, 540, 540, 540, 540, 2818, 540, 540, 540, 540, 540, 540, 540, 889, 540, 540, 540, 540, 907, 540, 540, 540, 540, 540, 540, 540, 2849, 540, 540, 0, 0, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1836, 561, 561, 561, 561, 561, 2857, 561, 561, 561, 561, 561, 561, 2865, 561, 561, 561, 561, 561, 561, 561, 561, 3081, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2897, 561, 561, 0, 0, 585, 585, 585, 585, 585, 585, 585, 1467, 1474, 585, 585, 585, 585, 585, 585, 585, 585, 3621, 0, 0, 0, 0, 0, 0, 540, 2905, 585, 585, 585, 585, 585, 585, 2913, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1983, 585, 585, 1986, 585, 585, 585, 585, 585, 585, 585, 2945, 585, 585, 561, 540, 585, 585, 561, 540, 540, 561, 561, 585, 585, 0, 0, 0, 0, 0, 3376, 0, 585, 3280, 585, 585, 585, 585, 585, 585, 561, 540, 585, 561, 540, 540, 561, 561, 585, 585, 0, 3155, 0, 0, 585, 585, 585, 3587, 585, 3589, 585, 585, 585, 561, 0, 0, 0, 0, 0, 0, 0, 2791, 0, 0, 0, 2793, 0, 0, 0, 0, 0, 0, 0, 0, 3600, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1314, 540, 540, 540, 540, 3607, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3614, 585, 585, 585, 585, 585, 585, 2686, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1045, 585, 585, 585, 585, 585, 972, 561, 3653, 561, 561, 561, 561, 585, 3657, 585, 585, 585, 585, 0, 0, 0, 0, 0, 0, 1204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 0, 290, 0, 0, 0, 345, 469, 469, 469, 453, 453, 469, 453, 453, 453, 453, 453, 453, 453, 453, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 550, 573, 550, 573, 550, 550, 573, 550, 597, 573, 573, 573, 573, 573, 573, 573, 597, 597, 597, 550, 597, 597, 597, 597, 597, 573, 573, 550, 573, 597, 573, 597, 1, 12290, 3, 78112, 862, 540, 540, 876, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1315, 540, 540, 540, 585, 1019, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 3498, 0, 0, 1123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1607, 0, 0, 0, 0, 1254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2111, 0, 0, 0, 540, 1341, 540, 540, 540, 540, 540, 1348, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3333, 561, 561, 561, 561, 561, 585, 585, 585, 585, 1505, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3365, 585, 585, 585, 585, 585, 1523, 585, 585, 585, 585, 585, 1530, 585, 585, 585, 585, 585, 585, 585, 1468, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2378, 585, 585, 585, 585, 585, 585, 561, 585, 585, 585, 1557, 585, 1079, 0, 1561, 0, 0, 0, 1567, 0, 0, 0, 0, 0, 803, 0, 0, 0, 0, 0, 0, 0, 803, 0, 0, 0, 0, 540, 540, 540, 540, 540, 1573, 0, 0, 0, 1579, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 749, 0, 0, 0, 0, 0, 0, 0, 1695, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2127, 0, 0, 0, 540, 1762, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1358, 540, 1843, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1854, 561, 561, 561, 561, 561, 561, 3239, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3578, 561, 561, 585, 585, 585, 585, 0, 2064, 2065, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1717, 0, 0, 0, 0, 0, 0, 2135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1159, 0, 0, 0, 0, 2186, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1808, 540, 540, 2213, 540, 540, 540, 540, 2218, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1754, 540, 540, 540, 540, 540, 540, 2240, 0, 0, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1401, 561, 561, 2298, 561, 561, 561, 561, 2303, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3083, 561, 561, 561, 561, 561, 585, 585, 585, 2388, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1938, 585, 585, 585, 3034, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2210, 0, 0, 0, 3380, 3176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1175, 0, 0, 0, 0, 540, 540, 3404, 540, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2282, 561, 561, 561, 561, 561, 561, 561, 3419, 561, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1049, 585, 585, 585, 585, 561, 540, 3454, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 561, 561, 561, 561, 3523, 561, 561, 561, 3469, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 3484, 385, 387, 337, 0, 0, 0, 0, 0, 0, 336, 0, 0, 337, 0, 0, 0, 0, 0, 1097, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2057, 0, 0, 0, 0, 0, 0, 0, 0, 384, 0, 0, 0, 69632, 73728, 0, 0, 0, 0, 0, 65536, 0, 0, 0, 0, 1139, 1140, 0, 0, 0, 0, 0, 362, 362, 0, 0, 0, 0, 0, 703, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0, 0, 0, 0, 0, 336, 0, 0, 438, 0, 444, 0, 470, 470, 470, 470, 470, 470, 470, 551, 574, 551, 574, 551, 551, 574, 551, 598, 480, 470, 470, 470, 499, 476, 499, 499, 499, 499, 499, 499, 499, 499, 470, 470, 476, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 480, 470, 481, 480, 470, 470, 470, 470, 574, 574, 574, 574, 574, 574, 574, 598, 598, 598, 551, 598, 598, 598, 598, 598, 574, 574, 551, 574, 598, 574, 598, 1, 12290, 3, 78112, 0, 0, 0, 678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2153, 0, 0, 0, 0, 0, 693, 0, 0, 0, 0, 0, 0, 362, 362, 362, 0, 0, 0, 0, 0, 0, 1217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1220, 0, 0, 1223, 0, 0, 0, 0, 0, 0, 663, 0, 791, 0, 0, 0, 0, 0, 0, 0, 795, 0, 0, 0, 0, 0, 2972, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2097, 0, 2099, 0, 0, 0, 0, 0, 804, 0, 0, 0, 0, 0, 812, 0, 0, 0, 0, 706, 0, 0, 0, 0, 0, 0, 0, 0, 715, 0, 717, 0, 0, 0, 831, 0, 0, 0, 663, 834, 0, 791, 0, 0, 0, 0, 0, 840, 0, 0, 0, 0, 0, 2996, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2429, 2430, 0, 0, 0, 0, 863, 540, 540, 877, 540, 540, 540, 888, 540, 540, 540, 540, 906, 540, 540, 540, 540, 540, 1311, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2843, 540, 540, 540, 540, 561, 561, 917, 561, 561, 561, 933, 561, 561, 947, 561, 561, 561, 561, 960, 561, 0, 995, 585, 1076, 1046, 585, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 0, 2686976, 2736128, 0, 0, 2531328, 2707456, 0, 3190784, 561, 561, 561, 978, 561, 561, 561, 0, 585, 585, 990, 585, 585, 585, 1006, 585, 585, 585, 585, 585, 2349, 585, 585, 585, 585, 2354, 585, 585, 585, 585, 585, 585, 585, 2377, 585, 585, 585, 585, 585, 585, 585, 585, 561, 540, 561, 585, 0, 0, 0, 0, 585, 1020, 585, 585, 585, 585, 1033, 585, 585, 585, 585, 1051, 585, 585, 585, 561, 540, 585, 561, 3149, 540, 3151, 561, 3153, 585, 0, 0, 0, 0, 0, 0, 1660, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 990, 585, 561, 540, 540, 540, 540, 540, 561, 561, 561, 561, 3067, 561, 561, 561, 561, 3071, 561, 561, 561, 561, 0, 0, 0, 1215, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2431, 0, 2433, 0, 1238, 0, 0, 0, 0, 1270, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 540, 3561, 540, 540, 540, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 561, 561, 585, 585, 585, 540, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1491, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1495, 585, 585, 585, 585, 561, 585, 585, 1556, 585, 585, 1079, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1100, 0, 0, 0, 0, 0, 0, 1622, 0, 0, 1625, 0, 1627, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 839, 540, 540, 540, 540, 859, 540, 1744, 540, 540, 540, 540, 540, 540, 540, 540, 1755, 540, 540, 540, 540, 540, 540, 540, 2176, 540, 540, 2180, 540, 540, 540, 2184, 540, 561, 561, 561, 1847, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2294, 561, 561, 561, 0, 0, 2117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1730, 0, 0, 0, 0, 0, 0, 2148, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1207, 0, 0, 0, 0, 0, 0, 0, 561, 561, 561, 561, 2248, 561, 561, 561, 561, 561, 561, 561, 561, 3095, 3097, 561, 561, 561, 3100, 561, 3102, 561, 561, 2313, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 0, 0, 0, 0, 0, 0, 585, 585, 2651, 585, 585, 585, 585, 585, 585, 585, 2660, 585, 585, 585, 585, 585, 2665, 585, 585, 2398, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 561, 540, 2410, 585, 561, 0, 540, 585, 585, 561, 540, 540, 540, 540, 540, 561, 561, 561, 561, 585, 585, 585, 585, 0, 3669, 540, 3670, 0, 2436, 0, 0, 0, 0, 0, 0, 2441, 0, 0, 0, 2444, 2445, 0, 0, 0, 0, 0, 3010, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 303, 304, 0, 0, 0, 0, 2497, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2506, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 163840, 0, 0, 0, 0, 65536, 0, 2512, 0, 0, 0, 0, 2515, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2523, 540, 2536, 2537, 540, 540, 540, 540, 540, 2542, 540, 2544, 540, 540, 540, 540, 2548, 561, 2595, 561, 561, 2598, 2599, 561, 561, 561, 561, 561, 2604, 561, 2606, 561, 561, 561, 561, 1863, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2890, 561, 561, 561, 561, 561, 561, 561, 2610, 561, 561, 561, 561, 561, 561, 561, 561, 2616, 561, 561, 561, 561, 561, 2276, 561, 561, 2279, 561, 561, 561, 561, 561, 561, 561, 1915, 561, 561, 26027, 1920, 585, 585, 585, 585, 2636, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2608, 2668, 585, 2670, 585, 585, 585, 585, 2674, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2675, 585, 585, 585, 585, 585, 585, 2680, 585, 585, 585, 585, 585, 585, 585, 585, 2688, 585, 585, 585, 585, 585, 585, 585, 1950, 585, 585, 585, 585, 1954, 585, 585, 585, 2696, 585, 585, 585, 585, 2700, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1494, 585, 585, 585, 585, 585, 561, 2720, 561, 561, 585, 2722, 585, 585, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2964, 0, 0, 0, 0, 2770, 0, 0, 0, 2773, 0, 0, 2776, 0, 0, 0, 0, 0, 0, 0, 0, 331, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1691, 0, 2786, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2795, 0, 0, 0, 0, 0, 3171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1245, 0, 0, 0, 0, 0, 540, 2825, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1773, 540, 540, 2835, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2844, 540, 540, 2847, 540, 540, 2850, 540, 0, 0, 2851, 561, 561, 561, 561, 561, 561, 1851, 561, 561, 561, 561, 1855, 561, 561, 561, 561, 561, 2883, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2892, 561, 561, 2895, 561, 561, 2898, 561, 0, 0, 2899, 585, 585, 585, 585, 585, 585, 585, 1965, 585, 585, 585, 1970, 585, 585, 585, 585, 585, 2931, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2940, 585, 585, 2943, 585, 585, 2946, 585, 561, 2948, 585, 2949, 2950, 540, 540, 561, 561, 561, 561, 1878, 561, 561, 561, 561, 1884, 561, 561, 561, 561, 561, 561, 936, 561, 561, 561, 561, 561, 561, 561, 561, 561, 984, 0, 585, 585, 585, 585, 585, 585, 1007, 585, 0, 2968, 2969, 0, 0, 0, 0, 2974, 0, 0, 0, 0, 0, 0, 0, 0, 331, 0, 331, 331, 0, 0, 0, 0, 3020, 0, 0, 540, 540, 3025, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3043, 540, 540, 540, 540, 540, 540, 540, 3050, 540, 540, 3052, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1352, 540, 540, 540, 540, 540, 561, 561, 561, 3091, 561, 561, 3093, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2602, 561, 561, 561, 561, 561, 561, 561, 561, 585, 585, 3106, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1496, 585, 585, 585, 1500, 585, 585, 585, 3132, 585, 585, 3134, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1040, 585, 585, 585, 585, 585, 967, 3158, 0, 0, 0, 3162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1222, 0, 0, 1225, 0, 3190, 0, 0, 3193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 540, 2166, 540, 540, 540, 540, 540, 3214, 540, 540, 540, 540, 540, 540, 540, 3219, 540, 540, 540, 540, 540, 540, 540, 2541, 540, 2543, 540, 540, 540, 540, 540, 540, 540, 540, 2581, 540, 540, 540, 540, 0, 2584, 0, 561, 561, 561, 3236, 3237, 561, 561, 561, 561, 561, 3241, 561, 561, 561, 561, 561, 561, 3250, 561, 561, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 3536, 585, 585, 585, 585, 561, 561, 561, 3247, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 585, 3481, 585, 3483, 585, 585, 585, 585, 3269, 585, 585, 585, 585, 585, 585, 585, 585, 3275, 585, 585, 585, 585, 585, 585, 2701, 585, 585, 585, 585, 585, 585, 585, 2706, 585, 0, 0, 3308, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 856, 540, 585, 3359, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1057, 561, 0, 0, 0, 0, 3176, 0, 0, 0, 0, 0, 0, 0, 3386, 0, 0, 0, 0, 0, 1169, 0, 1171, 0, 0, 0, 0, 1176, 0, 0, 0, 0, 0, 1185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 669, 0, 0, 0, 0, 0, 585, 3429, 585, 585, 585, 585, 585, 585, 561, 540, 561, 585, 0, 3437, 0, 0, 0, 0, 0, 3300, 0, 3176, 3302, 0, 0, 3305, 0, 0, 0, 0, 0, 0, 1113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 362, 362, 0, 703, 0, 0, 3440, 0, 0, 0, 3176, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 3452, 540, 540, 540, 540, 3457, 540, 540, 540, 540, 3462, 540, 540, 561, 561, 3467, 561, 0, 997, 1037, 585, 1048, 585, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 776, 0, 0, 0, 0, 0, 783, 0, 0, 561, 561, 561, 3472, 561, 561, 561, 561, 3477, 561, 561, 585, 585, 3482, 585, 585, 585, 585, 585, 585, 3259, 3260, 585, 585, 585, 585, 3264, 3265, 585, 585, 585, 585, 585, 585, 3120, 585, 585, 585, 585, 585, 3126, 585, 585, 3129, 585, 585, 3487, 585, 585, 585, 585, 3492, 585, 585, 561, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 167936, 0, 0, 0, 0, 65536, 0, 3499, 0, 0, 0, 0, 0, 3505, 0, 0, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3397, 540, 540, 540, 540, 540, 540, 540, 540, 3517, 540, 540, 3519, 561, 561, 561, 561, 561, 561, 561, 561, 3252, 561, 561, 561, 561, 561, 561, 585, 561, 561, 561, 3530, 561, 561, 3532, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1042, 585, 585, 585, 585, 585, 969, 585, 585, 3543, 585, 585, 3545, 561, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1144, 0, 362, 362, 0, 1147, 0, 540, 540, 3629, 3630, 540, 540, 561, 561, 561, 3635, 3636, 561, 561, 585, 585, 585, 585, 0, 2029, 0, 0, 0, 0, 0, 2031, 0, 0, 3641, 3642, 585, 585, 561, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 3395, 540, 540, 540, 540, 540, 540, 3401, 561, 561, 585, 585, 0, 540, 561, 585, 0, 540, 561, 585, 3681, 3682, 3683, 3684, 339, 340, 341, 342, 343, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1617, 0, 0, 0, 0, 0, 0, 0, 388, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2469, 0, 2470, 0, 342, 342, 343, 342, 0, 341, 342, 445, 454, 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, 486, 495, 495, 503, 495, 505, 495, 495, 505, 505, 495, 505, 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, 552, 575, 552, 575, 552, 552, 575, 552, 599, 575, 575, 575, 575, 575, 575, 575, 599, 599, 599, 552, 599, 599, 599, 599, 599, 575, 575, 552, 575, 599, 575, 599, 1, 12290, 3, 78112, 0, 0, 0, 646, 0, 0, 0, 0, 651, 652, 653, 654, 655, 656, 657, 0, 0, 0, 0, 1144, 0, 0, 1259, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2957312, 0, 0, 0, 0, 0, 0, 0, 692, 0, 0, 0, 0, 0, 0, 699, 362, 362, 362, 0, 0, 0, 0, 0, 0, 1232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 735, 0, 800, 0, 0, 0, 0, 721, 0, 723, 0, 0, 0, 0, 0, 0, 0, 0, 0, 733, 0, 0, 0, 0, 0, 1202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 333, 334, 0, 0, 0, 0, 0, 646, 752, 753, 754, 0, 0, 0, 0, 0, 760, 761, 0, 0, 0, 0, 0, 0, 1271, 0, 0, 0, 0, 0, 0, 540, 540, 540, 3026, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2220, 540, 540, 540, 540, 540, 0, 761, 0, 0, 790, 0, 0, 0, 0, 0, 0, 0, 0, 0, 797, 0, 0, 0, 0, 1152, 0, 0, 0, 0, 1157, 0, 0, 0, 0, 0, 0, 0, 2106, 0, 0, 0, 0, 0, 0, 0, 0, 1219, 0, 0, 0, 0, 0, 0, 0, 723, 0, 692, 814, 0, 0, 0, 0, 761, 0, 0, 0, 0, 0, 0, 0, 558, 581, 558, 581, 558, 558, 581, 558, 605, 0, 754, 823, 824, 0, 0, 0, 0, 0, 0, 754, 0, 0, 828, 699, 0, 0, 0, 0, 1168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1633, 0, 0, 0, 0, 0, 0, 833, 0, 0, 0, 835, 0, 0, 0, 692, 699, 0, 0, 692, 833, 0, 0, 0, 0, 0, 0, 0, 0, 0, 692, 540, 540, 853, 857, 860, 540, 868, 540, 540, 882, 884, 887, 540, 540, 540, 898, 902, 540, 540, 540, 540, 540, 540, 1766, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1786, 540, 540, 540, 540, 540, 561, 561, 561, 923, 927, 930, 561, 938, 561, 561, 561, 953, 955, 958, 561, 561, 561, 561, 1879, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2641, 561, 561, 561, 561, 561, 561, 561, 561, 2648, 0, 585, 585, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 2717, 540, 540, 540, 585, 585, 585, 1026, 1028, 1031, 585, 585, 585, 1043, 1047, 585, 585, 585, 585, 970, 0, 0, 0, 1060, 585, 1062, 1063, 853, 540, 898, 902, 1068, 923, 561, 970, 974, 561, 561, 561, 561, 0, 585, 585, 585, 996, 1000, 1003, 585, 1011, 1073, 0, 996, 585, 1043, 1047, 1078, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 560, 583, 560, 583, 560, 560, 583, 560, 607, 0, 0, 1199, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1208, 0, 0, 0, 0, 0, 1231, 0, 0, 0, 0, 1236, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 0, 0, 0, 0, 422, 65536, 0, 540, 1322, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1331, 540, 540, 1338, 540, 540, 540, 540, 2228, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 0, 0, 561, 2852, 561, 561, 561, 561, 561, 561, 561, 561, 1422, 561, 561, 1429, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2879, 561, 561, 561, 561, 561, 561, 561, 1442, 561, 561, 561, 561, 561, 561, 26027, 1360, 987, 585, 585, 585, 585, 585, 585, 585, 2925, 585, 585, 585, 585, 585, 585, 585, 585, 561, 540, 561, 585, 3436, 0, 3438, 0, 585, 1503, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1513, 585, 585, 1520, 1667, 0, 1669, 0, 0, 0, 1671, 0, 748, 0, 0, 0, 0, 0, 0, 0, 650, 0, 0, 0, 0, 0, 0, 0, 0, 0, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 282624, 0, 0, 1602, 0, 0, 0, 0, 0, 0, 540, 1738, 540, 540, 540, 540, 540, 540, 540, 2584, 0, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1839, 561, 561, 561, 1743, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2238, 540, 1776, 540, 540, 1781, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1353, 540, 540, 540, 540, 0, 561, 1829, 561, 561, 561, 561, 561, 561, 1835, 561, 561, 561, 561, 561, 561, 1864, 561, 561, 561, 1868, 561, 561, 1873, 561, 561, 1907, 561, 561, 561, 561, 561, 561, 561, 561, 561, 26027, 0, 585, 1923, 585, 585, 585, 585, 585, 585, 3270, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1968, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1929, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1511, 585, 585, 585, 585, 585, 1958, 585, 585, 585, 1962, 585, 585, 1967, 585, 585, 585, 585, 585, 585, 585, 1469, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2392, 585, 585, 585, 2395, 585, 585, 0, 1086, 0, 0, 0, 2034, 0, 1090, 0, 0, 0, 2036, 0, 1094, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1226, 585, 585, 585, 585, 2362, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1534, 585, 585, 585, 585, 2585, 0, 1826, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2271, 585, 585, 585, 2710, 585, 585, 585, 561, 540, 585, 585, 561, 540, 540, 540, 540, 540, 540, 1814, 540, 540, 540, 540, 1820, 540, 540, 540, 1360, 0, 0, 0, 0, 2744, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1649, 0, 0, 0, 0, 585, 585, 585, 585, 2924, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1937, 585, 585, 585, 585, 561, 561, 3338, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1857, 561, 561, 0, 0, 0, 0, 3176, 0, 0, 0, 0, 0, 0, 3385, 0, 0, 0, 0, 0, 0, 1628, 1629, 1630, 0, 0, 0, 0, 0, 0, 0, 0, 1159168, 362, 0, 0, 0, 0, 0, 0, 3402, 540, 540, 540, 561, 561, 561, 3407, 561, 561, 561, 561, 3411, 561, 561, 561, 561, 1391, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1414, 561, 561, 561, 561, 561, 561, 3417, 561, 561, 561, 585, 585, 585, 3422, 585, 585, 585, 585, 3426, 585, 585, 585, 585, 585, 2375, 2376, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1476, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3432, 585, 585, 585, 561, 540, 561, 585, 0, 0, 0, 0, 0, 0, 1644, 0, 0, 0, 0, 0, 0, 0, 0, 0, 661, 0, 661, 0, 0, 0, 0, 0, 0, 0, 0, 3176, 0, 0, 0, 0, 3446, 0, 0, 0, 540, 540, 540, 3392, 540, 540, 540, 540, 3396, 540, 540, 540, 540, 540, 540, 540, 3039, 540, 540, 540, 540, 540, 3045, 540, 540, 540, 540, 3455, 540, 540, 540, 3459, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 2626, 561, 561, 561, 561, 561, 561, 2633, 561, 561, 561, 561, 3470, 561, 561, 561, 3474, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 585, 3111, 585, 585, 585, 585, 585, 585, 3485, 585, 585, 585, 3489, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 3603, 540, 3604, 540, 540, 540, 561, 561, 585, 585, 0, 540, 561, 585, 3677, 3678, 3679, 3680, 0, 540, 561, 585, 585, 585, 585, 585, 1079, 0, 1562, 0, 0, 0, 1568, 0, 0, 0, 0, 0, 1256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 300, 300, 0, 0, 0, 0, 386, 0, 0, 0, 390, 386, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1174, 0, 0, 0, 0, 0, 0, 0, 0, 402, 0, 344, 0, 69632, 73728, 0, 0, 0, 0, 0, 65536, 0, 0, 0, 0, 1201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 357, 0, 0, 0, 0, 521, 521, 521, 521, 0, 0, 0, 0, 0, 0, 0, 0, 521, 521, 521, 521, 521, 521, 521, 553, 576, 553, 576, 553, 553, 576, 553, 600, 576, 576, 576, 576, 576, 576, 576, 600, 600, 600, 553, 600, 600, 600, 600, 600, 576, 576, 617, 622, 600, 622, 628, 1, 12290, 3, 78112, 561, 561, 561, 979, 561, 561, 561, 0, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2927, 585, 585, 585, 585, 585, 585, 0, 0, 0, 540, 1061, 585, 561, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 3238, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1433, 561, 561, 561, 561, 561, 1107, 0, 0, 0, 0, 1112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1190, 0, 0, 0, 0, 0, 561, 561, 561, 1389, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2308, 2309, 561, 561, 561, 1403, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2296, 2297, 1440, 561, 561, 561, 561, 561, 561, 561, 26027, 1360, 987, 585, 585, 585, 585, 585, 585, 585, 2947, 540, 585, 585, 561, 540, 540, 561, 561, 1574, 0, 0, 0, 1580, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1664, 0, 0, 0, 0, 1606, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1620, 0, 0, 0, 0, 1216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2110, 0, 0, 0, 0, 561, 561, 561, 1877, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2322, 0, 0, 0, 2052, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2155, 0, 2116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1676, 0, 2241, 0, 0, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2295, 561, 561, 561, 561, 2274, 561, 561, 561, 561, 2278, 561, 2280, 561, 561, 561, 561, 561, 561, 1897, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1397, 561, 561, 561, 561, 561, 561, 2359, 585, 585, 585, 585, 2363, 585, 2365, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3123, 585, 3125, 585, 585, 585, 585, 0, 0, 0, 2500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2494, 2495, 0, 0, 561, 2622, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2607, 561, 0, 3021, 0, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2533, 540, 0, 0, 0, 0, 3176, 3382, 0, 0, 3384, 0, 0, 0, 0, 0, 0, 0, 728, 0, 0, 0, 0, 0, 0, 0, 0, 1115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 3391, 540, 540, 3393, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1785, 540, 540, 540, 1790, 540, 0, 0, 0, 0, 3176, 0, 3443, 0, 0, 0, 0, 0, 3449, 540, 540, 540, 540, 540, 1782, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2832, 540, 540, 540, 540, 864, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 912, 1095, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2447, 0, 0, 1624, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2060, 0, 0, 1827, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2620, 345, 345, 347, 345, 0, 0, 345, 0, 345, 0, 0, 0, 0, 346, 0, 0, 0, 0, 0, 3310, 0, 0, 3312, 0, 0, 0, 0, 0, 0, 540, 585, 585, 561, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 561, 3410, 561, 561, 561, 561, 561, 0, 0, 0, 345, 345, 347, 345, 345, 345, 345, 345, 345, 512, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 554, 577, 554, 577, 554, 554, 577, 554, 601, 577, 577, 577, 577, 577, 577, 577, 601, 601, 601, 554, 601, 601, 601, 601, 601, 577, 577, 554, 577, 601, 577, 601, 1, 12290, 3, 78112, 0, 722, 0, 724, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2508, 0, 0, 0, 0, 739, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1690, 0, 0, 0, 811, 0, 0, 810, 0, 0, 0, 0, 0, 755, 0, 0, 819, 0, 0, 0, 0, 1269, 0, 0, 0, 0, 0, 0, 0, 1181, 540, 540, 540, 540, 540, 1797, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3464, 561, 561, 561, 561, 540, 540, 872, 540, 540, 540, 540, 890, 892, 540, 540, 903, 540, 540, 540, 540, 540, 540, 2175, 540, 2177, 540, 540, 540, 540, 540, 540, 2185, 561, 561, 918, 924, 561, 561, 561, 561, 942, 561, 561, 561, 561, 561, 962, 964, 561, 561, 975, 561, 561, 561, 561, 0, 585, 585, 991, 997, 585, 585, 585, 585, 585, 585, 585, 3271, 585, 585, 585, 585, 585, 585, 3277, 585, 1015, 585, 585, 585, 585, 585, 1035, 1037, 585, 585, 1048, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 540, 540, 3650, 3651, 540, 540, 0, 0, 0, 540, 991, 585, 561, 854, 892, 540, 903, 540, 924, 964, 561, 975, 0, 0, 0, 1151, 0, 1153, 0, 1155, 0, 0, 0, 0, 0, 0, 0, 0, 713, 0, 0, 0, 0, 0, 0, 0, 0, 1181, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1706, 0, 0, 1198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1731, 0, 1212, 1213, 0, 0, 0, 0, 0, 1218, 0, 0, 0, 0, 0, 0, 0, 0, 729, 0, 0, 0, 0, 0, 0, 0, 540, 540, 1307, 1309, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1316, 540, 540, 1319, 540, 540, 1343, 540, 540, 540, 540, 540, 540, 540, 540, 1354, 1355, 540, 540, 540, 540, 540, 1813, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1360, 1360, 914, 561, 561, 561, 1366, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 26027, 1921, 585, 585, 585, 585, 561, 561, 1420, 561, 561, 561, 561, 561, 561, 561, 1434, 561, 561, 561, 561, 561, 561, 3342, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3080, 561, 561, 561, 561, 561, 561, 561, 561, 2319, 561, 561, 561, 561, 0, 0, 0, 561, 561, 561, 1445, 1446, 561, 561, 561, 26027, 1360, 987, 585, 585, 585, 1457, 585, 585, 585, 585, 585, 2403, 585, 585, 585, 585, 585, 561, 2409, 585, 2411, 2412, 585, 1487, 1489, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3366, 585, 585, 585, 585, 1525, 585, 585, 585, 585, 585, 585, 585, 585, 1536, 1537, 585, 585, 585, 585, 585, 585, 3434, 585, 561, 540, 561, 585, 0, 0, 0, 3439, 585, 1542, 0, 540, 585, 585, 561, 540, 1547, 540, 540, 1550, 561, 1551, 561, 561, 561, 561, 1895, 561, 561, 561, 1900, 561, 561, 561, 561, 561, 561, 561, 0, 585, 585, 988, 585, 585, 585, 585, 585, 1554, 585, 1555, 585, 585, 1558, 1079, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2069, 0, 0, 0, 0, 2073, 0, 0, 1678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2037, 0, 0, 0, 1694, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2072, 0, 0, 0, 1637, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2051, 0, 0, 561, 561, 561, 561, 561, 561, 1833, 561, 561, 561, 561, 561, 561, 561, 561, 26027, 1360, 987, 585, 585, 585, 585, 585, 561, 1908, 561, 561, 561, 561, 1914, 561, 561, 561, 26027, 0, 585, 585, 585, 585, 585, 2334, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2938, 585, 585, 585, 585, 585, 585, 585, 1927, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1055, 585, 561, 585, 585, 585, 1994, 585, 585, 585, 585, 585, 585, 585, 585, 2002, 585, 585, 585, 585, 585, 585, 2711, 561, 540, 585, 585, 561, 540, 540, 540, 540, 540, 540, 2217, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1802, 540, 540, 540, 540, 540, 585, 2008, 585, 585, 585, 561, 540, 585, 585, 561, 540, 540, 540, 540, 561, 561, 561, 561, 2261, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2891, 561, 561, 561, 561, 0, 2076, 0, 0, 0, 0, 0, 0, 0, 0, 2084, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 266240, 0, 0, 0, 0, 65536, 0, 2088, 0, 0, 2090, 0, 0, 0, 0, 0, 0, 0, 2098, 0, 0, 0, 0, 0, 0, 1725, 0, 0, 0, 0, 0, 0, 0, 0, 0, 643, 0, 0, 0, 0, 0, 0, 0, 0, 2146, 0, 0, 0, 2146, 0, 0, 2151, 2152, 0, 0, 0, 0, 0, 0, 0, 274432, 274432, 274432, 0, 274432, 274432, 274432, 274432, 274432, 2156, 0, 0, 0, 0, 0, 0, 0, 2162, 540, 540, 540, 540, 540, 2168, 540, 540, 540, 540, 2538, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1821, 540, 540, 1360, 540, 2200, 540, 2203, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2209, 540, 540, 540, 540, 2578, 540, 540, 540, 540, 540, 540, 540, 540, 0, 2584, 0, 0, 0, 0, 799, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 799, 0, 0, 0, 0, 0, 0, 0, 0, 2244, 561, 561, 561, 561, 561, 561, 2251, 561, 561, 561, 561, 561, 561, 3351, 585, 585, 585, 585, 585, 585, 585, 3356, 585, 561, 561, 2300, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2323, 0, 0, 0, 2329, 585, 585, 585, 585, 585, 585, 2336, 585, 585, 585, 585, 585, 585, 585, 1470, 585, 585, 585, 585, 1480, 585, 585, 585, 585, 585, 2360, 585, 585, 585, 585, 585, 585, 2366, 585, 2368, 585, 2371, 585, 585, 585, 585, 585, 585, 3546, 0, 0, 3549, 3550, 0, 0, 0, 0, 0, 0, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2912256, 0, 3207168, 2465792, 0, 0, 2385, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1989, 2472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2480, 0, 0, 0, 0, 0, 0, 0, 286720, 286720, 0, 286720, 286720, 1, 12290, 3, 0, 0, 0, 0, 0, 2514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2522, 0, 0, 0, 0, 1575, 0, 0, 0, 0, 0, 1581, 0, 0, 0, 0, 0, 0, 0, 69632, 73728, 172032, 0, 0, 0, 0, 65536, 0, 561, 561, 2596, 561, 561, 561, 561, 561, 2601, 561, 561, 561, 561, 561, 561, 561, 0, 585, 585, 992, 585, 585, 585, 585, 585, 585, 2681, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1956, 585, 2719, 561, 561, 561, 2721, 585, 585, 585, 2723, 2724, 0, 0, 0, 0, 0, 0, 0, 2801, 0, 0, 0, 540, 2805, 540, 540, 540, 2742, 0, 2743, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2100, 0, 0, 0, 0, 2758, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2128, 0, 0, 540, 2809, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2223, 2224, 540, 2846, 540, 540, 540, 540, 540, 0, 0, 561, 561, 561, 561, 2855, 561, 2856, 561, 2894, 561, 561, 561, 561, 561, 0, 0, 585, 585, 585, 585, 2903, 585, 2904, 585, 2942, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 540, 540, 561, 561, 585, 585, 0, 0, 0, 3374, 0, 0, 3377, 0, 0, 0, 540, 3024, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1771, 540, 540, 540, 540, 561, 561, 585, 3105, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2369, 585, 585, 585, 585, 585, 3145, 540, 585, 561, 540, 540, 561, 561, 585, 585, 0, 0, 0, 0, 0, 0, 2066, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 297, 0, 0, 0, 0, 0, 0, 0, 3390, 540, 540, 540, 540, 3394, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2179, 540, 540, 540, 540, 540, 540, 540, 3403, 540, 540, 3405, 561, 561, 561, 561, 3409, 561, 561, 561, 561, 561, 561, 2277, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3082, 561, 3084, 561, 561, 561, 561, 561, 561, 561, 3418, 561, 561, 3420, 585, 585, 585, 585, 3424, 585, 585, 585, 585, 585, 585, 585, 3591, 585, 561, 0, 0, 0, 0, 0, 0, 0, 3176, 0, 3303, 0, 0, 0, 0, 3307, 0, 585, 585, 585, 585, 585, 3433, 585, 585, 561, 540, 561, 585, 0, 0, 0, 0, 0, 0, 2137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1129, 0, 0, 0, 0, 0, 0, 0, 3500, 0, 3502, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 3511, 540, 540, 540, 540, 2812, 540, 2815, 540, 540, 540, 540, 2820, 540, 540, 540, 2823, 540, 540, 540, 540, 3631, 540, 561, 561, 561, 561, 561, 3637, 561, 585, 585, 585, 585, 585, 1079, 0, 0, 0, 1564, 0, 0, 0, 1570, 0, 585, 585, 3643, 585, 561, 3645, 0, 3647, 0, 0, 540, 540, 540, 540, 540, 540, 540, 1286, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3208, 540, 540, 540, 540, 540, 365, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2496, 398, 0, 0, 0, 0, 0, 365, 373, 401, 0, 0, 0, 0, 0, 365, 0, 0, 393, 0, 0, 0, 0, 348, 0, 0, 365, 0, 393, 0, 406, 408, 0, 0, 365, 373, 0, 69632, 73728, 0, 0, 0, 0, 424, 65536, 0, 0, 0, 0, 1596, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 362, 0, 0, 0, 424, 424, 0, 424, 0, 408, 424, 447, 455, 0, 0, 0, 0, 0, 0, 0, 777, 0, 0, 0, 0, 0, 0, 0, 644, 0, 406, 0, 496, 496, 0, 496, 496, 496, 496, 496, 496, 496, 496, 522, 522, 522, 522, 455, 455, 455, 530, 455, 531, 455, 455, 522, 536, 522, 522, 522, 522, 538, 555, 578, 555, 578, 555, 555, 578, 555, 602, 578, 578, 578, 608, 608, 608, 578, 602, 602, 602, 555, 602, 602, 602, 602, 602, 578, 578, 618, 623, 602, 623, 629, 1, 12290, 3, 78112, 643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2769, 0, 0, 0, 694, 0, 0, 0, 0, 0, 362, 362, 362, 0, 0, 0, 0, 0, 0, 2440, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1260, 0, 0, 0, 0, 0, 0, 0, 0, 805, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2142, 2143, 0, 540, 540, 540, 878, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1332, 540, 540, 540, 561, 561, 919, 561, 561, 561, 561, 561, 561, 948, 950, 561, 561, 561, 561, 561, 561, 3575, 561, 3577, 561, 561, 561, 585, 585, 585, 585, 0, 0, 1563, 0, 0, 0, 0, 0, 1569, 0, 585, 1021, 1023, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 561, 3496, 0, 3497, 0, 0, 0, 0, 0, 540, 992, 585, 561, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 3341, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3579, 561, 585, 585, 585, 585, 0, 0, 0, 1098, 1230, 0, 0, 0, 0, 0, 0, 1237, 0, 0, 0, 0, 0, 0, 2452, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2764, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1242, 1251, 540, 540, 1280, 540, 540, 540, 1284, 540, 540, 1295, 540, 540, 1299, 540, 540, 540, 540, 540, 2229, 540, 2231, 540, 540, 540, 540, 540, 540, 540, 0, 0, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1840, 561, 561, 1360, 914, 561, 561, 561, 561, 561, 561, 1369, 561, 561, 561, 1373, 561, 561, 1384, 561, 561, 1388, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2324, 0, 0, 561, 561, 1405, 561, 561, 561, 1409, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3612, 3613, 561, 585, 585, 585, 585, 585, 1460, 585, 585, 585, 1464, 585, 585, 1475, 585, 585, 1479, 585, 585, 585, 585, 585, 585, 1032, 585, 585, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 3625, 0, 540, 0, 1623, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1636, 0, 0, 0, 0, 1626, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2058, 2059, 0, 2061, 2062, 1638, 0, 0, 0, 1642, 0, 0, 0, 1646, 0, 0, 0, 1650, 0, 0, 0, 0, 0, 1257, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1145, 362, 362, 0, 0, 1148, 561, 1844, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2635, 561, 561, 561, 561, 1862, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2869, 561, 561, 2872, 2007, 585, 585, 585, 585, 561, 1752, 585, 1938, 1844, 540, 540, 540, 540, 561, 561, 561, 561, 2275, 561, 561, 561, 561, 561, 561, 2281, 561, 2283, 561, 2286, 0, 0, 2056, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2154, 0, 0, 0, 0, 0, 2118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2520, 0, 0, 0, 0, 2132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2141, 0, 0, 0, 0, 0, 0, 2463, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2491, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2158, 0, 0, 2161, 0, 540, 540, 2164, 540, 540, 540, 540, 540, 540, 540, 3053, 540, 3055, 540, 540, 540, 540, 540, 540, 540, 540, 2232, 540, 540, 2235, 2236, 540, 540, 0, 540, 540, 540, 2227, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 0, 2242, 561, 561, 561, 561, 561, 561, 561, 0, 0, 0, 561, 561, 2246, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 26027, 1360, 987, 585, 585, 1455, 585, 1458, 561, 2312, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 0, 0, 0, 0, 0, 0, 585, 2650, 585, 585, 585, 585, 585, 585, 561, 3547, 3548, 0, 0, 0, 0, 0, 0, 3554, 0, 585, 585, 2331, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2381, 2382, 585, 585, 585, 585, 2387, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2397, 540, 540, 2415, 2416, 561, 561, 2419, 2420, 585, 585, 2423, 2424, 0, 1563, 0, 1569, 0, 1575, 0, 1581, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2752, 0, 0, 0, 0, 0, 0, 0, 2438, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1728, 0, 0, 0, 0, 0, 2513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2519, 0, 0, 0, 0, 0, 0, 2478, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1189, 0, 0, 0, 0, 0, 0, 540, 540, 540, 2565, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1333, 540, 540, 540, 585, 585, 2682, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2693, 585, 585, 585, 585, 585, 585, 3590, 585, 585, 561, 0, 3594, 0, 0, 0, 0, 0, 0, 2516, 2466, 0, 0, 0, 0, 0, 2521, 0, 0, 2824, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2239, 561, 561, 561, 561, 2885, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1395, 561, 561, 561, 561, 561, 561, 561, 561, 1430, 561, 561, 561, 561, 561, 561, 561, 561, 2866, 561, 561, 561, 561, 561, 561, 561, 585, 585, 585, 585, 2933, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1985, 585, 585, 585, 585, 0, 3177, 0, 0, 0, 3180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1601, 1602, 0, 0, 0, 0, 0, 0, 0, 0, 3194, 0, 0, 0, 0, 0, 0, 3197, 0, 3199, 540, 540, 540, 540, 880, 540, 885, 540, 891, 540, 894, 540, 540, 908, 540, 540, 540, 540, 540, 3038, 540, 540, 540, 540, 540, 540, 540, 540, 3046, 540, 585, 3289, 3290, 0, 0, 0, 0, 3294, 0, 0, 0, 0, 0, 0, 0, 0, 1099, 0, 0, 0, 0, 0, 0, 0, 540, 540, 3316, 540, 540, 540, 3319, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1819, 540, 540, 540, 540, 1360, 561, 3337, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2646, 561, 3415, 561, 561, 561, 561, 561, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3115, 3428, 585, 3430, 585, 585, 585, 585, 585, 561, 540, 561, 585, 0, 0, 0, 0, 0, 0, 2503, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 336, 290, 0, 0, 0, 0, 3555, 0, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3566, 540, 540, 561, 3064, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2617, 561, 561, 561, 561, 561, 3608, 561, 3609, 561, 561, 561, 561, 561, 561, 561, 585, 585, 3615, 585, 585, 585, 585, 585, 2658, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1952, 585, 585, 585, 585, 585, 3616, 585, 585, 585, 585, 585, 585, 585, 561, 0, 0, 0, 0, 0, 0, 540, 585, 585, 561, 540, 540, 540, 1067, 911, 561, 561, 561, 1072, 407, 353, 0, 0, 0, 0, 0, 69632, 73728, 0, 0, 0, 0, 0, 65536, 0, 0, 0, 0, 1658, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 362, 1146, 0, 0, 472, 483, 472, 0, 0, 472, 0, 0, 0, 0, 0, 0, 0, 0, 523, 523, 527, 527, 527, 527, 472, 472, 472, 472, 472, 477, 472, 472, 527, 523, 527, 527, 527, 527, 539, 556, 579, 556, 579, 556, 556, 579, 556, 603, 579, 579, 579, 579, 579, 579, 579, 603, 603, 603, 556, 603, 603, 603, 603, 603, 579, 579, 619, 624, 603, 624, 630, 1, 12290, 3, 78112, 0, 644, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2101, 0, 738, 0, 0, 0, 644, 738, 0, 744, 745, 644, 0, 0, 0, 0, 0, 0, 0, 0, 793, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 802, 0, 807, 0, 0, 0, 0, 0, 0, 807, 0, 0, 0, 0, 0, 644, 0, 0, 0, 802, 0, 807, 0, 793, 0, 822, 0, 0, 0, 665, 0, 0, 0, 0, 822, 0, 0, 0, 0, 0, 0, 0, 1134592, 0, 362, 0, 0, 0, 1134592, 0, 0, 0, 793, 793, 0, 644, 0, 0, 793, 807, 845, 0, 540, 850, 540, 540, 540, 540, 540, 2539, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3324, 540, 540, 540, 540, 540, 869, 873, 879, 883, 540, 540, 540, 540, 540, 899, 540, 540, 540, 540, 540, 540, 540, 3206, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2205, 540, 540, 540, 540, 540, 540, 561, 561, 920, 561, 561, 561, 561, 939, 943, 949, 561, 954, 561, 561, 561, 561, 585, 585, 585, 585, 0, 0, 0, 0, 0, 2728, 0, 0, 1016, 1022, 585, 1027, 585, 585, 585, 585, 585, 1044, 585, 585, 585, 585, 585, 1058, 0, 0, 0, 540, 993, 585, 561, 540, 540, 899, 540, 540, 561, 561, 971, 561, 561, 561, 561, 561, 0, 585, 585, 993, 585, 585, 585, 585, 1012, 1149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2784, 0, 0, 0, 1200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1211, 1227, 0, 0, 1099, 0, 0, 0, 1233, 0, 1235, 0, 0, 0, 0, 0, 0, 0, 3176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1249, 0, 0, 0, 0, 1670, 0, 0, 0, 0, 0, 0, 1674, 0, 0, 0, 0, 0, 0, 743, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2753, 2754, 0, 1252, 1200, 0, 1233, 1255, 0, 1258, 0, 0, 0, 0, 0, 1130, 0, 0, 0, 0, 0, 1597, 0, 0, 0, 1600, 0, 0, 1603, 0, 0, 0, 0, 0, 843, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 540, 3320, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1801, 540, 540, 540, 1806, 540, 540, 0, 1267, 0, 0, 0, 0, 0, 1267, 0, 0, 1149, 1267, 0, 1274, 540, 540, 540, 540, 1282, 540, 540, 540, 1291, 540, 540, 540, 540, 540, 540, 540, 540, 2204, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2830, 540, 540, 540, 540, 540, 540, 540, 1279, 540, 540, 540, 540, 1285, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2194, 540, 540, 540, 540, 540, 540, 1306, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1317, 540, 540, 540, 540, 540, 2567, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2545, 540, 540, 540, 540, 1321, 540, 540, 540, 540, 540, 540, 540, 1327, 540, 540, 540, 1334, 1336, 540, 540, 540, 540, 1310, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1335, 540, 540, 540, 1360, 914, 1362, 561, 561, 561, 561, 1368, 561, 561, 561, 561, 1374, 561, 561, 561, 561, 1407, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2293, 561, 561, 561, 561, 561, 561, 1406, 561, 561, 561, 561, 1411, 561, 561, 561, 561, 561, 561, 561, 561, 1852, 561, 561, 561, 561, 561, 561, 561, 561, 1866, 561, 561, 561, 561, 561, 561, 561, 1418, 561, 561, 561, 1425, 1427, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1865, 561, 561, 561, 561, 561, 561, 561, 561, 1883, 561, 561, 561, 561, 561, 561, 561, 1459, 585, 585, 585, 585, 1465, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1533, 585, 585, 585, 585, 585, 1486, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1497, 585, 585, 585, 585, 585, 585, 1034, 585, 585, 585, 585, 1052, 585, 585, 585, 561, 1502, 585, 585, 585, 585, 585, 585, 585, 585, 1509, 585, 585, 585, 1516, 1518, 585, 585, 585, 585, 585, 2685, 585, 585, 585, 585, 2689, 585, 585, 585, 2694, 585, 561, 0, 1290, 1544, 1470, 1379, 540, 540, 540, 540, 540, 561, 561, 561, 561, 561, 3249, 561, 3251, 561, 561, 561, 561, 561, 561, 561, 585, 3534, 585, 3535, 585, 585, 585, 3539, 585, 0, 1575, 0, 0, 0, 1581, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1632, 0, 0, 0, 0, 0, 1592, 1593, 0, 0, 0, 0, 0, 1599, 0, 0, 0, 0, 0, 0, 0, 0, 1172, 0, 0, 0, 0, 0, 0, 0, 0, 1639, 0, 0, 0, 0, 0, 0, 0, 1647, 1648, 0, 0, 0, 0, 0, 0, 0, 2387968, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2987, 0, 0, 0, 0, 0, 2990, 0, 1655, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2482, 0, 0, 0, 1721, 0, 0, 0, 0, 0, 0, 0, 1718, 0, 0, 0, 0, 0, 0, 300, 300, 300, 300, 0, 300, 300, 300, 300, 300, 540, 540, 540, 1747, 540, 540, 540, 540, 1753, 540, 540, 540, 540, 540, 540, 540, 540, 1817, 540, 540, 540, 540, 540, 540, 1360, 540, 540, 540, 1764, 540, 540, 540, 540, 1768, 540, 540, 540, 540, 540, 540, 540, 540, 2178, 540, 540, 540, 540, 540, 540, 540, 540, 1287, 1294, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1779, 540, 540, 1783, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2206, 2207, 540, 540, 540, 540, 1809, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1360, 914, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1379, 561, 0, 1074, 585, 585, 1050, 585, 78112, 1079, 0, 0, 0, 0, 0, 0, 0, 1106, 0, 0, 0, 0, 0, 0, 1210, 0, 561, 1845, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1856, 561, 561, 561, 561, 1423, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3253, 561, 561, 561, 561, 585, 561, 1860, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1871, 561, 561, 561, 561, 1424, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 26027, 1920, 585, 585, 585, 585, 1876, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3244, 561, 561, 585, 2026, 585, 585, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 286720, 0, 0, 0, 0, 2079, 2080, 0, 0, 2082, 2083, 0, 0, 0, 0, 0, 0, 0, 3176, 0, 0, 0, 0, 0, 3306, 0, 0, 0, 0, 0, 0, 2105, 0, 0, 0, 0, 2108, 2109, 0, 0, 0, 0, 0, 0, 301, 301, 301, 301, 0, 301, 301, 301, 301, 301, 2115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2796, 0, 0, 0, 2147, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2781, 0, 0, 0, 0, 0, 2157, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 0, 540, 2225, 540, 540, 540, 540, 2230, 540, 540, 540, 540, 540, 540, 540, 540, 0, 0, 0, 0, 1696, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2070, 0, 0, 0, 0, 0, 2242, 0, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2618, 561, 561, 561, 561, 561, 2259, 561, 561, 2263, 561, 561, 561, 2267, 561, 561, 561, 561, 561, 561, 3610, 561, 3611, 561, 561, 561, 585, 585, 585, 585, 0, 0, 0, 2030, 0, 1082, 0, 0, 0, 2032, 585, 2344, 585, 585, 2348, 585, 585, 585, 2352, 585, 585, 585, 585, 585, 585, 585, 1528, 585, 585, 585, 585, 585, 585, 1538, 585, 585, 585, 585, 2361, 585, 585, 2364, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1935, 1936, 585, 585, 585, 585, 1943, 585, 585, 2400, 585, 585, 585, 585, 585, 585, 585, 585, 561, 540, 585, 585, 561, 540, 2718, 540, 540, 0, 0, 0, 2437, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2794, 0, 0, 0, 0, 2473, 0, 0, 0, 2477, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1685, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2501, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2511, 0, 540, 540, 2525, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2532, 540, 540, 540, 540, 1324, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1330, 540, 540, 540, 540, 540, 540, 2550, 540, 540, 2552, 540, 2553, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2193, 540, 540, 2196, 540, 540, 540, 540, 2563, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2574, 540, 540, 540, 540, 2827, 2828, 540, 540, 540, 540, 2831, 540, 540, 540, 540, 540, 540, 540, 1751, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1351, 540, 540, 540, 540, 540, 540, 0, 0, 0, 561, 561, 2587, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2264, 561, 561, 561, 561, 2269, 561, 561, 561, 2594, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2871, 561, 561, 2609, 561, 561, 561, 2612, 561, 561, 2614, 561, 2615, 561, 561, 561, 561, 561, 929, 561, 937, 561, 561, 561, 561, 561, 561, 561, 561, 2629, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2623, 561, 561, 2627, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2290, 2291, 561, 561, 561, 561, 561, 561, 561, 0, 2327, 585, 585, 585, 585, 585, 585, 585, 1507, 585, 585, 585, 585, 585, 585, 585, 585, 561, 540, 585, 561, 3284, 540, 3286, 561, 561, 561, 561, 2638, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3099, 561, 561, 561, 0, 0, 2733, 2734, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3002, 0, 0, 0, 2785, 0, 2787, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2432, 0, 0, 0, 0, 0, 0, 2800, 0, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 540, 3217, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3042, 540, 3044, 540, 540, 540, 540, 540, 540, 2848, 540, 540, 540, 0, 0, 561, 561, 561, 561, 561, 561, 561, 2318, 561, 561, 561, 561, 561, 0, 0, 0, 561, 561, 2859, 561, 2862, 561, 561, 561, 561, 2867, 561, 561, 561, 2870, 561, 561, 561, 561, 2302, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 940, 561, 561, 561, 561, 561, 561, 561, 561, 1394, 561, 561, 561, 561, 561, 561, 561, 1402, 561, 561, 561, 2896, 561, 561, 561, 0, 0, 585, 585, 585, 585, 585, 585, 585, 1529, 585, 585, 585, 585, 585, 585, 585, 585, 2661, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2907, 585, 2910, 585, 585, 585, 585, 2915, 585, 585, 585, 2918, 585, 585, 585, 585, 585, 1527, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2367, 585, 585, 585, 585, 585, 585, 585, 585, 2944, 585, 585, 585, 561, 540, 585, 585, 561, 540, 540, 561, 561, 585, 585, 3373, 0, 0, 0, 3375, 0, 0, 2980, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2979, 2991, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3005, 0, 3006, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2989, 0, 561, 561, 561, 561, 3078, 561, 561, 561, 561, 561, 561, 561, 561, 3086, 561, 561, 561, 561, 2315, 561, 561, 561, 561, 561, 561, 561, 561, 0, 0, 2327, 0, 0, 0, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3273, 585, 585, 585, 585, 585, 585, 561, 561, 585, 585, 585, 3107, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1969, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3119, 585, 585, 585, 585, 585, 585, 585, 585, 3127, 585, 585, 585, 585, 585, 1901, 540, 585, 585, 561, 540, 540, 540, 540, 561, 561, 3065, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3479, 585, 585, 585, 585, 585, 0, 3159, 0, 0, 0, 0, 0, 0, 0, 3165, 0, 0, 0, 0, 0, 0, 0, 3176, 0, 0, 3304, 0, 0, 0, 0, 0, 0, 3191, 0, 0, 0, 0, 0, 0, 3195, 3196, 0, 0, 0, 0, 540, 540, 3601, 540, 3602, 540, 540, 540, 540, 540, 540, 540, 540, 1752, 540, 540, 540, 540, 540, 540, 540, 540, 1349, 540, 540, 540, 540, 540, 540, 540, 540, 1288, 540, 540, 540, 540, 540, 540, 540, 540, 1289, 540, 540, 540, 540, 540, 540, 540, 540, 1290, 540, 540, 540, 540, 1300, 540, 540, 3279, 585, 585, 585, 585, 585, 585, 585, 561, 540, 585, 561, 540, 540, 561, 561, 561, 561, 2611, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2304, 561, 561, 561, 561, 561, 561, 561, 561, 561, 1853, 561, 561, 561, 561, 561, 561, 540, 540, 540, 540, 3317, 540, 540, 540, 3321, 540, 540, 540, 540, 540, 540, 540, 540, 2192, 540, 540, 540, 540, 540, 540, 2198, 561, 561, 561, 3339, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2628, 561, 561, 561, 561, 561, 561, 561, 561, 2305, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3348, 561, 561, 561, 585, 585, 585, 585, 585, 3353, 585, 585, 585, 3357, 561, 561, 3572, 561, 561, 561, 561, 561, 561, 561, 561, 3580, 585, 585, 585, 3584, 3597, 0, 3598, 3599, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3605, 3606, 540, 540, 540, 540, 2837, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1803, 540, 540, 540, 540, 585, 585, 585, 585, 585, 3619, 3620, 585, 561, 0, 0, 3623, 0, 0, 0, 540, 585, 585, 561, 540, 540, 895, 540, 540, 561, 561, 967, 561, 561, 3671, 585, 3672, 0, 540, 561, 585, 0, 540, 561, 585, 0, 540, 561, 585, 585, 585, 585, 585, 1079, 1559, 0, 0, 0, 1565, 0, 0, 0, 1571, 2033, 0, 0, 0, 0, 1577, 2035, 0, 0, 0, 0, 0, 0, 0, 1682, 0, 1684, 0, 0, 0, 0, 0, 0, 0, 1712, 0, 0, 1715, 0, 0, 0, 0, 0, 355, 356, 0, 0, 0, 0, 0, 0, 0, 362, 0, 290, 0, 0, 0, 0, 0, 0, 2762, 0, 0, 0, 0, 0, 0, 0, 2768, 0, 0, 0, 0, 389, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3198, 0, 540, 540, 473, 473, 487, 0, 0, 487, 356, 356, 356, 509, 356, 356, 356, 356, 473, 473, 580, 580, 580, 580, 580, 580, 580, 604, 604, 604, 557, 604, 604, 604, 604, 604, 580, 580, 557, 580, 604, 580, 604, 1, 12290, 3, 78112, 540, 870, 540, 540, 540, 540, 540, 540, 540, 540, 540, 904, 540, 540, 540, 540, 540, 540, 2191, 540, 540, 540, 540, 2195, 540, 2197, 540, 540, 561, 561, 976, 561, 561, 561, 561, 0, 585, 585, 585, 585, 585, 585, 585, 1013, 1197, 0, 0, 0, 0, 0, 0, 0, 1197, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 540, 540, 540, 540, 540, 540, 540, 540, 1360, 914, 561, 561, 561, 561, 561, 561, 561, 561, 1371, 561, 561, 561, 1380, 561, 561, 561, 561, 2639, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2644, 561, 561, 561, 561, 585, 585, 585, 1462, 585, 585, 585, 1471, 585, 585, 585, 585, 585, 585, 585, 585, 1472, 585, 1477, 585, 585, 1481, 585, 585, 1541, 561, 0, 1291, 585, 1471, 1380, 540, 540, 540, 540, 540, 561, 561, 561, 561, 585, 585, 585, 585, 0, 0, 0, 0, 2727, 0, 0, 0, 0, 0, 1576, 0, 0, 0, 1582, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2737, 0, 0, 0, 0, 0, 2741, 0, 1607, 0, 0, 0, 0, 0, 0, 0, 1615, 1616, 0, 0, 0, 0, 0, 0, 303, 204800, 204800, 0, 205103, 204800, 1, 12290, 3, 0, 1761, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 1774, 1891, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3087, 561, 561, 561, 561, 1911, 561, 561, 561, 561, 561, 561, 26027, 0, 585, 585, 585, 585, 585, 585, 1466, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2928, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1947, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2001, 585, 585, 585, 585, 585, 585, 585, 1960, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1973, 0, 0, 2243, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2634, 561, 561, 2328, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2384, 0, 0, 0, 0, 2425, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2085, 2086, 0, 0, 0, 0, 2449, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3175, 0, 0, 0, 0, 561, 561, 561, 561, 561, 561, 2590, 561, 561, 561, 561, 561, 561, 2289, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2292, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2861, 561, 2863, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2877, 561, 561, 561, 561, 561, 561, 561, 561, 1899, 561, 561, 561, 561, 561, 1905, 561, 585, 585, 585, 2909, 585, 2911, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1984, 585, 585, 585, 585, 585, 585, 585, 3360, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1056, 585, 561, 0, 3556, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3567, 540, 561, 561, 561, 561, 2876, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 26027, 0, 585, 585, 585, 585, 561, 561, 561, 561, 3656, 561, 585, 585, 585, 585, 3660, 585, 0, 0, 0, 0, 0, 0, 2775, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2124, 0, 0, 0, 0, 0, 0, 0, 0, 357, 0, 0, 0, 0, 0, 0, 362, 0, 290, 0, 0, 0, 0, 0, 0, 2790, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1147354, 0, 0, 0, 0, 0, 0, 0, 357, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2509, 0, 0, 357, 0, 367, 0, 0, 367, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2457, 0, 0, 581, 581, 581, 581, 581, 581, 581, 605, 605, 605, 558, 605, 605, 605, 605, 605, 581, 581, 558, 581, 605, 581, 605, 1, 12290, 3, 78112, 865, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2575, 1385, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3243, 561, 1775, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3047, 585, 585, 585, 585, 1961, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2380, 585, 585, 585, 585, 2756, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3315, 0, 2981, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3188, 0, 3298, 0, 3299, 0, 0, 0, 0, 3176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3388, 0, 0, 0, 0, 358, 359, 360, 361, 0, 0, 362, 0, 290, 0, 0, 0, 0, 0, 0, 2973, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 362, 362, 702, 0, 0, 0, 0, 359, 0, 358, 0, 0, 0, 69632, 73728, 0, 0, 0, 0, 425, 65536, 0, 0, 0, 0, 1710, 1711, 0, 0, 0, 1714, 0, 0, 0, 0, 0, 1718, 425, 425, 0, 425, 0, 359, 425, 0, 456, 0, 0, 0, 0, 0, 0, 0, 1102, 0, 0, 0, 0, 1263, 1264, 0, 0, 0, 0, 0, 497, 497, 0, 504, 504, 504, 504, 510, 511, 504, 504, 524, 524, 524, 524, 456, 456, 456, 456, 456, 456, 456, 456, 524, 524, 524, 524, 524, 524, 524, 559, 582, 559, 582, 559, 559, 582, 559, 606, 582, 582, 582, 582, 582, 582, 582, 606, 606, 606, 559, 606, 606, 606, 606, 606, 582, 582, 620, 625, 606, 625, 631, 1, 12290, 3, 78112, 0, 0, 0, 540, 585, 585, 561, 540, 540, 900, 540, 540, 561, 561, 972, 561, 561, 561, 561, 561, 0, 585, 585, 585, 585, 585, 585, 585, 585, 1934, 585, 585, 585, 585, 585, 585, 585, 0, 0, 2104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2740, 0, 0, 0, 0, 0, 561, 2245, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3533, 585, 585, 585, 585, 585, 585, 585, 585, 585, 3494, 561, 0, 0, 0, 0, 0, 0, 585, 2330, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 1482, 585, 585, 540, 2549, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2237, 0, 540, 540, 2577, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 0, 0, 0, 0, 0, 1611, 0, 0, 1614, 0, 0, 0, 0, 0, 0, 0, 443, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2891776, 0, 0, 0, 0, 0, 2392064, 583, 583, 583, 583, 583, 583, 583, 607, 607, 607, 560, 607, 607, 607, 607, 607, 583, 583, 560, 583, 607, 583, 607, 1, 12290, 3, 78112, 705, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 155648, 866, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 3224, 1136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 362, 362, 0, 0, 0, 0, 0, 1659, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 780, 0, 0, 0, 0, 786, 561, 585, 585, 585, 585, 585, 1079, 1560, 0, 0, 0, 1566, 0, 0, 0, 1572, 0, 0, 0, 1578, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3313, 0, 0, 540, 2199, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2547, 540, 2535, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 2822, 540, 561, 561, 561, 2597, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2317, 561, 561, 2320, 2321, 561, 561, 0, 0, 0, 0, 0, 0, 647, 0, 0, 0, 0, 0, 0, 743, 540, 540, 540, 540, 540, 540, 540, 3331, 540, 540, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3072, 561, 561, 561, 0, 0, 0, 540, 585, 585, 561, 1064, 540, 540, 905, 540, 1069, 561, 561, 977, 561, 561, 561, 561, 0, 585, 585, 585, 585, 585, 585, 585, 585, 1951, 585, 585, 585, 585, 585, 585, 585, 0, 0, 1594, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2767, 0, 0, 561, 561, 1846, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2645, 561, 561, 585, 585, 585, 1977, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2692, 585, 585, 585, 540, 540, 540, 2188, 540, 2190, 540, 540, 540, 540, 540, 540, 540, 540, 540, 540, 561, 561, 561, 3334, 561, 561, 0, 0, 0, 561, 561, 561, 2247, 561, 561, 561, 561, 561, 561, 561, 561, 561, 2613, 561, 561, 561, 561, 561, 561, 561, 2619, 561, 561, 2273, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, 3242, 561, 561, 0, 585, 585, 585, 2332, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2408, 540, 585, 585, 561, 561, 2647, 0, 0, 0, 0, 0, 0, 585, 585, 585, 585, 585, 585, 585, 585, 2687, 585, 585, 2691, 585, 585, 585, 585, 585, 585, 585, 585, 2684, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 2916, 585, 585, 585, 585, 561, 561, 585, 585, 585, 585, 585, 3109, 585, 585, 585, 585, 585, 585, 585, 585, 2702, 585, 585, 585, 585, 585, 585, 585, 0, 1134592, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 225706, 0, 0, 1134592, 0, 0, 0, 1134592, 1134592, 0, 0, 1134592, 0, 0, 1134592, 0, 1134592, 0, 0, 0, 1134592, 1135005, 1135005, 0, 0, 0, 0, 0, 1135005, 0, 1134592, 1134592, 0, 0, 0, 0, 1135202, 1135202, 1135202, 1135202, 1134592, 1135202, 1135202, 1135202, 1135202, 1135202, 0, 1134592, 1134592, 1134592, 1134592, 1135202, 1134592, 1135202, 1, 12290, 3, 0, 0, 0, 0, 2134016, 0, 0, 0, 0, 0, 0, 0, 0, 1138688, 0, 0, 0, 0, 0, 1670, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2125824, 2126738, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 2125824, 2125824, 2125824, 2125824, 2424832, 2433024, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 987, 2125824, 2125824, 2125824, 2125824, 2424832, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 1147354, 457, 457, 1147354, 457, 457, 457, 457, 457, 457, 457, 457, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 1147405, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2792, 0, 0, 0, 0, 0, 0, 457, 0, 0, 0, 1147354, 1147354, 1147354, 1147405, 1147405, 1147354, 1147405, 1147405, 1, 12290, 3, 0, 0, 0, 0, 2042, 0, 0, 2045, 2046, 0, 0, 0, 2050, 0, 0, 0, 0, 0, 680, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1221, 0, 0, 0, 0, 0, 0, 1142784, 0, 2179072, 2125824, 2125824, 2125824, 2179072, 2179072, 2179072, 2179072, 2179072, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 3137536, 2125824, 2940928, 2940928, 2940928, 0, 0, 0, 0, 0, 0, 305, 440, 448, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 1159168, 0, 0, 1159168, 0, 1159168, 1159168, 0, 1159168, 0, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2802, 0, 540, 540, 540, 540, 540, 1159168, 1159168, 0, 1159168, 1159168, 0, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 0, 1159168, 1159168, 0, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1159168, 1, 12290, 3, 0, 0, 0, 0, 2053, 0, 2054, 0, 0, 0, 0, 0, 0, 0, 0, 0, 799, 0, 799, 0, 0, 0, 0, 0, 0, 0, 2134016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1163264, 0, 0, 0, 0, 0, 155648, 155648, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 358, 0, 913, 2125824, 2125824, 2125824, 2125824, 2424832, 2433024, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 0, 0, 1452, 2125824, 2125824, 2125824, 2125824, 2424832, 106496, 0, 106496, 106496, 0, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 0, 0, 106496, 0, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 106496, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2183168, 0, 0, 0, 0, 0, 0, 0, 0, 2134016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2782, 2783, 0, 0, 0, 0, 3117056, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163840, 0, 0, 0, 0, 3043328, 0, 3149824, 2936832, 0, 2760704, 0, 0, 0, 0, 0, 2953216, 0, 0, 2826240, 2875392, 0, 0, 0, 0, 0, 0, 2834432, 0, 3227648, 2568192, 0, 0, 0, 0, 2564096, 0, 2748416, 2879488, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2179072, 2179072, 2179072, 3137536, 2125824, 2125824, 2498560, 2125824, 2125824, 2125824, 2555904, 2564096, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2125824, 2654208, 2678784, 2760704, 2764800, 2785280, 2854912, 2969600, 2125824, 3006464, 2125824, 3018752, 2125824, 2125824
21507 ];
21508
21509 XQueryParser.EXPECTED =
21510 [ 260, 268, 276, 283, 296, 304, 881, 312, 318, 331, 366, 339, 350, 361, 369, 342, 288, 886, 1555, 1545, 377, 384, 1551, 392, 400, 415, 423, 431, 439, 447, 455, 463, 486, 553, 490, 500, 500, 499, 498, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 353, 1871, 509, 517, 525, 1149, 688, 533, 1759, 407, 548, 949, 561, 323, 569, 1480, 1303, 866, 577, 1034, 592, 596, 1439, 1444, 604, 1857, 628, 636, 644, 1919, 1049, 652, 673, 660, 668, 681, 696, 995, 710, 718, 731, 1324, 739, 761, 1116, 776, 784, 792, 1170, 1200, 1204, 807, 843, 851, 859, 894, 902, 910, 723, 918, 926, 934, 942, 753, 957, 1568, 965, 980, 611, 988, 1738, 1003, 1011, 616, 1185, 1827, 871, 1539, 1029, 1042, 1418, 584, 1424, 972, 1057, 1065, 1073, 1598, 1087, 1095, 1103, 1111, 1134, 1142, 768, 478, 1163, 1289, 620, 1155, 1178, 876, 1620, 1643, 1193, 702, 1812, 799, 1789, 1212, 1753, 1218, 1226, 1234, 1242, 500, 1250, 1258, 828, 1266, 1274, 1282, 1297, 1850, 1311, 1319, 1332, 1079, 540, 1345, 1017, 1337, 1359, 1021, 1367, 1375, 1390, 1398, 1403, 1411, 1432, 1452, 1460, 1468, 1476, 1488, 1496, 1382, 1516, 1524, 1532, 1563, 1576, 746, 1584, 1592, 1502, 1606, 1614, 814, 1628, 1636, 469, 821, 1661, 1665, 1673, 1678, 1686, 1694, 1702, 1710, 1718, 501, 1726, 1734, 1746, 1767, 1775, 1783, 1351, 1126, 1797, 1805, 1121, 835, 1820, 474, 1835, 1843, 1865, 1508, 1879, 1649, 1653, 1887, 1892, 1900, 1908, 1916, 500, 500, 1927, 1975, 1928, 1939, 1939, 1939, 1934, 1938, 1939, 1930, 1943, 1950, 1946, 1954, 1958, 1961, 1964, 1968, 1972, 1979, 2007, 2007, 2007, 3094, 2007, 1983, 3521, 2007, 2812, 2007, 2007, 2007, 2007, 2779, 2007, 2007, 2132, 2007, 4152, 3820, 3824, 1987, 2098, 1994, 2000, 2006, 2007, 2007, 3996, 2007, 2007, 2012, 4079, 3820, 3824, 3824, 3824, 3824, 2019, 2097, 2097, 2026, 2170, 2032, 2007, 2007, 2007, 2007, 2919, 2007, 2428, 3887, 2007, 3734, 2038, 2089, 2007, 2007, 2007, 3390, 3824, 3824, 2045, 2097, 2097, 2097, 2097, 2097, 2099, 1996, 2067, 2059, 2063, 2003, 2007, 2007, 2007, 2007, 2007, 2259, 3005, 2007, 3049, 2007, 2007, 2007, 3818, 3820, 3820, 3820, 3820, 2133, 3824, 3824, 3824, 3824, 3824, 2055, 3820, 2139, 3824, 3824, 3824, 3827, 2097, 2097, 2022, 2072, 2007, 2007, 4080, 2007, 2162, 2077, 2007, 2007, 2779, 3400, 3820, 3820, 2053, 3824, 3825, 2097, 2097, 2084, 2072, 2088, 4151, 2385, 2007, 2007, 2007, 2007, 3112, 2752, 3820, 2052, 3824, 2095, 2097, 2104, 2778, 2050, 3823, 2095, 2115, 2129, 3821, 3826, 1989, 3390, 3822, 3827, 1990, 2137, 2141, 2149, 3819, 2141, 2159, 2167, 2048, 2174, 2028, 2181, 2184, 2188, 2192, 2202, 2202, 2193, 2197, 2201, 2203, 2207, 2211, 2215, 2219, 2222, 2226, 2230, 2234, 2238, 2732, 2242, 2007, 2007, 2737, 2247, 2007, 2007, 2007, 3028, 4134, 2007, 2007, 2007, 3213, 2007, 2007, 2007, 2007, 2702, 3310, 2007, 3694, 2243, 2007, 4531, 2253, 2007, 2007, 2007, 2007, 2007, 4488, 2007, 2007, 2007, 4489, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 4297, 2280, 2282, 2286, 2289, 2293, 2297, 2301, 2662, 2386, 2007, 2007, 2007, 2007, 2387, 2307, 2314, 2318, 4376, 4208, 2325, 2681, 3075, 3584, 2645, 2353, 2359, 2620, 2007, 2007, 2381, 2363, 2007, 2007, 3675, 2007, 3534, 4411, 3291, 4070, 3348, 2391, 2007, 2395, 2399, 2007, 2007, 2007, 2007, 3092, 3298, 2007, 2007, 2402, 2007, 2007, 2007, 3382, 2007, 2007, 2418, 3423, 2432, 2007, 2007, 2007, 2007, 2797, 2433, 2797, 2457, 2007, 2007, 2007, 2007, 2463, 2007, 2007, 3716, 3131, 2917, 2007, 2007, 3777, 4457, 4344, 2470, 2007, 2007, 2007, 2477, 2007, 2007, 2007, 2484, 2007, 2107, 3702, 2007, 3700, 2493, 2007, 2111, 2007, 2007, 3723, 3037, 2007, 2007, 2007, 2090, 3072, 2007, 2007, 2007, 2007, 2261, 3346, 2007, 2007, 2500, 2007, 2505, 4255, 4115, 4254, 2007, 4238, 2510, 4117, 3651, 3491, 2511, 4118, 4239, 4255, 3650, 4117, 2516, 4116, 4117, 3593, 3670, 3596, 2528, 2531, 2535, 2538, 2542, 2007, 3509, 2620, 4365, 4173, 2562, 2566, 2570, 2007, 2674, 2672, 3782, 2574, 2007, 3457, 2579, 2007, 2501, 2007, 4424, 3255, 2555, 2588, 4214, 4424, 4450, 2584, 2592, 2599, 3102, 4176, 2007, 2007, 3778, 2008, 2342, 4482, 2348, 4126, 4353, 2007, 2007, 2007, 2721, 2607, 2007, 2007, 2007, 3379, 2007, 2007, 2007, 3480, 2619, 2007, 4362, 2007, 4150, 4231, 2625, 4223, 2632, 2636, 2007, 4444, 2654, 2007, 2007, 2007, 2007, 3897, 2007, 2007, 4225, 2675, 2642, 2007, 2007, 2007, 2007, 4443, 2653, 4024, 2007, 4424, 4341, 2118, 4304, 2679, 2007, 2007, 3794, 2734, 2268, 4056, 2403, 2007, 2007, 3896, 2007, 2655, 2910, 4541, 3011, 2685, 2775, 2007, 2007, 2007, 3576, 2686, 2007, 2007, 4010, 3290, 2007, 2007, 3151, 3295, 3238, 2007, 2697, 2007, 3451, 2403, 4245, 2586, 4285, 2701, 3577, 2715, 2007, 2007, 2007, 3620, 2706, 2007, 2007, 2007, 2007, 2713, 2775, 2007, 2007, 4082, 3399, 2007, 2007, 4082, 3399, 2741, 2769, 2855, 2774, 2007, 3410, 2751, 2007, 2007, 4104, 2007, 2007, 2007, 2007, 2506, 4140, 4109, 4114, 3788, 2803, 4147, 2007, 2007, 4385, 3699, 2007, 3534, 4411, 2007, 2041, 4469, 4448, 2007, 2007, 2007, 2709, 3410, 2751, 2702, 2784, 3450, 4048, 2121, 2770, 3436, 2007, 3434, 3438, 2007, 2791, 2007, 2795, 2801, 2328, 2810, 2787, 2452, 2816, 2453, 2007, 2443, 2450, 2424, 2465, 2007, 2007, 2007, 2007, 3098, 2007, 2007, 2007, 2007, 3372, 2007, 2007, 2007, 2007, 3389, 3820, 3820, 3820, 2163, 3824, 3824, 3824, 3824, 4039, 2821, 2787, 2832, 2786, 3985, 2838, 2843, 4030, 3312, 2839, 2844, 4031, 4431, 2848, 2834, 2852, 2859, 2860, 2177, 2864, 3301, 4460, 4463, 2871, 4547, 2875, 2879, 2883, 2886, 2890, 2894, 2897, 2899, 2900, 2007, 2007, 2904, 2007, 3808, 2910, 4541, 3081, 2914, 2007, 2007, 2924, 2928, 2937, 2944, 2952, 2961, 2968, 3274, 2970, 2007, 2473, 2408, 2007, 2007, 2007, 2007, 2414, 3024, 2007, 2495, 2976, 2980, 4495, 4081, 2986, 2999, 2007, 2007, 2007, 2007, 2007, 3335, 2007, 2489, 2007, 3285, 2007, 3286, 2007, 3109, 2656, 3009, 3015, 3021, 3139, 2007, 4251, 2344, 3032, 2007, 2007, 2007, 2007, 3722, 3036, 2007, 2612, 2007, 2007, 3782, 2574, 2007, 3508, 4541, 3046, 3053, 2702, 3058, 2007, 2007, 3062, 3067, 2007, 2007, 2007, 2007, 3063, 2007, 2007, 2007, 3691, 2007, 2007, 2007, 2007, 2338, 3741, 2007, 2007, 3119, 2007, 2007, 2007, 3125, 2007, 2007, 2007, 2550, 4047, 2007, 2007, 2920, 3125, 2007, 2007, 3428, 4501, 2355, 3026, 2007, 2615, 2654, 4143, 3807, 3464, 2520, 2524, 3111, 2918, 2007, 3114, 3109, 3780, 3113, 3150, 3110, 3781, 3147, 4236, 3779, 2920, 3137, 2919, 2920, 3489, 4183, 3144, 3155, 2155, 2007, 2007, 2007, 4522, 3741, 2007, 3667, 2007, 3121, 3163, 3167, 3171, 3175, 3179, 3183, 3187, 3191, 2007, 2007, 2817, 3354, 2007, 2765, 3195, 3974, 3201, 3218, 4237, 3222, 3226, 3236, 4136, 3242, 3713, 3038, 3248, 3246, 2007, 2007, 2007, 2575, 2690, 2007, 2007, 2007, 2007, 4428, 2007, 2007, 2007, 2249, 4402, 4409, 2007, 2007, 3231, 3253, 2007, 2765, 3195, 3974, 3259, 3475, 4398, 3265, 3269, 3278, 2007, 2007, 3282, 2007, 2647, 2638, 3815, 3004, 2336, 2007, 2007, 2007, 3352, 2007, 2765, 3195, 2780, 3316, 2068, 3260, 3320, 3417, 3327, 3333, 2007, 2719, 3457, 2007, 2725, 2730, 2741, 4471, 3360, 3364, 3407, 2007, 2007, 2007, 3368, 2007, 2736, 3608, 3079, 3085, 3140, 2702, 4437, 3054, 3399, 2007, 2007, 2007, 4081, 3398, 2007, 2745, 2007, 2007, 3576, 2749, 2007, 2007, 2719, 2756, 2763, 3971, 3448, 2007, 2007, 3455, 2007, 2007, 3455, 2007, 2255, 2007, 3975, 3472, 3484, 2007, 3497, 2971, 3449, 2972, 2007, 3503, 3273, 4555, 4530, 4554, 3513, 4094, 4553, 3271, 4553, 4095, 4554, 3272, 4093, 4528, 3271, 3515, 4528, 4529, 2007, 4379, 2620, 3519, 2007, 3525, 4151, 3529, 3538, 3542, 3546, 3550, 3554, 3558, 3562, 3566, 2828, 3729, 2918, 2410, 4192, 3571, 3230, 4556, 3575, 3581, 3356, 3619, 3590, 2007, 2007, 4378, 3676, 2007, 3534, 4488, 2007, 2948, 3600, 2007, 2867, 3355, 2007, 2007, 2007, 2007, 3339, 4185, 3612, 2007, 2007, 2580, 3618, 2007, 2007, 2549, 2551, 2386, 2007, 2007, 3132, 3630, 2007, 2007, 2608, 3641, 2007, 3647, 4412, 2007, 3655, 3866, 3249, 3663, 2007, 2007, 2007, 2660, 2007, 2007, 2666, 2007, 4405, 2007, 2007, 2007, 2007, 2337, 3687, 2007, 2594, 3230, 4081, 3698, 2007, 2805, 3682, 2007, 2007, 2007, 3686, 2007, 2007, 2824, 2007, 2007, 2007, 2007, 2826, 4487, 2995, 2957, 2349, 3606, 2007, 2007, 3706, 2007, 4081, 3710, 2007, 2595, 2007, 3720, 4485, 2946, 3727, 3068, 3733, 2007, 3738, 2620, 2007, 2940, 2777, 3753, 3945, 3949, 3954, 3868, 2007, 3747, 2620, 2007, 2007, 3747, 2620, 3751, 2378, 2034, 3757, 3764, 3636, 2007, 4288, 2007, 2007, 4288, 3428, 3769, 2466, 2015, 3765, 3773, 2007, 3786, 2007, 3127, 2007, 2954, 2007, 2007, 3775, 2007, 2007, 3775, 2007, 2007, 2956, 2007, 2548, 2459, 2007, 3792, 3751, 3798, 3760, 3637, 2602, 2007, 3149, 4508, 2110, 2488, 2007, 3701, 2494, 2007, 2007, 4046, 2007, 3780, 2603, 2007, 3802, 3806, 3812, 3837, 4356, 3836, 3831, 2331, 3835, 3677, 3841, 2332, 3836, 3678, 4221, 3854, 3848, 4359, 3847, 3845, 3852, 3877, 3863, 3874, 3881, 3884, 2007, 2007, 2007, 2007, 2480, 2437, 2007, 2007, 2964, 2776, 2007, 3893, 3901, 3905, 3909, 3913, 3917, 3921, 3925, 3929, 3933, 3937, 2007, 2007, 2982, 4068, 4074, 4253, 2007, 2007, 3212, 4493, 2007, 2007, 2007, 2248, 3959, 3964, 3968, 4202, 3979, 3983, 3989, 3950, 2007, 4000, 4007, 4014, 2007, 2007, 2963, 2421, 3753, 4019, 4023, 2040, 3626, 4028, 4035, 2007, 3229, 3106, 3743, 3026, 2726, 2007, 2007, 2007, 4080, 2007, 4152, 3820, 3820, 2054, 3824, 3824, 2096, 2097, 2097, 2097, 2097, 2100, 2143, 4043, 2007, 2007, 3205, 3209, 2007, 2007, 2007, 2990, 2994, 2007, 2007, 2248, 3207, 2007, 2007, 2007, 3197, 4052, 2310, 4253, 4060, 2669, 2007, 4114, 2007, 2007, 2007, 2628, 3210, 2007, 2007, 2007, 2506, 4064, 2007, 2007, 3232, 3254, 3975, 2007, 4119, 3159, 2962, 4078, 3753, 4086, 2404, 2007, 4090, 2620, 4114, 2007, 2007, 2007, 4099, 2620, 2007, 2007, 3376, 2007, 2007, 2007, 2007, 2933, 4100, 4108, 4113, 2007, 2439, 4123, 3603, 4423, 2007, 3870, 3133, 2007, 2007, 2007, 4130, 2007, 3386, 2068, 4158, 3394, 3506, 2007, 2007, 2007, 4526, 2007, 2007, 2007, 4526, 2007, 3992, 2370, 4535, 4156, 2920, 2007, 2007, 4162, 2007, 2007, 2007, 4162, 2558, 2007, 4166, 4170, 2007, 4180, 2007, 2007, 4189, 2007, 2007, 4196, 4200, 4206, 4212, 3859, 4218, 2007, 2693, 2007, 2007, 4229, 2007, 3586, 2152, 2145, 4235, 3487, 2007, 4243, 3642, 2775, 3643, 4249, 4440, 2806, 3659, 4259, 4264, 3657, 3857, 3940, 2080, 3658, 3858, 3941, 4274, 3939, 3857, 4278, 3856, 3857, 4282, 3017, 4292, 4293, 4270, 2321, 4301, 4003, 4311, 4315, 4319, 4323, 4327, 4330, 4334, 4338, 2007, 2007, 2007, 2007, 2621, 3230, 3492, 3042, 4267, 3478, 2931, 3955, 4350, 4514, 4396, 3306, 3462, 3468, 3444, 2007, 4516, 2007, 2007, 2446, 2007, 2007, 2007, 2759, 2375, 3002, 4369, 4307, 2007, 4015, 2007, 2546, 2544, 4373, 4383, 2007, 2007, 2007, 4389, 3478, 2931, 2068, 3670, 3532, 4437, 2007, 4393, 2007, 2007, 3427, 3432, 2303, 3443, 3422, 2007, 2007, 4416, 4081, 2007, 2091, 3671, 3422, 3203, 4420, 2007, 2007, 2007, 2007, 2007, 3342, 2007, 3388, 3404, 3414, 3421, 2007, 2254, 3381, 3994, 2931, 4346, 4454, 4260, 3567, 3304, 2007, 3439, 3100, 2007, 2007, 2007, 2007, 3089, 2007, 4467, 2007, 2007, 2007, 2007, 2007, 3214, 2124, 2007, 2007, 4475, 2365, 3889, 3499, 2007, 3616, 2007, 2007, 2007, 2337, 3624, 2007, 2906, 2007, 3329, 3633, 2007, 2499, 3960, 4434, 2007, 2007, 2007, 2007, 4479, 2007, 2007, 3493, 2265, 2007, 2272, 3323, 2276, 4499, 2125, 2007, 4505, 2367, 4512, 2007, 4520, 2512, 2007, 2007, 3211, 4539, 2007, 3211, 4539, 2073, 4037, 4454, 2007, 2007, 2007, 4545, 2007, 2649, 2007, 2007, 4551, 3115, 4157, 3422, 2007, 2369, 2007, 2370, 2007, 2371, 3261, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 3458, 2007, 2007, 2080, 4576, 4599, 4601, 4601, 4596, 4590, 4601, 4601, 5213, 4588, 4600, 4601, 4601, 4601, 4601, 4601, 4601, 4605, 4601, 4601, 4624, 4632, 4592, 4611, 4609, 4615, 4626, 4639, 4641, 4646, 4628, 4651, 4653, 4653, 4647, 4635, 4657, 4642, 4661, 4665, 4669, 4673, 4676, 4680, 4682, 4686, 4690, 4560, 6008, 4569, 4572, 6007, 4694, 4697, 4751, 6953, 4752, 5681, 6931, 4707, 6326, 4735, 4735, 4712, 4752, 4752, 5273, 4792, 6322, 4707, 4735, 5096, 4719, 4736, 5094, 5098, 4748, 4748, 4750, 4752, 4752, 4752, 4752, 4564, 5125, 5113, 4729, 5190, 6233, 4752, 5981, 4707, 4707, 4734, 4735, 4711, 4791, 6324, 5279, 4792, 6322, 4707, 4735, 6320, 4748, 4749, 4752, 4752, 4582, 6339, 6230, 4730, 5190, 4752, 4752, 4752, 6892, 4707, 4707, 6327, 4735, 4714, 6320, 6322, 6322, 6322, 6324, 4707, 4707, 4707, 4710, 4735, 4793, 4788, 6324, 4709, 4765, 5096, 5096, 4748, 4752, 4752, 4752, 4758, 4721, 4752, 4752, 4752, 4777, 4792, 4788, 4709, 4752, 4561, 4752, 5750, 4735, 4735, 4794, 6324, 4752, 5743, 4752, 4752, 4752, 4757, 4752, 4707, 4709, 4735, 4735, 4735, 4735, 4711, 4791, 6322, 4792, 5276, 4722, 4752, 4563, 5399, 6420, 4752, 6238, 5201, 5242, 4735, 4735, 4785, 4752, 4563, 5663, 4752, 4563, 6254, 5386, 5386, 5386, 4752, 4752, 4752, 5746, 4752, 6321, 6322, 6322, 6322, 6323, 6320, 6322, 6322, 6323, 4707, 4707, 4707, 4735, 4752, 4752, 4584, 5193, 4735, 4735, 4713, 4752, 4563, 6913, 6240, 6240, 6240, 6929, 4735, 4735, 4714, 5739, 6322, 6322, 6322, 6325, 6322, 6324, 4707, 4710, 4740, 5096, 5097, 4707, 4709, 4735, 4752, 4698, 4752, 6653, 4709, 5467, 5467, 5467, 4752, 5513, 5517, 5483, 4804, 4818, 4798, 4802, 4844, 4844, 4844, 4808, 4815, 4812, 4828, 4832, 4842, 4844, 4844, 4844, 4844, 4845, 4838, 4926, 4844, 4852, 4850, 4913, 4853, 4857, 4861, 4865, 4835, 4869, 4872, 4879, 4876, 4881, 4883, 4887, 4889, 4891, 4893, 4900, 4900, 4897, 4907, 4910, 4923, 4846, 4916, 4919, 4930, 4933, 4935, 4939, 4903, 4943, 4752, 4752, 4752, 4948, 4715, 4752, 4752, 4752, 4977, 6877, 4954, 4752, 4752, 4752, 4978, 6115, 4759, 4759, 4752, 4752, 4753, 6060, 5603, 6128, 4975, 4752, 4714, 4752, 6620, 4752, 6554, 6723, 6126, 4984, 5424, 5283, 4988, 4992, 4993, 4993, 4993, 4997, 5000, 5002, 5006, 5009, 5013, 5017, 5017, 5019, 5023, 5024, 5028, 5030, 5034, 5038, 5037, 5042, 5046, 4752, 4752, 4760, 5740, 4752, 5065, 4752, 5423, 4752, 4725, 4724, 4723, 4565, 5750, 4752, 5657, 4752, 5671, 5072, 4752, 4743, 4752, 5390, 5082, 4752, 6010, 4752, 4751, 5572, 6253, 5505, 4752, 5971, 6389, 5056, 4752, 4752, 4752, 5074, 5535, 6350, 4752, 4752, 6930, 5401, 4752, 5494, 4752, 4752, 4752, 5125, 4752, 6136, 6009, 4752, 5110, 6936, 6567, 5134, 5141, 5150, 5143, 5152, 4752, 4752, 4754, 4752, 4752, 4752, 4755, 4752, 4752, 4752, 4752, 6233, 6232, 4752, 4752, 6347, 4752, 4752, 6356, 5137, 5161, 5250, 4752, 4752, 4752, 5060, 6584, 5222, 5223, 5186, 4752, 6234, 5190, 6523, 5174, 5165, 5171, 5181, 4752, 4752, 4752, 5190, 4752, 5143, 5180, 4752, 4752, 4756, 6223, 4752, 6358, 5781, 5171, 4752, 6600, 5055, 5251, 4752, 5745, 4752, 4752, 6357, 5166, 4752, 5700, 4752, 6585, 5199, 5167, 5205, 5153, 4752, 5211, 5207, 4752, 4752, 4757, 5714, 4752, 5698, 4752, 5191, 5136, 5142, 5151, 5221, 6420, 4752, 4752, 4757, 5946, 5568, 5167, 6098, 6009, 4752, 5973, 4752, 5175, 5166, 6097, 5153, 4752, 4752, 4583, 6238, 5201, 5241, 4752, 4752, 6357, 5780, 6547, 5167, 5243, 4752, 4752, 6357, 5781, 4960, 4752, 6600, 5250, 5242, 4752, 4752, 4752, 5291, 5782, 5243, 4752, 4752, 4752, 5293, 6836, 6078, 4752, 4752, 4752, 5346, 5256, 4752, 4752, 4752, 5355, 4752, 6927, 4752, 4752, 4752, 5377, 5972, 4752, 4752, 6928, 5301, 5305, 5306, 5306, 5307, 5306, 5306, 5311, 5314, 5316, 5318, 5320, 5320, 5320, 5320, 5321, 5325, 5325, 5325, 5327, 5325, 5325, 5331, 5331, 4752, 4752, 4761, 6855, 4752, 4752, 4960, 4752, 4752, 4752, 5217, 4752, 6405, 5353, 5571, 4752, 6913, 6240, 5376, 5259, 4752, 5068, 5397, 4752, 5067, 5385, 5396, 4752, 6696, 6700, 5406, 4752, 4752, 4752, 5471, 5263, 4752, 4752, 4752, 5531, 6256, 5416, 4752, 5572, 4752, 5665, 4752, 5365, 4752, 5664, 4752, 4752, 4961, 4961, 4961, 5670, 4752, 6018, 4752, 4752, 6375, 6009, 4752, 6535, 4752, 4752, 4752, 5581, 5083, 5429, 6534, 4752, 4752, 6428, 6383, 5341, 6009, 4752, 4752, 4752, 5187, 5417, 4752, 5573, 4753, 5358, 6639, 6644, 6017, 4752, 6260, 6601, 4752, 6413, 4752, 4752, 4968, 5118, 5439, 5444, 5449, 4752, 4752, 6578, 5109, 4752, 4752, 4753, 6958, 5445, 5153, 4752, 4752, 4752, 5387, 6259, 6593, 5458, 4752, 4752, 5050, 5054, 5721, 5336, 5342, 4752, 4752, 6591, 4752, 4752, 6698, 4752, 4752, 4752, 5434, 5465, 6603, 4752, 4752, 5080, 4752, 6569, 5473, 5477, 5445, 6429, 5475, 5869, 5481, 4752, 4752, 6717, 6721, 4752, 5720, 5335, 5491, 6602, 4752, 4752, 4752, 5747, 5525, 5477, 5500, 4752, 4752, 6740, 6908, 6569, 5524, 5476, 5499, 6429, 4752, 4752, 6712, 4752, 4752, 5084, 5430, 6860, 4752, 4752, 4752, 5748, 5187, 4752, 4752, 5223, 4752, 5745, 6422, 4752, 4752, 4752, 6219, 4752, 5571, 4752, 5665, 6571, 5548, 5869, 5516, 5812, 5477, 5871, 4752, 4752, 4752, 5750, 5720, 5335, 5504, 4752, 4752, 6868, 5157, 4752, 6861, 4752, 4752, 5111, 6426, 5386, 5748, 5510, 4752, 4752, 5870, 6429, 4752, 4752, 4752, 5746, 4752, 4752, 4752, 4760, 5529, 4752, 4752, 5560, 5567, 4752, 4752, 4757, 5546, 5554, 6429, 4752, 6713, 4752, 4752, 5191, 5176, 5559, 5113, 4752, 4752, 5192, 4752, 4752, 4752, 6727, 4752, 6319, 4752, 4752, 5228, 4752, 5568, 4752, 4752, 4752, 5811, 5225, 6277, 5386, 4752, 4752, 6874, 6878, 4752, 4752, 6206, 4752, 5720, 5814, 5569, 4752, 5687, 5691, 5225, 6255, 6934, 5689, 5570, 5570, 4752, 5944, 5690, 4752, 5689, 5570, 4752, 5688, 4752, 6238, 5563, 4752, 4753, 5522, 5548, 5687, 5577, 4752, 5687, 5577, 6238, 5401, 6651, 4752, 4753, 6054, 6070, 5386, 6364, 5586, 6009, 6256, 5600, 4752, 6419, 5378, 5602, 5607, 5620, 5611, 5619, 5614, 5615, 5615, 5615, 5615, 5624, 5631, 5628, 5635, 5637, 5637, 5637, 5642, 5638, 5646, 5646, 5646, 5646, 4752, 4752, 6449, 4752, 4752, 5247, 5251, 6259, 4778, 5412, 6009, 4752, 5705, 4752, 6945, 4752, 4752, 4752, 6239, 4752, 4752, 5678, 4752, 4752, 5650, 4752, 5656, 5652, 4752, 4756, 4752, 4752, 6103, 4752, 5661, 5669, 5675, 4752, 4757, 5847, 5927, 4752, 5685, 4752, 6232, 4752, 5377, 6310, 4752, 4752, 5695, 4752, 4752, 5289, 5389, 4752, 4752, 5957, 6439, 4752, 4752, 4752, 5845, 5211, 5251, 4752, 6437, 6441, 4752, 4752, 4752, 5860, 4581, 5709, 4752, 4752, 5227, 4752, 5718, 4752, 4752, 5356, 6055, 5761, 5726, 5732, 5738, 4752, 5759, 5763, 5728, 5734, 4752, 4752, 4752, 5980, 5762, 5727, 5733, 4752, 4758, 4752, 4752, 6124, 5052, 5056, 4779, 6862, 4752, 4752, 5380, 5228, 4752, 5767, 6936, 4752, 6937, 6934, 5378, 4752, 5228, 5704, 4752, 4752, 6947, 4752, 4752, 5356, 5549, 5774, 5786, 6683, 5251, 5787, 6684, 4752, 4752, 4752, 5990, 6258, 4778, 5412, 6009, 4752, 6557, 5986, 4752, 4775, 4752, 5744, 6946, 4752, 4752, 4752, 6094, 6233, 4752, 4752, 5791, 4752, 5805, 6900, 6682, 6686, 6686, 4752, 4752, 4752, 6117, 5774, 6902, 6684, 4752, 4950, 5088, 5102, 5411, 6870, 4752, 4752, 5380, 6635, 5768, 6937, 5802, 4744, 5810, 6902, 6685, 4752, 4959, 4752, 4752, 4702, 4752, 4752, 5809, 6901, 5818, 4752, 4752, 5421, 4954, 4752, 5798, 4780, 6870, 5972, 4752, 4752, 4752, 6241, 4752, 4752, 4752, 5188, 6000, 5824, 5251, 4752, 4752, 5842, 5822, 5828, 4752, 4752, 5453, 5153, 5281, 4752, 4752, 4752, 6238, 6233, 6238, 4752, 4752, 5971, 5570, 4752, 4752, 6241, 5972, 4752, 6241, 4752, 4752, 6238, 4752, 4752, 4752, 5230, 6239, 4752, 6241, 5973, 5838, 5237, 4752, 6254, 6635, 5226, 5851, 6443, 5858, 5866, 5875, 5879, 5884, 5886, 5880, 5890, 5893, 5896, 5899, 5901, 5903, 5907, 5907, 5913, 5907, 5907, 5909, 5920, 5921, 5917, 5917, 5919, 5917, 5917, 5918, 5917, 5931, 5265, 4752, 4752, 5460, 5360, 4757, 4752, 6931, 4752, 4752, 4752, 5461, 5361, 6613, 5542, 4752, 4752, 4752, 6896, 5776, 6882, 4752, 4752, 5742, 5936, 5195, 4752, 6225, 5942, 6564, 5950, 5953, 5961, 4752, 4961, 4752, 4752, 4752, 6000, 6367, 5966, 6419, 4752, 4752, 5487, 4752, 6294, 4752, 6293, 5985, 4752, 5990, 5994, 4752, 4752, 4752, 6298, 6367, 5927, 4752, 4752, 4752, 6243, 4759, 6930, 4752, 4752, 5741, 4752, 4752, 6938, 6005, 6421, 6050, 6014, 4752, 4752, 5505, 4752, 4752, 4752, 6437, 4752, 6209, 5755, 5755, 6022, 6026, 6110, 4752, 4962, 4961, 4752, 4752, 6111, 4752, 4752, 4752, 6317, 6031, 6026, 6110, 4752, 4966, 4752, 5225, 5398, 4752, 5400, 4752, 4752, 4752, 6254, 4752, 6366, 5926, 4752, 4752, 5561, 5225, 5266, 4752, 4752, 5224, 6352, 4752, 6628, 4752, 4972, 5386, 5066, 6048, 5970, 4752, 4752, 5573, 5398, 4752, 6208, 4752, 4752, 5596, 4752, 6059, 5779, 6064, 4752, 4977, 4821, 6882, 6069, 6065, 4752, 4752, 5699, 4752, 4752, 6001, 5925, 5251, 4752, 4752, 4752, 6247, 4752, 5739, 4752, 6353, 4752, 6629, 4752, 5973, 4752, 6569, 6074, 6089, 6569, 6084, 6088, 5251, 6082, 6086, 6090, 4752, 4979, 4579, 4752, 4752, 4752, 6422, 4752, 6423, 6722, 4752, 4752, 4752, 6321, 6322, 5389, 6627, 4752, 5971, 4980, 4580, 4752, 4752, 4752, 6320, 4757, 4752, 5740, 4752, 5075, 5968, 4752, 4977, 5523, 6665, 6354, 6627, 4752, 5972, 4752, 4752, 6036, 4753, 6937, 4752, 4752, 4752, 6418, 6252, 4752, 4752, 4752, 6423, 6860, 6869, 4752, 4752, 5720, 5813, 5555, 4752, 4752, 4752, 5809, 6354, 6627, 4752, 4753, 6937, 4978, 4581, 4752, 4752, 4752, 6429, 4752, 4979, 4581, 4752, 4752, 5722, 5337, 5263, 4752, 6861, 6870, 4752, 5287, 5297, 4758, 4752, 5742, 6353, 6860, 6869, 4758, 5740, 5390, 5998, 6234, 4752, 4752, 4752, 6102, 4752, 5386, 6234, 5505, 6935, 4755, 6239, 4752, 5971, 4752, 4752, 4752, 5386, 4754, 5720, 4581, 4752, 4752, 5741, 6936, 4752, 6863, 5739, 4752, 5076, 4752, 4752, 5720, 5335, 5341, 4752, 6869, 4752, 6313, 4752, 6311, 4752, 6608, 4752, 4752, 5745, 4752, 6259, 4752, 4618, 6121, 6232, 6230, 6230, 5741, 6935, 4752, 4752, 6201, 5189, 4752, 6134, 6132, 6140, 6144, 6151, 6145, 6145, 6150, 6146, 6155, 6159, 6163, 6167, 6169, 6174, 6176, 6169, 6169, 6170, 6186, 6187, 6180, 6180, 6185, 6180, 6180, 6181, 6191, 4752, 4752, 4752, 6545, 6229, 6841, 5573, 5061, 6250, 4752, 4752, 4752, 6569, 5524, 4752, 6247, 6251, 4752, 5107, 4752, 4752, 4753, 6719, 6266, 6265, 6267, 4752, 5110, 4752, 5111, 4752, 5113, 5111, 4752, 5956, 4752, 5192, 4752, 6621, 5747, 6333, 4752, 4752, 5797, 5191, 6271, 6276, 5252, 4961, 4752, 6281, 6287, 6251, 4752, 4752, 4752, 6570, 6286, 6291, 4752, 4752, 5751, 4752, 5833, 5832, 5831, 4752, 5110, 6077, 4752, 4752, 6362, 4752, 4752, 4770, 4752, 4752, 4752, 6717, 5589, 4752, 6202, 5190, 4752, 5110, 6929, 4752, 4752, 6307, 4752, 4752, 6934, 4752, 4752, 4752, 6934, 4759, 6304, 5573, 4961, 5831, 5831, 5831, 4752, 5112, 4752, 4752, 5742, 5580, 4769, 6009, 4752, 4752, 6387, 4752, 5126, 4752, 6331, 4961, 4753, 5534, 5538, 5542, 4752, 6282, 5536, 5540, 4752, 5112, 6427, 5932, 5582, 4771, 4752, 4752, 4752, 6546, 5782, 5243, 4752, 5579, 5536, 5540, 5862, 5538, 5542, 4752, 5114, 5993, 4752, 4961, 4752, 5797, 4768, 5153, 4752, 4752, 5804, 6899, 5787, 6318, 4752, 4752, 5957, 4752, 6213, 6334, 4752, 4752, 4752, 6731, 4752, 6234, 6343, 5539, 6009, 4752, 4752, 5769, 4752, 4752, 5938, 6343, 5539, 4752, 6425, 4961, 4752, 5193, 4752, 4752, 6231, 4752, 5377, 5401, 4752, 6254, 6318, 4752, 4752, 6255, 4752, 6425, 4752, 4752, 5409, 6311, 4961, 4752, 4752, 5823, 4752, 4752, 4752, 6240, 4752, 4752, 4752, 5103, 5454, 6009, 4752, 4752, 5844, 5146, 5452, 6377, 4752, 4752, 5846, 5145, 6860, 6009, 4752, 5190, 6375, 6009, 6422, 6424, 4752, 6868, 4752, 4752, 4752, 5388, 5380, 6254, 6362, 4752, 5124, 5122, 4752, 4752, 6322, 6322, 6322, 6322, 4707, 4707, 4707, 4707, 4708, 4735, 4735, 6381, 4752, 6009, 5377, 6389, 4752, 4752, 6885, 6009, 4752, 4752, 6868, 5377, 6253, 6887, 4752, 4752, 6887, 4752, 4752, 6886, 4752, 6403, 5971, 6255, 4752, 4752, 5853, 4752, 4752, 4752, 6936, 6255, 6886, 5971, 6255, 5191, 4752, 4752, 5752, 4752, 4756, 6589, 6886, 6401, 6885, 6885, 4752, 6886, 5377, 6885, 6394, 6394, 4703, 4703, 4703, 4752, 5185, 4752, 4752, 4757, 5110, 4960, 5744, 6398, 4752, 5187, 6451, 4752, 4752, 6409, 4752, 6411, 5750, 6215, 6417, 5744, 6435, 6217, 4752, 5189, 6447, 6457, 6461, 6462, 6466, 6486, 6469, 6484, 6472, 6478, 6475, 6480, 6498, 6492, 6490, 6496, 6496, 6500, 6506, 6506, 6507, 6504, 6506, 6506, 6506, 6511, 6514, 4752, 4752, 5854, 4752, 4752, 4752, 6619, 4824, 5749, 6417, 6518, 4752, 4752, 4752, 6756, 5187, 4752, 4752, 4752, 6834, 6431, 4752, 4752, 4752, 6836, 5834, 6009, 6522, 6527, 6869, 4752, 6430, 4752, 5188, 4752, 5223, 4752, 4752, 4752, 6253, 4752, 6540, 6551, 6561, 5402, 6575, 4752, 4752, 5945, 4752, 4752, 6755, 6009, 4752, 5188, 5194, 4752, 4752, 4752, 6252, 6255, 4752, 6756, 5962, 4752, 5222, 5392, 5390, 4752, 6849, 6848, 4752, 5231, 6032, 6027, 6850, 4752, 4752, 4752, 6854, 6619, 4824, 5749, 6582, 5518, 4752, 4752, 4752, 6861, 4753, 6634, 4752, 4752, 5945, 5691, 4752, 4752, 6589, 4752, 4753, 4752, 4757, 5561, 4752, 6597, 4752, 6607, 4752, 5235, 4752, 4752, 4752, 5225, 6612, 5541, 4752, 6617, 5229, 6351, 5401, 6625, 4752, 5753, 4752, 6633, 5359, 6640, 6645, 6009, 4944, 5540, 4752, 4752, 5955, 4752, 6649, 6238, 5686, 5686, 5144, 4752, 5744, 4752, 4752, 4752, 4753, 4980, 6619, 4824, 6272, 6654, 5754, 4753, 4752, 6311, 4752, 4752, 6312, 4752, 4752, 5355, 5359, 5550, 6658, 6009, 5357, 6678, 4944, 5541, 4752, 5571, 4752, 6597, 6597, 6597, 6597, 4752, 4752, 4752, 6928, 4752, 4752, 5110, 6426, 4752, 5746, 6423, 4752, 5266, 4752, 4564, 4752, 6662, 5550, 6671, 6670, 6009, 4752, 4752, 5977, 4752, 6664, 6669, 5153, 4752, 5270, 6423, 5505, 4823, 5748, 5401, 5189, 4752, 4752, 4752, 5739, 6322, 5752, 4753, 4752, 4752, 5741, 5390, 4752, 6675, 6690, 6429, 6694, 4752, 4752, 5193, 6234, 4824, 5750, 4752, 5369, 4752, 4955, 4752, 4752, 5385, 5753, 4756, 4752, 6239, 4752, 6240, 4752, 5349, 4758, 4752, 6705, 6429, 4752, 5372, 4758, 5592, 4752, 6705, 6429, 5572, 6238, 6913, 4752, 4752, 6009, 4752, 4752, 5712, 4752, 4752, 6010, 6536, 4714, 6709, 4752, 4752, 6016, 4752, 4756, 4752, 6240, 4752, 5379, 6255, 4752, 5388, 4752, 6257, 6419, 5074, 6720, 4752, 4752, 6042, 4752, 5749, 4752, 4752, 4752, 6929, 4752, 4752, 5971, 6717, 6429, 4752, 4752, 6042, 5417, 6914, 6241, 4752, 5747, 6233, 4752, 4752, 4752, 6926, 4752, 6729, 4752, 4752, 4752, 6933, 6727, 4563, 4752, 5747, 6741, 5389, 5192, 5222, 4752, 5986, 4561, 5748, 4752, 6936, 6934, 4562, 5749, 6934, 5853, 4563, 6935, 4752, 5387, 5748, 4752, 4752, 6735, 6371, 4563, 6936, 6934, 4752, 4752, 6739, 6680, 6421, 4744, 6300, 6231, 5091, 4752, 5389, 5748, 4752, 4752, 6701, 4581, 6039, 6745, 6748, 4620, 6733, 6752, 6760, 6768, 6762, 6764, 6771, 6775, 6779, 6782, 6784, 6788, 6790, 6794, 6797, 6801, 6804, 6809, 6808, 6813, 6815, 6819, 6817, 6823, 6827, 6830, 4752, 5391, 5223, 5222, 6421, 4752, 4752, 4759, 5112, 4760, 4752, 5113, 4752, 5428, 6533, 4752, 4752, 6388, 4752, 4752, 6393, 4752, 4752, 6428, 4752, 4752, 6428, 6260, 6840, 5381, 4752, 6845, 4584, 4752, 6043, 4752, 5495, 4752, 4752, 4753, 6197, 4769, 6859, 6044, 4752, 4752, 6195, 5582, 4752, 6739, 6907, 5191, 4752, 6867, 6915, 4752, 5506, 5505, 4752, 5973, 4752, 4563, 4752, 5386, 4752, 5533, 5537, 5541, 5389, 5388, 4752, 4752, 6232, 4752, 4752, 5747, 6741, 6355, 6235, 4752, 6543, 6238, 5400, 4752, 5188, 4752, 4752, 6891, 5777, 5700, 4752, 5562, 6253, 4752, 4752, 6912, 4752, 4752, 6932, 4752, 4752, 6935, 4752, 4753, 5435, 5440, 5445, 5388, 5388, 4752, 4752, 6242, 6042, 4752, 5739, 6934, 4752, 5571, 4752, 5398, 4752, 4751, 5401, 5401, 5399, 5793, 4753, 6898, 5778, 4563, 4752, 5388, 5749, 6601, 5747, 6906, 5192, 6236, 4752, 6897, 5777, 4563, 4752, 5130, 4752, 4752, 6338, 4752, 4752, 6231, 4752, 4752, 6920, 4752, 4752, 4752, 6261, 4752, 5775, 6919, 4752, 5386, 6258, 4781, 5595, 5193, 6237, 4752, 5571, 4752, 5399, 4760, 4752, 5740, 6935, 4752, 4752, 6107, 4752, 4752, 6924, 4752, 4752, 6281, 5535, 6896, 6942, 4752, 4752, 6311, 4752, 4752, 4752, 6530, 4759, 4752, 5740, 6935, 6951, 4752, 4752, 4752, 6311, 5770, 4977, 6959, 4752, 4752, 6312, 5113, 4752, 6957, 4752, 4752, 6313, 4752, 4752, 4752, 6453, 2, 4, 8, 262144, 0, 0, 0, 0x80000000, 1073741824, 0, 0, 1075838976, 2097152, 2097152, 268435456, 4194432, 4194560, 4196352, 270532608, 2097152, 4194304, 50331648, 0, 0, 0, 4194304, 0, 0, 541065216, 541065216, -2143289344, -2143289344, 4194304, 4194304, 4196352, -2143289344, 4194304, 4194432, 37748736, 541065216, -2143289344, 4194304, 4194304, 4194304, 4194304, 4194304, 4194304, 4198144, 4196352, 8540160, 4194304, 4194304, 4194304, 4196352, 276901888, 4194304, 4194304, 8425488, 4194304, 1, 0, 1024, 137363456, 66, 37748736, 742391808, 239075328, -1405091840, 775946240, 775946240, 775946240, 171966464, 742391808, 742391808, 742391808, 775946240, -1371537408, 775946240, 775946240, -1405091840, -1371537408, 775946240, 775946240, 775946240, 775946240, 4718592, -1371537408, 775946240, -1371537408, 775946240, -1371537408, 171966464, 775946240, 171966464, 171966464, 171966464, 171966464, 239075328, 171966464, 775946240, 239075328, 64, 4718592, 2097216, 4720640, 541589504, 4194368, 541589504, 4194400, 4194368, 541065280, 4194368, 4194368, -2143289280, 4194368, -2143285440, -2143285408, -2143285408, 776470528, -2143285408, -2109730976, -2143285408, -2143285408, -2143285408, -2109730976, -2143285408, 775946336, 775946304, 775946304, 776470528, 775946304, -1908404384, 775946304, -1908404384, 0, 2097152, 4194304, 128, 0, 256, 2048, 0, 0, 16777216, 16777216, 16777216, 16777216, 64, 64, 64, 64, 96, 96, 96, 64, 0, 0, 0, 24, 64, 0, 96, 96, 0, 0, 0, 288, 8388608, 0, 0, 8388608, 4096, 4096, 4096, 32, 96, 96, 96, 96, 262144, 96, 96, 1048576, 128, 0, 1048576, 0, 0, 2048, 2048, 2048, 2048, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 96, 96, 128, 128, 2048, 524288, 268435456, 536870912, 1073741824, 0, 0, 8388608, 4096, 0, 64, 0, 2048, 524288, 536870912, 0, 64, 524288, 64, 96, 64, 524288, 524288, 96, 96, 64, 524288, 96, 64, 80, 528, 524304, 1048592, 2097168, 268435472, 16, 16, 2, 536936448, 16, 262160, 16, 536936448, 16, 17, 17, 20, 16, 48, 16, 16, 20, 48, 64, 128, 1024, 134217728, 0, 0, 24, 560, 48, 2097680, 3145744, 1048592, 1048592, 2097168, 16, 1049104, 16, 16, 20, 560, 2097168, 2097168, 16, 16, 16, 16, 20, 16, 2097552, 3146256, 16, 16, 16, 28, 0, 2, 2098064, 17, 21, 16, 16, 163577856, 17, 528, 528, 16, 528, 2228784, -161430188, -161429680, -161430188, -161430188, -161430188, -161429680, -161430188, -161429676, -160905388, -161429676, -161430188, -161429676, -161429676, -161429676, -161429676, -161429675, -161349072, -161349072, -161429675, -161349072, -161349072, -161349072, -161349072, -161347728, -161347728, -161347728, -161347728, -161298576, -160299088, -161298576, -161298572, -161298572, -161298572, -161298572, -18860267, -160774284, -18729163, -160774288, -160299084, -161298572, -160774284, -161298572, -161298572, 16, 16, 28, 16, 16, 112, 21, 53, 146804757, 146812949, 0, 16, 0, 48, 3146256, 2097680, 1048592, 146862101, 146863389, -161429676, 146863389, 146863421, 146863389, 146863389, 146863389, 146863421, -161429740, -161429676, -160905388, -161298572, 0, 65536, 524288, 1048576, 33554432, 0, 159383552, 0, 0, 0, 1157627904, -1073741824, 0, 0, 0, 300, 142606336, 0, 8192, 0, 0, 0, 384, 0, 243269632, 0, 0, 0, 1862270976, 1, 32768, 131328, 131072, 16777216, 0, 0, 1, 2, 4, 128, 2097152, 0, 1073741825, 0x80000000, 0x80000000, 8, 16777216, 1073774592, 278528, 1226014816, 100665360, 100665360, 100665360, 100665360, 100665360, 100665360, -2046818288, 1091799136, -2044196848, 1091799136, 1091799136, 1091799136, 1091799136, 1091799136, 1091803360, 1091799136, 1091799136, 1158908000, 1158908001, 1192462432, 1192462448, 1192462448, 1192462448, 1192462448, 1200851056, 1091799393, 1200851056, 1200851056, 1192462448, 1870630720, 1870647104, 1870630720, 1870647104, 1870630720, 1870647104, 1870647104, 1870647104, 1870647104, 1870647104, 1870647120, 1870647124, 1870647124, 1870647124, 1870630736, 1870655316, 1870655316, 1870655316, 1870655317, 1870655348, 1870647120, 1870647120, 1870647120, 1879019376, 1879035760, 1870647124, 1879035760, 1879035764, 32768, 131072, 524288, 2097152, 8388608, 16777216, 134217728, 268435456, 1073741824, 0x80000000, 131328, 0, 0, 0, 832, 0, 164096, 0, 0, 0, 520, 4333568, 1048576, 1224736768, 0, 0, 1, 4, 0, 0, 235712, 0, 1090519040, 0, 0, 0, 999, 259072, 1191182336, 0, 0, 9437184, 0, 0, 1048576, 0, 128, 128, 128, 128, 2048, 2048, 231744, 0, 0, 0, 1007, 495424, 7864320, 1862270976, 0, 0, 0, 1024, 0, 0, 0, 63, 520000, 1862270976, 1862270976, 16252928, 0, 0, 16252928, 0, 0, 0, 1536, 0x80000000, 64, 98304, 1048576, 150994944, 0, 64, 256, 3584, 16384, 98304, 393216, 98304, 393216, 524288, 1048576, 2097152, 4194304, 0x80000000, 0, 0, 2097152, 4194304, 251658240, 536870912, 1073741824, 0, 0, 8192, 1073741824, 1073741824, 8388608, 2097152, 16777216, 134217728, 268435456, 2048, 65536, 262144, 524288, 1048576, 2097152, 1048576, 2097152, 4194304, 117440512, 64, 256, 1536, 16384, 65536, 117440512, 134217728, 536870912, 1073741824, 0, 0, 100663296, 0, 0, 0, 4096, 0, 0, 0, 64, 0, 0, 128, -2113929216, 64, 256, 1536, 65536, 262144, 524288, 4194304, 16777216, 100663296, 134217728, 536870912, 1073741824, 1048576, 2097152, 4194304, 16777216, 4194432, 3145728, 524288, 2097152, 134217728, 268435456, 65536, 1048576, 0, 0, 0, 2048, 0, 0, 134217728, 0, 0, 0, 15, 16, 524288, 2097152, 1073741824, 0x80000000, 0x80000000, 0, 1048576, 2097152, 67108864, 1073741824, 0, 0, 0, 0, 2097152, 1073741824, 0x80000000, 0, 0, 0, 768, 0, 2097152, 0x80000000, 0, -872415232, 0, -872415232, 67108864, 134217728, 1073741824, 0, 0x80000000, 0, 0, 0, 8192, 4096, 0, 0, 1536, 524288, 64, 64, 96, 64, 0, 524288, 0, 1073741824, 2621440, 1073741824, 9476, 512, 0, 32, 384, 8192, 0, 0, 1, 8, 512, 512, 9476, 134218240, 1050624, 262144, 512, 50331649, 1275208192, 4194312, 4194312, 4194312, 4194312, 541065224, 4194312, 4194312, 4194344, -869654016, 4203820, -869654016, -869654016, -869654016, -869654016, 1279402504, 1279402504, 1279402504, 1279402504, 2143549415, 2143549415, 2143549415, 2143549415, 2143549415, 2143549423, 2143549415, 2143549423, 2143549423, 2143549423, 2143549423, 16, 32, 256, 1024, 8192, 33554432, 8192, 33554432, 67108864, 134217728, 0, 0, 536870912, 9216, 0, 0, 1792, 0x80000000, 0, 1050624, 0, 0, 1, 14, 16, 32, 1024, 2048, 77824, 524288, 0, 512, 139264, 1275068416, 512, 2760704, -872415232, 0, 0, 1856, 0x80000000, 4203520, 0, 0, 0, 32768, 0, 0, 0, 58624, 520, 0, 0, 0, 131072, 0, 0, 0, 512, 0, 1048576, 0, 1275068416, 0, 0, 0, 65536, 0, 0, 0, 12561, 0, 1007, 1007, 0, 0, 2048, 524288, 0, 536870912, 0, 512, 0, 2048, 1048576, 0, 0, 40, 0, 2621440, 0, 0, 0x80000000, 999, 259072, 4194304, 25165824, 100663296, 402653184, 1, 102, 384, 512, 5120, 5120, 8192, 16384, 229376, 4194304, 4194304, 25165824, 33554432, 67108864, 402653184, 402653184, 536870912, 1073741824, 0, 0, 2048, 3145728, 16777216, 536870912, 110, 110, 0, 0, 1, 30, 32, 0, 40, 0, 524288, 64, 96, 1, 6, 96, 384, 512, 1024, 4096, 8192, 16384, 229376, 67108864, 402653184, 536870912, 0, 2, 16, 104, 0, 104, 104, 8192, 33554432, 134217728, 0, 0, 2048, 100663296, 0, 229376, 25165824, 33554432, 402653184, 536870912, 8192, 33554432, 0, 0, 0, 17408, 0, 524288, 2097152, 0, 0, 2048, 268435456, 536870912, 0, 0, 268435456, 49152, 2, 4, 32, 64, 256, 512, 1024, 8, 8, 0, 0, 1, 64, 128, 3584, 16384, 3145728, 16777216, 67108864, 134217728, 805306368, 1073741824, 0, 0, 4, 64, 256, 1024, 4096, 8192, 65536, 524288, 98304, 131072, 25165824, 268435456, 536870912, 0, 2, 4, 256, 1024, 0, 2048, 0, 98304, 131072, 16777216, 268435456, 0, 0, 0, 262144, 0, 0, 65536, 268435456, 0, 0, 1, 128, 512, 2048, 524288, 2048, 524288, 67108864, 536870912, 0, 262144, 0, 0, 2432, 0, 0, 4096, 8192, 0, 32, 4100, 67108864, 0, 32768, 0, 32768, 0, 0, 134348800, 134348800, 1049088, 1049088, 8192, 1049088, 12845065, 12845065, 12845065, 12845065, 270532608, 0, 1049088, 0, 134348800, 12845065, 12845065, 147193865, 5505537, 5591557, 5587465, 5587457, 5587457, 147202057, 5587457, 5587457, 5591557, 5587457, 13894153, 13894153, 13894153, 13894153, -1881791493, 13894153, 81003049, 13894153, 13894153, -1881791493, -1881791493, -1881791493, -1881791493, 0, 9, 0, 0, 1, 5505024, 142606336, 0, 0, 0, 278528, 0, 82432, 0, 0, 1, 16777216, 0, 0, 0, 139264, 0, 0, 0, 229440, 0, 5, 86528, 9, 4456448, 8388608, 0, 0, 8192, 8392704, 9, 8388608, 0, 0, 256, 1024, 65536, 16777216, 268435456, 0, 0, 41, 75497472, 0, 0, 16384, 262144, 0, 0, 0, 512, 1048576, 0, 0, 262144, 4194304, 8388608, 0, 0, 16384, 4194304, 0x80000000, 0, 0, 81920, 0, 0, 2, 4, 16, 32, 8192, 131072, 262144, 1048576, 4194304, 8388608, 4194304, 8388608, 16777216, 33554432, -1946157056, 0, -1946157056, 0, 0, 0, 524288, 0, 0, 0, 16, 0, 0, 0, 8, 0, 0, 0, 12, 0, 0, 0, 13, 0, 1, 2, 56, 64, 896, 8192, 131072, 0, 0, 33554432, 1024, 0, 4, 0, 8, 16, 32, 64, 128, 1024, 2048, 16384, 65536, 262144, 524288, 2097152, 384, 512, 8192, 131072, 1048576, 0, 16384, 65536, 0, 65536, 0, 0, 131072, 0, 32, 0, 32768, 134217728, 0, 0, 2, 8, 16, 0, 2, 8, 32, 64, 256, 1024, 98304, 131072, 1048576, 33554432, 134217728, 0x80000000, 8, 32, 384, 8192, 131072, 33554432, 131072, 33554432, 0x80000000, 0, 0, 24576, 0, 0, 0, 50331648, 0, 8396800, 4194304, 134217728, 2048, 134217728, 0, 0, 2, 16384, 32768, 1048576, 2097152, 0, 8396800, 0, 0, 4, 8, 0, 0, 16384, 0, 2, 4, 128, 3584, 16384, 16384, 16384, 16777216, 16384, 229376, 25165824, 33554432, 268435456, 536870912, 524288, 268567040, 16384, -2113929088, 2113544, 68423701, 68423701, 68423701, 68423701, 68489237, 68423701, 68423701, 68423701, 85200917, 68423701, 68489237, 72618005, 68423701, 68423701, -2079059883, 68423701, -2079059883, 68425749, 68423703, 69488664, 85200919, 69488664, 69488664, 69488664, 69488664, 70537244, 70537245, 70537245, 70537245, 70537245, 70537245, 70539293, -2022351809, -2076946339, 70537245, -2076946339, -2076946339, -2022351681, -2022351681, -2022351681, -2022351681, -2022351809, -2022351681, -2022351809, -2022351681, 32768, 65536, 4194304, 16777216, 0x80000000, 0, 0, 0, 8388608, 134217728, 1073741824, 131584, 268435456, 0, 0, 4, 128, 1048576, 67108864, 0, 0, 4, 256, 1024, 98304, 0, 0, 5242880, -2080374784, 268288, 0, 0, 4, 16777216, 0, 0, 23, 0, 0, 0, 867391, 24, 282624, 0, 0, 6, 0, 0, 0, 2097152, 0, 0, 0, 28, 3145728, 0, 0, 32768, 65536, 0, 284672, 0, 0, 0, 1048576, 0, 63, 128, 351232, 7340032, -2030043136, 0, 0, 131072, 268435456, 0, 0, 8, 32, 64, 16, 4096, 262144, 1048576, 1073741824, 0, 0, 0, -2046820352, 0, 20480, 0, 0, 8, 4194304, 0, 0, 15, 16, 32, 3072, 20480, 65536, 262144, 7340032, 50331648, 16, 32, 128, 3072, 20480, 0, 1, 4, 1048576, 4096, 1048576, 512, 0, 0, 0, 150528, 0, 0, 0, 5242880, 0, 7, 0, 14, 32, 1024, 2048, 12288, 1, 14, 32, 128, 1024, 7340032, 50331648, 0x80000000, 0, 0, 2048, 16384, 65536, 7340032, 50331648, 8, 32, 1024, 65536, 262144, 2097152, 1073741824, 0, 1, 6, 8, 32, 128, 1024, 65536, 2097152, 4194304, 50331648, 0x80000000, 0, 1, 2, 4, 2097152, 4194304, 67108864, 134217728, 536870912, 0, 32768, 4194304, 16777216, 0, 1, 2, 4, 50331648, 67108864, 0x80000000, 0, 0, 128, 50331648, 0, 0, 8, 33554432, 4096, 4194304, 268435456, 0, 0, 32768, 131072, 131072, 0, 32768, 32768, 268435968, 268435968, 1073743872, 268435968, 0, 128, 6144, 0, 229376, 128, 268435968, 16777220, 268436032, 256, 256, 256, 256, 257, 256, 256, 536871168, 256, 256, 256, 256, 384, -1879046336, -1879046334, 1073744256, -1879046334, -1879046326, -1879046334, -1879046334, -1879046326, -1879046326, -1845491902, -1878784182, 268444480, 268444480, 268444480, 268444480, 2100318145, 268436288, 268436288, 268436288, 268436288, 268436289, 268436288, 2100318149, 2100318149, 2100318149, 2100318149, 2100326337, 2100318149, 2100318149, 2100318145, 2100318149, 2100318145, 2100318149, 2100326341, 2100318149, 2100326341, 2100326341, 0, 1, 16, 32, 128, 512, 0, 4194304, 1, 1024, 0, 0, 229376, 0, 0, 12, 3145728, 0, 0, 576, 0, 0, 16, 8192, 0, 0, 16, 262144, 0, 384, 0, 0, 21, 266240, 1864, 0, 0, 0, 8388608, 0, 0, 0, 128, 0, 0, 0, 256, 0, 0, 0, 260, 512, 0, 1, 4036, 19939328, 2080374784, 0, 0, 0, 16777216, 0, 0, 0, 32, 0, 0, 0, 40, 67108864, 0, 19947520, 0, 0, 0, 19947520, 2304, 0, 8, 0, 512, 301989888, 0, 0, 262144, 16777216, 0, 1, 4, 64, 128, 64, 128, 3840, 16384, 19922944, 19922944, 2080374784, 0, 0, 29, 0, 0, 1536, 0x80000000, 0, 0, 32, 1, 8, 0, 33554432, 0, 0, 32768, 196608, 0, 0, 0, 33554432, 0, 0, 32768, 65536, 131072, 0, 0, 524288, 524288, 524288, 524288, 64, 64, 64, 32, 96, 8, 0, 33554432, 262144, 8192, 0, 0, 4194304, 1024, 0, 4096, 0, 1024, 2048, 16384, 3145728, 2048, 524288, 536870912, 1073741824, 8, 0, 0, 512, 131072, 0, 0, 64, 256, 1536, 2048, 33554432, 8192, 0, 0, 32, 64, 256, 32768, 65536, 16777216, 134217728, 536870912, 1073741824, 0, 3145728, 16777216, 536870912, 1073741824, 0, 0, 8192, 8192, 8192, 9216, 33554432, 0, 2097152, 16777216, 1073741824, 0, 0, 32768, 0, 16777216, 0, 16777216, 64, 0, 2, 0, 0, 32768, 16777216, 0, 0, 32, 512, 128, 131072, 0, 134218752, 0, 0, 44, 0, 66048, 0, 0, 0, 67108864, 0, 0, 0, 8192, 0, 8192, 0, 536870912, 0, 0, 0, 12289, 0, 268500992, 4243456, 0, 0, 59, 140224, 5505024, -1887436800, 0, 0, 2, 2, 4096, 4096, 0, 4096, 8192, 67108864, 0, 0, 1, 4032, 0, 4243456, 4096, 1048588, 12289, 1124073472, 1124073472, 1124073472, 1124073472, 1124073472, 1124073488, 1124073472, 1124073472, 1124073474, 1124073472, 1124073472, 1392574464, 1124073472, 12289, 1073754113, 12289, 12289, 1124073472, 12289, 12289, 1098920193, 1098920193, 1124073488, 1124073472, 1258292224, 1124073472, 1124073472, 1124073472, 1124085761, 1258304513, 1124085761, 1124085761, 1124085761, 1124085777, 1132474625, 1098920209, 1132474625, 1132474625, 1132474625, 1132474625, 1400975617, 2132360255, 2132622399, 2132622399, 2132360255, 2132360255, 2132360255, 2132360255, 2132622399, 2132360255, 2132360255, 2132360255, 2140749119, 2132360255, 2140749119, 2140749119, 0, 65536, 268435456, 49152, 184549376, 0, 0, 0, 83886080, 0, 0, 318767104, 0, 0, 32768, 100663296, 402653184, 1610612736, 0, 0, 0, 231488, 0, 12545, 25165824, 0, 0, 49152, 0, 0, 256, 1536, 65536, 0, 0, 58720256, 0, 0, 131072, 32768, 0, 0, 134217728, 0, 12305, 13313, 0, 0, 331776, 83886080, 117440512, 0, 0, 1, 6, 32, 64, 0, 78081, 327155712, 0, 0, 511808, 7864320, 512, 65536, 0, 0, 64, 65536, 1048576, 0, 0, 33554432, 1073741824, 0, 0, 110, 0, 0, 256, 8388608, 0, 0, 524288, 2097152, 0x80000000, 0, 0, 77824, 0, 0, 0, 268435456, 524288, 1048576, 16777216, 100663296, 134217728, 0, 339968, 0, 0, 128, 131072, 1024, 134217728, 0, 268435456, 0, 0, 128, 33554432, 0, 0, 1, 12288, 0, 0, 0, 134217728, 2048, 12288, 65536, 524288, 1048576, 1048576, 33554432, 67108864, 134217728, 805306368, 0, 327680, 0, 0, 256, 65536, 0, 0, 268435456, 1048576, 33554432, 134217728, 805306368, 1, 14, 16, 1024, 4096, 8192, 229376, 65536, 524288, 33554432, 134217728, 536870912, 1073741824, 0, 1, 14, 1024, 2048, 4096, 8192, 131072, 1048576, 8388608, 33554432, 134217728, 0x80000000, 0, 0, 4096, 65536, 524288, 134217728, 16384, 4194304, 0, 0, 999, 29619200, 2113929216, 0, 0, 0, 148480, 1, 12, 1024, 134217728, 0, 128, 134217728, 8, 0, 8, 8, 8, 0, 1, 4, 8, 134217728, 536870912, 0, 0, 1073741824, 32768, 0, 4, 8, 536870912, 0, 0, 1024, 1024, 0, 1024, 2048, 3145728, 0, 8, 32, 512, 4096, 8192, 0, 0, 68157440, 137363456, 0, 66, 66, 524288, 4100, 1024, 0, 0, 605247, 1058013184, 1073741824, 100680704, 25165824, 92274688, 25165824, 25165824, 92274688, 92274688, 25165952, 25165824, 25165824, 26214400, 92274688, 25165824, 92274688, 93323264, 92274688, 92274688, 92274688, 92274688, 92274720, 93323264, 25165890, 100721664, 25165890, 100721928, 100721928, 100787464, 100853000, 100721928, 100721928, 125977600, 125977600, 125977600, 125977600, 125846528, 125846528, 126895104, 125846528, 125846528, 125846528, 125846560, 125977600, 127026176, 125977600, 125977600, 127026176, 127026176, 281843, 1330419, 281843, 1330419, 281843, 281843, 1330419, 1330419, 281843, 281843, 5524723, 5524723, 5524723, 5524723, 93605107, 5524723, 39079155, 72633587, 72633587, 5524723, 92556531, 93605107, 93605107, 127290611, 97799411, 127290611, 131484915, 2097152, 134217728, 0, 0, 1024, 65536, 58368, 0, 0, 0, 301989888, 8, 124160, 189696, 0, 0, 605503, 1066401792, 0, 0, 3, 240, 19456, 262144, 0, 150528, 0, 0, 0, 536870912, 0, 1073741824, 0, 57344, 0, 0, 0, 1073741824, 0, 0, 0, 1, 2, 112, 128, 3072, 16384, 262144, 2048, 16384, 262144, 0, 0, 2097152, 16777216, 0, 0, 0, 1, 2, 48, 64, 0, 1, 2, 16, 32, 64, 384, 8192, 131072, 1048576, 32, 4096, 8192, 131072, 0, 0, 32768, 0, 256, 0, 256, 0, 65536, 1024, 2048, 262144, 0, 0, 32768, 256, 0, 0, 1024, 2097152, 0, 0, 0, 16384, 0, 0, 0, 4, 0, 0, 0, 5, 64, 128, 262144, 0, 0, 2097152, 268435456, 0, 0, 64, 128, 0, 0, 1536, 1792, 1, 2, 16, 64, 0, 0
21511 ];
21512
21513 XQueryParser.TOKEN =
21514 [
21515 "(0)",
21516 "PragmaContents",
21517 "DirCommentContents",
21518 "DirPIContents",
21519 "CDataSection",
21520 "Wildcard",
21521 "EQName",
21522 "URILiteral",
21523 "IntegerLiteral",
21524 "DecimalLiteral",
21525 "DoubleLiteral",
21526 "StringLiteral",
21527 "PredefinedEntityRef",
21528 "'\"\"'",
21529 "EscapeApos",
21530 "ElementContentChar",
21531 "QuotAttrContentChar",
21532 "AposAttrContentChar",
21533 "PITarget",
21534 "NCName",
21535 "QName",
21536 "S",
21537 "S",
21538 "CharRef",
21539 "CommentContents",
21540 "EOF",
21541 "'!'",
21542 "'!='",
21543 "'\"'",
21544 "'#'",
21545 "'#)'",
21546 "'$'",
21547 "'%'",
21548 "''''",
21549 "'('",
21550 "'(#'",
21551 "'(:'",
21552 "')'",
21553 "'*'",
21554 "'*'",
21555 "'+'",
21556 "','",
21557 "'-'",
21558 "'-->'",
21559 "'.'",
21560 "'..'",
21561 "'/'",
21562 "'//'",
21563 "'/>'",
21564 "':'",
21565 "':)'",
21566 "'::'",
21567 "':='",
21568 "';'",
21569 "'<'",
21570 "'<!--'",
21571 "'</'",
21572 "'<<'",
21573 "'<='",
21574 "'<?'",
21575 "'='",
21576 "'>'",
21577 "'>='",
21578 "'>>'",
21579 "'?'",
21580 "'?>'",
21581 "'@'",
21582 "'NaN'",
21583 "'['",
21584 "']'",
21585 "'after'",
21586 "'all'",
21587 "'allowing'",
21588 "'ancestor'",
21589 "'ancestor-or-self'",
21590 "'and'",
21591 "'any'",
21592 "'append'",
21593 "'array'",
21594 "'as'",
21595 "'ascending'",
21596 "'at'",
21597 "'attribute'",
21598 "'base-uri'",
21599 "'before'",
21600 "'boundary-space'",
21601 "'break'",
21602 "'by'",
21603 "'case'",
21604 "'cast'",
21605 "'castable'",
21606 "'catch'",
21607 "'check'",
21608 "'child'",
21609 "'collation'",
21610 "'collection'",
21611 "'comment'",
21612 "'constraint'",
21613 "'construction'",
21614 "'contains'",
21615 "'content'",
21616 "'context'",
21617 "'continue'",
21618 "'copy'",
21619 "'copy-namespaces'",
21620 "'count'",
21621 "'decimal-format'",
21622 "'decimal-separator'",
21623 "'declare'",
21624 "'default'",
21625 "'delete'",
21626 "'descendant'",
21627 "'descendant-or-self'",
21628 "'descending'",
21629 "'diacritics'",
21630 "'different'",
21631 "'digit'",
21632 "'distance'",
21633 "'div'",
21634 "'document'",
21635 "'document-node'",
21636 "'element'",
21637 "'else'",
21638 "'empty'",
21639 "'empty-sequence'",
21640 "'encoding'",
21641 "'end'",
21642 "'entire'",
21643 "'eq'",
21644 "'every'",
21645 "'exactly'",
21646 "'except'",
21647 "'exit'",
21648 "'external'",
21649 "'first'",
21650 "'following'",
21651 "'following-sibling'",
21652 "'for'",
21653 "'foreach'",
21654 "'foreign'",
21655 "'from'",
21656 "'ft-option'",
21657 "'ftand'",
21658 "'ftnot'",
21659 "'ftor'",
21660 "'function'",
21661 "'ge'",
21662 "'greatest'",
21663 "'group'",
21664 "'grouping-separator'",
21665 "'gt'",
21666 "'idiv'",
21667 "'if'",
21668 "'import'",
21669 "'in'",
21670 "'index'",
21671 "'infinity'",
21672 "'inherit'",
21673 "'insensitive'",
21674 "'insert'",
21675 "'instance'",
21676 "'integrity'",
21677 "'intersect'",
21678 "'into'",
21679 "'is'",
21680 "'item'",
21681 "'json'",
21682 "'json-item'",
21683 "'key'",
21684 "'language'",
21685 "'last'",
21686 "'lax'",
21687 "'le'",
21688 "'least'",
21689 "'let'",
21690 "'levels'",
21691 "'loop'",
21692 "'lowercase'",
21693 "'lt'",
21694 "'minus-sign'",
21695 "'mod'",
21696 "'modify'",
21697 "'module'",
21698 "'most'",
21699 "'namespace'",
21700 "'namespace-node'",
21701 "'ne'",
21702 "'next'",
21703 "'no'",
21704 "'no-inherit'",
21705 "'no-preserve'",
21706 "'node'",
21707 "'nodes'",
21708 "'not'",
21709 "'object'",
21710 "'occurs'",
21711 "'of'",
21712 "'on'",
21713 "'only'",
21714 "'option'",
21715 "'or'",
21716 "'order'",
21717 "'ordered'",
21718 "'ordering'",
21719 "'paragraph'",
21720 "'paragraphs'",
21721 "'parent'",
21722 "'pattern-separator'",
21723 "'per-mille'",
21724 "'percent'",
21725 "'phrase'",
21726 "'position'",
21727 "'preceding'",
21728 "'preceding-sibling'",
21729 "'preserve'",
21730 "'previous'",
21731 "'processing-instruction'",
21732 "'relationship'",
21733 "'rename'",
21734 "'replace'",
21735 "'return'",
21736 "'returning'",
21737 "'revalidation'",
21738 "'same'",
21739 "'satisfies'",
21740 "'schema'",
21741 "'schema-attribute'",
21742 "'schema-element'",
21743 "'score'",
21744 "'self'",
21745 "'sensitive'",
21746 "'sentence'",
21747 "'sentences'",
21748 "'skip'",
21749 "'sliding'",
21750 "'some'",
21751 "'stable'",
21752 "'start'",
21753 "'stemming'",
21754 "'stop'",
21755 "'strict'",
21756 "'strip'",
21757 "'structured-item'",
21758 "'switch'",
21759 "'text'",
21760 "'then'",
21761 "'thesaurus'",
21762 "'times'",
21763 "'to'",
21764 "'treat'",
21765 "'try'",
21766 "'tumbling'",
21767 "'type'",
21768 "'typeswitch'",
21769 "'union'",
21770 "'unique'",
21771 "'unordered'",
21772 "'updating'",
21773 "'uppercase'",
21774 "'using'",
21775 "'validate'",
21776 "'value'",
21777 "'variable'",
21778 "'version'",
21779 "'weight'",
21780 "'when'",
21781 "'where'",
21782 "'while'",
21783 "'wildcards'",
21784 "'window'",
21785 "'with'",
21786 "'without'",
21787 "'word'",
21788 "'words'",
21789 "'xquery'",
21790 "'zero-digit'",
21791 "'{'",
21792 "'{{'",
21793 "'{|'",
21794 "'|'",
21795 "'||'",
21796 "'|}'",
21797 "'}'",
21798 "'}}'"
21799 ];
21800 });
21801
21802 define('ace/mode/xquery/visitors/SemanticHighlighter', ['require', 'exports', 'module' ], function(require, exports, module) {
21803
21804 var SemanticHighlighter = exports.SemanticHighlighter = function(ast) {
21805
21806 this.tokens = {};
21807
21808 this.getTokens = function() {
21809 this.visit(ast);
21810 return this.tokens;
21811 };
21812
21813 this.EQName = this.NCName = function(node)
21814 {
21815 var row = node.pos.sl;
21816 this.tokens[row] = this.tokens[row] === undefined ? [] : this.tokens[row];
21817 node.pos.type = "support.function";
21818 this.tokens[row].push(node.pos);
21819 return true;
21820 };
21821
21822 this.visit = function(node) {
21823 var name = node.name;
21824 var skip = false;
21825
21826 if (typeof this[name] === "function") skip = this[name](node) === true ? true : false;
21827
21828 if (!skip) {
21829 this.visitChildren(node);
21830 }
21831 };
21832
21833 this.visitChildren = function(node, handler) {
21834 for (var i = 0; i < node.children.length; i++) {
21835 var child = node.children[i];
21836 if (handler !== undefined && typeof handler[child.name] === "function") {
21837 handler[child.name](child);
21838 }
21839 else {
21840 this.visit(child);
21841 }
21842 }
21843 };
21844
21845 };
21846
21847 });
+0
-174
try/index.html less more
0 <html>
1 <head>
2 <title>Try out tv4</title>
3 <script src="../tv4.js"></script>
4 <style type="text/css" media="screen">
5 #page-table {
6 position: absolute;
7 top: 0;
8 bottom: 0;
9 left: 0;
10 right: 0;
11 width: 100%;
12 height: 100%;
13 overflow: hidden;
14 }
15 #editor-data-title, #editor-schema-title {
16 font-size: 16px;
17 font-weight: bold;
18 font-family: Verdana;
19 text-align: center;
20 border-bottom: 2px solid black;
21 height: 25px;
22 }
23 #editor-data-title {
24 left: 0;
25 width: 50%;
26 background-color: #CDE;
27 border-right: 1px solid black;
28 }
29 #editor-schema-title {
30 right: 0;
31 width: 50%;
32 background-color: #EDC;
33 border-left: 1px solid black;
34 }
35 #editor-data {
36 width: 100%;
37 height: 100%;
38 border-right: 1px solid black;
39 }
40 #editor-schema {
41 width: 100%;
42 height: 100%;
43 border-left: 1px solid black;
44 }
45 #run-button-cell {
46 height: 25px;
47 }
48 #run-button {
49 float: left;
50 width: 90%;
51 height: 25px;
52 font-weight: bold;
53 }
54 #save-button {
55 float: right;
56 width: 9.99%;
57 height: 25px;
58 }
59 #result-cell {
60 vertical-align: top;
61 height: 20em;
62 font-size: 0.9em;
63 font-family: Consolas, Courier New, sans;
64 }
65 #result {
66 height: 100%;
67 overflow: auto;
68 padding: 0.5em;
69 }
70 </style>
71 </head>
72 <body>
73 <table id="page-table" cellspacing=0 cellpadding=0>
74 <thead>
75 <tr>
76 <td id="editor-data-title">data</td>
77 <td id="editor-schema-title">schema</td>
78 </tr>
79 </thead>
80 <tbody>
81 <tr>
82 <td style="position: relative">
83 <div id="editor-data">{
84 "foo": "bar"
85 }</div>
86 </td>
87 <td style="position: relative">
88 <div id="editor-schema">{
89 "type": "object",
90 "properties": {
91 "foo": {
92 "type": "string"
93 }
94 },
95 "required": ["foo"]
96 }</div>
97 </td>
98 </tr>
99 <tr>
100 <td colspan=2 id="run-button-cell">
101 <input id="run-button" type="button" value="validate" onclick="validate()"></input>
102 <input id="save-button" type="button" value="save to URL" onclick="saveToFragment()"></input>
103 </td>
104 </tr>
105 <tr>
106 <td colspan=2 id="result-cell">
107 <pre id="result">&nbsp;</pre>
108 </td>
109 </tr>
110 </tbody>
111 </table>
112
113 <script src="ace/ace.js" type="text/javascript" charset="utf-8"></script>
114 <script>
115 var editorData = ace.edit("editor-data");
116 editorData.setTheme("ace/theme/dawn");
117 editorData.getSession().setMode("ace/mode/json");
118
119 var editorSchema = ace.edit("editor-schema");
120 editorSchema.setTheme("ace/theme/dawn");
121 editorSchema.getSession().setMode("ace/mode/json");
122
123 var hash = (window.location.href.indexOf('#') == -1) ? '#' : window.location.href.substring(window.location.href.indexOf('#'));
124 console.log(hash);
125 if (hash.charAt(1) == "?") {
126 var parts = hash.substring(2).split("&");
127 for (var i = 0; i < parts.length; i++) {
128 var pair = parts[i].split('=');
129 var key = pair[0];
130 var value = decodeURIComponent(pair.length ? parts[i].substring(key.length + 1) : "");
131 if (key == "data") {
132 editorData.getSession().setValue(value);
133 } else if (key == "schema") {
134 editorSchema.getSession().setValue(value);
135 }
136 }
137 }
138
139 function validate() {
140 var dataJson = editorData.getSession().getValue();
141 try {
142 var data = JSON.parse(dataJson);
143 } catch (e) {
144 return output("Error parsing data JSON:\n" + e);
145 }
146 var schemaJson = editorSchema.getSession().getValue();
147 try {
148 var schema = JSON.parse(schemaJson);
149 } catch (e) {
150 return output("Error parsing schema JSON:\n" + e);
151 }
152 output(tv4.validateMultiple(data, schema));
153 }
154
155 function saveToFragment() {
156 var dataJson = editorData.getSession().getValue();
157 var schemaJson = editorSchema.getSession().getValue();
158 var hash = "#?data=" + encodeURIComponent(dataJson) + "&schema=" + encodeURIComponent(schemaJson);
159 window.location.href = hash;
160 }
161
162 function output(result) {
163 var target = document.getElementById('result');
164 if (typeof result != 'string') {
165 result = JSON.stringify(result, null, 4)
166 }
167 target.innerHTML = result.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
168 }
169
170 validate();
171 </script>
172 </body>
173 </html>
15761576 this.error = error;
15771577 this.missing = context.missing;
15781578 this.valid = (error === null);
1579
1580 this.toString = function () {
1581 if (this.error) {
1582 return this.error.message;
1583 } else {
1584 return 'Object passed schema validation';
1585 }
1586 };
1587
15791588 return this.valid;
15801589 },
15811590 validateResult: function () {
16731682
16741683 return tv4; // used by _header.js to globalise.
16751684
1676 }));
1685 }));
+0
-1
tv4.min.js less more
0 !function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof module&&module.exports?module.exports=b():a.tv4=b()}(this,function(){function a(a){return encodeURI(a).replace(/%25[0-9][0-9]/g,function(a){return"%"+a.substring(3)})}function b(b){var c="";m[b.charAt(0)]&&(c=b.charAt(0),b=b.substring(1));var d="",e="",f=!0,g=!1,h=!1;"+"===c?f=!1:"."===c?(e=".",d="."):"/"===c?(e="/",d="/"):"#"===c?(e="#",f=!1):";"===c?(e=";",d=";",g=!0,h=!0):"?"===c?(e="?",d="&",g=!0):"&"===c&&(e="&",d="&",g=!0);for(var i=[],j=b.split(","),k=[],l={},o=0;o<j.length;o++){var p=j[o],q=null;if(-1!==p.indexOf(":")){var r=p.split(":");p=r[0],q=parseInt(r[1],10)}for(var s={};n[p.charAt(p.length-1)];)s[p.charAt(p.length-1)]=!0,p=p.substring(0,p.length-1);var t={truncate:q,name:p,suffices:s};k.push(t),l[p]=t,i.push(p)}var u=function(b){for(var c="",i=0,j=0;j<k.length;j++){var l=k[j],m=b(l.name);if(null===m||void 0===m||Array.isArray(m)&&0===m.length||"object"==typeof m&&0===Object.keys(m).length)i++;else if(c+=j===i?e:d||",",Array.isArray(m)){g&&(c+=l.name+"=");for(var n=0;n<m.length;n++)n>0&&(c+=l.suffices["*"]?d||",":",",l.suffices["*"]&&g&&(c+=l.name+"=")),c+=f?encodeURIComponent(m[n]).replace(/!/g,"%21"):a(m[n])}else if("object"==typeof m){g&&!l.suffices["*"]&&(c+=l.name+"=");var o=!0;for(var p in m)o||(c+=l.suffices["*"]?d||",":","),o=!1,c+=f?encodeURIComponent(p).replace(/!/g,"%21"):a(p),c+=l.suffices["*"]?"=":",",c+=f?encodeURIComponent(m[p]).replace(/!/g,"%21"):a(m[p])}else g&&(c+=l.name,h&&""===m||(c+="=")),null!=l.truncate&&(m=m.substring(0,l.truncate)),c+=f?encodeURIComponent(m).replace(/!/g,"%21"):a(m)}return c};return u.varNames=i,{prefix:e,substitution:u}}function c(a){if(!(this instanceof c))return new c(a);for(var d=a.split("{"),e=[d.shift()],f=[],g=[],h=[];d.length>0;){var i=d.shift(),j=i.split("}")[0],k=i.substring(j.length+1),l=b(j);g.push(l.substitution),f.push(l.prefix),e.push(k),h=h.concat(l.substitution.varNames)}this.fill=function(a){for(var b=e[0],c=0;c<g.length;c++){var d=g[c];b+=d(a),b+=e[c+1]}return b},this.varNames=h,this.template=a}function d(a,b){if(a===b)return!0;if(a&&b&&"object"==typeof a&&"object"==typeof b){if(Array.isArray(a)!==Array.isArray(b))return!1;if(Array.isArray(a)){if(a.length!==b.length)return!1;for(var c=0;c<a.length;c++)if(!d(a[c],b[c]))return!1}else{var e;for(e in a)if(void 0===b[e]&&void 0!==a[e])return!1;for(e in b)if(void 0===a[e]&&void 0!==b[e])return!1;for(e in a)if(!d(a[e],b[e]))return!1}return!0}return!1}function e(a){var b=String(a).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return b?{href:b[0]||"",protocol:b[1]||"",authority:b[2]||"",host:b[3]||"",hostname:b[4]||"",port:b[5]||"",pathname:b[6]||"",search:b[7]||"",hash:b[8]||""}:null}function f(a,b){function c(a){var b=[];return a.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(a){"/.."===a?b.pop():b.push(a)}),b.join("").replace(/^\//,"/"===a.charAt(0)?"/":"")}return b=e(b||""),a=e(a||""),b&&a?(b.protocol||a.protocol)+(b.protocol||b.authority?b.authority:a.authority)+c(b.protocol||b.authority||"/"===b.pathname.charAt(0)?b.pathname:b.pathname?(a.authority&&!a.pathname?"/":"")+a.pathname.slice(0,a.pathname.lastIndexOf("/")+1)+b.pathname:a.pathname)+(b.protocol||b.authority||b.pathname?b.search:b.search||a.search)+b.hash:null}function g(a){return a.split("#")[0]}function h(a,b){if(a&&"object"==typeof a)if(void 0===b?b=a.id:"string"==typeof a.id&&(b=f(b,a.id),a.id=b),Array.isArray(a))for(var c=0;c<a.length;c++)h(a[c],b);else{"string"==typeof a.$ref&&(a.$ref=f(b,a.$ref));for(var d in a)"enum"!==d&&h(a[d],b)}}function i(a){a=a||"en";var b=v[a];return function(a){var c=b[a.code]||u[a.code];if("string"!=typeof c)return"Unknown error code "+a.code+": "+JSON.stringify(a.messageParams);var d=a.params;return c.replace(/\{([^{}]*)\}/g,function(a,b){var c=d[b];return"string"==typeof c||"number"==typeof c?c:a})}}function j(a,b,c,d,e){if(Error.call(this),void 0===a)throw new Error("No error code supplied: "+d);this.message="",this.params=b,this.code=a,this.dataPath=c||"",this.schemaPath=d||"",this.subErrors=e||null;var f=new Error(this.message);if(this.stack=f.stack||f.stacktrace,!this.stack)try{throw f}catch(f){this.stack=f.stack||f.stacktrace}}function k(a,b){if(b.substring(0,a.length)===a){var c=b.substring(a.length);if(b.length>0&&"/"===b.charAt(a.length-1)||"#"===c.charAt(0)||"?"===c.charAt(0))return!0}return!1}function l(a){var b,c,d=new o,e={setErrorReporter:function(a){return"string"==typeof a?this.language(a):(c=a,!0)},addFormat:function(){d.addFormat.apply(d,arguments)},language:function(a){return a?(v[a]||(a=a.split("-")[0]),v[a]?(b=a,a):!1):b},addLanguage:function(a,b){var c;for(c in r)b[c]&&!b[r[c]]&&(b[r[c]]=b[c]);var d=a.split("-")[0];if(v[d]){v[a]=Object.create(v[d]);for(c in b)"undefined"==typeof v[d][c]&&(v[d][c]=b[c]),v[a][c]=b[c]}else v[a]=b,v[d]=b;return this},freshApi:function(a){var b=l();return a&&b.language(a),b},validate:function(a,e,f,g){var h=i(b),j=c?function(a,b,d){return c(a,b,d)||h(a,b,d)}:h,k=new o(d,!1,j,f,g);"string"==typeof e&&(e={$ref:e}),k.addSchema("",e);var l=k.validateAll(a,e,null,null,"");return!l&&g&&(l=k.banUnknownProperties(a,e)),this.error=l,this.missing=k.missing,this.valid=null===l,this.valid},validateResult:function(){var a={};return this.validate.apply(a,arguments),a},validateMultiple:function(a,e,f,g){var h=i(b),j=c?function(a,b,d){return c(a,b,d)||h(a,b,d)}:h,k=new o(d,!0,j,f,g);"string"==typeof e&&(e={$ref:e}),k.addSchema("",e),k.validateAll(a,e,null,null,""),g&&k.banUnknownProperties(a,e);var l={};return l.errors=k.errors,l.missing=k.missing,l.valid=0===l.errors.length,l},addSchema:function(){return d.addSchema.apply(d,arguments)},getSchema:function(){return d.getSchema.apply(d,arguments)},getSchemaMap:function(){return d.getSchemaMap.apply(d,arguments)},getSchemaUris:function(){return d.getSchemaUris.apply(d,arguments)},getMissingUris:function(){return d.getMissingUris.apply(d,arguments)},dropSchemas:function(){d.dropSchemas.apply(d,arguments)},defineKeyword:function(){d.defineKeyword.apply(d,arguments)},defineError:function(a,b,c){if("string"!=typeof a||!/^[A-Z]+(_[A-Z]+)*$/.test(a))throw new Error("Code name must be a string in UPPER_CASE_WITH_UNDERSCORES");if("number"!=typeof b||b%1!==0||1e4>b)throw new Error("Code number must be an integer > 10000");if("undefined"!=typeof r[a])throw new Error("Error already defined: "+a+" as "+r[a]);if("undefined"!=typeof s[b])throw new Error("Error code already used: "+s[b]+" as "+b);r[a]=b,s[b]=a,u[a]=u[b]=c;for(var d in v){var e=v[d];e[a]&&(e[b]=e[b]||e[a])}},reset:function(){d.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:h,resolveUrl:f,getDocumentUri:g,errorCodes:r};return e.language(a||"en"),e}Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.keys called on non-object");var f=[];for(var g in e)a.call(e,g)&&f.push(g);if(b)for(var h=0;d>h;h++)a.call(e,c[h])&&f.push(c[h]);return f}}()),Object.create||(Object.create=function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return a.prototype=b,new a}}()),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&d!==1/0&&d!==-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Object.isFrozen||(Object.isFrozen=function(a){for(var b="tv4_test_frozen_key";a.hasOwnProperty(b);)b+=Math.random();try{return a[b]=!0,delete a[b],!1}catch(c){return!0}});var m={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},n={"*":!0};c.prototype={toString:function(){return this.template},fillFromObject:function(a){return this.fill(function(b){return a[b]})}};var o=function(a,b,c,d,e){if(this.missing=[],this.missingMap={},this.formatValidators=a?Object.create(a.formatValidators):{},this.schemas=a?Object.create(a.schemas):{},this.collectMultiple=b,this.errors=[],this.handleError=b?this.collectError:this.returnError,d&&(this.checkRecursive=!0,this.scanned=[],this.scannedFrozen=[],this.scannedFrozenSchemas=[],this.scannedFrozenValidationErrors=[],this.validatedSchemasKey="tv4_validation_id",this.validationErrorsKey="tv4_validation_errors_id"),e&&(this.trackUnknownProperties=!0,this.knownPropertyPaths={},this.unknownPropertyPaths={}),this.errorReporter=c||i("en"),"string"==typeof this.errorReporter)throw new Error("debug");if(this.definedKeywords={},a)for(var f in a.definedKeywords)this.definedKeywords[f]=a.definedKeywords[f].slice(0)};o.prototype.defineKeyword=function(a,b){this.definedKeywords[a]=this.definedKeywords[a]||[],this.definedKeywords[a].push(b)},o.prototype.createError=function(a,b,c,d,e,f,g){var h=new j(a,b,c,d,e);return h.message=this.errorReporter(h,f,g),h},o.prototype.returnError=function(a){return a},o.prototype.collectError=function(a){return a&&this.errors.push(a),null},o.prototype.prefixErrors=function(a,b,c){for(var d=a;d<this.errors.length;d++)this.errors[d]=this.errors[d].prefixWith(b,c);return this},o.prototype.banUnknownProperties=function(a,b){for(var c in this.unknownPropertyPaths){var d=this.createError(r.UNKNOWN_PROPERTY,{path:c},c,"",null,a,b),e=this.handleError(d);if(e)return e}return null},o.prototype.addFormat=function(a,b){if("object"==typeof a){for(var c in a)this.addFormat(c,a[c]);return this}this.formatValidators[a]=b},o.prototype.resolveRefs=function(a,b){if(void 0!==a.$ref){if(b=b||{},b[a.$ref])return this.createError(r.CIRCULAR_REFERENCE,{urls:Object.keys(b).join(", ")},"","",null,void 0,a);b[a.$ref]=!0,a=this.getSchema(a.$ref,b)}return a},o.prototype.getSchema=function(a,b){var c;if(void 0!==this.schemas[a])return c=this.schemas[a],this.resolveRefs(c,b);var d=a,e="";if(-1!==a.indexOf("#")&&(e=a.substring(a.indexOf("#")+1),d=a.substring(0,a.indexOf("#"))),"object"==typeof this.schemas[d]){c=this.schemas[d];var f=decodeURIComponent(e);if(""===f)return this.resolveRefs(c,b);if("/"!==f.charAt(0))return void 0;for(var g=f.split("/").slice(1),h=0;h<g.length;h++){var i=g[h].replace(/~1/g,"/").replace(/~0/g,"~");if(void 0===c[i]){c=void 0;break}c=c[i]}if(void 0!==c)return this.resolveRefs(c,b)}void 0===this.missing[d]&&(this.missing.push(d),this.missing[d]=d,this.missingMap[d]=d)},o.prototype.searchSchemas=function(a,b){if(Array.isArray(a))for(var c=0;c<a.length;c++)this.searchSchemas(a[c],b);else if(a&&"object"==typeof a){"string"==typeof a.id&&k(b,a.id)&&void 0===this.schemas[a.id]&&(this.schemas[a.id]=a);for(var d in a)if("enum"!==d)if("object"==typeof a[d])this.searchSchemas(a[d],b);else if("$ref"===d){var e=g(a[d]);e&&void 0===this.schemas[e]&&void 0===this.missingMap[e]&&(this.missingMap[e]=e)}}},o.prototype.addSchema=function(a,b){if("string"!=typeof a||"undefined"==typeof b){if("object"!=typeof a||"string"!=typeof a.id)return;b=a,a=b.id}a===g(a)+"#"&&(a=g(a)),this.schemas[a]=b,delete this.missingMap[a],h(b,a),this.searchSchemas(b,a)},o.prototype.getSchemaMap=function(){var a={};for(var b in this.schemas)a[b]=this.schemas[b];return a},o.prototype.getSchemaUris=function(a){var b=[];for(var c in this.schemas)(!a||a.test(c))&&b.push(c);return b},o.prototype.getMissingUris=function(a){var b=[];for(var c in this.missingMap)(!a||a.test(c))&&b.push(c);return b},o.prototype.dropSchemas=function(){this.schemas={},this.reset()},o.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},o.prototype.validateAll=function(a,b,c,d,e){var f;if(b=this.resolveRefs(b),!b)return null;if(b instanceof j)return this.errors.push(b),b;var g,h=this.errors.length,i=null,k=null;if(this.checkRecursive&&a&&"object"==typeof a){if(f=!this.scanned.length,a[this.validatedSchemasKey]){var l=a[this.validatedSchemasKey].indexOf(b);if(-1!==l)return this.errors=this.errors.concat(a[this.validationErrorsKey][l]),null}if(Object.isFrozen(a)&&(g=this.scannedFrozen.indexOf(a),-1!==g)){var m=this.scannedFrozenSchemas[g].indexOf(b);if(-1!==m)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[g][m]),null}if(this.scanned.push(a),Object.isFrozen(a))-1===g&&(g=this.scannedFrozen.length,this.scannedFrozen.push(a),this.scannedFrozenSchemas.push([])),i=this.scannedFrozenSchemas[g].length,this.scannedFrozenSchemas[g][i]=b,this.scannedFrozenValidationErrors[g][i]=[];else{if(!a[this.validatedSchemasKey])try{Object.defineProperty(a,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(a,this.validationErrorsKey,{value:[],configurable:!0})}catch(n){a[this.validatedSchemasKey]=[],a[this.validationErrorsKey]=[]}k=a[this.validatedSchemasKey].length,a[this.validatedSchemasKey][k]=b,a[this.validationErrorsKey][k]=[]}}var o=this.errors.length,p=this.validateBasic(a,b,e)||this.validateNumeric(a,b,e)||this.validateString(a,b,e)||this.validateArray(a,b,e)||this.validateObject(a,b,e)||this.validateCombinations(a,b,e)||this.validateHypermedia(a,b,e)||this.validateFormat(a,b,e)||this.validateDefinedKeywords(a,b,e)||null;if(f){for(;this.scanned.length;){var q=this.scanned.pop();delete q[this.validatedSchemasKey]}this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(p||o!==this.errors.length)for(;c&&c.length||d&&d.length;){var r=c&&c.length?""+c.pop():null,s=d&&d.length?""+d.pop():null;p&&(p=p.prefixWith(r,s)),this.prefixErrors(o,r,s)}return null!==i?this.scannedFrozenValidationErrors[g][i]=this.errors.slice(h):null!==k&&(a[this.validationErrorsKey][k]=this.errors.slice(h)),this.handleError(p)},o.prototype.validateFormat=function(a,b){if("string"!=typeof b.format||!this.formatValidators[b.format])return null;var c=this.formatValidators[b.format].call(null,a,b);return"string"==typeof c||"number"==typeof c?this.createError(r.FORMAT_CUSTOM,{message:c},"","/format",null,a,b):c&&"object"==typeof c?this.createError(r.FORMAT_CUSTOM,{message:c.message||"?"},c.dataPath||"",c.schemaPath||"/format",null,a,b):null},o.prototype.validateDefinedKeywords=function(a,b,c){for(var d in this.definedKeywords)if("undefined"!=typeof b[d])for(var e=this.definedKeywords[d],f=0;f<e.length;f++){var g=e[f],h=g(a,b[d],b,c);if("string"==typeof h||"number"==typeof h)return this.createError(r.KEYWORD_CUSTOM,{key:d,message:h},"","",null,a,b).prefixWith(null,d);if(h&&"object"==typeof h){var i=h.code;if("string"==typeof i){if(!r[i])throw new Error("Undefined error code (use defineError): "+i);i=r[i]}else"number"!=typeof i&&(i=r.KEYWORD_CUSTOM);var j="object"==typeof h.message?h.message:{key:d,message:h.message||"?"},k=h.schemaPath||"/"+d.replace(/~/g,"~0").replace(/\//g,"~1");return this.createError(i,j,h.dataPath||null,k,null,a,b)}}return null},o.prototype.validateBasic=function(a,b,c){var d;return(d=this.validateType(a,b,c))?d.prefixWith(null,"type"):(d=this.validateEnum(a,b,c))?d.prefixWith(null,"type"):null},o.prototype.validateType=function(a,b){if(void 0===b.type)return null;var c=typeof a;null===a?c="null":Array.isArray(a)&&(c="array");var d=b.type;Array.isArray(d)||(d=[d]);for(var e=0;e<d.length;e++){var f=d[e];if(f===c||"integer"===f&&"number"===c&&a%1===0)return null}return this.createError(r.INVALID_TYPE,{type:c,expected:d.join("/")},"","",null,a,b)},o.prototype.validateEnum=function(a,b){if(void 0===b["enum"])return null;for(var c=0;c<b["enum"].length;c++){var e=b["enum"][c];if(d(a,e))return null}return this.createError(r.ENUM_MISMATCH,{value:"undefined"!=typeof JSON?JSON.stringify(a):a},"","",null,a,b)},o.prototype.validateNumeric=function(a,b,c){return this.validateMultipleOf(a,b,c)||this.validateMinMax(a,b,c)||this.validateNaN(a,b,c)||null};var p=Math.pow(2,-51),q=1-p;o.prototype.validateMultipleOf=function(a,b){var c=b.multipleOf||b.divisibleBy;if(void 0===c)return null;if("number"==typeof a){var d=a/c%1;if(d>=p&&q>d)return this.createError(r.NUMBER_MULTIPLE_OF,{value:a,multipleOf:c},"","",null,a,b)}return null},o.prototype.validateMinMax=function(a,b){if("number"!=typeof a)return null;if(void 0!==b.minimum){if(a<b.minimum)return this.createError(r.NUMBER_MINIMUM,{value:a,minimum:b.minimum},"","/minimum",null,a,b);if(b.exclusiveMinimum&&a===b.minimum)return this.createError(r.NUMBER_MINIMUM_EXCLUSIVE,{value:a,minimum:b.minimum},"","/exclusiveMinimum",null,a,b)}if(void 0!==b.maximum){if(a>b.maximum)return this.createError(r.NUMBER_MAXIMUM,{value:a,maximum:b.maximum},"","/maximum",null,a,b);if(b.exclusiveMaximum&&a===b.maximum)return this.createError(r.NUMBER_MAXIMUM_EXCLUSIVE,{value:a,maximum:b.maximum},"","/exclusiveMaximum",null,a,b)}return null},o.prototype.validateNaN=function(a,b){return"number"!=typeof a?null:isNaN(a)===!0||a===1/0||a===-(1/0)?this.createError(r.NUMBER_NOT_A_NUMBER,{value:a},"","/type",null,a,b):null},o.prototype.validateString=function(a,b,c){return this.validateStringLength(a,b,c)||this.validateStringPattern(a,b,c)||null},o.prototype.validateStringLength=function(a,b){return"string"!=typeof a?null:void 0!==b.minLength&&a.length<b.minLength?this.createError(r.STRING_LENGTH_SHORT,{length:a.length,minimum:b.minLength},"","/minLength",null,a,b):void 0!==b.maxLength&&a.length>b.maxLength?this.createError(r.STRING_LENGTH_LONG,{length:a.length,maximum:b.maxLength},"","/maxLength",null,a,b):null},o.prototype.validateStringPattern=function(a,b){if("string"!=typeof a||"string"!=typeof b.pattern&&!(b.pattern instanceof RegExp))return null;var c;if(b.pattern instanceof RegExp)c=b.pattern;else{var d,e="",f=b.pattern.match(/^\/(.+)\/([img]*)$/);f?(d=f[1],e=f[2]):d=b.pattern,c=new RegExp(d,e)}return c.test(a)?null:this.createError(r.STRING_PATTERN,{pattern:b.pattern},"","/pattern",null,a,b)},o.prototype.validateArray=function(a,b,c){return Array.isArray(a)?this.validateArrayLength(a,b,c)||this.validateArrayUniqueItems(a,b,c)||this.validateArrayItems(a,b,c)||null:null},o.prototype.validateArrayLength=function(a,b){var c;return void 0!==b.minItems&&a.length<b.minItems&&(c=this.createError(r.ARRAY_LENGTH_SHORT,{length:a.length,minimum:b.minItems},"","/minItems",null,a,b),this.handleError(c))?c:void 0!==b.maxItems&&a.length>b.maxItems&&(c=this.createError(r.ARRAY_LENGTH_LONG,{length:a.length,maximum:b.maxItems},"","/maxItems",null,a,b),this.handleError(c))?c:null},o.prototype.validateArrayUniqueItems=function(a,b){if(b.uniqueItems)for(var c=0;c<a.length;c++)for(var e=c+1;e<a.length;e++)if(d(a[c],a[e])){var f=this.createError(r.ARRAY_UNIQUE,{match1:c,match2:e},"","/uniqueItems",null,a,b);if(this.handleError(f))return f}return null},o.prototype.validateArrayItems=function(a,b,c){if(void 0===b.items)return null;var d,e;if(Array.isArray(b.items)){for(e=0;e<a.length;e++)if(e<b.items.length){if(d=this.validateAll(a[e],b.items[e],[e],["items",e],c+"/"+e))return d}else if(void 0!==b.additionalItems)if("boolean"==typeof b.additionalItems){if(!b.additionalItems&&(d=this.createError(r.ARRAY_ADDITIONAL_ITEMS,{},"/"+e,"/additionalItems",null,a,b),this.handleError(d)))return d}else if(d=this.validateAll(a[e],b.additionalItems,[e],["additionalItems"],c+"/"+e))return d}else for(e=0;e<a.length;e++)if(d=this.validateAll(a[e],b.items,[e],["items"],c+"/"+e))return d;return null},o.prototype.validateObject=function(a,b,c){return"object"!=typeof a||null===a||Array.isArray(a)?null:this.validateObjectMinMaxProperties(a,b,c)||this.validateObjectRequiredProperties(a,b,c)||this.validateObjectProperties(a,b,c)||this.validateObjectDependencies(a,b,c)||null},o.prototype.validateObjectMinMaxProperties=function(a,b){var c,d=Object.keys(a);return void 0!==b.minProperties&&d.length<b.minProperties&&(c=this.createError(r.OBJECT_PROPERTIES_MINIMUM,{propertyCount:d.length,minimum:b.minProperties},"","/minProperties",null,a,b),this.handleError(c))?c:void 0!==b.maxProperties&&d.length>b.maxProperties&&(c=this.createError(r.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:d.length,maximum:b.maxProperties},"","/maxProperties",null,a,b),this.handleError(c))?c:null},o.prototype.validateObjectRequiredProperties=function(a,b){if(void 0!==b.required)for(var c=0;c<b.required.length;c++){var d=b.required[c];if(void 0===a[d]){var e=this.createError(r.OBJECT_REQUIRED,{key:d},"","/required/"+c,null,a,b);if(this.handleError(e))return e}}return null},o.prototype.validateObjectProperties=function(a,b,c){var d;for(var e in a){var f=c+"/"+e.replace(/~/g,"~0").replace(/\//g,"~1"),g=!1;if(void 0!==b.properties&&void 0!==b.properties[e]&&(g=!0,d=this.validateAll(a[e],b.properties[e],[e],["properties",e],f)))return d;if(void 0!==b.patternProperties)for(var h in b.patternProperties){var i=new RegExp(h);if(i.test(e)&&(g=!0,d=this.validateAll(a[e],b.patternProperties[h],[e],["patternProperties",h],f)))return d}if(g)this.trackUnknownProperties&&(this.knownPropertyPaths[f]=!0,delete this.unknownPropertyPaths[f]);else if(void 0!==b.additionalProperties){if(this.trackUnknownProperties&&(this.knownPropertyPaths[f]=!0,delete this.unknownPropertyPaths[f]),"boolean"==typeof b.additionalProperties){if(!b.additionalProperties&&(d=this.createError(r.OBJECT_ADDITIONAL_PROPERTIES,{key:e},"","/additionalProperties",null,a,b).prefixWith(e,null),this.handleError(d)))return d}else if(d=this.validateAll(a[e],b.additionalProperties,[e],["additionalProperties"],f))return d}else this.trackUnknownProperties&&!this.knownPropertyPaths[f]&&(this.unknownPropertyPaths[f]=!0)}return null},o.prototype.validateObjectDependencies=function(a,b,c){var d;if(void 0!==b.dependencies)for(var e in b.dependencies)if(void 0!==a[e]){var f=b.dependencies[e];if("string"==typeof f){if(void 0===a[f]&&(d=this.createError(r.OBJECT_DEPENDENCY_KEY,{key:e,missing:f},"","",null,a,b).prefixWith(null,e).prefixWith(null,"dependencies"),this.handleError(d)))return d}else if(Array.isArray(f))for(var g=0;g<f.length;g++){var h=f[g];if(void 0===a[h]&&(d=this.createError(r.OBJECT_DEPENDENCY_KEY,{key:e,missing:h},"","/"+g,null,a,b).prefixWith(null,e).prefixWith(null,"dependencies"),this.handleError(d)))return d}else if(d=this.validateAll(a,f,[],["dependencies",e],c))return d}return null},o.prototype.validateCombinations=function(a,b,c){return this.validateAllOf(a,b,c)||this.validateAnyOf(a,b,c)||this.validateOneOf(a,b,c)||this.validateNot(a,b,c)||null},o.prototype.validateAllOf=function(a,b,c){if(void 0===b.allOf)return null;for(var d,e=0;e<b.allOf.length;e++){var f=b.allOf[e];if(d=this.validateAll(a,f,[],["allOf",e],c))return d}return null},o.prototype.validateAnyOf=function(a,b,c){if(void 0===b.anyOf)return null;var d,e,f=[],g=this.errors.length;this.trackUnknownProperties&&(d=this.unknownPropertyPaths,e=this.knownPropertyPaths);for(var h=!0,i=0;i<b.anyOf.length;i++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var j=b.anyOf[i],k=this.errors.length,l=this.validateAll(a,j,[],["anyOf",i],c);if(null===l&&k===this.errors.length){if(this.errors=this.errors.slice(0,g),this.trackUnknownProperties){for(var m in this.knownPropertyPaths)e[m]=!0,delete d[m];for(var n in this.unknownPropertyPaths)e[n]||(d[n]=!0);h=!1;continue}return null}l&&f.push(l.prefixWith(null,""+i).prefixWith(null,"anyOf"))}return this.trackUnknownProperties&&(this.unknownPropertyPaths=d,this.knownPropertyPaths=e),h?(f=f.concat(this.errors.slice(g)),this.errors=this.errors.slice(0,g),this.createError(r.ANY_OF_MISSING,{},"","/anyOf",f,a,b)):void 0},o.prototype.validateOneOf=function(a,b,c){if(void 0===b.oneOf)return null;var d,e,f=null,g=[],h=this.errors.length;this.trackUnknownProperties&&(d=this.unknownPropertyPaths,e=this.knownPropertyPaths);for(var i=0;i<b.oneOf.length;i++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var j=b.oneOf[i],k=this.errors.length,l=this.validateAll(a,j,[],["oneOf",i],c);if(null===l&&k===this.errors.length){if(null!==f)return this.errors=this.errors.slice(0,h),this.createError(r.ONE_OF_MULTIPLE,{index1:f,index2:i},"","/oneOf",null,a,b);if(f=i,this.trackUnknownProperties){for(var m in this.knownPropertyPaths)e[m]=!0,delete d[m];for(var n in this.unknownPropertyPaths)e[n]||(d[n]=!0)}}else l&&g.push(l)}return this.trackUnknownProperties&&(this.unknownPropertyPaths=d,this.knownPropertyPaths=e),null===f?(g=g.concat(this.errors.slice(h)),this.errors=this.errors.slice(0,h),this.createError(r.ONE_OF_MISSING,{},"","/oneOf",g,a,b)):(this.errors=this.errors.slice(0,h),null)},o.prototype.validateNot=function(a,b,c){if(void 0===b.not)return null;var d,e,f=this.errors.length;this.trackUnknownProperties&&(d=this.unknownPropertyPaths,e=this.knownPropertyPaths,this.unknownPropertyPaths={},this.knownPropertyPaths={});var g=this.validateAll(a,b.not,null,null,c),h=this.errors.slice(f);return this.errors=this.errors.slice(0,f),this.trackUnknownProperties&&(this.unknownPropertyPaths=d,this.knownPropertyPaths=e),null===g&&0===h.length?this.createError(r.NOT_PASSED,{},"","/not",null,a,b):null},o.prototype.validateHypermedia=function(a,b,d){if(!b.links)return null;for(var e,f=0;f<b.links.length;f++){var g=b.links[f];if("describedby"===g.rel){for(var h=new c(g.href),i=!0,j=0;j<h.varNames.length;j++)if(!(h.varNames[j]in a)){i=!1;break}if(i){var k=h.fillFromObject(a),l={$ref:k};if(e=this.validateAll(a,l,[],["links",f],d))return e}}}};var r={INVALID_TYPE:0,ENUM_MISMATCH:1,ANY_OF_MISSING:10,ONE_OF_MISSING:11,ONE_OF_MULTIPLE:12,NOT_PASSED:13,NUMBER_MULTIPLE_OF:100,NUMBER_MINIMUM:101,NUMBER_MINIMUM_EXCLUSIVE:102,NUMBER_MAXIMUM:103,NUMBER_MAXIMUM_EXCLUSIVE:104,NUMBER_NOT_A_NUMBER:105,STRING_LENGTH_SHORT:200,STRING_LENGTH_LONG:201,STRING_PATTERN:202,OBJECT_PROPERTIES_MINIMUM:300,OBJECT_PROPERTIES_MAXIMUM:301,OBJECT_REQUIRED:302,OBJECT_ADDITIONAL_PROPERTIES:303,OBJECT_DEPENDENCY_KEY:304,ARRAY_LENGTH_SHORT:400,ARRAY_LENGTH_LONG:401,ARRAY_UNIQUE:402,ARRAY_ADDITIONAL_ITEMS:403,FORMAT_CUSTOM:500,KEYWORD_CUSTOM:501,CIRCULAR_REFERENCE:600,UNKNOWN_PROPERTY:1e3},s={};for(var t in r)s[r[t]]=t;var u={INVALID_TYPE:"Invalid type: {type} (expected {expected})",ENUM_MISMATCH:"No enum match for: {value}",ANY_OF_MISSING:'Data does not match any schemas from "anyOf"',ONE_OF_MISSING:'Data does not match any schemas from "oneOf"',ONE_OF_MULTIPLE:'Data is valid against more than one schema from "oneOf": indices {index1} and {index2}',NOT_PASSED:'Data matches schema from "not"',NUMBER_MULTIPLE_OF:"Value {value} is not a multiple of {multipleOf}",NUMBER_MINIMUM:"Value {value} is less than minimum {minimum}",NUMBER_MINIMUM_EXCLUSIVE:"Value {value} is equal to exclusive minimum {minimum}",NUMBER_MAXIMUM:"Value {value} is greater than maximum {maximum}",NUMBER_MAXIMUM_EXCLUSIVE:"Value {value} is equal to exclusive maximum {maximum}",NUMBER_NOT_A_NUMBER:"Value {value} is not a valid number",STRING_LENGTH_SHORT:"String is too short ({length} chars), minimum {minimum}",STRING_LENGTH_LONG:"String is too long ({length} chars), maximum {maximum}",STRING_PATTERN:"String does not match pattern: {pattern}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({propertyCount}), minimum {minimum}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({propertyCount}), maximum {maximum}",OBJECT_REQUIRED:"Missing required property: {key}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {missing} (due to key: {key})",ARRAY_LENGTH_SHORT:"Array is too short ({length}), minimum {minimum}",ARRAY_LENGTH_LONG:"Array is too long ({length}), maximum {maximum}",ARRAY_UNIQUE:"Array items are not unique (indices {match1} and {match2})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",FORMAT_CUSTOM:"Format validation failed ({message})",KEYWORD_CUSTOM:"Keyword failed: {key} ({message})",CIRCULAR_REFERENCE:"Circular $refs: {urls}",UNKNOWN_PROPERTY:"Unknown property (not in schema)"};j.prototype=Object.create(Error.prototype),j.prototype.constructor=j,j.prototype.name="ValidationError",j.prototype.prefixWith=function(a,b){if(null!==a&&(a=a.replace(/~/g,"~0").replace(/\//g,"~1"),this.dataPath="/"+a+this.dataPath),null!==b&&(b=b.replace(/~/g,"~0").replace(/\//g,"~1"),this.schemaPath="/"+b+this.schemaPath),null!==this.subErrors)for(var c=0;c<this.subErrors.length;c++)this.subErrors[c].prefixWith(a,b);return this};var v={},w=l();return w.addLanguage("en-gb",u),w.tv4=w,w});