diff --git a/.travis.yml b/.travis.yml index 7eb1eb01..2cd8be7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,4 @@ before_script: - "mysql -e 'create database myapp_test;'" - "psql -c 'create database myapp_test;' -U postgres" - mongo mydb_test --eval 'db.addUser("travis", "test");' + - which neo4j && neo4j start && sleep 5 diff --git a/lib/adapters/neo4j-lib/.gitignore b/lib/adapters/neo4j-lib/.gitignore deleted file mode 100644 index 16370d47..00000000 --- a/lib/adapters/neo4j-lib/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store - -db/ -support/ diff --git a/lib/adapters/neo4j-lib/.npmignore b/lib/adapters/neo4j-lib/.npmignore deleted file mode 100644 index 30d74d25..00000000 --- a/lib/adapters/neo4j-lib/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/CHANGELOG.md b/lib/adapters/neo4j-lib/CHANGELOG.md deleted file mode 100644 index 603713ef..00000000 --- a/lib/adapters/neo4j-lib/CHANGELOG.md +++ /dev/null @@ -1,48 +0,0 @@ -# Changelog: Neo4j driver for Node - -## Version 0.2.1 – September 2, 2011 - - - Updated `request` dependency. ([@aseemk][]) - - Added Cypher querying and tests. ([@aseemk][]) - - Better error handling. ([@aseemk][]) - -## Version 0.2.0 – July 14, 2011 - - - Massive overhaul of the entire library: - - Rewrote complete library using [Streamline.js][] ([@aseemk][]) - - Massively extended test suite ([@aseemk][]) - - Implemented `Node.getRelationships` method ([@aseemk][]) - - Implemented `Node.getRelationshipNodes` method ([@aseemk][]) - - Simplified error handling ([@gasi][]) - - Split monolithic file into separate files according to classes ([@aseemk][]) - - Implemented `Node.path` method and `Path` class ([@gasi][]) - - Added `Node.createRelationshipFrom` method ([@gasi][]) - - Fixed numerous bugs ([@aseemk][] & [@gasi][]) - -## Version 0.1.0 – April 20, 2011 - - - Changed name from _Neo4j REST client for Node.js_ to _Neo4j driver for Node_. - - Rewrote complete library to feature an object-oriented structure. - -## Version 0.0.3 – March 26, 2011 - - - Updated README. - -## Version 0.0.2 – March 26, 2011 - - - Renamed top-level constructor to `Client`. - - Added top-level `serialize` and `deserialize` functions. - - Added `autoMarshal` argument to `Client` for storing hierarchical data on - nodes and relationship. Internally uses new `serialize` and `deserialize` - functions. - - Changed position of Client's `basePath` argument (now last). - - Updated test. - -## Version 0.0.1 – March 21, 2011 - - - Initial release. - - -[Streamline.js]: https://github.com/Sage/streamlinejs -[@aseemk]: https://github.com/aseemk -[@gasi]: https://github.com/gasi diff --git a/lib/adapters/neo4j-lib/LICENSE b/lib/adapters/neo4j-lib/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/lib/adapters/neo4j-lib/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/lib/adapters/neo4j-lib/README.md b/lib/adapters/neo4j-lib/README.md deleted file mode 100644 index 4dcead26..00000000 --- a/lib/adapters/neo4j-lib/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# Neo4j driver for Node - -This driver let's you access the [Neo4j graph database][neo4j] from Node. - - -## Installation - - npm install neo4j - - -## Development - - git clone git@github.com:gasi/node-neo4j.git neo4j - cd neo4j - npm link - -You'll also need a local Neo4j database instance for the tests: - - curl http://dist.neo4j.org/neo4j-community-1.3-unix.tar.gz --O neo4j-community-1.3-unix.tar.gz - tar -zxvf neo4j-community-1.3-unix.tar.gz - mv neo4j-community-1.3 db - -If you're new to Neo4j, read the [Getting Started][neo4j-getting-started] page. -Start the server: - - db/bin/neo4j start - -Stop the server: - - db/bin/neo4j stop - -To run the tests: - - npm test - - -## Usage - - var neo4j = require('neo4j'); - var db = new neo4j.GraphDatabase('http://localhost:7474'); - - function print(err, res) { - console.log(err || res); - } - - var node = db.createNode({hello: 'world'}); - node.save(print); - -## License - -This library is licensed under the [Apache License, Version 2.0][license]. - - -## Reporting Issues - -If you encounter any bugs or other issues, please file them in the -[issue tracker][issue-tracker]. - - -[neo4j]: http://neo4j.org/ -[neo-rest-api]: http://components.neo4j.org/neo4j-server/snapshot/rest.html -[neo4j-getting-started]: http://wiki.neo4j.org/content/Getting_Started_With_Neo4j_Server -[issue-tracker]: https://github.com/gasi/node-neo4j/issues -[license]: http://www.apache.org/licenses/LICENSE-2.0.html diff --git a/lib/adapters/neo4j-lib/lib/GraphDatabase_.coffee b/lib/adapters/neo4j-lib/lib/GraphDatabase_.coffee deleted file mode 100644 index cac109c8..00000000 --- a/lib/adapters/neo4j-lib/lib/GraphDatabase_.coffee +++ /dev/null @@ -1,250 +0,0 @@ -# TODO many of these functions take a callback but, in some cases, call the -# callback immediately (e.g. if a value is cached). we should probably make -# sure to always call callbacks asynchronously, to prevent race conditions. -# this can be done in Streamline syntax by adding one line before cases where -# we're returning immediately: process.nextTick _ - -status = require 'http-status' -request = require 'request' - -applyPatch = (method, auth) -> - return if applyPatch.patched[method] - applyPatch.patched[method] = true - __m = request[method] - request[method] = -> - args = [].slice.call(arguments) - url = args[0] - # console.log(args) - if typeof url == 'string' && !url.match(/https?:\/\/[^\/]*@/) - args[0] = url.replace(/http:\/\//, 'http://' + auth + '@') - # normalize opts - if url && url.url - url.uri = url.url - delete url.url - # handle auth in uri - if url && url.uri && url.uri.match && !url.uri.match(/https?:\/\/[^\/]*@/) - args[0].uri = url.uri.replace(/http:\/\//, 'http://' + auth + '@') - __m.apply(request, args) - -applyPatch.patched = {} - -util = require './util_' -adjustError = util.adjustError - -Relationship = require './Relationship_' -Node = require './Node_' - -module.exports = class GraphDatabase - constructor: (url) -> - - @url = url - @auth = require('url').parse(url).auth - - applyPatch('get', @auth) - applyPatch('post', @auth) - applyPatch('put', @auth) - applyPatch('del', @auth) - applyPatch('head', @auth) - - # Cache - @_root = null - @_services = null - - # Database - _purgeCache: -> - @_root = null - @_services = null - - _getRoot: (_) -> - if @_root? - return @_root - - try - response = request.get @url, _ - - if response.statusCode isnt status.OK - throw response - - @_root = JSON.parse response.body - return @_root - - catch error - throw adjustError error - - getServices: (_) -> - if @_services? - return @_services - - try - root = @_getRoot _ - response = request.get root.data, _ - - if response.statusCode isnt status.OK - throw response - - @_services = JSON.parse response.body - return @_services - - catch error - throw adjustError error - - # Nodes - createNode: (data) -> - data = data || {} - node = new Node this, - data: data - return node - - getNode: (url, _) -> - try - response = request.get url, _ - - if response.statusCode isnt status.OK - - # Node not found - if response.statusCode is status.NOT_FOUND - throw new Error "No node at #{url}" - - throw response - - node = new Node this, JSON.parse response.body - return node - - catch error - throw adjustError error - - getIndexedNode: (index, property, value, _) -> - try - nodes = @getIndexedNodes index, property, value, _ - - node = null - if nodes and nodes.length > 0 - node = nodes[0] - return node - - catch error - throw adjustError error - - getIndexedNodes: (index, property, value, _) -> - try - services = @getServices _ - - key = encodeURIComponent property - val = encodeURIComponent value - url = "#{services.node_index}/#{index}/#{key}/#{val}" - - response = request.get url, _ - - if response.statusCode isnt status.OK - # Database error - throw response - - # Success - nodeArray = JSON.parse response.body - nodes = nodeArray.map (node) => - new Node this, node - return nodes - - catch error - throw adjustError error - - getNodeById: (id, _) -> - try - services = @getServices _ - url = "#{services.node}/#{id}" - node = @getNode url, _ - return node - - catch error - throw adjustError error - - # Relationships - createRelationship: (startNode, endNode, type, _) -> - # TODO: Implement - - getRelationship: (url, _) -> - try - response = request.get url, _ - - if response.statusCode isnt status.OK - # TODO: Handle 404 - throw response - - data = JSON.parse response.body - - # Construct relationship - relationship = new Relationship this, data - - return relationship - - catch error - throw adjustError error - - getRelationshipById: (id, _) -> - services = @getServices _ - # FIXME: Neo4j doesn't expose the path to relationships - relationshipURL = services.node.replace('node', 'relationship') - url = "#{relationshipURL}/#{id}" - @getRelationship url, _ - - # wrapper around the Cypher plugin, which comes bundled w/ Neo4j. - # pass in the Cypher query as a string (can be multi-line). - # http://docs.neo4j.org/chunked/stable/cypher-query-lang.html - # returns an array of "rows" (matches), where each row is a map from - # variable name (as given in the passed in query) to value. any values - # that represent nodes or relationships are transformed to instances. - query: (_, query) -> - try - services = @getServices _ - endpoint = services.extensions?.CypherPlugin?['execute_query'] - if not endpoint - throw new Error 'Cypher plugin not installed' - - response = request.post - uri: endpoint - json: {query} - , _ - - if response.statusCode isnt status.OK - # Database error - throw response - - # Success: build result maps, and transform nodes/relationships - body = response.body # JSON already parsed by request - columns = body.columns - results = for row in body.data - map = {} - for value, i in row - map[columns[i]] = - if value and typeof value is 'object' and value.self - if value.type then new Relationship this, value - else new Node this, value - else - value - map - return results - - catch error - throw adjustError error - - # executes a query against the given node index. lucene syntax reference: - # http://lucene.apache.org/java/3_1_0/queryparsersyntax.html - queryNodeIndex: (index, query, _) -> - try - services = @getServices _ - url = "#{services.node_index}/#{index}?query=#{encodeURIComponent query}" - - response = request.get url, _ - - if response.statusCode isnt status.OK - # Database error - throw response - - # Success - nodeArray = JSON.parse response.body - nodes = nodeArray.map (node) => - new Node this, node - return nodes - - catch error - throw adjustError error diff --git a/lib/adapters/neo4j-lib/lib/Node_.coffee b/lib/adapters/neo4j-lib/lib/Node_.coffee deleted file mode 100644 index f8c8b517..00000000 --- a/lib/adapters/neo4j-lib/lib/Node_.coffee +++ /dev/null @@ -1,311 +0,0 @@ -status = require 'http-status' -request = require 'request' - -util = require './util_' -adjustError = util.adjustError - -PropertyContainer = require './PropertyContainer_' -Relationship = require './Relationship_' -Path = require './Path_' - -module.exports = class Node extends PropertyContainer - constructor: (db, data) -> - super db, data - - toString: -> - "node @#{@id}" - - save: (_) -> - try - # TODO: check for actual modification - if @exists - response = request.put - uri: "#{@self}/properties" - json: @data - , _ - - if response.statusCode isnt status.NO_CONTENT - # database error - # note that JSON has already been parsed by request. - message = response.body?.message - switch response.statusCode - when status.BAD_REQUEST then message or= 'Invalid data sent' - when status.NOT_FOUND then message or= 'Node not found' - throw new Error message - else - services = @db.getServices _ - - response = request.post - uri: services.node - json: @data - , _ - - if response.statusCode isnt status.CREATED - # database error - # note that JSON has already been parsed by request. - message = response.body?.message or 'Invalid data sent' - throw new Error message - - # only update our copy of the data when it is POSTed. - # note that JSON has already been parsed by request. - @_data = response.body - - # explicitly not returning any value; making this a "void" method. - return - - catch error - throw adjustError error - - # throws an error if this node has any relationships on it, unless force - # is true, in which case the relationships are also deleted. - delete: (_, force=false) -> - if not @exists - return - - try - # Does this node have any relationships on it? - relationships = @all null, _ - - # If so, and it's not expected, prevent mistakes! - if relationships.length and not force - throw new Error "Could not delete #{@}; still has relationships." - - # Otherwise, if there are any, delete the relationships - # TODO parallelize using Streamline - for relationship in relationships - relationship.delete _ - - catch error - throw adjustError error - - # *Then* delete the node - # XXX need to explicitly relay arguments to super since streamline - # needs to see the underscore parameter currently. - super _ - - # Alias - del: @::delete - - createRelationshipTo: (otherNode, type, data, _) -> - @_createRelationship this, otherNode, type, data, _ - - createRelationshipFrom: (otherNode, type, data, _) -> - @_createRelationship otherNode, this, type, data, _ - - _createRelationship: (from, to, type, data, _) -> - try - # ensure this node exists - # ensure otherNode exists - # create relationship - - # XXX Can we really always assume `from` is loaded? - createRelationshipURL = from._data['create_relationship'] - otherNodeURL = to.self - - if createRelationshipURL? and otherNodeURL - response = request.post - url: createRelationshipURL - json: - to: otherNodeURL - data: data - type: type - , _ - - if response.statusCode isnt status.CREATED - # database error - message = '' - switch response.statusCode - when status.BAD_REQUEST - # note that JSON has already been parsed by request. - message = response.body?.message or - response.body?.exception or - "Invalid createRelationship: #{from.id} #{type} #{to.id} w/ data: #{JSON.stringify data}" - when status.CONFLICT - message = '"to" node, or the node specified by the URI not found' - throw new Error message - - # success - # note that JSON has already been parsed by request. - relationship = new Relationship @db, response.body, from, to - return relationship - else - throw new Error 'Failed to create relationship' - - catch error - throw adjustError error - - # TODO support passing in no type, e.g. for all types? - # TODO to be consistent with the REST and Java APIs, this returns an array - # of all returned relationships. it would certainly be more user-friendly - # though if it returned a dictionary of relationships mapped by type, no? - # XXX TODO this takes direction and type as separate parameters, while the - # getRelationshipNodes() method combines both as an object. inconsistent? - # unfortunately, the REST API is also inconsistent like this... - _getRelationships: (direction, type, _) -> - # Method overload: No type specified - # XXX can't support method overloading right now, because Streamline - # doesn't allow "setting" the callback parameter like this requires. - #if typeof type is 'function' - # _ = type - # type = [] - - # Assume no types - types = null - - # support passing in multiple types, as array - if type? - types = if type instanceof Array then type else [type] - - try - if types? - prefix = @_data["#{direction}_typed_relationships"] - relationshipsURL = prefix?.replace '{-list|&|types}', types.join '&' - else - relationshipsURL = @_data["#{direction}_relationships"] - - if not relationshipsURL - throw new Error 'Couldn\'t find URL of relationships endpoint.' - - resp = request.get relationshipsURL, _ - - if resp.statusCode is status.NOT_FOUND - throw new Error 'Node not found.' - - if resp.statusCode isnt status.OK - throw new Error "Unrecognized response code: #{resp.statusCode}" - - # success - data = JSON.parse resp.body - relationships = data.map (data) => - # other node will automatically get filled in by Relationship - if @self is data.start - new Relationship @db, data, this, null - else - new Relationship @db, data, null, this - return relationships - - catch error - throw adjustError error - - # TODO to be consistent with the REST and Java APIs, this returns an array - # of all returned relationships. it would certainly be more user-friendly - # though if it returned a dictionary of relationships mapped by type, no? - getRelationships: (type, _) -> - @all type, _ - - outgoing: (type, _) -> - @_getRelationships 'outgoing', type, _ - - incoming: (type, _) -> - @_getRelationships 'incoming', type, _ - - all: (type, _) -> - @_getRelationships 'all', type, _ - - path: (to, type, direction, maxDepth=1, algorithm='shortestPath', _) -> - try - pathURL = "#{@self}/path" - data = - to: to.self - relationships: - type: type - direction: direction - max_depth: maxDepth - algorithm: algorithm - - res = request.post - url: pathURL - json: data - , _ - - if res.statusCode is status.NOT_FOUND - # Empty path - return null - - if res.statusCode isnt status.OK - throw new Error "Unrecognized response code: #{res.statusCode}" - - # Parse result - # Note that JSON has already been parsed by request. - data = res.body - - start = new Node this, {self: data.start} - end = new Node this, {self: data.end} - length = data.length - nodes = data.nodes.map (url) => - new Node this, {self: url} - relationships = data.relationships.map (url) => - new Relationship this, {self: url, type} - - # Return path - path = new Path start, end, length, nodes, relationships - return path - - catch error - throw adjustError error - - # XXX this is actually a traverse, but in lieu of defining a non-trivial - # traverse() method, exposing this for now for our simple use case. - # the rels parameter can be: - # - just a string, e.g. 'has' (both directions traversed) - # - an array of strings, e.g. 'has' and 'wants' (both directions traversed) - # - just an object, e.g. {type: 'has', direction: 'out'} - # - an array of objects, e.g. [{type: 'has', direction: 'out'}, ...] - getRelationshipNodes: (rels, _) -> - - # support passing in both one rel and multiple rels, as array - rels = if rels instanceof Array then rels else [rels] - - try - traverseURL = @_data['traverse']?.replace '{returnType}', 'node' - - if not traverseURL - throw new Error 'Traverse not available.' - - resp = request.post - url: traverseURL - json: - 'max_depth': 1 - 'relationships': rels.map (rel) -> - if typeof rel is 'string' then {'type': rel} else rel - , _ - - if resp.statusCode is 404 - throw new Error 'Node not found.' - - if resp.statusCode isnt 200 - throw new Error "Unrecognized response code: #{resp.statusCode}" - - # success - # note that JSON has already been parsed by request. - return resp.body.map (data) => new Node @db, data - - catch error - throw adjustError error - - index: (index, key, value, _) -> - try - # TODO - if not @exists - throw new Error 'Node must exists before indexing properties' - - services = @db.getServices _ - - encodedKey = encodeURIComponent key - encodedValue = encodeURIComponent value - url = "#{services.node_index}/#{index}/#{encodedKey}/#{encodedValue}" - - response = request.post - url: url - json: @self - , _ - - if response.statusCode isnt status.CREATED - # database error - throw new Error response.statusCode - - # success - return - - catch error - throw adjustError error diff --git a/lib/adapters/neo4j-lib/lib/Path_.coffee b/lib/adapters/neo4j-lib/lib/Path_.coffee deleted file mode 100644 index e1b12ce5..00000000 --- a/lib/adapters/neo4j-lib/lib/Path_.coffee +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = class Path - constructor: (start, end, length, nodes, relationships) -> - @_start = start - @_nodes = nodes - @_length = length - @_relationships = relationships - @_end = end - - @getter 'start', -> @_start || null - @getter 'end', -> @_end || null - @getter 'length', -> @_length || 0 - @getter 'nodes', -> @_nodes || [] - @getter 'relationships', -> @_relationships || [] - - getter: @__defineGetter__ - setter: @__defineSetter__ diff --git a/lib/adapters/neo4j-lib/lib/PropertyContainer_.coffee b/lib/adapters/neo4j-lib/lib/PropertyContainer_.coffee deleted file mode 100644 index 7b4e0e8c..00000000 --- a/lib/adapters/neo4j-lib/lib/PropertyContainer_.coffee +++ /dev/null @@ -1,56 +0,0 @@ -status = require 'http-status' -request = require 'request' - -util = require './util_' -adjustError = util.adjustError - -module.exports = class PropertyContainer - constructor: (db, data) -> - @db = db - - @_data = data or {} - @_data.self = data?.self or null - - @getter 'self', -> @_data.self or null - @getter 'exists', -> @self? - @getter 'id', -> - if not @exists - null - else - match = /(?:node|relationship)\/(\d+)$/.exec @self - #/ XXX slash to unbreak broken coda coffee plugin (which chokes on the regex with a slash) - parseInt match[1] - - @getter 'data', -> @_data.data or null - @setter 'data', (value) -> @_data.data = value - - getter: @::__defineGetter__ - setter: @::__defineSetter__ - - equals: (other) -> - @self is other?.self - - delete: (_) -> - if not @exists - return - - try - response = request.del @self, _ - - if response.statusCode isnt status.NO_CONTENT - # database error - message = '' - switch response.statusCode - when status.NOT_FOUND - message = 'PropertyContainer not found' - when status.CONFLICT - message = 'Node could not be deleted (still has relationships?)' - throw new Error message - - # success - @_data.self = null - - return - - catch error - throw adjustError error diff --git a/lib/adapters/neo4j-lib/lib/Relationship_.coffee b/lib/adapters/neo4j-lib/lib/Relationship_.coffee deleted file mode 100644 index b182ae5a..00000000 --- a/lib/adapters/neo4j-lib/lib/Relationship_.coffee +++ /dev/null @@ -1,52 +0,0 @@ -status = require 'http-status' -request = require 'request' - -util = require './util_' -adjustError = util.adjustError - -PropertyContainer = require './PropertyContainer_' - -module.exports = class Relationship extends PropertyContainer - constructor: (db, data, start, end) -> - super db, data - - # require Node inline to prevent circular require dependency: - Node = require './Node_' - - # TODO relationship "start" and "end" are inconsistent with - # creating relationships "to" and "from". consider renaming. - @_start = start or new Node db, {self: data.start} - @_end = end or new Node db, {self: data.end} - - @getter 'start', -> @_start or null - @getter 'end', -> @_end or null - @getter 'type', -> data.type - - save: (_) -> - try - # TODO: check for actual modification - if @exists - response = request.put - uri: "#{@self}/properties" - json: @data - , _ - - if response.statusCode isnt status.NO_CONTENT - # database error - message = '' - switch response.statusCode - when status.BAD_REQUEST - message = 'Invalid data sent' - when status.NOT_FOUND - message = 'Relationship not found' - throw new Error message - - # explicitly returning nothing to make this a "void" method. - return - - catch error - throw adjustError error - - # Alias - del: @::delete - diff --git a/lib/adapters/neo4j-lib/lib/index.js b/lib/adapters/neo4j-lib/lib/index.js deleted file mode 100644 index b3bba66b..00000000 --- a/lib/adapters/neo4j-lib/lib/index.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - - Neo4j driver for Node - - Copyright 2011 Daniel Gasienica - Copyright 2011 Aseem Kishore - - Licensed under the Apache License, Version 2.0 (the "License"); you may - not use this file except in compliance with the License. You may obtain - a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - License for the specific language governing permissions and limitations - under the License. - -*/ - -require('coffee-script'); -require('streamline'); - -exports.GraphDatabase = require('./GraphDatabase_'); - -// XXX serialize functions not used internally right now, but used by outside -// clients, e.g. the scrapedb script. TODO formalize these better? -var util = require('./util_'); -exports.serialize = util.serialize; -exports.deserialize = util.deserialize; diff --git a/lib/adapters/neo4j-lib/lib/util_.coffee b/lib/adapters/neo4j-lib/lib/util_.coffee deleted file mode 100644 index c4af86d4..00000000 --- a/lib/adapters/neo4j-lib/lib/util_.coffee +++ /dev/null @@ -1,89 +0,0 @@ -constants = require 'constants' - -#----------------------------------------------------------------------------- -# -# Errors -# -#----------------------------------------------------------------------------- - -exports.adjustError = (error) -> - # Neo4j server error (error is a response object) - if error.statusCode >= 400 and error.body - serverError = error.body - - # in some cases, node-request hasn't parsed response JSON yet, so do. - # XXX protect against neo4j incorrectly sending HTML instead of JSON. - if typeof serverError is 'string' - try - serverError = JSON.parse serverError - - error = new Error - error.message = serverError.message or serverError - - if typeof error isnt 'object' - error = new Error error - - if error.errno is constants.ECONNREFUSED - error.message = "Couldn’t reach database (Connection refused)" - - return error - -#----------------------------------------------------------------------------- -# -# Serialization / Deserialization -# -#----------------------------------------------------------------------------- - -exports.serialize = (o, separator) -> - JSON.stringify flatten(o, separator) - - -exports.deserialize = (o, separator) -> - unflatten JSON.parse(o), separator - - -flatten = (o, separator, result, prefix) -> - separator = separator || '.' - result = result || {} - prefix = prefix || '' - - # only proceed if argument o is a complex object - if typeof o isnt 'object' - return o - - for key in Object.keys o - value = o[key] - if typeof value != 'object' - result[prefix + key] = value - else - flatten(value, separator, result, key + separator) - - return result - - -unflatten = (o, separator, result) -> - separator = separator || '.' - result = result || {} - - # only proceed if argument o is a complex object - if typeof o isnt 'object' - return o - - for key in Object.keys o - value = o[key] - separatorIndex = key.indexOf separator - if separatorIndex == -1 - result[key] = value - else - keys = key.split separator - target = result - numKeys = keys.length - for i in [0..(numKeys - 2)] - currentKey = keys[i] - if target[currentKey] == undefined - target[currentKey] = {} - target = target[currentKey] - lastKey = keys[numKeys - 1] - target[lastKey] = value - - return result diff --git a/lib/adapters/neo4j-lib/node_modules/.bin/cake b/lib/adapters/neo4j-lib/node_modules/.bin/cake deleted file mode 120000 index d95f32af..00000000 --- a/lib/adapters/neo4j-lib/node_modules/.bin/cake +++ /dev/null @@ -1 +0,0 @@ -../coffee-script/bin/cake \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/.bin/coffee b/lib/adapters/neo4j-lib/node_modules/.bin/coffee deleted file mode 120000 index b57f275d..00000000 --- a/lib/adapters/neo4j-lib/node_modules/.bin/coffee +++ /dev/null @@ -1 +0,0 @@ -../coffee-script/bin/coffee \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/.bin/coffee-streamline b/lib/adapters/neo4j-lib/node_modules/.bin/coffee-streamline deleted file mode 120000 index d945bffc..00000000 --- a/lib/adapters/neo4j-lib/node_modules/.bin/coffee-streamline +++ /dev/null @@ -1 +0,0 @@ -../streamline/bin/coffee-streamline \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/.bin/node-streamline b/lib/adapters/neo4j-lib/node_modules/.bin/node-streamline deleted file mode 120000 index 4b9db3b5..00000000 --- a/lib/adapters/neo4j-lib/node_modules/.bin/node-streamline +++ /dev/null @@ -1 +0,0 @@ -../streamline/bin/node-streamline \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/.npmignore b/lib/adapters/neo4j-lib/node_modules/coffee-script/.npmignore deleted file mode 100644 index 21e430d2..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -*.coffee -*.html -.DS_Store -.git* -Cakefile -documentation/ -examples/ -extras/coffee-script.js -raw/ -src/ -test/ diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/LICENSE b/lib/adapters/neo4j-lib/node_modules/coffee-script/LICENSE deleted file mode 100644 index 8cb3cfda..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2011 Jeremy Ashkenas - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/README b/lib/adapters/neo4j-lib/node_modules/coffee-script/README deleted file mode 100644 index 08f17dff..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/README +++ /dev/null @@ -1,48 +0,0 @@ -= - { - } } { - { { } } - } }{ { - { }{ } } _____ __ __ - ( }{ }{ { ) / ____| / _|/ _| - .- { { } { }} -. | | ___ | |_| |_ ___ ___ - ( ( } { } { } } ) | | / _ \| _| _/ _ \/ _ \ - |`-..________ ..-'| | |___| (_) | | | || __/ __/ - | | \_____\___/|_| |_| \___|\___| - | ;--. - | (__ \ _____ _ _ - | | ) ) / ____| (_) | | - | |/ / | (___ ___ _ __ _ _ __ | |_ - | ( / \___ \ / __| '__| | '_ \| __| - | |/ ____) | (__| | | | |_) | |_ - | | |_____/ \___|_| |_| .__/ \__| - `-.._________..-' | | - |_| - - - CoffeeScript is a little language that compiles into JavaScript. - - Install Node.js, and then the CoffeeScript compiler: - sudo bin/cake install - - Or, if you have the Node Package Manager installed: - npm install -g coffee-script - (Leave off the -g if you don't wish to install globally.) - - Compile a script: - coffee /path/to/script.coffee - - For documentation, usage, and examples, see: - http://coffeescript.org/ - - To suggest a feature, report a bug, or general discussion: - http://github.com/jashkenas/coffee-script/issues/ - - If you'd like to chat, drop by #coffeescript on Freenode IRC, - or on webchat.freenode.net. - - The source repository: - git://github.com/jashkenas/coffee-script.git - - All contributors are listed here: - http://github.com/jashkenas/coffee-script/contributors diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/Rakefile b/lib/adapters/neo4j-lib/node_modules/coffee-script/Rakefile deleted file mode 100644 index dfb85dab..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/Rakefile +++ /dev/null @@ -1,78 +0,0 @@ -require 'rubygems' -require 'erb' -require 'fileutils' -require 'rake/testtask' -require 'json' - -desc "Build the documentation page" -task :doc do - source = 'documentation/index.html.erb' - child = fork { exec "bin/coffee -bcw -o documentation/js documentation/coffee/*.coffee" } - at_exit { Process.kill("INT", child) } - Signal.trap("INT") { exit } - loop do - mtime = File.stat(source).mtime - if !@mtime || mtime > @mtime - rendered = ERB.new(File.read(source)).result(binding) - File.open('index.html', 'w+') {|f| f.write(rendered) } - end - @mtime = mtime - sleep 1 - end -end - -desc "Build coffee-script-source gem" -task :gem do - require 'rubygems' - require 'rubygems/package' - - gemspec = Gem::Specification.new do |s| - s.name = 'coffee-script-source' - s.version = JSON.parse(File.read('package.json'))["version"] - s.date = Time.now.strftime("%Y-%m-%d") - - s.homepage = "http://jashkenas.github.com/coffee-script/" - s.summary = "The CoffeeScript Compiler" - s.description = <<-EOS - CoffeeScript is a little language that compiles into JavaScript. - Underneath all of those embarrassing braces and semicolons, - JavaScript has always had a gorgeous object model at its heart. - CoffeeScript is an attempt to expose the good parts of JavaScript - in a simple way. - EOS - - s.files = [ - 'lib/coffee_script/coffee-script.js', - 'lib/coffee_script/source.rb' - ] - - s.authors = ['Jeremy Ashkenas'] - s.email = 'jashkenas@gmail.com' - s.rubyforge_project = 'coffee-script-source' - end - - file = File.open("coffee-script-source.gem", "w") - Gem::Package.open(file, 'w') do |pkg| - pkg.metadata = gemspec.to_yaml - - path = "lib/coffee_script/source.rb" - contents = <<-ERUBY -module CoffeeScript - module Source - def self.bundled_path - File.expand_path("../coffee-script.js", __FILE__) - end - end -end - ERUBY - pkg.add_file_simple(path, 0644, contents.size) do |tar_io| - tar_io.write(contents) - end - - contents = File.read("extras/coffee-script.js") - path = "lib/coffee_script/coffee-script.js" - pkg.add_file_simple(path, 0644, contents.size) do |tar_io| - tar_io.write(contents) - end - end -end diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/bin/cake b/lib/adapters/neo4j-lib/node_modules/coffee-script/bin/cake deleted file mode 100755 index e92e7523..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/bin/cake +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'); -var fs = require('fs'); -var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); - -require(lib + '/cake').run(); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/bin/coffee b/lib/adapters/neo4j-lib/node_modules/coffee-script/bin/coffee deleted file mode 100755 index 4dc0a5ec..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/bin/coffee +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'); -var fs = require('fs'); -var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); - -require(lib + '/command').run(); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/extras/jsl.conf b/lib/adapters/neo4j-lib/node_modules/coffee-script/extras/jsl.conf deleted file mode 100644 index 1190da52..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/extras/jsl.conf +++ /dev/null @@ -1,44 +0,0 @@ -# JavaScriptLint configuration file for CoffeeScript. - -+no_return_value # function {0} does not always return a value -+duplicate_formal # duplicate formal argument {0} --equal_as_assign # test for equality (==) mistyped as assignment (=)?{0} -+var_hides_arg # variable {0} hides argument -+redeclared_var # redeclaration of {0} {1} --anon_no_return_value # anonymous function does not always return a value -+missing_semicolon # missing semicolon -+meaningless_block # meaningless block; curly braces have no impact --comma_separated_stmts # multiple statements separated by commas (use semicolons?) -+unreachable_code # unreachable code -+missing_break # missing break statement --missing_break_for_last_case # missing break statement for last case in switch --comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==) --inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement --useless_void # use of the void type may be unnecessary (void is always undefined) -+multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs -+use_of_label # use of label --block_without_braces # block statement without curly braces -+leading_decimal_point # leading decimal point may indicate a number or an object member -+trailing_decimal_point # trailing decimal point may indicate a number or an object member -+octal_number # leading zeros make an octal number -+nested_comment # nested comment -+misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma -+ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement -+empty_statement # empty statement or extra semicolon --missing_option_explicit # the "option explicit" control comment is missing -+partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag -+dup_option_explicit # duplicate "option explicit" control comment -+useless_assign # useless assignment -+ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity -+ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent) --missing_default_case # missing default case in switch statement -+duplicate_case_in_switch # duplicate case in switch statements -+default_not_at_end # the default case is not at the end of the switch statement -+legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax -+jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax -+useless_comparison # useless comparison; comparing identical expressions -+with_statement # with statement hides undeclared variables; use temporary variable instead -+trailing_comma_in_array # extra comma is not recommended in array initializers -+assign_to_function_call # assignment to a function call -+parseint_missing_radix # parseInt missing radix parameter -+lambda_assign_requires_semicolon diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/browser.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/browser.js deleted file mode 100644 index 2fb7b2e2..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/browser.js +++ /dev/null @@ -1,75 +0,0 @@ -(function() { - var CoffeeScript, runScripts; - CoffeeScript = require('./coffee-script'); - CoffeeScript.require = require; - CoffeeScript.eval = function(code, options) { - return eval(CoffeeScript.compile(code, options)); - }; - CoffeeScript.run = function(code, options) { - if (options == null) { - options = {}; - } - options.bare = true; - return Function(CoffeeScript.compile(code, options))(); - }; - if (typeof window === "undefined" || window === null) { - return; - } - CoffeeScript.load = function(url, callback) { - var xhr; - xhr = new (window.ActiveXObject || XMLHttpRequest)('Microsoft.XMLHTTP'); - xhr.open('GET', url, true); - if ('overrideMimeType' in xhr) { - xhr.overrideMimeType('text/plain'); - } - xhr.onreadystatechange = function() { - var _ref; - if (xhr.readyState === 4) { - if ((_ref = xhr.status) === 0 || _ref === 200) { - CoffeeScript.run(xhr.responseText); - } else { - throw new Error("Could not load " + url); - } - if (callback) { - return callback(); - } - } - }; - return xhr.send(null); - }; - runScripts = function() { - var coffees, execute, index, length, s, scripts; - scripts = document.getElementsByTagName('script'); - coffees = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = scripts.length; _i < _len; _i++) { - s = scripts[_i]; - if (s.type === 'text/coffeescript') { - _results.push(s); - } - } - return _results; - })(); - index = 0; - length = coffees.length; - (execute = function() { - var script; - script = coffees[index++]; - if ((script != null ? script.type : void 0) === 'text/coffeescript') { - if (script.src) { - return CoffeeScript.load(script.src, execute); - } else { - CoffeeScript.run(script.innerHTML); - return execute(); - } - } - })(); - return null; - }; - if (window.addEventListener) { - addEventListener('DOMContentLoaded', runScripts, false); - } else { - attachEvent('onload', runScripts); - } -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/cake.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/cake.js deleted file mode 100755 index 6619934e..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/cake.js +++ /dev/null @@ -1,76 +0,0 @@ -(function() { - var CoffeeScript, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks; - fs = require('fs'); - path = require('path'); - helpers = require('./helpers'); - optparse = require('./optparse'); - CoffeeScript = require('./coffee-script'); - tasks = {}; - options = {}; - switches = []; - oparse = null; - helpers.extend(global, { - task: function(name, description, action) { - var _ref; - if (!action) { - _ref = [description, action], action = _ref[0], description = _ref[1]; - } - return tasks[name] = { - name: name, - description: description, - action: action - }; - }, - option: function(letter, flag, description) { - return switches.push([letter, flag, description]); - }, - invoke: function(name) { - if (!tasks[name]) { - missingTask(name); - } - return tasks[name].action(options); - } - }); - exports.run = function() { - return path.exists('Cakefile', function(exists) { - var arg, args, _i, _len, _ref, _results; - if (!exists) { - throw new Error("Cakefile not found in " + (process.cwd())); - } - args = process.argv.slice(2); - CoffeeScript.run(fs.readFileSync('Cakefile').toString(), { - filename: 'Cakefile' - }); - oparse = new optparse.OptionParser(switches); - if (!args.length) { - return printTasks(); - } - options = oparse.parse(args); - _ref = options.arguments; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - arg = _ref[_i]; - _results.push(invoke(arg)); - } - return _results; - }); - }; - printTasks = function() { - var desc, name, spaces, task; - console.log(''); - for (name in tasks) { - task = tasks[name]; - spaces = 20 - name.length; - spaces = spaces > 0 ? Array(spaces + 1).join(' ') : ''; - desc = task.description ? "# " + task.description : ''; - console.log("cake " + name + spaces + " " + desc); - } - if (switches.length) { - return console.log(oparse.help()); - } - }; - missingTask = function(task) { - console.log("No such task: \"" + task + "\""); - return process.exit(1); - }; -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/coffee-script.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/coffee-script.js deleted file mode 100755 index 28712795..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/coffee-script.js +++ /dev/null @@ -1,135 +0,0 @@ -(function() { - var Lexer, RESERVED, compile, fs, lexer, parser, path, _ref; - var __hasProp = Object.prototype.hasOwnProperty; - fs = require('fs'); - path = require('path'); - _ref = require('./lexer'), Lexer = _ref.Lexer, RESERVED = _ref.RESERVED; - parser = require('./parser').parser; - if (require.extensions) { - require.extensions['.coffee'] = function(module, filename) { - var content; - content = compile(fs.readFileSync(filename, 'utf8'), { - filename: filename - }); - return module._compile(content, filename); - }; - } else if (require.registerExtension) { - require.registerExtension('.coffee', function(content) { - return compile(content); - }); - } - exports.VERSION = '1.1.2'; - exports.RESERVED = RESERVED; - exports.helpers = require('./helpers'); - exports.compile = compile = function(code, options) { - if (options == null) { - options = {}; - } - try { - return (parser.parse(lexer.tokenize(code))).compile(options); - } catch (err) { - if (options.filename) { - err.message = "In " + options.filename + ", " + err.message; - } - throw err; - } - }; - exports.tokens = function(code, options) { - return lexer.tokenize(code, options); - }; - exports.nodes = function(source, options) { - if (typeof source === 'string') { - return parser.parse(lexer.tokenize(source, options)); - } else { - return parser.parse(source); - } - }; - exports.run = function(code, options) { - var Module, mainModule; - mainModule = require.main; - mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.'; - mainModule.moduleCache && (mainModule.moduleCache = {}); - if (process.binding('natives').module) { - Module = require('module').Module; - mainModule.paths = Module._nodeModulePaths(path.dirname(options.filename)); - } - if (path.extname(mainModule.filename) !== '.coffee' || require.extensions) { - return mainModule._compile(compile(code, options), mainModule.filename); - } else { - return mainModule._compile(code, mainModule.filename); - } - }; - exports.eval = function(code, options) { - var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref2, _ref3, _ref4, _require; - if (options == null) { - options = {}; - } - if (!(code = code.trim())) { - return; - } - if (_ref2 = require('vm'), Script = _ref2.Script, _ref2) { - sandbox = Script.createContext(); - sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox; - if (options.sandbox != null) { - if (options.sandbox instanceof sandbox.constructor) { - sandbox = options.sandbox; - } else { - _ref3 = options.sandbox; - for (k in _ref3) { - if (!__hasProp.call(_ref3, k)) continue; - v = _ref3[k]; - sandbox[k] = v; - } - } - } - sandbox.__filename = options.filename || 'eval'; - sandbox.__dirname = path.dirname(sandbox.__filename); - if (!(sandbox.module || sandbox.require)) { - Module = require('module'); - sandbox.module = _module = new Module(options.modulename || 'eval'); - sandbox.require = _require = function(path) { - return Module._load(path, _module); - }; - _module.filename = sandbox.__filename; - _ref4 = Object.getOwnPropertyNames(require); - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - r = _ref4[_i]; - _require[r] = require[r]; - } - _require.paths = _module.paths = Module._nodeModulePaths(process.cwd()); - _require.resolve = function(request) { - return Module._resolveFilename(request, _module); - }; - } - } - o = {}; - for (k in options) { - if (!__hasProp.call(options, k)) continue; - v = options[k]; - o[k] = v; - } - o.bare = true; - js = compile(code, o); - if (Script) { - return Script.runInContext(js, sandbox); - } else { - return eval(js); - } - }; - lexer = new Lexer; - parser.lexer = { - lex: function() { - var tag, _ref2; - _ref2 = this.tokens[this.pos++] || [''], tag = _ref2[0], this.yytext = _ref2[1], this.yylineno = _ref2[2]; - return tag; - }, - setInput: function(tokens) { - this.tokens = tokens; - return this.pos = 0; - }, - upcomingInput: function() { - return ""; - } - }; - parser.yy = require('./nodes'); -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/command.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/command.js deleted file mode 100644 index ca255020..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/command.js +++ /dev/null @@ -1,301 +0,0 @@ -(function() { - var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compileScript, compileScripts, compileStdio, contents, exec, forkNode, fs, helpers, lint, loadRequires, optionParser, optparse, opts, parseOptions, path, printLine, printTokens, printWarn, sources, spawn, usage, version, watch, writeJs, _ref; - fs = require('fs'); - path = require('path'); - helpers = require('./helpers'); - optparse = require('./optparse'); - CoffeeScript = require('./coffee-script'); - _ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec; - EventEmitter = require('events').EventEmitter; - helpers.extend(CoffeeScript, new EventEmitter); - printLine = function(line) { - return process.stdout.write(line + '\n'); - }; - printWarn = function(line) { - return process.binding('stdio').writeError(line + '\n'); - }; - BANNER = 'Usage: coffee [options] path/to/script.coffee'; - SWITCHES = [['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-o', '--output [DIR]', 'set the directory for compiled JavaScript'], ['-j', '--join [FILE]', 'concatenate the scripts before compiling'], ['-w', '--watch', 'watch scripts for changes, and recompile'], ['-p', '--print', 'print the compiled JavaScript to stdout'], ['-l', '--lint', 'pipe the compiled JavaScript through JavaScript Lint'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-e', '--eval', 'compile a string from the command line'], ['-r', '--require [FILE*]', 'require a library before executing your script'], ['-b', '--bare', 'compile without the top-level function wrapper'], ['-t', '--tokens', 'print the tokens that the lexer produces'], ['-n', '--nodes', 'print the parse tree that Jison produces'], ['--nodejs [ARGS]', 'pass options through to the "node" binary'], ['-v', '--version', 'display CoffeeScript version'], ['-h', '--help', 'display this help message']]; - opts = {}; - sources = []; - contents = []; - optionParser = null; - exports.run = function() { - parseOptions(); - if (opts.nodejs) { - return forkNode(); - } - if (opts.help) { - return usage(); - } - if (opts.version) { - return version(); - } - if (opts.require) { - loadRequires(); - } - if (opts.interactive) { - return require('./repl'); - } - if (opts.stdio) { - return compileStdio(); - } - if (opts.eval) { - return compileScript(null, sources[0]); - } - if (!sources.length) { - return require('./repl'); - } - if (opts.run) { - opts.literals = sources.splice(1).concat(opts.literals); - } - process.ARGV = process.argv = process.argv.slice(0, 2).concat(opts.literals); - process.argv[0] = 'coffee'; - process.execPath = require.main.filename; - return compileScripts(); - }; - compileScripts = function() { - var base, compile, source, unprocessed, _i, _j, _len, _len2, _results; - unprocessed = []; - for (_i = 0, _len = sources.length; _i < _len; _i++) { - source = sources[_i]; - unprocessed[sources.indexOf(source)] = 1; - } - _results = []; - for (_j = 0, _len2 = sources.length; _j < _len2; _j++) { - source = sources[_j]; - base = path.join(source); - compile = function(source, sourceIndex, topLevel) { - var remaining_files; - remaining_files = function() { - var total, x, _k, _len3; - total = 0; - for (_k = 0, _len3 = unprocessed.length; _k < _len3; _k++) { - x = unprocessed[_k]; - total += x; - } - return total; - }; - return path.exists(source, function(exists) { - if (topLevel && !exists && source.slice(-7) !== '.coffee') { - return compile("" + source + ".coffee", sourceIndex, topLevel); - } - if (topLevel && !exists) { - throw new Error("File not found: " + source); - } - return fs.stat(source, function(err, stats) { - if (err) { - throw err; - } - if (stats.isDirectory()) { - return fs.readdir(source, function(err, files) { - var file, _k, _len3; - if (err) { - throw err; - } - unprocessed[sourceIndex] += files.length; - for (_k = 0, _len3 = files.length; _k < _len3; _k++) { - file = files[_k]; - compile(path.join(source, file), sourceIndex); - } - return unprocessed[sourceIndex] -= 1; - }); - } else if (topLevel || path.extname(source) === '.coffee') { - fs.readFile(source, function(err, code) { - if (err) { - throw err; - } - unprocessed[sourceIndex] -= 1; - if (opts.join) { - contents[sourceIndex] = helpers.compact([contents[sourceIndex], code.toString()]).join('\n'); - if (helpers.compact(contents).length > 0 && remaining_files() === 0) { - return compileJoin(); - } - } else { - return compileScript(source, code.toString(), base); - } - }); - if (opts.watch && !opts.join) { - return watch(source, base); - } - } else { - return unprocessed[sourceIndex] -= 1; - } - }); - }); - }; - _results.push(compile(source, sources.indexOf(source), true)); - } - return _results; - }; - compileScript = function(file, input, base) { - var o, options, t, task; - o = opts; - options = compileOptions(file); - try { - t = task = { - file: file, - input: input, - options: options - }; - CoffeeScript.emit('compile', task); - if (o.tokens) { - return printTokens(CoffeeScript.tokens(t.input)); - } else if (o.nodes) { - return printLine(CoffeeScript.nodes(t.input).toString().trim()); - } else if (o.run) { - return CoffeeScript.run(t.input, t.options); - } else { - t.output = CoffeeScript.compile(t.input, t.options); - CoffeeScript.emit('success', task); - if (o.print) { - return printLine(t.output.trim()); - } else if (o.compile) { - return writeJs(t.file, t.output, base); - } else if (o.lint) { - return lint(t.file, t.output); - } - } - } catch (err) { - CoffeeScript.emit('failure', err, task); - if (CoffeeScript.listeners('failure').length) { - return; - } - if (o.watch) { - return printLine(err.message); - } - printWarn(err.stack); - return process.exit(1); - } - }; - compileStdio = function() { - var code, stdin; - code = ''; - stdin = process.openStdin(); - stdin.on('data', function(buffer) { - if (buffer) { - return code += buffer.toString(); - } - }); - return stdin.on('end', function() { - return compileScript(null, code); - }); - }; - compileJoin = function() { - var code; - code = contents.join('\n'); - return compileScript(opts.join, code, opts.join); - }; - loadRequires = function() { - var realFilename, req, _i, _len, _ref2; - realFilename = module.filename; - module.filename = '.'; - _ref2 = opts.require; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - req = _ref2[_i]; - require(req); - } - return module.filename = realFilename; - }; - watch = function(source, base) { - return fs.watchFile(source, { - persistent: true, - interval: 500 - }, function(curr, prev) { - if (curr.size === prev.size && curr.mtime.getTime() === prev.mtime.getTime()) { - return; - } - return fs.readFile(source, function(err, code) { - if (err) { - throw err; - } - return compileScript(source, code.toString(), base); - }); - }); - }; - writeJs = function(source, js, base) { - var baseDir, compile, dir, filename, jsPath, srcDir; - filename = path.basename(source, path.extname(source)) + '.js'; - srcDir = path.dirname(source); - baseDir = base === '.' ? srcDir : srcDir.substring(base.length); - dir = opts.output ? path.join(opts.output, baseDir) : srcDir; - jsPath = path.join(dir, filename); - compile = function() { - if (js.length <= 0) { - js = ' '; - } - return fs.writeFile(jsPath, js, function(err) { - if (err) { - return printLine(err.message); - } else if (opts.compile && opts.watch) { - return console.log("" + ((new Date).toLocaleTimeString()) + " - compiled " + source); - } - }); - }; - return path.exists(dir, function(exists) { - if (exists) { - return compile(); - } else { - return exec("mkdir -p " + dir, compile); - } - }); - }; - lint = function(file, js) { - var conf, jsl, printIt; - printIt = function(buffer) { - return printLine(file + ':\t' + buffer.toString().trim()); - }; - conf = __dirname + '/../extras/jsl.conf'; - jsl = spawn('jsl', ['-nologo', '-stdin', '-conf', conf]); - jsl.stdout.on('data', printIt); - jsl.stderr.on('data', printIt); - jsl.stdin.write(js); - return jsl.stdin.end(); - }; - printTokens = function(tokens) { - var strings, tag, token, value; - strings = (function() { - var _i, _len, _ref2, _results; - _results = []; - for (_i = 0, _len = tokens.length; _i < _len; _i++) { - token = tokens[_i]; - _ref2 = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref2[0], value = _ref2[1]; - _results.push("[" + tag + " " + value + "]"); - } - return _results; - })(); - return printLine(strings.join(' ')); - }; - parseOptions = function() { - var o; - optionParser = new optparse.OptionParser(SWITCHES, BANNER); - o = opts = optionParser.parse(process.argv.slice(2)); - o.compile || (o.compile = !!o.output); - o.run = !(o.compile || o.print || o.lint); - o.print = !!(o.print || (o.eval || o.stdio && o.compile)); - return sources = o.arguments; - }; - compileOptions = function(filename) { - return { - filename: filename, - bare: opts.bare - }; - }; - forkNode = function() { - var args, nodeArgs; - nodeArgs = opts.nodejs.split(/\s+/); - args = process.argv.slice(1); - args.splice(args.indexOf('--nodejs'), 2); - return spawn(process.execPath, nodeArgs.concat(args), { - cwd: process.cwd(), - env: process.env, - customFds: [0, 1, 2] - }); - }; - usage = function() { - return printLine((new optparse.OptionParser(SWITCHES, BANNER)).help()); - }; - version = function() { - return printLine("CoffeeScript version " + CoffeeScript.VERSION); - }; -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/grammar.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/grammar.js deleted file mode 100644 index e0bc41f1..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/grammar.js +++ /dev/null @@ -1,591 +0,0 @@ -(function() { - var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; - Parser = require('jison').Parser; - unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/; - o = function(patternString, action, options) { - var match; - patternString = patternString.replace(/\s{2,}/g, ' '); - if (!action) { - return [patternString, '$$ = $1;', options]; - } - action = (match = unwrap.exec(action)) ? match[1] : "(" + action + "())"; - action = action.replace(/\bnew /g, '$&yy.'); - action = action.replace(/\b(?:Block\.wrap|extend)\b/g, 'yy.$&'); - return [patternString, "$$ = " + action + ";", options]; - }; - grammar = { - Root: [ - o('', function() { - return new Block; - }), o('Body'), o('Block TERMINATOR') - ], - Body: [ - o('Line', function() { - return Block.wrap([$1]); - }), o('Body TERMINATOR Line', function() { - return $1.push($3); - }), o('Body TERMINATOR') - ], - Line: [o('Expression'), o('Statement')], - Statement: [ - o('Return'), o('Throw'), o('Comment'), o('STATEMENT', function() { - return new Literal($1); - }) - ], - Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class')], - Block: [ - o('INDENT OUTDENT', function() { - return new Block; - }), o('INDENT Body OUTDENT', function() { - return $2; - }) - ], - Identifier: [ - o('IDENTIFIER', function() { - return new Literal($1); - }) - ], - AlphaNumeric: [ - o('NUMBER', function() { - return new Literal($1); - }), o('STRING', function() { - return new Literal($1); - }) - ], - Literal: [ - o('AlphaNumeric'), o('JS', function() { - return new Literal($1); - }), o('REGEX', function() { - return new Literal($1); - }), o('BOOL', function() { - var val; - val = new Literal($1); - if ($1 === 'undefined') { - val.isUndefined = true; - } - return val; - }) - ], - Assign: [ - o('Assignable = Expression', function() { - return new Assign($1, $3); - }), o('Assignable = INDENT Expression OUTDENT', function() { - return new Assign($1, $4); - }) - ], - AssignObj: [ - o('ObjAssignable', function() { - return new Value($1); - }), o('ObjAssignable : Expression', function() { - return new Assign(new Value($1), $3, 'object'); - }), o('ObjAssignable :\ - INDENT Expression OUTDENT', function() { - return new Assign(new Value($1), $4, 'object'); - }), o('Comment') - ], - ObjAssignable: [o('Identifier'), o('AlphaNumeric'), o('ThisProperty')], - Return: [ - o('RETURN Expression', function() { - return new Return($2); - }), o('RETURN', function() { - return new Return; - }) - ], - Comment: [ - o('HERECOMMENT', function() { - return new Comment($1); - }) - ], - Code: [ - o('PARAM_START ParamList PARAM_END FuncGlyph Block', function() { - return new Code($2, $5, $4); - }), o('FuncGlyph Block', function() { - return new Code([], $2, $1); - }) - ], - FuncGlyph: [ - o('->', function() { - return 'func'; - }), o('=>', function() { - return 'boundfunc'; - }) - ], - OptComma: [o(''), o(',')], - ParamList: [ - o('', function() { - return []; - }), o('Param', function() { - return [$1]; - }), o('ParamList , Param', function() { - return $1.concat($3); - }) - ], - Param: [ - o('ParamVar', function() { - return new Param($1); - }), o('ParamVar ...', function() { - return new Param($1, null, true); - }), o('ParamVar = Expression', function() { - return new Param($1, $3); - }) - ], - ParamVar: [o('Identifier'), o('ThisProperty'), o('Array'), o('Object')], - Splat: [ - o('Expression ...', function() { - return new Splat($1); - }) - ], - SimpleAssignable: [ - o('Identifier', function() { - return new Value($1); - }), o('Value Accessor', function() { - return $1.push($2); - }), o('Invocation Accessor', function() { - return new Value($1, [$2]); - }), o('ThisProperty') - ], - Assignable: [ - o('SimpleAssignable'), o('Array', function() { - return new Value($1); - }), o('Object', function() { - return new Value($1); - }) - ], - Value: [ - o('Assignable'), o('Literal', function() { - return new Value($1); - }), o('Parenthetical', function() { - return new Value($1); - }), o('Range', function() { - return new Value($1); - }), o('This') - ], - Accessor: [ - o('. Identifier', function() { - return new Access($2); - }), o('?. Identifier', function() { - return new Access($2, 'soak'); - }), o(':: Identifier', function() { - return new Access($2, 'proto'); - }), o('::', function() { - return new Access(new Literal('prototype')); - }), o('Index') - ], - Index: [ - o('INDEX_START IndexValue INDEX_END', function() { - return $2; - }), o('INDEX_SOAK Index', function() { - return extend($2, { - soak: true - }); - }), o('INDEX_PROTO Index', function() { - return extend($2, { - proto: true - }); - }) - ], - IndexValue: [ - o('Expression', function() { - return new Index($1); - }), o('Slice', function() { - return new Slice($1); - }) - ], - Object: [ - o('{ AssignList OptComma }', function() { - return new Obj($2, $1.generated); - }) - ], - AssignList: [ - o('', function() { - return []; - }), o('AssignObj', function() { - return [$1]; - }), o('AssignList , AssignObj', function() { - return $1.concat($3); - }), o('AssignList OptComma TERMINATOR AssignObj', function() { - return $1.concat($4); - }), o('AssignList OptComma INDENT AssignList OptComma OUTDENT', function() { - return $1.concat($4); - }) - ], - Class: [ - o('CLASS', function() { - return new Class; - }), o('CLASS Block', function() { - return new Class(null, null, $2); - }), o('CLASS EXTENDS Value', function() { - return new Class(null, $3); - }), o('CLASS EXTENDS Value Block', function() { - return new Class(null, $3, $4); - }), o('CLASS SimpleAssignable', function() { - return new Class($2); - }), o('CLASS SimpleAssignable Block', function() { - return new Class($2, null, $3); - }), o('CLASS SimpleAssignable EXTENDS Value', function() { - return new Class($2, $4); - }), o('CLASS SimpleAssignable EXTENDS Value Block', function() { - return new Class($2, $4, $5); - }) - ], - Invocation: [ - o('Value OptFuncExist Arguments', function() { - return new Call($1, $3, $2); - }), o('Invocation OptFuncExist Arguments', function() { - return new Call($1, $3, $2); - }), o('SUPER', function() { - return new Call('super', [new Splat(new Literal('arguments'))]); - }), o('SUPER Arguments', function() { - return new Call('super', $2); - }) - ], - OptFuncExist: [ - o('', function() { - return false; - }), o('FUNC_EXIST', function() { - return true; - }) - ], - Arguments: [ - o('CALL_START CALL_END', function() { - return []; - }), o('CALL_START ArgList OptComma CALL_END', function() { - return $2; - }) - ], - This: [ - o('THIS', function() { - return new Value(new Literal('this')); - }), o('@', function() { - return new Value(new Literal('this')); - }) - ], - ThisProperty: [ - o('@ Identifier', function() { - return new Value(new Literal('this'), [new Access($2)], 'this'); - }) - ], - Array: [ - o('[ ]', function() { - return new Arr([]); - }), o('[ ArgList OptComma ]', function() { - return new Arr($2); - }) - ], - RangeDots: [ - o('..', function() { - return 'inclusive'; - }), o('...', function() { - return 'exclusive'; - }) - ], - Range: [ - o('[ Expression RangeDots Expression ]', function() { - return new Range($2, $4, $3); - }) - ], - Slice: [ - o('Expression RangeDots Expression', function() { - return new Range($1, $3, $2); - }), o('Expression RangeDots', function() { - return new Range($1, null, $2); - }), o('RangeDots Expression', function() { - return new Range(null, $2, $1); - }) - ], - ArgList: [ - o('Arg', function() { - return [$1]; - }), o('ArgList , Arg', function() { - return $1.concat($3); - }), o('ArgList OptComma TERMINATOR Arg', function() { - return $1.concat($4); - }), o('INDENT ArgList OptComma OUTDENT', function() { - return $2; - }), o('ArgList OptComma INDENT ArgList OptComma OUTDENT', function() { - return $1.concat($4); - }) - ], - Arg: [o('Expression'), o('Splat')], - SimpleArgs: [ - o('Expression'), o('SimpleArgs , Expression', function() { - return [].concat($1, $3); - }) - ], - Try: [ - o('TRY Block', function() { - return new Try($2); - }), o('TRY Block Catch', function() { - return new Try($2, $3[0], $3[1]); - }), o('TRY Block FINALLY Block', function() { - return new Try($2, null, null, $4); - }), o('TRY Block Catch FINALLY Block', function() { - return new Try($2, $3[0], $3[1], $5); - }) - ], - Catch: [ - o('CATCH Identifier Block', function() { - return [$2, $3]; - }) - ], - Throw: [ - o('THROW Expression', function() { - return new Throw($2); - }) - ], - Parenthetical: [ - o('( Body )', function() { - return new Parens($2); - }), o('( INDENT Body OUTDENT )', function() { - return new Parens($3); - }) - ], - WhileSource: [ - o('WHILE Expression', function() { - return new While($2); - }), o('WHILE Expression WHEN Expression', function() { - return new While($2, { - guard: $4 - }); - }), o('UNTIL Expression', function() { - return new While($2, { - invert: true - }); - }), o('UNTIL Expression WHEN Expression', function() { - return new While($2, { - invert: true, - guard: $4 - }); - }) - ], - While: [ - o('WhileSource Block', function() { - return $1.addBody($2); - }), o('Statement WhileSource', function() { - return $2.addBody(Block.wrap([$1])); - }), o('Expression WhileSource', function() { - return $2.addBody(Block.wrap([$1])); - }), o('Loop', function() { - return $1; - }) - ], - Loop: [ - o('LOOP Block', function() { - return new While(new Literal('true')).addBody($2); - }), o('LOOP Expression', function() { - return new While(new Literal('true')).addBody(Block.wrap([$2])); - }) - ], - For: [ - o('Statement ForBody', function() { - return new For($1, $2); - }), o('Expression ForBody', function() { - return new For($1, $2); - }), o('ForBody Block', function() { - return new For($2, $1); - }) - ], - ForBody: [ - o('FOR Range', function() { - return { - source: new Value($2) - }; - }), o('ForStart ForSource', function() { - $2.own = $1.own; - $2.name = $1[0]; - $2.index = $1[1]; - return $2; - }) - ], - ForStart: [ - o('FOR ForVariables', function() { - return $2; - }), o('FOR OWN ForVariables', function() { - $3.own = true; - return $3; - }) - ], - ForValue: [ - o('Identifier'), o('Array', function() { - return new Value($1); - }), o('Object', function() { - return new Value($1); - }) - ], - ForVariables: [ - o('ForValue', function() { - return [$1]; - }), o('ForValue , ForValue', function() { - return [$1, $3]; - }) - ], - ForSource: [ - o('FORIN Expression', function() { - return { - source: $2 - }; - }), o('FOROF Expression', function() { - return { - source: $2, - object: true - }; - }), o('FORIN Expression WHEN Expression', function() { - return { - source: $2, - guard: $4 - }; - }), o('FOROF Expression WHEN Expression', function() { - return { - source: $2, - guard: $4, - object: true - }; - }), o('FORIN Expression BY Expression', function() { - return { - source: $2, - step: $4 - }; - }), o('FORIN Expression WHEN Expression BY Expression', function() { - return { - source: $2, - guard: $4, - step: $6 - }; - }), o('FORIN Expression BY Expression WHEN Expression', function() { - return { - source: $2, - step: $4, - guard: $6 - }; - }) - ], - Switch: [ - o('SWITCH Expression INDENT Whens OUTDENT', function() { - return new Switch($2, $4); - }), o('SWITCH Expression INDENT Whens ELSE Block OUTDENT', function() { - return new Switch($2, $4, $6); - }), o('SWITCH INDENT Whens OUTDENT', function() { - return new Switch(null, $3); - }), o('SWITCH INDENT Whens ELSE Block OUTDENT', function() { - return new Switch(null, $3, $5); - }) - ], - Whens: [ - o('When'), o('Whens When', function() { - return $1.concat($2); - }) - ], - When: [ - o('LEADING_WHEN SimpleArgs Block', function() { - return [[$2, $3]]; - }), o('LEADING_WHEN SimpleArgs Block TERMINATOR', function() { - return [[$2, $3]]; - }) - ], - IfBlock: [ - o('IF Expression Block', function() { - return new If($2, $3, { - type: $1 - }); - }), o('IfBlock ELSE IF Expression Block', function() { - return $1.addElse(new If($4, $5, { - type: $3 - })); - }) - ], - If: [ - o('IfBlock'), o('IfBlock ELSE Block', function() { - return $1.addElse($3); - }), o('Statement POST_IF Expression', function() { - return new If($3, Block.wrap([$1]), { - type: $2, - statement: true - }); - }), o('Expression POST_IF Expression', function() { - return new If($3, Block.wrap([$1]), { - type: $2, - statement: true - }); - }) - ], - Operation: [ - o('UNARY Expression', function() { - return new Op($1, $2); - }), o('- Expression', (function() { - return new Op('-', $2); - }), { - prec: 'UNARY' - }), o('+ Expression', (function() { - return new Op('+', $2); - }), { - prec: 'UNARY' - }), o('-- SimpleAssignable', function() { - return new Op('--', $2); - }), o('++ SimpleAssignable', function() { - return new Op('++', $2); - }), o('SimpleAssignable --', function() { - return new Op('--', $1, null, true); - }), o('SimpleAssignable ++', function() { - return new Op('++', $1, null, true); - }), o('Expression ?', function() { - return new Existence($1); - }), o('Expression + Expression', function() { - return new Op('+', $1, $3); - }), o('Expression - Expression', function() { - return new Op('-', $1, $3); - }), o('Expression MATH Expression', function() { - return new Op($2, $1, $3); - }), o('Expression SHIFT Expression', function() { - return new Op($2, $1, $3); - }), o('Expression COMPARE Expression', function() { - return new Op($2, $1, $3); - }), o('Expression LOGIC Expression', function() { - return new Op($2, $1, $3); - }), o('Expression RELATION Expression', function() { - if ($2.charAt(0) === '!') { - return new Op($2.slice(1), $1, $3).invert(); - } else { - return new Op($2, $1, $3); - } - }), o('SimpleAssignable COMPOUND_ASSIGN\ - Expression', function() { - return new Assign($1, $3, $2); - }), o('SimpleAssignable COMPOUND_ASSIGN\ - INDENT Expression OUTDENT', function() { - return new Assign($1, $4, $2); - }), o('SimpleAssignable EXTENDS Expression', function() { - return new Extends($1, $3); - }) - ] - }; - operators = [['left', '.', '?.', '::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'DO', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['right', 'POST_IF']]; - tokens = []; - for (name in grammar) { - alternatives = grammar[name]; - grammar[name] = (function() { - var _i, _j, _len, _len2, _ref, _results; - _results = []; - for (_i = 0, _len = alternatives.length; _i < _len; _i++) { - alt = alternatives[_i]; - _ref = alt[0].split(' '); - for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) { - token = _ref[_j]; - if (!grammar[token]) { - tokens.push(token); - } - } - if (name === 'Root') { - alt[1] = "return " + alt[1]; - } - _results.push(alt); - } - return _results; - })(); - } - exports.parser = new Parser({ - tokens: tokens.join(' '), - bnf: grammar, - operators: operators.reverse(), - startSymbol: 'Root' - }); -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/helpers.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/helpers.js deleted file mode 100644 index 89be573d..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/helpers.js +++ /dev/null @@ -1,66 +0,0 @@ -(function() { - var extend, flatten; - exports.starts = function(string, literal, start) { - return literal === string.substr(start, literal.length); - }; - exports.ends = function(string, literal, back) { - var len; - len = literal.length; - return literal === string.substr(string.length - len - (back || 0), len); - }; - exports.compact = function(array) { - var item, _i, _len, _results; - _results = []; - for (_i = 0, _len = array.length; _i < _len; _i++) { - item = array[_i]; - if (item) { - _results.push(item); - } - } - return _results; - }; - exports.count = function(string, substr) { - var num, pos; - num = pos = 0; - if (!substr.length) { - return 1 / 0; - } - while (pos = 1 + string.indexOf(substr, pos)) { - num++; - } - return num; - }; - exports.merge = function(options, overrides) { - return extend(extend({}, options), overrides); - }; - extend = exports.extend = function(object, properties) { - var key, val; - for (key in properties) { - val = properties[key]; - object[key] = val; - } - return object; - }; - exports.flatten = flatten = function(array) { - var element, flattened, _i, _len; - flattened = []; - for (_i = 0, _len = array.length; _i < _len; _i++) { - element = array[_i]; - if (element instanceof Array) { - flattened = flattened.concat(flatten(element)); - } else { - flattened.push(element); - } - } - return flattened; - }; - exports.del = function(obj, key) { - var val; - val = obj[key]; - delete obj[key]; - return val; - }; - exports.last = function(array, back) { - return array[array.length - (back || 0) - 1]; - }; -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/index.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/index.js deleted file mode 100644 index 38f7c1e9..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/index.js +++ /dev/null @@ -1,8 +0,0 @@ -(function() { - var key, val, _ref; - _ref = require('./coffee-script'); - for (key in _ref) { - val = _ref[key]; - exports[key] = val; - } -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/lexer.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/lexer.js deleted file mode 100644 index 4764bf64..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/lexer.js +++ /dev/null @@ -1,656 +0,0 @@ -(function() { - var ASSIGNED, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref; - var __indexOf = Array.prototype.indexOf || function(item) { - for (var i = 0, l = this.length; i < l; i++) { - if (this[i] === item) return i; - } - return -1; - }; - Rewriter = require('./rewriter').Rewriter; - _ref = require('./helpers'), count = _ref.count, starts = _ref.starts, compact = _ref.compact, last = _ref.last; - exports.Lexer = Lexer = (function() { - function Lexer() {} - Lexer.prototype.tokenize = function(code, opts) { - var i; - if (opts == null) { - opts = {}; - } - if (WHITESPACE.test(code)) { - code = "\n" + code; - } - code = code.replace(/\r/g, '').replace(TRAILING_SPACES, ''); - this.code = code; - this.line = opts.line || 0; - this.indent = 0; - this.indebt = 0; - this.outdebt = 0; - this.indents = []; - this.tokens = []; - i = 0; - while (this.chunk = code.slice(i)) { - i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken(); - } - this.closeIndentation(); - if (opts.rewrite === false) { - return this.tokens; - } - return (new Rewriter).rewrite(this.tokens); - }; - Lexer.prototype.identifierToken = function() { - var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3; - if (!(match = IDENTIFIER.exec(this.chunk))) { - return 0; - } - input = match[0], id = match[1], colon = match[2]; - if (id === 'own' && this.tag() === 'FOR') { - this.token('OWN', id); - return id.length; - } - forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::') || !prev.spaced && prev[0] === '@'); - tag = 'IDENTIFIER'; - if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) { - tag = id.toUpperCase(); - if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) { - tag = 'LEADING_WHEN'; - } else if (tag === 'FOR') { - this.seenFor = true; - } else if (tag === 'UNLESS') { - tag = 'IF'; - } else if (__indexOf.call(UNARY, tag) >= 0) { - tag = 'UNARY'; - } else if (__indexOf.call(RELATION, tag) >= 0) { - if (tag !== 'INSTANCEOF' && this.seenFor) { - tag = 'FOR' + tag; - this.seenFor = false; - } else { - tag = 'RELATION'; - if (this.value() === '!') { - this.tokens.pop(); - id = '!' + id; - } - } - } - } - if (__indexOf.call(JS_FORBIDDEN, id) >= 0) { - if (forcedIdentifier) { - tag = 'IDENTIFIER'; - id = new String(id); - id.reserved = true; - } else if (__indexOf.call(RESERVED, id) >= 0) { - this.identifierError(id); - } - } - if (!forcedIdentifier) { - if (__indexOf.call(COFFEE_ALIASES, id) >= 0) { - id = COFFEE_ALIAS_MAP[id]; - } - tag = (function() { - switch (id) { - case '!': - return 'UNARY'; - case '==': - case '!=': - return 'COMPARE'; - case '&&': - case '||': - return 'LOGIC'; - case 'true': - case 'false': - case 'null': - case 'undefined': - return 'BOOL'; - case 'break': - case 'continue': - case 'debugger': - return 'STATEMENT'; - default: - return tag; - } - })(); - } - this.token(tag, id); - if (colon) { - this.token(':', ':'); - } - return input.length; - }; - Lexer.prototype.numberToken = function() { - var match, number; - if (!(match = NUMBER.exec(this.chunk))) { - return 0; - } - number = match[0]; - this.token('NUMBER', number); - return number.length; - }; - Lexer.prototype.stringToken = function() { - var match, string; - switch (this.chunk.charAt(0)) { - case "'": - if (!(match = SIMPLESTR.exec(this.chunk))) { - return 0; - } - this.token('STRING', (string = match[0]).replace(MULTILINER, '\\\n')); - break; - case '"': - if (!(string = this.balancedString(this.chunk, '"'))) { - return 0; - } - if (0 < string.indexOf('#{', 1)) { - this.interpolateString(string.slice(1, -1)); - } else { - this.token('STRING', this.escapeLines(string)); - } - break; - default: - return 0; - } - this.line += count(string, '\n'); - return string.length; - }; - Lexer.prototype.heredocToken = function() { - var doc, heredoc, match, quote; - if (!(match = HEREDOC.exec(this.chunk))) { - return 0; - } - heredoc = match[0]; - quote = heredoc.charAt(0); - doc = this.sanitizeHeredoc(match[2], { - quote: quote, - indent: null - }); - if (quote === '"' && 0 <= doc.indexOf('#{')) { - this.interpolateString(doc, { - heredoc: true - }); - } else { - this.token('STRING', this.makeString(doc, quote, true)); - } - this.line += count(heredoc, '\n'); - return heredoc.length; - }; - Lexer.prototype.commentToken = function() { - var comment, here, match; - if (!(match = this.chunk.match(COMMENT))) { - return 0; - } - comment = match[0], here = match[1]; - if (here) { - this.token('HERECOMMENT', this.sanitizeHeredoc(here, { - herecomment: true, - indent: Array(this.indent + 1).join(' ') - })); - this.token('TERMINATOR', '\n'); - } - this.line += count(comment, '\n'); - return comment.length; - }; - Lexer.prototype.jsToken = function() { - var match, script; - if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) { - return 0; - } - this.token('JS', (script = match[0]).slice(1, -1)); - return script.length; - }; - Lexer.prototype.regexToken = function() { - var length, match, prev, regex, _ref2; - if (this.chunk.charAt(0) !== '/') { - return 0; - } - if (match = HEREGEX.exec(this.chunk)) { - length = this.heregexToken(match); - this.line += count(match[0], '\n'); - return length; - } - prev = last(this.tokens); - if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) { - return 0; - } - if (!(match = REGEX.exec(this.chunk))) { - return 0; - } - regex = match[0]; - this.token('REGEX', regex === '//' ? '/(?:)/' : regex); - return regex.length; - }; - Lexer.prototype.heregexToken = function(match) { - var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4, _ref5; - heregex = match[0], body = match[1], flags = match[2]; - if (0 > body.indexOf('#{')) { - re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/'); - this.token('REGEX', "/" + (re || '(?:)') + "/" + flags); - return heregex.length; - } - this.token('IDENTIFIER', 'RegExp'); - this.tokens.push(['CALL_START', '(']); - tokens = []; - _ref2 = this.interpolateString(body, { - regex: true - }); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - _ref3 = _ref2[_i], tag = _ref3[0], value = _ref3[1]; - if (tag === 'TOKENS') { - tokens.push.apply(tokens, value); - } else { - if (!(value = value.replace(HEREGEX_OMIT, ''))) { - continue; - } - value = value.replace(/\\/g, '\\\\'); - tokens.push(['STRING', this.makeString(value, '"', true)]); - } - tokens.push(['+', '+']); - } - tokens.pop(); - if (((_ref4 = tokens[0]) != null ? _ref4[0] : void 0) !== 'STRING') { - this.tokens.push(['STRING', '""'], ['+', '+']); - } - (_ref5 = this.tokens).push.apply(_ref5, tokens); - if (flags) { - this.tokens.push([',', ','], ['STRING', '"' + flags + '"']); - } - this.token(')', ')'); - return heregex.length; - }; - Lexer.prototype.lineToken = function() { - var diff, indent, match, noNewlines, prev, size; - if (!(match = MULTI_DENT.exec(this.chunk))) { - return 0; - } - indent = match[0]; - this.line += count(indent, '\n'); - prev = last(this.tokens, 1); - size = indent.length - 1 - indent.lastIndexOf('\n'); - noNewlines = this.unfinished(); - if (size - this.indebt === this.indent) { - if (noNewlines) { - this.suppressNewlines(); - } else { - this.newlineToken(); - } - return indent.length; - } - if (size > this.indent) { - if (noNewlines) { - this.indebt = size - this.indent; - this.suppressNewlines(); - return indent.length; - } - diff = size - this.indent + this.outdebt; - this.token('INDENT', diff); - this.indents.push(diff); - this.outdebt = this.indebt = 0; - } else { - this.indebt = 0; - this.outdentToken(this.indent - size, noNewlines); - } - this.indent = size; - return indent.length; - }; - Lexer.prototype.outdentToken = function(moveOut, noNewlines, close) { - var dent, len; - while (moveOut > 0) { - len = this.indents.length - 1; - if (this.indents[len] === void 0) { - moveOut = 0; - } else if (this.indents[len] === this.outdebt) { - moveOut -= this.outdebt; - this.outdebt = 0; - } else if (this.indents[len] < this.outdebt) { - this.outdebt -= this.indents[len]; - moveOut -= this.indents[len]; - } else { - dent = this.indents.pop() - this.outdebt; - moveOut -= dent; - this.outdebt = 0; - this.token('OUTDENT', dent); - } - } - if (dent) { - this.outdebt -= moveOut; - } - if (!(this.tag() === 'TERMINATOR' || noNewlines)) { - this.token('TERMINATOR', '\n'); - } - return this; - }; - Lexer.prototype.whitespaceToken = function() { - var match, nline, prev; - if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) { - return 0; - } - prev = last(this.tokens); - if (prev) { - prev[match ? 'spaced' : 'newLine'] = true; - } - if (match) { - return match[0].length; - } else { - return 0; - } - }; - Lexer.prototype.newlineToken = function() { - if (this.tag() !== 'TERMINATOR') { - this.token('TERMINATOR', '\n'); - } - return this; - }; - Lexer.prototype.suppressNewlines = function() { - if (this.value() === '\\') { - this.tokens.pop(); - } - return this; - }; - Lexer.prototype.literalToken = function() { - var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5; - if (match = OPERATOR.exec(this.chunk)) { - value = match[0]; - if (CODE.test(value)) { - this.tagParameters(); - } - } else { - value = this.chunk.charAt(0); - } - tag = value; - prev = last(this.tokens); - if (value === '=' && prev) { - if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) { - this.assignmentError(); - } - if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') { - prev[0] = 'COMPOUND_ASSIGN'; - prev[1] += '='; - return value.length; - } - } - if (value === ';') { - tag = 'TERMINATOR'; - } else if (__indexOf.call(MATH, value) >= 0) { - tag = 'MATH'; - } else if (__indexOf.call(COMPARE, value) >= 0) { - tag = 'COMPARE'; - } else if (__indexOf.call(COMPOUND_ASSIGN, value) >= 0) { - tag = 'COMPOUND_ASSIGN'; - } else if (__indexOf.call(UNARY, value) >= 0) { - tag = 'UNARY'; - } else if (__indexOf.call(SHIFT, value) >= 0) { - tag = 'SHIFT'; - } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) { - tag = 'LOGIC'; - } else if (prev && !prev.spaced) { - if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) { - if (prev[0] === '?') { - prev[0] = 'FUNC_EXIST'; - } - tag = 'CALL_START'; - } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) { - tag = 'INDEX_START'; - switch (prev[0]) { - case '?': - prev[0] = 'INDEX_SOAK'; - break; - case '::': - prev[0] = 'INDEX_PROTO'; - } - } - } - this.token(tag, value); - return value.length; - }; - Lexer.prototype.sanitizeHeredoc = function(doc, options) { - var attempt, herecomment, indent, match, _ref2; - indent = options.indent, herecomment = options.herecomment; - if (herecomment) { - if (HEREDOC_ILLEGAL.test(doc)) { - throw new Error("block comment cannot contain \"*/\", starting on line " + (this.line + 1)); - } - if (doc.indexOf('\n') <= 0) { - return doc; - } - } else { - while (match = HEREDOC_INDENT.exec(doc)) { - attempt = match[1]; - if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) { - indent = attempt; - } - } - } - if (indent) { - doc = doc.replace(RegExp("\\n" + indent, "g"), '\n'); - } - if (!herecomment) { - doc = doc.replace(/^\n/, ''); - } - return doc; - }; - Lexer.prototype.tagParameters = function() { - var i, stack, tok, tokens; - if (this.tag() !== ')') { - return this; - } - stack = []; - tokens = this.tokens; - i = tokens.length; - tokens[--i][0] = 'PARAM_END'; - while (tok = tokens[--i]) { - switch (tok[0]) { - case ')': - stack.push(tok); - break; - case '(': - case 'CALL_START': - if (stack.length) { - stack.pop(); - } else if (tok[0] === '(') { - tok[0] = 'PARAM_START'; - return this; - } else { - return this; - } - } - } - return this; - }; - Lexer.prototype.closeIndentation = function() { - return this.outdentToken(this.indent); - }; - Lexer.prototype.identifierError = function(word) { - throw SyntaxError("Reserved word \"" + word + "\" on line " + (this.line + 1)); - }; - Lexer.prototype.assignmentError = function() { - throw SyntaxError("Reserved word \"" + (this.value()) + "\" on line " + (this.line + 1) + " can't be assigned"); - }; - Lexer.prototype.balancedString = function(str, end) { - var i, letter, match, prev, stack, _ref2; - stack = [end]; - for (i = 1, _ref2 = str.length; 1 <= _ref2 ? i < _ref2 : i > _ref2; 1 <= _ref2 ? i++ : i--) { - switch (letter = str.charAt(i)) { - case '\\': - i++; - continue; - case end: - stack.pop(); - if (!stack.length) { - return str.slice(0, i + 1); - } - end = stack[stack.length - 1]; - continue; - } - if (end === '}' && (letter === '"' || letter === "'")) { - stack.push(end = letter); - } else if (end === '}' && letter === '/' && (match = HEREGEX.exec(str.slice(i)) || REGEX.exec(str.slice(i)))) { - i += match[0].length - 1; - } else if (end === '}' && letter === '{') { - stack.push(end = '}'); - } else if (end === '"' && prev === '#' && letter === '{') { - stack.push(end = '}'); - } - prev = letter; - } - throw new Error("missing " + (stack.pop()) + ", starting on line " + (this.line + 1)); - }; - Lexer.prototype.interpolateString = function(str, options) { - var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _len, _ref2, _ref3, _ref4; - if (options == null) { - options = {}; - } - heredoc = options.heredoc, regex = options.regex; - tokens = []; - pi = 0; - i = -1; - while (letter = str.charAt(i += 1)) { - if (letter === '\\') { - i += 1; - continue; - } - if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) { - continue; - } - if (pi < i) { - tokens.push(['NEOSTRING', str.slice(pi, i)]); - } - inner = expr.slice(1, -1); - if (inner.length) { - nested = new Lexer().tokenize(inner, { - line: this.line, - rewrite: false - }); - nested.pop(); - if (((_ref2 = nested[0]) != null ? _ref2[0] : void 0) === 'TERMINATOR') { - nested.shift(); - } - if (len = nested.length) { - if (len > 1) { - nested.unshift(['(', '(']); - nested.push([')', ')']); - } - tokens.push(['TOKENS', nested]); - } - } - i += expr.length; - pi = i + 1; - } - if ((i > pi && pi < str.length)) { - tokens.push(['NEOSTRING', str.slice(pi)]); - } - if (regex) { - return tokens; - } - if (!tokens.length) { - return this.token('STRING', '""'); - } - if (tokens[0][0] !== 'NEOSTRING') { - tokens.unshift(['', '']); - } - if (interpolated = tokens.length > 1) { - this.token('(', '('); - } - for (i = 0, _len = tokens.length; i < _len; i++) { - _ref3 = tokens[i], tag = _ref3[0], value = _ref3[1]; - if (i) { - this.token('+', '+'); - } - if (tag === 'TOKENS') { - (_ref4 = this.tokens).push.apply(_ref4, value); - } else { - this.token('STRING', this.makeString(value, '"', heredoc)); - } - } - if (interpolated) { - this.token(')', ')'); - } - return tokens; - }; - Lexer.prototype.token = function(tag, value) { - return this.tokens.push([tag, value, this.line]); - }; - Lexer.prototype.tag = function(index, tag) { - var tok; - return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]); - }; - Lexer.prototype.value = function(index, val) { - var tok; - return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]); - }; - Lexer.prototype.unfinished = function() { - var prev, value; - return LINE_CONTINUER.test(this.chunk) || (prev = last(this.tokens, 1)) && prev[0] !== '.' && (value = this.value()) && !value.reserved && NO_NEWLINE.test(value) && !CODE.test(value) && !ASSIGNED.test(this.chunk); - }; - Lexer.prototype.escapeLines = function(str, heredoc) { - return str.replace(MULTILINER, heredoc ? '\\n' : ''); - }; - Lexer.prototype.makeString = function(body, quote, heredoc) { - if (!body) { - return quote + quote; - } - body = body.replace(/\\([\s\S])/g, function(match, contents) { - if (contents === '\n' || contents === quote) { - return contents; - } else { - return match; - } - }); - body = body.replace(RegExp("" + quote, "g"), '\\$&'); - return quote + this.escapeLines(body, heredoc) + quote; - }; - return Lexer; - })(); - 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']; - COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when']; - COFFEE_ALIAS_MAP = { - and: '&&', - or: '||', - is: '==', - isnt: '!=', - not: '!', - yes: 'true', - no: 'false', - on: 'true', - off: 'false' - }; - COFFEE_ALIASES = (function() { - var _results; - _results = []; - for (key in COFFEE_ALIAS_MAP) { - _results.push(key); - } - return _results; - })(); - COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES); - RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf']; - JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED); - exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS); - IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/; - NUMBER = /^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i; - HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/; - OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/; - WHITESPACE = /^[^\n\S]+/; - COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/; - CODE = /^[-=]>/; - MULTI_DENT = /^(?:\n[^\n\S]*)+/; - SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/; - JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/; - REGEX = /^\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/[imgy]{0,4}(?!\w)/; - HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/; - HEREGEX_OMIT = /\s+(?:#.*)?/g; - MULTILINER = /\n/g; - HEREDOC_INDENT = /\n+([^\n\S]*)/g; - HEREDOC_ILLEGAL = /\*\//; - ASSIGNED = /^\s*@?([$A-Za-z_][$\w\x7f-\uffff]*|['"].*['"])[^\n\S]*?[:=][^:=>]/; - LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/; - TRAILING_SPACES = /\s+$/; - NO_NEWLINE = /^(?:[-+*&|\/%=<>!.\\][<>=&|]*|and|or|is(?:nt)?|n(?:ot|ew)|delete|typeof|instanceof)$/; - COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|=']; - UNARY = ['!', '~', 'NEW', 'TYPEOF', 'DELETE', 'DO']; - LOGIC = ['&&', '||', '&', '|', '^']; - SHIFT = ['<<', '>>', '>>>']; - COMPARE = ['==', '!=', '<', '>', '<=', '>=']; - MATH = ['*', '/', '%']; - RELATION = ['IN', 'OF', 'INSTANCEOF']; - BOOL = ['TRUE', 'FALSE', 'NULL', 'UNDEFINED']; - NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', '++', '--', ']']; - NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING'); - CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER']; - INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL'); - LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR']; -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/nodes.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/nodes.js deleted file mode 100644 index 11310622..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/nodes.js +++ /dev/null @@ -1,2289 +0,0 @@ -(function() { - var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, 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, Push, Range, Return, SIMPLENUM, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, starts, unfoldSoak, utility, _ref; - var __hasProp = Object.prototype.hasOwnProperty, __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; - }, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __indexOf = Array.prototype.indexOf || function(item) { - for (var i = 0, l = this.length; i < l; i++) { - if (this[i] === item) return i; - } - return -1; - }; - Scope = require('./scope').Scope; - _ref = require('./helpers'), compact = _ref.compact, flatten = _ref.flatten, extend = _ref.extend, merge = _ref.merge, del = _ref.del, starts = _ref.starts, ends = _ref.ends, last = _ref.last; - exports.extend = extend; - YES = function() { - return true; - }; - NO = function() { - return false; - }; - THIS = function() { - return this; - }; - NEGATE = function() { - this.negated = !this.negated; - return this; - }; - exports.Base = Base = (function() { - function Base() {} - Base.prototype.compile = function(o, lvl) { - var node; - o = extend({}, o); - if (lvl) { - o.level = lvl; - } - node = this.unfoldSoak(o) || this; - node.tab = o.indent; - if (o.level === LEVEL_TOP || !node.isStatement(o)) { - return node.compileNode(o); - } else { - return node.compileClosure(o); - } - }; - Base.prototype.compileClosure = function(o) { - if (this.jumps() || this instanceof Throw) { - throw SyntaxError('cannot use a pure statement in an expression.'); - } - o.sharedScope = true; - return Closure.wrap(this).compileNode(o); - }; - Base.prototype.cache = function(o, level, reused) { - var ref, sub; - if (!this.isComplex()) { - ref = level ? this.compile(o, level) : this; - return [ref, ref]; - } else { - ref = new Literal(reused || o.scope.freeVariable('ref')); - sub = new Assign(ref, this); - if (level) { - return [sub.compile(o, level), ref.value]; - } else { - return [sub, ref]; - } - } - }; - Base.prototype.compileLoopReference = function(o, name) { - var src, tmp; - src = tmp = this.compile(o, LEVEL_LIST); - if (!((-Infinity < +src && +src < Infinity) || IDENTIFIER.test(src) && o.scope.check(src, true))) { - src = "" + (tmp = o.scope.freeVariable(name)) + " = " + src; - } - return [src, tmp]; - }; - Base.prototype.makeReturn = function() { - return new Return(this); - }; - Base.prototype.contains = function(pred) { - var contains; - contains = false; - this.traverseChildren(false, function(node) { - if (pred(node)) { - contains = true; - return false; - } - }); - return contains; - }; - Base.prototype.containsType = function(type) { - return this instanceof type || this.contains(function(node) { - return node instanceof type; - }); - }; - Base.prototype.lastNonComment = function(list) { - var i; - i = list.length; - while (i--) { - if (!(list[i] instanceof Comment)) { - return list[i]; - } - } - return null; - }; - Base.prototype.toString = function(idt, name) { - var tree; - if (idt == null) { - idt = ''; - } - if (name == null) { - name = this.constructor.name; - } - tree = '\n' + idt + name; - if (this.soak) { - tree += '?'; - } - this.eachChild(function(node) { - return tree += node.toString(idt + TAB); - }); - return tree; - }; - Base.prototype.eachChild = function(func) { - var attr, child, _i, _j, _len, _len2, _ref2, _ref3; - if (!this.children) { - return this; - } - _ref2 = this.children; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - attr = _ref2[_i]; - if (this[attr]) { - _ref3 = flatten([this[attr]]); - for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { - child = _ref3[_j]; - if (func(child) === false) { - return this; - } - } - } - } - return this; - }; - Base.prototype.traverseChildren = function(crossScope, func) { - return this.eachChild(function(child) { - if (func(child) === false) { - return false; - } - return child.traverseChildren(crossScope, func); - }); - }; - Base.prototype.invert = function() { - return new Op('!', this); - }; - Base.prototype.unwrapAll = function() { - var node; - node = this; - while (node !== (node = node.unwrap())) { - continue; - } - return node; - }; - Base.prototype.children = []; - Base.prototype.isStatement = NO; - Base.prototype.jumps = NO; - Base.prototype.isComplex = YES; - Base.prototype.isChainable = NO; - Base.prototype.isAssignable = NO; - Base.prototype.unwrap = THIS; - Base.prototype.unfoldSoak = NO; - Base.prototype.assigns = NO; - return Base; - })(); - exports.Block = Block = (function() { - __extends(Block, Base); - function Block(nodes) { - this.expressions = compact(flatten(nodes || [])); - } - Block.prototype.children = ['expressions']; - Block.prototype.push = function(node) { - this.expressions.push(node); - return this; - }; - Block.prototype.pop = function() { - return this.expressions.pop(); - }; - Block.prototype.unshift = function(node) { - this.expressions.unshift(node); - return this; - }; - Block.prototype.unwrap = function() { - if (this.expressions.length === 1) { - return this.expressions[0]; - } else { - return this; - } - }; - Block.prototype.isEmpty = function() { - return !this.expressions.length; - }; - Block.prototype.isStatement = function(o) { - var exp, _i, _len, _ref2; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - exp = _ref2[_i]; - if (exp.isStatement(o)) { - return true; - } - } - return false; - }; - Block.prototype.jumps = function(o) { - var exp, _i, _len, _ref2; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - exp = _ref2[_i]; - if (exp.jumps(o)) { - return exp; - } - } - }; - Block.prototype.makeReturn = function() { - var expr, len; - len = this.expressions.length; - while (len--) { - expr = this.expressions[len]; - if (!(expr instanceof Comment)) { - this.expressions[len] = expr.makeReturn(); - if (expr instanceof Return && !expr.expression) { - this.expressions.splice(len, 1); - } - break; - } - } - return this; - }; - Block.prototype.compile = function(o, level) { - if (o == null) { - o = {}; - } - if (o.scope) { - return Block.__super__.compile.call(this, o, level); - } else { - return this.compileRoot(o); - } - }; - Block.prototype.compileNode = function(o) { - var code, codes, node, top, _i, _len, _ref2; - this.tab = o.indent; - top = o.level === LEVEL_TOP; - codes = []; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - node = _ref2[_i]; - node = node.unwrapAll(); - node = node.unfoldSoak(o) || node; - if (node instanceof Block) { - codes.push(node.compileNode(o)); - } else if (top) { - node.front = true; - code = node.compile(o); - codes.push(node.isStatement(o) ? code : this.tab + code + ';'); - } else { - codes.push(node.compile(o, LEVEL_LIST)); - } - } - if (top) { - return codes.join('\n'); - } - code = codes.join(', ') || 'void 0'; - if (codes.length > 1 && o.level >= LEVEL_LIST) { - return "(" + code + ")"; - } else { - return code; - } - }; - Block.prototype.compileRoot = function(o) { - var code; - o.indent = this.tab = o.bare ? '' : TAB; - o.scope = new Scope(null, this, null); - o.level = LEVEL_TOP; - code = this.compileWithDeclarations(o); - if (o.bare) { - return code; - } else { - return "(function() {\n" + code + "\n}).call(this);\n"; - } - }; - Block.prototype.compileWithDeclarations = function(o) { - var assigns, code, declars, exp, i, post, rest, scope, _len, _ref2; - code = post = ''; - _ref2 = this.expressions; - for (i = 0, _len = _ref2.length; i < _len; i++) { - exp = _ref2[i]; - exp = exp.unwrap(); - if (!(exp instanceof Comment || exp instanceof Literal)) { - break; - } - } - o = merge(o, { - level: LEVEL_TOP - }); - if (i) { - rest = this.expressions.splice(i, this.expressions.length); - code = this.compileNode(o); - this.expressions = rest; - } - post = this.compileNode(o); - scope = o.scope; - if (scope.expressions === this) { - declars = o.scope.hasDeclarations(); - assigns = scope.hasAssignments; - if ((declars || assigns) && i) { - code += '\n'; - } - if (declars) { - code += "" + this.tab + "var " + (scope.declaredVariables().join(', ')) + ";\n"; - } - if (assigns) { - code += "" + this.tab + "var " + (multident(scope.assignedVariables().join(', '), this.tab)) + ";\n"; - } - } - return code + post; - }; - Block.wrap = function(nodes) { - if (nodes.length === 1 && nodes[0] instanceof Block) { - return nodes[0]; - } - return new Block(nodes); - }; - return Block; - })(); - exports.Literal = Literal = (function() { - __extends(Literal, Base); - function Literal(value) { - this.value = value; - } - Literal.prototype.makeReturn = function() { - if (this.isStatement()) { - return this; - } else { - return new Return(this); - } - }; - Literal.prototype.isAssignable = function() { - return IDENTIFIER.test(this.value); - }; - Literal.prototype.isStatement = function() { - var _ref2; - return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger'; - }; - Literal.prototype.isComplex = NO; - Literal.prototype.assigns = function(name) { - return name === this.value; - }; - Literal.prototype.jumps = function(o) { - if (!this.isStatement()) { - return false; - } - if (!(o && (o.loop || o.block && (this.value !== 'continue')))) { - return this; - } else { - return false; - } - }; - Literal.prototype.compileNode = function(o) { - var code; - code = this.isUndefined ? o.level >= LEVEL_ACCESS ? '(void 0)' : 'void 0' : this.value.reserved ? "\"" + this.value + "\"" : this.value; - if (this.isStatement()) { - return "" + this.tab + code + ";"; - } else { - return code; - } - }; - Literal.prototype.toString = function() { - return ' "' + this.value + '"'; - }; - return Literal; - })(); - exports.Return = Return = (function() { - __extends(Return, Base); - function Return(expr) { - if (expr && !expr.unwrap().isUndefined) { - this.expression = expr; - } - } - Return.prototype.children = ['expression']; - Return.prototype.isStatement = YES; - Return.prototype.makeReturn = THIS; - Return.prototype.jumps = THIS; - Return.prototype.compile = function(o, level) { - var expr, _ref2; - expr = (_ref2 = this.expression) != null ? _ref2.makeReturn() : void 0; - if (expr && !(expr instanceof Return)) { - return expr.compile(o, level); - } else { - return Return.__super__.compile.call(this, o, level); - } - }; - Return.prototype.compileNode = function(o) { - return this.tab + ("return" + (this.expression ? ' ' + this.expression.compile(o, LEVEL_PAREN) : '') + ";"); - }; - return Return; - })(); - exports.Value = Value = (function() { - __extends(Value, Base); - function Value(base, props, tag) { - if (!props && base instanceof Value) { - return base; - } - this.base = base; - this.properties = props || []; - if (tag) { - this[tag] = true; - } - return this; - } - Value.prototype.children = ['base', 'properties']; - Value.prototype.push = function(prop) { - this.properties.push(prop); - return this; - }; - Value.prototype.hasProperties = function() { - return !!this.properties.length; - }; - Value.prototype.isArray = function() { - return !this.properties.length && this.base instanceof Arr; - }; - Value.prototype.isComplex = function() { - return this.hasProperties() || this.base.isComplex(); - }; - Value.prototype.isAssignable = function() { - return this.hasProperties() || this.base.isAssignable(); - }; - Value.prototype.isSimpleNumber = function() { - return this.base instanceof Literal && SIMPLENUM.test(this.base.value); - }; - Value.prototype.isAtomic = function() { - var node, _i, _len, _ref2; - _ref2 = this.properties.concat(this.base); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - node = _ref2[_i]; - if (node.soak || node instanceof Call) { - return false; - } - } - return true; - }; - Value.prototype.isStatement = function(o) { - return !this.properties.length && this.base.isStatement(o); - }; - Value.prototype.assigns = function(name) { - return !this.properties.length && this.base.assigns(name); - }; - Value.prototype.jumps = function(o) { - return !this.properties.length && this.base.jumps(o); - }; - Value.prototype.isObject = function(onlyGenerated) { - if (this.properties.length) { - return false; - } - return (this.base instanceof Obj) && (!onlyGenerated || this.base.generated); - }; - Value.prototype.isSplice = function() { - return last(this.properties) instanceof Slice; - }; - Value.prototype.makeReturn = function() { - if (this.properties.length) { - return Value.__super__.makeReturn.call(this); - } else { - return this.base.makeReturn(); - } - }; - Value.prototype.unwrap = function() { - if (this.properties.length) { - return this; - } else { - return this.base; - } - }; - Value.prototype.cacheReference = function(o) { - var base, bref, name, nref; - name = last(this.properties); - if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) { - return [this, this]; - } - base = new Value(this.base, this.properties.slice(0, -1)); - if (base.isComplex()) { - bref = new Literal(o.scope.freeVariable('base')); - base = new Value(new Parens(new Assign(bref, base))); - } - if (!name) { - return [base, bref]; - } - if (name.isComplex()) { - nref = new Literal(o.scope.freeVariable('name')); - name = new Index(new Assign(nref, name.index)); - nref = new Index(nref); - } - return [base.push(name), new Value(bref || base.base, [nref || name])]; - }; - Value.prototype.compileNode = function(o) { - var code, prop, props, _i, _len; - this.base.front = this.front; - props = this.properties; - code = this.base.compile(o, props.length ? LEVEL_ACCESS : null); - if ((this.base instanceof Parens || props.length) && SIMPLENUM.test(code)) { - code = "" + code + "."; - } - for (_i = 0, _len = props.length; _i < _len; _i++) { - prop = props[_i]; - code += prop.compile(o); - } - return code; - }; - Value.prototype.unfoldSoak = function(o) { - var result; - if (this.unfoldedSoak != null) { - return this.unfoldedSoak; - } - result = __bind(function() { - var fst, i, ifn, prop, ref, snd, _len, _ref2; - if (ifn = this.base.unfoldSoak(o)) { - Array.prototype.push.apply(ifn.body.properties, this.properties); - return ifn; - } - _ref2 = this.properties; - for (i = 0, _len = _ref2.length; i < _len; i++) { - prop = _ref2[i]; - if (prop.soak) { - prop.soak = false; - fst = new Value(this.base, this.properties.slice(0, i)); - snd = new Value(this.base, this.properties.slice(i)); - if (fst.isComplex()) { - ref = new Literal(o.scope.freeVariable('ref')); - fst = new Parens(new Assign(ref, fst)); - snd.base = ref; - } - return new If(new Existence(fst), snd, { - soak: true - }); - } - } - return null; - }, this)(); - return this.unfoldedSoak = result || false; - }; - return Value; - })(); - exports.Comment = Comment = (function() { - __extends(Comment, Base); - function Comment(comment) { - this.comment = comment; - } - Comment.prototype.isStatement = YES; - Comment.prototype.makeReturn = THIS; - Comment.prototype.compileNode = function(o, level) { - var code; - code = '/*' + multident(this.comment, this.tab) + '*/'; - if ((level || o.level) === LEVEL_TOP) { - code = o.indent + code; - } - return code; - }; - return Comment; - })(); - exports.Call = Call = (function() { - __extends(Call, Base); - function Call(variable, args, soak) { - this.args = args != null ? args : []; - this.soak = soak; - this.isNew = false; - this.isSuper = variable === 'super'; - this.variable = this.isSuper ? null : variable; - } - Call.prototype.children = ['variable', 'args']; - Call.prototype.newInstance = function() { - var base; - base = this.variable.base || this.variable; - if (base instanceof Call && !base.isNew) { - base.newInstance(); - } else { - this.isNew = true; - } - return this; - }; - Call.prototype.superReference = function(o) { - var method, name; - method = o.scope.method; - if (!method) { - throw SyntaxError('cannot call super outside of a function.'); - } - name = method.name; - if (name == null) { - throw SyntaxError('cannot call super on an anonymous function.'); - } - if (method.klass) { - return (new Value(new Literal(method.klass), [new Access(new Literal("__super__")), new Access(new Literal(name))])).compile(o); - } else { - return "" + name + ".__super__.constructor"; - } - }; - Call.prototype.unfoldSoak = function(o) { - var call, ifn, left, list, rite, _i, _len, _ref2, _ref3; - if (this.soak) { - if (this.variable) { - if (ifn = unfoldSoak(o, this, 'variable')) { - return ifn; - } - _ref2 = new Value(this.variable).cacheReference(o), left = _ref2[0], rite = _ref2[1]; - } else { - left = new Literal(this.superReference(o)); - rite = new Value(left); - } - rite = new Call(rite, this.args); - rite.isNew = this.isNew; - left = new Literal("typeof " + (left.compile(o)) + " === \"function\""); - return new If(left, new Value(rite), { - soak: true - }); - } - call = this; - list = []; - while (true) { - if (call.variable instanceof Call) { - list.push(call); - call = call.variable; - continue; - } - if (!(call.variable instanceof Value)) { - break; - } - list.push(call); - if (!((call = call.variable.base) instanceof Call)) { - break; - } - } - _ref3 = list.reverse(); - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - call = _ref3[_i]; - if (ifn) { - if (call.variable instanceof Call) { - call.variable = ifn; - } else { - call.variable.base = ifn; - } - } - ifn = unfoldSoak(o, call, 'variable'); - } - return ifn; - }; - Call.prototype.filterImplicitObjects = function(list) { - var node, nodes, obj, prop, properties, _i, _j, _len, _len2, _ref2; - nodes = []; - for (_i = 0, _len = list.length; _i < _len; _i++) { - node = list[_i]; - if (!((typeof node.isObject === "function" ? node.isObject() : void 0) && node.base.generated)) { - nodes.push(node); - continue; - } - obj = null; - _ref2 = node.base.properties; - for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { - prop = _ref2[_j]; - if (prop instanceof Assign || prop instanceof Comment) { - if (!obj) { - nodes.push(obj = new Obj(properties = [], true)); - } - properties.push(prop); - } else { - nodes.push(prop); - obj = null; - } - } - } - return nodes; - }; - Call.prototype.compileNode = function(o) { - var arg, args, code, _ref2; - if ((_ref2 = this.variable) != null) { - _ref2.front = this.front; - } - if (code = Splat.compileSplattedArray(o, this.args, true)) { - return this.compileSplat(o, code); - } - args = this.filterImplicitObjects(this.args); - args = ((function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = args.length; _i < _len; _i++) { - arg = args[_i]; - _results.push(arg.compile(o, LEVEL_LIST)); - } - return _results; - })()).join(', '); - if (this.isSuper) { - return this.superReference(o) + (".call(this" + (args && ', ' + args) + ")"); - } else { - return (this.isNew ? 'new ' : '') + this.variable.compile(o, LEVEL_ACCESS) + ("(" + args + ")"); - } - }; - Call.prototype.compileSuper = function(args, o) { - return "" + (this.superReference(o)) + ".call(this" + (args.length ? ', ' : '') + args + ")"; - }; - Call.prototype.compileSplat = function(o, splatArgs) { - var base, fun, idt, name, ref; - if (this.isSuper) { - return "" + (this.superReference(o)) + ".apply(this, " + splatArgs + ")"; - } - if (this.isNew) { - idt = this.tab + TAB; - return "(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args);\n" + idt + "return typeof result === \"object\" ? result : child;\n" + this.tab + "})(" + (this.variable.compile(o, LEVEL_LIST)) + ", " + splatArgs + ", function() {})"; - } - base = new Value(this.variable); - if ((name = base.properties.pop()) && base.isComplex()) { - ref = o.scope.freeVariable('ref'); - fun = "(" + ref + " = " + (base.compile(o, LEVEL_LIST)) + ")" + (name.compile(o)); - } else { - fun = base.compile(o, LEVEL_ACCESS); - if (SIMPLENUM.test(fun)) { - fun = "(" + fun + ")"; - } - if (name) { - ref = fun; - fun += name.compile(o); - } else { - ref = 'null'; - } - } - return "" + fun + ".apply(" + ref + ", " + splatArgs + ")"; - }; - return Call; - })(); - exports.Extends = Extends = (function() { - __extends(Extends, Base); - function Extends(child, parent) { - this.child = child; - this.parent = parent; - } - Extends.prototype.children = ['child', 'parent']; - Extends.prototype.compile = function(o) { - utility('hasProp'); - return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compile(o); - }; - return Extends; - })(); - exports.Access = Access = (function() { - __extends(Access, Base); - function Access(name, tag) { - this.name = name; - this.name.asKey = true; - this.proto = tag === 'proto' ? '.prototype' : ''; - this.soak = tag === 'soak'; - } - Access.prototype.children = ['name']; - Access.prototype.compile = function(o) { - var name; - name = this.name.compile(o); - return this.proto + (IDENTIFIER.test(name) ? "." + name : "[" + name + "]"); - }; - Access.prototype.isComplex = NO; - return Access; - })(); - exports.Index = Index = (function() { - __extends(Index, Base); - function Index(index) { - this.index = index; - } - Index.prototype.children = ['index']; - Index.prototype.compile = function(o) { - return (this.proto ? '.prototype' : '') + ("[" + (this.index.compile(o, LEVEL_PAREN)) + "]"); - }; - Index.prototype.isComplex = function() { - return this.index.isComplex(); - }; - return Index; - })(); - exports.Range = Range = (function() { - __extends(Range, Base); - Range.prototype.children = ['from', 'to']; - function Range(from, to, tag) { - this.from = from; - this.to = to; - this.exclusive = tag === 'exclusive'; - this.equals = this.exclusive ? '' : '='; - } - Range.prototype.compileVariables = function(o) { - var step, _ref2, _ref3, _ref4, _ref5; - o = merge(o, { - top: true - }); - _ref2 = this.from.cache(o, LEVEL_LIST), this.fromC = _ref2[0], this.fromVar = _ref2[1]; - _ref3 = this.to.cache(o, LEVEL_LIST), this.toC = _ref3[0], this.toVar = _ref3[1]; - if (step = del(o, 'step')) { - _ref4 = step.cache(o, LEVEL_LIST), this.step = _ref4[0], this.stepVar = _ref4[1]; - } - _ref5 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref5[0], this.toNum = _ref5[1]; - if (this.stepVar) { - return this.stepNum = this.stepVar.match(SIMPLENUM); - } - }; - Range.prototype.compileNode = function(o) { - var cond, condPart, from, gt, idx, known, lt, stepPart, to, varPart, _ref2, _ref3; - if (!this.fromVar) { - this.compileVariables(o); - } - if (!o.index) { - return this.compileArray(o); - } - known = this.fromNum && this.toNum; - idx = del(o, 'index'); - varPart = "" + idx + " = " + this.fromC; - if (this.toC !== this.toVar) { - varPart += ", " + this.toC; - } - if (this.step !== this.stepVar) { - varPart += ", " + this.step; - } - _ref2 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref2[0], gt = _ref2[1]; - condPart = this.stepNum ? condPart = +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref3 = [+this.fromNum, +this.toNum], from = _ref3[0], to = _ref3[1], _ref3), condPart = from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = "" + this.fromVar + " <= " + this.toVar, condPart = "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar); - stepPart = this.stepVar ? "" + idx + " += " + this.stepVar : known ? from <= to ? "" + idx + "++" : "" + idx + "--" : "" + cond + " ? " + idx + "++ : " + idx + "--"; - return "" + varPart + "; " + condPart + "; " + stepPart; - }; - Range.prototype.compileArray = function(o) { - var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref2, _ref3, _results; - if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) { - range = (function() { - _results = []; - for (var _i = _ref2 = +this.fromNum, _ref3 = +this.toNum; _ref2 <= _ref3 ? _i <= _ref3 : _i >= _ref3; _ref2 <= _ref3 ? _i++ : _i--){ _results.push(_i); } - return _results; - }).apply(this); - if (this.exclusive) { - range.pop(); - } - return "[" + (range.join(', ')) + "]"; - } - idt = this.tab + TAB; - i = o.scope.freeVariable('i'); - result = o.scope.freeVariable('results'); - pre = "\n" + idt + result + " = [];"; - if (this.fromNum && this.toNum) { - o.index = i; - body = this.compileNode(o); - } else { - vars = ("" + i + " = " + this.fromC) + (this.toC !== this.toVar ? ", " + this.toC : ''); - cond = "" + this.fromVar + " <= " + this.toVar; - body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--"; - } - post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent; - hasArgs = function(node) { - return node != null ? node.contains(function(n) { - return n instanceof Literal && n.value === 'arguments' && !n.asKey; - }) : void 0; - }; - if (hasArgs(this.from) || hasArgs(this.to)) { - args = ', arguments'; - } - return "(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this" + (args != null ? args : '') + ")"; - }; - return Range; - })(); - exports.Slice = Slice = (function() { - __extends(Slice, Base); - Slice.prototype.children = ['range']; - function Slice(range) { - this.range = range; - Slice.__super__.constructor.call(this); - } - Slice.prototype.compileNode = function(o) { - var compiled, from, fromStr, to, toStr, _ref2; - _ref2 = this.range, to = _ref2.to, from = _ref2.from; - fromStr = from && from.compile(o, LEVEL_PAREN) || '0'; - compiled = to && to.compile(o, LEVEL_PAREN); - if (to && !(!this.range.exclusive && +compiled === -1)) { - toStr = ', ' + (this.range.exclusive ? compiled : SIMPLENUM.test(compiled) ? (+compiled + 1).toString() : "(" + compiled + " + 1) || 9e9"); - } - return ".slice(" + fromStr + (toStr || '') + ")"; - }; - return Slice; - })(); - exports.Obj = Obj = (function() { - __extends(Obj, Base); - function Obj(props, generated) { - this.generated = generated != null ? generated : false; - this.objects = this.properties = props || []; - } - Obj.prototype.children = ['properties']; - Obj.prototype.compileNode = function(o) { - var i, idt, indent, join, lastNoncom, node, obj, prop, props, _i, _len; - props = this.properties; - if (!props.length) { - if (this.front) { - return '({})'; - } else { - return '{}'; - } - } - if (this.generated) { - for (_i = 0, _len = props.length; _i < _len; _i++) { - node = props[_i]; - if (node instanceof Value) { - throw new Error('cannot have an implicit value in an implicit object'); - } - } - } - idt = o.indent += TAB; - lastNoncom = this.lastNonComment(this.properties); - props = (function() { - var _len2, _results; - _results = []; - for (i = 0, _len2 = props.length; i < _len2; i++) { - prop = props[i]; - join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n'; - indent = prop instanceof Comment ? '' : idt; - if (prop instanceof Value && prop["this"]) { - prop = new Assign(prop.properties[0].name, prop, 'object'); - } - if (!(prop instanceof Comment)) { - if (!(prop instanceof Assign)) { - prop = new Assign(prop, prop, 'object'); - } - (prop.variable.base || prop.variable).asKey = true; - } - _results.push(indent + prop.compile(o, LEVEL_TOP) + join); - } - return _results; - })(); - props = props.join(''); - obj = "{" + (props && '\n' + props + '\n' + this.tab) + "}"; - if (this.front) { - return "(" + obj + ")"; - } else { - return obj; - } - }; - Obj.prototype.assigns = function(name) { - var prop, _i, _len, _ref2; - _ref2 = this.properties; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - prop = _ref2[_i]; - if (prop.assigns(name)) { - return true; - } - } - return false; - }; - return Obj; - })(); - exports.Arr = Arr = (function() { - __extends(Arr, Base); - function Arr(objs) { - this.objects = objs || []; - } - Arr.prototype.children = ['objects']; - Arr.prototype.filterImplicitObjects = Call.prototype.filterImplicitObjects; - Arr.prototype.compileNode = function(o) { - var code, obj, objs; - if (!this.objects.length) { - return '[]'; - } - o.indent += TAB; - objs = this.filterImplicitObjects(this.objects); - if (code = Splat.compileSplattedArray(o, objs)) { - return code; - } - code = ((function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = objs.length; _i < _len; _i++) { - obj = objs[_i]; - _results.push(obj.compile(o, LEVEL_LIST)); - } - return _results; - })()).join(', '); - if (code.indexOf('\n') >= 0) { - return "[\n" + o.indent + code + "\n" + this.tab + "]"; - } else { - return "[" + code + "]"; - } - }; - Arr.prototype.assigns = function(name) { - var obj, _i, _len, _ref2; - _ref2 = this.objects; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - obj = _ref2[_i]; - if (obj.assigns(name)) { - return true; - } - } - return false; - }; - return Arr; - })(); - exports.Class = Class = (function() { - __extends(Class, Base); - function Class(variable, parent, body) { - this.variable = variable; - this.parent = parent; - this.body = body != null ? body : new Block; - this.boundFuncs = []; - this.body.classBody = true; - } - Class.prototype.children = ['variable', 'parent', 'body']; - Class.prototype.determineName = function() { - var decl, tail; - if (!this.variable) { - return null; - } - decl = (tail = last(this.variable.properties)) ? tail instanceof Access && tail.name.value : this.variable.base.value; - return decl && (decl = IDENTIFIER.test(decl) && decl); - }; - Class.prototype.setContext = function(name) { - return this.body.traverseChildren(false, function(node) { - if (node.classBody) { - return false; - } - if (node instanceof Literal && node.value === 'this') { - return node.value = name; - } else if (node instanceof Code) { - node.klass = name; - if (node.bound) { - return node.context = name; - } - } - }); - }; - Class.prototype.addBoundFunctions = function(o) { - var bvar, lhs, _i, _len, _ref2, _results; - if (this.boundFuncs.length) { - _ref2 = this.boundFuncs; - _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - bvar = _ref2[_i]; - lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o); - _results.push(this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)"))); - } - return _results; - } - }; - Class.prototype.addProperties = function(node, name, o) { - var assign, base, exprs, func, props; - props = node.base.properties.slice(0); - exprs = (function() { - var _results; - _results = []; - while (assign = props.shift()) { - if (assign instanceof Assign) { - base = assign.variable.base; - delete assign.context; - func = assign.value; - if (base.value === 'constructor') { - if (this.ctor) { - throw new Error('cannot define more than one constructor in a class'); - } - if (func.bound) { - throw new Error('cannot define a constructor as a bound function'); - } - if (func instanceof Code) { - assign = this.ctor = func; - } else { - this.externalCtor = o.scope.freeVariable('class'); - assign = new Assign(new Literal(this.externalCtor), func); - } - } else { - if (!assign.variable["this"]) { - assign.variable = new Value(new Literal(name), [new Access(base, 'proto')]); - } - if (func instanceof Code && func.bound) { - this.boundFuncs.push(base); - func.bound = false; - } - } - } - _results.push(assign); - } - return _results; - }).call(this); - return compact(exprs); - }; - Class.prototype.walkBody = function(name, o) { - return this.traverseChildren(false, __bind(function(child) { - var exps, i, node, _len, _ref2; - if (child instanceof Class) { - return false; - } - if (child instanceof Block) { - _ref2 = exps = child.expressions; - for (i = 0, _len = _ref2.length; i < _len; i++) { - node = _ref2[i]; - if (node instanceof Value && node.isObject(true)) { - exps[i] = this.addProperties(node, name, o); - } - } - return child.expressions = exps = flatten(exps); - } - }, this)); - }; - Class.prototype.ensureConstructor = function(name) { - if (!this.ctor) { - this.ctor = new Code; - if (this.parent) { - this.ctor.body.push(new Literal("" + name + ".__super__.constructor.apply(this, arguments)")); - } - if (this.externalCtor) { - this.ctor.body.push(new Literal("" + this.externalCtor + ".apply(this, arguments)")); - } - this.body.expressions.unshift(this.ctor); - } - this.ctor.ctor = this.ctor.name = name; - this.ctor.klass = null; - return this.ctor.noReturn = true; - }; - Class.prototype.compileNode = function(o) { - var decl, klass, lname, name; - decl = this.determineName(); - name = decl || this.name || '_Class'; - lname = new Literal(name); - this.setContext(name); - this.walkBody(name, o); - this.ensureConstructor(name); - if (this.parent) { - this.body.expressions.unshift(new Extends(lname, this.parent)); - } - if (!(this.ctor instanceof Code)) { - this.body.expressions.unshift(this.ctor); - } - this.body.expressions.push(lname); - this.addBoundFunctions(o); - klass = new Parens(Closure.wrap(this.body), true); - if (this.variable) { - klass = new Assign(this.variable, klass); - } - return klass.compile(o); - }; - return Class; - })(); - exports.Assign = Assign = (function() { - __extends(Assign, Base); - function Assign(variable, value, context, options) { - this.variable = variable; - this.value = value; - this.context = context; - this.param = options && options.param; - } - Assign.prototype.children = ['variable', 'value']; - Assign.prototype.isStatement = function(o) { - return (o != null ? o.level : void 0) === LEVEL_TOP && (this.context != null) && __indexOf.call(this.context, "?") >= 0; - }; - Assign.prototype.assigns = function(name) { - return this[this.context === 'object' ? 'value' : 'variable'].assigns(name); - }; - Assign.prototype.unfoldSoak = function(o) { - return unfoldSoak(o, this, 'variable'); - }; - Assign.prototype.compileNode = function(o) { - var isValue, match, name, val, _ref2, _ref3, _ref4, _ref5; - if (isValue = this.variable instanceof Value) { - if (this.variable.isArray() || this.variable.isObject()) { - return this.compilePatternMatch(o); - } - if (this.variable.isSplice()) { - return this.compileSplice(o); - } - if ((_ref2 = this.context) === '||=' || _ref2 === '&&=' || _ref2 === '?=') { - return this.compileConditional(o); - } - } - name = this.variable.compile(o, LEVEL_LIST); - if (!(this.context || this.variable.isAssignable())) { - throw SyntaxError("\"" + (this.variable.compile(o)) + "\" cannot be assigned."); - } - if (!(this.context || isValue && (this.variable.namespaced || this.variable.hasProperties()))) { - if (this.param) { - o.scope.add(name, 'var'); - } else { - o.scope.find(name); - } - } - if (this.value instanceof Code && (match = METHOD_DEF.exec(name))) { - if (match[1]) { - this.value.klass = match[1]; - } - this.value.name = (_ref3 = (_ref4 = (_ref5 = match[2]) != null ? _ref5 : match[3]) != null ? _ref4 : match[4]) != null ? _ref3 : match[5]; - } - val = this.value.compile(o, LEVEL_LIST); - if (this.context === 'object') { - return "" + name + ": " + val; - } - val = name + (" " + (this.context || '=') + " ") + val; - if (o.level <= LEVEL_LIST) { - return val; - } else { - return "(" + val + ")"; - } - }; - Assign.prototype.compilePatternMatch = function(o) { - var acc, assigns, code, i, idx, isObject, ivar, obj, objects, olen, ref, rest, splat, top, val, value, vvar, _len, _ref2, _ref3, _ref4, _ref5; - top = o.level === LEVEL_TOP; - value = this.value; - objects = this.variable.base.objects; - if (!(olen = objects.length)) { - code = value.compile(o); - if (o.level >= LEVEL_OP) { - return "(" + code + ")"; - } else { - return code; - } - } - isObject = this.variable.isObject(); - if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) { - if (obj instanceof Assign) { - _ref2 = obj, idx = _ref2.variable.base, obj = _ref2.value; - } else { - if (obj.base instanceof Parens) { - _ref3 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref3[0], idx = _ref3[1]; - } else { - idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0); - } - } - acc = IDENTIFIER.test(idx.unwrap().value || 0); - value = new Value(value); - value.properties.push(new (acc ? Access : Index)(idx)); - return new Assign(obj, value, null, { - param: this.param - }).compile(o, LEVEL_TOP); - } - vvar = value.compile(o, LEVEL_LIST); - assigns = []; - splat = false; - if (!IDENTIFIER.test(vvar) || this.variable.assigns(vvar)) { - assigns.push("" + (ref = o.scope.freeVariable('ref')) + " = " + vvar); - vvar = ref; - } - for (i = 0, _len = objects.length; i < _len; i++) { - obj = objects[i]; - idx = i; - if (isObject) { - if (obj instanceof Assign) { - _ref4 = obj, idx = _ref4.variable.base, obj = _ref4.value; - } else { - if (obj.base instanceof Parens) { - _ref5 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref5[0], idx = _ref5[1]; - } else { - idx = obj["this"] ? obj.properties[0].name : obj; - } - } - } - if (!splat && obj instanceof Splat) { - val = "" + olen + " <= " + vvar + ".length ? " + (utility('slice')) + ".call(" + vvar + ", " + i; - if (rest = olen - i - 1) { - ivar = o.scope.freeVariable('i'); - val += ", " + ivar + " = " + vvar + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])"; - } else { - val += ") : []"; - } - val = new Literal(val); - splat = "" + ivar + "++"; - } else { - if (obj instanceof Splat) { - obj = obj.name.compile(o); - throw SyntaxError("multiple splats are disallowed in an assignment: " + obj + " ..."); - } - if (typeof idx === 'number') { - idx = new Literal(splat || idx); - acc = false; - } else { - acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0); - } - val = new Value(new Literal(vvar), [new (acc ? Access : Index)(idx)]); - } - assigns.push(new Assign(obj, val, null, { - param: this.param - }).compile(o, LEVEL_TOP)); - } - if (!top) { - assigns.push(vvar); - } - code = assigns.join(', '); - if (o.level < LEVEL_LIST) { - return code; - } else { - return "(" + code + ")"; - } - }; - Assign.prototype.compileConditional = function(o) { - var left, rite, _ref2; - _ref2 = this.variable.cacheReference(o), left = _ref2[0], rite = _ref2[1]; - if (__indexOf.call(this.context, "?") >= 0) { - o.isExistentialEquals = true; - } - return new Op(this.context.slice(0, -1), left, new Assign(rite, this.value, '=')).compile(o); - }; - Assign.prototype.compileSplice = function(o) { - var code, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref2, _ref3, _ref4; - _ref2 = this.variable.properties.pop().range, from = _ref2.from, to = _ref2.to, exclusive = _ref2.exclusive; - name = this.variable.compile(o); - _ref3 = (from != null ? from.cache(o, LEVEL_OP) : void 0) || ['0', '0'], fromDecl = _ref3[0], fromRef = _ref3[1]; - if (to) { - if ((from != null ? from.isSimpleNumber() : void 0) && to.isSimpleNumber()) { - to = +to.compile(o) - +fromRef; - if (!exclusive) { - to += 1; - } - } else { - to = to.compile(o) + ' - ' + fromRef; - if (!exclusive) { - to += ' + 1'; - } - } - } else { - to = "9e9"; - } - _ref4 = this.value.cache(o, LEVEL_LIST), valDef = _ref4[0], valRef = _ref4[1]; - code = "[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat(" + valDef + ")), " + valRef; - if (o.level > LEVEL_TOP) { - return "(" + code + ")"; - } else { - return code; - } - }; - return Assign; - })(); - exports.Code = Code = (function() { - __extends(Code, Base); - function Code(params, body, tag) { - this.params = params || []; - this.body = body || new Block; - this.bound = tag === 'boundfunc'; - if (this.bound) { - this.context = 'this'; - } - } - Code.prototype.children = ['params', 'body']; - Code.prototype.isStatement = function() { - return !!this.ctor; - }; - Code.prototype.jumps = NO; - Code.prototype.compileNode = function(o) { - var code, exprs, i, idt, lit, p, param, ref, splats, v, val, vars, wasEmpty, _i, _j, _k, _len, _len2, _len3, _len4, _ref2, _ref3, _ref4, _ref5; - o.scope = new Scope(o.scope, this.body, this); - o.scope.shared = del(o, 'sharedScope'); - o.indent += TAB; - delete o.bare; - vars = []; - exprs = []; - _ref2 = this.params; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - param = _ref2[_i]; - if (param.splat) { - _ref3 = this.params; - for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { - p = _ref3[_j]; - if (p.name.value) { - o.scope.add(p.name.value, 'var', true); - } - } - splats = new Assign(new Value(new Arr((function() { - var _k, _len3, _ref4, _results; - _ref4 = this.params; - _results = []; - for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) { - p = _ref4[_k]; - _results.push(p.asReference(o)); - } - return _results; - }).call(this))), new Value(new Literal('arguments'))); - break; - } - } - _ref4 = this.params; - for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) { - param = _ref4[_k]; - if (param.isComplex()) { - val = ref = param.asReference(o); - if (param.value) { - val = new Op('?', ref, param.value); - } - exprs.push(new Assign(new Value(param.name), val, '=', { - param: true - })); - } else { - ref = param; - if (param.value) { - lit = new Literal(ref.name.value + ' == null'); - val = new Assign(new Value(param.name), param.value, '='); - exprs.push(new If(lit, val)); - } - } - if (!splats) { - vars.push(ref); - } - } - wasEmpty = this.body.isEmpty(); - if (splats) { - exprs.unshift(splats); - } - if (exprs.length) { - (_ref5 = this.body.expressions).unshift.apply(_ref5, exprs); - } - if (!splats) { - for (i = 0, _len4 = vars.length; i < _len4; i++) { - v = vars[i]; - o.scope.parameter(vars[i] = v.compile(o)); - } - } - if (!(wasEmpty || this.noReturn)) { - this.body.makeReturn(); - } - idt = o.indent; - code = 'function'; - if (this.ctor) { - code += ' ' + this.name; - } - code += '(' + vars.join(', ') + ') {'; - if (!this.body.isEmpty()) { - code += "\n" + (this.body.compileWithDeclarations(o)) + "\n" + this.tab; - } - code += '}'; - if (this.ctor) { - return this.tab + code; - } - if (this.bound) { - return utility('bind') + ("(" + code + ", " + this.context + ")"); - } - if (this.front || (o.level >= LEVEL_ACCESS)) { - return "(" + code + ")"; - } else { - return code; - } - }; - Code.prototype.traverseChildren = function(crossScope, func) { - if (crossScope) { - return Code.__super__.traverseChildren.call(this, crossScope, func); - } - }; - return Code; - })(); - exports.Param = Param = (function() { - __extends(Param, Base); - function Param(name, value, splat) { - this.name = name; - this.value = value; - this.splat = splat; - } - Param.prototype.children = ['name', 'value']; - Param.prototype.compile = function(o) { - return this.name.compile(o, LEVEL_LIST); - }; - Param.prototype.asReference = function(o) { - var node; - if (this.reference) { - return this.reference; - } - node = this.name; - if (node["this"]) { - node = node.properties[0].name; - if (node.value.reserved) { - node = new Literal('_' + node.value); - } - } else if (node.isComplex()) { - node = new Literal(o.scope.freeVariable('arg')); - } - node = new Value(node); - if (this.splat) { - node = new Splat(node); - } - return this.reference = node; - }; - Param.prototype.isComplex = function() { - return this.name.isComplex(); - }; - return Param; - })(); - exports.Splat = Splat = (function() { - __extends(Splat, Base); - Splat.prototype.children = ['name']; - Splat.prototype.isAssignable = YES; - function Splat(name) { - this.name = name.compile ? name : new Literal(name); - } - Splat.prototype.assigns = function(name) { - return this.name.assigns(name); - }; - Splat.prototype.compile = function(o) { - if (this.index != null) { - return this.compileParam(o); - } else { - return this.name.compile(o); - } - }; - Splat.compileSplattedArray = function(o, list, apply) { - var args, base, code, i, index, node, _len; - index = -1; - while ((node = list[++index]) && !(node instanceof Splat)) { - continue; - } - if (index >= list.length) { - return ''; - } - if (list.length === 1) { - code = list[0].compile(o, LEVEL_LIST); - if (apply) { - return code; - } - return "" + (utility('slice')) + ".call(" + code + ")"; - } - args = list.slice(index); - for (i = 0, _len = args.length; i < _len; i++) { - node = args[i]; - code = node.compile(o, LEVEL_LIST); - args[i] = node instanceof Splat ? "" + (utility('slice')) + ".call(" + code + ")" : "[" + code + "]"; - } - if (index === 0) { - return args[0] + (".concat(" + (args.slice(1).join(', ')) + ")"); - } - base = (function() { - var _i, _len2, _ref2, _results; - _ref2 = list.slice(0, index); - _results = []; - for (_i = 0, _len2 = _ref2.length; _i < _len2; _i++) { - node = _ref2[_i]; - _results.push(node.compile(o, LEVEL_LIST)); - } - return _results; - })(); - return "[" + (base.join(', ')) + "].concat(" + (args.join(', ')) + ")"; - }; - return Splat; - })(); - exports.While = While = (function() { - __extends(While, Base); - function While(condition, options) { - this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition; - this.guard = options != null ? options.guard : void 0; - } - While.prototype.children = ['condition', 'guard', 'body']; - While.prototype.isStatement = YES; - While.prototype.makeReturn = function() { - this.returns = true; - return this; - }; - While.prototype.addBody = function(body) { - this.body = body; - return this; - }; - While.prototype.jumps = function() { - var expressions, node, _i, _len; - expressions = this.body.expressions; - if (!expressions.length) { - return false; - } - for (_i = 0, _len = expressions.length; _i < _len; _i++) { - node = expressions[_i]; - if (node.jumps({ - loop: true - })) { - return node; - } - } - return false; - }; - While.prototype.compileNode = function(o) { - var body, code, rvar, set; - o.indent += TAB; - set = ''; - body = this.body; - if (body.isEmpty()) { - body = ''; - } else { - if (o.level > LEVEL_TOP || this.returns) { - rvar = o.scope.freeVariable('results'); - set = "" + this.tab + rvar + " = [];\n"; - if (body) { - body = Push.wrap(rvar, body); - } - } - if (this.guard) { - body = Block.wrap([new If(this.guard, body)]); - } - body = "\n" + (body.compile(o, LEVEL_TOP)) + "\n" + this.tab; - } - code = set + this.tab + ("while (" + (this.condition.compile(o, LEVEL_PAREN)) + ") {" + body + "}"); - if (this.returns) { - code += "\n" + this.tab + "return " + rvar + ";"; - } - return code; - }; - return While; - })(); - exports.Op = Op = (function() { - var CONVERSIONS, INVERSIONS; - __extends(Op, Base); - function Op(op, first, second, flip) { - var call; - if (op === 'in') { - return new In(first, second); - } - if (op === 'do') { - call = new Call(first, first.params || []); - call["do"] = true; - return call; - } - if (op === 'new') { - if (first instanceof Call && !first["do"] && !first.isNew) { - return first.newInstance(); - } - if (first instanceof Code && first.bound || first["do"]) { - first = new Parens(first); - } - } - this.operator = CONVERSIONS[op] || op; - this.first = first; - this.second = second; - this.flip = !!flip; - return this; - } - CONVERSIONS = { - '==': '===', - '!=': '!==', - 'of': 'in' - }; - INVERSIONS = { - '!==': '===', - '===': '!==' - }; - Op.prototype.children = ['first', 'second']; - Op.prototype.isSimpleNumber = NO; - Op.prototype.isUnary = function() { - return !this.second; - }; - Op.prototype.isComplex = function() { - var _ref2; - return !(this.isUnary() && ((_ref2 = this.operator) === '+' || _ref2 === '-')) || this.first.isComplex(); - }; - Op.prototype.isChainable = function() { - var _ref2; - return (_ref2 = this.operator) === '<' || _ref2 === '>' || _ref2 === '>=' || _ref2 === '<=' || _ref2 === '===' || _ref2 === '!=='; - }; - Op.prototype.invert = function() { - var allInvertable, curr, fst, op, _ref2; - if (this.isChainable() && this.first.isChainable()) { - allInvertable = true; - curr = this; - while (curr && curr.operator) { - allInvertable && (allInvertable = curr.operator in INVERSIONS); - curr = curr.first; - } - if (!allInvertable) { - return new Parens(this).invert(); - } - curr = this; - while (curr && curr.operator) { - curr.invert = !curr.invert; - curr.operator = INVERSIONS[curr.operator]; - curr = curr.first; - } - return this; - } else if (op = INVERSIONS[this.operator]) { - this.operator = op; - if (this.first.unwrap() instanceof Op) { - this.first.invert(); - } - return this; - } else if (this.second) { - return new Parens(this).invert(); - } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref2 = fst.operator) === '!' || _ref2 === 'in' || _ref2 === 'instanceof')) { - return fst; - } else { - return new Op('!', this); - } - }; - Op.prototype.unfoldSoak = function(o) { - var _ref2; - return ((_ref2 = this.operator) === '++' || _ref2 === '--' || _ref2 === 'delete') && unfoldSoak(o, this, 'first'); - }; - Op.prototype.compileNode = function(o) { - var code; - if (this.isUnary()) { - return this.compileUnary(o); - } - if (this.isChainable() && this.first.isChainable()) { - return this.compileChain(o); - } - if (this.operator === '?') { - return this.compileExistence(o); - } - this.first.front = this.front; - code = this.first.compile(o, LEVEL_OP) + ' ' + this.operator + ' ' + this.second.compile(o, LEVEL_OP); - if (o.level <= LEVEL_OP) { - return code; - } else { - return "(" + code + ")"; - } - }; - Op.prototype.compileChain = function(o) { - var code, fst, shared, _ref2; - _ref2 = this.first.second.cache(o), this.first.second = _ref2[0], shared = _ref2[1]; - fst = this.first.compile(o, LEVEL_OP); - code = "" + fst + " " + (this.invert ? '&&' : '||') + " " + (shared.compile(o)) + " " + this.operator + " " + (this.second.compile(o, LEVEL_OP)); - return "(" + code + ")"; - }; - Op.prototype.compileExistence = function(o) { - var fst, ref; - if (this.first.isComplex()) { - ref = new Literal(o.scope.freeVariable('ref')); - fst = new Parens(new Assign(ref, this.first)); - } else { - fst = this.first; - ref = fst; - } - return new If(new Existence(fst), ref, { - type: 'if' - }).addElse(this.second).compile(o); - }; - Op.prototype.compileUnary = function(o) { - var op, parts; - parts = [op = this.operator]; - if ((op === 'new' || op === 'typeof' || op === 'delete') || (op === '+' || op === '-') && this.first instanceof Op && this.first.operator === op) { - parts.push(' '); - } - if (op === 'new' && this.first.isStatement(o)) { - this.first = new Parens(this.first); - } - parts.push(this.first.compile(o, LEVEL_OP)); - if (this.flip) { - parts.reverse(); - } - return parts.join(''); - }; - Op.prototype.toString = function(idt) { - return Op.__super__.toString.call(this, idt, this.constructor.name + ' ' + this.operator); - }; - return Op; - })(); - exports.In = In = (function() { - __extends(In, Base); - function In(object, array) { - this.object = object; - this.array = array; - } - In.prototype.children = ['object', 'array']; - In.prototype.invert = NEGATE; - In.prototype.compileNode = function(o) { - var hasSplat, obj, _i, _len, _ref2; - if (this.array instanceof Value && this.array.isArray()) { - _ref2 = this.array.base.objects; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - obj = _ref2[_i]; - if (obj instanceof Splat) { - hasSplat = true; - break; - } - } - if (!hasSplat) { - return this.compileOrTest(o); - } - } - return this.compileLoopTest(o); - }; - In.prototype.compileOrTest = function(o) { - var cmp, cnj, i, item, ref, sub, tests, _ref2, _ref3; - _ref2 = this.object.cache(o, LEVEL_OP), sub = _ref2[0], ref = _ref2[1]; - _ref3 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref3[0], cnj = _ref3[1]; - tests = (function() { - var _len, _ref4, _results; - _ref4 = this.array.base.objects; - _results = []; - for (i = 0, _len = _ref4.length; i < _len; i++) { - item = _ref4[i]; - _results.push((i ? ref : sub) + cmp + item.compile(o, LEVEL_OP)); - } - return _results; - }).call(this); - if (tests.length === 0) { - return 'false'; - } - tests = tests.join(cnj); - if (o.level < LEVEL_OP) { - return tests; - } else { - return "(" + tests + ")"; - } - }; - In.prototype.compileLoopTest = function(o) { - var code, ref, sub, _ref2; - _ref2 = this.object.cache(o, LEVEL_LIST), sub = _ref2[0], ref = _ref2[1]; - code = utility('indexOf') + (".call(" + (this.array.compile(o, LEVEL_LIST)) + ", " + ref + ") ") + (this.negated ? '< 0' : '>= 0'); - if (sub === ref) { - return code; - } - code = sub + ', ' + code; - if (o.level < LEVEL_LIST) { - return code; - } else { - return "(" + code + ")"; - } - }; - In.prototype.toString = function(idt) { - return In.__super__.toString.call(this, idt, this.constructor.name + (this.negated ? '!' : '')); - }; - return In; - })(); - exports.Try = Try = (function() { - __extends(Try, Base); - function Try(attempt, error, recovery, ensure) { - this.attempt = attempt; - this.error = error; - this.recovery = recovery; - this.ensure = ensure; - } - Try.prototype.children = ['attempt', 'recovery', 'ensure']; - Try.prototype.isStatement = YES; - Try.prototype.jumps = function(o) { - var _ref2; - return this.attempt.jumps(o) || ((_ref2 = this.recovery) != null ? _ref2.jumps(o) : void 0); - }; - Try.prototype.makeReturn = function() { - if (this.attempt) { - this.attempt = this.attempt.makeReturn(); - } - if (this.recovery) { - this.recovery = this.recovery.makeReturn(); - } - return this; - }; - Try.prototype.compileNode = function(o) { - var catchPart, errorPart; - o.indent += TAB; - errorPart = this.error ? " (" + (this.error.compile(o)) + ") " : ' '; - catchPart = this.recovery ? (o.scope.add(this.error.value, 'param'), " catch" + errorPart + "{\n" + (this.recovery.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}") : !(this.ensure || this.recovery) ? ' catch (_e) {}' : void 0; - return ("" + this.tab + "try {\n" + (this.attempt.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}" + (catchPart || '')) + (this.ensure ? " finally {\n" + (this.ensure.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}" : ''); - }; - return Try; - })(); - exports.Throw = Throw = (function() { - __extends(Throw, Base); - function Throw(expression) { - this.expression = expression; - } - Throw.prototype.children = ['expression']; - Throw.prototype.isStatement = YES; - Throw.prototype.jumps = NO; - Throw.prototype.makeReturn = THIS; - Throw.prototype.compileNode = function(o) { - return this.tab + ("throw " + (this.expression.compile(o)) + ";"); - }; - return Throw; - })(); - exports.Existence = Existence = (function() { - __extends(Existence, Base); - function Existence(expression) { - this.expression = expression; - } - Existence.prototype.children = ['expression']; - Existence.prototype.invert = NEGATE; - Existence.prototype.compileNode = function(o) { - var cmp, cnj, code, _ref2; - code = this.expression.compile(o, LEVEL_OP); - code = IDENTIFIER.test(code) && !o.scope.check(code) ? ((_ref2 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref2[0], cnj = _ref2[1], _ref2), "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null") : "" + code + " " + (this.negated ? '==' : '!=') + " null"; - if (o.level <= LEVEL_COND) { - return code; - } else { - return "(" + code + ")"; - } - }; - return Existence; - })(); - exports.Parens = Parens = (function() { - __extends(Parens, Base); - function Parens(body) { - this.body = body; - } - Parens.prototype.children = ['body']; - Parens.prototype.unwrap = function() { - return this.body; - }; - Parens.prototype.isComplex = function() { - return this.body.isComplex(); - }; - Parens.prototype.makeReturn = function() { - return this.body.makeReturn(); - }; - Parens.prototype.compileNode = function(o) { - var bare, code, expr; - expr = this.body.unwrap(); - if (expr instanceof Value && expr.isAtomic()) { - expr.front = this.front; - return expr.compile(o); - } - code = expr.compile(o, LEVEL_PAREN); - bare = o.level < LEVEL_OP && (expr instanceof Op || expr instanceof Call || (expr instanceof For && expr.returns)); - if (bare) { - return code; - } else { - return "(" + code + ")"; - } - }; - return Parens; - })(); - exports.For = For = (function() { - __extends(For, Base); - function For(body, source) { - var _ref2; - this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index; - this.body = Block.wrap([body]); - this.own = !!source.own; - this.object = !!source.object; - if (this.object) { - _ref2 = [this.index, this.name], this.name = _ref2[0], this.index = _ref2[1]; - } - if (this.index instanceof Value) { - throw SyntaxError('index cannot be a pattern matching expression'); - } - this.range = this.source instanceof Value && this.source.base instanceof Range && !this.source.properties.length; - this.pattern = this.name instanceof Value; - if (this.range && this.index) { - throw SyntaxError('indexes do not apply to range loops'); - } - if (this.range && this.pattern) { - throw SyntaxError('cannot pattern match over range loops'); - } - this.returns = false; - } - For.prototype.children = ['body', 'source', 'guard', 'step']; - For.prototype.isStatement = YES; - For.prototype.jumps = While.prototype.jumps; - For.prototype.makeReturn = function() { - this.returns = true; - return this; - }; - For.prototype.compileNode = function(o) { - var body, defPart, forPart, forVarPart, guardPart, idt1, index, ivar, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, stepPart, stepvar, svar, varPart, _ref2; - body = Block.wrap([this.body]); - lastJumps = (_ref2 = last(body.expressions)) != null ? _ref2.jumps() : void 0; - if (lastJumps && lastJumps instanceof Return) { - this.returns = false; - } - source = this.range ? this.source.base : this.source; - scope = o.scope; - name = this.name && this.name.compile(o, LEVEL_LIST); - index = this.index && this.index.compile(o, LEVEL_LIST); - if (name && !this.pattern) { - scope.find(name, { - immediate: true - }); - } - if (index) { - scope.find(index, { - immediate: true - }); - } - if (this.returns) { - rvar = scope.freeVariable('results'); - } - ivar = (this.range ? name : index) || scope.freeVariable('i'); - if (this.step && !this.range) { - stepvar = scope.freeVariable("step"); - } - if (this.pattern) { - name = ivar; - } - varPart = ''; - guardPart = ''; - defPart = ''; - idt1 = this.tab + TAB; - if (this.range) { - forPart = source.compile(merge(o, { - index: ivar, - step: this.step - })); - } else { - svar = this.source.compile(o, LEVEL_LIST); - if ((name || this.own) && !IDENTIFIER.test(svar)) { - defPart = "" + this.tab + (ref = scope.freeVariable('ref')) + " = " + svar + ";\n"; - svar = ref; - } - if (name && !this.pattern) { - namePart = "" + name + " = " + svar + "[" + ivar + "]"; - } - if (!this.object) { - lvar = scope.freeVariable('len'); - forVarPart = ("" + ivar + " = 0, " + lvar + " = " + svar + ".length") + (this.step ? ", " + stepvar + " = " + (this.step.compile(o, LEVEL_OP)) : ''); - stepPart = this.step ? "" + ivar + " += " + stepvar : "" + ivar + "++"; - forPart = "" + forVarPart + "; " + ivar + " < " + lvar + "; " + stepPart; - } - } - if (this.returns) { - resultPart = "" + this.tab + rvar + " = [];\n"; - returnResult = "\n" + this.tab + "return " + rvar + ";"; - body = Push.wrap(rvar, body); - } - if (this.guard) { - body = Block.wrap([new If(this.guard, body)]); - } - if (this.pattern) { - body.expressions.unshift(new Assign(this.name, new Literal("" + svar + "[" + ivar + "]"))); - } - defPart += this.pluckDirectCall(o, body); - if (namePart) { - varPart = "\n" + idt1 + namePart + ";"; - } - if (this.object) { - forPart = "" + ivar + " in " + svar; - if (this.own) { - guardPart = "\n" + idt1 + "if (!" + (utility('hasProp')) + ".call(" + svar + ", " + ivar + ")) continue;"; - } - } - body = body.compile(merge(o, { - indent: idt1 - }), LEVEL_TOP); - if (body) { - body = '\n' + body + '\n'; - } - return "" + defPart + (resultPart || '') + this.tab + "for (" + forPart + ") {" + guardPart + varPart + body + this.tab + "}" + (returnResult || ''); - }; - For.prototype.pluckDirectCall = function(o, body) { - var base, defs, expr, fn, idx, ref, val, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; - defs = ''; - _ref2 = body.expressions; - for (idx = 0, _len = _ref2.length; idx < _len; idx++) { - expr = _ref2[idx]; - expr = expr.unwrapAll(); - if (!(expr instanceof Call)) { - continue; - } - val = expr.variable.unwrapAll(); - if (!((val instanceof Code) || (val instanceof Value && ((_ref3 = val.base) != null ? _ref3.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref4 = (_ref5 = val.properties[0].name) != null ? _ref5.value : void 0) === 'call' || _ref4 === 'apply')))) { - continue; - } - fn = ((_ref6 = val.base) != null ? _ref6.unwrapAll() : void 0) || val; - ref = new Literal(o.scope.freeVariable('fn')); - base = new Value(ref); - if (val.base) { - _ref7 = [base, val], val.base = _ref7[0], base = _ref7[1]; - } - body.expressions[idx] = new Call(base, expr.args); - defs += this.tab + new Assign(ref, fn).compile(o, LEVEL_TOP) + ';\n'; - } - return defs; - }; - return For; - })(); - exports.Switch = Switch = (function() { - __extends(Switch, Base); - function Switch(subject, cases, otherwise) { - this.subject = subject; - this.cases = cases; - this.otherwise = otherwise; - } - Switch.prototype.children = ['subject', 'cases', 'otherwise']; - Switch.prototype.isStatement = YES; - Switch.prototype.jumps = function(o) { - var block, conds, _i, _len, _ref2, _ref3, _ref4; - if (o == null) { - o = { - block: true - }; - } - _ref2 = this.cases; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - _ref3 = _ref2[_i], conds = _ref3[0], block = _ref3[1]; - if (block.jumps(o)) { - return block; - } - } - return (_ref4 = this.otherwise) != null ? _ref4.jumps(o) : void 0; - }; - Switch.prototype.makeReturn = function() { - var pair, _i, _len, _ref2, _ref3; - _ref2 = this.cases; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - pair = _ref2[_i]; - pair[1].makeReturn(); - } - if ((_ref3 = this.otherwise) != null) { - _ref3.makeReturn(); - } - return this; - }; - Switch.prototype.compileNode = function(o) { - var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _len, _len2, _ref2, _ref3, _ref4, _ref5; - idt1 = o.indent + TAB; - idt2 = o.indent = idt1 + TAB; - code = this.tab + ("switch (" + (((_ref2 = this.subject) != null ? _ref2.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n"); - _ref3 = this.cases; - for (i = 0, _len = _ref3.length; i < _len; i++) { - _ref4 = _ref3[i], conditions = _ref4[0], block = _ref4[1]; - _ref5 = flatten([conditions]); - for (_i = 0, _len2 = _ref5.length; _i < _len2; _i++) { - cond = _ref5[_i]; - if (!this.subject) { - cond = cond.invert(); - } - code += idt1 + ("case " + (cond.compile(o, LEVEL_PAREN)) + ":\n"); - } - if (body = block.compile(o, LEVEL_TOP)) { - code += body + '\n'; - } - if (i === this.cases.length - 1 && !this.otherwise) { - break; - } - expr = this.lastNonComment(block.expressions); - if (expr instanceof Return || (expr instanceof Literal && expr.jumps() && expr.value !== 'debugger')) { - continue; - } - code += idt2 + 'break;\n'; - } - if (this.otherwise && this.otherwise.expressions.length) { - code += idt1 + ("default:\n" + (this.otherwise.compile(o, LEVEL_TOP)) + "\n"); - } - return code + this.tab + '}'; - }; - return Switch; - })(); - exports.If = If = (function() { - __extends(If, Base); - function If(condition, body, options) { - this.body = body; - if (options == null) { - options = {}; - } - this.condition = options.type === 'unless' ? condition.invert() : condition; - this.elseBody = null; - this.isChain = false; - this.soak = options.soak; - } - If.prototype.children = ['condition', 'body', 'elseBody']; - If.prototype.bodyNode = function() { - var _ref2; - return (_ref2 = this.body) != null ? _ref2.unwrap() : void 0; - }; - If.prototype.elseBodyNode = function() { - var _ref2; - return (_ref2 = this.elseBody) != null ? _ref2.unwrap() : void 0; - }; - If.prototype.addElse = function(elseBody) { - if (this.isChain) { - this.elseBodyNode().addElse(elseBody); - } else { - this.isChain = elseBody instanceof If; - this.elseBody = this.ensureBlock(elseBody); - } - return this; - }; - If.prototype.isStatement = function(o) { - var _ref2; - return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref2 = this.elseBodyNode()) != null ? _ref2.isStatement(o) : void 0); - }; - If.prototype.jumps = function(o) { - var _ref2; - return this.body.jumps(o) || ((_ref2 = this.elseBody) != null ? _ref2.jumps(o) : void 0); - }; - If.prototype.compileNode = function(o) { - if (this.isStatement(o)) { - return this.compileStatement(o); - } else { - return this.compileExpression(o); - } - }; - If.prototype.makeReturn = function() { - this.body && (this.body = new Block([this.body.makeReturn()])); - this.elseBody && (this.elseBody = new Block([this.elseBody.makeReturn()])); - return this; - }; - If.prototype.ensureBlock = function(node) { - if (node instanceof Block) { - return node; - } else { - return new Block([node]); - } - }; - If.prototype.compileStatement = function(o) { - var body, child, cond, exeq, ifPart; - child = del(o, 'chainChild'); - exeq = del(o, 'isExistentialEquals'); - if (exeq) { - return new If(this.condition.invert(), this.elseBodyNode(), { - type: 'if' - }).compile(o); - } - cond = this.condition.compile(o, LEVEL_PAREN); - o.indent += TAB; - body = this.ensureBlock(this.body).compile(o); - if (body) { - body = "\n" + body + "\n" + this.tab; - } - ifPart = "if (" + cond + ") {" + body + "}"; - if (!child) { - ifPart = this.tab + ifPart; - } - if (!this.elseBody) { - return ifPart; - } - return ifPart + ' else ' + (this.isChain ? (o.indent = this.tab, o.chainChild = true, this.elseBody.unwrap().compile(o, LEVEL_TOP)) : "{\n" + (this.elseBody.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}"); - }; - If.prototype.compileExpression = function(o) { - var alt, body, code, cond; - cond = this.condition.compile(o, LEVEL_COND); - body = this.bodyNode().compile(o, LEVEL_LIST); - alt = this.elseBodyNode() ? this.elseBodyNode().compile(o, LEVEL_LIST) : 'void 0'; - code = "" + cond + " ? " + body + " : " + alt; - if (o.level >= LEVEL_COND) { - return "(" + code + ")"; - } else { - return code; - } - }; - If.prototype.unfoldSoak = function() { - return this.soak && this; - }; - return If; - })(); - Push = { - wrap: function(name, exps) { - if (exps.isEmpty() || last(exps.expressions).jumps()) { - return exps; - } - return exps.push(new Call(new Value(new Literal(name), [new Access(new Literal('push'))]), [exps.pop()])); - } - }; - Closure = { - wrap: function(expressions, statement, noReturn) { - var args, call, func, mentionsArgs, meth; - if (expressions.jumps()) { - return expressions; - } - func = new Code([], Block.wrap([expressions])); - args = []; - if ((mentionsArgs = expressions.contains(this.literalArgs)) || expressions.contains(this.literalThis)) { - meth = new Literal(mentionsArgs ? 'apply' : 'call'); - args = [new Literal('this')]; - if (mentionsArgs) { - args.push(new Literal('arguments')); - } - func = new Value(func, [new Access(meth)]); - } - func.noReturn = noReturn; - call = new Call(func, args); - if (statement) { - return Block.wrap([call]); - } else { - return call; - } - }, - literalArgs: function(node) { - return node instanceof Literal && node.value === 'arguments' && !node.asKey; - }, - literalThis: function(node) { - return (node instanceof Literal && node.value === 'this' && !node.asKey) || (node instanceof Code && node.bound); - } - }; - unfoldSoak = function(o, parent, name) { - var ifn; - if (!(ifn = parent[name].unfoldSoak(o))) { - return; - } - parent[name] = ifn.body; - ifn.body = new Value(parent); - return ifn; - }; - UTILITIES = { - "extends": 'function(child, parent) {\n for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor;\n child.__super__ = parent.prototype;\n return child;\n}', - bind: 'function(fn, me){ return function(){ return fn.apply(me, arguments); }; }', - indexOf: 'Array.prototype.indexOf || function(item) {\n for (var i = 0, l = this.length; i < l; i++) {\n if (this[i] === item) return i;\n }\n return -1;\n}', - hasProp: 'Object.prototype.hasOwnProperty', - slice: 'Array.prototype.slice' - }; - LEVEL_TOP = 1; - LEVEL_PAREN = 2; - LEVEL_LIST = 3; - LEVEL_COND = 4; - LEVEL_OP = 5; - LEVEL_ACCESS = 6; - TAB = ' '; - IDENTIFIER_STR = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*"; - IDENTIFIER = RegExp("^" + IDENTIFIER_STR + "$"); - SIMPLENUM = /^[+-]?\d+$/; - METHOD_DEF = RegExp("^(?:(" + IDENTIFIER_STR + ")\\.prototype(?:\\.(" + IDENTIFIER_STR + ")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\]))|(" + IDENTIFIER_STR + ")$"); - IS_STRING = /^['"]/; - utility = function(name) { - var ref; - ref = "__" + name; - Scope.root.assign(ref, UTILITIES[name]); - return ref; - }; - multident = function(code, tab) { - return code.replace(/\n/g, '$&' + tab); - }; -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/optparse.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/optparse.js deleted file mode 100755 index 13841e53..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/optparse.js +++ /dev/null @@ -1,111 +0,0 @@ -(function() { - var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments; - exports.OptionParser = OptionParser = (function() { - function OptionParser(rules, banner) { - this.banner = banner; - this.rules = buildRules(rules); - } - OptionParser.prototype.parse = function(args) { - var arg, i, isOption, matchedRule, options, rule, value, _i, _len, _len2, _ref; - options = { - arguments: [], - literals: [] - }; - args = normalizeArguments(args); - for (i = 0, _len = args.length; i < _len; i++) { - arg = args[i]; - if (arg === '--') { - options.literals = args.slice(i + 1); - break; - } - isOption = !!(arg.match(LONG_FLAG) || arg.match(SHORT_FLAG)); - matchedRule = false; - _ref = this.rules; - for (_i = 0, _len2 = _ref.length; _i < _len2; _i++) { - rule = _ref[_i]; - if (rule.shortFlag === arg || rule.longFlag === arg) { - value = rule.hasArgument ? args[i += 1] : true; - options[rule.name] = rule.isList ? (options[rule.name] || []).concat(value) : value; - matchedRule = true; - break; - } - } - if (isOption && !matchedRule) { - throw new Error("unrecognized option: " + arg); - } - if (!isOption) { - options.arguments = args.slice(i); - break; - } - } - return options; - }; - OptionParser.prototype.help = function() { - var letPart, lines, rule, spaces, _i, _len, _ref; - lines = []; - if (this.banner) { - lines.unshift("" + this.banner + "\n"); - } - _ref = this.rules; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - rule = _ref[_i]; - spaces = 15 - rule.longFlag.length; - spaces = spaces > 0 ? Array(spaces + 1).join(' ') : ''; - letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' '; - lines.push(' ' + letPart + rule.longFlag + spaces + rule.description); - } - return "\n" + (lines.join('\n')) + "\n"; - }; - return OptionParser; - })(); - LONG_FLAG = /^(--\w[\w\-]+)/; - SHORT_FLAG = /^(-\w)/; - MULTI_FLAG = /^-(\w{2,})/; - OPTIONAL = /\[(\w+(\*?))\]/; - buildRules = function(rules) { - var tuple, _i, _len, _results; - _results = []; - for (_i = 0, _len = rules.length; _i < _len; _i++) { - tuple = rules[_i]; - if (tuple.length < 3) { - tuple.unshift(null); - } - _results.push(buildRule.apply(null, tuple)); - } - return _results; - }; - buildRule = function(shortFlag, longFlag, description, options) { - var match; - if (options == null) { - options = {}; - } - match = longFlag.match(OPTIONAL); - longFlag = longFlag.match(LONG_FLAG)[1]; - return { - name: longFlag.substr(2), - shortFlag: shortFlag, - longFlag: longFlag, - description: description, - hasArgument: !!(match && match[1]), - isList: !!(match && match[2]) - }; - }; - normalizeArguments = function(args) { - var arg, l, match, result, _i, _j, _len, _len2, _ref; - args = args.slice(0); - result = []; - for (_i = 0, _len = args.length; _i < _len; _i++) { - arg = args[_i]; - if (match = arg.match(MULTI_FLAG)) { - _ref = match[1].split(''); - for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) { - l = _ref[_j]; - result.push('-' + l); - } - } else { - result.push(arg); - } - } - return result; - }; -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/parser.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/parser.js deleted file mode 100755 index 789e8caf..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/parser.js +++ /dev/null @@ -1,676 +0,0 @@ -/* Jison generated parser */ -var parser = (function(){ -var parser = {trace: function trace() { }, -yy: {}, -symbols_: {"error":2,"Root":3,"Body":4,"Block":5,"TERMINATOR":6,"Line":7,"Expression":8,"Statement":9,"Return":10,"Throw":11,"Comment":12,"STATEMENT":13,"Value":14,"Invocation":15,"Code":16,"Operation":17,"Assign":18,"If":19,"Try":20,"While":21,"For":22,"Switch":23,"Class":24,"INDENT":25,"OUTDENT":26,"Identifier":27,"IDENTIFIER":28,"AlphaNumeric":29,"NUMBER":30,"STRING":31,"Literal":32,"JS":33,"REGEX":34,"BOOL":35,"Assignable":36,"=":37,"AssignObj":38,"ObjAssignable":39,":":40,"ThisProperty":41,"RETURN":42,"HERECOMMENT":43,"PARAM_START":44,"ParamList":45,"PARAM_END":46,"FuncGlyph":47,"->":48,"=>":49,"OptComma":50,",":51,"Param":52,"ParamVar":53,"...":54,"Array":55,"Object":56,"Splat":57,"SimpleAssignable":58,"Accessor":59,"Parenthetical":60,"Range":61,"This":62,".":63,"?.":64,"::":65,"Index":66,"INDEX_START":67,"IndexValue":68,"INDEX_END":69,"INDEX_SOAK":70,"INDEX_PROTO":71,"Slice":72,"{":73,"AssignList":74,"}":75,"CLASS":76,"EXTENDS":77,"OptFuncExist":78,"Arguments":79,"SUPER":80,"FUNC_EXIST":81,"CALL_START":82,"CALL_END":83,"ArgList":84,"THIS":85,"@":86,"[":87,"]":88,"RangeDots":89,"..":90,"Arg":91,"SimpleArgs":92,"TRY":93,"Catch":94,"FINALLY":95,"CATCH":96,"THROW":97,"(":98,")":99,"WhileSource":100,"WHILE":101,"WHEN":102,"UNTIL":103,"Loop":104,"LOOP":105,"ForBody":106,"FOR":107,"ForStart":108,"ForSource":109,"ForVariables":110,"OWN":111,"ForValue":112,"FORIN":113,"FOROF":114,"BY":115,"SWITCH":116,"Whens":117,"ELSE":118,"When":119,"LEADING_WHEN":120,"IfBlock":121,"IF":122,"POST_IF":123,"UNARY":124,"-":125,"+":126,"--":127,"++":128,"?":129,"MATH":130,"SHIFT":131,"COMPARE":132,"LOGIC":133,"RELATION":134,"COMPOUND_ASSIGN":135,"$accept":0,"$end":1}, -terminals_: {2:"error",6:"TERMINATOR",13:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"BOOL",37:"=",40:":",42:"RETURN",43:"HERECOMMENT",44:"PARAM_START",46:"PARAM_END",48:"->",49:"=>",51:",",54:"...",63:".",64:"?.",65:"::",67:"INDEX_START",69:"INDEX_END",70:"INDEX_SOAK",71:"INDEX_PROTO",73:"{",75:"}",76:"CLASS",77:"EXTENDS",80:"SUPER",81:"FUNC_EXIST",82:"CALL_START",83:"CALL_END",85:"THIS",86:"@",87:"[",88:"]",90:"..",93:"TRY",95:"FINALLY",96:"CATCH",97:"THROW",98:"(",99:")",101:"WHILE",102:"WHEN",103:"UNTIL",105:"LOOP",107:"FOR",111:"OWN",113:"FORIN",114:"FOROF",115:"BY",116:"SWITCH",118:"ELSE",120:"LEADING_WHEN",122:"IF",123:"POST_IF",124:"UNARY",125:"-",126:"+",127:"--",128:"++",129:"?",130:"MATH",131:"SHIFT",132:"COMPARE",133:"LOGIC",134:"RELATION",135:"COMPOUND_ASSIGN"}, -productions_: [0,[3,0],[3,1],[3,2],[4,1],[4,3],[4,2],[7,1],[7,1],[9,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],[5,2],[5,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[18,3],[18,5],[38,1],[38,3],[38,5],[38,1],[39,1],[39,1],[39,1],[10,2],[10,1],[12,1],[16,5],[16,2],[47,1],[47,1],[50,0],[50,1],[45,0],[45,1],[45,3],[52,1],[52,2],[52,3],[53,1],[53,1],[53,1],[53,1],[57,2],[58,1],[58,2],[58,2],[58,1],[36,1],[36,1],[36,1],[14,1],[14,1],[14,1],[14,1],[14,1],[59,2],[59,2],[59,2],[59,1],[59,1],[66,3],[66,2],[66,2],[68,1],[68,1],[56,4],[74,0],[74,1],[74,3],[74,4],[74,6],[24,1],[24,2],[24,3],[24,4],[24,2],[24,3],[24,4],[24,5],[15,3],[15,3],[15,1],[15,2],[78,0],[78,1],[79,2],[79,4],[62,1],[62,1],[41,2],[55,2],[55,4],[89,1],[89,1],[61,5],[72,3],[72,2],[72,2],[84,1],[84,3],[84,4],[84,4],[84,6],[91,1],[91,1],[92,1],[92,3],[20,2],[20,3],[20,4],[20,5],[94,3],[11,2],[60,3],[60,5],[100,2],[100,4],[100,2],[100,4],[21,2],[21,2],[21,2],[21,1],[104,2],[104,2],[22,2],[22,2],[22,2],[106,2],[106,2],[108,2],[108,3],[112,1],[112,1],[112,1],[110,1],[110,3],[109,2],[109,2],[109,4],[109,4],[109,4],[109,6],[109,6],[23,5],[23,7],[23,4],[23,6],[117,1],[117,2],[119,3],[119,4],[121,3],[121,5],[19,1],[19,3],[19,3],[19,3],[17,2],[17,2],[17,2],[17,2],[17,2],[17,2],[17,2],[17,2],[17,3],[17,3],[17,3],[17,3],[17,3],[17,3],[17,3],[17,3],[17,5],[17,3]], -performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { - -var $0 = $$.length - 1; -switch (yystate) { -case 1:return this.$ = new yy.Block; -break; -case 2:return this.$ = $$[$0]; -break; -case 3:return this.$ = $$[$0-1]; -break; -case 4:this.$ = yy.Block.wrap([$$[$0]]); -break; -case 5:this.$ = $$[$0-2].push($$[$0]); -break; -case 6:this.$ = $$[$0-1]; -break; -case 7:this.$ = $$[$0]; -break; -case 8:this.$ = $$[$0]; -break; -case 9:this.$ = $$[$0]; -break; -case 10:this.$ = $$[$0]; -break; -case 11:this.$ = $$[$0]; -break; -case 12:this.$ = new yy.Literal($$[$0]); -break; -case 13:this.$ = $$[$0]; -break; -case 14:this.$ = $$[$0]; -break; -case 15:this.$ = $$[$0]; -break; -case 16:this.$ = $$[$0]; -break; -case 17:this.$ = $$[$0]; -break; -case 18:this.$ = $$[$0]; -break; -case 19:this.$ = $$[$0]; -break; -case 20:this.$ = $$[$0]; -break; -case 21:this.$ = $$[$0]; -break; -case 22:this.$ = $$[$0]; -break; -case 23:this.$ = $$[$0]; -break; -case 24:this.$ = new yy.Block; -break; -case 25:this.$ = $$[$0-1]; -break; -case 26:this.$ = new yy.Literal($$[$0]); -break; -case 27:this.$ = new yy.Literal($$[$0]); -break; -case 28:this.$ = new yy.Literal($$[$0]); -break; -case 29:this.$ = $$[$0]; -break; -case 30:this.$ = new yy.Literal($$[$0]); -break; -case 31:this.$ = new yy.Literal($$[$0]); -break; -case 32:this.$ = (function () { - var val; - val = new yy.Literal($$[$0]); - if ($$[$0] === 'undefined') { - val.isUndefined = true; - } - return val; - }()); -break; -case 33:this.$ = new yy.Assign($$[$0-2], $$[$0]); -break; -case 34:this.$ = new yy.Assign($$[$0-4], $$[$0-1]); -break; -case 35:this.$ = new yy.Value($$[$0]); -break; -case 36:this.$ = new yy.Assign(new yy.Value($$[$0-2]), $$[$0], 'object'); -break; -case 37:this.$ = new yy.Assign(new yy.Value($$[$0-4]), $$[$0-1], 'object'); -break; -case 38:this.$ = $$[$0]; -break; -case 39:this.$ = $$[$0]; -break; -case 40:this.$ = $$[$0]; -break; -case 41:this.$ = $$[$0]; -break; -case 42:this.$ = new yy.Return($$[$0]); -break; -case 43:this.$ = new yy.Return; -break; -case 44:this.$ = new yy.Comment($$[$0]); -break; -case 45:this.$ = new yy.Code($$[$0-3], $$[$0], $$[$0-1]); -break; -case 46:this.$ = new yy.Code([], $$[$0], $$[$0-1]); -break; -case 47:this.$ = 'func'; -break; -case 48:this.$ = 'boundfunc'; -break; -case 49:this.$ = $$[$0]; -break; -case 50:this.$ = $$[$0]; -break; -case 51:this.$ = []; -break; -case 52:this.$ = [$$[$0]]; -break; -case 53:this.$ = $$[$0-2].concat($$[$0]); -break; -case 54:this.$ = new yy.Param($$[$0]); -break; -case 55:this.$ = new yy.Param($$[$0-1], null, true); -break; -case 56:this.$ = new yy.Param($$[$0-2], $$[$0]); -break; -case 57:this.$ = $$[$0]; -break; -case 58:this.$ = $$[$0]; -break; -case 59:this.$ = $$[$0]; -break; -case 60:this.$ = $$[$0]; -break; -case 61:this.$ = new yy.Splat($$[$0-1]); -break; -case 62:this.$ = new yy.Value($$[$0]); -break; -case 63:this.$ = $$[$0-1].push($$[$0]); -break; -case 64:this.$ = new yy.Value($$[$0-1], [$$[$0]]); -break; -case 65:this.$ = $$[$0]; -break; -case 66:this.$ = $$[$0]; -break; -case 67:this.$ = new yy.Value($$[$0]); -break; -case 68:this.$ = new yy.Value($$[$0]); -break; -case 69:this.$ = $$[$0]; -break; -case 70:this.$ = new yy.Value($$[$0]); -break; -case 71:this.$ = new yy.Value($$[$0]); -break; -case 72:this.$ = new yy.Value($$[$0]); -break; -case 73:this.$ = $$[$0]; -break; -case 74:this.$ = new yy.Access($$[$0]); -break; -case 75:this.$ = new yy.Access($$[$0], 'soak'); -break; -case 76:this.$ = new yy.Access($$[$0], 'proto'); -break; -case 77:this.$ = new yy.Access(new yy.Literal('prototype')); -break; -case 78:this.$ = $$[$0]; -break; -case 79:this.$ = $$[$0-1]; -break; -case 80:this.$ = yy.extend($$[$0], { - soak: true - }); -break; -case 81:this.$ = yy.extend($$[$0], { - proto: true - }); -break; -case 82:this.$ = new yy.Index($$[$0]); -break; -case 83:this.$ = new yy.Slice($$[$0]); -break; -case 84:this.$ = new yy.Obj($$[$0-2], $$[$0-3].generated); -break; -case 85:this.$ = []; -break; -case 86:this.$ = [$$[$0]]; -break; -case 87:this.$ = $$[$0-2].concat($$[$0]); -break; -case 88:this.$ = $$[$0-3].concat($$[$0]); -break; -case 89:this.$ = $$[$0-5].concat($$[$0-2]); -break; -case 90:this.$ = new yy.Class; -break; -case 91:this.$ = new yy.Class(null, null, $$[$0]); -break; -case 92:this.$ = new yy.Class(null, $$[$0]); -break; -case 93:this.$ = new yy.Class(null, $$[$0-1], $$[$0]); -break; -case 94:this.$ = new yy.Class($$[$0]); -break; -case 95:this.$ = new yy.Class($$[$0-1], null, $$[$0]); -break; -case 96:this.$ = new yy.Class($$[$0-2], $$[$0]); -break; -case 97:this.$ = new yy.Class($$[$0-3], $$[$0-1], $$[$0]); -break; -case 98:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]); -break; -case 99:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]); -break; -case 100:this.$ = new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))]); -break; -case 101:this.$ = new yy.Call('super', $$[$0]); -break; -case 102:this.$ = false; -break; -case 103:this.$ = true; -break; -case 104:this.$ = []; -break; -case 105:this.$ = $$[$0-2]; -break; -case 106:this.$ = new yy.Value(new yy.Literal('this')); -break; -case 107:this.$ = new yy.Value(new yy.Literal('this')); -break; -case 108:this.$ = new yy.Value(new yy.Literal('this'), [new yy.Access($$[$0])], 'this'); -break; -case 109:this.$ = new yy.Arr([]); -break; -case 110:this.$ = new yy.Arr($$[$0-2]); -break; -case 111:this.$ = 'inclusive'; -break; -case 112:this.$ = 'exclusive'; -break; -case 113:this.$ = new yy.Range($$[$0-3], $$[$0-1], $$[$0-2]); -break; -case 114:this.$ = new yy.Range($$[$0-2], $$[$0], $$[$0-1]); -break; -case 115:this.$ = new yy.Range($$[$0-1], null, $$[$0]); -break; -case 116:this.$ = new yy.Range(null, $$[$0], $$[$0-1]); -break; -case 117:this.$ = [$$[$0]]; -break; -case 118:this.$ = $$[$0-2].concat($$[$0]); -break; -case 119:this.$ = $$[$0-3].concat($$[$0]); -break; -case 120:this.$ = $$[$0-2]; -break; -case 121:this.$ = $$[$0-5].concat($$[$0-2]); -break; -case 122:this.$ = $$[$0]; -break; -case 123:this.$ = $$[$0]; -break; -case 124:this.$ = $$[$0]; -break; -case 125:this.$ = [].concat($$[$0-2], $$[$0]); -break; -case 126:this.$ = new yy.Try($$[$0]); -break; -case 127:this.$ = new yy.Try($$[$0-1], $$[$0][0], $$[$0][1]); -break; -case 128:this.$ = new yy.Try($$[$0-2], null, null, $$[$0]); -break; -case 129:this.$ = new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]); -break; -case 130:this.$ = [$$[$0-1], $$[$0]]; -break; -case 131:this.$ = new yy.Throw($$[$0]); -break; -case 132:this.$ = new yy.Parens($$[$0-1]); -break; -case 133:this.$ = new yy.Parens($$[$0-2]); -break; -case 134:this.$ = new yy.While($$[$0]); -break; -case 135:this.$ = new yy.While($$[$0-2], { - guard: $$[$0] - }); -break; -case 136:this.$ = new yy.While($$[$0], { - invert: true - }); -break; -case 137:this.$ = new yy.While($$[$0-2], { - invert: true, - guard: $$[$0] - }); -break; -case 138:this.$ = $$[$0-1].addBody($$[$0]); -break; -case 139:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]])); -break; -case 140:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]])); -break; -case 141:this.$ = $$[$0]; -break; -case 142:this.$ = new yy.While(new yy.Literal('true')).addBody($$[$0]); -break; -case 143:this.$ = new yy.While(new yy.Literal('true')).addBody(yy.Block.wrap([$$[$0]])); -break; -case 144:this.$ = new yy.For($$[$0-1], $$[$0]); -break; -case 145:this.$ = new yy.For($$[$0-1], $$[$0]); -break; -case 146:this.$ = new yy.For($$[$0], $$[$0-1]); -break; -case 147:this.$ = { - source: new yy.Value($$[$0]) - }; -break; -case 148:this.$ = (function () { - $$[$0].own = $$[$0-1].own; - $$[$0].name = $$[$0-1][0]; - $$[$0].index = $$[$0-1][1]; - return $$[$0]; - }()); -break; -case 149:this.$ = $$[$0]; -break; -case 150:this.$ = (function () { - $$[$0].own = true; - return $$[$0]; - }()); -break; -case 151:this.$ = $$[$0]; -break; -case 152:this.$ = new yy.Value($$[$0]); -break; -case 153:this.$ = new yy.Value($$[$0]); -break; -case 154:this.$ = [$$[$0]]; -break; -case 155:this.$ = [$$[$0-2], $$[$0]]; -break; -case 156:this.$ = { - source: $$[$0] - }; -break; -case 157:this.$ = { - source: $$[$0], - object: true - }; -break; -case 158:this.$ = { - source: $$[$0-2], - guard: $$[$0] - }; -break; -case 159:this.$ = { - source: $$[$0-2], - guard: $$[$0], - object: true - }; -break; -case 160:this.$ = { - source: $$[$0-2], - step: $$[$0] - }; -break; -case 161:this.$ = { - source: $$[$0-4], - guard: $$[$0-2], - step: $$[$0] - }; -break; -case 162:this.$ = { - source: $$[$0-4], - step: $$[$0-2], - guard: $$[$0] - }; -break; -case 163:this.$ = new yy.Switch($$[$0-3], $$[$0-1]); -break; -case 164:this.$ = new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1]); -break; -case 165:this.$ = new yy.Switch(null, $$[$0-1]); -break; -case 166:this.$ = new yy.Switch(null, $$[$0-3], $$[$0-1]); -break; -case 167:this.$ = $$[$0]; -break; -case 168:this.$ = $$[$0-1].concat($$[$0]); -break; -case 169:this.$ = [[$$[$0-1], $$[$0]]]; -break; -case 170:this.$ = [[$$[$0-2], $$[$0-1]]]; -break; -case 171:this.$ = new yy.If($$[$0-1], $$[$0], { - type: $$[$0-2] - }); -break; -case 172:this.$ = $$[$0-4].addElse(new yy.If($$[$0-1], $$[$0], { - type: $$[$0-2] - })); -break; -case 173:this.$ = $$[$0]; -break; -case 174:this.$ = $$[$0-2].addElse($$[$0]); -break; -case 175:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), { - type: $$[$0-1], - statement: true - }); -break; -case 176:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), { - type: $$[$0-1], - statement: true - }); -break; -case 177:this.$ = new yy.Op($$[$0-1], $$[$0]); -break; -case 178:this.$ = new yy.Op('-', $$[$0]); -break; -case 179:this.$ = new yy.Op('+', $$[$0]); -break; -case 180:this.$ = new yy.Op('--', $$[$0]); -break; -case 181:this.$ = new yy.Op('++', $$[$0]); -break; -case 182:this.$ = new yy.Op('--', $$[$0-1], null, true); -break; -case 183:this.$ = new yy.Op('++', $$[$0-1], null, true); -break; -case 184:this.$ = new yy.Existence($$[$0-1]); -break; -case 185:this.$ = new yy.Op('+', $$[$0-2], $$[$0]); -break; -case 186:this.$ = new yy.Op('-', $$[$0-2], $$[$0]); -break; -case 187:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 188:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 189:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 190:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 191:this.$ = (function () { - if ($$[$0-1].charAt(0) === '!') { - return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert(); - } else { - return new yy.Op($$[$0-1], $$[$0-2], $$[$0]); - } - }()); -break; -case 192:this.$ = new yy.Assign($$[$0-2], $$[$0], $$[$0-1]); -break; -case 193:this.$ = new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3]); -break; -case 194:this.$ = new yy.Extends($$[$0-2], $$[$0]); -break; -} -}, -table: [{1:[2,1],3:1,4:2,5:3,7:4,8:6,9:7,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,5],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[3]},{1:[2,2],6:[1,71]},{6:[1,72]},{1:[2,4],6:[2,4],26:[2,4],99:[2,4]},{4:74,7:4,8:6,9:7,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,26:[1,73],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,7],6:[2,7],26:[2,7],99:[2,7],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,8],6:[2,8],26:[2,8],99:[2,8],100:87,101:[1,62],103:[1,63],106:88,107:[1,65],108:66,123:[1,86]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],46:[2,13],51:[2,13],54:[2,13],59:90,63:[1,92],64:[1,93],65:[1,94],66:95,67:[1,96],69:[2,13],70:[1,97],71:[1,98],75:[2,13],78:89,81:[1,91],82:[2,102],83:[2,13],88:[2,13],90:[2,13],99:[2,13],101:[2,13],102:[2,13],103:[2,13],107:[2,13],115:[2,13],123:[2,13],125:[2,13],126:[2,13],129:[2,13],130:[2,13],131:[2,13],132:[2,13],133:[2,13],134:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],46:[2,14],51:[2,14],54:[2,14],59:100,63:[1,92],64:[1,93],65:[1,94],66:95,67:[1,96],69:[2,14],70:[1,97],71:[1,98],75:[2,14],78:99,81:[1,91],82:[2,102],83:[2,14],88:[2,14],90:[2,14],99:[2,14],101:[2,14],102:[2,14],103:[2,14],107:[2,14],115:[2,14],123:[2,14],125:[2,14],126:[2,14],129:[2,14],130:[2,14],131:[2,14],132:[2,14],133:[2,14],134:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],46:[2,15],51:[2,15],54:[2,15],69:[2,15],75:[2,15],83:[2,15],88:[2,15],90:[2,15],99:[2,15],101:[2,15],102:[2,15],103:[2,15],107:[2,15],115:[2,15],123:[2,15],125:[2,15],126:[2,15],129:[2,15],130:[2,15],131:[2,15],132:[2,15],133:[2,15],134:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],46:[2,16],51:[2,16],54:[2,16],69:[2,16],75:[2,16],83:[2,16],88:[2,16],90:[2,16],99:[2,16],101:[2,16],102:[2,16],103:[2,16],107:[2,16],115:[2,16],123:[2,16],125:[2,16],126:[2,16],129:[2,16],130:[2,16],131:[2,16],132:[2,16],133:[2,16],134:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],46:[2,17],51:[2,17],54:[2,17],69:[2,17],75:[2,17],83:[2,17],88:[2,17],90:[2,17],99:[2,17],101:[2,17],102:[2,17],103:[2,17],107:[2,17],115:[2,17],123:[2,17],125:[2,17],126:[2,17],129:[2,17],130:[2,17],131:[2,17],132:[2,17],133:[2,17],134:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],46:[2,18],51:[2,18],54:[2,18],69:[2,18],75:[2,18],83:[2,18],88:[2,18],90:[2,18],99:[2,18],101:[2,18],102:[2,18],103:[2,18],107:[2,18],115:[2,18],123:[2,18],125:[2,18],126:[2,18],129:[2,18],130:[2,18],131:[2,18],132:[2,18],133:[2,18],134:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],46:[2,19],51:[2,19],54:[2,19],69:[2,19],75:[2,19],83:[2,19],88:[2,19],90:[2,19],99:[2,19],101:[2,19],102:[2,19],103:[2,19],107:[2,19],115:[2,19],123:[2,19],125:[2,19],126:[2,19],129:[2,19],130:[2,19],131:[2,19],132:[2,19],133:[2,19],134:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],46:[2,20],51:[2,20],54:[2,20],69:[2,20],75:[2,20],83:[2,20],88:[2,20],90:[2,20],99:[2,20],101:[2,20],102:[2,20],103:[2,20],107:[2,20],115:[2,20],123:[2,20],125:[2,20],126:[2,20],129:[2,20],130:[2,20],131:[2,20],132:[2,20],133:[2,20],134:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],46:[2,21],51:[2,21],54:[2,21],69:[2,21],75:[2,21],83:[2,21],88:[2,21],90:[2,21],99:[2,21],101:[2,21],102:[2,21],103:[2,21],107:[2,21],115:[2,21],123:[2,21],125:[2,21],126:[2,21],129:[2,21],130:[2,21],131:[2,21],132:[2,21],133:[2,21],134:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],46:[2,22],51:[2,22],54:[2,22],69:[2,22],75:[2,22],83:[2,22],88:[2,22],90:[2,22],99:[2,22],101:[2,22],102:[2,22],103:[2,22],107:[2,22],115:[2,22],123:[2,22],125:[2,22],126:[2,22],129:[2,22],130:[2,22],131:[2,22],132:[2,22],133:[2,22],134:[2,22]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],46:[2,23],51:[2,23],54:[2,23],69:[2,23],75:[2,23],83:[2,23],88:[2,23],90:[2,23],99:[2,23],101:[2,23],102:[2,23],103:[2,23],107:[2,23],115:[2,23],123:[2,23],125:[2,23],126:[2,23],129:[2,23],130:[2,23],131:[2,23],132:[2,23],133:[2,23],134:[2,23]},{1:[2,9],6:[2,9],26:[2,9],99:[2,9],101:[2,9],103:[2,9],107:[2,9],123:[2,9]},{1:[2,10],6:[2,10],26:[2,10],99:[2,10],101:[2,10],103:[2,10],107:[2,10],123:[2,10]},{1:[2,11],6:[2,11],26:[2,11],99:[2,11],101:[2,11],103:[2,11],107:[2,11],123:[2,11]},{1:[2,12],6:[2,12],26:[2,12],99:[2,12],101:[2,12],103:[2,12],107:[2,12],123:[2,12]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],37:[1,101],46:[2,69],51:[2,69],54:[2,69],63:[2,69],64:[2,69],65:[2,69],67:[2,69],69:[2,69],70:[2,69],71:[2,69],75:[2,69],81:[2,69],82:[2,69],83:[2,69],88:[2,69],90:[2,69],99:[2,69],101:[2,69],102:[2,69],103:[2,69],107:[2,69],115:[2,69],123:[2,69],125:[2,69],126:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69]},{1:[2,70],6:[2,70],25:[2,70],26:[2,70],46:[2,70],51:[2,70],54:[2,70],63:[2,70],64:[2,70],65:[2,70],67:[2,70],69:[2,70],70:[2,70],71:[2,70],75:[2,70],81:[2,70],82:[2,70],83:[2,70],88:[2,70],90:[2,70],99:[2,70],101:[2,70],102:[2,70],103:[2,70],107:[2,70],115:[2,70],123:[2,70],125:[2,70],126:[2,70],129:[2,70],130:[2,70],131:[2,70],132:[2,70],133:[2,70],134:[2,70]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],46:[2,71],51:[2,71],54:[2,71],63:[2,71],64:[2,71],65:[2,71],67:[2,71],69:[2,71],70:[2,71],71:[2,71],75:[2,71],81:[2,71],82:[2,71],83:[2,71],88:[2,71],90:[2,71],99:[2,71],101:[2,71],102:[2,71],103:[2,71],107:[2,71],115:[2,71],123:[2,71],125:[2,71],126:[2,71],129:[2,71],130:[2,71],131:[2,71],132:[2,71],133:[2,71],134:[2,71]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],46:[2,72],51:[2,72],54:[2,72],63:[2,72],64:[2,72],65:[2,72],67:[2,72],69:[2,72],70:[2,72],71:[2,72],75:[2,72],81:[2,72],82:[2,72],83:[2,72],88:[2,72],90:[2,72],99:[2,72],101:[2,72],102:[2,72],103:[2,72],107:[2,72],115:[2,72],123:[2,72],125:[2,72],126:[2,72],129:[2,72],130:[2,72],131:[2,72],132:[2,72],133:[2,72],134:[2,72]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],46:[2,73],51:[2,73],54:[2,73],63:[2,73],64:[2,73],65:[2,73],67:[2,73],69:[2,73],70:[2,73],71:[2,73],75:[2,73],81:[2,73],82:[2,73],83:[2,73],88:[2,73],90:[2,73],99:[2,73],101:[2,73],102:[2,73],103:[2,73],107:[2,73],115:[2,73],123:[2,73],125:[2,73],126:[2,73],129:[2,73],130:[2,73],131:[2,73],132:[2,73],133:[2,73],134:[2,73]},{1:[2,100],6:[2,100],25:[2,100],26:[2,100],46:[2,100],51:[2,100],54:[2,100],63:[2,100],64:[2,100],65:[2,100],67:[2,100],69:[2,100],70:[2,100],71:[2,100],75:[2,100],79:102,81:[2,100],82:[1,103],83:[2,100],88:[2,100],90:[2,100],99:[2,100],101:[2,100],102:[2,100],103:[2,100],107:[2,100],115:[2,100],123:[2,100],125:[2,100],126:[2,100],129:[2,100],130:[2,100],131:[2,100],132:[2,100],133:[2,100],134:[2,100]},{27:107,28:[1,70],41:108,45:104,46:[2,51],51:[2,51],52:105,53:106,55:109,56:110,73:[1,67],86:[1,111],87:[1,112]},{5:113,25:[1,5]},{8:114,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:116,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:117,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{14:119,15:120,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:121,41:60,55:47,56:48,58:118,60:25,61:26,62:27,73:[1,67],80:[1,28],85:[1,55],86:[1,56],87:[1,54],98:[1,53]},{14:119,15:120,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:121,41:60,55:47,56:48,58:122,60:25,61:26,62:27,73:[1,67],80:[1,28],85:[1,55],86:[1,56],87:[1,54],98:[1,53]},{1:[2,66],6:[2,66],25:[2,66],26:[2,66],37:[2,66],46:[2,66],51:[2,66],54:[2,66],63:[2,66],64:[2,66],65:[2,66],67:[2,66],69:[2,66],70:[2,66],71:[2,66],75:[2,66],77:[1,126],81:[2,66],82:[2,66],83:[2,66],88:[2,66],90:[2,66],99:[2,66],101:[2,66],102:[2,66],103:[2,66],107:[2,66],115:[2,66],123:[2,66],125:[2,66],126:[2,66],127:[1,123],128:[1,124],129:[2,66],130:[2,66],131:[2,66],132:[2,66],133:[2,66],134:[2,66],135:[1,125]},{1:[2,173],6:[2,173],25:[2,173],26:[2,173],46:[2,173],51:[2,173],54:[2,173],69:[2,173],75:[2,173],83:[2,173],88:[2,173],90:[2,173],99:[2,173],101:[2,173],102:[2,173],103:[2,173],107:[2,173],115:[2,173],118:[1,127],123:[2,173],125:[2,173],126:[2,173],129:[2,173],130:[2,173],131:[2,173],132:[2,173],133:[2,173],134:[2,173]},{5:128,25:[1,5]},{5:129,25:[1,5]},{1:[2,141],6:[2,141],25:[2,141],26:[2,141],46:[2,141],51:[2,141],54:[2,141],69:[2,141],75:[2,141],83:[2,141],88:[2,141],90:[2,141],99:[2,141],101:[2,141],102:[2,141],103:[2,141],107:[2,141],115:[2,141],123:[2,141],125:[2,141],126:[2,141],129:[2,141],130:[2,141],131:[2,141],132:[2,141],133:[2,141],134:[2,141]},{5:130,25:[1,5]},{8:131,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,132],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,90],5:133,6:[2,90],14:119,15:120,25:[1,5],26:[2,90],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:121,41:60,46:[2,90],51:[2,90],54:[2,90],55:47,56:48,58:135,60:25,61:26,62:27,69:[2,90],73:[1,67],75:[2,90],77:[1,134],80:[1,28],83:[2,90],85:[1,55],86:[1,56],87:[1,54],88:[2,90],90:[2,90],98:[1,53],99:[2,90],101:[2,90],102:[2,90],103:[2,90],107:[2,90],115:[2,90],123:[2,90],125:[2,90],126:[2,90],129:[2,90],130:[2,90],131:[2,90],132:[2,90],133:[2,90],134:[2,90]},{1:[2,43],6:[2,43],8:136,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,26:[2,43],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],99:[2,43],100:39,101:[2,43],103:[2,43],104:40,105:[1,64],106:41,107:[2,43],108:66,116:[1,42],121:37,122:[1,61],123:[2,43],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:137,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,44],6:[2,44],25:[2,44],26:[2,44],51:[2,44],75:[2,44],99:[2,44],101:[2,44],103:[2,44],107:[2,44],123:[2,44]},{1:[2,67],6:[2,67],25:[2,67],26:[2,67],37:[2,67],46:[2,67],51:[2,67],54:[2,67],63:[2,67],64:[2,67],65:[2,67],67:[2,67],69:[2,67],70:[2,67],71:[2,67],75:[2,67],81:[2,67],82:[2,67],83:[2,67],88:[2,67],90:[2,67],99:[2,67],101:[2,67],102:[2,67],103:[2,67],107:[2,67],115:[2,67],123:[2,67],125:[2,67],126:[2,67],129:[2,67],130:[2,67],131:[2,67],132:[2,67],133:[2,67],134:[2,67]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],37:[2,68],46:[2,68],51:[2,68],54:[2,68],63:[2,68],64:[2,68],65:[2,68],67:[2,68],69:[2,68],70:[2,68],71:[2,68],75:[2,68],81:[2,68],82:[2,68],83:[2,68],88:[2,68],90:[2,68],99:[2,68],101:[2,68],102:[2,68],103:[2,68],107:[2,68],115:[2,68],123:[2,68],125:[2,68],126:[2,68],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],46:[2,29],51:[2,29],54:[2,29],63:[2,29],64:[2,29],65:[2,29],67:[2,29],69:[2,29],70:[2,29],71:[2,29],75:[2,29],81:[2,29],82:[2,29],83:[2,29],88:[2,29],90:[2,29],99:[2,29],101:[2,29],102:[2,29],103:[2,29],107:[2,29],115:[2,29],123:[2,29],125:[2,29],126:[2,29],129:[2,29],130:[2,29],131:[2,29],132:[2,29],133:[2,29],134:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],46:[2,30],51:[2,30],54:[2,30],63:[2,30],64:[2,30],65:[2,30],67:[2,30],69:[2,30],70:[2,30],71:[2,30],75:[2,30],81:[2,30],82:[2,30],83:[2,30],88:[2,30],90:[2,30],99:[2,30],101:[2,30],102:[2,30],103:[2,30],107:[2,30],115:[2,30],123:[2,30],125:[2,30],126:[2,30],129:[2,30],130:[2,30],131:[2,30],132:[2,30],133:[2,30],134:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],46:[2,31],51:[2,31],54:[2,31],63:[2,31],64:[2,31],65:[2,31],67:[2,31],69:[2,31],70:[2,31],71:[2,31],75:[2,31],81:[2,31],82:[2,31],83:[2,31],88:[2,31],90:[2,31],99:[2,31],101:[2,31],102:[2,31],103:[2,31],107:[2,31],115:[2,31],123:[2,31],125:[2,31],126:[2,31],129:[2,31],130:[2,31],131:[2,31],132:[2,31],133:[2,31],134:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],46:[2,32],51:[2,32],54:[2,32],63:[2,32],64:[2,32],65:[2,32],67:[2,32],69:[2,32],70:[2,32],71:[2,32],75:[2,32],81:[2,32],82:[2,32],83:[2,32],88:[2,32],90:[2,32],99:[2,32],101:[2,32],102:[2,32],103:[2,32],107:[2,32],115:[2,32],123:[2,32],125:[2,32],126:[2,32],129:[2,32],130:[2,32],131:[2,32],132:[2,32],133:[2,32],134:[2,32]},{4:138,7:4,8:6,9:7,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,139],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:140,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,144],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,57:145,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],84:142,85:[1,55],86:[1,56],87:[1,54],88:[1,141],91:143,93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,106],6:[2,106],25:[2,106],26:[2,106],46:[2,106],51:[2,106],54:[2,106],63:[2,106],64:[2,106],65:[2,106],67:[2,106],69:[2,106],70:[2,106],71:[2,106],75:[2,106],81:[2,106],82:[2,106],83:[2,106],88:[2,106],90:[2,106],99:[2,106],101:[2,106],102:[2,106],103:[2,106],107:[2,106],115:[2,106],123:[2,106],125:[2,106],126:[2,106],129:[2,106],130:[2,106],131:[2,106],132:[2,106],133:[2,106],134:[2,106]},{1:[2,107],6:[2,107],25:[2,107],26:[2,107],27:146,28:[1,70],46:[2,107],51:[2,107],54:[2,107],63:[2,107],64:[2,107],65:[2,107],67:[2,107],69:[2,107],70:[2,107],71:[2,107],75:[2,107],81:[2,107],82:[2,107],83:[2,107],88:[2,107],90:[2,107],99:[2,107],101:[2,107],102:[2,107],103:[2,107],107:[2,107],115:[2,107],123:[2,107],125:[2,107],126:[2,107],129:[2,107],130:[2,107],131:[2,107],132:[2,107],133:[2,107],134:[2,107]},{25:[2,47]},{25:[2,48]},{1:[2,62],6:[2,62],25:[2,62],26:[2,62],37:[2,62],46:[2,62],51:[2,62],54:[2,62],63:[2,62],64:[2,62],65:[2,62],67:[2,62],69:[2,62],70:[2,62],71:[2,62],75:[2,62],77:[2,62],81:[2,62],82:[2,62],83:[2,62],88:[2,62],90:[2,62],99:[2,62],101:[2,62],102:[2,62],103:[2,62],107:[2,62],115:[2,62],123:[2,62],125:[2,62],126:[2,62],127:[2,62],128:[2,62],129:[2,62],130:[2,62],131:[2,62],132:[2,62],133:[2,62],134:[2,62],135:[2,62]},{1:[2,65],6:[2,65],25:[2,65],26:[2,65],37:[2,65],46:[2,65],51:[2,65],54:[2,65],63:[2,65],64:[2,65],65:[2,65],67:[2,65],69:[2,65],70:[2,65],71:[2,65],75:[2,65],77:[2,65],81:[2,65],82:[2,65],83:[2,65],88:[2,65],90:[2,65],99:[2,65],101:[2,65],102:[2,65],103:[2,65],107:[2,65],115:[2,65],123:[2,65],125:[2,65],126:[2,65],127:[2,65],128:[2,65],129:[2,65],130:[2,65],131:[2,65],132:[2,65],133:[2,65],134:[2,65],135:[2,65]},{8:147,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:148,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:149,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{5:150,8:151,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,5],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{27:156,28:[1,70],55:157,56:158,61:152,73:[1,67],87:[1,54],110:153,111:[1,154],112:155},{109:159,113:[1,160],114:[1,161]},{6:[2,85],12:165,25:[2,85],27:166,28:[1,70],29:167,30:[1,68],31:[1,69],38:163,39:164,41:168,43:[1,46],51:[2,85],74:162,75:[2,85],86:[1,111]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],40:[2,27],46:[2,27],51:[2,27],54:[2,27],63:[2,27],64:[2,27],65:[2,27],67:[2,27],69:[2,27],70:[2,27],71:[2,27],75:[2,27],81:[2,27],82:[2,27],83:[2,27],88:[2,27],90:[2,27],99:[2,27],101:[2,27],102:[2,27],103:[2,27],107:[2,27],115:[2,27],123:[2,27],125:[2,27],126:[2,27],129:[2,27],130:[2,27],131:[2,27],132:[2,27],133:[2,27],134:[2,27]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],40:[2,28],46:[2,28],51:[2,28],54:[2,28],63:[2,28],64:[2,28],65:[2,28],67:[2,28],69:[2,28],70:[2,28],71:[2,28],75:[2,28],81:[2,28],82:[2,28],83:[2,28],88:[2,28],90:[2,28],99:[2,28],101:[2,28],102:[2,28],103:[2,28],107:[2,28],115:[2,28],123:[2,28],125:[2,28],126:[2,28],129:[2,28],130:[2,28],131:[2,28],132:[2,28],133:[2,28],134:[2,28]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],37:[2,26],40:[2,26],46:[2,26],51:[2,26],54:[2,26],63:[2,26],64:[2,26],65:[2,26],67:[2,26],69:[2,26],70:[2,26],71:[2,26],75:[2,26],77:[2,26],81:[2,26],82:[2,26],83:[2,26],88:[2,26],90:[2,26],99:[2,26],101:[2,26],102:[2,26],103:[2,26],107:[2,26],113:[2,26],114:[2,26],115:[2,26],123:[2,26],125:[2,26],126:[2,26],127:[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]},{1:[2,6],6:[2,6],7:169,8:6,9:7,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,26:[2,6],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],99:[2,6],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,3]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],46:[2,24],51:[2,24],54:[2,24],69:[2,24],75:[2,24],83:[2,24],88:[2,24],90:[2,24],95:[2,24],96:[2,24],99:[2,24],101:[2,24],102:[2,24],103:[2,24],107:[2,24],115:[2,24],118:[2,24],120:[2,24],123:[2,24],125:[2,24],126:[2,24],129:[2,24],130:[2,24],131:[2,24],132:[2,24],133:[2,24],134:[2,24]},{6:[1,71],26:[1,170]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],46:[2,184],51:[2,184],54:[2,184],69:[2,184],75:[2,184],83:[2,184],88:[2,184],90:[2,184],99:[2,184],101:[2,184],102:[2,184],103:[2,184],107:[2,184],115:[2,184],123:[2,184],125:[2,184],126:[2,184],129:[2,184],130:[2,184],131:[2,184],132:[2,184],133:[2,184],134:[2,184]},{8:171,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:172,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:173,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:174,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:175,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:176,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:177,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:178,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,140],6:[2,140],25:[2,140],26:[2,140],46:[2,140],51:[2,140],54:[2,140],69:[2,140],75:[2,140],83:[2,140],88:[2,140],90:[2,140],99:[2,140],101:[2,140],102:[2,140],103:[2,140],107:[2,140],115:[2,140],123:[2,140],125:[2,140],126:[2,140],129:[2,140],130:[2,140],131:[2,140],132:[2,140],133:[2,140],134:[2,140]},{1:[2,145],6:[2,145],25:[2,145],26:[2,145],46:[2,145],51:[2,145],54:[2,145],69:[2,145],75:[2,145],83:[2,145],88:[2,145],90:[2,145],99:[2,145],101:[2,145],102:[2,145],103:[2,145],107:[2,145],115:[2,145],123:[2,145],125:[2,145],126:[2,145],129:[2,145],130:[2,145],131:[2,145],132:[2,145],133:[2,145],134:[2,145]},{8:179,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],46:[2,139],51:[2,139],54:[2,139],69:[2,139],75:[2,139],83:[2,139],88:[2,139],90:[2,139],99:[2,139],101:[2,139],102:[2,139],103:[2,139],107:[2,139],115:[2,139],123:[2,139],125:[2,139],126:[2,139],129:[2,139],130:[2,139],131:[2,139],132:[2,139],133:[2,139],134:[2,139]},{1:[2,144],6:[2,144],25:[2,144],26:[2,144],46:[2,144],51:[2,144],54:[2,144],69:[2,144],75:[2,144],83:[2,144],88:[2,144],90:[2,144],99:[2,144],101:[2,144],102:[2,144],103:[2,144],107:[2,144],115:[2,144],123:[2,144],125:[2,144],126:[2,144],129:[2,144],130:[2,144],131:[2,144],132:[2,144],133:[2,144],134:[2,144]},{79:180,82:[1,103]},{1:[2,63],6:[2,63],25:[2,63],26:[2,63],37:[2,63],46:[2,63],51:[2,63],54:[2,63],63:[2,63],64:[2,63],65:[2,63],67:[2,63],69:[2,63],70:[2,63],71:[2,63],75:[2,63],77:[2,63],81:[2,63],82:[2,63],83:[2,63],88:[2,63],90:[2,63],99:[2,63],101:[2,63],102:[2,63],103:[2,63],107:[2,63],115:[2,63],123:[2,63],125:[2,63],126:[2,63],127:[2,63],128:[2,63],129:[2,63],130:[2,63],131:[2,63],132:[2,63],133:[2,63],134:[2,63],135:[2,63]},{82:[2,103]},{27:181,28:[1,70]},{27:182,28:[1,70]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],27:183,28:[1,70],37:[2,77],46:[2,77],51:[2,77],54:[2,77],63:[2,77],64:[2,77],65:[2,77],67:[2,77],69:[2,77],70:[2,77],71:[2,77],75:[2,77],77:[2,77],81:[2,77],82:[2,77],83:[2,77],88:[2,77],90:[2,77],99:[2,77],101:[2,77],102:[2,77],103:[2,77],107:[2,77],115:[2,77],123:[2,77],125:[2,77],126:[2,77],127:[2,77],128:[2,77],129:[2,77],130:[2,77],131:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],37:[2,78],46:[2,78],51:[2,78],54:[2,78],63:[2,78],64:[2,78],65:[2,78],67:[2,78],69:[2,78],70:[2,78],71:[2,78],75:[2,78],77:[2,78],81:[2,78],82:[2,78],83:[2,78],88:[2,78],90:[2,78],99:[2,78],101:[2,78],102:[2,78],103:[2,78],107:[2,78],115:[2,78],123:[2,78],125:[2,78],126:[2,78],127:[2,78],128:[2,78],129:[2,78],130:[2,78],131:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78]},{8:185,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],54:[1,189],55:47,56:48,58:36,60:25,61:26,62:27,68:184,72:186,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],89:187,90:[1,188],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{66:190,67:[1,96],70:[1,97],71:[1,98]},{66:191,67:[1,96],70:[1,97],71:[1,98]},{79:192,82:[1,103]},{1:[2,64],6:[2,64],25:[2,64],26:[2,64],37:[2,64],46:[2,64],51:[2,64],54:[2,64],63:[2,64],64:[2,64],65:[2,64],67:[2,64],69:[2,64],70:[2,64],71:[2,64],75:[2,64],77:[2,64],81:[2,64],82:[2,64],83:[2,64],88:[2,64],90:[2,64],99:[2,64],101:[2,64],102:[2,64],103:[2,64],107:[2,64],115:[2,64],123:[2,64],125:[2,64],126:[2,64],127:[2,64],128:[2,64],129:[2,64],130:[2,64],131:[2,64],132:[2,64],133:[2,64],134:[2,64],135:[2,64]},{8:193,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,194],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,101],6:[2,101],25:[2,101],26:[2,101],46:[2,101],51:[2,101],54:[2,101],63:[2,101],64:[2,101],65:[2,101],67:[2,101],69:[2,101],70:[2,101],71:[2,101],75:[2,101],81:[2,101],82:[2,101],83:[2,101],88:[2,101],90:[2,101],99:[2,101],101:[2,101],102:[2,101],103:[2,101],107:[2,101],115:[2,101],123:[2,101],125:[2,101],126:[2,101],129:[2,101],130:[2,101],131:[2,101],132:[2,101],133:[2,101],134:[2,101]},{8:197,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,144],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,57:145,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],83:[1,195],84:196,85:[1,55],86:[1,56],87:[1,54],91:143,93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{46:[1,198],51:[1,199]},{46:[2,52],51:[2,52]},{37:[1,201],46:[2,54],51:[2,54],54:[1,200]},{37:[2,57],46:[2,57],51:[2,57],54:[2,57]},{37:[2,58],46:[2,58],51:[2,58],54:[2,58]},{37:[2,59],46:[2,59],51:[2,59],54:[2,59]},{37:[2,60],46:[2,60],51:[2,60],54:[2,60]},{27:146,28:[1,70]},{8:197,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,144],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,57:145,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],84:142,85:[1,55],86:[1,56],87:[1,54],88:[1,141],91:143,93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,46],6:[2,46],25:[2,46],26:[2,46],46:[2,46],51:[2,46],54:[2,46],69:[2,46],75:[2,46],83:[2,46],88:[2,46],90:[2,46],99:[2,46],101:[2,46],102:[2,46],103:[2,46],107:[2,46],115:[2,46],123:[2,46],125:[2,46],126:[2,46],129:[2,46],130:[2,46],131:[2,46],132:[2,46],133:[2,46],134:[2,46]},{1:[2,177],6:[2,177],25:[2,177],26:[2,177],46:[2,177],51:[2,177],54:[2,177],69:[2,177],75:[2,177],83:[2,177],88:[2,177],90:[2,177],99:[2,177],100:84,101:[2,177],102:[2,177],103:[2,177],106:85,107:[2,177],108:66,115:[2,177],123:[2,177],125:[2,177],126:[2,177],129:[1,75],130:[2,177],131:[2,177],132:[2,177],133:[2,177],134:[2,177]},{100:87,101:[1,62],103:[1,63],106:88,107:[1,65],108:66,123:[1,86]},{1:[2,178],6:[2,178],25:[2,178],26:[2,178],46:[2,178],51:[2,178],54:[2,178],69:[2,178],75:[2,178],83:[2,178],88:[2,178],90:[2,178],99:[2,178],100:84,101:[2,178],102:[2,178],103:[2,178],106:85,107:[2,178],108:66,115:[2,178],123:[2,178],125:[2,178],126:[2,178],129:[1,75],130:[2,178],131:[2,178],132:[2,178],133:[2,178],134:[2,178]},{1:[2,179],6:[2,179],25:[2,179],26:[2,179],46:[2,179],51:[2,179],54:[2,179],69:[2,179],75:[2,179],83:[2,179],88:[2,179],90:[2,179],99:[2,179],100:84,101:[2,179],102:[2,179],103:[2,179],106:85,107:[2,179],108:66,115:[2,179],123:[2,179],125:[2,179],126:[2,179],129:[1,75],130:[2,179],131:[2,179],132:[2,179],133:[2,179],134:[2,179]},{1:[2,180],6:[2,180],25:[2,180],26:[2,180],46:[2,180],51:[2,180],54:[2,180],63:[2,66],64:[2,66],65:[2,66],67:[2,66],69:[2,180],70:[2,66],71:[2,66],75:[2,180],81:[2,66],82:[2,66],83:[2,180],88:[2,180],90:[2,180],99:[2,180],101:[2,180],102:[2,180],103:[2,180],107:[2,180],115:[2,180],123:[2,180],125:[2,180],126:[2,180],129:[2,180],130:[2,180],131:[2,180],132:[2,180],133:[2,180],134:[2,180]},{59:90,63:[1,92],64:[1,93],65:[1,94],66:95,67:[1,96],70:[1,97],71:[1,98],78:89,81:[1,91],82:[2,102]},{59:100,63:[1,92],64:[1,93],65:[1,94],66:95,67:[1,96],70:[1,97],71:[1,98],78:99,81:[1,91],82:[2,102]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],46:[2,69],51:[2,69],54:[2,69],63:[2,69],64:[2,69],65:[2,69],67:[2,69],69:[2,69],70:[2,69],71:[2,69],75:[2,69],81:[2,69],82:[2,69],83:[2,69],88:[2,69],90:[2,69],99:[2,69],101:[2,69],102:[2,69],103:[2,69],107:[2,69],115:[2,69],123:[2,69],125:[2,69],126:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69]},{1:[2,181],6:[2,181],25:[2,181],26:[2,181],46:[2,181],51:[2,181],54:[2,181],63:[2,66],64:[2,66],65:[2,66],67:[2,66],69:[2,181],70:[2,66],71:[2,66],75:[2,181],81:[2,66],82:[2,66],83:[2,181],88:[2,181],90:[2,181],99:[2,181],101:[2,181],102:[2,181],103:[2,181],107:[2,181],115:[2,181],123:[2,181],125:[2,181],126:[2,181],129:[2,181],130:[2,181],131:[2,181],132:[2,181],133:[2,181],134:[2,181]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],46:[2,182],51:[2,182],54:[2,182],69:[2,182],75:[2,182],83:[2,182],88:[2,182],90:[2,182],99:[2,182],101:[2,182],102:[2,182],103:[2,182],107:[2,182],115:[2,182],123:[2,182],125:[2,182],126:[2,182],129:[2,182],130:[2,182],131:[2,182],132:[2,182],133:[2,182],134:[2,182]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],46:[2,183],51:[2,183],54:[2,183],69:[2,183],75:[2,183],83:[2,183],88:[2,183],90:[2,183],99:[2,183],101:[2,183],102:[2,183],103:[2,183],107:[2,183],115:[2,183],123:[2,183],125:[2,183],126:[2,183],129:[2,183],130:[2,183],131:[2,183],132:[2,183],133:[2,183],134:[2,183]},{8:202,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,203],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:204,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{5:205,25:[1,5],122:[1,206]},{1:[2,126],6:[2,126],25:[2,126],26:[2,126],46:[2,126],51:[2,126],54:[2,126],69:[2,126],75:[2,126],83:[2,126],88:[2,126],90:[2,126],94:207,95:[1,208],96:[1,209],99:[2,126],101:[2,126],102:[2,126],103:[2,126],107:[2,126],115:[2,126],123:[2,126],125:[2,126],126:[2,126],129:[2,126],130:[2,126],131:[2,126],132:[2,126],133:[2,126],134:[2,126]},{1:[2,138],6:[2,138],25:[2,138],26:[2,138],46:[2,138],51:[2,138],54:[2,138],69:[2,138],75:[2,138],83:[2,138],88:[2,138],90:[2,138],99:[2,138],101:[2,138],102:[2,138],103:[2,138],107:[2,138],115:[2,138],123:[2,138],125:[2,138],126:[2,138],129:[2,138],130:[2,138],131:[2,138],132:[2,138],133:[2,138],134:[2,138]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],46:[2,146],51:[2,146],54:[2,146],69:[2,146],75:[2,146],83:[2,146],88:[2,146],90:[2,146],99:[2,146],101:[2,146],102:[2,146],103:[2,146],107:[2,146],115:[2,146],123:[2,146],125:[2,146],126:[2,146],129:[2,146],130:[2,146],131:[2,146],132:[2,146],133:[2,146],134:[2,146]},{25:[1,210],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{117:211,119:212,120:[1,213]},{1:[2,91],6:[2,91],25:[2,91],26:[2,91],46:[2,91],51:[2,91],54:[2,91],69:[2,91],75:[2,91],83:[2,91],88:[2,91],90:[2,91],99:[2,91],101:[2,91],102:[2,91],103:[2,91],107:[2,91],115:[2,91],123:[2,91],125:[2,91],126:[2,91],129:[2,91],130:[2,91],131:[2,91],132:[2,91],133:[2,91],134:[2,91]},{14:214,15:120,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:121,41:60,55:47,56:48,58:215,60:25,61:26,62:27,73:[1,67],80:[1,28],85:[1,55],86:[1,56],87:[1,54],98:[1,53]},{1:[2,94],5:216,6:[2,94],25:[1,5],26:[2,94],46:[2,94],51:[2,94],54:[2,94],63:[2,66],64:[2,66],65:[2,66],67:[2,66],69:[2,94],70:[2,66],71:[2,66],75:[2,94],77:[1,217],81:[2,66],82:[2,66],83:[2,94],88:[2,94],90:[2,94],99:[2,94],101:[2,94],102:[2,94],103:[2,94],107:[2,94],115:[2,94],123:[2,94],125:[2,94],126:[2,94],129:[2,94],130:[2,94],131:[2,94],132:[2,94],133:[2,94],134:[2,94]},{1:[2,42],6:[2,42],26:[2,42],99:[2,42],100:84,101:[2,42],103:[2,42],106:85,107:[2,42],108:66,123:[2,42],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,131],6:[2,131],26:[2,131],99:[2,131],100:84,101:[2,131],103:[2,131],106:85,107:[2,131],108:66,123:[2,131],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{6:[1,71],99:[1,218]},{4:219,7:4,8:6,9:7,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,122],25:[2,122],51:[2,122],54:[1,221],88:[2,122],89:220,90:[1,188],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,109],6:[2,109],25:[2,109],26:[2,109],37:[2,109],46:[2,109],51:[2,109],54:[2,109],63:[2,109],64:[2,109],65:[2,109],67:[2,109],69:[2,109],70:[2,109],71:[2,109],75:[2,109],81:[2,109],82:[2,109],83:[2,109],88:[2,109],90:[2,109],99:[2,109],101:[2,109],102:[2,109],103:[2,109],107:[2,109],113:[2,109],114:[2,109],115:[2,109],123:[2,109],125:[2,109],126:[2,109],129:[2,109],130:[2,109],131:[2,109],132:[2,109],133:[2,109],134:[2,109]},{6:[2,49],25:[2,49],50:222,51:[1,223],88:[2,49]},{6:[2,117],25:[2,117],26:[2,117],51:[2,117],83:[2,117],88:[2,117]},{8:197,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,144],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,57:145,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],84:224,85:[1,55],86:[1,56],87:[1,54],91:143,93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,123],25:[2,123],26:[2,123],51:[2,123],83:[2,123],88:[2,123]},{1:[2,108],6:[2,108],25:[2,108],26:[2,108],37:[2,108],40:[2,108],46:[2,108],51:[2,108],54:[2,108],63:[2,108],64:[2,108],65:[2,108],67:[2,108],69:[2,108],70:[2,108],71:[2,108],75:[2,108],77:[2,108],81:[2,108],82:[2,108],83:[2,108],88:[2,108],90:[2,108],99:[2,108],101:[2,108],102:[2,108],103:[2,108],107:[2,108],115:[2,108],123:[2,108],125:[2,108],126:[2,108],127:[2,108],128:[2,108],129:[2,108],130:[2,108],131:[2,108],132:[2,108],133:[2,108],134:[2,108],135:[2,108]},{5:225,25:[1,5],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,134],6:[2,134],25:[2,134],26:[2,134],46:[2,134],51:[2,134],54:[2,134],69:[2,134],75:[2,134],83:[2,134],88:[2,134],90:[2,134],99:[2,134],100:84,101:[1,62],102:[1,226],103:[1,63],106:85,107:[1,65],108:66,115:[2,134],123:[2,134],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,136],6:[2,136],25:[2,136],26:[2,136],46:[2,136],51:[2,136],54:[2,136],69:[2,136],75:[2,136],83:[2,136],88:[2,136],90:[2,136],99:[2,136],100:84,101:[1,62],102:[1,227],103:[1,63],106:85,107:[1,65],108:66,115:[2,136],123:[2,136],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],46:[2,142],51:[2,142],54:[2,142],69:[2,142],75:[2,142],83:[2,142],88:[2,142],90:[2,142],99:[2,142],101:[2,142],102:[2,142],103:[2,142],107:[2,142],115:[2,142],123:[2,142],125:[2,142],126:[2,142],129:[2,142],130:[2,142],131:[2,142],132:[2,142],133:[2,142],134:[2,142]},{1:[2,143],6:[2,143],25:[2,143],26:[2,143],46:[2,143],51:[2,143],54:[2,143],69:[2,143],75:[2,143],83:[2,143],88:[2,143],90:[2,143],99:[2,143],100:84,101:[1,62],102:[2,143],103:[1,63],106:85,107:[1,65],108:66,115:[2,143],123:[2,143],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],46:[2,147],51:[2,147],54:[2,147],69:[2,147],75:[2,147],83:[2,147],88:[2,147],90:[2,147],99:[2,147],101:[2,147],102:[2,147],103:[2,147],107:[2,147],115:[2,147],123:[2,147],125:[2,147],126:[2,147],129:[2,147],130:[2,147],131:[2,147],132:[2,147],133:[2,147],134:[2,147]},{113:[2,149],114:[2,149]},{27:156,28:[1,70],55:157,56:158,73:[1,67],87:[1,112],110:228,112:155},{51:[1,229],113:[2,154],114:[2,154]},{51:[2,151],113:[2,151],114:[2,151]},{51:[2,152],113:[2,152],114:[2,152]},{51:[2,153],113:[2,153],114:[2,153]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],46:[2,148],51:[2,148],54:[2,148],69:[2,148],75:[2,148],83:[2,148],88:[2,148],90:[2,148],99:[2,148],101:[2,148],102:[2,148],103:[2,148],107:[2,148],115:[2,148],123:[2,148],125:[2,148],126:[2,148],129:[2,148],130:[2,148],131:[2,148],132:[2,148],133:[2,148],134:[2,148]},{8:230,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:231,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,49],25:[2,49],50:232,51:[1,233],75:[2,49]},{6:[2,86],25:[2,86],26:[2,86],51:[2,86],75:[2,86]},{6:[2,35],25:[2,35],26:[2,35],40:[1,234],51:[2,35],75:[2,35]},{6:[2,38],25:[2,38],26:[2,38],51:[2,38],75:[2,38]},{6:[2,39],25:[2,39],26:[2,39],40:[2,39],51:[2,39],75:[2,39]},{6:[2,40],25:[2,40],26:[2,40],40:[2,40],51:[2,40],75:[2,40]},{6:[2,41],25:[2,41],26:[2,41],40:[2,41],51:[2,41],75:[2,41]},{1:[2,5],6:[2,5],26:[2,5],99:[2,5]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],46:[2,25],51:[2,25],54:[2,25],69:[2,25],75:[2,25],83:[2,25],88:[2,25],90:[2,25],95:[2,25],96:[2,25],99:[2,25],101:[2,25],102:[2,25],103:[2,25],107:[2,25],115:[2,25],118:[2,25],120:[2,25],123:[2,25],125:[2,25],126:[2,25],129:[2,25],130:[2,25],131:[2,25],132:[2,25],133:[2,25],134:[2,25]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],46:[2,185],51:[2,185],54:[2,185],69:[2,185],75:[2,185],83:[2,185],88:[2,185],90:[2,185],99:[2,185],100:84,101:[2,185],102:[2,185],103:[2,185],106:85,107:[2,185],108:66,115:[2,185],123:[2,185],125:[2,185],126:[2,185],129:[1,75],130:[1,78],131:[2,185],132:[2,185],133:[2,185],134:[2,185]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],46:[2,186],51:[2,186],54:[2,186],69:[2,186],75:[2,186],83:[2,186],88:[2,186],90:[2,186],99:[2,186],100:84,101:[2,186],102:[2,186],103:[2,186],106:85,107:[2,186],108:66,115:[2,186],123:[2,186],125:[2,186],126:[2,186],129:[1,75],130:[1,78],131:[2,186],132:[2,186],133:[2,186],134:[2,186]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],46:[2,187],51:[2,187],54:[2,187],69:[2,187],75:[2,187],83:[2,187],88:[2,187],90:[2,187],99:[2,187],100:84,101:[2,187],102:[2,187],103:[2,187],106:85,107:[2,187],108:66,115:[2,187],123:[2,187],125:[2,187],126:[2,187],129:[1,75],130:[2,187],131:[2,187],132:[2,187],133:[2,187],134:[2,187]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],46:[2,188],51:[2,188],54:[2,188],69:[2,188],75:[2,188],83:[2,188],88:[2,188],90:[2,188],99:[2,188],100:84,101:[2,188],102:[2,188],103:[2,188],106:85,107:[2,188],108:66,115:[2,188],123:[2,188],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[2,188],132:[2,188],133:[2,188],134:[2,188]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],46:[2,189],51:[2,189],54:[2,189],69:[2,189],75:[2,189],83:[2,189],88:[2,189],90:[2,189],99:[2,189],100:84,101:[2,189],102:[2,189],103:[2,189],106:85,107:[2,189],108:66,115:[2,189],123:[2,189],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[2,189],133:[2,189],134:[1,82]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],46:[2,190],51:[2,190],54:[2,190],69:[2,190],75:[2,190],83:[2,190],88:[2,190],90:[2,190],99:[2,190],100:84,101:[2,190],102:[2,190],103:[2,190],106:85,107:[2,190],108:66,115:[2,190],123:[2,190],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[2,190],134:[1,82]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],46:[2,191],51:[2,191],54:[2,191],69:[2,191],75:[2,191],83:[2,191],88:[2,191],90:[2,191],99:[2,191],100:84,101:[2,191],102:[2,191],103:[2,191],106:85,107:[2,191],108:66,115:[2,191],123:[2,191],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[2,191],133:[2,191],134:[2,191]},{1:[2,176],6:[2,176],25:[2,176],26:[2,176],46:[2,176],51:[2,176],54:[2,176],69:[2,176],75:[2,176],83:[2,176],88:[2,176],90:[2,176],99:[2,176],100:84,101:[1,62],102:[2,176],103:[1,63],106:85,107:[1,65],108:66,115:[2,176],123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,175],6:[2,175],25:[2,175],26:[2,175],46:[2,175],51:[2,175],54:[2,175],69:[2,175],75:[2,175],83:[2,175],88:[2,175],90:[2,175],99:[2,175],100:84,101:[1,62],102:[2,175],103:[1,63],106:85,107:[1,65],108:66,115:[2,175],123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,98],6:[2,98],25:[2,98],26:[2,98],46:[2,98],51:[2,98],54:[2,98],63:[2,98],64:[2,98],65:[2,98],67:[2,98],69:[2,98],70:[2,98],71:[2,98],75:[2,98],81:[2,98],82:[2,98],83:[2,98],88:[2,98],90:[2,98],99:[2,98],101:[2,98],102:[2,98],103:[2,98],107:[2,98],115:[2,98],123:[2,98],125:[2,98],126:[2,98],129:[2,98],130:[2,98],131:[2,98],132:[2,98],133:[2,98],134:[2,98]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],37:[2,74],46:[2,74],51:[2,74],54:[2,74],63:[2,74],64:[2,74],65:[2,74],67:[2,74],69:[2,74],70:[2,74],71:[2,74],75:[2,74],77:[2,74],81:[2,74],82:[2,74],83:[2,74],88:[2,74],90:[2,74],99:[2,74],101:[2,74],102:[2,74],103:[2,74],107:[2,74],115:[2,74],123:[2,74],125:[2,74],126:[2,74],127:[2,74],128:[2,74],129:[2,74],130:[2,74],131:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],37:[2,75],46:[2,75],51:[2,75],54:[2,75],63:[2,75],64:[2,75],65:[2,75],67:[2,75],69:[2,75],70:[2,75],71:[2,75],75:[2,75],77:[2,75],81:[2,75],82:[2,75],83:[2,75],88:[2,75],90:[2,75],99:[2,75],101:[2,75],102:[2,75],103:[2,75],107:[2,75],115:[2,75],123:[2,75],125:[2,75],126:[2,75],127:[2,75],128:[2,75],129:[2,75],130:[2,75],131:[2,75],132:[2,75],133:[2,75],134:[2,75],135:[2,75]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],37:[2,76],46:[2,76],51:[2,76],54:[2,76],63:[2,76],64:[2,76],65:[2,76],67:[2,76],69:[2,76],70:[2,76],71:[2,76],75:[2,76],77:[2,76],81:[2,76],82:[2,76],83:[2,76],88:[2,76],90:[2,76],99:[2,76],101:[2,76],102:[2,76],103:[2,76],107:[2,76],115:[2,76],123:[2,76],125:[2,76],126:[2,76],127:[2,76],128:[2,76],129:[2,76],130:[2,76],131:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76]},{69:[1,235]},{54:[1,189],69:[2,82],89:236,90:[1,188],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{69:[2,83]},{8:237,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{13:[2,111],28:[2,111],30:[2,111],31:[2,111],33:[2,111],34:[2,111],35:[2,111],42:[2,111],43:[2,111],44:[2,111],48:[2,111],49:[2,111],69:[2,111],73:[2,111],76:[2,111],80:[2,111],85:[2,111],86:[2,111],87:[2,111],93:[2,111],97:[2,111],98:[2,111],101:[2,111],103:[2,111],105:[2,111],107:[2,111],116:[2,111],122:[2,111],124:[2,111],125:[2,111],126:[2,111],127:[2,111],128:[2,111]},{13:[2,112],28:[2,112],30:[2,112],31:[2,112],33:[2,112],34:[2,112],35:[2,112],42:[2,112],43:[2,112],44:[2,112],48:[2,112],49:[2,112],69:[2,112],73:[2,112],76:[2,112],80:[2,112],85:[2,112],86:[2,112],87:[2,112],93:[2,112],97:[2,112],98:[2,112],101:[2,112],103:[2,112],105:[2,112],107:[2,112],116:[2,112],122:[2,112],124:[2,112],125:[2,112],126:[2,112],127:[2,112],128:[2,112]},{1:[2,80],6:[2,80],25:[2,80],26:[2,80],37:[2,80],46:[2,80],51:[2,80],54:[2,80],63:[2,80],64:[2,80],65:[2,80],67:[2,80],69:[2,80],70:[2,80],71:[2,80],75:[2,80],77:[2,80],81:[2,80],82:[2,80],83:[2,80],88:[2,80],90:[2,80],99:[2,80],101:[2,80],102:[2,80],103:[2,80],107:[2,80],115:[2,80],123:[2,80],125:[2,80],126:[2,80],127:[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]},{1:[2,81],6:[2,81],25:[2,81],26:[2,81],37:[2,81],46:[2,81],51:[2,81],54:[2,81],63:[2,81],64:[2,81],65:[2,81],67:[2,81],69:[2,81],70:[2,81],71:[2,81],75:[2,81],77:[2,81],81:[2,81],82:[2,81],83:[2,81],88:[2,81],90:[2,81],99:[2,81],101:[2,81],102:[2,81],103:[2,81],107:[2,81],115:[2,81],123:[2,81],125:[2,81],126:[2,81],127:[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]},{1:[2,99],6:[2,99],25:[2,99],26:[2,99],46:[2,99],51:[2,99],54:[2,99],63:[2,99],64:[2,99],65:[2,99],67:[2,99],69:[2,99],70:[2,99],71:[2,99],75:[2,99],81:[2,99],82:[2,99],83:[2,99],88:[2,99],90:[2,99],99:[2,99],101:[2,99],102:[2,99],103:[2,99],107:[2,99],115:[2,99],123:[2,99],125:[2,99],126:[2,99],129:[2,99],130:[2,99],131:[2,99],132:[2,99],133:[2,99],134:[2,99]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],46:[2,33],51:[2,33],54:[2,33],69:[2,33],75:[2,33],83:[2,33],88:[2,33],90:[2,33],99:[2,33],100:84,101:[2,33],102:[2,33],103:[2,33],106:85,107:[2,33],108:66,115:[2,33],123:[2,33],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{8:238,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,104],6:[2,104],25:[2,104],26:[2,104],46:[2,104],51:[2,104],54:[2,104],63:[2,104],64:[2,104],65:[2,104],67:[2,104],69:[2,104],70:[2,104],71:[2,104],75:[2,104],81:[2,104],82:[2,104],83:[2,104],88:[2,104],90:[2,104],99:[2,104],101:[2,104],102:[2,104],103:[2,104],107:[2,104],115:[2,104],123:[2,104],125:[2,104],126:[2,104],129:[2,104],130:[2,104],131:[2,104],132:[2,104],133:[2,104],134:[2,104]},{6:[2,49],25:[2,49],50:239,51:[1,223],83:[2,49]},{6:[2,122],25:[2,122],26:[2,122],51:[2,122],54:[1,240],83:[2,122],88:[2,122],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{47:241,48:[1,57],49:[1,58]},{27:107,28:[1,70],41:108,52:242,53:106,55:109,56:110,73:[1,67],86:[1,111],87:[1,112]},{46:[2,55],51:[2,55]},{8:243,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],46:[2,192],51:[2,192],54:[2,192],69:[2,192],75:[2,192],83:[2,192],88:[2,192],90:[2,192],99:[2,192],100:84,101:[2,192],102:[2,192],103:[2,192],106:85,107:[2,192],108:66,115:[2,192],123:[2,192],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{8:244,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],46:[2,194],51:[2,194],54:[2,194],69:[2,194],75:[2,194],83:[2,194],88:[2,194],90:[2,194],99:[2,194],100:84,101:[2,194],102:[2,194],103:[2,194],106:85,107:[2,194],108:66,115:[2,194],123:[2,194],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,174],6:[2,174],25:[2,174],26:[2,174],46:[2,174],51:[2,174],54:[2,174],69:[2,174],75:[2,174],83:[2,174],88:[2,174],90:[2,174],99:[2,174],101:[2,174],102:[2,174],103:[2,174],107:[2,174],115:[2,174],123:[2,174],125:[2,174],126:[2,174],129:[2,174],130:[2,174],131:[2,174],132:[2,174],133:[2,174],134:[2,174]},{8:245,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,127],6:[2,127],25:[2,127],26:[2,127],46:[2,127],51:[2,127],54:[2,127],69:[2,127],75:[2,127],83:[2,127],88:[2,127],90:[2,127],95:[1,246],99:[2,127],101:[2,127],102:[2,127],103:[2,127],107:[2,127],115:[2,127],123:[2,127],125:[2,127],126:[2,127],129:[2,127],130:[2,127],131:[2,127],132:[2,127],133:[2,127],134:[2,127]},{5:247,25:[1,5]},{27:248,28:[1,70]},{117:249,119:212,120:[1,213]},{26:[1,250],118:[1,251],119:252,120:[1,213]},{26:[2,167],118:[2,167],120:[2,167]},{8:254,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],92:253,93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,92],5:255,6:[2,92],25:[1,5],26:[2,92],46:[2,92],51:[2,92],54:[2,92],59:90,63:[1,92],64:[1,93],65:[1,94],66:95,67:[1,96],69:[2,92],70:[1,97],71:[1,98],75:[2,92],78:89,81:[1,91],82:[2,102],83:[2,92],88:[2,92],90:[2,92],99:[2,92],101:[2,92],102:[2,92],103:[2,92],107:[2,92],115:[2,92],123:[2,92],125:[2,92],126:[2,92],129:[2,92],130:[2,92],131:[2,92],132:[2,92],133:[2,92],134:[2,92]},{1:[2,66],6:[2,66],25:[2,66],26:[2,66],46:[2,66],51:[2,66],54:[2,66],63:[2,66],64:[2,66],65:[2,66],67:[2,66],69:[2,66],70:[2,66],71:[2,66],75:[2,66],81:[2,66],82:[2,66],83:[2,66],88:[2,66],90:[2,66],99:[2,66],101:[2,66],102:[2,66],103:[2,66],107:[2,66],115:[2,66],123:[2,66],125:[2,66],126:[2,66],129:[2,66],130:[2,66],131:[2,66],132:[2,66],133:[2,66],134:[2,66]},{1:[2,95],6:[2,95],25:[2,95],26:[2,95],46:[2,95],51:[2,95],54:[2,95],69:[2,95],75:[2,95],83:[2,95],88:[2,95],90:[2,95],99:[2,95],101:[2,95],102:[2,95],103:[2,95],107:[2,95],115:[2,95],123:[2,95],125:[2,95],126:[2,95],129:[2,95],130:[2,95],131:[2,95],132:[2,95],133:[2,95],134:[2,95]},{14:256,15:120,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:121,41:60,55:47,56:48,58:215,60:25,61:26,62:27,73:[1,67],80:[1,28],85:[1,55],86:[1,56],87:[1,54],98:[1,53]},{1:[2,132],6:[2,132],25:[2,132],26:[2,132],46:[2,132],51:[2,132],54:[2,132],63:[2,132],64:[2,132],65:[2,132],67:[2,132],69:[2,132],70:[2,132],71:[2,132],75:[2,132],81:[2,132],82:[2,132],83:[2,132],88:[2,132],90:[2,132],99:[2,132],101:[2,132],102:[2,132],103:[2,132],107:[2,132],115:[2,132],123:[2,132],125:[2,132],126:[2,132],129:[2,132],130:[2,132],131:[2,132],132:[2,132],133:[2,132],134:[2,132]},{6:[1,71],26:[1,257]},{8:258,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,61],13:[2,112],25:[2,61],28:[2,112],30:[2,112],31:[2,112],33:[2,112],34:[2,112],35:[2,112],42:[2,112],43:[2,112],44:[2,112],48:[2,112],49:[2,112],51:[2,61],73:[2,112],76:[2,112],80:[2,112],85:[2,112],86:[2,112],87:[2,112],88:[2,61],93:[2,112],97:[2,112],98:[2,112],101:[2,112],103:[2,112],105:[2,112],107:[2,112],116:[2,112],122:[2,112],124:[2,112],125:[2,112],126:[2,112],127:[2,112],128:[2,112]},{6:[1,260],25:[1,261],88:[1,259]},{6:[2,50],8:197,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[2,50],26:[2,50],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,57:145,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],83:[2,50],85:[1,55],86:[1,56],87:[1,54],88:[2,50],91:262,93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,49],25:[2,49],26:[2,49],50:263,51:[1,223]},{1:[2,171],6:[2,171],25:[2,171],26:[2,171],46:[2,171],51:[2,171],54:[2,171],69:[2,171],75:[2,171],83:[2,171],88:[2,171],90:[2,171],99:[2,171],101:[2,171],102:[2,171],103:[2,171],107:[2,171],115:[2,171],118:[2,171],123:[2,171],125:[2,171],126:[2,171],129:[2,171],130:[2,171],131:[2,171],132:[2,171],133:[2,171],134:[2,171]},{8:264,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:265,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{113:[2,150],114:[2,150]},{27:156,28:[1,70],55:157,56:158,73:[1,67],87:[1,112],112:266},{1:[2,156],6:[2,156],25:[2,156],26:[2,156],46:[2,156],51:[2,156],54:[2,156],69:[2,156],75:[2,156],83:[2,156],88:[2,156],90:[2,156],99:[2,156],100:84,101:[2,156],102:[1,267],103:[2,156],106:85,107:[2,156],108:66,115:[1,268],123:[2,156],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,157],6:[2,157],25:[2,157],26:[2,157],46:[2,157],51:[2,157],54:[2,157],69:[2,157],75:[2,157],83:[2,157],88:[2,157],90:[2,157],99:[2,157],100:84,101:[2,157],102:[1,269],103:[2,157],106:85,107:[2,157],108:66,115:[2,157],123:[2,157],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{6:[1,271],25:[1,272],75:[1,270]},{6:[2,50],12:165,25:[2,50],26:[2,50],27:166,28:[1,70],29:167,30:[1,68],31:[1,69],38:273,39:164,41:168,43:[1,46],75:[2,50],86:[1,111]},{8:274,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,275],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],37:[2,79],46:[2,79],51:[2,79],54:[2,79],63:[2,79],64:[2,79],65:[2,79],67:[2,79],69:[2,79],70:[2,79],71:[2,79],75:[2,79],77:[2,79],81:[2,79],82:[2,79],83:[2,79],88:[2,79],90:[2,79],99:[2,79],101:[2,79],102:[2,79],103:[2,79],107:[2,79],115:[2,79],123:[2,79],125:[2,79],126:[2,79],127:[2,79],128:[2,79],129:[2,79],130:[2,79],131:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79]},{8:276,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,69:[2,115],73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{69:[2,116],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{26:[1,277],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{6:[1,260],25:[1,261],83:[1,278]},{6:[2,61],25:[2,61],26:[2,61],51:[2,61],83:[2,61],88:[2,61]},{5:279,25:[1,5]},{46:[2,53],51:[2,53]},{46:[2,56],51:[2,56],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{26:[1,280],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{5:281,25:[1,5],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{5:282,25:[1,5]},{1:[2,128],6:[2,128],25:[2,128],26:[2,128],46:[2,128],51:[2,128],54:[2,128],69:[2,128],75:[2,128],83:[2,128],88:[2,128],90:[2,128],99:[2,128],101:[2,128],102:[2,128],103:[2,128],107:[2,128],115:[2,128],123:[2,128],125:[2,128],126:[2,128],129:[2,128],130:[2,128],131:[2,128],132:[2,128],133:[2,128],134:[2,128]},{5:283,25:[1,5]},{26:[1,284],118:[1,285],119:252,120:[1,213]},{1:[2,165],6:[2,165],25:[2,165],26:[2,165],46:[2,165],51:[2,165],54:[2,165],69:[2,165],75:[2,165],83:[2,165],88:[2,165],90:[2,165],99:[2,165],101:[2,165],102:[2,165],103:[2,165],107:[2,165],115:[2,165],123:[2,165],125:[2,165],126:[2,165],129:[2,165],130:[2,165],131:[2,165],132:[2,165],133:[2,165],134:[2,165]},{5:286,25:[1,5]},{26:[2,168],118:[2,168],120:[2,168]},{5:287,25:[1,5],51:[1,288]},{25:[2,124],51:[2,124],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,93],6:[2,93],25:[2,93],26:[2,93],46:[2,93],51:[2,93],54:[2,93],69:[2,93],75:[2,93],83:[2,93],88:[2,93],90:[2,93],99:[2,93],101:[2,93],102:[2,93],103:[2,93],107:[2,93],115:[2,93],123:[2,93],125:[2,93],126:[2,93],129:[2,93],130:[2,93],131:[2,93],132:[2,93],133:[2,93],134:[2,93]},{1:[2,96],5:289,6:[2,96],25:[1,5],26:[2,96],46:[2,96],51:[2,96],54:[2,96],59:90,63:[1,92],64:[1,93],65:[1,94],66:95,67:[1,96],69:[2,96],70:[1,97],71:[1,98],75:[2,96],78:89,81:[1,91],82:[2,102],83:[2,96],88:[2,96],90:[2,96],99:[2,96],101:[2,96],102:[2,96],103:[2,96],107:[2,96],115:[2,96],123:[2,96],125:[2,96],126:[2,96],129:[2,96],130:[2,96],131:[2,96],132:[2,96],133:[2,96],134:[2,96]},{99:[1,290]},{88:[1,291],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,110],6:[2,110],25:[2,110],26:[2,110],37:[2,110],46:[2,110],51:[2,110],54:[2,110],63:[2,110],64:[2,110],65:[2,110],67:[2,110],69:[2,110],70:[2,110],71:[2,110],75:[2,110],81:[2,110],82:[2,110],83:[2,110],88:[2,110],90:[2,110],99:[2,110],101:[2,110],102:[2,110],103:[2,110],107:[2,110],113:[2,110],114:[2,110],115:[2,110],123:[2,110],125:[2,110],126:[2,110],129:[2,110],130:[2,110],131:[2,110],132:[2,110],133:[2,110],134:[2,110]},{8:197,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,57:145,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],91:292,93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:197,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,25:[1,144],27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,57:145,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],84:293,85:[1,55],86:[1,56],87:[1,54],91:143,93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,118],25:[2,118],26:[2,118],51:[2,118],83:[2,118],88:[2,118]},{6:[1,260],25:[1,261],26:[1,294]},{1:[2,135],6:[2,135],25:[2,135],26:[2,135],46:[2,135],51:[2,135],54:[2,135],69:[2,135],75:[2,135],83:[2,135],88:[2,135],90:[2,135],99:[2,135],100:84,101:[1,62],102:[2,135],103:[1,63],106:85,107:[1,65],108:66,115:[2,135],123:[2,135],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,137],6:[2,137],25:[2,137],26:[2,137],46:[2,137],51:[2,137],54:[2,137],69:[2,137],75:[2,137],83:[2,137],88:[2,137],90:[2,137],99:[2,137],100:84,101:[1,62],102:[2,137],103:[1,63],106:85,107:[1,65],108:66,115:[2,137],123:[2,137],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{113:[2,155],114:[2,155]},{8:295,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:296,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:297,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,84],6:[2,84],25:[2,84],26:[2,84],37:[2,84],46:[2,84],51:[2,84],54:[2,84],63:[2,84],64:[2,84],65:[2,84],67:[2,84],69:[2,84],70:[2,84],71:[2,84],75:[2,84],81:[2,84],82:[2,84],83:[2,84],88:[2,84],90:[2,84],99:[2,84],101:[2,84],102:[2,84],103:[2,84],107:[2,84],113:[2,84],114:[2,84],115:[2,84],123:[2,84],125:[2,84],126:[2,84],129:[2,84],130:[2,84],131:[2,84],132:[2,84],133:[2,84],134:[2,84]},{12:165,27:166,28:[1,70],29:167,30:[1,68],31:[1,69],38:298,39:164,41:168,43:[1,46],86:[1,111]},{6:[2,85],12:165,25:[2,85],26:[2,85],27:166,28:[1,70],29:167,30:[1,68],31:[1,69],38:163,39:164,41:168,43:[1,46],51:[2,85],74:299,86:[1,111]},{6:[2,87],25:[2,87],26:[2,87],51:[2,87],75:[2,87]},{6:[2,36],25:[2,36],26:[2,36],51:[2,36],75:[2,36],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{8:300,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{69:[2,114],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],46:[2,34],51:[2,34],54:[2,34],69:[2,34],75:[2,34],83:[2,34],88:[2,34],90:[2,34],99:[2,34],101:[2,34],102:[2,34],103:[2,34],107:[2,34],115:[2,34],123:[2,34],125:[2,34],126:[2,34],129:[2,34],130:[2,34],131:[2,34],132:[2,34],133:[2,34],134:[2,34]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],46:[2,105],51:[2,105],54:[2,105],63:[2,105],64:[2,105],65:[2,105],67:[2,105],69:[2,105],70:[2,105],71:[2,105],75:[2,105],81:[2,105],82:[2,105],83:[2,105],88:[2,105],90:[2,105],99:[2,105],101:[2,105],102:[2,105],103:[2,105],107:[2,105],115:[2,105],123:[2,105],125:[2,105],126:[2,105],129:[2,105],130:[2,105],131:[2,105],132:[2,105],133:[2,105],134:[2,105]},{1:[2,45],6:[2,45],25:[2,45],26:[2,45],46:[2,45],51:[2,45],54:[2,45],69:[2,45],75:[2,45],83:[2,45],88:[2,45],90:[2,45],99:[2,45],101:[2,45],102:[2,45],103:[2,45],107:[2,45],115:[2,45],123:[2,45],125:[2,45],126:[2,45],129:[2,45],130:[2,45],131:[2,45],132:[2,45],133:[2,45],134:[2,45]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],46:[2,193],51:[2,193],54:[2,193],69:[2,193],75:[2,193],83:[2,193],88:[2,193],90:[2,193],99:[2,193],101:[2,193],102:[2,193],103:[2,193],107:[2,193],115:[2,193],123:[2,193],125:[2,193],126:[2,193],129:[2,193],130:[2,193],131:[2,193],132:[2,193],133:[2,193],134:[2,193]},{1:[2,172],6:[2,172],25:[2,172],26:[2,172],46:[2,172],51:[2,172],54:[2,172],69:[2,172],75:[2,172],83:[2,172],88:[2,172],90:[2,172],99:[2,172],101:[2,172],102:[2,172],103:[2,172],107:[2,172],115:[2,172],118:[2,172],123:[2,172],125:[2,172],126:[2,172],129:[2,172],130:[2,172],131:[2,172],132:[2,172],133:[2,172],134:[2,172]},{1:[2,129],6:[2,129],25:[2,129],26:[2,129],46:[2,129],51:[2,129],54:[2,129],69:[2,129],75:[2,129],83:[2,129],88:[2,129],90:[2,129],99:[2,129],101:[2,129],102:[2,129],103:[2,129],107:[2,129],115:[2,129],123:[2,129],125:[2,129],126:[2,129],129:[2,129],130:[2,129],131:[2,129],132:[2,129],133:[2,129],134:[2,129]},{1:[2,130],6:[2,130],25:[2,130],26:[2,130],46:[2,130],51:[2,130],54:[2,130],69:[2,130],75:[2,130],83:[2,130],88:[2,130],90:[2,130],95:[2,130],99:[2,130],101:[2,130],102:[2,130],103:[2,130],107:[2,130],115:[2,130],123:[2,130],125:[2,130],126:[2,130],129:[2,130],130:[2,130],131:[2,130],132:[2,130],133:[2,130],134:[2,130]},{1:[2,163],6:[2,163],25:[2,163],26:[2,163],46:[2,163],51:[2,163],54:[2,163],69:[2,163],75:[2,163],83:[2,163],88:[2,163],90:[2,163],99:[2,163],101:[2,163],102:[2,163],103:[2,163],107:[2,163],115:[2,163],123:[2,163],125:[2,163],126:[2,163],129:[2,163],130:[2,163],131:[2,163],132:[2,163],133:[2,163],134:[2,163]},{5:301,25:[1,5]},{26:[1,302]},{6:[1,303],26:[2,169],118:[2,169],120:[2,169]},{8:304,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,97],6:[2,97],25:[2,97],26:[2,97],46:[2,97],51:[2,97],54:[2,97],69:[2,97],75:[2,97],83:[2,97],88:[2,97],90:[2,97],99:[2,97],101:[2,97],102:[2,97],103:[2,97],107:[2,97],115:[2,97],123:[2,97],125:[2,97],126:[2,97],129:[2,97],130:[2,97],131:[2,97],132:[2,97],133:[2,97],134:[2,97]},{1:[2,133],6:[2,133],25:[2,133],26:[2,133],46:[2,133],51:[2,133],54:[2,133],63:[2,133],64:[2,133],65:[2,133],67:[2,133],69:[2,133],70:[2,133],71:[2,133],75:[2,133],81:[2,133],82:[2,133],83:[2,133],88:[2,133],90:[2,133],99:[2,133],101:[2,133],102:[2,133],103:[2,133],107:[2,133],115:[2,133],123:[2,133],125:[2,133],126:[2,133],129:[2,133],130:[2,133],131:[2,133],132:[2,133],133:[2,133],134:[2,133]},{1:[2,113],6:[2,113],25:[2,113],26:[2,113],46:[2,113],51:[2,113],54:[2,113],63:[2,113],64:[2,113],65:[2,113],67:[2,113],69:[2,113],70:[2,113],71:[2,113],75:[2,113],81:[2,113],82:[2,113],83:[2,113],88:[2,113],90:[2,113],99:[2,113],101:[2,113],102:[2,113],103:[2,113],107:[2,113],115:[2,113],123:[2,113],125:[2,113],126:[2,113],129:[2,113],130:[2,113],131:[2,113],132:[2,113],133:[2,113],134:[2,113]},{6:[2,119],25:[2,119],26:[2,119],51:[2,119],83:[2,119],88:[2,119]},{6:[2,49],25:[2,49],26:[2,49],50:305,51:[1,223]},{6:[2,120],25:[2,120],26:[2,120],51:[2,120],83:[2,120],88:[2,120]},{1:[2,158],6:[2,158],25:[2,158],26:[2,158],46:[2,158],51:[2,158],54:[2,158],69:[2,158],75:[2,158],83:[2,158],88:[2,158],90:[2,158],99:[2,158],100:84,101:[2,158],102:[2,158],103:[2,158],106:85,107:[2,158],108:66,115:[1,306],123:[2,158],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,160],6:[2,160],25:[2,160],26:[2,160],46:[2,160],51:[2,160],54:[2,160],69:[2,160],75:[2,160],83:[2,160],88:[2,160],90:[2,160],99:[2,160],100:84,101:[2,160],102:[1,307],103:[2,160],106:85,107:[2,160],108:66,115:[2,160],123:[2,160],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,159],6:[2,159],25:[2,159],26:[2,159],46:[2,159],51:[2,159],54:[2,159],69:[2,159],75:[2,159],83:[2,159],88:[2,159],90:[2,159],99:[2,159],100:84,101:[2,159],102:[2,159],103:[2,159],106:85,107:[2,159],108:66,115:[2,159],123:[2,159],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{6:[2,88],25:[2,88],26:[2,88],51:[2,88],75:[2,88]},{6:[2,49],25:[2,49],26:[2,49],50:308,51:[1,233]},{26:[1,309],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{26:[1,310]},{1:[2,166],6:[2,166],25:[2,166],26:[2,166],46:[2,166],51:[2,166],54:[2,166],69:[2,166],75:[2,166],83:[2,166],88:[2,166],90:[2,166],99:[2,166],101:[2,166],102:[2,166],103:[2,166],107:[2,166],115:[2,166],123:[2,166],125:[2,166],126:[2,166],129:[2,166],130:[2,166],131:[2,166],132:[2,166],133:[2,166],134:[2,166]},{26:[2,170],118:[2,170],120:[2,170]},{25:[2,125],51:[2,125],100:84,101:[1,62],103:[1,63],106:85,107:[1,65],108:66,123:[1,83],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{6:[1,260],25:[1,261],26:[1,311]},{8:312,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:313,9:115,10:19,11:20,12:21,13:[1,22],14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:18,27:59,28:[1,70],29:49,30:[1,68],31:[1,69],32:24,33:[1,50],34:[1,51],35:[1,52],36:23,41:60,42:[1,44],43:[1,46],44:[1,29],47:30,48:[1,57],49:[1,58],55:47,56:48,58:36,60:25,61:26,62:27,73:[1,67],76:[1,43],80:[1,28],85:[1,55],86:[1,56],87:[1,54],93:[1,38],97:[1,45],98:[1,53],100:39,101:[1,62],103:[1,63],104:40,105:[1,64],106:41,107:[1,65],108:66,116:[1,42],121:37,122:[1,61],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[1,271],25:[1,272],26:[1,314]},{6:[2,37],25:[2,37],26:[2,37],51:[2,37],75:[2,37]},{1:[2,164],6:[2,164],25:[2,164],26:[2,164],46:[2,164],51:[2,164],54:[2,164],69:[2,164],75:[2,164],83:[2,164],88:[2,164],90:[2,164],99:[2,164],101:[2,164],102:[2,164],103:[2,164],107:[2,164],115:[2,164],123:[2,164],125:[2,164],126:[2,164],129:[2,164],130:[2,164],131:[2,164],132:[2,164],133:[2,164],134:[2,164]},{6:[2,121],25:[2,121],26:[2,121],51:[2,121],83:[2,121],88:[2,121]},{1:[2,161],6:[2,161],25:[2,161],26:[2,161],46:[2,161],51:[2,161],54:[2,161],69:[2,161],75:[2,161],83:[2,161],88:[2,161],90:[2,161],99:[2,161],100:84,101:[2,161],102:[2,161],103:[2,161],106:85,107:[2,161],108:66,115:[2,161],123:[2,161],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{1:[2,162],6:[2,162],25:[2,162],26:[2,162],46:[2,162],51:[2,162],54:[2,162],69:[2,162],75:[2,162],83:[2,162],88:[2,162],90:[2,162],99:[2,162],100:84,101:[2,162],102:[2,162],103:[2,162],106:85,107:[2,162],108:66,115:[2,162],123:[2,162],125:[1,77],126:[1,76],129:[1,75],130:[1,78],131:[1,79],132:[1,80],133:[1,81],134:[1,82]},{6:[2,89],25:[2,89],26:[2,89],51:[2,89],75:[2,89]}], -defaultActions: {57:[2,47],58:[2,48],72:[2,3],91:[2,103],186:[2,83]}, -parseError: function parseError(str, hash) { - throw new Error(str); -}, -parse: function parse(input) { - var self = this, - stack = [0], - vstack = [null], // semantic value stack - lstack = [], // location stack - table = this.table, - yytext = '', - yylineno = 0, - yyleng = 0, - recovering = 0, - TERROR = 2, - EOF = 1; - - //this.reductionCount = this.shiftCount = 0; - - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - if (typeof this.lexer.yylloc == 'undefined') - this.lexer.yylloc = {}; - var yyloc = this.lexer.yylloc; - lstack.push(yyloc); - - if (typeof this.yy.parseError === 'function') - this.parseError = this.yy.parseError; - - function popStack (n) { - stack.length = stack.length - 2*n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - - function lex() { - var token; - token = self.lexer.lex() || 1; // $end = 1 - // if token isn't its numeric value, convert - if (typeof token !== 'number') { - token = self.symbols_[token] || token; - } - return token; - }; - - var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected; - while (true) { - // retreive state number from top of stack - state = stack[stack.length-1]; - - // use default actions if available - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol == null) - symbol = lex(); - // read action for current state and first input - action = table[state] && table[state][symbol]; - } - - // handle parse error - if (typeof action === 'undefined' || !action.length || !action[0]) { - - if (!recovering) { - // Report error - expected = []; - for (p in table[state]) if (this.terminals_[p] && p > 2) { - expected.push("'"+this.terminals_[p]+"'"); - } - var errStr = ''; - if (this.lexer.showPosition) { - errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+'\nExpecting '+expected.join(', '); - } else { - errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " + - (symbol == 1 /*EOF*/ ? "end of input" : - ("'"+(this.terminals_[symbol] || symbol)+"'")); - } - this.parseError(errStr, - {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); - } - - // just recovered from another error - if (recovering == 3) { - if (symbol == EOF) { - throw new Error(errStr || 'Parsing halted.'); - } - - // discard current lookahead and grab another - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - symbol = lex(); - } - - // try to recover from error - while (1) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - break; - } - if (state == 0) { - throw new Error(errStr || 'Parsing halted.'); - } - popStack(1); - state = stack[stack.length-1]; - } - - preErrorSymbol = symbol; // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length-1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error - } - - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); - } - - switch (action[0]) { - - case 1: // shift - //this.shiftCount++; - - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); // push state - symbol = null; - if (!preErrorSymbol) { // normal execution/no error - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) - recovering--; - } else { // error just occurred, resume old lookahead f/ before error - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - - case 2: // reduce - //this.reductionCount++; - - len = this.productions_[action[1]][1]; - - // perform semantic action - yyval.$ = vstack[vstack.length-len]; // default to $$ = $1 - // default location, uses first token for firsts, last for lasts - 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 - }; - r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); - - if (typeof r !== 'undefined') { - return r; - } - - // pop off stack - if (len) { - stack = stack.slice(0,-1*len*2); - vstack = vstack.slice(0, -1*len); - lstack = lstack.slice(0, -1*len); - } - - stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) - vstack.push(yyval.$); - lstack.push(yyval._$); - // goto new state = table[STATE][NONTERMINAL] - newState = table[stack[stack.length-2]][stack[stack.length-1]]; - stack.push(newState); - break; - - case 3: // accept - return true; - } - - } - - return true; -}}; -return parser; -})(); -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = parser; -exports.parse = function () { return parser.parse.apply(parser, arguments); } -exports.main = function commonjsMain(args) { - if (!args[1]) - throw new Error('Usage: '+args[0]+' FILE'); - if (typeof process !== 'undefined') { - var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); - } else { - var cwd = require("file").path(require("file").cwd()); - var source = cwd.join(args[1]).read({charset: "utf-8"}); - } - return exports.parser.parse(source); -} -if (typeof module !== 'undefined' && require.main === module) { - exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); -} -} \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/repl.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/repl.js deleted file mode 100644 index 9e1bf7c7..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/repl.js +++ /dev/null @@ -1,123 +0,0 @@ -(function() { - var ACCESSOR, CoffeeScript, Module, REPL_PROMPT, REPL_PROMPT_CONTINUATION, SIMPLEVAR, Script, autocomplete, backlog, completeAttribute, completeVariable, enableColours, error, g, getCompletions, inspect, nonContextGlobals, readline, repl, run, sandbox, stdin, stdout, _i, _len; - CoffeeScript = require('./coffee-script'); - readline = require('readline'); - inspect = require('util').inspect; - Script = require('vm').Script; - Module = require('module'); - REPL_PROMPT = 'coffee> '; - REPL_PROMPT_CONTINUATION = '......> '; - enableColours = false; - if (process.platform !== 'win32') { - enableColours = !process.env.NODE_DISABLE_COLORS; - } - stdin = process.openStdin(); - stdout = process.stdout; - error = function(err) { - return stdout.write((err.stack || err.toString()) + '\n\n'); - }; - backlog = ''; - sandbox = Script.createContext(); - nonContextGlobals = ['Buffer', 'console', 'process', 'setInterval', 'clearInterval', 'setTimeout', 'clearTimeout']; - for (_i = 0, _len = nonContextGlobals.length; _i < _len; _i++) { - g = nonContextGlobals[_i]; - sandbox[g] = global[g]; - } - sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox; - run = function(buffer) { - var code, returnValue, _; - if (!buffer.toString().trim() && !backlog) { - repl.prompt(); - return; - } - code = backlog += buffer; - if (code[code.length - 1] === '\\') { - backlog = "" + backlog.slice(0, -1) + "\n"; - repl.setPrompt(REPL_PROMPT_CONTINUATION); - repl.prompt(); - return; - } - repl.setPrompt(REPL_PROMPT); - backlog = ''; - try { - _ = sandbox._; - returnValue = CoffeeScript.eval("_=(" + code + "\n)", { - sandbox: sandbox, - filename: 'repl', - modulename: 'repl' - }); - if (returnValue === void 0) { - sandbox._ = _; - } else { - process.stdout.write(inspect(returnValue, false, 2, enableColours) + '\n'); - } - } catch (err) { - error(err); - } - return repl.prompt(); - }; - ACCESSOR = /\s*([\w\.]+)(?:\.(\w*))$/; - SIMPLEVAR = /\s*(\w*)$/i; - autocomplete = function(text) { - return completeAttribute(text) || completeVariable(text) || [[], text]; - }; - completeAttribute = function(text) { - var all, completions, match, obj, prefix, val; - if (match = text.match(ACCESSOR)) { - all = match[0], obj = match[1], prefix = match[2]; - try { - val = Script.runInContext(obj, sandbox); - } catch (error) { - return; - } - completions = getCompletions(prefix, Object.getOwnPropertyNames(val)); - return [completions, prefix]; - } - }; - completeVariable = function(text) { - var completions, free, possibilities, vars, _ref; - if (free = (_ref = text.match(SIMPLEVAR)) != null ? _ref[1] : void 0) { - vars = Script.runInContext('Object.getOwnPropertyNames(this)', sandbox); - possibilities = vars.concat(CoffeeScript.RESERVED); - completions = getCompletions(free, possibilities); - return [completions, free]; - } - }; - getCompletions = function(prefix, candidates) { - var el, _j, _len2, _results; - _results = []; - for (_j = 0, _len2 = candidates.length; _j < _len2; _j++) { - el = candidates[_j]; - if (el.indexOf(prefix) === 0) { - _results.push(el); - } - } - return _results; - }; - process.on('uncaughtException', error); - if (readline.createInterface.length < 3) { - repl = readline.createInterface(stdin, autocomplete); - stdin.on('data', function(buffer) { - return repl.write(buffer); - }); - } else { - repl = readline.createInterface(stdin, stdout, autocomplete); - } - repl.on('attemptClose', function() { - if (backlog) { - backlog = ''; - process.stdout.write('\n'); - repl.setPrompt(REPL_PROMPT); - return repl.prompt(); - } else { - return repl.close(); - } - }); - repl.on('close', function() { - process.stdout.write('\n'); - return stdin.destroy(); - }); - repl.on('line', run); - repl.setPrompt(REPL_PROMPT); - repl.prompt(); -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/rewriter.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/rewriter.js deleted file mode 100644 index d50a222c..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/rewriter.js +++ /dev/null @@ -1,363 +0,0 @@ -(function() { - 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, left, rite, _i, _len, _ref; - var __indexOf = Array.prototype.indexOf || function(item) { - for (var i = 0, l = this.length; i < l; i++) { - if (this[i] === item) return i; - } - return -1; - }, __slice = Array.prototype.slice; - exports.Rewriter = (function() { - function Rewriter() {} - Rewriter.prototype.rewrite = function(tokens) { - this.tokens = tokens; - this.removeLeadingNewlines(); - this.removeMidExpressionNewlines(); - this.closeOpenCalls(); - this.closeOpenIndexes(); - this.addImplicitIndentation(); - this.tagPostfixConditionals(); - this.addImplicitBraces(); - this.addImplicitParentheses(); - this.ensureBalance(BALANCED_PAIRS); - this.rewriteClosingParens(); - return this.tokens; - }; - Rewriter.prototype.scanTokens = function(block) { - var i, token, tokens; - tokens = this.tokens; - i = 0; - while (token = tokens[i]) { - i += block.call(this, token, i, tokens); - } - return true; - }; - Rewriter.prototype.detectEnd = function(i, condition, action) { - var levels, token, tokens, _ref, _ref2; - tokens = this.tokens; - levels = 0; - while (token = tokens[i]) { - if (levels === 0 && condition.call(this, token, i)) { - return action.call(this, token, i); - } - if (!token || levels < 0) { - return action.call(this, token, i - 1); - } - if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) { - levels += 1; - } else if (_ref2 = token[0], __indexOf.call(EXPRESSION_END, _ref2) >= 0) { - levels -= 1; - } - i += 1; - } - return i - 1; - }; - Rewriter.prototype.removeLeadingNewlines = function() { - var i, tag, _len, _ref; - _ref = this.tokens; - for (i = 0, _len = _ref.length; i < _len; i++) { - tag = _ref[i][0]; - if (tag !== 'TERMINATOR') { - break; - } - } - if (i) { - return this.tokens.splice(0, i); - } - }; - Rewriter.prototype.removeMidExpressionNewlines = function() { - return this.scanTokens(function(token, i, tokens) { - var _ref; - if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) { - return 1; - } - tokens.splice(i, 1); - return 0; - }); - }; - Rewriter.prototype.closeOpenCalls = function() { - var action, condition; - condition = function(token, i) { - var _ref; - return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')'; - }; - action = function(token, i) { - return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END'; - }; - return this.scanTokens(function(token, i) { - if (token[0] === 'CALL_START') { - this.detectEnd(i + 1, condition, action); - } - return 1; - }); - }; - Rewriter.prototype.closeOpenIndexes = function() { - var action, condition; - condition = function(token, i) { - var _ref; - return (_ref = token[0]) === ']' || _ref === 'INDEX_END'; - }; - action = function(token, i) { - return token[0] = 'INDEX_END'; - }; - return this.scanTokens(function(token, i) { - if (token[0] === 'INDEX_START') { - this.detectEnd(i + 1, condition, action); - } - return 1; - }); - }; - Rewriter.prototype.addImplicitBraces = function() { - var action, condition, stack, start, startIndent; - stack = []; - start = null; - startIndent = 0; - condition = function(token, i) { - var one, tag, three, two, _ref, _ref2; - _ref = this.tokens.slice(i + 1, (i + 3 + 1) || 9e9), one = _ref[0], two = _ref[1], three = _ref[2]; - if ('HERECOMMENT' === (one != null ? one[0] : void 0)) { - return false; - } - tag = token[0]; - return ((tag === 'TERMINATOR' || tag === 'OUTDENT') && !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':')) || (tag === ',' && one && ((_ref2 = one[0]) !== 'IDENTIFIER' && _ref2 !== 'NUMBER' && _ref2 !== 'STRING' && _ref2 !== '@' && _ref2 !== 'TERMINATOR' && _ref2 !== 'OUTDENT')); - }; - action = function(token, i) { - var tok; - tok = ['}', '}', token[2]]; - tok.generated = true; - return this.tokens.splice(i, 0, tok); - }; - return this.scanTokens(function(token, i, tokens) { - var ago, idx, tag, tok, value, _ref, _ref2; - if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) { - stack.push([(tag === 'INDENT' && this.tag(i - 1) === '{' ? '{' : tag), i]); - return 1; - } - if (__indexOf.call(EXPRESSION_END, tag) >= 0) { - start = stack.pop(); - return 1; - } - if (!(tag === ':' && ((ago = this.tag(i - 2)) === ':' || ((_ref2 = stack[stack.length - 1]) != null ? _ref2[0] : void 0) !== '{'))) { - return 1; - } - stack.push(['{']); - idx = ago === '@' ? i - 2 : i - 1; - while (this.tag(idx - 2) === 'HERECOMMENT') { - idx -= 2; - } - value = new String('{'); - value.generated = true; - tok = ['{', value, token[2]]; - tok.generated = true; - tokens.splice(idx, 0, tok); - this.detectEnd(i + 2, condition, action); - return 2; - }); - }; - Rewriter.prototype.addImplicitParentheses = function() { - var action, noCall; - noCall = false; - action = function(token, i) { - var idx; - idx = token[0] === 'OUTDENT' ? i + 1 : i; - return this.tokens.splice(idx, 0, ['CALL_END', ')', token[2]]); - }; - return this.scanTokens(function(token, i, tokens) { - var callObject, current, next, prev, seenControl, seenSingle, tag, _ref, _ref2, _ref3; - tag = token[0]; - if (tag === 'CLASS' || tag === 'IF') { - noCall = true; - } - _ref = tokens.slice(i - 1, (i + 1 + 1) || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2]; - callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0); - seenSingle = false; - seenControl = false; - if (__indexOf.call(LINEBREAKS, tag) >= 0) { - noCall = false; - } - if (prev && !prev.spaced && tag === '?') { - token.call = true; - } - if (token.fromThen) { - return 1; - } - if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref3 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref3) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) { - return 1; - } - tokens.splice(i, 0, ['CALL_START', '(', token[2]]); - this.detectEnd(i + 1, function(token, i) { - var post, _ref4; - tag = token[0]; - if (!seenSingle && token.fromThen) { - return true; - } - if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>') { - seenSingle = true; - } - if (tag === 'IF' || tag === 'ELSE' || tag === 'SWITCH' || tag === 'TRY') { - seenControl = true; - } - if ((tag === '.' || tag === '?.' || tag === '::') && this.tag(i - 1) === 'OUTDENT') { - return true; - } - return !token.generated && this.tag(i - 1) !== ',' && (__indexOf.call(IMPLICIT_END, tag) >= 0 || (tag === 'INDENT' && !seenControl)) && (tag !== 'INDENT' || (this.tag(i - 2) !== 'CLASS' && (_ref4 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref4) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{'))); - }, action); - if (prev[0] === '?') { - prev[0] = 'FUNC_EXIST'; - } - return 2; - }); - }; - Rewriter.prototype.addImplicitIndentation = function() { - return this.scanTokens(function(token, i, tokens) { - var action, condition, indent, outdent, starter, tag, _ref, _ref2; - tag = token[0]; - if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') { - tokens.splice(i, 1); - return 0; - } - if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') { - tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation(token)))); - return 2; - } - if (tag === 'CATCH' && ((_ref = this.tag(i + 2)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) { - tokens.splice.apply(tokens, [i + 2, 0].concat(__slice.call(this.indentation(token)))); - return 4; - } - if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) { - starter = tag; - _ref2 = this.indentation(token), indent = _ref2[0], outdent = _ref2[1]; - if (starter === 'THEN') { - indent.fromThen = true; - } - indent.generated = outdent.generated = true; - tokens.splice(i + 1, 0, indent); - condition = function(token, i) { - var _ref3; - return token[1] !== ';' && (_ref3 = token[0], __indexOf.call(SINGLE_CLOSERS, _ref3) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN')); - }; - action = function(token, i) { - return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent); - }; - this.detectEnd(i + 2, condition, action); - if (tag === 'THEN') { - tokens.splice(i, 1); - } - return 1; - } - return 1; - }); - }; - Rewriter.prototype.tagPostfixConditionals = function() { - var condition; - condition = function(token, i) { - var _ref; - return (_ref = token[0]) === 'TERMINATOR' || _ref === 'INDENT'; - }; - return this.scanTokens(function(token, i) { - var original; - if (token[0] !== 'IF') { - return 1; - } - original = token; - this.detectEnd(i + 1, condition, function(token, i) { - if (token[0] !== 'INDENT') { - return original[0] = 'POST_' + original[0]; - } - }); - return 1; - }); - }; - Rewriter.prototype.ensureBalance = function(pairs) { - var close, level, levels, open, openLine, tag, token, _i, _j, _len, _len2, _ref, _ref2; - levels = {}; - openLine = {}; - _ref = this.tokens; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - token = _ref[_i]; - tag = token[0]; - for (_j = 0, _len2 = pairs.length; _j < _len2; _j++) { - _ref2 = pairs[_j], open = _ref2[0], close = _ref2[1]; - levels[open] |= 0; - if (tag === open) { - if (levels[open]++ === 0) { - openLine[open] = token[2]; - } - } else if (tag === close && --levels[open] < 0) { - throw Error("too many " + token[1] + " on line " + (token[2] + 1)); - } - } - } - for (open in levels) { - level = levels[open]; - if (level > 0) { - throw Error("unclosed " + open + " on line " + (openLine[open] + 1)); - } - } - return this; - }; - Rewriter.prototype.rewriteClosingParens = function() { - var debt, key, stack; - stack = []; - debt = {}; - for (key in INVERSES) { - debt[key] = 0; - } - return this.scanTokens(function(token, i, tokens) { - var inv, match, mtag, oppos, tag, val, _ref; - if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) { - stack.push(token); - return 1; - } - if (__indexOf.call(EXPRESSION_END, tag) < 0) { - return 1; - } - if (debt[inv = INVERSES[tag]] > 0) { - debt[inv] -= 1; - tokens.splice(i, 1); - return 0; - } - match = stack.pop(); - mtag = match[0]; - oppos = INVERSES[mtag]; - if (tag === oppos) { - return 1; - } - debt[mtag] += 1; - val = [oppos, mtag === 'INDENT' ? match[1] : oppos]; - if (this.tag(i + 2) === mtag) { - tokens.splice(i + 3, 0, val); - stack.push(match); - } else { - tokens.splice(i, 0, val); - } - return 1; - }); - }; - Rewriter.prototype.indentation = function(token) { - return [['INDENT', 2, token[2]], ['OUTDENT', 2, token[2]]]; - }; - Rewriter.prototype.tag = function(i) { - var _ref; - return (_ref = this.tokens[i]) != null ? _ref[0] : void 0; - }; - return Rewriter; - })(); - BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']]; - INVERSES = {}; - EXPRESSION_START = []; - EXPRESSION_END = []; - for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) { - _ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1]; - EXPRESSION_START.push(INVERSES[rite] = left); - EXPRESSION_END.push(INVERSES[left] = rite); - } - EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END); - IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; - IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++']; - IMPLICIT_UNSPACED_CALL = ['+', '-']; - IMPLICIT_BLOCK = ['->', '=>', '{', '[', ',']; - IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR']; - SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN']; - SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN']; - LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT']; -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/scope.js b/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/scope.js deleted file mode 100644 index ab88ba9f..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/lib/scope.js +++ /dev/null @@ -1,120 +0,0 @@ -(function() { - var Scope, extend, last, _ref; - _ref = require('./helpers'), extend = _ref.extend, last = _ref.last; - exports.Scope = Scope = (function() { - Scope.root = null; - function Scope(parent, expressions, method) { - this.parent = parent; - this.expressions = expressions; - this.method = method; - this.variables = [ - { - name: 'arguments', - type: 'arguments' - } - ]; - this.positions = {}; - if (!this.parent) { - Scope.root = this; - } - } - Scope.prototype.add = function(name, type, immediate) { - var pos; - if (this.shared && !immediate) { - return this.parent.add(name, type, immediate); - } - if (typeof (pos = this.positions[name]) === 'number') { - return this.variables[pos].type = type; - } else { - return this.positions[name] = this.variables.push({ - name: name, - type: type - }) - 1; - } - }; - Scope.prototype.find = function(name, options) { - if (this.check(name, options)) { - return true; - } - this.add(name, 'var'); - return false; - }; - Scope.prototype.parameter = function(name) { - if (this.shared && this.parent.check(name, true)) { - return; - } - return this.add(name, 'param'); - }; - Scope.prototype.check = function(name, immediate) { - var found, _ref2; - found = !!this.type(name); - if (found || immediate) { - return found; - } - return !!((_ref2 = this.parent) != null ? _ref2.check(name) : void 0); - }; - Scope.prototype.temporary = function(name, index) { - if (name.length > 1) { - return '_' + name + (index > 1 ? index : ''); - } else { - return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a'); - } - }; - Scope.prototype.type = function(name) { - var v, _i, _len, _ref2; - _ref2 = this.variables; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - v = _ref2[_i]; - if (v.name === name) { - return v.type; - } - } - return null; - }; - Scope.prototype.freeVariable = function(type) { - var index, temp; - index = 0; - while (this.check((temp = this.temporary(type, index)))) { - index++; - } - this.add(temp, 'var', true); - return temp; - }; - Scope.prototype.assign = function(name, value) { - this.add(name, { - value: value, - assigned: true - }); - return this.hasAssignments = true; - }; - Scope.prototype.hasDeclarations = function() { - return !!this.declaredVariables().length; - }; - Scope.prototype.declaredVariables = function() { - var realVars, tempVars, v, _i, _len, _ref2; - realVars = []; - tempVars = []; - _ref2 = this.variables; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - v = _ref2[_i]; - if (v.type === 'var') { - (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name); - } - } - return realVars.sort().concat(tempVars.sort()); - }; - Scope.prototype.assignedVariables = function() { - var v, _i, _len, _ref2, _results; - _ref2 = this.variables; - _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - v = _ref2[_i]; - if (v.type.assigned) { - _results.push("" + v.name + " = " + v.type.value); - } - } - return _results; - }; - return Scope; - })(); -}).call(this); diff --git a/lib/adapters/neo4j-lib/node_modules/coffee-script/package.json b/lib/adapters/neo4j-lib/node_modules/coffee-script/package.json deleted file mode 100644 index 58210ed7..00000000 --- a/lib/adapters/neo4j-lib/node_modules/coffee-script/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "coffee-script", - "description": "Unfancy JavaScript", - "keywords": ["javascript", "language", "coffeescript", "compiler"], - "author": "Jeremy Ashkenas", - "version": "1.1.2", - "licenses": [{ - "type": "MIT", - "url": "http://github.com/jashkenas/coffee-script/raw/master/LICENSE" - }], - "engines": { - "node": ">=0.2.5" - }, - "directories" : { - "lib" : "./lib" - }, - "main" : "./lib/coffee-script", - "bin": { - "coffee": "./bin/coffee", - "cake": "./bin/cake" - }, - "homepage": "http://coffeescript.org", - "repository": { - "type": "git", - "url": "git://github.com/jashkenas/coffee-script.git" - } -} diff --git a/lib/adapters/neo4j-lib/node_modules/http-status/.gitignore b/lib/adapters/neo4j-lib/node_modules/http-status/.gitignore deleted file mode 100644 index 496ee2ca..00000000 --- a/lib/adapters/neo4j-lib/node_modules/http-status/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.DS_Store \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/http-status/CHANGELOG.md b/lib/adapters/neo4j-lib/node_modules/http-status/CHANGELOG.md deleted file mode 100644 index 3f2fc5aa..00000000 --- a/lib/adapters/neo4j-lib/node_modules/http-status/CHANGELOG.md +++ /dev/null @@ -1,14 +0,0 @@ -# Changelog: HTTP Status - -## Version 0.1.0 – April 17, 2011 - - - Added reference links to HTTP specification - - Fixed naming convention for constants from `PascalCase` to `ALL_CAPS` - - Converted status codes from string to number - - Updated samples - - Updated tests - - Added this `CHANGELOG` - -## Version 0.0.1 – March 25, 2011 - - - Initial release. diff --git a/lib/adapters/neo4j-lib/node_modules/http-status/README.md b/lib/adapters/neo4j-lib/node_modules/http-status/README.md deleted file mode 100644 index 9533e99b..00000000 --- a/lib/adapters/neo4j-lib/node_modules/http-status/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# HTTP Status - -Utility to interact with HTTP status code. - -## Usage - -### API sample - - var HTTPStatus = require('http-status'); - - // Print "Internal Server Error" - console.log(HTTPStatus[500]); - - // Print 500 - console.log(HTTPStatus.INTERNAL_SERVER_ERROR); - -### Express sample - - var express = require('express'), - redis = require('redis'), - HTTPStatus = require('http-status'); - - var app = express.createServer(); - - app.get('/', function (req, res) { - var client = redis.createClient(); - client.ping(function (err, msg) { - if (err) { - return res.send(HTTPStatus.INTERNAL_SERVER_ERROR); - } - res.send(msg, HTTPStatus.OK); - }); - }); - - app.listen(3000); - -Contributors ------------- - -* David Worms : -* Daniel Gasienica : diff --git a/lib/adapters/neo4j-lib/node_modules/http-status/lib/index.js b/lib/adapters/neo4j-lib/node_modules/http-status/lib/index.js deleted file mode 100644 index 731391c6..00000000 --- a/lib/adapters/neo4j-lib/node_modules/http-status/lib/index.js +++ /dev/null @@ -1,82 +0,0 @@ -module.exports = { - 100: 'Continue', - 101: 'Switching Protocols', - 200: 'OK', - 201: 'Created', - 202: 'Accepted', - 203: 'Non-Authoritative Information', - 204: 'No Content', - 205: 'Reset Content', - 206: 'Partial Content', - 300: 'Multiple Choices', - 301: 'Moved Permanently', - 302: 'Found', - 303: 'See Other', - 304: 'Not Modified', - 305: 'Use Proxy', - 307: 'Temporary Redirect', - 400: 'Bad Request', - 401: 'Unauthorized', - 402: 'Payment Required', - 403: 'Forbidden', - 404: 'Not Found', - 405: 'Method Not Allowed', - 406: 'Not Acceptable', - 407: 'Proxy Authentication Required', - 408: 'Request Time-out', - 409: 'Conflict', - 410: 'Gone', - 411: 'Length Required', - 412: 'Precondition Failed', - 413: 'Request Entity Too Large', - 414: 'Request-URI Too Large', - 415: 'Unsupported Media Type', - 416: 'Requested range not satisfiable', - 417: 'Expectation Failed', - 500: 'Internal Server Error', - 501: 'Not Implemented', - 502: 'Bad Gateway', - 503: 'Service Unavailable', - 504: 'Gateway Time-out', - 505: 'HTTP Version not supported', - CONTINUE: 100, - SWITCHING_PROTOCOLS: 101, - OK: 200, - CREATED: 201, - ACCEPTED: 202, - NON_AUTHORITATIVE_INFORMATION: 203, - NO_CONTENT: 204, - RESET_CONTENT: 205, - PARTIAL_CONTENT: 206, - MULTITPLE_CHOICES: 300, - MOVED_PERMAMENTLY: 301, - FOUND: 302, - SEE_OTHER: 303, - NOT_MODIFIED: 304, - USE_PROXY: 305, - TEMPORARY_REDIRECT: 307, - BAD_REQUEST: 400, - UNAUTHORIZED: 401, - PAYMENT_REQUIRED: 402, - FORBIDDEN: 403, - NOT_FOUND: 404, - METHOD_NOT_ALLOWED: 405, - NOT_ACCEPTABLE: 406, - PROXY_AUTHENTICATION_REQUIRED: 407, - REQUEST_TIMEOUT: 408, - CONFLICT: 409, - GONE: 410, - LENGTH_REQUIRED: 411, - PRECONDITION_FAILED: 412, - REQUEST_ENTITY_TOO_LARGE: 413, - REQUEST_URI_TOO_LONG: 414, - UNSUPPORTED_MEDIA_TYPE: 415, - REQUESTED_RANGE_NOT_SATISFIABLE: 416, - EXPECTATION_FAILED: 417, - INTERNAL_SERVER_ERROR: 500, - NOT_IMPLEMENTED: 501, - BAD_GATEWAY: 502, - SERVICE_UNAVAILABLE: 503, - GATEWAY_TIMEOUT: 504, - HTTP_VERSION_NOT_SUPPORTED: 505 -}; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/http-status/package.json b/lib/adapters/neo4j-lib/node_modules/http-status/package.json deleted file mode 100644 index 1c9fc0aa..00000000 --- a/lib/adapters/neo4j-lib/node_modules/http-status/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ "name": "http-status" -, "version": "0.1.0" -, "description": "Interact with HTTP status code" -, "author": "David Worms " -, "contributors": [{"name": "Daniel Gasienica", "email": "daniel@gasienica.ch"}] -, "devDependencies": { "coffee-script": "1.x" } -, "main": "./lib/index" -, "engines": { "node": ">= 0.1.90" } -} diff --git a/lib/adapters/neo4j-lib/node_modules/http-status/samples/api.js b/lib/adapters/neo4j-lib/node_modules/http-status/samples/api.js deleted file mode 100755 index d49bc380..00000000 --- a/lib/adapters/neo4j-lib/node_modules/http-status/samples/api.js +++ /dev/null @@ -1,7 +0,0 @@ -var HTTPStatus = require('http-status'); - -// Print "Internal Server Error" -console.log(HTTPStatus[500]); - -// Print 500 -console.log(HTTPStatus.INTERNAL_SERVER_ERROR); diff --git a/lib/adapters/neo4j-lib/node_modules/http-status/samples/express.js b/lib/adapters/neo4j-lib/node_modules/http-status/samples/express.js deleted file mode 100755 index 7abb606f..00000000 --- a/lib/adapters/neo4j-lib/node_modules/http-status/samples/express.js +++ /dev/null @@ -1,17 +0,0 @@ -var express = require('express'), - redis = require('redis'), - HTTPStatus = require('http-status'); - -var app = express.createServer(); - -app.get('/', function (req, res) { - var client = redis.createClient(); - client.ping(function (err, msg) { - if (err) { - return res.send(HTTPStatus.INTERNAL_SERVER_ERROR); - } - res.send(msg, HTTPStatus.OK); - }); -}); - -app.listen(3000); diff --git a/lib/adapters/neo4j-lib/node_modules/http-status/src/index.coffee b/lib/adapters/neo4j-lib/node_modules/http-status/src/index.coffee deleted file mode 100644 index 73c7498d..00000000 --- a/lib/adapters/neo4j-lib/node_modules/http-status/src/index.coffee +++ /dev/null @@ -1,115 +0,0 @@ -# Reference: -# http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html -# http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1 - -module.exports = - # Informational 1xx - # Request received, continuing process - 100: 'Continue' - 101: 'Switching Protocols' - - # Successful 2xx - # The action was successfully received, understood, and accepted - 200: 'OK' - 201: 'Created' - 202: 'Accepted' - 203: 'Non-Authoritative Information' - 204: 'No Content' - 205: 'Reset Content' - 206: 'Partial Content' - - # Redirection 3xx - # Further action must be taken in order to complete the request - 300: 'Multiple Choices' - 301: 'Moved Permanently' - 302: 'Found' - 303: 'See Other' - 304: 'Not Modified' - 305: 'Use Proxy' - 307: 'Temporary Redirect' - - # Client Error 4xx - # The request contains bad syntax or cannot be fulfilled - 400: 'Bad Request' - 401: 'Unauthorized' - 402: 'Payment Required' - 403: 'Forbidden' - 404: 'Not Found' - 405: 'Method Not Allowed' - 406: 'Not Acceptable' - 407: 'Proxy Authentication Required' - 408: 'Request Time-out' - 409: 'Conflict' - 410: 'Gone' - 411: 'Length Required' - 412: 'Precondition Failed' - 413: 'Request Entity Too Large' - 414: 'Request-URI Too Large' - 415: 'Unsupported Media Type' - 416: 'Requested range not satisfiable' - 417: 'Expectation Failed' - - # Server Error 5xx - # The server failed to fulfill an apparently valid request - 500: 'Internal Server Error' - 501: 'Not Implemented' - 502: 'Bad Gateway' - 503: 'Service Unavailable' - 504: 'Gateway Time-out' - 505: 'HTTP Version not supported' - - # Informational 1xx - # Request received, continuing process - CONTINUE: 100 - SWITCHING_PROTOCOLS: 101 - - # Successful 2xx - # The action was successfully received, understood, and accepted - OK: 200 - CREATED: 201 - ACCEPTED: 202 - NON_AUTHORITATIVE_INFORMATION: 203 - NO_CONTENT: 204 - RESET_CONTENT: 205 - PARTIAL_CONTENT: 206 - - # Redirection 3xx - # Further action must be taken in order to complete the request - MULTITPLE_CHOICES: 300 - MOVED_PERMAMENTLY: 301 - FOUND: 302 - SEE_OTHER: 303 - NOT_MODIFIED: 304 - USE_PROXY: 305 - # Unused: 306 (reserved) - TEMPORARY_REDIRECT: 307 - - # Client Error 4xx - # The request contains bad syntax or cannot be fulfilled - BAD_REQUEST: 400 - UNAUTHORIZED: 401 - PAYMENT_REQUIRED: 402 - FORBIDDEN: 403 - NOT_FOUND: 404 - METHOD_NOT_ALLOWED: 405 - NOT_ACCEPTABLE: 406 - PROXY_AUTHENTICATION_REQUIRED: 407 - REQUEST_TIMEOUT: 408 - CONFLICT: 409 - GONE: 410 - LENGTH_REQUIRED: 411 - PRECONDITION_FAILED: 412 - REQUEST_ENTITY_TOO_LARGE: 413 - REQUEST_URI_TOO_LONG: 414 - UNSUPPORTED_MEDIA_TYPE: 415 - REQUESTED_RANGE_NOT_SATISFIABLE: 416 - EXPECTATION_FAILED: 417 - - # Server Error 5xx - # The server failed to fulfill an apparently valid request - INTERNAL_SERVER_ERROR: 500 - NOT_IMPLEMENTED: 501 - BAD_GATEWAY: 502 - SERVICE_UNAVAILABLE: 503 - GATEWAY_TIMEOUT: 504 - HTTP_VERSION_NOT_SUPPORTED: 505 diff --git a/lib/adapters/neo4j-lib/node_modules/http-status/test/index.js b/lib/adapters/neo4j-lib/node_modules/http-status/test/index.js deleted file mode 100755 index e39fc7f0..00000000 --- a/lib/adapters/neo4j-lib/node_modules/http-status/test/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var assert = require('assert'), - HTTPStatus = require('../lib/index'); - -module.exports = { - 'Test HTTP Status Code': function () { - assert.eql(200, HTTPStatus.OK); - assert.eql('OK', HTTPStatus[200]); - } -}; diff --git a/lib/adapters/neo4j-lib/node_modules/request/LICENSE b/lib/adapters/neo4j-lib/node_modules/request/LICENSE deleted file mode 100644 index a4a9aee0..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/request/README.md b/lib/adapters/neo4j-lib/node_modules/request/README.md deleted file mode 100644 index c7ebe911..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/README.md +++ /dev/null @@ -1,191 +0,0 @@ -# Request -- Simplified HTTP request method - -## Install - -
-  npm install request
-
- -Or from source: - -
-  git clone git://github.com/mikeal/request.git 
-  cd request
-  npm link
-
- -## Super simple to use - -Request is designed to be the simplest way possible to make http calls. It support HTTPS and follows redirects by default. - -```javascript -var request = require('request'); -request('http://www.google.com', function (error, response, body) { - if (!error && response.statusCode == 200) { - sys.puts(body) // Print the google web page. - } -}) -``` - -## Streaming - -You can stream any response to a file stream. - -```javascript -request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) -``` - -You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers. - -```javascript -fs.readStream('file.json').pipe(request.put('http://mysite.com/obj.json')) -``` - -Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers. - -```javascript -request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) -``` - -Now let's get fancy. - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - if (req.method === 'PUT') { - req.pipe(request.put('http://mysite.com/doodle.png')) - } else if (req.method === 'GET' || req.method === 'HEAD') { - request.get('http://mysite.com/doodle.png').pipe(resp) - } - } -}) -``` - -You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do: - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - var x = request('http://mysite.com/doodle.png') - req.pipe(x) - x.pipe(resp) - } -}) -``` - -And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :) - -```javascript -req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) -``` - -Also, none of this new functionality conflicts with requests previous features, it just expands them. - -```javascript -var r = request.defaults({'proxy':'http://localproxy.com'}) - -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - r.get('http://google.com/doodle.png').pipe(resp) - } -}) -``` - -You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. - -### request(options, callback) - -The first argument can be either a url or an options object. The only required option is uri, all others are optional. - -* `uri` || `url` - fully qualified uri or a parsed url object from url.parse() -* `method` - http method, defaults to GET -* `headers` - http headers, defaults to {} -* `body` - entity body for POST and PUT requests. Must be buffer or string. -* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. -* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. -* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true. -* `maxRedirects` - the maximum number of redirects to follow, defaults to 10. -* `onResponse` - If true the callback will be fired on the "response" event instead of "end". If a function it will be called on "response" and not effect the regular semantics of the main callback on "end". -* `encoding` - Encoding to be used on response.setEncoding when buffering the response data. -* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets. -* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool. -* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request -* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri. - -The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body buffer. - -## Convenience methods - -There are also shorthand methods for different HTTP METHODs and some other conveniences. - -### request.defaults(options) - -This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it. - -### request.put - -Same as request() but defaults to `method: "PUT"`. - -```javascript -request.put(url) -``` - -### request.post - -Same as request() but defaults to `method: "POST"`. - -```javascript -request.post(url) -``` - -### request.head - -Same as request() but defaults to `method: "HEAD"`. - -```javascript -request.head(url) -``` - -### request.del - -Same as request() but defaults to `method: "DELETE"`. - -```javascript -request.del(url) -``` - -### request.get - -Alias to normal request method for uniformity. - -```javascript -request.get(url) -``` - - -## Examples: - -```javascript - var request = require('request') - , rand = Math.floor(Math.random()*100000000).toString() - ; - request( - { method: 'PUT' - , uri: 'http://mikeal.couchone.com/testjs/' + rand - , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } - ] - } - , function (error, response, body) { - if(response.statusCode == 201){ - console.log('document saved as: http://mikeal.couchone.com/testjs/'+ rand) - } else { - console.log('error: '+ response.statusCode) - console.log(body) - } - } - ) -``` diff --git a/lib/adapters/neo4j-lib/node_modules/request/cookies.js b/lib/adapters/neo4j-lib/node_modules/request/cookies.js deleted file mode 100644 index 48845ae4..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/cookies.js +++ /dev/null @@ -1,150 +0,0 @@ - -var cookie_str_splitter=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g - -function stringify (cookie) { - var str=[cookie.name+"="+cookie.value]; - if(cookie.expiration_date !== Infinity) { - str.push("expires="+(new Date(cookie.expiration_date)).toGMTString()); - } - if(cookie.domain) { - str.push("domain="+cookie.domain); - } - if(cookie.path) { - str.push("path="+cookie.path); - } - if(cookie.secure) { - str.push("secure"); - } - if(cookie.noscript) { - str.push("httponly"); - } - return str.join("; "); -} - -function Jar () { - this.cookies = [] -} -Jar.prototype.setCookies = function (cookieString) { - -} -Jar.prototype.getHeader = function (host, path) { - -} -Jar.prototype.getCookies = function (access_info) { - var matches=[]; - for(var cookie_name in cookies) { - var cookie=this.getCookie(cookie_name,access_info); - if (cookie) { - matches.push(cookie); - } - } - matches.toString=function toString(){return matches.join(":");} - return matches; -} - -Jar.prototype.getCookie = function (host, path) { - var cookies_list = self.cookies[cookie_name]; - for(var i=0;i= 300 && - response.statusCode < 400 && - options.followRedirect && - options.method !== 'PUT' && - options.method !== 'POST' && - response.headers.location) { - if (options._redirectsFollowed >= options.maxRedirects) { - options.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop.")) - return - } - options._redirectsFollowed += 1 - - if (!isUrl.test(response.headers.location)) { - response.headers.location = url.resolve(options.uri.href, response.headers.location) - } - options.uri = response.headers.location - delete options.req - delete options.agent - delete options._started - if (options.headers) { - delete options.headers.host - } - request(options, options.callback) - return // Ignore the rest of the response - } else { - options._redirectsFollowed = 0 - // Be a good stream and emit end when the response is finished. - // Hack to emit end on close because of a core bug that never fires end - response.on('close', function () { - if (!options._ended) options.response.emit('end') - }) - - if (options.encoding) { - if (options.dests.length !== 0) { - console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.") - } else { - response.setEncoding(options.encoding) - } - } - - options.dests.forEach(function (dest) { - if (dest.headers) { - dest.headers['content-type'] = response.headers['content-type'] - if (response.headers['content-length']) { - dest.headers['content-length'] = response.headers['content-length'] - } - } - if (dest.setHeader) { - for (i in response.headers) { - dest.setHeader(i, response.headers[i]) - } - dest.statusCode = response.statusCode - } - if (options.pipefilter) options.pipefilter(response, dest) - }) - - response.on("data", function (chunk) {options.emit("data", chunk)}) - response.on("end", function (chunk) { - options._ended = true - options.emit("end", chunk) - }) - response.on("close", function () {options.emit("close")}) - - if (options.onResponse) { - options.onResponse(null, response) - } - if (options.callback) { - var buffer = '' - options.on("data", function (chunk) { - buffer += chunk - }) - options.on("end", function () { - response.body = buffer - if (options.json) { - try { - response.body = JSON.parse(response.body) - } catch (e) {} - } - options.callback(null, response, response.body) - }) - } - } - }) - - if (options.timeout) { - options.timeoutTimer = setTimeout(function() { - options.req.abort() - var e = new Error("ETIMEDOUT") - e.code = "ETIMEDOUT" - options.emit("error", e) - }, options.timeout) - } - - options.req.on('error', clientErrorHandler) - } - - options.once('pipe', function (src) { - if (options.ntick) throw new Error("You cannot pipe to this stream after the first nextTick() after creation of the request stream.") - options.src = src - if (isReadStream(src)) { - if (!options.headers['content-type'] && !options.headers['Content-Type']) - options.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1)) - } else { - if (src.headers) { - for (i in src.headers) { - if (!options.headers[i]) { - options.headers[i] = src.headers[i] - } - } - } - if (src.method && !options.method) { - options.method = src.method - } - } - - options.on('pipe', function () { - console.error("You have already piped to this stream. Pipeing twice is likely to break the request.") - }) - }) - - process.nextTick(function () { - if (options.body) { - options.write(options.body) - options.end() - } else if (options.requestBodyStream) { - console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.") - options.requestBodyStream.pipe(options) - } else if (!options.src) { - options.end() - } - options.ntick = true - }) -} -Request.prototype.pipe = function (dest) { - if (this.response) throw new Error("You cannot pipe after the response event.") - this.dests.push(dest) - stream.Stream.prototype.pipe.call(this, dest) - return dest -} -Request.prototype.write = function () { - if (!this._started) this.start() - if (!this.req) throw new Error("This request has been piped before http.request() was called.") - this.req.write.apply(this.req, arguments) -} -Request.prototype.end = function () { - if (!this._started) this.start() - if (!this.req) throw new Error("This request has been piped before http.request() was called.") - this.req.end.apply(this.req, arguments) -} -Request.prototype.pause = function () { - if (!this.response) throw new Error("This request has been piped before http.request() was called.") - this.response.pause.apply(this.response, arguments) -} -Request.prototype.resume = function () { - if (!this.response) throw new Error("This request has been piped before http.request() was called.") - this.response.resume.apply(this.response, arguments) -} - -function request (options, callback) { - if (typeof options === 'string') options = {uri:options} - if (callback) options.callback = callback - var r = new Request(options) - r.request() - return r -} - -module.exports = request - -request.defaults = function (options) { - var def = function (method) { - var d = function (opts, callback) { - if (typeof opts === 'string') opts = {uri:opts} - for (i in options) { - if (opts[i] === undefined) opts[i] = options[i] - } - return method(opts, callback) - } - return d - } - de = def(request) - de.get = def(request.get) - de.post = def(request.post) - de.put = def(request.put) - de.head = def(request.head) - de.del = def(request.del) - return de -} - -request.get = request -request.post = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'POST' - return request(options, callback) -} -request.put = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'PUT' - return request(options, callback) -} -request.head = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'HEAD' - if (options.body || options.requestBodyStream || options.json || options.multipart) { - throw new Error("HTTP HEAD requests MUST NOT include a request body.") - } - return request(options, callback) -} -request.del = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'DELETE' - return request(options, callback) -} diff --git a/lib/adapters/neo4j-lib/node_modules/request/mimetypes.js b/lib/adapters/neo4j-lib/node_modules/request/mimetypes.js deleted file mode 100644 index 86910064..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/mimetypes.js +++ /dev/null @@ -1,146 +0,0 @@ -// from http://github.com/felixge/node-paperboy -exports.types = { - "aiff":"audio/x-aiff", - "arj":"application/x-arj-compressed", - "asf":"video/x-ms-asf", - "asx":"video/x-ms-asx", - "au":"audio/ulaw", - "avi":"video/x-msvideo", - "bcpio":"application/x-bcpio", - "ccad":"application/clariscad", - "cod":"application/vnd.rim.cod", - "com":"application/x-msdos-program", - "cpio":"application/x-cpio", - "cpt":"application/mac-compactpro", - "csh":"application/x-csh", - "css":"text/css", - "deb":"application/x-debian-package", - "dl":"video/dl", - "doc":"application/msword", - "drw":"application/drafting", - "dvi":"application/x-dvi", - "dwg":"application/acad", - "dxf":"application/dxf", - "dxr":"application/x-director", - "etx":"text/x-setext", - "ez":"application/andrew-inset", - "fli":"video/x-fli", - "flv":"video/x-flv", - "gif":"image/gif", - "gl":"video/gl", - "gtar":"application/x-gtar", - "gz":"application/x-gzip", - "hdf":"application/x-hdf", - "hqx":"application/mac-binhex40", - "html":"text/html", - "ice":"x-conference/x-cooltalk", - "ico":"image/x-icon", - "ief":"image/ief", - "igs":"model/iges", - "ips":"application/x-ipscript", - "ipx":"application/x-ipix", - "jad":"text/vnd.sun.j2me.app-descriptor", - "jar":"application/java-archive", - "jpeg":"image/jpeg", - "jpg":"image/jpeg", - "js":"text/javascript", - "json":"application/json", - "latex":"application/x-latex", - "lsp":"application/x-lisp", - "lzh":"application/octet-stream", - "m":"text/plain", - "m3u":"audio/x-mpegurl", - "man":"application/x-troff-man", - "me":"application/x-troff-me", - "midi":"audio/midi", - "mif":"application/x-mif", - "mime":"www/mime", - "movie":"video/x-sgi-movie", - "mustache":"text/plain", - "mp4":"video/mp4", - "mpg":"video/mpeg", - "mpga":"audio/mpeg", - "ms":"application/x-troff-ms", - "nc":"application/x-netcdf", - "oda":"application/oda", - "ogm":"application/ogg", - "pbm":"image/x-portable-bitmap", - "pdf":"application/pdf", - "pgm":"image/x-portable-graymap", - "pgn":"application/x-chess-pgn", - "pgp":"application/pgp", - "pm":"application/x-perl", - "png":"image/png", - "pnm":"image/x-portable-anymap", - "ppm":"image/x-portable-pixmap", - "ppz":"application/vnd.ms-powerpoint", - "pre":"application/x-freelance", - "prt":"application/pro_eng", - "ps":"application/postscript", - "qt":"video/quicktime", - "ra":"audio/x-realaudio", - "rar":"application/x-rar-compressed", - "ras":"image/x-cmu-raster", - "rgb":"image/x-rgb", - "rm":"audio/x-pn-realaudio", - "rpm":"audio/x-pn-realaudio-plugin", - "rtf":"text/rtf", - "rtx":"text/richtext", - "scm":"application/x-lotusscreencam", - "set":"application/set", - "sgml":"text/sgml", - "sh":"application/x-sh", - "shar":"application/x-shar", - "silo":"model/mesh", - "sit":"application/x-stuffit", - "skt":"application/x-koan", - "smil":"application/smil", - "snd":"audio/basic", - "sol":"application/solids", - "spl":"application/x-futuresplash", - "src":"application/x-wais-source", - "stl":"application/SLA", - "stp":"application/STEP", - "sv4cpio":"application/x-sv4cpio", - "sv4crc":"application/x-sv4crc", - "svg":"image/svg+xml", - "swf":"application/x-shockwave-flash", - "tar":"application/x-tar", - "tcl":"application/x-tcl", - "tex":"application/x-tex", - "texinfo":"application/x-texinfo", - "tgz":"application/x-tar-gz", - "tiff":"image/tiff", - "tr":"application/x-troff", - "tsi":"audio/TSP-audio", - "tsp":"application/dsptype", - "tsv":"text/tab-separated-values", - "unv":"application/i-deas", - "ustar":"application/x-ustar", - "vcd":"application/x-cdlink", - "vda":"application/vda", - "vivo":"video/vnd.vivo", - "vrm":"x-world/x-vrml", - "wav":"audio/x-wav", - "wax":"audio/x-ms-wax", - "wma":"audio/x-ms-wma", - "wmv":"video/x-ms-wmv", - "wmx":"video/x-ms-wmx", - "wrl":"model/vrml", - "wvx":"video/x-ms-wvx", - "xbm":"image/x-xbitmap", - "xlw":"application/vnd.ms-excel", - "xml":"text/xml", - "xpm":"image/x-xpixmap", - "xwd":"image/x-xwindowdump", - "xyz":"chemical/x-pdb", - "zip":"application/zip", -}; - -exports.lookup = function(ext, defaultType) { - defaultType = defaultType || 'application/octet-stream'; - - return (ext in exports.types) - ? exports.types[ext] - : defaultType; -}; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/request/package.json b/lib/adapters/neo4j-lib/node_modules/request/package.json deleted file mode 100644 index 9ebbe042..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ "name" : "request" -, "description" : "Simplified HTTP request client." -, "tags" : ["http", "simple", "util", "utility"] -, "version" : "2.1.1" -, "author" : "Mikeal Rogers " -, "repository" : - { "type" : "git" - , "url" : "http://github.com/mikeal/request.git" - } -, "bugs" : - { "web" : "http://github.com/mikeal/request/issues" } -, "engines" : ["node >= 0.3.6"] -, "main" : "./main" -} diff --git a/lib/adapters/neo4j-lib/node_modules/request/test.js b/lib/adapters/neo4j-lib/node_modules/request/test.js deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/adapters/neo4j-lib/node_modules/request/tests/googledoodle.png b/lib/adapters/neo4j-lib/node_modules/request/tests/googledoodle.png deleted file mode 100644 index f80c9c52..00000000 Binary files a/lib/adapters/neo4j-lib/node_modules/request/tests/googledoodle.png and /dev/null differ diff --git a/lib/adapters/neo4j-lib/node_modules/request/tests/server.js b/lib/adapters/neo4j-lib/node_modules/request/tests/server.js deleted file mode 100644 index 85defb52..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/tests/server.js +++ /dev/null @@ -1,46 +0,0 @@ -var http = require('http') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - ; - -exports.createServer = function (port) { - port = port || 6767 - var s = http.createServer(function (req, resp) { - s.emit(req.url, req, resp); - }) - s.listen(port) - s.url = 'http://localhost:'+port - return s; -} - -exports.createPostStream = function (text) { - var postStream = new stream.Stream(); - postStream.writeable = true; - postStream.readable = true; - setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0); - return postStream; -} -exports.createPostValidator = function (text) { - var l = function (req, resp) { - var r = ''; - req.on('data', function (chunk) {r += chunk}) - req.on('end', function () { - if (r !== text) console.log(r, text); - assert.equal(r, text) - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write('OK') - resp.end() - }) - } - return l; -} -exports.createGetResponse = function (text, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - resp.write(text) - resp.end() - } - return l; -} diff --git a/lib/adapters/neo4j-lib/node_modules/request/tests/test-body.js b/lib/adapters/neo4j-lib/node_modules/request/tests/test-body.js deleted file mode 100644 index 7686965e..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/tests/test-body.js +++ /dev/null @@ -1,78 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutStream : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , requestBodyStream : server.createPostStream("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -var counter = 0; - -for (i in tests) { - (function () { - var test = tests[i]; - s.on('/'+i, test.resp); - test.uri = s.url + '/' + i; - request(test, function (err, resp, body) { - if (err) throw err; - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close(); - } - }) - counter++; - })() -} diff --git a/lib/adapters/neo4j-lib/node_modules/request/tests/test-cookies.js b/lib/adapters/neo4j-lib/node_modules/request/tests/test-cookies.js deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/adapters/neo4j-lib/node_modules/request/tests/test-errors.js b/lib/adapters/neo4j-lib/node_modules/request/tests/test-errors.js deleted file mode 100644 index e5df87b5..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/tests/test-errors.js +++ /dev/null @@ -1,30 +0,0 @@ -var server = require('./server') - , events = require('events') - , assert = require('assert') - , request = require('../main.js') - ; - -var local = 'http://localhost:8888/asdf' - -try { - request({uri:local, body:{}}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.body.') -} - -try { - request({uri:local, multipart: 'foo'}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.multipart.') -} - -try { - request({uri:local, multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -console.log("All tests passed.") \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/request/tests/test-pipes.js b/lib/adapters/neo4j-lib/node_modules/request/tests/test-pipes.js deleted file mode 100644 index b48c814c..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/tests/test-pipes.js +++ /dev/null @@ -1,136 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - ; - -var s = server.createServer(3453); - -passes = 0; - -var check = function () { - if (passes === 7) { - console.log('All tests passed.') - setTimeout(function () { - process.exit(); - }, 500) - } - if (passes > 7) throw new Error('Need to update for more failures') -} - -// Test pipeing to a request object -s.once('/push', server.createPostValidator("mydata")); - -var mydata = new stream.Stream(); -mydata.readable = true - -var r1 = request.put({url:'http://localhost:3453/push'}, function () { - passes += 1; - check(); -}) -mydata.pipe(r1) - -mydata.emit('data', 'mydata'); -mydata.emit('end'); - - -// Test pipeing from a request object. -s.once('/pull', server.createGetResponse("mypulldata")); - -var mypulldata = new stream.Stream(); -mypulldata.writable = true - -request({url:'http://localhost:3453/pull'}).pipe(mypulldata) - -var d = ''; - -mypulldata.write = function (chunk) { - d += chunk; -} -mypulldata.end = function () { - assert.equal(d, 'mypulldata'); - passes += 1 - check(); -}; - - -s.on('/cat', function (req, resp) { - if (req.method === "GET") { - resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4}); - resp.end('asdf') - } else if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/plain-test'); - assert.equal(req.headers['content-length'], 4) - var validate = ''; - - req.on('data', function (chunk) {validate += chunk}) - req.on('end', function () { - resp.writeHead(201); - resp.end(); - assert.equal(validate, 'asdf'); - passes += 1; - check(); - }) - } -}) -s.on('/pushjs', function (req, resp) { - if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/javascript'); - passes += 1; - check(); - } -}) -s.on('/catresp', function (req, resp) { - request.get('http://localhost:3453/cat').pipe(resp) -}) -s.on('/doodle', function (req, resp) { - if (req.headers['x-oneline-proxy']) { - resp.setHeader('x-oneline-proxy', 'yup') - } - resp.writeHead('200', {'content-type':'image/png'}) - fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp) -}) -s.on('/onelineproxy', function (req, resp) { - var x = request('http://localhost:3453/doodle') - req.pipe(x) - x.pipe(resp) -}) - - -fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs')) - -request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat')) - -request.get('http://localhost:3453/catresp', function (e, resp, body) { - assert.equal(resp.headers['content-type'], 'text/plain-test'); - assert.equal(resp.headers['content-length'], 4) - passes += 1 - check(); -}) - -var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png')) - -request.get('http://localhost:3453/doodle').pipe(doodleWrite) - -doodleWrite.on('close', function () { - assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png'))) - passes += 1 - check() -}) - -process.on('exit', function () { - fs.unlinkSync(path.join(__dirname, 'test.png')) -}) - -request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) { - assert.equal(resp.headers['x-oneline-proxy'], 'yup') - passes += 1 - check() -}) - - - - diff --git a/lib/adapters/neo4j-lib/node_modules/request/tests/test-put.js b/lib/adapters/neo4j-lib/node_modules/request/tests/test-put.js deleted file mode 100644 index 06b33f2c..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/tests/test-put.js +++ /dev/null @@ -1,18 +0,0 @@ -// var http = require('http') -// , request = require('../main') -// ; -// -// var s = http.createServer(function (req, resp) { -// resp.statusCode = 412 -// resp.end('hello') -// }) -// s.listen(8000) -// -// request.put("http://localhost:8000", function (e,_,b){ -// console.log(e,b) -// s.close() -// }) - -require('../main').put("http://testnano.iriscouch.com:80/test", function (e,_,b){ - console.log(e,b) -}) diff --git a/lib/adapters/neo4j-lib/node_modules/request/tests/test-ssl.js b/lib/adapters/neo4j-lib/node_modules/request/tests/test-ssl.js deleted file mode 100644 index 090498ac..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/tests/test-ssl.js +++ /dev/null @@ -1,7 +0,0 @@ -var request = require("../main"); - -request({'uri': 'https://encrypted.google.com/'}, function (err, res, body) { - // util.debug(err); - // console.dir(res) - console.log('asdf') -}); \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/request/tests/test-timeout.js b/lib/adapters/neo4j-lib/node_modules/request/tests/test-timeout.js deleted file mode 100644 index 4469d798..00000000 --- a/lib/adapters/neo4j-lib/node_modules/request/tests/test-timeout.js +++ /dev/null @@ -1,84 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); -var expectedBody = "waited"; -var remainingTests = 5; - -// Request that waits for 200ms -s.on('/timeout', function (req, resp) { - setTimeout(function(){ - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write(expectedBody) - resp.end() - }, 200); -}); - -// Scenario that should timeout -var shouldTimeout = { - url: s.url + "/timeout", - timeout:100 -} - -request(shouldTimeout, function (err, resp, body) { - assert.equal(err, "ETIMEDOUT"); - checkDone(); -}) - - -// Scenario that shouldn't timeout -var shouldntTimeout = { - url: s.url + "/timeout", - timeout:300 -} - -request(shouldntTimeout, function (err, resp, body) { - assert.equal(!err); - assert.equal(expectedBody, body) - checkDone(); -}) - -// Scenario with no timeout set, so shouldn't timeout -var noTimeout = { - url: s.url + "/timeout" -} - -request(noTimeout, function (err, resp, body) { - assert.equal(!err); - assert.equal(expectedBody, body) - checkDone(); -}) - -// Scenario with a negative timeout value, should be treated a zero or the minimum delay -var negativeTimeout = { - url: s.url + "/timeout", - timeout:-1000 -} - -request(negativeTimeout, function (err, resp, body) { - assert.equal(err, "ETIMEDOUT"); - checkDone(); -}) - -// Scenario with a float timeout value, should be rounded by setTimeout anyway -var floatTimeout = { - url: s.url + "/timeout", - timeout: 100.76 -} - -request(floatTimeout, function (err, resp, body) { - assert.equal(err, "ETIMEDOUT"); - checkDone(); -}) - -function checkDone() { - if(--remainingTests == 0) { - s.close(); - console.log("All tests passed."); - } -} - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/.npmignore b/lib/adapters/neo4j-lib/node_modules/streamline/.npmignore deleted file mode 100644 index bc111391..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/.npmignore +++ /dev/null @@ -1 +0,0 @@ -lib/*_.js diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/API.md b/lib/adapters/neo4j-lib/node_modules/streamline/API.md deleted file mode 100644 index 094fd413..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/API.md +++ /dev/null @@ -1,363 +0,0 @@ - -# streamline/lib/compiler/command - -Streamline commmand line analyzer / dispatcher - -* `command.run()` - runs `node-streamline` command line analyzer / dispatcher - -# streamline/lib/compiler/compile - -Streamline compiler and file loader - -* `script = compile.loadFile(_, path, options)` - Loads Javascript file and transforms it if necessary. - Returns the transformed source. - If `path` is `foo_.js`, the source is transformed and the result - is *not* saved to disk. - If `path` is `foo.js` and if a `foo_.js` file exists, - `foo_.js` is transformed if necessary and saved as `foo.js`. - If `path` is `foo.js` and `foo_.js` does not exist, the contents - of `foo.js` is returned. - `options` is a set of options passed to the transformation engine. - If `options.force` is set, `foo_.js` is transformed even if - `foo.js` is more recent. -* `script = compile.loadFileSync(path, options)` - Synchronous version of `compile.loadFile`. - Used by `require` logic. -* `compile.compile(_, paths, options)` - Compiles streamline source files in `paths`. - Generates a `foo.js` file for each `foo_.js` file found in `paths`. - `paths` may be a list of files or a list of directories which - will be traversed recursively. - `options` is a set of options for the `transform` operation. - -# streamline/lib/compiler/register - -Streamline `require` handler registration - -* `register.register(options)` - Registers `require` handlers for streamline. - `options` is a set of default options passed to the `transform` function. - -# streamline/lib/compiler/transform - -Streamline's transformation engine - -* `transformed = transform.transform(source, options)` - Transforms streamline source. - The following `options` may be specified: - * `tryCatch` controls exception handling - * `lines` controls line mapping - * `callback` alternative identifier if `_` is already used. - * `noHelpers` disables generation of helper functions (`__cb`, etc.) - -# streamline/lib/require/client/require - -Client-side require script - -* `id = module.id` - the `id` of the current module. -* `module = require(id)` - _requires_ a module synchronously. - `id` _must_ be a string literal. -* `module = require.async(id, _)` - _requires_ a module asynchronously. - `id` may be a variable or an expression. -* `main = require.main` - return the main module -* `require.main(id)` - loads main module from HTML page. - -# streamline/lib/require/server/require - -Server-side require handler - -Handles require requests coming from the client. - -* `dispatcher = require.dispatcher(options)` - returns an HTTP request dispatcher that responds to requests - issued by the client-side `require` script. - The dispatcher is called as `dispatcher(_, request, response)` - -# streamline/lib/streams/server/streams - -Server Streams module - -The `streams` module contains _pull mode_ wrappers around node streams. - -These wrappers implement a _pull style_ API. -Instead of having the stream _push_ the data to its consumer by emitting `data` and `end` events, -these wrappers let the consumer _pull_ the data from the stream by calling asynchronous `read` methods. - -For a bit more background on this design, -you can read [this blog post](http://bjouhier.wordpress.com/2011/04/25/asynchronous-episode-3-adventures-in-event-land/) - -For a simple example of this API in action, -see the [google client example](./examples/googleClient_.js) - -## Emitter - -Base wrapper for all objects that emit an `end` or `close` event. -All stream wrappers derive from this wrapper. - -* `wrapper = new streams.Emitter(stream)` - creates a wrapper. -* `emitter = wrapper.emitter` - returns the underlying emitter. The emitter stream can be used to attach additional observers. -* `emitter = wrapper.unwrap()` - unwraps and returns the underlying emitter. - The wrapper should not be used after this call. - -## ReadableStream - -All readable stream wrappers derive from this wrapper. - -* `stream = new streams.ReadableStream(stream, [options])` - creates a readable stream wrapper. -* `stream.setEncoding(enc)` - sets the encoding. - returns `this` for chaining. -* `data = stream.read(_, [len])` - reads asynchronously from the stream and returns a `string` or a `Buffer` depending on the encoding. - If a `len` argument is passed, the `read` call returns when `len` characters or bytes - (depending on encoding) have been read, or when the underlying stream has emitted its `end` event. - Without `len`, the read calls returns the data chunks as they have been emitted by the underlying stream. - Once the end of stream has been reached, the `read` call returns `null`. -* `data = stream.readAll(_)` - reads till the end of stream. - Equivalent to `stream.read(_, -1)`. -* `stream.unread(chunk)` - pushes the chunk back to the stream. - returns `this` for chaining. - -## WritableStream - -All writable stream wrappers derive from this wrapper. - -* `stream = new streams.WritableStream(stream, [options])` - creates a writable stream wrapper. -* `stream.write(_, data, [enc])` - Writes the data. - This operation is asynchronous because it _drains_ the stream if necessary. - If you have a lot of small write operations to perform and you don't want the overhead of draining at every step, - you can write to the underlying stream with `stream.emitter.write(data)` most of the time - and call `stream.write(_, data)` once in a while to drain. - Returns `this` for chaining. -* `stream.end()` - signals the end of the send operation. - Returns `this` for chaining. - -## HttpServerRequest - -This is a wrapper around node's `http.ServerRequest`: -This stream is readable (see Readable Stream above). - -* `request = new streams.HttpServerRequest(req, [options])` - returns a wrapper around `req`, an `http.ServerRequest` object. - The `options` parameter can be used to pass `lowMark` and `highMark` values. -* `method = request.method` -* `url = request.url` -* `headers = request.headers` -* `trailers = request.trailers` -* `httpVersion = request.httpVersion` -* `connection = request.connection` -* `socket = request.socket` - (same as `http.ServerRequest`) - -## HttmServerResponse - -This is a wrapper around node's `http.ServerResponse`. -This stream is writable (see Writable Stream above). - -* `response = new streams.HttpServerResponse(resp, [options])` - returns a wrapper around `resp`, an `http.ServerResponse` object. -* `response.writeContinue()` -* `response.writeHead(head)` -* `response.setHeader(name, value)` -* `value = response.getHeader(head)` -* `response.removeHeader(name)` -* `response.addTrailers(trailers)` -* `response.statusCode = value` - (same as `http.ServerResponse`) - -## HttpServer - -This is a wrapper around node's `http.Server` object: - -* `server = new streams.HttpServer(requestListener, [options])` - creates the wrapper. - `requestListener` is called as `requestListener(request, response, _)` - where `request` and `response` are wrappers around `http.ServerRequest` and `http.ServerResponse`. -* `server.listen(_, port, [host])` -* `server.listen(_, path)` - (same as `http.Server`) - -## HttpClientResponse - -This is a wrapper around node's `http.ClientResponse` - -This stream is readable (see Readable Stream above). - -* `response = request.response(_)` returns the response stream. -* `status = response.statusCode` - returns the HTTP status code. -* `version = response.httpVersion` - returns the HTTP version. -* `headers = response.headers` - returns the HTTP response headers. -* `trailers = response.trailers` - returns the HTTP response trailers. -* `response.checkStatus(statuses)` - throws an error if the status is not in the `statuses` array. - If only one status is expected, it may be passed directly as an integer rather than as an array. - Returns `this` for chaining. - -## HttpClientRequest - -This is a wrapper around node's `http.ClientRequest`. - -This stream is writable (see Writable Stream above). - -* `request = streams.httpRequest(options)` - creates the wrapper. - The options are the following: - * `method`: the HTTP method, `'GET'` by default. - * `headers`: the HTTP headers. - * `url`: the requested URL (with query string if necessary). - * `proxy.url`: the proxy URL. - * `lowMark` and `highMark`: low and high water mark values for buffering (in bytes or characters depending - on encoding). - Note that these values are only hints as the data is received in chunks. -* `response = request.response(_)` - returns the response. -* `request.abort()` - aborts the request. - -## NetStream - -This is a wrapper around streams returned by TCP and socket clients: - -These streams is both readable and writable (see Readable Stream and Writable Stream above). - -* `stream = new streams.NetStream(stream, [options])` - creates a network stream wrapper. - -## TCP and Socket clients - -These are wrappers around node's `net.createConnection`: - -* `client = streams.tcpClient(port, host, [options])` - returns a TCP connection client. -* `client = streams.socketClient(path, [options])` - returns a socket client. - The `options` parameter of the constructor provide options for the stream (`lowMark` and `highMark`). If you want different options for `read` and `write` operations, you can specify them by creating `options.read` and `options.write` sub-objects inside `options`. -* `stream = client.connect(_)` - connects the client and returns a network stream. -# streamline/lib/tools/docTool - -Documentation tool - -Usage: - - node streamline/lib/tools/docTool [path] - -Extracts documentation comments from `.js` files and generates `API.md` file -under package root. - -Top of source file must contain `/// !doc` marker to enable doc extraction. -Documentation comments must start with `/// ` (with 1 trailing space). -Extraction can be turned off with `/// !nodoc` and turned back on with `/// !doc`. - -The tool can also be invoked programatically with: - -* `doc = docTool.generate(_, path)` - extracts documentation comments from file `path` - -# streamline/lib/util/flows - -Flows Module - -The `streamline/lib/util/flows` module contains some handy utilities for streamline code - -## Array utilities - -The following functions are async equivalents of the ES5 Array methods (`forEach`, `map`, `filter`, ...) - -* `flows.each(_, array, fn, [thisObj])` - applies `fn` sequentially to the elements of `array`. - `fn` is called as `fn(_, elt, i)`. -* `result = flows.map(_, array, fn, [thisObj])` - transforms `array` by applying `fn` to each element in turn. - `fn` is called as `fn(_, elt, i)`. -* `result = flows.filter(_, array, fn, [thisObj])` - generates a new array that only contains the elements that satisfy the `fn` predicate. - `fn` is called as `fn(_, elt)`. -* `bool = flows.every(_, array, fn, [thisObj])` - returns true if `fn` is true on every element (if `array` is empty too). - `fn` is called as `fn(_, elt)`. -* `bool = flows.some(_, array, fn, [thisObj])` - returns true if `fn` is true for at least one element. - `fn` is called as `fn(_, elt)`. -* `result = flows.reduce(_, array, fn, val, [thisObj])` - reduces by applying `fn` to each element. - `fn` is called as `val = fn(_, val, elt, i, array)`. -* `result = flows.reduceRight(_, array, fn, val, [thisObj])` - reduces from end to start by applying `fn` to each element. - `fn` is called as `val = fn(_, val, elt, i, array)`. - -## Object utility - -The following function can be used to iterate through object properties: - -* `flows.eachKey(_, obj, fn)` - calls `fn(_, key, obj[key])` for every `key` in `obj`. - -## Workflow Utilities - -* `fun = flows.funnel(max)` - limits the number of concurrent executions of a given code block. - -The `funnel` function is typically used with the following pattern: - - // somewhere - var myFunnel = flows.funnel(10); // create a funnel that only allows 10 concurrent executions. - - // elsewhere - myFunnel(_, function(_) { /* code with at most 10 concurrent executions */ }); - -The `diskUsage2.js` example demonstrates how these calls can be combined to control concurrent execution. - -The `funnel` function can also be used to implement critical sections. Just set funnel's `max` parameter to 1. - -* `results = flows.collect(_, futures)` - collects the results of an array of futures - -## Context propagation - -Streamline also allows you to propagate a global context along a chain of calls and callbacks. -This context can be used like TLS (Thread Local Storage) in a threaded environment. -It allows you to have several active chains that each have their own global context. - -This kind of context is very handy to store information that all calls should be able to access -but that you don't want to pass explicitly via function parameters. The most obvious example is -the `locale` that each request may set differently and that your low level libraries should -be able to retrieve to format messages. - -The `streamline.flows` module exposes two functions to manipulate the context: - -* `oldCtx = flows.setContext(ctx)` - sets the context (and returns the old context). -* `ctx = flows.getContext()` - returns the current context. - -## Miscellaneous - -* `flows.nextTick(_)` - `nextTick` function for both browser and server. - Aliased to `process.nextTick` on the server side. -* `result = flows.apply(_, fn, thisObj, args, [index])` - Helper to apply `Function.apply` to streamline functions. - Equivalent to `result = fn.apply(thisObj, argsWith_)` where `argsWith_` is - a modified argument list in which the callback has been inserted at `index` - (at the end of the argument list if `index` is not specified). diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/AUTHORS b/lib/adapters/neo4j-lib/node_modules/streamline/AUTHORS deleted file mode 100644 index 3cb673c0..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/AUTHORS +++ /dev/null @@ -1,7 +0,0 @@ -# Authors ordered by first contribution. - -Bruno Jouhier -Preston Guillory -Will Conant -Aseem Kishore - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/README.md b/lib/adapters/neo4j-lib/node_modules/streamline/README.md deleted file mode 100644 index d22def9d..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/README.md +++ /dev/null @@ -1,155 +0,0 @@ -## streamline.js - -`streamline.js` is a small tool to simplify asynchronous Javascript programming. - -Instead of writing hairy code like: - -```javascript -function lineCount(path, callback) { - fs.readFile(path, "utf8", function(err, data) { - if (err) { callback(err); return; } - callback(null, data.split('\n').length); - }); -} -``` -Streamline.js lets you write: - -```javascript -function lineCount(path, _) { - return fs.readFile(path, "utf8", _).split('\n').length; -} -``` -You just have to follow a simple rule: - -> Replace all callbacks by an underscore and write your code as if all functions were synchronous. - -Streamline will transform the code and generate the callbacks for you! - -And streamline is not limited to a subset of Javascript. -You can use all the flow control features of Javascript in your asynchronous code: conditionals, -loops, `try/catch/finally` blocks, anonymous functions, `this`, etc. - -Streamline generates more or less the callbacks that you would write yourself. So you get the same level -of performance as with hand-written callbacks. -Also, the generated code is nicely indented, easy to read, and directly available to debuggers. - -Streamline also provides _futures_, and comes with a small optional library of helper functions (see Goodies section below). - -# On-line demo - -You can test `streamline.js` directly with the [on-line demo](http://sage.github.com/streamlinejs/examples/streamlineMe/streamlineMe.html) - -# Installation - -The easiest way to install `streamline.js` is with NPM: - -```sh -npm install streamline -g -``` - -The `-g` option installs it _globally_. -You can also install it _locally_, without `-g` but then the `node-streamline` and `coffee-streamline` -commands will not be in your default PATH. - -Note: if you encounter a permission error when installing on UNIX systems, you should retry with `sudo`. - -# Creating and running streamline modules - -To create a module called `myModule`, put your _streamlined_ source in a file called `myModule_.js`. - -Then you have several options: - -1. You can _compile_ your module with `node-streamline -c`. This will create a file called `myModule.js` that you can directly run with the `node` command, -or _require_ from a normal node program. -2. You can run the module with `node-streamline myModule_` or require it as `require('myModule_')` from a program that you launch with `node-streamline`. -If you choose this option, the `myModule.js` file will not be created. -3. You can run the module with `node-streamline myModule` or require it as `require('myModule')` from a program that you launch with `node-streamline`. -If you choose this option, you have to create an empty `myModule.js` file to initiate the process. -4. You can load source and transform it _on the fly_ with the `transform` API. - -Option 1 is ideal for production code, as your transformed module will be loaded standalone. The transformation engine will not be loaded. - -Option 2 is your best option if you do not want to save the transformed code to disk. - -Option 3 is ideal for the development phase if you do not have a build script. -The files will only be recompiled if the source has changed (so you won't get the overhead every time you launch your program). -The transformed source will be available on disk, and will be loaded by the debugger (because you require `myModule`, not `myModule_`). -Also, this option makes the switch to production really easy: recompile the whole tree and run with `node` rather than with `node-streamline`. - -Option 4 is reserved for advanced scenarios where the code is transformed on the fly. - -There is an alternative to running your application with `node-streamline`: -you can call `require('streamline')` from your main script and then run it with `node`. -Modules that are required (directly or indirectly) by your main script will be transformed on demand. - -Note: streamline can also transform vanilla Javascript files that don't use CommonJS modules and don't target node. -So you can compile them (option 1) and load them directly in the browser from a ` - - - - - - - - - - - -
- - - - - - - -

Please, generate my callbacks!

-

source code:

- sample: - - - - - - - - - - -
- -
-

streamlined code:

- show complete code -
- -
- -
-
- - \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/examples/streamlineMe/streamlineMe.js b/lib/adapters/neo4j-lib/node_modules/streamline/examples/streamlineMe/streamlineMe.js deleted file mode 100644 index 67475603..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/examples/streamlineMe/streamlineMe.js +++ /dev/null @@ -1,222 +0,0 @@ -var _demo = "\n" + -"\nwindow.demo = function(message, callback) {" + -"\n if (typeof callback !== 'function')" + -"\n throw new Error('bad callback: ' + callback);" + -"\n info(message + ' (waiting 1s)');" + -"\n setTimeout(function() {" + -"\n info(message + ' (done!)');" + -"\n callback(null, message.length);" + -"\n }, 1000);" + -"\n}" + -"\n"; - -var _samples = { - introSample: "" + - "// Demonstrates how 'streamline.js' transforms synchronous-looking code" + - "\n// into asynchronous code with callbacks." + - "\n//" + - "\n// Try one of the samples above, or write your own code below." + - "\n// Syntax is simple: just use '_' anywhere a callback is expected" + - "\n//" + - "\n// The samples compute factorial(4) by different methods." + - "\n//" + - "\n// Look at the transformed code and run it with the 'execute' button." + - "\n//" + - "\n// The transformation generates some one-liner auxiliary functions." + - "\n// Select the 'show complete code' option to see the whole code." + - "\n//" + - "\n// The 'beautify' button can help you tidy your code." + - _demo + - "\ndemo('Straight to the answer: fact(4) = 24', _);" + - "\n" + - "\n// A few pointers to understand the generated code:" + - "\n//" + - "\n// * the '_' parameter is the callback. This is where execution will" + - "\n// continue on a return or throw statement." + - "\n// * the '__then' variable is a 'then' callback. This is where execution will" + - "\n// resume at the end of the construct if it didn't encounter a return " + - "\n// or throw." + - "\n// * the '__cb' function is just a little callback wrapper that deals with " + - "\n// error handling and other small matters in a generic way." + - "\n// * the '__trap' function handles errors if the callback is missing." + - "\n", - - sequenceSample: "" + - "// Multiply one step at a time:" + - "\n" + - "\nvar fact = demo('1', _);" + - "\nfact *= demo('12', _);" + - "\nfact *= demo('123', _);" + - "\nfact *= demo('1234', _);" + - "\ndemo('fact(4) = ' + fact, _);" + - "\n", - - expressionsSample: "" + - "// Multiply all at once:" + - "\n" + - "\nvar fact = demo('1', _) * demo('12', _) * demo('123', _) * demo('1234', _);" + - "\ndemo('fact(4) = ' + fact, _)" + - "\n", - - functionsSample: "" + - "// Go through intermediate functions: " + - "\n" + - "\nfunction f(n1, n2, _) {" + - "\n return demo(n1, _) * demo(n2, _);" + - "\n}" + - "\n" + - "\nfunction g(_) {" + - "\n return f('1', '12', _) * f('123', '1234', _);" + - "\n}" + - "\n" + - "\ndemo('fact(4) = ' + g(_), _);" + - "\n", - - ifElseSample: "" + - "// Natural recursive version with if/else test." + - "\n" + - "\nfunction fact(n, _) {" + - "\n if (n == 1) { demo('return: 1', _); return 1; }" + - "\n else { demo('recurse: ' + n, _); return n * fact(n - 1, _); }" + - "\n}" + - "\n" + - "\ndemo('fact(4) = ' + fact(4, _), _);" + - "\n", - - loopSample: "" + - "// Natural iterative version" + - "\n" + - "\nfunction fact(n, _) {" + - "\n var result = 1;" + - "\n for (var str = '-'; str.length <= n; str += '-') {" + - "\n result *= demo(str, _);" + - "\n }" + - "\n return result;" + - "\n}" + - "\n" + - "\ndemo('fact(4) = ' + fact(4, _), _);" + - "\n", - - tryCatchSample: "" + - "// Recursive variant with throw/catch." + - "\n" + - "\nfunction fact(n, _) {" + - "\n try {" + - "\n demo('try: n = ' + n, _);" + - "\n if (n == 0) throw new Error('zero');" + - "\n return n * fact(n - 1, _);" + - "\n }" + - "\n catch (ex) { demo('caught ' + ex.message, _); return 1; }" + - "\n finally { demo('finally: n = ' + n, _); }" + - "\n}" + - "\n" + - "\ndemo('fact(4) = ' + fact(4, _), _);" + - "\n", - - lazySample: "" + - "// Variant with lazy eval operators." + - "\n// Note that fact(3, _) is evaluated but fact(5, _) is not" + - "\n" + - "\nfunction fact(n, _) {" + - "\n demo('n=' + n, _);" + - "\n return n == 1 ? demo('!', _) : n * fact(n - 1, _);" + - "\n}" + - "\n" + - "\nvar fact4 = (fact(3, _) - 6) || fact(4, _) || fact(5, _);" + - "\n" + - "\ndemo('fact(4) = ' + fact4, _);" + - "\n", - - futuresSample: "" + - "// Variant with futures." + - "\n// Much faster because all futures wait together" + - "\n" + - "\n// Intermediate function to return future when called" + - "\n// without _ (demo does not return future)" + - "\nfunction demo2(str, _) { return demo(str, _); }" + - "\n" + - "\nvar v1 = demo2('1');" + - "\nvar v2 = demo2('12');" + - "\nvar v3 = demo2('123');" + - "\nvar v4 = demo2('1234');" + - "\n" + - "\ndemo2('fact(4) = ' +v1(_) * v2(_) * v3(_) * v4(_));" + - "\n", -} - -var _complete = false; - -function error(message) { - $('#result').removeClass('info').addClass('error').text(message); -} - -function info(message) { - $('#result').removeClass('error').addClass('success').text(message); -} - -window.__context = { - errorHandler: function(err) { - error(err.message || err.toString()); - } -} - -eval(_demo); // define demo if user does not execute intro - -function _transform() { - var codeIn = $('#codeIn').val(); - try { - var codeOut = Streamline.transform(codeIn, { - noHelpers: !_complete, - lines: _complete ? "mark" : "ignore" - }); - $('#codeOut').val(codeOut); - info("ready") - } catch (ex) { - console.error(ex); - error(ex.message) - } -} - -function _execute() { - var codeIn = $('#codeIn').val(); - try { - var codeOut = Streamline.transform(codeIn, { - lines: "preserve" - }); - eval(codeOut); - } catch (ex) { - error(ex.message); - } -} - -function _beautify(str) { - try { - var str = Narcissus.decompiler.pp(Narcissus.parser.parse(str)); - str = str.replace(/}\s*;/g, "}") - $('#codeIn').val(str); - return true; - } catch (ex) { - error(ex.message); - return false; - } -} - -$( function() { - $('#codeIn').keyup(_transform); - $('.sample').click( function() { - $('#codeIn').val(_samples[this.id]); - _transform(); - }); - $('#beautify').click( function() { - _beautify($('#codeIn').val()); - }) - $('#complete').change( function() { - _complete = !_complete; - _transform(); - }) - $('#execute').click( function() { - _execute(); - }) - $('#codeIn').val(_samples["introSample"]); - _transform(); -}) diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/examples/streams/googleClient.js b/lib/adapters/neo4j-lib/node_modules/streamline/examples/streams/googleClient.js deleted file mode 100644 index 123399f4..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/examples/streams/googleClient.js +++ /dev/null @@ -1,38 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); try { return fn(null, result); } catch (ex) { return __propagate(_, ex); } } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } -function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } - (function __main(_) { - var streams, str, result, formatted; -/* 10 */ function google(str, _) { - if (!_) { - return __future(google, arguments, 1); - } - ; - var req, resp; -/* 16 */ req = streams.httpRequest({ -/* 17 */ url: ("http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" + str), -/* 18 */ proxy: process.env.http_proxy - }); -/* 25 */ return req.end().response(__cb(_, function(__0, __1) { - resp = __1; -/* 27 */ return resp.checkStatus(200).readAll(__cb(_, function(__0, __3) { -/* 27 */ var __2 = JSON.parse(__3); - return _(null, __2); - })); - })); - }; -/* 8 */ streams = require("../lib/server/streams"); -/* 31 */ str = ((process.argv.length > 2) ? process.argv[2] : "node.js"); -/* 34 */ return google(str, __cb(_, function(__0, __1) { - result = __1; -/* 39 */ formatted = result.responseData.results.map(function(entry) { -/* 38 */ return ((entry.url + "\n ") + entry.titleNoFormatting); -/* 39 */ }).join("\n"); -/* 40 */ console.log(formatted); - _(); - })); - }).call(this, __trap); diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/examples/streams/googleClient_.js b/lib/adapters/neo4j-lib/node_modules/streamline/examples/streams/googleClient_.js deleted file mode 100644 index 9997cf64..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/examples/streams/googleClient_.js +++ /dev/null @@ -1,40 +0,0 @@ -/* -* Usage: node-streamline googleClient searchString -* -* Demonstrates the streamline http client wrapper -*/ - -// require the streamline streams wrapper -var streams = require('../lib/server/streams'); - -function google(str, _) { - // Create the request. - // The options are the same as for node's http.request call. - // But the call also accepts a simple URL for the GET case - // But streams.requestRequest does not take any callback parameter. - // Instead, the callback is passed to the response(_) method (a few lines below). - var req = streams.httpRequest({ - url: 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=' + str, - proxy: process.env.http_proxy - }); - - // In the case of a POST request, this is where you would send - // the body with req.write calls. - - // End the request and get a response object (asynchronously) - var resp = req.end().response(_); - // Check the status, read the whole body (asynchronously) and parse it. - return JSON.parse(resp.checkStatus(200).readAll(_)); -} - -// get the search string from the command line, defaulting to "node.js" -var str = process.argv.length > 2 ? process.argv[2] : "node.js"; - -// call google to get search results -var result = google(str, _); - -// format the result and print it to console -var formatted = result.responseData.results.map( function(entry) { - return entry.url + '\n\t' + entry.titleNoFormatting; -}).join('\n'); -console.log(formatted); diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/index.html b/lib/adapters/neo4j-lib/node_modules/streamline/index.html deleted file mode 100644 index f1e15308..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/index.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - Sage/streamlinejs @ GitHub - - - - - - Fork me on GitHub - -
- -
- - - - -
- -

streamlinejs

- -
- Asynchronous Javascript for dummies -
- -

Getting started

-

Read the README

-

And try the on-line demo

- -

Contact

-

Visit the streamlinejs forum on Google Groups

- -

Download

-

- You can download this project in either - zip or - tar formats. -

-

You can also clone the project with Git - by running: -

$ git clone git://github.com/Sage/streamlinejs
-

- - -
- - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compile.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/compile.js deleted file mode 100644 index 4d2a1f8e..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compile.js +++ /dev/null @@ -1,5 +0,0 @@ -console.error("Module moved to subdirectory. New require path is streamline/lib/compiler/compile"); -var moved = require("./compiler/compile"); -for (var name in moved) - exports[name] = moved[name]; - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/command.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/command.js deleted file mode 100644 index 5fc445e8..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/command.js +++ /dev/null @@ -1,103 +0,0 @@ -"use strict"; - -/// !doc -/// -/// # streamline/lib/compiler/command -/// -/// Streamline commmand line analyzer / dispatcher -/// -var compile = require('./compile').compile; -var path = require('path'); - -function _run(){ - var argv = process.argv; - var inputs; - argv.shift(); - - if (argv.length <= 1) - return require("repl").start("node-streamline> "); - - // for now! - //return require(path.join(process.cwd(), argv[1])); - var options = { - action: "run", - lines: "mark" - }; - while (argv[1] && argv[1][0] == '-') { - var arg = argv.splice(1, 1)[0]; - switch (arg) { - case '-c': - case '--compile': - options.action = "compile"; - inputs = argv.splice(1, argv.length - 1); - break; - case '-f': - case '--force': - options.force = true; - break; - case '-v': - case '--verbose': - options.verbose = true; - break; - case '-lm': - case '--lines-mark': - options.lines = "mark"; - break; - case '-li': - case '--lines-ignore': - options.lines = "ignore"; - break; - case '-lm': - case '--lines-mark': - options.lines = "mark"; - break; - case '-lp': - case '--lines-preserve': - options.lines = "preserve"; - break; - case '-h': - case '--help': - options.action = "help"; - break; - default: - throw new Error("unkown option " + arg + ". Try -h for help"); - } - } - switch (options.action) { - case "run": - if (argv.length < 1) { - throw new Error("invalid command line. Try -h for help"); - } - require(path.join(process.cwd(), argv[1])); - break; - case "compile": - compile(function(err) { - err && console.error(err.message + "\n" + err.stack); - }, inputs, options); - break; - case "help": - console.log("Usage:"); - console.log(" node-streamline module\n"); - console.log("Available options:"); - console.log(" -c, --compile compile *_.js files and save as *.js files"); - console.log(" -f, --force force recompilation"); - console.log(" -v, --verbose verbose"); - console.log(" -li, --lines-ignore ignore line numbers"); - console.log(" -lm, --lines-mark mark with line numbers"); - console.log(" -lp, --lines-preserve preserve line numbers"); - console.log(" -h, --help displays this help message"); - console.log(""); - break; - } -} - -/// * `command.run()` -/// runs `node-streamline` command line analyzer / dispatcher -exports.run = function(){ - try { - _run(); - } - catch (ex) { - console.error(ex.message + "\n" + ex.stack); - } -} diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/compile.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/compile.js deleted file mode 100644 index a401e89f..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/compile.js +++ /dev/null @@ -1,304 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -"use strict"; -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); try { return fn(null, result); } catch (ex) { return __propagate(_, ex); } } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } -function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } -function __tryCatch(_, fn){ try { fn(); } catch (e) { try { _(e); } catch (ex) { __trap(ex); } } } -var fs = require("fs"); -var fspath = require("path"); -var transform = require("./transform"); -var flows = require("../util/flows"); -function _exists(callback, fname) { - fspath.exists(fname, function(result) { - callback(null, result); - }); -}; -function _mkdir(dir, mode, _) { - if (!_) { - return __future(_mkdir, arguments, 2); - } -; - var p; - p = fspath.dirname(dir); - return _exists(p, __cb(_, function(__0, __2) { - var __1 = !__2; - return (function(__then) { - if (__1) { - return _mkdir(p, mode, __cb(_, __then)); - } - else { - __then(); - } - ; - })(function() { - return fs.mkdir(dir, mode, _); - }); - })); -}; -function mtime(_, fname) { - if (!_) { - return __future(mtime, arguments, 0); - } -; - return (function(_) { - return _exists(__cb(_, function(__0, __1) { - var __2 = __1; - return (function(__then) { - if (__2) { - return fs.stat(fname, __cb(_, function(__0, __4) { - var __3 = __4.mtime; - return _(null, __3); - })); - } - else { - __then(); - } - ; - })(function() { - return _(null, 0); - }); - }), fname); - })(_); -}; -exports.loadFile = function __1(_, path, options) { - if (!_) { - return __future(__1, arguments, 0); - } -; - var dontSave, js, js_, mtimejs, mtimejs_, banner, content, transformed; - if ((path.indexOf(".js") == (path.length - 3))) { - path = path.substring(0, (path.length - 3)); - } -; - options = (options || { - }); - options.sourceName = path; - dontSave = (path[(path.length - 1)] == "_"); - if (dontSave) { - path = path.substring(0, (path.length - 1)); - options.lines = (options.lines || "preserve"); - } - else { - options.lines = (options.lines || "mark"); - } -; - js = (path + ".js"); - js_ = (path + "_.js"); - return mtime(__cb(_, function(__0, __2) { - mtimejs = __2; - return mtime(__cb(_, function(__0, __3) { - mtimejs_ = __3; - banner = transform.banner(); - if ((options.lines !== "preserve")) { - banner += "\n"; - } - ; - return (function(__then) { - if (mtimejs_) { - return fs.readFile(js_, "utf8", __cb(_, function(__0, __4) { - content = __4; - return (function(_) { - var __1 = mtimejs; - if (!__1) { - return _(null, __1); - } - ; - return fs.readFile(js, "utf8", _); - })(__cb(_, function(__0, __5) { - transformed = __5; - if ((((transformed && (mtimejs_ < mtimejs)) && (transformed.substring(0, banner.length) == banner)) && !options.force)) { - return _(null, transformed); - } - ; - if (options.verbose) { - console.log(("streamline: transforming: " + js_)); - } - ; - transformed = (banner + transform.transform(content, options)); - return (function(__then) { - if (!dontSave) { - return (function(__then) { - (function(_) { - __tryCatch(_, function() { - return fs.writeFile(js, transformed, "utf8", __cb(_, __then)); - }); - })(function(ex, __result) { - __tryCatch(_, function() { - if (ex) { - __then(); - } - else { - _(null, __result); - } - ; - }); - }); - })(function() { - __tryCatch(_, __then); - }); - } - else { - __then(); - } - ; - })(function() { - return _(null, transformed); - }); - })); - })); - } - else { - return fs.readFile(js, "utf8", _); - } - ; - })(_); - }), js_); - }), js); -}; -function mtimeSync(fname) { - try { - return fs.statSync(fname).mtime; - } catch (ex) { - return 0; - }; -}; -exports.loadFileSync = function(path, options) { - if ((path.indexOf(".js") == (path.length - 3))) { - path = path.substring(0, (path.length - 3)); - }; - options = (options || { - }); - options.sourceName = path; - var dontSave = (path[(path.length - 1)] == "_"); - if (dontSave) { - path = path.substring(0, (path.length - 1)); - options.lines = (options.lines || "preserve"); - } - else { - options.lines = (options.lines || "mark"); - } -; - var js = (path + ".js"); - var js_ = (path + "_.js"); - var mtimejs = mtimeSync(js); - var mtimejs_ = mtimeSync(js_); - var banner = transform.banner(); - if ((options.lines !== "preserve")) { - banner += "\n"; - }; - if (mtimejs_) { - var content = fs.readFileSync(js_, "utf8"); - var transformed = (mtimejs && fs.readFileSync(js, "utf8")); - if ((((transformed && (mtimejs_ < mtimejs)) && (transformed.substring(0, banner.length) == banner)) && !options.force)) { - return transformed - }; - if (options.verbose) { - console.log(("streamline: transforming: " + js_)); - }; - var transformed = (banner + transform.transform(content, options)); - if (!dontSave) { - try { - fs.writeFileSync(js, transformed, "utf8"); - } catch (ex) { - - }; - } - ; - return transformed; - } - else { - return fs.readFileSync(js, "utf8"); - } -; -}; -exports.compile = function __2(_, paths, options) { - if (!_) { - return __future(__2, arguments, 0); - } -; - var failed, cwd; - function _compile(_, path, options) { - if (!_) { - return __future(_compile, arguments, 0); - } - ; - var stat, js; - return fs.stat(path, __cb(_, function(__0, __2) { - stat = __2; - return (function(__then) { - if (stat.isDirectory()) { - return fs.readdir(path, __cb(_, function(__0, __3) { - return flows.each(__cb(_, __then), __3, function __1(_, f) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - return _compile(_, ((path + "/") + f), options); - }); - })); - } - else { - return (function(__then) { - if ((stat.isFile() && path.match(/_\.js$/))) { - return (function(__then) { - (function(_) { - __tryCatch(_, function() { - js = (path.substring(0, (path.length - 4)) + ".js"); - return exports.loadFile(__cb(_, __then), js, options); - }); - })(function(ex, __result) { - __tryCatch(_, function() { - if (ex) { - console.error(ex.message); - failed++; - __then(); - } - else { - _(null, __result); - } - ; - }); - }); - })(function() { - __tryCatch(_, __then); - }); - } - else { - __then(); - } - ; - })(__then); - } - ; - })(_); - })); - }; - failed = 0; - options = (options || { - }); - if (options.verbose) { - console.log(("transform version: " + transform.version)); - } -; - if ((!paths || (paths.length == 0))) { - return _(new Error("cannot compile: no files specified")); - } -; - cwd = process.cwd; - return flows.each(__cb(_, function() { - if (failed) { - return _(new Error((("errors found in " + failed) + " files"))); - } - ; - _(); - }), paths, function __1(_, path) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - return _compile(_, fspath.join(cwd, path), options); - }); -}; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/compile_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/compile_.js deleted file mode 100644 index 145d5d8d..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/compile_.js +++ /dev/null @@ -1,191 +0,0 @@ -//streamline.options = { "lines" : "ignore" } -"use strict"; - -/// !doc -/// -/// # streamline/lib/compiler/compile -/// -/// Streamline compiler and file loader -/// -var fs = require("fs"); -var fspath = require("path"); -var transform = require('./transform'); -var flows = require('../util/flows'); - -function _exists(callback, fname) { - fspath.exists(fname, function(result) { - callback(null, result); - }) -} - -function _mkdir(dir, mode, _) { - var p = fspath.dirname(dir); - if (!_exists(p, _)) - _mkdir(p, mode, _); - fs.mkdir(dir, mode, _); -} - -function mtime(_, fname) { - return _exists(_, fname) ? fs.stat(fname, _).mtime : 0; -} - -/// * `script = compile.loadFile(_, path, options)` -/// Loads Javascript file and transforms it if necessary. -/// Returns the transformed source. -/// If `path` is `foo_.js`, the source is transformed and the result -/// is *not* saved to disk. -/// If `path` is `foo.js` and if a `foo_.js` file exists, -/// `foo_.js` is transformed if necessary and saved as `foo.js`. -/// If `path` is `foo.js` and `foo_.js` does not exist, the contents -/// of `foo.js` is returned. -/// `options` is a set of options passed to the transformation engine. -/// If `options.force` is set, `foo_.js` is transformed even if -/// `foo.js` is more recent. -exports.loadFile = function(_, path, options) { - if (path.indexOf(".js") == path.length - 3) - path = path.substring(0, path.length - 3); - options = options || {}; - options.sourceName = path; - var dontSave = path[path.length - 1] == '_'; - if (dontSave) { - path = path.substring(0, path.length - 1); - options.lines = options.lines || "preserve"; - } - else { - options.lines = options.lines || "mark"; - } - var js = path + ".js"; - var js_ = path + "_.js"; - - var mtimejs = mtime(_, js); - var mtimejs_ = mtime(_, js_); - - var banner = transform.banner(); - if (options.lines !== "preserve") - banner += "\n"; - - if (mtimejs_) { - var content = fs.readFile(js_, 'utf8', _); - var transformed = mtimejs && fs.readFile(js, 'utf8', _); - if (transformed - && mtimejs_ < mtimejs - && transformed.substring(0, banner.length) == banner - && !options.force) - return transformed; - if (options.verbose) - console.log("streamline: transforming: " + js_) - var transformed = banner + transform.transform(content, options); - if (!dontSave) { - // try/catch because write will fail if file was installed globally (npm -g) - try { - fs.writeFile(js, transformed, 'utf8', _); - } - catch (ex) { - } - } - return transformed; - } - else { - return fs.readFile(js, 'utf8', _); - } -} - -function mtimeSync(fname) { - try { - return fs.statSync(fname).mtime; - } - catch (ex) { - return 0; - } -} - -/// * `script = compile.loadFileSync(path, options)` -/// Synchronous version of `compile.loadFile`. -/// Used by `require` logic. -exports.loadFileSync = function(path, options) { - if (path.indexOf(".js") == path.length - 3) - path = path.substring(0, path.length - 3); - options = options || {}; - options.sourceName = path; - var dontSave = path[path.length - 1] == '_'; - if (dontSave) { - path = path.substring(0, path.length - 1); - options.lines = options.lines || "preserve"; - } - else { - options.lines = options.lines || "mark"; - } - var js = path + ".js"; - var js_ = path + "_.js"; - - var mtimejs = mtimeSync(js); - var mtimejs_ = mtimeSync(js_); - - var banner = transform.banner(); - if (options.lines !== "preserve") - banner += "\n"; - - if (mtimejs_) { - var content = fs.readFileSync(js_, 'utf8'); - var transformed = mtimejs && fs.readFileSync(js, 'utf8'); - if (transformed - && mtimejs_ < mtimejs - && transformed.substring(0, banner.length) == banner - && !options.force) - return transformed; - if (options.verbose) - console.log("streamline: transforming: " + js_) - var transformed = banner + transform.transform(content, options); - if (!dontSave) { - // try/catch because write will fail if file was installed globally (npm -g) - try { - fs.writeFileSync(js, transformed, 'utf8'); - } - catch (ex) { - } - } - return transformed; - } - else { - return fs.readFileSync(js, 'utf8'); - } -} - -/// * `compile.compile(_, paths, options)` -/// Compiles streamline source files in `paths`. -/// Generates a `foo.js` file for each `foo_.js` file found in `paths`. -/// `paths` may be a list of files or a list of directories which -/// will be traversed recursively. -/// `options` is a set of options for the `transform` operation. -exports.compile = function(_, paths, options) { - function _compile(_, path, options) { - var stat = fs.stat(path, _); - if (stat.isDirectory()) { - flows.each(_, fs.readdir(path, _), function(_, f) { - _compile(_, path + "/" + f, options) - }); - } else if (stat.isFile() && path.match(/_\.js$/)) { - try { - var js = path.substring(0, path.length - 4) + ".js"; - exports.loadFile(_, js, options); - } catch (ex) { - console.error(ex.message); - failed++; - } - } - // else ignore - } - - var failed = 0; - options = options || {}; - if (options.verbose) - console.log("transform version: " + transform.version) - if (!paths || paths.length == 0) - throw new Error("cannot compile: no files specified"); - var cwd = process.cwd; - flows.each(_, paths, function(_, path) { - _compile(_, fspath.join(cwd, path), options); - }); - if (failed) - throw new Error("errors found in " + failed + " files"); -} diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/format.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/format.js deleted file mode 100644 index 289bdfe5..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/format.js +++ /dev/null @@ -1,585 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Narcissus JavaScript engine. - * - * The Initial Developer of the Original Code is - * Brendan Eich . - * Portions created by the Initial Developer are Copyright (C) 2010 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Shu-Yu Guo - * Bruno Jouhier - * Gregor Richards - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -if (typeof exports !== 'undefined') { - var Narcissus = require('../../deps/narcissus'); -} -(function(exports){ - eval(Narcissus.definitions.consts); - var tokens = Narcissus.definitions.tokens; - - exports.format = function(node, linesOpt) { - var result = ''; - - var ppOut = _pp(node); - if (linesOpt == "ignore") - return ppOut.source; - - var lineMap = ppOut.lineMap; - - var lines = ppOut.source.split("\n"); - - if (linesOpt == "preserve") { - var outputLineNo = 1; - for (var i = 0; i < lines.length; i++) { - var sourceNodes = (lineMap[i] || []).filter(function(n) { return n._isSourceNode }); - if (sourceNodes.length > 0) { - var sourceLineNo = sourceNodes[0].lineno; - while (outputLineNo < sourceLineNo) { - result += "\n"; - outputLineNo += 1; - } - } - result += lines[i].replace(/^\s+/, ' '); - } - } - else if (linesOpt == "mark"){ - for (var i = 0; i < lines.length; i++) { - var line = lines[i]; - var sourceNodes = (lineMap[i] || []).filter(function(n) { return n._isSourceNode }); - var linePrefix = ' '; - if (sourceNodes.length > 0) { - var sourceLineNo = '' + sourceNodes[0].lineno; - linePrefix = '/* '; - for (var j = sourceLineNo.length; j < 5; j++) linePrefix += ' '; - linePrefix += sourceLineNo + ' */ '; - } - result += linePrefix + line + "\n"; - } - } - else - throw new Error("bad --lines option: " + linesOpt) - - return result; - } - - /** Narcissus.decompiler.pp with line number tracking **/ - function _pp(node) { - - var curLineNo = 0; - var lineNodeMap = {}; - - var src = pp(node); - - return { - source: src, - lineMap: lineNodeMap - }; - - function countNewline(s) { - curLineNo += 1; - return s; - } - - function indent(n, s) { - var ss = "", d = true; - - for (var i = 0, j = s.length; i < j; i++) { - if (d) - for (var k = 0; k < n; k++) - ss += " "; - ss += s[i]; - d = s[i] === '\n'; - } - - return ss; - } - - function isBlock(n) { - return n && (n.type === BLOCK); - } - - function isNonEmptyBlock(n) { - return isBlock(n) && n.children.length > 0; - } - - function nodeStr(n) { - return '"' + - n.value.replace(/\\/g, "\\\\") - .replace(/"/g, "\\\"") - .replace(/\n/g, "\\n") - .replace(/\r/g, "\\r") + - '"'; - } - - function pp(n, d, inLetHead) { - var topScript = false; - - if (!n) - return ""; - if (!(n instanceof Object)) - return n; - if (!d) { - topScript = true; - d = 1; - } - - if (!lineNodeMap[curLineNo]) - lineNodeMap[curLineNo] = []; - - lineNodeMap[curLineNo].push(n); - - var p = ""; - - if (n.parenthesized) - p += "("; - - switch (n.type) { - case FUNCTION: - case GETTER: - case SETTER: - if (n.type === FUNCTION) - p += "function"; - else if (n.type === GETTER) - p += "get"; - else - p += "set"; - - p += (n.name ? " " + n.name : "") + "("; - for (var i = 0, j = n.params.length; i < j; i++) - p += (i > 0 ? ", " : "") + pp(n.params[i], d); - p += ") " + pp(n.body, d); - break; - - case SCRIPT: - case BLOCK: - var nc = n.children; - if (topScript) { - // No indentation. - for (var i = 0, j = nc.length; i < j; i++) { - if (i > 0) - p += countNewline("\n"); - p += pp(nc[i], d); - var eoc = p[p.length - 1]; - if (eoc != ";") - p += ";"; - } - - break; - } - - p += "{"; - if (n.id !== undefined) - p += " /* " + n.id + " */"; - p += countNewline("\n"); - for (var i = 0, j = nc.length; i < j; i++) { - if (i > 0) - p += countNewline("\n"); - p += indent(2, pp(nc[i], d)); - var eoc = p[p.length - 1]; - if (eoc != ";") - p += ";"; - } - p += countNewline("\n}"); - break; - - case LET_BLOCK: - p += "let (" + pp(n.variables, d, true) + ") "; - if (n.expression) - p += pp(n.expression, d); - else - p += pp(n.block, d); - break; - - case IF: - p += "if (" + pp(n.condition, d) + ") "; - - var tp = n.thenPart, ep = n.elsePart; - var b = isBlock(tp) || isBlock(ep); - if (!b) - p += countNewline("{\n"); - p += (b ? pp(tp, d) : indent(2, pp(tp, d))) - if (ep && ";}".indexOf(p[p.length - 1]) < 0) - p += ";"; - p += countNewline("\n"); - - if (ep) { - if (!b) - p += countNewline("} else {\n"); - else - p += " else "; - - p += (b ? pp(ep, d) : indent(2, pp(ep, d))) + countNewline("\n"); - } - if (!b) - p += "}"; - break; - - case SWITCH: - p += "switch (" + pp(n.discriminant, d) + countNewline(") {\n"); - for (var i = 0, j = n.cases.length; i < j; i++) { - var ca = n.cases[i]; - if (ca.type === CASE) - p += "case " + pp(ca.caseLabel, d) + countNewline(":\n"); - else - p += countNewline(" default:\n"); - ps = pp(ca.statements, d); - p += ps.slice(2, ps.length - 2) + countNewline("\n"); - } - p += "}"; - break; - - case FOR: - p += "for (" + pp(n.setup, d) + "; " - + pp(n.condition, d) + "; " - + pp(n.update, d) + ") "; - - var pb = pp(n.body, d); - if (!isBlock(n.body)) - p += countNewline("{\n") + indent(2, pb) + countNewline(";\n}"); - else if (n.body) - p += pb; - break; - - case WHILE: - p += "while (" + pp(n.condition, d) + ") "; - - var pb = pp(n.body, d); - if (!isBlock(n.body)) - p += countNewline("{\n") + indent(2, pb) + countNewline(";\n}"); - else - p += pb; - break; - - case FOR_IN: - var u = n.varDecl; - p += n.isEach ? "for each (" : "for ("; - p += (u ? pp(u, d) : pp(n.iterator, d)) + " in " + - pp(n.object, d) + ") "; - - var pb = pp(n.body, d); - if (!isBlock(n.body)) - p += countNewline("{\n") + indent(2, pb) + countNewline(";\n}"); - else if (n.body) - p += pb; - break; - - case DO: - p += "do " + pp(n.body, d); - p += " while (" + pp(n.condition, d) + ");"; - break; - - case BREAK: - p += "break" + (n.label ? " " + n.label : "") + ";"; - break; - - case CONTINUE: - p += "continue" + (n.label ? " " + n.label : "") + ";"; - break; - - case TRY: - p += "try "; - p += pp(n.tryBlock, d); - for (var i = 0, j = n.catchClauses.length; i < j; i++) { - var t = n.catchClauses[i]; - p += " catch (" + pp(t.varName, d) + - (t.guard ? " if " + pp(t.guard, d) : "") + - ") "; - p += pp(t.block, d); - } - if (n.finallyBlock) { - p += " finally "; - p += pp(n.finallyBlock, d); - } - break; - - case THROW: - p += "throw " + pp(n.exception, d); - break; - - case RETURN: - p += "return"; - if (n.value) - p += " " + pp(n.value, d); - break; - - case YIELD: - p += "yield"; - if (n.value.type) - p += " " + pp(n.value, d); - break; - - case GENERATOR: - p += pp(n.expression, d) + " " + pp(n.tail, d); - break; - - case WITH: - p += "with (" + pp(n.object, d) + ") "; - p += pp(n.body, d); - break; - - case LET: - case VAR: - case CONST: - var nc = n.children; - if (!inLetHead) { - p += tokens[n.type] + " "; - } - for (var i = 0, j = nc.length; i < j; i++) { - if (i > 0) - p += ", "; - var u = nc[i]; - p += pp(u.name, d); - if (u.initializer) - p += " = " + pp(u.initializer, d); - } - break; - - case DEBUGGER: - p += countNewline("debugger NYI\n"); - break; - - case SEMICOLON: - if (n.expression) { - p += pp(n.expression, d) + ";"; - } - break; - - case LABEL: - p += n.label + countNewline(":\n") + pp(n.statement, d); - break; - - case COMMA: - case LIST: - var nc = n.children; - for (var i = 0, j = nc.length; i < j; i++) { - if (i > 0) - p += ", "; - p += pp(nc[i], d); - } - break; - - case ASSIGN: - var nc = n.children; - var t = n.assignOp; - p += pp(nc[0], d) + " " + (t ? tokens[t] : "") + "=" + " " + pp(nc[1], d); - break; - - case HOOK: - var nc = n.children; - p += "(" + pp(nc[0], d) + " ? " - + pp(nc[1], d) + " : " - + pp(nc[2], d); - p += ")"; - break; - - case OR: - case AND: - var nc = n.children; - p += "(" + pp(nc[0], d) + " " + tokens[n.type] + " " - + pp(nc[1], d); - p += ")"; - break; - - case BITWISE_OR: - case BITWISE_XOR: - case BITWISE_AND: - case EQ: - case NE: - case STRICT_EQ: - case STRICT_NE: - case LT: - case LE: - case GE: - case GT: - case IN: - case INSTANCEOF: - case LSH: - case RSH: - case URSH: - case PLUS: - case MINUS: - case MUL: - case DIV: - case MOD: - var nc = n.children; - p += "(" + pp(nc[0], d) + " " + tokens[n.type] + " " - + pp(nc[1], d) + ")"; - break; - - case DELETE: - case VOID: - case TYPEOF: - p += tokens[n.type] + " " + pp(n.children[0], d); - break; - - case NOT: - case BITWISE_NOT: - p += tokens[n.type] + pp(n.children[0], d); - break; - - case UNARY_PLUS: - p += "+" + pp(n.children[0], d); - break; - - case UNARY_MINUS: - p += "-" + pp(n.children[0], d); - break; - - case INCREMENT: - case DECREMENT: - if (n.postfix) { - p += pp(n.children[0], d) + tokens[n.type]; - } else { - p += tokens[n.type] + pp(n.children[0], d); - } - break; - - case DOT: - var nc = n.children; - p += pp(nc[0], d) + "." + pp(nc[1], d); - break; - - case INDEX: - var nc = n.children; - p += pp(nc[0], d) + "[" + pp(nc[1], d) + "]"; - break; - - case CALL: - var nc = n.children; - p += pp(nc[0], d) + "(" + pp(nc[1], d) + ")"; - break; - - case NEW: - case NEW_WITH_ARGS: - var nc = n.children; - p += "new " + pp(nc[0], d); - if (nc[1]) - p += "(" + pp(nc[1], d) + ")"; - break; - - case ARRAY_INIT: - p += "["; - var nc = n.children; - for (var i = 0, j = nc.length; i < j; i++) { - if(nc[i]) - p += pp(nc[i], d); - p += "," - } - p += "]"; - break; - - case ARRAY_COMP: - p += "[" + pp (n.expression, d) + " "; - p += pp(n.tail, d); - p += "]"; - break; - - case COMP_TAIL: - var nc = n.children; - for (var i = 0, j = nc.length; i < j; i++) { - if (i > 0) - p += " "; - p += pp(nc[i], d); - } - if (n.guard) - p += " if (" + pp(n.guard, d) + ")"; - break; - - case OBJECT_INIT: - var nc = n.children; - if (nc[0] && nc[0].type === PROPERTY_INIT) - p += countNewline("{\n"); - else - p += "{"; - for (var i = 0, j = nc.length; i < j; i++) { - if (i > 0) { - p += countNewline(",\n"); - } - - var t = nc[i]; - if (t.type === PROPERTY_INIT) { - var tc = t.children; - var l; - // see if the left needs to be a string - if (tc[0].value === "" || /[^A-Za-z0-9_$]/.test(tc[0].value)) { - l = nodeStr(tc[0]); - } else { - l = pp(tc[0], d); - } - p += indent(2, l) + ": " + - indent(2, pp(tc[1], d)).substring(2); - } else { - p += indent(2, pp(t, d)); - } - } - p += countNewline("\n}"); - break; - - case NULL: - p += "null"; - break; - - case THIS: - p += "this"; - break; - - case TRUE: - p += "true"; - break; - - case FALSE: - p += "false"; - break; - - case IDENTIFIER: - case NUMBER: - case REGEXP: - p += n.value; - break; - - case STRING: - p += nodeStr(n); - break; - - case GROUP: - p += "(" + pp(n.children[0], d) + ")"; - break; - - default: - throw "PANIC: unknown operation " + tokens[n.type] + " " + n.toSource(); - } - - if (n.parenthesized) - p += ")"; - - return p; - } - } -})(typeof exports !== 'undefined' ? exports : (window.Streamline = window.Streamline || {})); diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/index.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/index.js deleted file mode 100644 index 491fb673..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/index.js +++ /dev/null @@ -1,4 +0,0 @@ -require("./register").register(); -exports.transform = require("./transform"); -exports.compile = require("./compile").compile -exports.command = require("./command"); diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/register.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/register.js deleted file mode 100644 index 080f55c8..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/register.js +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -"use strict"; -var fs = require("fs"); -var path = require("path"); -var transform = require("./transform"); -var compile = require("./compile"); -var registered = false; - -/// !doc -/// -/// # streamline/lib/compiler/register -/// -/// Streamline `require` handler registration -/// -/// * `register.register(options)` -/// Registers `require` handlers for streamline. -/// `options` is a set of default options passed to the `transform` function. -exports.register = function(options) { - if (registered) - return; - registered = true; - - require.extensions[".js"] = function(module, filename) { - var content = compile.loadFileSync(filename, options); - module._compile(content, filename); - }; - - // we'll also override .coffee registration to support streamlining, but - // only if .coffee has already been registered. if not, nothing to do: - if (!require.extensions['.coffee']) - return; - - // .coffee has been registered, so we'll include coffee-script, but be - // robust to failure (this is an edge case though). - try { - var coffee = require('coffee-script'); - } catch (ex) { - return; - } - - var origCoffeeRequire = require.extensions['.coffee']; - require.extensions['.coffee'] = function(module, filename) { - // we'll only handle files that are named in the streamline style: - if (!filename.match(/_\.coffee$/)) { - return origCoffeeRequire(module, filename); - } - - var content = fs.readFileSync(filename, 'utf8'); - - // coffee compiles by default with a function wrapper. this breaks - // streamline since the function wrapper doesn't have the necessary - // callback parameter. we could manually add it (e.g. using regex), - // but the good news is we don't need coffee's function wrapper, - // since streamline adds its own, so we tell coffee not to add it. - var compiled = coffee.compile(content, { - bare: true - }); - - // support the same file-level options that we support in JS, e.g. a - // custom callback parameter. we unfortunately need to duplicate this - // logic that's already in transform() because the JS generated by - // coffee doesn't include single-line comments (e.g. # foo). - var options; - var sourceOptions = /streamline\.options\s*=\s*(\{.*\})/.exec(content); - if (sourceOptions) { - options = JSON.parse(sourceOptions[1]); - } else { - options = {}; - } - - // either way, default to "lines preserve" since we're require()-ing. - options.lines = options.lines || "preserve"; - - module._compile(transform.transform(compiled, options), filename); - }; -}; - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/transform.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/transform.js deleted file mode 100644 index f6214319..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/compiler/transform.js +++ /dev/null @@ -1,1630 +0,0 @@ - -/** - * Copyright (c) 2011 Bruno Jouhier - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ -/// !doc -/// -/// # streamline/lib/compiler/transform -/// -/// Streamline's transformation engine -/// -if (typeof exports !== 'undefined') { - var Narcissus = require('../../deps/narcissus'); - var format = require('./format').format; -} -else { - var format = Streamline.format; -} -(function(exports){ - //"use strict"; - var parse = Narcissus.parser.parse; - var pp = Narcissus.decompiler.pp; - var definitions = Narcissus.definitions; - - eval(definitions.consts.replace(/const /g, "var ")); - - function _assert(cond){ - if (!cond) - throw new Error("Assertion failed!") - } - function _tag(node){ - if (!node || !node.type) - return "*NOT_A_NODE*"; - var t = definitions.tokens[node.type]; - return /^\W/.test(t) ? definitions.opTypeNames[t] : t.toUpperCase(); - } - - /* - * Utility functions - */ - function _node(ref, type, children){ - return { - _scope: ref && ref._scope, - _async: ref && ref._async, - type: type, - children: children - }; - } - - function _identifier(name, initializer){ - return { - _scope: initializer && initializer._scope, - type: IDENTIFIER, - name: name, - value: name, - initializer: initializer - }; - } - - function _number(val){ - return { - type: NUMBER, - value: val - }; - } - - function _return(node){ - return { - type: RETURN, - _scope: node._scope, - value: node - }; - } - - function _semicolon(node){ - var stmt = _node(node, SEMICOLON); - stmt.expression = node; - return stmt; - } - // cosmetic stuff: template logic generates nested blocks. Flatten them. - function _flatten(node){ - if (node.type == BLOCK || node.type == SCRIPT) { - do { - var found = false; - var children = []; - node.children.forEach(function(child){ - if (child._isFunctionReference || (child.type == SEMICOLON && (child.expression == null || child.expression._isFunction))) - return; // eliminate empty statement and dummy function node; - node._async |= child._async; - if (child.type == BLOCK || child.type == SCRIPT) { - children = children.concat(child.children); - found = true; - } - else - children.push(child); - }) - node.children = children; - } - while (found); - } - return node; - } - - // generic helper to traverse parse tree - // if doAll is true, fn is called on every property, otherwise only on sub-nodes - // if clone object is passed, values returned by fn are assigned to clone properties - function _propagate(node, fn, doAll, clone){ - var result = clone ? clone : node; - for (var prop in node) { - // funDecls and expDecls are aliases to children - // target property creates loop (see Node.prototype.toString) - if (node.hasOwnProperty(prop) && - prop.indexOf("Decls") < 0 && - (doAll || prop != 'target') && - prop[0] != '_') { - var child = node[prop]; - if (child != null) { - if (Array.isArray(child)) { - if (clone) - result[prop] = (child = [].concat(child)); - var undef = false; - for (var i = 0; i < child.length; i++) { - if (doAll || (child[i] && child[i].type)) { - child[i] = fn(child[i], node); - undef |= typeof child[i] === "undefined" - } - } - if (undef) { - result[prop] = child.filter(function(elt){ - return typeof elt !== "undefined"; - }); - } - } - else { - if (doAll || (child && child.type)) - result[prop] = fn(child, node); - - } - } - } - } - return result; - } - - // clones the tree rooted at node. - function _clone(node){ - var lastId = 0; - var clones = {}; // target property creates cycles - function cloneOne(child){ - if (!child || !child.type) - return child; - var cloneId = child._cloneId; - if (!cloneId) - cloneId = (child._cloneId = ++lastId); - var clone = clones[cloneId]; - if (clone) - return clone; - clones[cloneId] = (clone = { - _cloneId: cloneId - }); - return _propagate(child, cloneOne, true, clone); - } - - return _propagate(node, cloneOne, true, {}); - } - - /* - * Utility class to generate parse trees from code templates - */ - function Template(pass, fn, isExpression, createScope){ - // parser the function and set the root - var _root = parse(fn.toString()).children[0].body; - if (_root.children.length == 1) - _root = _root.children[0]; - else - _root = _node(_root.children[0], BLOCK, _root.children); - - // if template is an expression rather than a full statement, go one more step down - //if (isExpression) - // _root = _root.expression; - - // generates a parse tree from a template by substituting bindings. - this.generate = function(scopeNode, bindings){ - var scope = scopeNode._scope; - _assert(scope != null); - bindings = bindings || {}; - var fn = null; - function gen(node){ - if (node.type != SCRIPT && node.type != BLOCK) - node._pass = pass; - if (node.type == FUNCTION && createScope) { - _assert(fn == null); - fn = node; - } - if (!node || !node.type) { - if (node == "_") - return scope.options.callback; - // not a parse node - replace if it is a name that matches a binding - return typeof node === "string" && node[0] === "$" ? bindings[node] : node; - } - node._scope = scope; - // if node is ident; statement (SEMICOLON) or ident expression, try to match with binding - var ident = node.type == SEMICOLON ? node.expression : node; - if (ident && ident.type == IDENTIFIER && ident.value[0] === "$") { - var result = bindings[ident.value]; - // transfer initializer if there is one - if (ident.initializer) { - result.initializer = gen(ident.initializer); - if (result.initializer._async) - result._async = true; - } - return result; - } - else { - // recurse through sub nodes - node = _propagate(node, function(child){ - child = gen(child); - // propagate async flag like analyze phase - if (child && (child._async || (child === scope.options.callback && createScope)) && node.type !== FUNCTION) - node._async = true; - return child; - }, true); - node = _flatten(node); - return node; - } - } - - // generate - var result = gen(_clone(_root)); - if (fn) { - // parser drops parenthesized flag (because of return) - fn.parenthesized = true; - var scope = new Scope(fn.body, fn._scope.options); - scope.last = fn._scope.last; - _assert(fn.params[0] === fn._scope.options.callback); - scope.cbIndex = 0; - function _changeScope(node, parent){ - if (node.type == FUNCTION) - return node; - node._scope = scope; - return _propagate(node, _changeScope); - } - _propagate(fn, _changeScope); - } - return isExpression ? result.value : result; - } - this.root = isExpression ? _root.value : _root; // for simplify pass - } - - /* - * Utility to generate names of intermediate variables - */ - function Scope(script, options){ - this.script = script; - this.last = 0; - this.vars = []; - this.functions = []; - this.options = options; - this.cbIndex = -1; - this.isAsync = function(){ - return this.cbIndex >= 0; - } - } - - function _genId(node){ - return "__" + ++node._scope.last; - } - - /* - * Preliminary pass: mark source nodes so we can map line numbers - */ - function _markSource(node){ - function _markOne(node){ - node._isSourceNode = true; - _propagate(node, function(child){ - _markOne(child); - return child; - }); - } - - _markOne(node); - } - - /* - * Canonicalization pass: wrap top level script if async - */ - function _isScriptAsync(script, options){ - var async = false; - function _doIt(node, parent){ - switch (node.type) { - case FUNCTION: - // do not propagate into functions - return node; - case IDENTIFIER: - if (node.value == options.callback) { - async = true; - } - else { // propagate only if async is still false - _propagate(node, _doIt); - } - return node; - default: - // do not propagate if async has been found - if (!async) { - _propagate(node, _doIt); - } - return node; - } - } - _propagate(script, _doIt); - return async; - } - - var _rootTemplate = new Template("root", function _t(){ - (function __main(_){ - $script - }).call(this, __trap); - }); - - function _canonTopLevelScript(script, options){ - script._scope = new Scope(script, options); - if (_isScriptAsync(script, options)) - return _rootTemplate.generate(script, { - $script: script - }); - else - return script; - } - - /* - * Scope canonicalization pass: - * Set _scope on all nodes - * Set _async on all nodes that contain an async marker - * Move vars and functions to beginning of scope. - * Replace this by __this. - * Set _breaks flag on all statements that end with return, throw or break - */ - var _assignTemplate = new Template("canon", function _t(){ - $lhs = $rhs; - }); - - function _canonScopes(node, options){ - function _doIt(node, parent){ - var scope = parent._scope; - node._scope = scope; - var async = scope.isAsync(); - if (!async && node.type !== FUNCTION) { - if (node.type === IDENTIFIER && node.value === options.callback) - throw new Error(node.filename + ": Function contains async calls but does not have _ parameter: " + node.name + " at line " + node.lineno); - return _propagate(node, _doIt); - } - - switch (node.type) { - case FUNCTION: - var result = node; - var cbIndex = node.params.reduce(function(index, param, i){ - if (param != options.callback) - return index; - if (index < 0) - return i; - else - throw new Error("duplicate _ parameter"); - }, -1); - if (cbIndex >= 0) { - // assign names to anonymous functions (for futures) - if (!node.name) - node.name = _genId(node); - } - // if function is a statement, move it away - if (async && (parent.type === SCRIPT || parent.type === BLOCK)) { - scope.functions.push(node); - result = undefined; - } - // create new scope for the body - var bodyScope = new Scope(node.body, options); - node.body._scope = bodyScope; - bodyScope.name = node.name; - bodyScope.cbIndex = cbIndex; - node.body = _propagate(node.body, _doIt); - // insert declarations at beginning of body - node.body.children = bodyScope.functions.concat(node.body.children); - if (bodyScope.hasThis && !node._inhibitThis) { - bodyScope.vars.push(_identifier("__this", _node(node, THIS))); - } - if (bodyScope.hasArguments && !node._inhibitArguments) { - bodyScope.vars.push(_identifier("__arguments", _identifier("arguments"))); - } - if (bodyScope.vars.length > 0) { - node.body.children.splice(0, 0, _node(node, VAR, bodyScope.vars)); - } - // do not set _async flag - return result; - case VAR: - var children = node.children.map(function(child){ - if (!scope.vars.some(function(elt){ - return elt.value == child.value; - })) { - scope.vars.push(_identifier(child.value)); - } - if (!child.initializer) - return null; - child = _assignTemplate.generate(parent, { - $lhs: _identifier(child.value), - $rhs: child.initializer - }); - if (parent.type === FOR) - child = child.expression; - return child; - }).filter(function(child){ - return child != null; - }); - if (children.length == 0) { - return; - } - var type = parent.type == BLOCK || parent.type === SCRIPT ? BLOCK : COMMA; - var result = _node(parent, type, children); - result = _propagate(result, _doIt); - parent._async |= result._async; - return result; - case THIS: - scope.hasThis = true; - return _identifier("__this"); - case IDENTIFIER: - if (node.value === "arguments") { - scope.hasArguments = true; - return _identifier("__arguments"); - } - node = _propagate(node, _doIt); - node._async |= node.value === options.callback; - parent._async |= node._async; - return node; - case CALL: - _convertCoffeeScriptCalls(node, options); - // fall through - default: - // todo: set breaks flag - node = _propagate(node, _doIt); - _setBreaks(node); - parent._async |= node._async; - return node; - } - } - return _propagate(node, _doIt); - } - - function _convertCoffeeScriptCalls(node, options){ - // takes care of anonymous functions inserted by - // CoffeeScript compiler - var fn = node.children[0]; - var args = node.children[1]; - if (fn.type === FUNCTION && - fn.params.length === 0 && - !fn.name && - args.children.length == 0) { - // (function() { ... })() - fn._noFuture = true; - fn.params = [options.callback]; - args.children = [_identifier(options.callback)]; - } - else if (fn.type === DOT) { - var ident = fn.children[1]; - fn = fn.children[0]; - if (fn.type === FUNCTION && - fn.params.length === 0 && - !fn.name && - ident.type === IDENTIFIER) { - if (ident.value === "call" && - args.children.length === 1 && - args.children[0].type === THIS) { - // (function() { ... }).call(this) - node.children[0] = fn; - fn._noFuture = true; - fn.params = [options.callback]; - args.children = [_identifier(options.callback)]; - node._scope.hasThis = true; - fn._inhibitThis = true; - } - else if (ident.value === "apply" && - args.children.length === 2 && - args.children[0].type === THIS && - args.children[1].type === IDENTIFIER && - args.children[1].value === "arguments") { - // (function() { ... }).apply(this, arguments) - node.children[0] = fn; - fn._noFuture = true; - fn.params = [options.callback]; - args.children = [_identifier(options.callback)]; - node._scope.hasThis = true; - node._scope.hasArguments = true; - fn._inhibitThis = true; - fn._inhibitArguments = true; - } - } - } - } - - function _setBreaks(node){ - switch (node.type) { - case IF: - node._breaks = node.thenPart._breaks && node.elsePart && node.elsePart._breaks; - break; - case SWITCH: - for (var i = 0; i < node.cases.length; i++) { - var stmts = node.cases[i].statements; - if (node._async && stmts.children.length > 0 && !stmts._breaks) { - // narcissus has the strange idea of inserting an empty default after last case. - // If we detect this and if the last case is not terminated by a break, we do not consider it an error - // and we just fix it by adding a break. - if (i == node.cases.length - 2 && - node.cases[i + 1].type === DEFAULT && - node.cases[i + 1].statements.children.length === 1 && - node.cases[i + 1].statements.children[0].type === SEMICOLON && - node.cases[i + 1].statements.children[0].expression == null) { - stmts.children.push(_node(node, BREAK)); - stmts._breaks = true; - } - else if (i === node.cases.length - 1) { - stmts.children.push(_node(node, BREAK)); - stmts._breaks = true; - } - else { - throw new Error(node.filename + ": unsupported construct: switch case with some path not terminated by break, return or throw"); - } - } - } - break; - case TRY: - node._breaks = node.tryBlock._breaks && node.catchClauses[0] && node.catchClauses[0].block._breaks; - break; - case BLOCK: - case SCRIPT: - node.children.forEach(function(child){ - node._breaks |= child._breaks; - }); - break; - case RETURN: - case THROW: - case BREAK: - node._breaks = true; - break; - } - } - - /* - * Flow canonicalization pass: - * Converts all loops to FOR format - * Converts lazy expressions - * Splits try/catch/finally - * Wraps isolated statements into blocks - */ - function _statementify(exp){ - if (!exp) - return exp; - var block = _node(exp, BLOCK, []); - function uncomma(node){ - if (node.type === COMMA) { - node.children.forEach(uncomma); - } - else { - block.children.push(node.type == SEMICOLON ? node : _semicolon(node)); - } - } - uncomma(exp); - return block; - - } - function _blockify(node){ - if (!node || node.type == BLOCK) - return node; - if (node.type == COMMA) - return _statementify(node); - var block = _node(node, BLOCK, [node]); - block._async = node._async; - return block; - } - - var _flowsTemplates = { - WHILE: new Template("flows", function _t(){ - { - for (; $condition;) { - $body; - } - } - }), - - DO: new Template("flows", function _t(){ - { - var $firstTime = true; - for (; $firstTime || $condition;) { - $firstTime = false; - $body; - } - } - }), - - FOR: new Template("flows", function _t(){ - { - $setup; - for (; $condition; $update) { - $body; - } - } - }), - - FOR_IN: new Template("flows", function _t(){ - { - var $array = __forIn($object); - var $i = 0; - for (; $i < $array.length;) { - $iter = $array[$i++]; - $body; - } - } - }), - - TRY: new Template("flows", function _t(){ - try { - try { - $try; - } - catch ($ex) { - $catch; - } - } - finally { - $finally; - } - }), - - AND: new Template("flows", function _t(){ - return (function(_){ - var $v = $op1; - if (!$v) { - return $v; - } - return $op2; - })(_) - }, true, true), - - OR: new Template("flows", function _t(){ - return (function(_){ - var $v = $op1; - if ($v) { - return $v; - } - return $op2; - })(_) - }, true, true), - - HOOK: new Template("flows", function _t(){ - return (function(_){ - var $v = $condition; - if ($v) { - return $true; - } - return $false; - })(_); - }, true, true), - - CONDITION: new Template("flows", function _t(){ - return (function(_){ - return $condition; - })(_); - }, true, true), - - UPDATE: new Template("flows", function _t(){ - return (function(_){ - $update; - })(_); - }, true, true) - }; - - function _canonFlows(node, options){ - function _doIt(node, parent){ - var scope = node._scope; - function _doAsyncFor(node) { - // extra pass to wrap async condition and update - if (node.condition && node.condition._async && node.condition.type !== CALL) - node.condition = _flowsTemplates.CONDITION.generate(node, { - $condition: node.condition - }); - if (node.update && node.update._async) - node.update = _flowsTemplates.UPDATE.generate(node, { - $update: _statementify(node.update) - }); - } - if (node.type == FOR && node._pass === "flows") - _doAsyncFor(node); - if (!scope || !scope.isAsync() || node._pass === "flows") - return _propagate(node, _doIt); - - switch (node.type) { - case IF: - node.thenPart = _blockify(node.thenPart); - node.elsePart = _blockify(node.elsePart); - break; - case SWITCH: - if (node._async) { - var def = node.cases.filter(function(n){ - return n.type == DEFAULT - })[0]; - if (!def) { - def = _node(node, DEFAULT); - def.statements = _node(node, BLOCK, []); - node.cases.push(def); - } - if (!def._breaks) { - def.statements.children.push(_node(node, BREAK)) - } - } - break; - case WHILE: - node.body = _blockify(node.body); - if (node._async) { - node = _flowsTemplates.WHILE.generate(node, { - $condition: node.condition, - $body: node.body - }); - } - break; - case DO: - node.body = _blockify(node.body); - if (node._async) { - node = _flowsTemplates.DO.generate(node, { - $firstTime: _identifier(_genId(node)), - $condition: node.condition, - $body: node.body - }); - } - break; - case FOR: - node.body = _blockify(node.body); - if (node._async) { - if (node.setup) { - node = _flowsTemplates.FOR.generate(node, { - $setup: _statementify(node.setup), - $condition: node.condition, - $update: node.update, - $body: node.body - }); - } - else { - if (node._pass !== "flows") { - node._pass = "flows"; - _doAsyncFor(node); - } - } - } - break; - case FOR_IN: - node.body = _blockify(node.body); - if (node._async) { - if (node.iterator.type != IDENTIFIER) { - throw new Error("unsupported 'for ... in' syntax: type=" + _tag(node.iterator)); - } - node = _flowsTemplates.FOR_IN.generate(node, { - $array: _identifier(_genId(node)), - $i: _identifier(_genId(node)), - $object: node.object, - $iter: node.iterator, - $body: node.body - }); - } - break; - case TRY: - if (node._async) { - if (node.tryBlock && node.catchClauses[0] && node.finallyBlock) { - node = _flowsTemplates.TRY.generate(node, { - $try: node.tryBlock, - $catch: node.catchClauses[0].block, - $ex: node.catchClauses[0].varName, - $finally: node.finallyBlock - }) - } - } - break; - case AND: - case OR: - if (node._async) { - node = _flowsTemplates[_tag(node)].generate(node, { - $v: _identifier(_genId(node)), - $op1: node.children[0], - $op2: node.children[1] - }); - } - break; - case HOOK: - if (node._async) { - node = _flowsTemplates.HOOK.generate(node, { - $v: _identifier(_genId(node)), - $condition: node.children[0], - $true: node.children[1], - $false: node.children[2] - }); - } - break; - } - return _propagate(node, _doIt); - } - return _propagate(node, _doIt); - } - - /* - * Disassembly pass - */ - function _split(node, prop){ - var exp = node[prop]; - if (!exp || !exp._async) - return node; - var id = _genId(node); - var v = _identifier(id, exp); - node[prop] = _identifier(id); - return _node(node, BLOCK, [_node(node, VAR, [v]), node]); - } - - function _disassemble(node, options){ - function _disassembleIt(node, parent, noResult){ - if (!node._async) - return _propagate(node, _scanIt); - node = _propagate(node, _disassembleIt); - if (node.type === CALL) { - if (node.children[0].type === IDENTIFIER && - node.children[0].value.indexOf('__wrap') == 0) { - node._isWrapper = true; - return node; - } - var args = node.children[1]; - if (args.children.some(function(arg){ - return (arg.type === IDENTIFIER && arg.value === options.callback) || arg._isWrapper; - })) { - if (noResult) { - node._scope.disassembly.push(_statementify(node)); - return; - } - else { - if (parent.type == IDENTIFIER && parent.value.indexOf('__') === 0) { - // don't generate another ID, use the parent one - node._skipDisassembly = true; - return node; - } - var id = _genId(node); - var v = _identifier(id, node); - node = _node(node, VAR, [v]); - node._scope.disassembly.push(node); - return _identifier(id); - } - } - } - return node; - } - function _scanIt(node, parent){ - var scope = node._scope; - if (!scope || !scope.isAsync() || !node._async) - return _propagate(node, _scanIt); - switch (node.type) { - case IF: - node = _split(node, "condition"); - break; - case SWITCH: - node = _split(node, "discriminant"); - break; - case FOR: - break; - case RETURN: - node = _split(node, "value"); - break; - case THROW: - node = _split(node, "exception"); - break; - case VAR: - _assert(node.children.length === 1); - var ident = node.children[0]; - scope.disassembly = []; - ident.initializer = _disassembleIt(ident.initializer, ident); - node._async = ident.initializer._skipDisassembly; - scope.disassembly.push(node); - return _node(parent, BLOCK, scope.disassembly); - case SEMICOLON: - scope.disassembly = []; - node.expression = _disassembleIt(node.expression, node, true); - if (node.expression) { - node._async = false; - scope.disassembly.push(node); - } - return _node(parent, BLOCK, scope.disassembly); - } - return _propagate(node, _scanIt); - } - return _propagate(node, _scanIt); - - } - - /* - * Transformation pass - introducing callbacks - */ - var _cbTemplates = { - FUNCTION_PEDANTIC: new Template("cb", function _t(){ - { - if (!_) { - return __future.call(this, $fn, arguments, $index); - } - _ = __wrapIn(_); - try { - $body; - _(); - } - catch (e) { - return __propagate(_, e); - } - } - }), - FUNCTION_THIS: new Template("cb", function _t(){ - { - if (!_) { - return __future.call(this, $fn, arguments, $index); - } - $body; - _(); - } - }), - FUNCTION: new Template("cb", function _t(){ - { - if (!_) { - return __future($fn, arguments, $index); - } - $body; - _(); - } - }), - FUNCTION_INTERNAL: new Template("cb", function _t(){ - { - $body; - _(); - } - }), - RETURN: new Template("cb", function _t(){ - return _(null, $value); - }), - RETURN_UNDEFINED: new Template("cb", function _t(){ - return _(null); - }), - THROW: new Template("cb", function _t(){ - return _($exception); - }), - - IF: new Template("cb", function _t(){ - return (function(__then){ - if ($condition) { - $then; - __then(); - } - else { - $else; - __then(); - } - })(function(){ - $tail; - }); - }), - - SWITCH: new Template("cb", function _t(){ - return (function(__break){ - $statement; - })(function(){ - $tail; - }); - }), - - BREAK: new Template("cb", function _t(){ - return __break(); - }), - CONTINUE: new Template("cb", function _t(){ - return __loop(); - }), - LOOP1: new Template("cb", function _(){ - if ($v) { - $body; - __loop(); - } - else { - __break(); - } - }), - // LOOP2 is in temp pass so that it gets transformed if update is async - LOOP2: new Template("temp", function _(){ - var $v = $condition; - $loop1; - }), - LOOP2_UPDATE: new Template("temp", function _(){ - if ($beenHere) { - $update; - } - else { - $beenHere = true; - } - var $v = $condition; - $loop1; - }), - FOR: new Template("cb", function _(){ - return (function(__break){ - var __loop = __nt(_, function(){ - $loop2 - }); - __loop(); - })(function(){ - $tail; - }); - }), - FOR_UPDATE: new Template("cb", function _(){ - var $beenHere = false; - return (function(__break){ - var __loop = __nt(_, function(){ - $loop2 - }); - __loop(); - })(function(){ - $tail; - }); - }), - - CATCH: new Template("cb", function _t(){ - return (function(__then){ - (function(_){ - __tryCatch(_, function(){ - $try; - __then(); - }); - })(function($ex, __result){ - __tryCatch(_, function(){ - if ($ex) { - $catch; - __then(); - } - else { - _(null, __result); - } - }); - }); - })(function(){ - __tryCatch(_, function(){ - $tail; - }); - }); - }), - - FINALLY: new Template("cb", function _t(){ - return (function(__then){ - (function(_){ - __tryCatch(_, function(){ - $try; - _(null, null, true); - }); - })(function(__e, __r, __cont){ - (function(__then){ - __tryCatch(_, function(){ - $finally; - __then(); - }); - })(function(){ - __tryCatch(_, function(){ - if (__cont) - __then(); - else - _(__e, __r); - }); - }) - }); - })(function(){ - __tryCatch(_, function(){ - $tail; - }); - }); - }), - - CALL_VOID: new Template("cb", function _t(){ - return __cb(_, function(){ - $tail; - }) - }, true), - - CALL_TMP: new Template("cb", function _t(){ - return __cb(_, function(__0, $result){ - $tail - }) - }, true), - CALL_RESULT: new Template("cb", function _t(){ - return __cb(_, function(__0, $v){ - var $result = $v; - $tail - }) - }, true) - }; - - function _callbackify(node, options){ - function _scanIt(node, parent){ - //console.log("CBIT: " + _tag(node) + " " + pp(node)) - node = _flatten(node); - if (!node._scope || !node._scope.isAsync() || node._pass === "cb") - return _propagate(node, _scanIt); - switch (node.type) { - case SCRIPT: - if (parent._pass !== "cb") { - var template = parent._noFuture || parent._pass === "flows" || parent.name == "__main" ? _cbTemplates.FUNCTION_INTERNAL : (options.tryCatch === "pedantic" ? _cbTemplates.FUNCTION_PEDANTIC : (node._scope.hasThis ? _cbTemplates.FUNCTION_THIS : _cbTemplates.FUNCTION)); - node = template.generate(node, { - $fn: parent.name, //node._scope.name ? _identifier(node._scope.name) : _node(node, NULL), - $index: _number(node._scope.cbIndex), - $body: node - }); - } - node.type = SCRIPT; - // continue with block restructure - case BLOCK: - for (var i = 0; i < node.children.length; i++) { - node.children[i] = _restructureIt(node, i); - } - return node; - } - return _propagate(node, _scanIt); - } - function _extractTail(parent, i){ - return _node(parent, BLOCK, parent.children.splice(i + 1, parent.children.length - i - 1)); - } - function _restructureIt(parent, i){ - var node = parent.children[i]; - if (node._pass === "cb") - return _propagate(node, _scanIt); - //console.log("RESTRUCTUREIT: " + _tag(node) + " " + pp(node)) - switch (node.type) { - case RETURN: - _extractTail(parent, i); - var template = node.value ? _cbTemplates.RETURN : _cbTemplates.RETURN_UNDEFINED; - node = template.generate(node, { - $value: node.value - }); - break; - case THROW: - _extractTail(parent, i); - node = _cbTemplates.THROW.generate(node, { - $exception: node.exception - }); - break; - case BREAK: - if (node.target && !node.target._async) { - break; - } - _extractTail(parent, i); - if (node.label) { - throw new Error(node.filename + ": labelled break not supported yet"); - } - node = _cbTemplates.BREAK.generate(node, {}); - break; - case CONTINUE: - if (node.target && !node.target._async) { - break; - } - _extractTail(parent, i); - if (node.label) { - throw new Error(node.filename + ": labelled continue not supported yet"); - } - node = _cbTemplates.CONTINUE.generate(node, {}); - break; - default: - if (node._async) { - var tail = _extractTail(parent, i); - switch (node.type) { - case IF: - node = _cbTemplates.IF.generate(node, { - $condition: node.condition, - $then: node.thenPart, - $else: node.elsePart || _node(node, BLOCK, []), - $tail: tail - }); - break; - case SWITCH: - node._pass = "cb"; // avoid infinite recursion - node = _cbTemplates.SWITCH.generate(node, { - $statement: node, - $tail: tail - }); - break; - case FOR: - var v = _identifier(_genId(node)); - var loop1 = _cbTemplates.LOOP1.generate(node, { - $v: v, - $body: node.body, - }); - var update = node.update; - var beenHere = update && _identifier(_genId(node)); - var loop2 = (update ? _cbTemplates.LOOP2_UPDATE : _cbTemplates.LOOP2).generate(node, { - $v: v, - $condition: node.condition, - $beenHere: beenHere, - $update: _statementify(update), - $loop1: loop1 - }); - node = (update ? _cbTemplates.FOR_UPDATE : _cbTemplates.FOR).generate(node, { - $beenHere: beenHere, - $loop2: loop2, - $tail: tail - - }); - break; - case TRY: - if (node.catchClauses[0]) { - node = _cbTemplates.CATCH.generate(node, { - $try: node.tryBlock, - $catch: node.catchClauses[0].block, - $ex: node.catchClauses[0].varName, - $tail: tail - }); - } - else { - node = _cbTemplates.FINALLY.generate(node, { - $try: node.tryBlock, - $finally: node.finallyBlock, - $tail: tail - }); - } - break; - case VAR: - _assert(node.children.length == 1); - var ident = node.children[0]; - _assert(ident.type === IDENTIFIER); - var call = ident.initializer; - delete ident.initializer; - _assert(call && call.type === CALL); - return _restructureCall(call, tail, ident.value); - case SEMICOLON: - var call = node.expression; - _assert(call.type === CALL) - return _restructureCall(call, tail); - default: - throw new Error("internal error: bad node type: " + _tag(node) + ": " + pp(node)); - } - } - } - return _scanIt(node, parent); - - function _restructureCall(node, tail, result){ - var args = node.children[1]; - function _cbIndex(args){ - return args.children.reduce(function(index, arg, i){ - if ((arg.type == IDENTIFIER && arg.value === options.callback) || arg._isWrapper) - return i; - else - return index; - }, -1); - } - var i = _cbIndex(args); - _assert(i >= 0); - if (args.children[i]._isWrapper) { - args = args.children[i].children[1]; - i = _cbIndex(args); - } - args.children[i] = (result ? result.indexOf('__') === 0 ? _cbTemplates.CALL_TMP : _cbTemplates.CALL_RESULT : _cbTemplates.CALL_VOID).generate(node, { - $v: _genId(node), - $result: result, - $tail: tail - }); - node = _propagate(node, _scanIt); - - var stmt = _node(node, RETURN, []); - stmt.value = node; - stmt._pass = "cb"; - return stmt; - } - } - return _propagate(node, _scanIt); - } - - /* - * Simplify pass - introducing callbacks - */ - function _checkUsed(val, used){ - if (typeof val === "string" && val.substring(0, 2) === "__") - used[val] = true; - } - - - var _optims = { - function__0$fn: new Template("simplify", "function _t(){ return function(__0) { $fn(); } }", true).root, - function$return: new Template("simplify", "function _t(){ return function() { return $fn(); } }", true).root, - function__0$arg1return_null$arg2: new Template("simplify", "function _t(){ return function(__0, $arg1) { return _(null, $arg2); } }", true).root, - __cb__: new Template("simplify", "function _t(){ return __cb(_, _) }", true).root, - function$fn: new Template("simplify", "function _t(){ return function () {$fn();} }", true).root - - } - - function _simplify(node, options, used){ - if (node._simplified) - return node; - node._simplified = true; - _propagate(node, function(child){ - return _simplify(child, options, used) - }); - _checkUsed(node.value, used); - - function _match(prop, v1, v2, result){ - var ignored = ["parenthesized", "lineno", "start", "end", "tokenizer", "hasReturnWithValue"]; - if (prop.indexOf('_') == 0 || ignored.indexOf(prop) >= 0) - return true; - if (v1 == v2) - return true; - if (v1 == null || v2 == null) { - // ignore difference between null and empty array - if (prop == "children" && v1 && v1.length === 0) - return true; - return false; - } - if (Array.isArray(v1)) { - if (v1.length != v2.length) - return false; - for (var i = 0; i < v1.length; i++) { - if (!_match(prop, v1[i], v2[i], result)) - return false; - } - return true; - } - if (typeof v1 == "string" && v1[0] == "$" && typeof v2 == "string") { - result[v1] = v2; - return true; - } - if (v1.type) { - var exp; - if (v1.type == SCRIPT && v1.children[0] && - (exp = v1.children[0].expression) && - typeof exp.value == "string" && - exp.value[0] == '$') { - result[exp.value] = v2; - return true; - } - if (v1.type != v2.type) - return false; - if (v1.type == IDENTIFIER && v1.value == '$') { - result[v1.value] = v2.value; - return true; - } - - for (var prop in v1) { - if (v1.hasOwnProperty(prop) && prop.indexOf("Decls") < 0 && prop != "target") { - if (!_match(prop, v1[prop], v2[prop], result)) - return false; - } - } - return true; - } - return false; - } - - var result = {}; - if (_match("", _optims.function__0$fn, node, result)) - return _identifier(result.$fn); - if (_match("", _optims.function$return, node, result) && result.$fn === '__break') - return _identifier(result.$fn); - if (_match("", _optims.function__0$arg1return_null$arg2, node, result) && result.$arg1 == result.$arg2) - return _identifier("_"); - if (_match("", _optims.__cb__, node)) - return _identifier("_"); - if (_match("", _optims.function$fn, node, result) && (result.$fn === '_' || result.$fn === '__then' || result.$fn === '__loop')) - return _identifier(result.$fn); - _flatten(node); - return node; - } - - var __global = "var __global = typeof global !== 'undefined' ? global : window;"; - - function __cbSafe(_, fn){ - var ctx = __global.__context; - return function(err, result){ - __global.__context = ctx; - if (err) - return _(err); - try { - return fn(null, result); - } - catch (ex) { - return __propagate(_, ex); - } - } - } - - function __cb(_, fn){ - var ctx = __global.__context; - return function(err, result){ - __global.__context = ctx; - if (err) - return _(err); - return fn(null, result); - } - } - - function __cbStr(options){ - return (options && options.tryCatch !== "fast") ? __cbSafe.toString().replace("Safe", "") : __cb.toString(); - } - - // unfortunately callee is gone. So we need to pass a function - function __future(fn, args, i){ - var done, err, result; - var cb = function(e, r){ - done = true; - err = e, result = r; - }; - args = Array.prototype.slice.call(args); - args[i] = function(e, r){ - cb(e, r); - }; - fn.apply(this, args); - return function(_){ - if (done) - _.call(this, err, result); - else - cb = _.bind(this); - } -.bind(this); - } - - // don't go through process.nextTick/setTimeout at every iteration - function __nt(_, fn){ - var i = 0; - var cb = __cb(_, fn); - var safeCb = function(){ - try { - cb(); - } - catch (ex) { - __propagate(cb, ex); - } - }; - if (typeof process != "undefined" && typeof process.nextTick == "function") - return function(){ - if (++i % 20 == 0) - process.nextTick(safeCb); - else - cb(); - }; - else - return function(){ - if (++i % 20 == 0) - setTimeout(safeCb); - else - cb(); - }; - } - - function __propagate(_, err){ - try { - _(err); - } - catch (ex) { - __trap(ex); - } - } - - function __trap(err){ - if (err) { - if (__global.__context && __global.__context.errorHandler) - __global.__context.errorHandler(err); - else - console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); - } - } - - function __tryCatch(_, fn){ - try { - fn(); - } - catch (e) { - try { - _(e); - } - catch (ex) { - __trap(ex); - } - } - } - - function __forIn(object){ - var array = []; - for (var obj in object) { - array.push(obj); - } - return array; - } - - function __wrapIn(cb){ - return function(err, result){ - try { - cb(err, result); - } - catch (ex) { - __trap(ex); - } - } - } - - function __wrapOut(cb){ - return function(err, result){ - try { - cb(err, result); - } - catch (ex) { - if (err) - __trap(ex); - else - cb(ex); - } - } - } - - function _extend(obj, other){ - for (var i in other) { - obj[i] = other[i]; - } - return obj; - } - - function _cl(obj){ - return _extend({}, obj); - } - - /// * `transformed = transform.transform(source, options)` - /// Transforms streamline source. - /// The following `options` may be specified: - /// * `tryCatch` controls exception handling - /// * `lines` controls line mapping - /// * `callback` alternative identifier if `_` is already used. - /// * `noHelpers` disables generation of helper functions (`__cb`, etc.) - exports.transform = function(source, options){ - try { - //console.log("TRANSFORMING " + options.sourceName) - options = options ? _cl(options) : {}; // clone to isolate options set at file level - var sourceOptions = /streamline\.options\s*=\s*(\{.*\})/.exec(source); - if (sourceOptions) { - _extend(options, JSON.parse(sourceOptions[1])); - } - else if (source.indexOf("pragma streamline.extraTryCatch") >= 0) { - options.tryCatch = "pedantic"; - } - options.callback = options.callback || "_"; - options.tryCatch = options.tryCatch || "safe"; - options.lines = options.lines || "mark"; - //console.log("source=" + source); - var node = parse(source + "\n"); // final newline avoids infinite loop if unterminated string literal at the end - var strict = node.children[0] && node.children[0].expression && node.children[0].expression.value == "use strict"; - strict && node.children.splice(0, 1); - _markSource(node); - //console.log("tree=" + node); - node = _canonTopLevelScript(node, options); - //console.log("CANONTOPLEVEL=" + pp(node)); - node = _canonScopes(node, options); - //console.log("CANONSCOPES=" + pp(node)); - node = _canonFlows(node, options); - //console.log("CANONFLOWS=" + pp(node)); - node = _disassemble(node, options); - //console.log("DISASSEMBLE=" + pp(node)) - node = _callbackify(node, options); - //console.log("CALLBACKIFY=" + pp(node)) - var used = {}; - node = _simplify(node, options, used); - - var result = format(node, options.lines); - - // add helpers at beginning so that __global is initialized before any other code - if (!options.noHelpers) - result = exports.helpersSource(options, used, strict) + result; - //console.log("result=" + result); - //console.log("TRANSFORMED " + options.sourceName + ": " + result.length) - return result; - } - catch (err) { - var message = "error streamlining " + (options.sourceName || 'source') + ": " + err.message; - if (err.source && err.cursor) { - var line = 1; - for (var i = 0; i < err.cursor; i++) { - if (err.source[i] === "\n") - line += 1; - } - message += " on line " + line; - } - throw new Error(message); - } - } - function _trim(fn){ - return fn.toString().replace(/\s+/g, " "); - } - - exports.helpersSource = function(options, used, strict){ - var sep = options.lines == "preserve" ? " " : "\n"; - strict = strict ? '"use strict";' + sep : ""; - used.__propagate = used.__propagate || used.__nt || options.tryCatch !== "fast"; - used.__trap = used.__trap || used.__propagate || used.__tryCatch || used.__wrapIn || used.__wrapOut; - return sep + strict + __global + - ((!used || used.__cb) ? sep + _trim(__cbStr(options)) : "") + - ((!used || used.__future) ? sep + _trim(__future) : "") + - ((!used || used.__nt) ? sep + _trim(__nt) : "") + - ((!used || used.__propagate) ? sep + _trim(__propagate) : "") + - ((!used || used.__trap) ? sep + _trim(__trap) : "") + - ((!used || used.__tryCatch) ? sep + _trim(__tryCatch) : "") + - ((!used || used.__forIn) ? sep + _trim(__forIn) : "") + - ((!used || used.__wrapIn) ? sep + _trim(__wrapIn) : "") + - ((!used || used.__wrapOut) ? sep + _trim(__wrapOut) : "") + - sep; - } - exports.version = "0.1.35"; - - exports.banner = function(){ - // important: no newline, to support lines-preserve option! - return "/*** Generated by streamline " + exports.version + " - DO NOT EDIT ***/"; - } -})(typeof exports !== 'undefined' ? exports : (window.Streamline = window.Streamline || {})); diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/index.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/index.js deleted file mode 100644 index 7ecf62d8..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/index.js +++ /dev/null @@ -1,5 +0,0 @@ -//console.error("Module moved to subdirectory. New require path is streamline/lib/compiler"); -var moved = require("./compiler/index"); -for (var name in moved) - exports[name] = moved[name]; - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/register.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/register.js deleted file mode 100644 index 95c21339..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/register.js +++ /dev/null @@ -1,5 +0,0 @@ -console.error("Module moved to subdirectory. New require path is streamline/lib/compiler/register"); -var moved = require("./compiler/register"); -for (var name in moved) - exports[name] = moved[name]; - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/client/require.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/client/require.js deleted file mode 100644 index 2125bc3a..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/client/require.js +++ /dev/null @@ -1,170 +0,0 @@ -/// !doc -/// -/// # streamline/lib/require/client/require -/// -/// Client-side require script -/// -(function(exports, global){ - var _sandboxes = {}; - var _sources = {}; - var _known = []; - - var _evaluate = eval("(function() {})") != null ? (function(str){ - return eval(str); - }) : function(str){ - return new Function("return " + str)(); - }; - - function _combine(path, rel){ - var cut = path.lastIndexOf('/'); - if (cut < 0) - throw new Error("too many parent dirs" + rel); - path = path.substring(0, cut); - while (rel.indexOf('./.') == 0) // get rid of leading ./. and ./.. - rel = rel.substring(2); - if (rel.indexOf('../') == 0) - return _combine(path, rel.substring(1)); - if (rel.indexOf('./') != 0) - return rel; - return path + rel.substring(1); - } - - - // deprecated. remove later - function _print(str){ - console.log(str); - }; - - function _load(path, callback){ - if (_sources[path]) - return callback(); - //console.log("require: loading " + path) - $.ajax({ - type: "GET", - url: "/require?module=" + encodeURIComponent(path) + "&known=" + _known.join(","), - dataType: "text", - data: null, - success: function(data, statusText, xhr){ - var contentType = xhr.getResponseHeader("Content-Type"); - var boundary = /.*boundary="([^"]*)".*/.exec(contentType); - if (!boundary || !boundary[1]) - return callback(new Error("no boundary")); - var parts = data.split("\n--" + boundary[1]); - if (!parts || parts.length < 1 || parts[parts.length - 1].indexOf("--") != 0) - return callback(new Error("end marker missing")); - for (var i = 1; i < parts.length - 1; i++) { - var part = parts[i]; - var sep = part.indexOf('\n\n'); - if (sep < 0) - return callback(new Error("empty line missing")); - var headers = {}; - part.substring(0, sep).split('\n').forEach(function(line){ - var pair = line.split(': '); - headers[pair[0]] = pair[1]; - }); - var body = part.substring(sep + 2); - var id = headers["Content-ID"]; - if (id == "ERROR") - return callback(new Error(body)); - var location = headers["Content-Location"]; - if (!location) - return callback(new Error("content location missing")); - //console.log("require: got source " + location + ": " + body.length + " bytes"); - _sources[location] = body; - } - _known.push(path); - return callback(); - }, - error: function(xhr, message, ex){ - return callback(new Error(message)); - } - }); - } - - function _sandbox(path, isMain){ - if (_sandboxes[path]) - return _sandboxes[path]; - - try { - //console.log("require: creating sandbox " + path); - var sandbox = {}; - // for now assume that directories resolve to main or index - var source = _sources[path]; - if (source == null && (source = _sources[path + "/main"])) - path = path + "/main"; - if (source == null && (source = _sources[path + "/index"])) - path = path + "/index"; - if (source == null) - throw new Error("source missing: " + path + " keys=" + Object.keys(_sources)); - - _sandboxes[path] = sandbox; - source = "(function(require, exports, module, system, print) {\n" + source + "\n})"; - source = source + '\n//@ sourceURL=' + path + '\n'; - var factory = _evaluate(source); - //delete _sources[path]; -- we need it for circular references - - // prepare parameters for source wrapper - var module = { - /// * `id = module.id` - /// the `id` of the current module. - id: path, - toString: function(){ - return this.id; - } - }; - /// * `module = require(id)` - /// _requires_ a module synchronously. - /// `id` _must_ be a string literal. - var require = function(id){ - return _sandbox(_combine(path, id)); - }; - /// * `module = require.async(id, _)` - /// _requires_ a module asynchronously. - /// `id` may be a variable or an expression. - require.async = function(id, callback){ - var p = _combine(path, id); - if (_sandboxes[p]) { - setTimeout(function() { - callback(null, _sandboxes[p]); - }, 0) - } - else { - _load(p, function(err){ - if (err) return callback(err); - try { - _sandbox(p); - return callback(null, _sandboxes[p]); - } - catch (ex) { - return callback(ex); - } - }); - } - } - - /// * `main = require.main` - /// return the main module - require.main = isMain ? module : null; - factory.call({}, require, sandbox, module, null, _print); - return sandbox; - } - catch (ex) { - throw new Error("module initialization failed: " + path + ": " + ex); - } - } - - // setup require.main and export it. - var _require = function(id){ - console.error("require not allowed in this context. Use require.main"); - } - - /// * `require.main(id)` - /// loads main module from HTML page. - _require.main = function(path){ - _load(path, function(){ - _sandbox(path, true); - }); - } - - exports.require = _require; -})(this, this); diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/depend.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/depend.js deleted file mode 100644 index be4ec31c..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/depend.js +++ /dev/null @@ -1,323 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -"use strict"; -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); return fn(null, result); } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -function __nt(_, fn){ var i = 0; var cb = __cb(_, fn); var safeCb = function(){ try { cb(); } catch (ex) { __propagate(cb, ex); } }; if (typeof process != "undefined" && typeof process.nextTick == "function") return function(){ if (++i % 20 == 0) process.nextTick(safeCb); else cb(); }; else return function(){ if (++i % 20 == 0) setTimeout(safeCb); else cb(); }; } -function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } -function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } -var fs = require("fs"); -var fspath = require("path"); -var uuid = require("streamline/lib/util//uuid"); -var flows = require("streamline/lib/util/flows"); -var modulesDir; -var each = flows.each; -var dependencies = { -}; -var commentsRE = /(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(\/\/.*)/g; -var requireRE = /require\s*\(('|")([\w\W]*?)('|")\)/gm; -var funnel = flows.funnel(1); -function _exists(callback, path) { - fspath.exists(path, function(result) { - return callback(null, result); - }); -}; -function _findModulesDir(_) { - if (!_) { - return __future(_findModulesDir, arguments, 0); - } -; - var dir; - if (modulesDir) { - return _(null, modulesDir); - } -; - dir = __dirname; - var __3 = false; - return (function(__break) { - var __loop = __nt(_, function() { - if (__3) { - dir = dir.substring(0, dir.lastIndexOf("/")); - } - else { - __3 = true; - } - ; - var __2 = (dir.length > 0); - if (__2) { - return _exists(__cb(_, function(__0, __1) { - return (function(__then) { - if (__1) { - modulesDir = (dir + "/node_modules"); - return _(null, modulesDir); - } - else { - __then(); - } - ; - })(__loop); - }), (dir + "/node_modules")); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(new Error("cannot resolve module: node_modules not found")); - }); -}; -function _combine(path, rel) { - var cut = path.lastIndexOf("/"); - if ((cut <= 0)) { - throw new Error(("too many parent dirs" + rel)) - }; - path = path.substring(0, cut); - while ((rel.indexOf("./.") == 0)) { - rel = rel.substring(2);; - }; - if ((rel.indexOf("../") == 0)) { - return _combine(path, rel.substring(1)) - }; - if ((rel.indexOf("./") != 0)) { - return ((modulesDir + "/") + rel) - }; - return (path + rel.substring(1)); -}; -var _etag = uuid.generate(); -var _watched = { -}; -function _watcher(stats) { - funnel(null, function() { - _etag = uuid.generate(); - Object.keys(_watched).forEach(function(path) { - fs.unwatchFile(path); - }); - _watched = { - }; - dependencies = { - }; - }); -}; -exports.etag = function() { - return ("" + _etag); -}; -function _watch(file) { - if (!_watched[file]) { - _watched[file] = true; - fs.watchFile(file, _watcher); - } -; -}; -function _loadFile(_, path) { - if (!_) { - return __future(_loadFile, arguments, 0); - } -; - var js, js_; - js = (path + ".js"); - js_ = (path + "_.js"); - return _exists(__cb(_, function(__0, __1) { - return (function(__then) { - if (__1) { - _watch(js_); - return require("streamline/lib/compiler/compile").loadFile(_, path); - } - else { - return _exists(__cb(_, function(__0, __3) { - return (function(__then) { - if (__3) { - _watch(js); - return fs.readFile(js, "utf8", _); - } - else { - return _(new Error(("invalid require path: " + path))); - } - ; - })(__then); - }), js); - } - ; - })(_); - }), js_); -}; -function _extendPath(_, path) { - if (!_) { - return __future(_extendPath, arguments, 0); - } -; - return (function(_) { - return (function(_) { - return _exists(__cb(_, function(__0, __3) { - var __2 = !__3; - var __4 = !__2; - return (function(__then) { - if (__4) { - var __5 = __2; - return _(null, __5); - } - else { - __then(); - } - ; - })(function() { - return _exists(_, path); - }); - }), (path + ".js")); - })(__cb(_, function(__0, __1) { - var __3 = !__1; - return (function(__then) { - if (__3) { - var __4 = __1; - return _(null, __4); - } - else { - __then(); - } - ; - })(function() { - return fs.stat(path, __cb(_, function(__0, __6) { - var __5 = __6.isDirectory(); - return _(null, __5); - })); - }); - })); - })(__cb(_, function(__0, __2) { - return (function(__then) { - if (__2) { - return _exists(__cb(_, function(__0, __3) { - return (function(__then) { - if (__3) { - return _(null, (path + "/main")); - } - else { - return _exists(__cb(_, function(__0, __4) { - return (function(__then) { - if (__4) { - return _(null, (path + "/index")); - } - else { - __then(); - } - ; - })(__then); - }), (path + "/index.js")); - } - ; - })(__then); - }), (path + "/main.js")); - } - else { - __then(); - } - ; - })(function() { - return _(null, path); - }); - })); -}; -function _directDependencies(_, path) { - if (!_) { - return __future(_directDependencies, arguments, 0); - } -; - var result, str, match; - if (dependencies[path]) { - return _(null, dependencies[path]); - } -; - return _findModulesDir(__cb(_, function() { - result = []; - dependencies[path] = result; - return _loadFile(__cb(_, function(__0, __1) { - str = __1; - str = str.replace(commentsRE, ""); - while (match = requireRE.exec(str)) { - result.push(_combine(path, match[2])); - }; - return _(null, result); - }), path); - })); -}; -function _missingDependencies(_, path, known) { - if (!_) { - return __future(_missingDependencies, arguments, 0); - } -; - var knownMap, missingMap; - function _explore(_, path, missingMap) { - if (!_) { - return __future(_explore, arguments, 0); - } - ; - var dependencies; - return _extendPath(__cb(_, function(__0, __2) { - path = __2; - if (knownMap[path]) { - return _(null); - } - ; - if (missingMap) { - missingMap[path] = true; - } - ; - knownMap[path] = true; - return _directDependencies(__cb(_, function(__0, __3) { - dependencies = __3; - return each(_, dependencies, function __1(_, dependency) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - return _explore(_, dependency, missingMap); - }); - }), path); - }), path); - }; - knownMap = { - }; - known.forEach(function(key) { - knownMap[key] = true; - }); - missingMap = { - }; - return each(__cb(_, function() { - return _explore(__cb(_, function() { - return _(null, Object.keys(missingMap)); - }), path, missingMap); - }), known, function __1(_, cur) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - return _explore(_, cur, null); - }); -}; -exports.directDependencies = function __1(_, path) { - if (!_) { - return __future(__1, arguments, 0); - } -; - return funnel(_, function __1(_) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - return _directDependencies(_, path); - }); -}; -exports.missingDependencies = function __2(_, path, known) { - if (!_) { - return __future(__2, arguments, 0); - } -; - return funnel(_, function __1(_) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - return _missingDependencies(_, path, known); - }); -}; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/depend_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/depend_.js deleted file mode 100644 index 6169460f..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/depend_.js +++ /dev/null @@ -1,158 +0,0 @@ -"use strict"; -//streamline.options = { "tryCatch" : "fast", "lines" : "ignore" } -// Analyzes require dependencies -var fs = require('fs'); -var fspath = require('path'); -var uuid = require('streamline/lib/util//uuid'); -var flows = require('streamline/lib/util/flows'); -var modulesDir; -var each = flows.each; - -var dependencies = {}; - -var commentsRE = /(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(\/\/.*)/g; -var requireRE = /require\s*\(('|")([\w\W]*?)('|")\)/mg; - -var funnel = flows.funnel(1); - -function _exists(callback, path) { - fspath.exists(path, function(result) { - return callback(null, result); - }); -} - -function _findModulesDir(_) { - if (modulesDir) - return modulesDir; - for (var dir = __dirname; dir.length > 0; dir = dir.substring(0, dir.lastIndexOf('/'))) { - if (_exists(_, dir + "/node_modules")) { - modulesDir = dir + "/node_modules"; - return modulesDir; - } - } - throw new Error("cannot resolve module: node_modules not found") -} - -function _combine(path, rel) { - var cut = path.lastIndexOf('/'); - if (cut <= 0) - throw new Error("too many parent dirs" + rel); - path = path.substring(0, cut); - while (rel.indexOf('./.') == 0) // get rid of leading ./. and ./.. - rel = rel.substring(2); - if (rel.indexOf('../') == 0) - return _combine(path, rel.substring(1)); - if (rel.indexOf('./') != 0) - return modulesDir + "/" + rel; - return path + rel.substring(1); -} - -var _etag = uuid.generate(); -var _watched = {}; - -function _watcher(stats) { - //console.log("WATCHER!") - funnel(null, function() { - // one of the files changed: regenerate etag and reset cache - _etag = uuid.generate(); - // unwatch all files because list may change - Object.keys(_watched).forEach( function(path) { - fs.unwatchFile(path); - }); - _watched = {}; - dependencies = {}; - }); - //console.log("WATCHER DONE!") -} - -exports.etag = function() { - return "" + _etag; -} -function _watch(file) { - if (!_watched[file]) { - _watched[file] = true; - fs.watchFile(file, _watcher); - } -} - -function _loadFile(_, path) { - var js = path + ".js"; - var js_ = path + "_.js"; - if (_exists(_, js_)) { - _watch(js_); - return require("streamline/lib/compiler/compile").loadFile(_, path); - } else if (_exists(_, js)) { - _watch(js); - return fs.readFile(js, "utf8", _); - } else - throw new Error("invalid require path: " + path); -} - -function _extendPath(_, path) { - if (!_exists(_, path + ".js") && _exists(_, path) && fs.stat(path, _).isDirectory()) { - // should read package.json here -- see later - if (_exists(_, path + "/main.js")) - return path + "/main"; - else if (_exists(_, path + "/index.js")) - return path + "/index"; - } - return path; -} - -// Returns all the dependencies of a given js file -// Can be used to build a dependency graph -function _directDependencies(_, path) { - if (dependencies[path]) - return dependencies[path]; - _findModulesDir(_); - var result = []; - dependencies[path] = result; - var str = _loadFile(_, path); - str = str.replace(commentsRE, ""); - var match; - while (match = requireRE.exec(str)) - result.push(_combine(path, match[2])); - return result; -} - -// Returns all the dependencies that we reach from path (recursively) but -// the we don't reach from any of the known paths (recursively too). -// Used to return require lists to the client -function _missingDependencies(_, path, known) { - var knownMap = {}; - known.forEach( function(key) { - knownMap[key] = true; - }); - function _explore(_, path, missingMap) { - path = _extendPath(_, path); - if (knownMap[path]) - return; - if (missingMap) - missingMap[path] = true; - knownMap[path] = true; - var dependencies = _directDependencies(_, path); - each(_, dependencies, function(_, dependency) { - _explore(_, dependency, missingMap); - }); - } - - var missingMap = {}; - // first explore known path, to fill knownMap with all their dependencies - each(_, known, function(_, cur) { - _explore(_, cur, null); - }); - // then fill missing map - _explore(_, path, missingMap); - return Object.keys(missingMap); -} - -exports.directDependencies = function(_, path) { - return funnel(_, function(_) { - return _directDependencies(_, path); - }) -} -exports.missingDependencies = function(_, path, known) { - return funnel(_, function(_) { - return _missingDependencies(_, path, known); - }) -} diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/require.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/require.js deleted file mode 100644 index f94574c7..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/require.js +++ /dev/null @@ -1,144 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -"use strict"; -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); return fn(null, result); } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } -function __tryCatch(_, fn){ try { fn(); } catch (e) { try { _(e); } catch (ex) { __trap(ex); } } } -var fs = require("fs"); -var depend = require("./depend"); -var flows = require("streamline/lib/util/flows"); -var uuid = require("streamline/lib/util/uuid"); -var each = flows.each; -var path = require("path"); -var url = require("streamline/lib/util/url"); -function _replyError(response, statusCode, body) { - response.writeHead(statusCode, { - "Content-Type": "text/plain", - "Content-Length": body.length - }); - response.end(body); -}; -exports.dispatcher = function(config) { - config = (config || { - }); - var root = (config.root || path.join(__dirname, "../../../../..")); - return function __1(_, request, response) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - var noneMatch, parts, qs, path, known, stats, missing, accept, boundary, endMarker, i; - return (function(__then) { - (function(_) { - __tryCatch(_, function() { - noneMatch = request.headers["if-none-match"]; - if ((noneMatch === depend.etag())) { - response.writeHead(304, { - }); - return _(null, response.end()); - } - ; - parts = request.url.split("?"); - qs = url.parseQueryString(parts[1]); - path = qs["module"]; - known = ((qs["known"] || "")).split(","); - if ((path[0] == ".")) { - return _(new Error(("server require cannot resolve relative path: " + path))); - } - ; - path = ((path[0] == "/") ? (root + path) : ((root + "/node_modules/") + path)); - return fs.stat((path + ".js"), __cb(_, function(__0, __2) { - stats = __2; - if (!stats.isFile()) { - return _(null, _replyError(response, 404, ("file not found " + path))); - } - ; - return depend.missingDependencies(__cb(_, function(__0, __3) { - missing = __3; - accept = request.headers.accept; - return (function(__then) { - if ((accept.indexOf("text/html") == 0)) { - response.writeHead(200, { - "content-type": "text/html", - ETag: depend.etag() - }); - return response.write(__cb(_, function() { - response.end(); - return _(null); - }), ((((((("" + "\ndependencies: ") + path) + "") + "\n") + "\n\n")); - } - else { - __then(); - } - ; - })(function() { - boundary = uuid.generate(); - endMarker = (("\n--" + boundary) + "--\n"); - response.writeHead(200, { - "Content-Type": (("multipart/related; boundary=\"" + boundary) + "\""), - ETag: depend.etag() - }); - i = 0; - return each(__cb(_, function() { - response.end(endMarker); - __then(); - }), missing, function __1(_, dep) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - var modIndex, location, data; - return (function(__then) { - (function(_) { - __tryCatch(_, function() { - modIndex = dep.indexOf("/node_modules/"); - location = ((modIndex >= 0) ? dep.substring((modIndex + 14)) : dep.substring(root.length)); - return fs.readFile((dep + ".js"), "utf8", __cb(_, function(__0, __1) { - data = __1; - return response.write(__cb(_, __then), (((((((((((("\n--" + boundary) + "\n") + "Content-ID: FILE ") + ++i) + "\n") + "Content-Location: ") + location) + "\n") + "Content-Type: application/javascript\n") + "\n") + data) + "\n")); - })); - }); - })(function(ex, __result) { - __tryCatch(_, function() { - if (ex) { - return response.write(__cb(_, function() { - response.end(endMarker); - __then(); - }), ((((((("\n--" + boundary) + "\n") + "Content-ID: ERROR\n") + "Content-Type: text/plain\n") + "\n") + ex.toString()) + "\n")); - } - else { - _(null, __result); - } - ; - }); - }); - })(function() { - __tryCatch(_, _); - }); - }); - }); - }), path, known); - })); - }); - })(function(ex, __result) { - __tryCatch(_, function() { - if (ex) { - console.error(((ex.message + "\n") + ex.stack)); - return _(null, _replyError(response, 500, ex.toString())); - } - else { - _(null, __result); - } - ; - }); - }); - })(function() { - __tryCatch(_, _); - }); - }; -}; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/require_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/require_.js deleted file mode 100644 index b3c101c8..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/require/server/require_.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; -//streamline.options = { "tryCatch" : "fast", "lines" : "ignore" } -/// !doc -/// -/// # streamline/lib/require/server/require -/// -/// Server-side require handler -/// -/// Handles require requests coming from the client. -/// -var fs = require('fs'); -var depend = require("./depend"); -var flows = require('streamline/lib/util/flows'); -var uuid = require('streamline/lib/util/uuid'); -var each = flows.each; -var path = require('path'); -var url = require('streamline/lib/util/url'); - -function _replyError(response, statusCode, body) { - response.writeHead(statusCode, { - 'Content-Type': 'text/plain', - 'Content-Length': body.length - }); - response.end(body); -} - -// request is a GET on /require/module_path?known=known_modules -// response is a multipart document containing the requested module script -// and all its dependencies that are not referenced by any of the known modules. - -/// * `dispatcher = require.dispatcher(options)` -/// returns an HTTP request dispatcher that responds to requests -/// issued by the client-side `require` script. -/// The dispatcher is called as `dispatcher(_, request, response)` -exports.dispatcher = function(config) { - config = config || {}; - // default root is lib sibling of ancestor node_modules - var root = config.root || path.join(__dirname, "../../../../.."); - return function(_, request, response) { - try { - var noneMatch = request.headers['if-none-match']; - if (noneMatch === depend.etag()) { - response.writeHead(304, {}); - return response.end(); - } - var parts = request.url.split('?'); - var qs = url.parseQueryString(parts[1]); - var path = qs["module"]; - var known = (qs["known"] || "").split(","); - - if (path[0] == '.') - throw new Error("server require cannot resolve relative path: " + path); - path = path[0] == '/' ? root + path : root + "/node_modules/" + path; - var stats = fs.stat(path + ".js", _); - if (!stats.isFile()) - return _replyError(response, 404, "file not found " + path); - - var missing = depend.missingDependencies(_, path, known); - var accept = request.headers.accept; - if (accept.indexOf('text/html') == 0) { - response.writeHead(200, { - 'content-type': 'text/html', - 'ETag': depend.etag() - }); - response.write(_, "" - + "\ndependencies: " + path - + "" + "\n" - + "\n\n"); - response.end(); - return; - } - - var boundary = uuid.generate(); - var endMarker = "\n--" + boundary + "--\n"; - response.writeHead(200, { - 'Content-Type': 'multipart/related; boundary="' + boundary + '"', - 'ETag': depend.etag() - }); - var i = 0; - each(_, missing, function(_, dep) { - try { - var modIndex = dep.indexOf("/node_modules/"); - var location = modIndex >= 0 ? dep.substring(modIndex + 14) : dep.substring(root.length); - var data = fs.readFile(dep + ".js", "utf8", _); - response.write(_, "\n--" + boundary + "\n" - + "Content-ID: FILE " + ++i + "\n" - + "Content-Location: " + location + "\n" - + "Content-Type: application/javascript\n" - + "\n" + data + "\n"); - } catch (ex) { - response.write(_, "\n--" + boundary + "\n" - + "Content-ID: ERROR\n" - + "Content-Type: text/plain\n" - + "\n" + ex.toString() + "\n"); - response.end(endMarker); - } - }); - response.end(endMarker); - } catch (ex) { - console.error(ex.message + "\n" + ex.stack); - return _replyError(response, 500, ex.toString()); - } - }; -} diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/client/streams.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/client/streams.js deleted file mode 100644 index 2b7411ae..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/client/streams.js +++ /dev/null @@ -1,135 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -"use strict"; -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); return fn(null, result); } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -function DataBuffer(options) { - var _chunks = []; - this.read = function __1(_, len) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - var chunks, total, chunk; - if ((len < 0)) { - len = Infinity; - } - ; - if ((len == 0)) { - return _(null, ""); - } - ; - chunks = []; - total = 0; - while ((total < len)) { - chunk = _chunks.splice(0, 1)[0]; - if (!chunk) { - return _(null, ((chunks.length == 0) ? null : chunks.join(""))); - } - ; - if (((total + chunk.length) <= len)) { - chunks.push(chunk); - total += chunk.length; - } - else { - chunks.push(chunk.substring(0, (len - total))); - _chunks.splice(0, 0, chunk.substring((len - total))); - total = len; - } - ; - }; - return _(null, chunks.join("")); - }; - this.readAll = function __2(_) { - if (!_) { - return __future.call(this, __2, arguments, 0); - } - ; - var __this = this; - return __this.read(_, -1); - }; - this.unread = function(chunk) { - _chunks.splice(0, 0, chunk); - return this; - }; - this.write = function __3(_, data, enc) { - if (!_) { - return __future.call(this, __3, arguments, 0); - } - ; - var __this = this; - _chunks.push(data); - return _(null, __this); - }; - this.end = function(data, enc) { - if (data) { - _chunks.push(data); - }; - return this; - }; - this.contents = function() { - return _chunks.join(""); - }; -}; -function HttpError(statusCode, message) { - this.statusCode = statusCode; - this.message = message; - this.stack = new Error().stack; -}; -function _fixHttpClientOptions(options) { - if (!options) { - throw new Error("request error: no options") - }; - if ((typeof options === "string")) { - options = { - url: options - }; - }; - return options; -}; -function HttpClientRequest(options) { - options = _fixHttpClientOptions(options); - DataBuffer.call(this, options); - var _xhr; - this.response = function(callback) { - if (!callback) { - return __future.call(this, this.response, arguments, 0) - }; - $.ajax({ - url: options.url, - headers: options.headers, - type: options.method, - data: this.contents(), - dataType: "text", - beforeSend: function(xhr) { - _xhr = xhr; - }, - success: function(data, statusText, xhr) { - callback(null, new HttpClientResponse(data, xhr)); - }, - error: function(xhr, statusText, message) { - callback(new HttpError(xhr.status, ((statusText + ": ") + message))); - } - }); - }; - this.abort = function() { - (_xhr && _xhr.abort()); - _xhr = null; - }; -}; -function HttpClientResponse(data, xhr) { - DataBuffer.call(this); - this.end(data); - this.statusCode = xhr.status; - this.headers = { - }; - var self = this; - xhr.getAllResponseHeaders().replace(/\r\n/g, "\n").split("\n").forEach(function(header) { - var pair = header.split(":"); - self.headers[pair[0].toLowerCase()] = (pair[1] && pair[1].trim()); - }); -}; -exports.httpRequest = function(options) { - return new HttpClientRequest(options); -}; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/client/streams_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/client/streams_.js deleted file mode 100644 index f3c5ae3e..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/client/streams_.js +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * MIT License - */ -"use strict"; -//streamline.options = { "tryCatch" : "fast", "lines" : "ignore" } - -/// !nodoc -/// -/// # streamline/lib/streams/client/streams -/// -/// Client Streams module -/// The `streams` module contains _pull mode_ wrappers around AJAX streams. -/// - -// TODO: Client streams only deal with strings for now - -function DataBuffer(options) { - var _chunks = []; - - this.read = function(_, len) { - if (len < 0) - len = Infinity; - if (len == 0) - return ""; - var chunks = [], total = 0; - while (total < len) { - var chunk = _chunks.splice(0, 1)[0]; - if (!chunk) - return chunks.length == 0 ? null : chunks.join(''); - if (total + chunk.length <= len) { - chunks.push(chunk); - total += chunk.length; - } else { - chunks.push(chunk.substring(0, len - total)); - _chunks.splice(0, 0, chunk.substring(len - total)); - total = len; - } - } - return chunks.join(''); - } - /// * `data = stream.readAll(_)` - /// reads till the end of stream. - /// Equivalent to `stream.read(_, -1)`. - this.readAll = function(_) { - return this.read(_, -1); - } - /// * `stream.unread(chunk)` - /// pushes the chunk back to the stream. - /// returns `this` for chaining. - this.unread = function(chunk) { - _chunks.splice(0, 0, chunk); - return this; - } - - this.write = function(_, data, enc) { - _chunks.push(data); - return this; - } - - this.end = function(data, enc) { - if (data) - _chunks.push(data); - return this; - } - - this.contents = function() { - return _chunks.join(''); - } -} - -function HttpError(statusCode, message) { - this.statusCode = statusCode; - this.message = message; - this.stack = new Error().stack; -} - -function _fixHttpClientOptions(options) { - if (!options) - throw new Error("request error: no options"); - if (typeof options === "string") - options = { url: options }; - return options; -} -/// -/// ## HttpClientRequest -/// -/// This is a wrapper around jQuery's `$.ajax` call, with -/// the same API as the server side HttpClientRequest -/// -/// This stream is writable (see Writable Stream above). -/// -/// * `request = streams.httpRequest(options)` -/// creates the wrapper. -/// The options are the following: -/// * `method`: the HTTP method, `'GET'` by default. -/// * `headers`: the HTTP headers. -/// * `url`: the requested URL (with query string if necessary). -/// * `proxy.url`: the proxy URL. -/// * `lowMark` and `highMark`: low and high water mark values for buffering (in bytes or characters depending -/// on encoding). -/// Note that these values are only hints as the data is received in chunks. -function HttpClientRequest(options) { - options = _fixHttpClientOptions(options); - DataBuffer.call(this, options); - var _xhr; - this.response = function(callback) { - if (!callback) - return __future.call(this, this.response, arguments, 0); - $.ajax({ - url: options.url, - headers: options.headers, - type: options.method, - data: this.contents(), - dataType: "text", // bypass jQuery parsing - beforeSend: function(xhr) { - _xhr = xhr; - }, - success: function(data, statusText, xhr) { - callback(null, new HttpClientResponse(data, xhr)); - }, - error: function(xhr, statusText, message) { - callback(new HttpError(xhr.status, statusText + ": " + message)); - } - }); - } - this.abort = function() { - _xhr && _xhr.abort(); - _xhr = null; - } -} - -function HttpClientResponse(data, xhr) { - DataBuffer.call(this); - this.end(data); - this.statusCode = xhr.status; - this.headers = {}; - var self = this; - xhr.getAllResponseHeaders().replace(/\r\n/g, '\n').split('\n').forEach(function(header){ - var pair = header.split(':'); - self.headers[pair[0].toLowerCase()] = pair[1] && pair[1].trim(); - }); -} - -exports.httpRequest = function(options) { - return new HttpClientRequest(options); -}; - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/jsonRequest.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/jsonRequest.js deleted file mode 100644 index d4706145..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/jsonRequest.js +++ /dev/null @@ -1,27 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -"use strict"; -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); return fn(null, result); } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -var streams = require("./streams"); -exports.send = function __1(_, url, obj) { - if (!_) { - return __future(__1, arguments, 0); - } -; - var json, result; - json = ((obj && (typeof obj !== "string")) ? JSON.stringify(obj) : obj); - return streams.httpRequest({ - url: url, - method: (json ? "POST" : "GET"), - headers: { - "content-type": "application/json" - } - }).end(json, "utf8").response(__cb(_, function(__0, __1) { - return __1.readAll(__cb(_, function(__0, __2) { - result = __2; - return _(null, JSON.parse(result)); - })); - })); -}; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/jsonRequest_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/jsonRequest_.js deleted file mode 100644 index 02b61bfd..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/jsonRequest_.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * MIT License - */ -"use strict"; -//streamline.options = { "tryCatch" : "fast", "lines" : "ignore" } - -var streams = require("./streams"); -/// !nodoc -- experimental -/// -/// # streamline/lib/streams/jsonRequest -/// -/// Simple json request wrapper -exports.send = function(_, url, obj) { - var json = obj && typeof obj !== "string" ? JSON.stringify(obj) : obj; - var result = streams.httpRequest({ - url: url, - method: json ? "POST" : "GET", - headers: { "content-type" : "application/json"} - }).end(json, "utf8").response(_).readAll(_); - return JSON.parse(result); -} diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/readers.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/readers.js deleted file mode 100644 index 2187a417..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/readers.js +++ /dev/null @@ -1,81 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -"use strict"; -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); return fn(null, result); } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -function __nt(_, fn){ var i = 0; var cb = __cb(_, fn); var safeCb = function(){ try { cb(); } catch (ex) { __propagate(cb, ex); } }; if (typeof process != "undefined" && typeof process.nextTick == "function") return function(){ if (++i % 20 == 0) process.nextTick(safeCb); else cb(); }; else return function(){ if (++i % 20 == 0) setTimeout(safeCb); else cb(); }; } -function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } -function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } -var streams = require("./streams"); -exports.Reader = function(stream, boundary, options) { - options = (options || { - }); - options.defaultSize = (options.defaultSize || 512); - if ((!stream.emitter && (typeof stream.on === "function"))) { - stream = new streams.ReadableStream(stream, options); - stream.setEncoding((options.encoding || "utf8")); - } -; - if (!boundary) { - boundary = "\n"; - }; - this.readItem = function __1(_) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - var chunks, len, chunk, i; - chunks = []; - len = options.defaultSize; - return (function(__break) { - var __loop = __nt(_, function() { - var __2 = stream; - if (__2) { - return stream.read(__cb(_, function(__0, __1) { - chunk = __1; - if ((chunk == null)) { - stream = null; - } - else { - i = chunk.indexOf(boundary); - if ((i >= 0)) { - stream.unread(chunk.substring((i + boundary.length))); - chunks.push(chunk.substring(0, i)); - return __break(); - } - else { - if ((chunk.length == (len + boundary.length))) { - stream.unread(chunk.substring(len)); - chunks.push(chunk.substring(0, len)); - } - else { - return _(new Error(((("missing boundary:" + boundary) + " in: ") + chunk))); - } - ; - } - ; - } - ; - __loop(); - }), (len + boundary.length)); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(null, ((chunks.length == 0) ? null : chunks.join(""))); - }); - }; - this.close = function __2(_) { - if (!_) { - return __future(__2, arguments, 0); - } - ; - stream = null; - _(); - }; -}; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/readers_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/readers_.js deleted file mode 100644 index d8c17974..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/readers_.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * MIT License - */ -"use strict"; -//streamline.options = { "tryCatch" : "fast", "lines" : "ignore" } - -var streams = require("./streams"); - -/// !nodoc -- experimental -/// -/// # streamline/lib/streams/readers -/// -/// Readers module -/// The `readers` module contains higher level readers built on top of pull-mode streams. -/// - -exports.Reader = function(stream, boundary, options) { - options = options || {}; - options.defaultSize = options.defaultSize || 512; - if (!stream.emitter && typeof stream.on === "function") { - // break require string in 2 to fool client require - stream = new streams.ReadableStream(stream, options); - stream.setEncoding(options.encoding || "utf8"); - } - if (!boundary) - boundary = "\n"; - this.readItem = function(_) { - var chunks = []; - var len = options.defaultSize; - while (stream) { - var chunk = stream.read(_, len + boundary.length); - if (chunk == null) - stream = null; - else { - var i = chunk.indexOf(boundary); - if (i >= 0) { - stream.unread(chunk.substring(i + boundary.length)); - chunks.push(chunk.substring(0, i)); - break; - } else if (chunk.length == len + boundary.length) { - stream.unread(chunk.substring(len)); - chunks.push(chunk.substring(0, len)); - } else { - throw new Error("missing boundary:" + boundary + " in: " + chunk); - } - } - } - return chunks.length == 0 ? null : chunks.join(''); - } - this.close = function(_) { - stream = null; - } -} diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/httpHelper.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/httpHelper.js deleted file mode 100644 index c6f371a1..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/httpHelper.js +++ /dev/null @@ -1,160 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -"use strict"; -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); return fn(null, result); } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -var urlHelper = require("streamline/lib/util/url"); -exports.HttpStatus = { - OK: 200, - Created: 201, - Accepted: 202, - NoContent: 204, - MovedPermanently: 301, - Found: 302, - SeeOther: 303, - NotModified: 304, - TemporaryRedirect: 307, - BadRequest: 400, - Unauthorized: 401, - Forbidden: 403, - NotFound: 404, - MethodNotAllowed: 405, - NotAcceptable: 406, - Conflict: 409, - Gone: 410, - PreconditionFailed: 412, - UnsupportedMediaType: 415, - InternalServerError: 500, - NotImplemented: 501, - ServiceUnavailable: 503 -}; -function _classifyMedia(str) { - if (((str == "*") || (str == "*/*"))) { - return "*" - }; - var lower = str.toLowerCase(); - if ((lower.indexOf("xml") >= 0)) { - return "xml" - }; - if ((lower.indexOf("html") >= 0)) { - return "html" - }; - if ((lower.indexOf("json") >= 0)) { - return "json" - }; - if ((lower.indexOf("text") >= 0)) { - return "text" - }; - if ((lower.indexOf("image") >= 0)) { - return "image" - }; - return "unknown"; -}; -exports.parseAccept = function(str) { - var accept = ((str || "")).toString().split(/,\s*/).map(function(part, i) { - var m = part.match(/^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$/); - return (m && [m[1],Number((m[2] || 1)),i,]); - }).filter(function(elt) { - return elt; - }).sort(function(elt1, elt2) { - return ((elt2[1] - elt1[1]) || (elt1[2] - elt2[2])); - }).map(function(elt) { - var split = elt[0].split(";"); - var result = { - rawType: split[0], - type: _classifyMedia(split[0]), - parameters: { - } - }; - split.slice(1).forEach(function(str) { - var pair = str.split(/\s*=\s*/); - result.parameters[pair[0]] = pair[1]; - }); - return result; - }); - return ((accept.length > 0) ? accept : [{ - rawType: "*", - type: "*", - parameters: { - } - },]); -}; -function HttpError(statusCode, message) { - this.statusCode = statusCode; - this.message = message; - this.stack = new Error().stack; -}; -exports.tracer = null; -exports.HttpContext = function(request, response, options) { - if ((request == null)) { - return - }; - options = (options || { - }); - if (exports.tracer) { - exports.tracer((((("\nHTTP REQUEST: " + request.method) + " ") + request.url) + "\n")); - exports.tracer((("headers: " + JSON.stringify(request.headers)) + "\n")); - } -; - this.request = request; - this.response = response; - this.method = ((request.headers[(options.methodHeader || "x-http-method-override")] || request.method)).toLowerCase(); - var _split = request.url.split("?"); - this.path = _split.splice(0, 1)[0]; - var _urlBegin = ((((request.socket.secure ? "https" : "http")) + "://") + request.headers.host); - this.url = (_urlBegin + this.path); - this.rawQuery = _split.join("?"); - this.query = urlHelper.parseQueryString(this.rawQuery); - var _segments = this.path.split("/").map(function(seg) { - return decodeURIComponent(seg); - }); - var _segI = 1; - this.walkUrl = function() { - return _segments[_segI++]; - }; - this.walked = function() { - return (_urlBegin + _segments.slice(0, _segI).join("/")); - }; - this.rawAccept = ((this.query[options.acceptParam] || request.headers.accept) || "*"); - this.accept = exports.parseAccept(this.rawAccept); - this.parseBody = function __1(_) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - var ct, str; - ct = request.headers["content-type"]; - if (!ct) { - return _(null, null); - } - ; - if ((ct.indexOf("application/json") !== 0)) { - return _(new HttpError(415, ("expected application/json, got: " + ct))); - } - ; - return request.readAll(__cb(_, function(__0, __1) { - str = __1; - if ((str == null)) { - return _(null, null); - } - ; - if (exports.tracer) { - exports.tracer((("body: " + str) + "\n")); - } - ; - return _(null, JSON.parse(str)); - })); - }; - this.reply = function(code, message, headers) { - headers = (headers || { - }); - if ((message && !headers["content-type"])) { - headers["content-type"] = "text/plain"; - }; - response.writeHead(code, headers); - response.end(message); - }; - this.scratch = { - }; -}; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/httpHelper_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/httpHelper_.js deleted file mode 100644 index e3ac8a08..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/httpHelper_.js +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * MIT License - */ -"use strict"; -//streamline.options = { "tryCatch" : "fast", "lines" : "ignore" } - -var urlHelper = require("streamline/lib/util/url"); -/// !nodoc -- experimental -/// -/// # streamline/lib/streams/server/httpHelper -/// -/// HTTP helpers - -exports.HttpStatus = { - OK: 200, - Created: 201, - Accepted: 202, - NoContent: 204, - MovedPermanently: 301, - Found: 302, - SeeOther: 303, - NotModified: 304, - TemporaryRedirect: 307, - BadRequest: 400, - Unauthorized: 401, - Forbidden: 403, - NotFound: 404, - MethodNotAllowed: 405, - NotAcceptable: 406, - Conflict: 409, - Gone: 410, - PreconditionFailed: 412, - UnsupportedMediaType: 415, - InternalServerError: 500, - NotImplemented: 501, - ServiceUnavailable: 503 -} - -function _classifyMedia(str){ - if (str == "*" || str == "*/*") - return "*"; - var lower = str.toLowerCase(); - if (lower.indexOf("xml") >= 0) - return "xml"; - if (lower.indexOf("html") >= 0) - return "html"; - if (lower.indexOf("json") >= 0) - return "json"; - if (lower.indexOf("text") >= 0) - return "text"; - if (lower.indexOf("image") >= 0) - return "image"; - return "unknown"; -} - -exports.parseAccept = function(str){ - // parse and sort by decreasing quality - var accept = (str || "").toString().split(/,\s*/).map(function(part, i){ - var m = part.match(/^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$/) - return m && [m[1], Number(m[2] || 1.0), i]; - }).filter(function(elt){ - return elt; - }).sort(function(elt1, elt2){ - return elt2[1] - elt1[1] || elt1[2] - elt2[2]; // 2nd test to preserve order - }).map(function(elt){ - var split = elt[0].split(';'); - var result = { - rawType: split[0], - type: _classifyMedia(split[0]), - parameters: {} - }; - split.slice(1).forEach(function(str){ - var pair = str.split(/\s*=\s*/); - result.parameters[pair[0]] = pair[1]; - }); - return result; - }) - // empty accept means accept anything - return accept.length > 0 ? accept : [{ - rawType: "*", - type: "*", - parameters: {} - }]; -} - -function HttpError(statusCode, message){ - this.statusCode = statusCode; - this.message = message; - this.stack = new Error().stack; -} - -exports.tracer = null; - -exports.HttpContext = function(request, response, options){ - if (request == null) // subclassing - return; - options = options || {}; - - if (exports.tracer) { - exports.tracer("\nHTTP REQUEST: " + request.method + " " + request.url + "\n"); - exports.tracer("headers: " + JSON.stringify(request.headers) + "\n"); - } - - this.request = request; - this.response = response; - this.method = (request.headers[options.methodHeader || "x-http-method-override"] || request.method).toLowerCase(); - // URL stuff - var _split = request.url.split('?'); - this.path = _split.splice(0, 1)[0]; - var _urlBegin = (request.socket.secure ? "https" : "http") + "://" + request.headers.host; - this.url = _urlBegin + this.path; - this.rawQuery = _split.join('?'); - this.query = urlHelper.parseQueryString(this.rawQuery); - var _segments = this.path.split('/').map(function(seg){ - return decodeURIComponent(seg); - }); - var _segI = 1; // start after leading / - this.walkUrl = function(){ - return _segments[_segI++]; - } - this.walked = function(){ - return _urlBegin + _segments.slice(0, _segI).join("/"); - } - - // Accept stuff - this.rawAccept = this.query[options.acceptParam] || request.headers.accept || "*"; - this.accept = exports.parseAccept(this.rawAccept); - - // Request body stuff - this.parseBody = function(_){ - var ct = request.headers["content-type"]; - if (!ct) - return null; - if (ct.indexOf("application/json") !== 0) - throw new HttpError(415, "expected application/json, got: " + ct); - // assume utf8 -- be smarter later - //request.setEncoding('utf8'); - var str = request.readAll(_); - if (str == null) - return null; - if (exports.tracer) - exports.tracer("body: " + str + "\n") - return JSON.parse(str); - } - - this.reply = function(code, message, headers){ - headers = headers || {}; - if (message && !headers["content-type"]) - headers["content-type"] = "text/plain"; - response.writeHead(code, headers); - response.end(message); - } - - this.scratch = {}; // scratch area where business logic can write stuff -} diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/streams.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/streams.js deleted file mode 100644 index 8d866dd0..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/streams.js +++ /dev/null @@ -1,527 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -"use strict"; -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); return fn(null, result); } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -function __nt(_, fn){ var i = 0; var cb = __cb(_, fn); var safeCb = function(){ try { cb(); } catch (ex) { __propagate(cb, ex); } }; if (typeof process != "undefined" && typeof process.nextTick == "function") return function(){ if (++i % 20 == 0) process.nextTick(safeCb); else cb(); }; else return function(){ if (++i % 20 == 0) setTimeout(safeCb); else cb(); }; } -function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } -function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } -var parseUrl = require("url").parse; -function _reply(callback, err, value) { - try { - callback(err, value); - } catch (ex) { - __propagate(callback, ex); - }; -}; -function checkOpen(emitter) { - if (!emitter) { - throw new Error("invalid operation on closed stream") - }; -}; -function wrapProperties(constr, writable, props) { - props.forEach(function(name) { - constr.prototype.__defineGetter__(name, function() { - return this.emitter[name]; - }); - }); - (writable && props.forEach(function(name) { - constr.prototype.__defineSetter__(name, function(val) { - this.emitter[name] = val; - return this; - }); - })); -}; -function wrapMethods(constr, methods) { - methods.forEach(function(name) { - constr.prototype[name] = function() { - return this.emitter[name].apply(this.emitter, arguments); - }; - }); -}; -function wrapChainMethods(constr, methods) { - methods.forEach(function(name) { - constr.prototype[name] = function() { - this.emitter[name].apply(this.emitter, arguments); - return this; - }; - }); -}; -function wrapEvents(constr, events) { - constr.prototype.events = ((constr.prototype.events || [])).concat(events); -}; -function Emitter(emitter) { - emitter.on("close", function() { - _onClose(); - }); - function trackClose() { - emitter = null; - }; - var _onClose = trackClose; - this.close = function(callback) { - if (!callback) { - return __future.call(this, this.close, arguments, 0) - }; - if (!emitter) { - return _reply(callback) - }; - var close = (emitter.close || emitter.destroySoon); - if ((typeof close !== "function")) { - return _reply(callback) - }; - _onClose = function() { - emitter = null; - _onClose = trackClose; - _reply(callback); - }; - if (this.doesNotEmitClose) { - emitter.emit("close"); - }; - close.call(emitter); - }; - this.__defineGetter__("emitter", function() { - return emitter; - }); - this.unwrap = function() { - var result = emitter; - (emitter && emitter.events.forEach(function(event) { - emitter.removeAllListeners(event); - })); - emitter = null; - return result; - }; -}; -function ReadableStream(emitter, options) { - Emitter.call(this, emitter); - options = (options || { - }); - var _low = Math.max((options.lowMark || 0), 0); - var _high = Math.max((options.highMark || 0), _low); - var _paused = false; - var _current = 0; - var _chunks = []; - var _error; - var _done = false; - var _encoding; - emitter.on("error", function(err) { - _onData(err); - }); - emitter.on("data", function(chunk) { - _onData(null, chunk); - }); - emitter.on("end", function() { - _onData(null, null); - }); - function trackData(err, chunk) { - if (!emitter) { - return - }; - if (err) { - _error = err; - } else { - if (chunk) { - _chunks.push(chunk); - _current += chunk.length; - if (((((_current > _high) && !_paused) && !_done) && !_error)) { - emitter.pause(); - _paused = true; - } - ; - } - else _done = true; - - }; - }; - var _onData = trackData; - function readChunk(callback) { - if ((_chunks.length > 0)) { - var chunk = _chunks.splice(0, 1)[0]; - _current -= chunk.length; - if (((((_current <= _low) && _paused) && !_done) && !_error)) { - emitter.resume(); - _paused = false; - } - ; - return _reply(callback, null, chunk); - } - else if (_done) { - return _reply(callback, null, null); - } else { - if (_error) { - return _reply(callback, _error); - } else { - _onData = function(err, chunk) { - if (err) { - _error = err; - } else { - if (!chunk) { - _done = true; - } - }; - _onData = trackData; - _reply(callback, err, chunk); - }; - } - } - ; - }; - function concat(chunks, total) { - if (_encoding) { - return chunks.join("") - }; - if ((chunks.length == 1)) { - return chunks[0] - }; - var result = new Buffer(total); - chunks.reduce(function(val, chunk) { - chunk.copy(result, val); - return (val + chunk.length); - }, 0); - return result; - }; - this.setEncoding = function(enc) { - checkOpen(emitter); - _encoding = enc; - if (enc) { - emitter.setEncoding(enc); - }; - return this; - }; - this.read = function __1(_, len) { - if (!_) { - return __future.call(this, __1, arguments, 0); - } - ; - var chunks, total, chunk, __this = this; - if (!emitter) { - return _(null, null); - } - ; - return (function(__then) { - if ((len == null)) { - return readChunk(_); - } - else { - __then(); - } - ; - })(function() { - if ((len < 0)) { - len = Infinity; - } - ; - if ((len == 0)) { - return _(null, (_encoding ? "" : new Buffer(0))); - } - ; - chunks = []; - total = 0; - return (function(__break) { - var __loop = __nt(_, function() { - var __4 = (total < len); - if (__4) { - return readChunk(__cb(_, function(__0, __2) { - chunk = __2; - if (!chunk) { - return _(null, ((chunks.length == 0) ? null : concat(chunks, total))); - } - ; - if (((total + chunk.length) <= len)) { - chunks.push(chunk); - total += chunk.length; - } - else { - chunks.push(chunk.slice(0, (len - total))); - __this.unread(chunk.slice((len - total))); - total = len; - } - ; - __loop(); - })); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(null, concat(chunks, total)); - }); - }); - }; - this.readAll = function __2(_) { - if (!_) { - return __future.call(this, __2, arguments, 0); - } - ; - var __this = this; - return __this.read(_, -1); - }; - this.unread = function(chunk) { - if (chunk) { - _chunks.splice(0, 0, chunk); - _current += chunk.length; - } - ; - return this; - }; -}; -exports.ReadableStream = ReadableStream; -wrapEvents(ReadableStream, ["error","data","end","close",]); -function WritableStream(emitter, options) { - Emitter.call(this, emitter); - options = (options || { - }); - var _drainCallback; - emitter.on("drain", function() { - var callback = _drainCallback; - if (callback) { - _drainCallback = null; - _reply(callback); - } - ; - }); - function _drain(callback) { - _drainCallback = callback; - }; - this.write = function __1(_, data, enc) { - if (!_) { - return __future.call(this, __1, arguments, 0); - } - ; - var __this = this; - checkOpen(emitter); - return (function(__then) { - if (!emitter.write(data, enc)) { - return _drain(__cb(_, __then)); - } - else { - __then(); - } - ; - })(function() { - return _(null, __this); - }); - }; - this.end = function(data, enc) { - checkOpen(emitter); - emitter.end(data, enc); - return this; - }; -}; -exports.WritableStream = WritableStream; -wrapEvents(WritableStream, ["drain","close",]); -function _getEncoding(headers) { - var comps = ((headers["content-type"] || "text/plain")).split(";"); - var ctype = comps[0]; - for (var i = 1; (i < comps.length); i++) { - var pair = comps[i].split("="); - if (((pair.length == 2) && (pair[0].trim() == "charset"))) { - return pair[1].trim() - }; - }; - if (((ctype.indexOf("text") >= 0) || (ctype.indexOf("json") >= 0))) { - return "utf8" - }; - return null; -}; -function HttpServerRequest(req, options) { - ReadableStream.call(this, req, options); - this._request = req; - this.setEncoding(_getEncoding(req.headers)); -}; -exports.HttpServerRequest = HttpServerRequest; -HttpServerRequest.prototype.doesNotEmitClose = true; -wrapProperties(HttpServerRequest, true, ["method","url","headers","trailers","httpVersion","connection","socket",]); -function HttpServerResponse(resp, options) { - WritableStream.call(this, resp, options); - this._response = resp; -}; -exports.HttpServerResponse = HttpServerResponse; -HttpServerResponse.prototype.doesNotEmitClose = true; -wrapChainMethods(HttpServerResponse, ["writeContinue","writeHead","setHeader","removeHeader","addTrailers",]); -wrapMethods(HttpServerResponse, ["getHeader",]); -wrapProperties(HttpServerResponse, true, ["statusCode",]); -function _fixHttpServerOptions(options) { - options = (options || { - }); - options.module = require((options.secure ? "https" : "http")); - return options; -}; -function HttpServer(requestListener, options) { - var self = this; - options = _fixHttpServerOptions(options); - var server = options.module.createServer(function(request, response) { - return requestListener(new HttpServerRequest(request, options), new HttpServerResponse(response, options), function(err) { - if (err) { - response.writeHead(500, { - "Content-Type": "text/plain" - }); - response.end(((err.message + "\n") + err.stack)); - } - ; - }); - }); - Emitter.call(this, server); - this.listen = function(callback, args) { - if (!callback) { - return __future.call(this, this.listen, arguments, 0) - }; - args = Array.prototype.slice.call(arguments, 1); - args.push(function() { - _reply(callback, null, self); - }); - server.listen.apply(server, args); - }; -}; -exports.HttpServer = HttpServer; -function HttpClientResponse(resp, options) { - ReadableStream.call(this, resp, options); - this._response = resp; - this.setEncoding(_getEncoding(resp.headers)); -}; -wrapProperties(HttpClientResponse, false, ["statusCode","httpVersion","headers","trailers",]); -HttpClientResponse.prototype.checkStatus = function(statuses) { - if ((typeof statuses === "number")) { - statuses = [statuses,]; - }; - if ((statuses.indexOf(this.statusCode) < 0)) { - throw new Error(("invalid status: " + this.statusCode)) - }; - return this; -}; -function _fixHttpClientOptions(options) { - if (!options) { - throw new Error("request error: no options") - }; - if ((typeof options === "string")) { - options = { - url: options - }; - }; - if (options.url) { - var parsed = parseUrl(options.url); - options.protocol = parsed.protocol; - options.host = parsed.hostname; - options.port = parsed.port; - options.path = (parsed.pathname + ((parsed.query ? ("?" + parsed.query) : ""))); - } -; - options.protocol = (options.protocol || "http:"); - options.port = (options.port || (((options.protocol === "https:") ? 443 : 80))); - options.path = (options.path || "/"); - if (!options.host) { - throw new Error("request error: no host") - }; - options.method = (options.method || "GET"); - options.headers = (options.headers || { - }); - options.module = require(options.protocol.substring(0, (options.protocol.length - 1))); - if ((options.user != null)) { - var token = ((options.user + ":") + ((options.password || ""))); - token = new Buffer(token, "utf8").toString("base64"); - options.headers.Authorization = ("Basic " + token); - } -; - if (options.proxy) { - if ((typeof options.proxy === "string")) { - options.proxy = parseUrl(options.proxy); - options.proxy.host = options.proxy.hostname; - } - ; - options.proxy.port = (options.proxy.port || options.port); - if (!options.proxy.host) { - throw new Error("proxy configuration error: no host") - }; - options.path = (((((options.protocol + "//") + options.host) + ":") + options.port) + options.path); - options.headers.host = options.host; - options.host = options.proxy.host; - options.port = options.proxy.port; - } -; - return options; -}; -function HttpClientRequest(options) { - options = _fixHttpClientOptions(options); - var _request = options.module.request(options, function(resp) { - _onResponse(null, (resp && new HttpClientResponse(resp, options))); - }); - WritableStream.call(this, _request, options); - var _response; - var _error; - var _done = false; - _request.on("error", function(err) { - (!_response && _onResponse(err)); - }); - function trackResponse(err, resp) { - _done = true; - _error = err; - _response = resp; - }; - var _onResponse = trackResponse; - this.response = function(callback) { - if (!callback) { - return __future.call(this, this.response, arguments, 0) - }; - if (_done) { - return _reply(callback, _error, _response); - } else { - _onResponse = function(err, resp) { - _reply(callback, err, resp); - }; - }; - }; -}; -wrapChainMethods(HttpClientRequest, ["abort",]); -exports.httpRequest = function(options) { - return new HttpClientRequest(options); -}; -function NetStream(emitter, options) { - ReadableStream.call(this, emitter, (options.read || options)); - WritableStream.call(this, emitter, (options.write || options)); -}; -exports.NetStream = NetStream; -var net; -exports.tcpClient = function(port, host, options) { - host = (host || "localhost"); - options = (options || { - }); - return new NetClient(options, port, host); -}; -exports.socketClient = function(path, options) { - options = (options || { - }); - return new NetClient(options, path); -}; -function NetClient(options, args) { - args = Array.prototype.slice.call(arguments, 1); - net = (net || require("net")); - var _connection = net.createConnection.apply(net, args); - var _error; - var _done = false; - _connection.on("error", function(err) { - _onConnect(err); - }); - _connection.on("connect", function() { - _onConnect(null); - }); - function trackConnect(err) { - _done = true; - _error = err; - }; - var _onConnect = trackConnect; - this.connect = function(callback) { - if (!callback) { - return __future.call(this, this.connect, arguments, 0) - }; - if (_done) { - return _reply(callback, _error, new NetStream(_connection, options)); - } else { - _onConnect = function(err) { - _reply(callback, err, new NetStream(_connection, options)); - }; - }; - }; -}; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/streams_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/streams_.js deleted file mode 100644 index 44443a67..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/server/streams_.js +++ /dev/null @@ -1,648 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * MIT License - */ -"use strict"; -//streamline.options = { "tryCatch" : "fast", "lines" : "ignore" } - -/// !doc -/// -/// # streamline/lib/streams/server/streams -/// -/// Server Streams module -/// -/// The `streams` module contains _pull mode_ wrappers around node streams. -/// -/// These wrappers implement a _pull style_ API. -/// Instead of having the stream _push_ the data to its consumer by emitting `data` and `end` events, -/// these wrappers let the consumer _pull_ the data from the stream by calling asynchronous `read` methods. -/// -/// For a bit more background on this design, -/// you can read [this blog post](http://bjouhier.wordpress.com/2011/04/25/asynchronous-episode-3-adventures-in-event-land/) -/// -/// For a simple example of this API in action, -/// see the [google client example](./examples/googleClient_.js) - -var parseUrl = require("url").parse; - -function _reply(callback, err, value) { - try { - callback(err, value); - } catch (ex) { - __propagate(callback, ex); - } -} - -function checkOpen(emitter) { - if (!emitter) - throw new Error("invalid operation on closed stream") -} - -function wrapProperties(constr, writable, props) { - props.forEach( function(name) { - constr.prototype.__defineGetter__(name, function() { - return this.emitter[name]; - }) - }); - writable && props.forEach( function(name) { - constr.prototype.__defineSetter__(name, function(val) { - this.emitter[name] = val; - return this; - }) - }); -} - -function wrapMethods(constr, methods) { - methods.forEach( function(name) { - constr.prototype[name] = function() { - return this.emitter[name].apply(this.emitter, arguments); - } - }); -} - -function wrapChainMethods(constr, methods) { - methods.forEach( function(name) { - constr.prototype[name] = function() { - this.emitter[name].apply(this.emitter, arguments); - return this; - } - }); -} - -function wrapEvents(constr, events) { - constr.prototype.events = (constr.prototype.events || []).concat(events); -} - -/// -/// ## Emitter -/// -/// Base wrapper for all objects that emit an `end` or `close` event. -/// All stream wrappers derive from this wrapper. -/// -/// * `wrapper = new streams.Emitter(stream)` -/// creates a wrapper. -function Emitter(emitter) { - emitter.on('close', function() { - _onClose(); - }); - function trackClose() { - emitter = null; - } - - var _onClose = trackClose; - - this.close = function(callback) { - if (!callback) - return __future.call(this, this.close, arguments, 0); - if (!emitter) - return _reply(callback); - var close = emitter.close || emitter.destroySoon; - if (typeof close !== "function") - return _reply(callback); - _onClose = function() { - emitter = null; - _onClose = trackClose; - _reply(callback); - } - if (this.doesNotEmitClose) - emitter.emit("close"); - close.call(emitter); - } - /// * `emitter = wrapper.emitter` - /// returns the underlying emitter. The emitter stream can be used to attach additional observers. - this.__defineGetter__("emitter", function() { - return emitter; - }) - /// * `emitter = wrapper.unwrap()` - /// unwraps and returns the underlying emitter. - /// The wrapper should not be used after this call. - this.unwrap = function() { - var result = emitter; - emitter && emitter.events.forEach( function(event) { - emitter.removeAllListeners(event); - }); - emitter = null; - return result; - } -} - -/// -/// ## ReadableStream -/// -/// All readable stream wrappers derive from this wrapper. -/// -/// * `stream = new streams.ReadableStream(stream, [options])` -/// creates a readable stream wrapper. -function ReadableStream(emitter, options) { - Emitter.call(this, emitter); - options = options || {} - var _low = Math.max(options.lowMark || 0, 0); - var _high = Math.max(options.highMark || 0, _low); - var _paused = false; - var _current = 0; - var _chunks = []; - var _error; - var _done = false; - var _encoding; - - emitter.on('error', function(err) { - _onData(err); - }); - emitter.on('data', function(chunk) { - _onData(null, chunk); - }); - emitter.on('end', function() { - _onData(null, null); - }); - function trackData(err, chunk) { - if (!emitter) - return; - if (err) - _error = err; - else if (chunk) { - _chunks.push(chunk); - _current += chunk.length; - if (_current > _high && !_paused && !_done && !_error) { - emitter.pause(); - _paused = true; - } - } else - _done = true; - }; - - var _onData = trackData; - - function readChunk(callback) { - if (_chunks.length > 0) { - var chunk = _chunks.splice(0, 1)[0]; - _current -= chunk.length; - if (_current <= _low && _paused && !_done && !_error) { - emitter.resume(); - _paused = false; - } - return _reply(callback, null, chunk); - } else if (_done) - return _reply(callback, null, null); - else if (_error) - return _reply(callback, _error); - else - _onData = function(err, chunk) { - if (err) - _error = err; - else if (!chunk) - _done = true; - _onData = trackData; // restore it - _reply(callback, err, chunk); - }; - } - - function concat(chunks, total) { - if (_encoding) - return chunks.join(''); - if (chunks.length == 1) - return chunks[0]; - var result = new Buffer(total); - chunks.reduce( function(val, chunk) { - chunk.copy(result, val); - return val + chunk.length; - }, 0); - return result; - } - /// * `stream.setEncoding(enc)` - /// sets the encoding. - /// returns `this` for chaining. - this.setEncoding = function(enc) { - checkOpen(emitter); - _encoding = enc; - if (enc) - emitter.setEncoding(enc); - return this; - } - /// * `data = stream.read(_, [len])` - /// reads asynchronously from the stream and returns a `string` or a `Buffer` depending on the encoding. - /// If a `len` argument is passed, the `read` call returns when `len` characters or bytes - /// (depending on encoding) have been read, or when the underlying stream has emitted its `end` event. - /// Without `len`, the read calls returns the data chunks as they have been emitted by the underlying stream. - /// Once the end of stream has been reached, the `read` call returns `null`. - this.read = function(_, len) { - if (!emitter) - return null; - if (len == null) - return readChunk(_); - if (len < 0) - len = Infinity; - if (len == 0) - return _encoding ? "" : new Buffer(0); - var chunks = [], total = 0; - while (total < len) { - var chunk = readChunk(_); - if (!chunk) - return chunks.length == 0 ? null : concat(chunks, total); - if (total + chunk.length <= len) { - chunks.push(chunk); - total += chunk.length; - } else { - chunks.push(chunk.slice(0, len - total)); - this.unread(chunk.slice(len - total)); - total = len; - } - } - return concat(chunks, total); - } - /// * `data = stream.readAll(_)` - /// reads till the end of stream. - /// Equivalent to `stream.read(_, -1)`. - this.readAll = function(_) { - return this.read(_, -1); - } - /// * `stream.unread(chunk)` - /// pushes the chunk back to the stream. - /// returns `this` for chaining. - this.unread = function(chunk) { - if (chunk) { - _chunks.splice(0, 0, chunk); - _current += chunk.length; - } - return this; - } -} - -exports.ReadableStream = ReadableStream; -wrapEvents(ReadableStream, ["error", "data", "end", "close"]); - -/// -/// ## WritableStream -/// -/// All writable stream wrappers derive from this wrapper. -/// -/// * `stream = new streams.WritableStream(stream, [options])` -/// creates a writable stream wrapper. -function WritableStream(emitter, options) { - Emitter.call(this, emitter); - options = options || {} - var _drainCallback; - - emitter.on('drain', function() { - var callback = _drainCallback; - if (callback) { - _drainCallback = null; - _reply(callback); - } - }) - function _drain(callback) { - _drainCallback = callback; - } - - /// * `stream.write(_, data, [enc])` - /// Writes the data. - /// This operation is asynchronous because it _drains_ the stream if necessary. - /// If you have a lot of small write operations to perform and you don't want the overhead of draining at every step, - /// you can write to the underlying stream with `stream.emitter.write(data)` most of the time - /// and call `stream.write(_, data)` once in a while to drain. - /// Returns `this` for chaining. - this.write = function(_, data, enc) { - checkOpen(emitter); - if (!emitter.write(data, enc)) - _drain(_); - return this; - } - /// * `stream.end()` - /// signals the end of the send operation. - /// Returns `this` for chaining. - this.end = function(data, enc) { - checkOpen(emitter); - emitter.end(data, enc); - return this; - } -} - -exports.WritableStream = WritableStream; -wrapEvents(WritableStream, ["drain", "close"]); - -function _getEncoding(headers) { - var comps = (headers['content-type'] || 'text/plain').split(';'); - var ctype = comps[0]; - for (var i = 1; i < comps.length; i++) { - var pair = comps[i].split('='); - if (pair.length == 2 && pair[0].trim() == 'charset') - return pair[1].trim(); - } - if (ctype.indexOf('text') >= 0 || ctype.indexOf('json') >= 0) - return "utf8"; - return null; -} - -/// -/// ## HttpServerRequest -/// -/// This is a wrapper around node's `http.ServerRequest`: -/// This stream is readable (see Readable Stream above). -/// -/// * `request = new streams.HttpServerRequest(req, [options])` -/// returns a wrapper around `req`, an `http.ServerRequest` object. -/// The `options` parameter can be used to pass `lowMark` and `highMark` values. -function HttpServerRequest(req, options) { - ReadableStream.call(this, req, options); - this._request = req; - this.setEncoding(_getEncoding(req.headers)); -} - -exports.HttpServerRequest = HttpServerRequest; -HttpServerRequest.prototype.doesNotEmitClose = true; - -/// * `method = request.method` -/// * `url = request.url` -/// * `headers = request.headers` -/// * `trailers = request.trailers` -/// * `httpVersion = request.httpVersion` -/// * `connection = request.connection` -/// * `socket = request.socket` -/// (same as `http.ServerRequest`) -// TODO: all properties may not be writable - check -wrapProperties(HttpServerRequest, true, ["method", "url", "headers", "trailers", "httpVersion", "connection", "socket"]); - -/// -/// ## HttmServerResponse -/// -/// This is a wrapper around node's `http.ServerResponse`. -/// This stream is writable (see Writable Stream above). -/// -/// * `response = new streams.HttpServerResponse(resp, [options])` -/// returns a wrapper around `resp`, an `http.ServerResponse` object. -function HttpServerResponse(resp, options) { - WritableStream.call(this, resp, options); - this._response = resp; -} - -exports.HttpServerResponse = HttpServerResponse; -HttpServerResponse.prototype.doesNotEmitClose = true; - -/// * `response.writeContinue()` -/// * `response.writeHead(head)` -/// * `response.setHeader(name, value)` -/// * `value = response.getHeader(head)` -/// * `response.removeHeader(name)` -/// * `response.addTrailers(trailers)` -/// * `response.statusCode = value` -/// (same as `http.ServerResponse`) -wrapChainMethods(HttpServerResponse, ["writeContinue", "writeHead", "setHeader", "removeHeader", "addTrailers"]); -wrapMethods(HttpServerResponse, ["getHeader"]); -wrapProperties(HttpServerResponse, true, ["statusCode"]); - -function _fixHttpServerOptions(options) { - options = options || {}; - options.module = require(options.secure ? "https" : "http"); - return options; -} - -/// -/// ## HttpServer -/// -/// This is a wrapper around node's `http.Server` object: -/// -/// * `server = new streams.HttpServer(requestListener, [options])` -/// creates the wrapper. -/// `requestListener` is called as `requestListener(request, response, _)` -/// where `request` and `response` are wrappers around `http.ServerRequest` and `http.ServerResponse`. -function HttpServer(requestListener, options) { - var self = this; - options = _fixHttpServerOptions(options); - var server = options.module.createServer( function(request, response) { - return requestListener(new HttpServerRequest(request, options), new HttpServerResponse(response, options), function(err) { - if (err) { - response.writeHead(500, { "Content-Type" : "text/plain" }); - response.end(err.message + "\n" + err.stack); - } - }); - }); - Emitter.call(this, server); - - /// * `server.listen(_, port, [host])` - /// * `server.listen(_, path)` - /// (same as `http.Server`) - this.listen = function(callback, args) { - if (!callback) - return __future.call(this, this.listen, arguments, 0); - args = Array.prototype.slice.call(arguments, 1); - args.push( function() { - _reply(callback, null, self); - }); - server.listen.apply(server, args) - } -} - -exports.HttpServer = HttpServer; - -/// -/// ## HttpClientResponse -/// -/// This is a wrapper around node's `http.ClientResponse` -/// -/// This stream is readable (see Readable Stream above). -/// -/// * `response = request.response(_)` returns the response stream. -function HttpClientResponse(resp, options) { - ReadableStream.call(this, resp, options); - this._response = resp; - this.setEncoding(_getEncoding(resp.headers)); -} - -/// * `status = response.statusCode` -/// returns the HTTP status code. -/// * `version = response.httpVersion` -/// returns the HTTP version. -/// * `headers = response.headers` -/// returns the HTTP response headers. -/// * `trailers = response.trailers` -/// returns the HTTP response trailers. -wrapProperties(HttpClientResponse, false, ["statusCode", "httpVersion", "headers", "trailers"]); - -/// * `response.checkStatus(statuses)` -/// throws an error if the status is not in the `statuses` array. -/// If only one status is expected, it may be passed directly as an integer rather than as an array. -/// Returns `this` for chaining. -HttpClientResponse.prototype.checkStatus = function(statuses) { - if (typeof statuses === 'number') - statuses = [statuses]; - if (statuses.indexOf(this.statusCode) < 0) - throw new Error("invalid status: " + this.statusCode); - return this; -} - -function _fixHttpClientOptions(options) { - if (!options) - throw new Error("request error: no options"); - if (typeof options === "string") - options = { url: options }; - if (options.url) { - var parsed = parseUrl(options.url); - options.protocol = parsed.protocol; - options.host = parsed.hostname; - options.port = parsed.port; - options.path = parsed.pathname + (parsed.query ? "?" + parsed.query : ""); - } - options.protocol = options.protocol || "http:"; - options.port = options.port || (options.protocol === "https:" ? 443 : 80); - options.path = options.path || "/"; - if (!options.host) - throw new Error("request error: no host"); - options.method = options.method || "GET"; - options.headers = options.headers || {}; - options.module = require(options.protocol.substring(0, options.protocol.length - 1)); - if (options.user != null) { - // assumes basic auth for now - var token = options.user + ":" + (options.password || ""); - token = new Buffer(token, "utf8").toString("base64"); - options.headers.Authorization = "Basic " + token; - } - - if (options.proxy) { - if (typeof options.proxy === "string") { - options.proxy = parseUrl(options.proxy); - options.proxy.host = options.proxy.hostname; - } - options.proxy.port = options.proxy.port || options.port; - if (!options.proxy.host) - throw new Error("proxy configuration error: no host"); - options.path = options.protocol + "//" + options.host + ":" + options.port + options.path; - options.headers.host = options.host; - options.host = options.proxy.host; - options.port = options.proxy.port; - // will worry about authenticated proxy later - } - return options; -} - -/// -/// ## HttpClientRequest -/// -/// This is a wrapper around node's `http.ClientRequest`. -/// -/// This stream is writable (see Writable Stream above). -/// -/// * `request = streams.httpRequest(options)` -/// creates the wrapper. -/// The options are the following: -/// * `method`: the HTTP method, `'GET'` by default. -/// * `headers`: the HTTP headers. -/// * `url`: the requested URL (with query string if necessary). -/// * `proxy.url`: the proxy URL. -/// * `lowMark` and `highMark`: low and high water mark values for buffering (in bytes or characters depending -/// on encoding). -/// Note that these values are only hints as the data is received in chunks. -function HttpClientRequest(options) { - options = _fixHttpClientOptions(options); - var _request = options.module.request(options, function(resp) { - _onResponse(null, resp && new HttpClientResponse(resp, options)); - }); - WritableStream.call(this, _request, options); - var _response; - var _error; - var _done = false; - - _request.on('error', function(err) { - // TODO: add context to error - !_response && _onResponse(err); - }); - function trackResponse(err, resp) { - _done = true; - _error = err; - _response = resp; - }; - - var _onResponse = trackResponse; - /// * `response = request.response(_)` - /// returns the response. - this.response = function(callback) { - if (!callback) - return __future.call(this, this.response, arguments, 0); - if (_done) - return _reply(callback, _error, _response); - else - _onResponse = function(err, resp) { - _reply(callback, err, resp); - }; - } -} - -/// * `request.abort()` -/// aborts the request. -wrapChainMethods(HttpClientRequest, ["abort"]); - -exports.httpRequest = function(options) { - return new HttpClientRequest(options); -}; - -/// -/// ## NetStream -/// -/// This is a wrapper around streams returned by TCP and socket clients: -/// -/// These streams is both readable and writable (see Readable Stream and Writable Stream above). -/// -/// * `stream = new streams.NetStream(stream, [options])` -/// creates a network stream wrapper. - -function NetStream(emitter, options) { - ReadableStream.call(this, emitter, options.read || options); - WritableStream.call(this, emitter, options.write || options); -} - -exports.NetStream = NetStream; - -var net; // lazy require - -/// -/// ## TCP and Socket clients -/// -/// These are wrappers around node's `net.createConnection`: -/// -/// * `client = streams.tcpClient(port, host, [options])` -/// returns a TCP connection client. -/// * `client = streams.socketClient(path, [options])` -/// returns a socket client. -/// The `options` parameter of the constructor provide options for the stream (`lowMark` and `highMark`). If you want different options for `read` and `write` operations, you can specify them by creating `options.read` and `options.write` sub-objects inside `options`. -exports.tcpClient = function(port, host, options) { - host = host || "localhost"; - options = options || {}; - return new NetClient(options, port, host); -} -exports.socketClient = function(path, options) { - options = options || {}; - return new NetClient(options, path); -} - -function NetClient(options, args) { - args = Array.prototype.slice.call(arguments, 1); - net = net || require("net"); - var _connection = net.createConnection.apply(net, args); - var _error; - var _done = false; - - _connection.on('error', function(err) { - // TODO: add context to error - _onConnect(err); - }); - _connection.on('connect', function() { - _onConnect(null); - }); - function trackConnect(err) { - _done = true; - _error = err; - }; - - var _onConnect = trackConnect; - - /// * `stream = client.connect(_)` - /// connects the client and returns a network stream. - this.connect = function(callback) { - if (!callback) - return __future.call(this, this.connect, arguments, 0); - if (_done) - return _reply(callback, _error, new NetStream(_connection, options)); - else - _onConnect = function(err) { - _reply(callback, err, new NetStream(_connection, options)); - }; - } -} diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/streams.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/streams.js deleted file mode 100644 index af078cec..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/streams.js +++ /dev/null @@ -1,16 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -"use strict"; -var __global = typeof global !== 'undefined' ? global : window; -function copy(src, dst) { - Object.keys(src).forEach(function(key) { - dst[key] = src[key]; - }); -}; -if (((typeof process === "object") && (typeof process.cwd === "function"))) { - copy(require(("./server/" + "streams")), exports); -} - else { - copy(require("./client/streams"), exports); -} -; \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/streams_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/streams_.js deleted file mode 100644 index f6a39936..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/streams/streams_.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * MIT License - */ -"use strict"; -//streamline.options = { "tryCatch" : "fast", "lines" : "ignore" } - -/// !nodoc -- experimental combo streams -/// -function copy(src, dst) { - Object.keys(src).forEach(function(key) { dst[key] = src[key]}) -} -if (typeof process === "object" && typeof process.cwd === "function") { - copy(require('./server/' + 'streams'), exports); -} -else { - copy(require('./client/streams'), exports); -} diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/tools/docTool.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/tools/docTool.js deleted file mode 100644 index 3e015266..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/tools/docTool.js +++ /dev/null @@ -1,136 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); try { return fn(null, result); } catch (ex) { return __propagate(_, ex); } } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -function __nt(_, fn){ var i = 0; var cb = __cb(_, fn); var safeCb = function(){ try { cb(); } catch (ex) { __propagate(cb, ex); } }; if (typeof process != "undefined" && typeof process.nextTick == "function") return function(){ if (++i % 20 == 0) process.nextTick(safeCb); else cb(); }; else return function(){ if (++i % 20 == 0) setTimeout(safeCb); else cb(); }; } -function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } -function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } -(function __main(_) { - var fs, fsp; - fs = require("fs"); - fsp = require("path"); - exports.generate = function __1(_, path, options) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - function _generate(_, path) { - if (!_) { - return __future(_generate, arguments, 0); - } - ; - var stat, inside, doc, pair, isPackage, files, i; - return fs.stat(path, __cb(_, function(__0, __1) { - stat = __1; - return (function(__then) { - if (stat.isFile()) { - return (function(__then) { - if ((path.indexOf(".js") == (path.length - 3))) { - return fs.readFile(path, "utf8", __cb(_, function(__0, __2) { - doc = __2.split("\n").map(function(line) { - var i = line.indexOf(("//" + "/ ")); - line = ((i >= 0) ? line.substring((i + 4)) : null); - if ((line === "!doc")) { - inside = true; - } - else if ((line === "!nodoc")) { - inside = false; - } - else return ((inside && (line != null)) ? (line + "\n") : null) - - ; - }).filter(function(line) { - return (line != null); - }).join(""); - return _(null, (doc || "")); - })); - } - else { - __then(); - } - ; - })(function() { - return _(null, ""); - }); - } - else { - return (function(__then) { - if (stat.isDirectory()) { - pair = path.split("/node_modules/"); - isPackage = (pair[1] && (pair[1].indexOf("/") < 0)); - doc = ""; - return fs.readdir(path, __cb(_, function(__0, __3) { - files = __3; - i = 0; - var __9 = false; - return (function(__break) { - var __loop = __nt(_, function() { - if (__9) { - i++; - } - else { - __9 = true; - } - ; - var __8 = (i < files.length); - if (__8) { - return _generate(__cb(_, function(__0, __4) { - doc += __4; - __loop(); - }), ((path + "/") + files[i])); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return (function(__then) { - if ((isPackage && doc)) { - return fs.writeFile((path + "/API.md"), doc, "utf8", __cb(_, function() { - if (options.verbose) { - console.log((("generated " + path) + "/API.md")); - } - ; - doc = ""; - __then(); - })); - } - else { - __then(); - } - ; - })(function() { - return _(null, doc); - }); - }); - })); - } - else { - return _(null, ""); - } - ; - })(__then); - } - ; - })(_); - })); - }; - options = (options || { - }); - return _generate(_, path); - }; - return (function(__then) { - if ((process.argv[1] && (process.argv[1].indexOf("/docTool") >= 0))) { - return exports.generate(__cb(_, __then), fsp.join(process.cwd(), (process.argv[2] || ".")), { - verbose: true - }); - } - else { - __then(); - } - ; - })(_); -}).call(this, __trap); \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/tools/docTool_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/tools/docTool_.js deleted file mode 100644 index fb960ab8..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/tools/docTool_.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * MIT License - * - * streamline.options = { "lines": "ignore" } - */ - -/// !doc -/// # streamline/lib/tools/docTool -/// -/// Documentation tool -/// -/// Usage: -/// -/// node streamline/lib/tools/docTool [path] -/// -/// Extracts documentation comments from `.js` files and generates `API.md` file -/// under package root. -/// -/// Top of source file must contain `/// !doc` marker to enable doc extraction. -/// Documentation comments must start with `/// ` (with 1 trailing space). -/// Extraction can be turned off with `/// !nodoc` and turned back on with `/// !doc`. -/// -/// The tool can also be invoked programatically with: -/// -var fs = require('fs'); -var fsp = require('path'); - -/// * `doc = docTool.generate(_, path)` -/// extracts documentation comments from file `path` -exports.generate = function(_, path, options) { - options = options || {} - function _generate(_, path) { - var stat = fs.stat(path, _); - if (stat.isFile()) { - if (path.indexOf('.js') == path.length - 3) { - var inside; - var doc = fs.readFile(path, "utf8", _).split('\n').map( function(line) { - var i = line.indexOf('//' + '/ '); - line = i >= 0 ? line.substring(i + 4) : null; - if (line === "!doc") { - inside = true; - } else if (line === "!nodoc") { - inside = false; - } else - return inside && line != null ? line + "\n" : null; - }).filter( function(line) { - return line != null; - }).join(""); - return doc || ""; - } - return ""; - } else if (stat.isDirectory()) { - var pair = path.split("/node_modules/"); - var isPackage = pair[1] && pair[1].indexOf('/') < 0; - var doc = ""; - var files = fs.readdir(path, _); - for (var i = 0; i < files.length; i++) { - doc += _generate(_, path + "/" + files[i]); - } - if (isPackage && doc) { - fs.writeFile(path + "/API.md", doc, "utf8", _); - if (options.verbose) - console.log("generated " + path + "/API.md"); - doc = ""; - } - return doc; - } else - return ""; - } - _generate(_, path); - -} -if (process.argv[1] && process.argv[1].indexOf("/docTool") >= 0) - exports.generate(_, fsp.join(process.cwd(), process.argv[2] || '.'), { verbose: true }); diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/transform.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/transform.js deleted file mode 100644 index 7143ec45..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/transform.js +++ /dev/null @@ -1,5 +0,0 @@ -console.error("Module moved to subdirectory. New require path is streamline/lib/compiler/transform"); -var moved = require("./compiler/transform"); -for (var name in moved) - exports[name] = moved[name]; - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/flows.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/flows.js deleted file mode 100644 index 8ad03b62..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/flows.js +++ /dev/null @@ -1,451 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - -var __global = typeof global !== 'undefined' ? global : window; -function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); return fn(null, result); } } -function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } -function __nt(_, fn){ var i = 0; var cb = __cb(_, fn); var safeCb = function(){ try { cb(); } catch (ex) { __propagate(cb, ex); } }; if (typeof process != "undefined" && typeof process.nextTick == "function") return function(){ if (++i % 20 == 0) process.nextTick(safeCb); else cb(); }; else return function(){ if (++i % 20 == 0) setTimeout(safeCb); else cb(); }; } -function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } -function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } -function __forIn(object){ var array = []; for (var obj in object) { array.push(obj); } return array; } -(function(exports) { - "use strict"; - exports.each = function __1(_, array, fn, thisObj) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - var len, i; - if ((!array || !array.length)) { - return _(null); - } - ; - len = array.length; - i = 0; - var __2 = false; - return (function(__break) { - var __loop = __nt(_, function() { - if (__2) { - i++; - } - else { - __2 = true; - } - ; - var __1 = (i < len); - if (__1) { - return fn.call(thisObj, __cb(_, __loop), array[i], i); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(null, array); - }); - }; - exports.map = function __2(_, array, fn, thisObj) { - if (!_) { - return __future(__2, arguments, 0); - } - ; - var result, len, i; - if (!array) { - return _(null, array); - } - ; - result = []; - len = array.length; - i = 0; - var __3 = false; - return (function(__break) { - var __loop = __nt(_, function() { - if (__3) { - i++; - } - else { - __3 = true; - } - ; - var __2 = (i < len); - if (__2) { - return fn.call(thisObj, __cb(_, function(__0, __1) { - result[i] = __1; - __loop(); - }), array[i], i); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(null, result); - }); - }; - exports.filter = function __3(_, array, fn, thisObj) { - if (!_) { - return __future(__3, arguments, 0); - } - ; - var result, len, i, elt; - if (!array) { - return _(null, array); - } - ; - result = []; - len = array.length; - i = 0; - var __3 = false; - return (function(__break) { - var __loop = __nt(_, function() { - if (__3) { - i++; - } - else { - __3 = true; - } - ; - var __2 = (i < len); - if (__2) { - elt = array[i]; - return fn.call(thisObj, __cb(_, function(__0, __1) { - return (function(__then) { - if (__1) { - result.push(elt); - __then(); - } - else { - __then(); - } - ; - })(__loop); - }), elt); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(null, result); - }); - }; - exports.every = function __4(_, array, fn, thisObj) { - if (!_) { - return __future(__4, arguments, 0); - } - ; - var len, i; - if (!array) { - return _(null); - } - ; - len = array.length; - i = 0; - var __4 = false; - return (function(__break) { - var __loop = __nt(_, function() { - if (__4) { - i++; - } - else { - __4 = true; - } - ; - var __3 = (i < len); - if (__3) { - return fn.call(thisObj, __cb(_, function(__0, __2) { - var __1 = !__2; - return (function(__then) { - if (__1) { - return _(null, false); - } - else { - __then(); - } - ; - })(__loop); - }), array[i]); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(null, true); - }); - }; - exports.some = function __5(_, array, fn, thisObj) { - if (!_) { - return __future(__5, arguments, 0); - } - ; - var len, i; - if (!array) { - return _(null); - } - ; - len = array.length; - i = 0; - var __3 = false; - return (function(__break) { - var __loop = __nt(_, function() { - if (__3) { - i++; - } - else { - __3 = true; - } - ; - var __2 = (i < len); - if (__2) { - return fn.call(thisObj, __cb(_, function(__0, __1) { - return (function(__then) { - if (__1) { - return _(null, true); - } - else { - __then(); - } - ; - })(__loop); - }), array[i]); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(null, false); - }); - }; - exports.reduce = function __6(_, array, fn, v, thisObj) { - if (!_) { - return __future(__6, arguments, 0); - } - ; - var len, i; - if (!array) { - return _(null, v); - } - ; - len = array.length; - i = 0; - var __3 = false; - return (function(__break) { - var __loop = __nt(_, function() { - if (__3) { - i++; - } - else { - __3 = true; - } - ; - var __2 = (i < len); - if (__2) { - return fn.call(thisObj, __cb(_, function(__0, __1) { - v = __1; - __loop(); - }), v, array[i], i, array); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(null, v); - }); - }; - exports.reduceRight = function __7(_, array, fn, v, thisObj) { - if (!_) { - return __future(__7, arguments, 0); - } - ; - var len, i; - if (!array) { - return _(null, v); - } - ; - len = array.length; - i = (len - 1); - var __3 = false; - return (function(__break) { - var __loop = __nt(_, function() { - if (__3) { - i--; - } - else { - __3 = true; - } - ; - var __2 = (i >= 0); - if (__2) { - return fn.call(thisObj, __cb(_, function(__0, __1) { - v = __1; - __loop(); - }), v, array[i], i, array); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(null, v); - }); - }; - exports.eachKey = function __8(_, obj, fn, thisObj) { - if (!_) { - return __future(__8, arguments, 0); - } - ; - var key; - if (!obj) { - return _(null, obj); - } - ; - var __1 = __forIn(obj); - var __2 = 0; - return (function(__break) { - var __loop = __nt(_, function() { - var __3 = (__2 < __1.length); - if (__3) { - key = __1[__2++]; - return (function(__then) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - return fn.call(thisObj, __cb(_, __then), key, obj[key]); - } - else { - __then(); - } - ; - })(__loop); - } - else { - __break(); - } - ; - }); - __loop(); - })(function() { - return _(null, obj); - }); - }; - exports.spray = function(fns, max) { - return new function() { - var funnel = exports.funnel(max); - this.collect = function(callback, count, trim) { - if ((typeof (callback) != "function")) { - throw new Error("invalid call to collect: no callback") - }; - var results = (trim ? [] : new Array(fns.length)); - count = ((count < 0) ? fns.length : Math.min(count, fns.length)); - if ((count == 0)) { - return callback(null, results) - }; - var collected = 0; - for (var i = 0; (i < fns.length); i++) { - (function(i) { - funnel(function(err, result) { - if (err) { - return callback(err) - }; - if (trim) { - results.push(result); - } else { - results[i] = result; - }; - if ((++collected == count)) { - return callback(null, results) - }; - }, fns[i]); - })(i); - }; - }; - this.collectOne = function(callback) { - return this.collect(function(err, result) { - return callback(err, (result && result[0])); - }, 1, true); - }; - this.collectAll = function(callback) { - return this.collect(callback, -1, false); - }; - }; - }; - exports.funnel = function(max) { - max = ((typeof max == "undefined") ? -1 : max); - var queue = []; - var active = 0; - return function(callback, fn) { - if ((max < 0)) { - return fn(callback) - }; - queue.push({ - fn: fn, - cb: callback - }); - function _doOne() { - var current = queue.splice(0, 1)[0]; - if (!current.cb) { - return current.fn() - }; - active++; - current.fn(function(err, result) { - active--; - current.cb(err, result); - while (((active < max) && (queue.length > 0))) { - _doOne();; - }; - }); - }; - while (((active < max) && (queue.length > 0))) { - _doOne();; - }; - }; - }; - exports.collect = function __9(_, futures) { - if (!_) { - return __future(__9, arguments, 0); - } - ; - return exports.map(_, futures, function __1(_, future) { - if (!_) { - return __future(__1, arguments, 0); - } - ; - return future(_); - }); - }; - exports.setContext = function(ctx) { - var old = __global.__context; - __global.__context = ctx; - return old; - }; - exports.getContext = function() { - return __global.__context; - }; - exports.nextTick = (((typeof process === "object") && (typeof process.nextTick === "function")) ? process.nextTick : function(callback) { - setTimeout(function() { - callback(); - }, 0); - }); - exports.apply = function apply(callback, fn, thisObj, args, index) { - if ((callback == null)) { - return __future(apply, arguments, 0) - }; - args.splice(((index != null) ? index : args.length), 0, callback); - return fn.apply(thisObj, args); - }; -})(((typeof exports !== "undefined") ? exports : (window.StreamlineFlows = (window.StreamlineFlows || { -})))); \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/flows_.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/flows_.js deleted file mode 100644 index a59a9d8c..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/flows_.js +++ /dev/null @@ -1,291 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * streamline.options = { "tryCatch" : "fast", "lines": "ignore" } - */ -/// !doc -/// -/// # streamline/lib/util/flows -/// -/// Flows Module -/// -/// The `streamline/lib/util/flows` module contains some handy utilities for streamline code -/// -(function(exports) { - "use strict"; - /// ## Array utilities - /// - /// The following functions are async equivalents of the ES5 Array methods (`forEach`, `map`, `filter`, ...) - /// - /// * `flows.each(_, array, fn, [thisObj])` - /// applies `fn` sequentially to the elements of `array`. - /// `fn` is called as `fn(_, elt, i)`. - exports.each = function(_, array, fn, thisObj) { - if (!array || !array.length) - return; // array; - var len = array.length; - for (var i = 0; i < len; i++) - fn.call(thisObj, _, array[i], i) - return array; - } - /// * `result = flows.map(_, array, fn, [thisObj])` - /// transforms `array` by applying `fn` to each element in turn. - /// `fn` is called as `fn(_, elt, i)`. - exports.map = function(_, array, fn, thisObj) { - if (!array) - return array; - var result = []; - var len = array.length; - for (var i = 0; i < len; i++) - result[i] = fn.call(thisObj, _, array[i], i); - return result; - } - /// * `result = flows.filter(_, array, fn, [thisObj])` - /// generates a new array that only contains the elements that satisfy the `fn` predicate. - /// `fn` is called as `fn(_, elt)`. - exports.filter = function(_, array, fn, thisObj) { - if (!array) - return array; - var result = []; - var len = array.length; - for (var i = 0; i < len; i++) { - var elt = array[i]; - if (fn.call(thisObj, _, elt)) - result.push(elt) - } - return result; - } - /// * `bool = flows.every(_, array, fn, [thisObj])` - /// returns true if `fn` is true on every element (if `array` is empty too). - /// `fn` is called as `fn(_, elt)`. - exports.every = function(_, array, fn, thisObj) { - if (!array) - return; // undefined - var len = array.length; - for (var i = 0; i < len; i++) { - if (!fn.call(thisObj, _, array[i])) - return false; - } - return true; - } - /// * `bool = flows.some(_, array, fn, [thisObj])` - /// returns true if `fn` is true for at least one element. - /// `fn` is called as `fn(_, elt)`. - exports.some = function(_, array, fn, thisObj) { - if (!array) - return; // undefined - var len = array.length; - for (var i = 0; i < len; i++) { - if (fn.call(thisObj, _, array[i])) - return true; - } - return false; - } - /// * `result = flows.reduce(_, array, fn, val, [thisObj])` - /// reduces by applying `fn` to each element. - /// `fn` is called as `val = fn(_, val, elt, i, array)`. - exports.reduce = function(_, array, fn, v, thisObj) { - if (!array) - return v; // undefined - var len = array.length; - for (var i = 0; i < len; i++) { - v = fn.call(thisObj, _, v, array[i], i, array); - } - return v; - } - /// * `result = flows.reduceRight(_, array, fn, val, [thisObj])` - /// reduces from end to start by applying `fn` to each element. - /// `fn` is called as `val = fn(_, val, elt, i, array)`. - exports.reduceRight = function(_, array, fn, v, thisObj) { - if (!array) - return v; // undefined - var len = array.length; - for (var i = len - 1; i >= 0; i--) { - v = fn.call(thisObj, _, v, array[i], i, array); - } - return v; - } - /// - /// ## Object utility - /// - /// The following function can be used to iterate through object properties: - /// - /// * `flows.eachKey(_, obj, fn)` - /// calls `fn(_, key, obj[key])` for every `key` in `obj`. - exports.eachKey = function(_, obj, fn, thisObj) { - if (!obj) - return obj; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) - fn.call(thisObj, _, key, obj[key]); - } - return obj; - } - /// - /// ## Workflow Utilities - /// - // deprecated -- don't document - exports.spray = function(fns, max) { - return new - function() { - var funnel = exports.funnel(max); - this.collect = function(callback, count, trim) { - if (typeof(callback) != "function") - throw new Error("invalid call to collect: no callback") - var results = trim ? [] : new Array(fns.length); - count = count < 0 ? fns.length : Math.min(count, fns.length); - if (count == 0) - return callback(null, results); - var collected = 0; - for (var i = 0; i < fns.length; i++) { - (function(i) { - funnel( function(err, result) { - if (err) - return callback(err); - if (trim) - results.push(result); - else - results[i] = result; - if (++collected == count) - return callback(null, results); - }, fns[i]) - })(i); - } - } - this.collectOne = function(callback) { - return this.collect( function(err, result) { - return callback(err, result && result[0]); - }, 1, true) - } - this.collectAll = function(callback) { - return this.collect(callback, -1, false); - } - } - - } - /// * `fun = flows.funnel(max)` - /// limits the number of concurrent executions of a given code block. - /// - /// The `funnel` function is typically used with the following pattern: - /// - /// // somewhere - /// var myFunnel = flows.funnel(10); // create a funnel that only allows 10 concurrent executions. - /// - /// // elsewhere - /// myFunnel(_, function(_) { /* code with at most 10 concurrent executions */ }); - /// - /// The `diskUsage2.js` example demonstrates how these calls can be combined to control concurrent execution. - /// - /// The `funnel` function can also be used to implement critical sections. Just set funnel's `max` parameter to 1. - exports.funnel = function(max) { - max = typeof max == "undefined" ? -1 : max; - var queue = []; - var active = 0; - - return function(callback, fn) { - //console.log("FUNNEL: active=" + active + ", queued=" + queue.length); - if (max < 0) - return fn(callback); - - queue.push({ - fn: fn, - cb: callback - }); - - function _doOne() { - var current = queue.splice(0, 1)[0]; - if (!current.cb) - return current.fn(); - active++; - current.fn( function(err, result) { - active--; - current.cb(err, result); - while (active < max && queue.length > 0) - _doOne(); - }); - } - - while (active < max && queue.length > 0) - _doOne(); - } - } - - /// - /// * `results = flows.collect(_, futures)` - /// collects the results of an array of futures - exports.collect = function(_, futures) { - return exports.map(_, futures, function(_, future) { - return future(_); - }); - } - /// - /// ## Context propagation - /// - /// Streamline also allows you to propagate a global context along a chain of calls and callbacks. - /// This context can be used like TLS (Thread Local Storage) in a threaded environment. - /// It allows you to have several active chains that each have their own global context. - /// - /// This kind of context is very handy to store information that all calls should be able to access - /// but that you don't want to pass explicitly via function parameters. The most obvious example is - /// the `locale` that each request may set differently and that your low level libraries should - /// be able to retrieve to format messages. - /// - /// The `streamline.flows` module exposes two functions to manipulate the context: - /// - /// * `oldCtx = flows.setContext(ctx)` - /// sets the context (and returns the old context). - exports.setContext = function(ctx) { - var old = __global.__context; - __global.__context = ctx; - return old; - } - /// * `ctx = flows.getContext()` - /// returns the current context. - exports.getContext = function() { - return __global.__context; - } - - /// - /// ## Miscellaneous - /// - /// * `flows.nextTick(_)` - /// `nextTick` function for both browser and server. - /// Aliased to `process.nextTick` on the server side. - exports.nextTick = typeof process === "object" && typeof process.nextTick === "function" - ? process.nextTick : function(callback) { - setTimeout(function() { callback(); }, 0); - }; - - /// * `result = flows.apply(_, fn, thisObj, args, [index])` - /// Helper to apply `Function.apply` to streamline functions. - /// Equivalent to `result = fn.apply(thisObj, argsWith_)` where `argsWith_` is - /// a modified argument list in which the callback has been inserted at `index` - /// (at the end of the argument list if `index` is not specified). - exports.apply = function apply(callback, fn, thisObj, args, index) { - if (callback == null) - return __future(apply, arguments, 0); - args.splice(index != null ? index : args.length, 0, callback); - return fn.apply(thisObj, args); - } -})(typeof exports !== 'undefined' ? exports : (window.StreamlineFlows = window.StreamlineFlows || {})); diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/future.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/future.js deleted file mode 100644 index b52c7229..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/future.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * MIT License - */ -(function(exports) { - exports.future = function(fn, args, i) { - var done, err, result; - var cb = function(e, r) { - done = true; err = e, result = r; - }; - args = Array.prototype.slice.call(args); - args[i == null ? fn.length - 1 : i] = function(e, r) { - cb(e, r); - }; - fn.apply(this, args); - return function(_) { - if (done) - _.call(this, err, result); - else - cb = _.bind(this); - }.bind(this); - } -})(typeof exports !== 'undefined' ? exports : (window.StreamlineFuture = window.StreamlineFuture || {})); - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/index.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/index.js deleted file mode 100644 index fadbf720..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/index.js +++ /dev/null @@ -1,5 +0,0 @@ -exports.flows = require("./flows"); -exports.future = require("./future"); -exports.url = require("./url"); -exports.uuid = require("./uuid"); - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/url.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/url.js deleted file mode 100644 index c6b222e5..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/url.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * MIT License - */ -"use strict"; -exports.parseQueryString = function(str) { - return (str || '').split('&').reduce(function(result, param) { - var pair = param.split('='); - result[pair[0]] = decodeURIComponent(pair[1]); - return result; - }, {}); -} \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/uuid.js b/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/uuid.js deleted file mode 100644 index d71e9a90..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/lib/util/uuid.js +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2011 Bruno Jouhier - * MIT License - */ -"use strict"; - -var _uuidRE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/; - -function _toHex(b) { - b = b & 0xff; - return b < 16 ? "0" + b.toString(16) : b.toString(16); -}; - -function _fromHex(str, i) { - var code = str.charCodeAt(i); - return code < 0x3A ? code - 0x30 : code < 0x47 ? code + 10 - 0x41 : code + 10 - 0x61; -}; - -exports.generate = function(sep) { - var randomHex = function(len, mask, offset) { - var n = Math.floor(Math.random() * (1 << 24)); - if (mask) - n = (n & mask) + offset; - var s = n.toString(16); - return s.length >= len ? s.substring(0, len) : ("00000000".substring(0, len - s.length) + - s); - }; - // Version 4 UUIDs have the form - // xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx with hexadecimal digits x - // and hexadecimal digits 8, 9, A, or B for y - if (sep == null) - sep = '-'; - return randomHex(4) + randomHex(4) + sep + randomHex(4) + sep + - randomHex(4, 0x0fff, 0x4000) + - sep + - randomHex(4, 0x3fff, 0x8000) + - sep + - randomHex(6) + - randomHex(6); -}; -exports.fromBytes= function(bytes) { - var s = ''; - for (var i = 0; i < bytes.length; i++) { - if (i == 4 || i == 6 || i == 8 || i == 10) - s += '-'; - var j = i; - var b = bytes[j]; - s += _toHex(b); - } - return s; -}; -exports.toBytes = function(str) { - if (!str || str.length != 36 || !_uuidRE.test(str)) - return null; - str = str.replace(/-/g, ''); - var bytes = []; - for (var i = 0; i < 16; i++) { - var j = i; - var b = (_fromHex(str, 2 * j) << 4) + _fromHex(str, 2 * j + 1); - bytes.push(b >= 128 ? b - 256 : b); - } - return bytes; -}; -exports.fromString32 = function(str) { - return [str.substring(0, 8), str.substring(8, 12), str.substring(12, 16), str.substring(16, 20), str.substring(20)].join('-').toLowerCase(); -}; -exports.toString32 = function(uuid) { - return uuid.replace(/-/g, '') -}; - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/package.json b/lib/adapters/neo4j-lib/node_modules/streamline/package.json deleted file mode 100644 index cc2fa752..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "streamline", - "description": "Asynchronous Javascript for dummies", - "version": "0.1.35", - "engines": { "node": ">=0.4.0" }, - "dependencies": {}, - "author": "Bruno Jouhier", - "directories": {"lib": "./lib", "bin": "./bin" }, - "main": "lib/index.js" -} diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/test/common/flows-test.html b/lib/adapters/neo4j-lib/node_modules/streamline/test/common/flows-test.html deleted file mode 100644 index 069aaeb0..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/test/common/flows-test.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - -

streamline flows tests

-

-

-
    - - - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/test/common/flows-test.js b/lib/adapters/neo4j-lib/node_modules/streamline/test/common/flows-test.js deleted file mode 100644 index c7626a86..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/test/common/flows-test.js +++ /dev/null @@ -1,157 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - var __global = typeof global !== 'undefined' ? global : window; function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); return fn(null, result); } } function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } var module = QUnit.module; - -var flows = require("streamline/lib/util/flows"); - -function delay(_, val) { if (!_) { return __future(delay, arguments, 0); }; - return flows.nextTick(__cb(_, function() { - return _(null, val); }));}; - - -function delayFail(_, err) { if (!_) { return __future(delayFail, arguments, 0); }; - return flows.nextTick(__cb(_, function() { - return _(err); }));}; - - -module("flows"); - -asyncTest("each", 1, function __1(_) { if (!_) { return __future(__1, arguments, 0); }; var result; - result = 1; - return flows.each(__cb(_, function() { - - - strictEqual(result, 24); - start(); _(); }), [1,2,3,4,], function __1(_, val) { if (!_) { return __future(__1, arguments, 0); } ; return delay(__cb(_, function(__0, __1) { result = (result * __1); _(); }), val); });}); - -asyncTest("map", 1, function __2(_) { if (!_) { return __future(__2, arguments, 0); }; var result; - return flows.map(__cb(_, function(__0, __2) { result = __2; - - - deepEqual(result, [2,4,6,8,]); - start(); _(); }), [1,2,3,4,], function __1(_, val) { if (!_) { return __future(__1, arguments, 0); } ; return delay(__cb(_, function(__0, __2) { var __1 = (2 * __2); return _(null, __1); }), val); });}); - -asyncTest("filter", 1, function __3(_) { if (!_) { return __future(__3, arguments, 0); }; var result; - return flows.filter(__cb(_, function(__0, __2) { result = __2; - - - deepEqual(result, [1,3,]); - start(); _(); }), [1,2,3,4,], function __1(_, val) { if (!_) { return __future(__1, arguments, 0); } ; return delay(__cb(_, function(__0, __2) { var __1 = (__2 % 2); return _(null, __1); }), val); });}); - -asyncTest("every", 1, function __4(_) { if (!_) { return __future(__4, arguments, 0); }; var result; - return flows.every(__cb(_, function(__0, __2) { result = __2; - - - strictEqual(result, true); - start(); _(); }), [1,2,3,4,], function __1(_, val) { if (!_) { return __future(__1, arguments, 0); } ; return delay(__cb(_, function(__0, __2) { var __1 = (__2 < 5); return _(null, __1); }), val); });}); - -asyncTest("every", 1, function __5(_) { if (!_) { return __future(__5, arguments, 0); }; var result; - return flows.every(__cb(_, function(__0, __2) { result = __2; - - - strictEqual(result, false); - start(); _(); }), [1,2,3,4,], function __1(_, val) { if (!_) { return __future(__1, arguments, 0); } ; return delay(__cb(_, function(__0, __2) { var __1 = (__2 < 3); return _(null, __1); }), val); });}); - -asyncTest("some", 1, function __6(_) { if (!_) { return __future(__6, arguments, 0); }; var result; - return flows.some(__cb(_, function(__0, __2) { result = __2; - - - strictEqual(result, true); - start(); _(); }), [1,2,3,4,], function __1(_, val) { if (!_) { return __future(__1, arguments, 0); } ; return delay(__cb(_, function(__0, __2) { var __1 = (__2 < 3); return _(null, __1); }), val); });}); - -asyncTest("some", 1, function __7(_) { if (!_) { return __future(__7, arguments, 0); }; var result; - return flows.some(__cb(_, function(__0, __2) { result = __2; - - - strictEqual(result, false); - start(); _(); }), [1,2,3,4,], function __1(_, val) { if (!_) { return __future(__1, arguments, 0); } ; return delay(__cb(_, function(__0, __2) { var __1 = (__2 < 0); return _(null, __1); }), val); });}); - -asyncTest("reduce", 1, function __8(_) { if (!_) { return __future(__8, arguments, 0); }; var result; - return flows.reduce(__cb(_, function(__0, __2) { result = __2; - - - strictEqual(result, 24); - start(); _(); }), [1,2,3,4,], function __1(_, v, val) { if (!_) { return __future(__1, arguments, 0); } ; return delay(__cb(_, function(__0, __2) { var __1 = (v * __2); return _(null, __1); }), val); }, 1);}); - -asyncTest("reduceRight", 1, function __9(_) { if (!_) { return __future(__9, arguments, 0); }; var result; - return flows.reduceRight(__cb(_, function(__0, __2) { result = __2; - - - strictEqual(result, 24); - start(); _(); }), [1,2,3,4,], function __1(_, v, val) { if (!_) { return __future(__1, arguments, 0); } ; return delay(__cb(_, function(__0, __2) { var __1 = (v * __2); return _(null, __1); }), val); }, 1);}); - -asyncTest("collectAll", 1, function __10(_) { if (!_) { return __future(__10, arguments, 0); }; var total, peak, count, results; - - - - function doIt(i) { - return function __1(_) { if (!_) { return __future(__1, arguments, 0); } ; - count++; - peak = Math.max(count, peak); - return delay(__cb(_, function(__0, __1) { total += __1; - count--; - return _(null, (2 * i)); }), i); }; }; total = 0; peak = 0; count = 0; - - - - return flows.spray([doIt(1),doIt(2),doIt(3),]).collectAll(__cb(_, function(__0, __1) { results = __1; - deepEqual([total,peak,count,results,], [6,3,0,[2,4,6,],]); - start(); _(); }));}); - -asyncTest("collectOne", 1, function __11(_) { if (!_) { return __future(__11, arguments, 0); }; var total, peak, count, result; - - - - function doIt(i) { - return function __1(_) { if (!_) { return __future(__1, arguments, 0); } ; - count++; - peak = Math.max(count, peak); - return delay(__cb(_, function(__0, __1) { total += __1; - count--; - return _(null, (2 * i)); }), i); }; }; total = 0; peak = 0; count = 0; - - - - return flows.spray([doIt(1),doIt(2),doIt(3),]).collectOne(__cb(_, function(__0, __1) { result = __1; - deepEqual([total,peak,count,result,], [1,3,2,2,]); - start(); _(); }));}); - -asyncTest("collectAll with limit", 1, function __12(_) { if (!_) { return __future(__12, arguments, 0); }; var total, peak, count, results; - - - - function doIt(i) { - return function __1(_) { if (!_) { return __future(__1, arguments, 0); } ; - count++; - peak = Math.max(count, peak); - return delay(__cb(_, function(__0, __1) { total += __1; - count--; - return _(null, (2 * i)); }), i); }; }; total = 0; peak = 0; count = 0; - - - - return flows.spray([doIt(1),doIt(2),doIt(3),], 2).collectAll(__cb(_, function(__0, __1) { results = __1; - deepEqual([total,peak,count,results,], [6,2,0,[2,4,6,],]); - start(); _(); }));}); - -asyncTest("contexts", 3, function __13(_) { if (!_) { return __future(__13, arguments, 0); }; var result; - function testContext(_, x) { if (!_) { return __future(testContext, arguments, 0); } ; var y; - flows.setContext({ - val: x }); - - return delay(__cb(_, function(__0, __1) { y = __1; - strictEqual(y, (2 * flows.getContext().val)); - return _(null, (y + 1)); }), (2 * x)); }; - - - - - - - - - - - - return flows.spray([function __1(_) { if (!_) { return __future(__1, arguments, 0); } ; return testContext(_, 3); },function __2(_) { if (!_) { return __future(__2, arguments, 0); } ; return testContext(_, 5); },]).collectAll(__cb(_, function(__0, __3) { result = __3; - deepEqual(result, [7,11,]); - start(); _(); }));}); \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/test/common/flows-test_.js b/lib/adapters/neo4j-lib/node_modules/streamline/test/common/flows-test_.js deleted file mode 100644 index c2f328c2..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/test/common/flows-test_.js +++ /dev/null @@ -1,158 +0,0 @@ -//streamline.options = { "tryCatch" : "fast", "lines" : "preserve" } -var module = QUnit.module; -var flows = require("streamline/lib/util/flows"); - -function delay(_, val) { - flows.nextTick(_); - return val; -} - -function delayFail(_, err) { - flows.nextTick(_); - throw err; -} - -module("flows"); - -asyncTest("each", 1, function(_) { - var result = 1; - flows.each(_, [1, 2, 3, 4], function(_, val) { - result = result * delay(_, val); - }) - strictEqual(result, 24); - start(); -}) -asyncTest("map", 1, function(_) { - var result = flows.map(_, [1, 2, 3, 4], function(_, val) { - return 2 * delay(_, val); - }); - deepEqual(result, [2, 4, 6, 8]); - start(); -}) -asyncTest("filter", 1, function(_) { - var result = flows.filter(_, [1, 2, 3, 4], function(_, val) { - return delay(_, val) % 2; - }); - deepEqual(result, [1, 3]); - start(); -}) -asyncTest("every", 1, function(_) { - var result = flows.every(_, [1, 2, 3, 4], function(_, val) { - return delay(_, val) < 5; - }); - strictEqual(result, true); - start(); -}); -asyncTest("every", 1, function(_) { - var result = flows.every(_, [1, 2, 3, 4], function(_, val) { - return delay(_, val) < 3; - }); - strictEqual(result, false); - start(); -}); -asyncTest("some", 1, function(_) { - var result = flows.some(_, [1, 2, 3, 4], function(_, val) { - return delay(_, val) < 3; - }); - strictEqual(result, true); - start(); -}); -asyncTest("some", 1, function(_) { - var result = flows.some(_, [1, 2, 3, 4], function(_, val) { - return delay(_, val) < 0; - }); - strictEqual(result, false); - start(); -}); -asyncTest("reduce", 1, function(_) { - var result = flows.reduce(_, [1, 2, 3, 4], function(_, v, val) { - return v * delay(_, val); - }, 1); - strictEqual(result, 24); - start(); -}); -asyncTest("reduceRight", 1, function(_) { - var result = flows.reduceRight(_, [1, 2, 3, 4], function(_, v, val) { - return v * delay(_, val); - }, 1); - strictEqual(result, 24); - start(); -}); -asyncTest("collectAll", 1, function(_) { - var total = 0; - var peak = 0; - var count = 0; - function doIt(i) { - return function(_) { - count++; - peak = Math.max(count, peak); - total += delay(_, i); - count--; - return 2 * i; - } - } - - var results = flows.spray([doIt(1), doIt(2), doIt(3)]).collectAll(_); - deepEqual([total, peak, count, results], [6, 3, 0, [2, 4, 6]]); - start(); -}) -asyncTest("collectOne", 1, function(_) { - var total = 0; - var peak = 0; - var count = 0; - function doIt(i) { - return function(_) { - count++; - peak = Math.max(count, peak); - total += delay(_, i); - count--; - return 2 * i; - } - } - - var result = flows.spray([doIt(1), doIt(2), doIt(3)]).collectOne(_); - deepEqual([total, peak, count, result], [1, 3, 2, 2]); - start(); -}) -asyncTest("collectAll with limit", 1, function(_) { - var total = 0; - var peak = 0; - var count = 0; - function doIt(i) { - return function(_) { - count++; - peak = Math.max(count, peak); - total += delay(_, i); - count--; - return 2 * i; - } - } - - var results = flows.spray([doIt(1), doIt(2), doIt(3)], 2).collectAll(_); - deepEqual([total, peak, count, results], [6, 2, 0, [2, 4, 6]]); - start(); -}) -asyncTest("contexts", 3, function(_) { - function testContext(_, x) { - flows.setContext({ - val: x - }); - var y = delay(_, 2 * x); - strictEqual(y, 2 * flows.getContext().val); - return y + 1; - } - - var result = flows.spray([ - function(_) { - return testContext(_, 3); - }, - - function(_) { - return testContext(_, 5); - } - - ]).collectAll(_); - deepEqual(result, [7, 11]); - start(); -}) - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/test/common/transform-test.html b/lib/adapters/neo4j-lib/node_modules/streamline/test/common/transform-test.html deleted file mode 100644 index 5547fde2..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/test/common/transform-test.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - -

    streamline transform tests

    -

    -

    -
      - - - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/test/common/transform-test.js b/lib/adapters/neo4j-lib/node_modules/streamline/test/common/transform-test.js deleted file mode 100644 index 8ae7d3c7..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/test/common/transform-test.js +++ /dev/null @@ -1,1562 +0,0 @@ -var module = QUnit.module; -var transform = require('streamline/lib/compiler/transform').transform; - -module("streamline generation"); - -function clean(s){ - if (typeof jQuery === "function" && jQuery.browser.mozilla) - return new Function(s).toString(); - else - return s.replace(/[\n\t ]/g, '').replace(/};/g, '}').replace(/=\(_\|\|__trap\)/g, '=_||__trap'); -} - -function genTest(f1, f2, pedantic){ - var s1 = clean(transform(f1.toString(), { - noHelpers: true, - lines: "ignore", - tryCatch: pedantic ? "pedantic" : "safe" - })); - var s2 = clean(f2.toString()); - if (s1 !== s2) { - console.log("transformed=" + s1); - console.log("expected =" + s2); - } - strictEqual(s1, s2); -} - -test("basic", 1, function(){ - genTest(function f(_){ - f1(_); - f2(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - return f1(__cb(_, function(){ - f2(); - _(); - })); - }); -}); -test("basic with try/catch", 1, function(){ - genTest(function f(_){ - f1(_); - f2(); - }, function f(_){ - if (!_) { - return __future.call(this, f, arguments, 0); - } - _ = __wrapIn(_); - try { - return f1(__cb(_, function(){ - f2(); - _(); - })); - } - catch (e) { - return __propagate(_, e); - } - }, true); -}); -test("var return", 1, function(){ - genTest(function f(_){ - var x = f1(_); - f2(); - return x; - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - var x; - return f1(__cb(_, function(__0, __1){ - x = __1; - f2(); - return _(null, x); - })); - }); -}); -test("return", 1, function(){ - genTest(function f(_){ - f1(); - return f2(_); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return f2(_); - }); -}); -test("if", 1, function(){ - genTest(function f(_, b){ - f1(); - if (b) { - f2(); - f3(_); - f4(); - } - f5(); - }, function f(_, b){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return (function(__then){ - if (b) { - f2(); - return f3(__cb(_, function(){ - f4(); - __then(); - })); - } - else { - __then(); - } - })(function(){ - f5(); - _(); - }); - }); -}); -test("simplified if", 1, function(){ - genTest(function f(_, b){ - f1(); - if (b) { - f2(); - f3(_); - f4(); - } - }, function f(_, b){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return (function(__then){ - if (b) { - f2(); - return f3(__cb(_, function(){ - f4(); - __then(); - })); - } - else { - __then(); - } - })(_); - }); -}); -test("if else", 1, function(){ - genTest(function f(_, b){ - f1(); - if (b) { - f2(); - f3(_); - f4(); - } - else { - f5(); - f6(_); - f7(); - } - f8(); - }, function f(_, b){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return (function(__then){ - if (b) { - f2(); - return f3(__cb(_, function(){ - f4(); - __then(); - })); - } - else { - f5(); - return f6(__cb(_, function(){ - f7(); - __then(); - })); - } - })(function(){ - f8(); - _(); - }); - }); -}); -test("if else 2", 1, function(){ - genTest(function f(_, b){ - f1(); - if (b) { - f2(); - f3(_); - f4(); - return 1; - } - else { - f5(); - } - f6(); - return 2; - }, function f(_, b){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return (function(__then){ - if (b) { - f2(); - return f3(__cb(_, function(){ - f4(); - return _(null, 1); - })); - } - else { - f5(); - __then(); - } - })(function(){ - f6(); - return _(null, 2); - }); - }); -}); -test("each", 1, function(){ - genTest(function f(_, arr){ - f1(); - each(_, arr, function(_, elt){ - f2(_, elt); - f3(); - }) - f4(); - }, function f(_, arr){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return each(__cb(_, function(){ - f4(); - _(); - }), arr, function __1(_, elt){ - if (!_) { - return __future(__1, arguments, 0); - } - return f2(__cb(_, function(){ - f3(); - _(); - }), elt); - }); - }); -}); -test("while", 1, function(){ - genTest(function f(_){ - f1(); - while (cond) { - f2(_); - f3(); - } - f4(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return (function(__break){ - var __loop = __nt(_, function(){ - var __1 = cond; - if (__1) { - return f2(__cb(_, function(){ - f3(); - __loop(); - })); - } - else { - __break(); - } - }); - __loop(); - })(function(){ - f4(); - _(); - }); - }); -}); -test("do while", 1, function(){ - genTest(function f(_){ - f1(); - do { - f2(_); - f3(); - } - while (cond); - f4(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - var __1 = true; - return (function(__break){ - var __loop = __nt(_, function(){ - var __2 = (__1 || cond); - if (__2) { - __1 = false; - return f2(__cb(_, function(){ - f3(); - __loop(); - })); - } - else { - __break(); - } - }); - __loop(); - })(function(){ - f4(); - _(); - }); - }); -}); -test("for", 1, function(){ - genTest(function f(_, arr){ - f1(); - for (var i = 0; i < arr.length; i++) { - f2(_); - f3(); - } - f4(); - }, function f(_, arr){ - if (!_) { - return __future(f, arguments, 0); - } - var i; - f1(); - i = 0; - var __2 = false; - return (function(__break){ - var __loop = __nt(_, function(){ - if (__2) { - i++; - } - else { - __2 = true; - } - var __1 = (i < arr.length); - if (__1) { - return f2(__cb(_, function(){ - f3(); - __loop(); - })); - } - else { - __break(); - } - }); - __loop(); - })(function(){ - f4(); - _(); - }); - }) -}) -test("for in", 1, function(){ - genTest(function f(_){ - f1(); - for (var k in obj) { - f2(_, k); - f3(k); - } - f4(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - var k; - f1(); - var __1 = __forIn(obj); - var __2 = 0; - return (function(__break){ - var __loop = __nt(_, function(){ - var __3 = (__2 < __1.length); - if (__3) { - k = __1[__2++]; - return f2(__cb(_, function(){ - f3(k); - __loop(); - }), k); - } - else { - __break(); - } - }); - __loop(); - })(function(){ - f4(); - _(); - }); - }); -}) -test("for in (without var)", 1, function(){ - genTest(function f(_){ - var k; - f1(); - for (k in obj) { - f2(_, k); - f3(k); - } - f4(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - var k; - f1(); - var __1 = __forIn(obj); - var __2 = 0; - return (function(__break){ - var __loop = __nt(_, function(){ - var __3 = (__2 < __1.length); - if (__3) { - k = __1[__2++]; - return f2(__cb(_, function(){ - f3(k); - __loop(); - }), k); - } - else { - __break(); - } - }); - __loop(); - })(function(){ - f4(); - _(); - }); - }); -}) -test("switch", 1, function(){ - genTest(function f(_){ - f1(); - switch (exp) { - case 'a': - f2(_); - f3(); - break; - case 'b': - case 'c': - f4(); - f5(_); - break; - default: - f6(); - break; - } - f7(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return (function(__break){ - switch (exp) { - case "a": - return f2(__cb(_, function(){ - f3(); - return __break(); - })); - case "b": - case "c": - f4(); - return f5(__cb(_, __break)); - default: - f6(); - return __break(); - } - })(function(){ - f7(); - _(); - }); - }); -}) -test("nested switch", 1, function(){ - genTest(function f(_){ - switch (exp) { - case 'a': - f2(_); - switch (exp2) { - case "b": - break; - } - break; - } - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - return (function(__break){ - switch (exp) { - case "a": - return f2(__cb(_, function(){ - switch (exp2) { - case "b": - break; - } - return __break(); - })); - default: - return __break(); - } - })(_); - }); -}) -test("nested calls", 1, function(){ - genTest(function f(_){ - f1(); - f2(_, f3(_, f4(_)), f5(_, f6())); - f7(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return f4(__cb(_, function(__0, __1){ - return f3(__cb(_, function(__0, __2){ - return f5(__cb(_, function(__0, __3){ - return f2(__cb(_, function(){ - f7(); - _(); - }), __2, __3); - }), f6()); - }), __1); - })); - }); -}) -test("async while condition", 1, function(){ - genTest(function f(_){ - f1(); - while (f2(_)) - f3(); - f4(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return (function(__break){ - var __loop = __nt(_, function(){ - return f2(__cb(_, function(__0, __1){ - if (__1) { - f3(); - __loop(); - } - else { - __break(); - } - })); - }); - __loop(); - })(function(){ - f4(); - _(); - }); - }) -}) -test("try catch", 1, function(){ - genTest(function f(_){ - f1(); - try { - f2(); - f3(_); - f4(); - } - catch (ex) { - f5(); - f6(_); - f7(); - } - f8(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return (function(__then){ - (function(_){ - __tryCatch(_, function(){ - f2(); - return f3(__cb(_, function(){ - f4(); - __then(); - })); - }); - - })(function(ex, __result){ - __tryCatch(_, function(){ - if (ex) { - f5(); - return f6(__cb(_, function(){ - f7(); - __then(); - })); - } - else { - _(null, __result); - } - }); - }); - })(function(){ - __tryCatch(_, function(){ - f8(); - _(); - }); - }); - }); -}) -test("try finally", 1, function(){ - genTest(function f(_){ - f1(); - try { - f2(); - f3(_); - f4(); - } - finally { - f5(); - f6(_); - f7(); - } - f8(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return (function(__then){ - (function(_){ - __tryCatch(_, function(){ - f2(); - return f3(__cb(_, function(){ - f4(); - _(null, null, true); - })); - }); - })(function(__e, __r, __cont){ - (function(__then){ - __tryCatch(_, function(){ - f5(); - return f6(__cb(_, function(){ - f7(); - __then(); - })); - }); - })(function(){ - __tryCatch(_, function(){ - if (__cont) { - __then(); - } - else { - _(__e, __r); - } - }); - }); - }); - })(function(){ - __tryCatch(_, function(){ - f8(); - _(); - }); - }); - }) -}) -test("lazy and", 1, function(){ - // Note: __future is overkill in inner as _ cannot be null - fix later - genTest(function f(_){ - f1(); - if (f2(_) && f3(_)) { - f4(); - f5(_); - f6() - } - f7(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - f1(); - return (function(_){ - return f2(__cb(_, function(__0, __1){ - var __2 = !__1; - return (function(__then){ - if (__2) { - var __3 = __1; - return _(null, __3); - } - else { - __then(); - } - })(function(){ - return f3(_); - }); - })); - })(__cb(_, function(__0, __2){ - return (function(__then){ - if (__2) { - f4(); - return f5(__cb(_, function(){ - f6(); - __then(); - })); - } - else { - __then(); - } - })(function(){ - f7(); - _(); - }); - })); - }) -}) -test("empty body", 1, function(){ - genTest(function f(_){ - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - _(); - }) -}) -test("only return in body", 1, function(){ - genTest(function f(_){ - return 4; - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - return _(null, 4); - }) -}) -test("optim pass _", 1, function(){ - genTest(function f(_, arg1){ - return g(_, arg2); - }, function f(_, arg1){ - if (!_) { - return __future(f, arguments, 0); - } - return g(_, arg2); - }) -}) -test("out wrappers", 1, function(){ - genTest(function f(_, arg1){ - return g(__wrapOut(_), arg2) + 5; - }, function f(_, arg1){ - if (!_) { - return __future(f, arguments, 0); - } - return g(__wrapOut(__cb(_, function(__0, __2){ - var __1 = (__2 + 5); - return _(null, __1); - })), arg2); - }) -}) -test("scoping", 1, function(){ - genTest(function f(_){ - g(_); - if (x) { - var a1, a2, a3, b1 = 1, b2 = 2, b3 = 3; - var c1, c2; - a1 = 1; - a2 = 2; - } - else { - var a2 = 2; - b2++; - c1 = 1; - } - a3++; - b3++; - c2 = 2; - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - var a1, a2, a3, b1, b2, b3, c1, c2; - return g(__cb(_, function(){ - if (x) { - b1 = 1; - b2 = 2; - b3 = 3; - a1 = 1; - a2 = 2; - } - else { - a2 = 2; - b2++; - c1 = 1; - } - a3++; - b3++; - c2 = 2; - _(); - })); - }) -}) -test("sync code not modified", 1, function(){ - genTest(function f(){ - g(); - if (x) { - var a1, a2, a3, b1 = 1, b2 = 2, b3 = 3; - var c1, c2; - a1 = 1; - a2 = 2; - } - else { - var a2 = 2; - b2++; - c1 = 1; - } - a3++; - b3++; - c2 = 2; - }, function f(){ - g(); - if (x) { - var a1, a2, a3, b1 = 1, b2 = 2, b3 = 3; - var c1, c2; - a1 = 1; - a2 = 2; - } - else { - var a2 = 2; - b2++; - c1 = 1; - } - a3++; - b3++; - c2 = 2; - }) -}) -test("function forward reference", 1, function(){ - genTest(function f(_){ - foo(); - g(_); - function foo(){ - }; - - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - } - function foo(){ - } - - foo(); - return g(_); - }) -}) -test("CoffeeScript closure ()", 1, function(){ - genTest(function f(_){ - (function(){ - return g(_); - })(); - }, function f(_){ - if (!_) { - return __future(f, arguments, 0); - }; - return (function __1(_){ - return g(_); - })(_); - }) -}) -test("CoffeeScript closure (this)", 1, function(){ - genTest(function f(_){ - (function(){ - return g(_, this); - }).call(this); - }, function f(_){ - if (!_) { - return __future.call(this, f, arguments, 0); - }; - var __this = this; - return (function __1(_){ - return g(_, __this); - })(_); - }) -}) -test("CoffeeScript closure (this, arguments)", 1, function(){ - genTest(function f(_){ - (function(){ - return g(_, this, arguments); - }).apply(this, arguments); - }, function f(_){ - if (!_) { - return __future.call(this, f, arguments, 0); - }; - var __this = this, __arguments = arguments; - return (function __1(_){ - return g(_, __this, __arguments); - })(_); - }) -}) -module("streamline evaluation"); -function evalTest1(f, val, options, next){ - var str = transform(f.toString(), options); - (function(){ - eval(str); - f(function(err, result){ - var str = err ? "ERR: " + err : result; - strictEqual(str, val); - next(); - }) - })(); -} - -function evalTest(f, val){ - delay = delayUnsafe; - evalTest1(f, val, { - tryCatch: "safe" - }, function(){ - delay = delaySafe; - evalTest1(f, val, { - tryCatch: "fast" - }, start) - }) -} - -function delayUnsafe(_, val){ - setTimeout(function(){ - _(null, val); - }, 0); -} - -function delaySafe(_, val){ - setTimeout(function(){ - try { - _(null, val); - } - catch (ex) { - _(ex) - } - }, 0); -} - -var delay; - -function delayFail(_, err){ - setTimeout(function(){ - _(err); - }, 0); -} - -function throwError(message){ - throw new Error(message); -} - -asyncTest("eval return", 2, function(){ - evalTest(function f(_){ - return delay(_, 5); - }, 5); -}) -asyncTest("eval if true", 2, function(){ - evalTest(function f(_){ - if (true) - return delay(_, 3); - return 4; - }, 3); -}) -asyncTest("eval if false", 2, function(){ - evalTest(function f(_){ - if (false) - return delay(_, 3); - return 4; - }, 4); -}) -asyncTest("eval while", 2, function(){ - evalTest(function f(_){ - var i = 1, result = 1; - while (i < 5) { - result = delay(_, i * result); - i++; - } - return result; - }, 24); -}) -asyncTest("eval for", 2, function(){ - evalTest(function f(_){ - var result = 1; - for (var i = 1; i < 5; i++) { - result = delay(_, i) * delay(_, result); - } - return result; - }, 24); -}) -asyncTest("eval for in", 2, function(){ - evalTest(function f(_){ - var foo = { - a: 1, - b: 2, - c: 3, - d: 5 - } - var result = 1; - for (var k in foo) { - result = delay(_, foo[delay(_, k)]) * delay(_, result); - } - return result; - }, 30); -}) -asyncTest("fully async for in", 2, function(){ - evalTest(function f(_){ - var result = 1; - for (var i = delay(_, 2); i < delay(_, 5); i = delay(_, i) + 1) { - result = delay(_, result) * delay(_, i) - } - return result; - }, 24); -}) -asyncTest("break in loop", 2, function(){ - evalTest(function f(_){ - var result = 1; - for (var i = 1; i < 10; i++) { - if (i == 5) - break; - result = delay(_, result) * delay(_, i) - } - return result; - }, 24); -}) -asyncTest("continue", 2, function(){ - evalTest(function f(_){ - var result = 1; - for (var i = 1; i < 10; i++) { - if (i >= 5) - continue; - result = delay(_, result) * delay(_, i) - } - return result; - }, 24); -}) -asyncTest("break in while", 2, function(){ - evalTest(function f(_){ - var i = 1, result = 1; - while (i < 10) { - if (i == 5) - break; - result = delay(_, result) * delay(_, i); - i++; - } - return result; - }, 24); -}) -asyncTest("continue in while", 2, function(){ - evalTest(function f(_){ - var i = 1, result = 1; - while (i < 10) { - i++; - if (i >= 5) - continue; - result = delay(_, result) * delay(_, i); - } - return result; - }, 24); -}) -asyncTest("eval lazy", 2, function(){ - evalTest(function f(_){ - var result = 1; - return delay(_, delay(_, result + 8) < 5) && true ? 2 : 4 - }, 4); -}) -asyncTest("eval lazy full async", 2, function(){ - evalTest(function f(_){ - var result = 1; - return delay(_, delay(_, result + 8) < 5) && true ? delay(_, 2) : delay(_, 4) - }, 4); -}) -asyncTest("try catch 1", 2, function(){ - evalTest(function f(_){ - try { - return delay(_, "ok"); - } - catch (ex) { - return delay(_, "err"); - } - }, "ok"); -}) -asyncTest("try catch 2", 2, function(){ - evalTest(function f(_){ - try { - throw delay(_, "thrown"); - } - catch (ex) { - return delay(_, "caught ") + ex; - } - }, "caught thrown"); -}) -asyncTest("try catch 3", 2, function(){ - evalTest(function f(_){ - try { - throw delay(_, "thrown"); - } - catch (ex) { - return delay(_, "caught ") + ex; - } - }, "caught thrown"); -}) -asyncTest("try catch 5", 2, function(){ - evalTest(function f(_){ - try { - delayFail(_, "delay fail"); - } - catch (ex) { - return delay(_, "caught ") + ex; - } - }, "caught delay fail"); -}) -asyncTest("try catch 6", 2, function(){ - evalTest(function f(_){ - try { - throwError("direct") - return delay(_, "ok") - } - catch (ex) { - return delay(_, "caught ") + ex.message; - } - }, "caught direct"); -}) -asyncTest("try catch 7", 2, function(){ - evalTest(function f(_){ - try { - var message = delay(_, "indirect"); - throwError(message) - return delay(_, "ok") - } - catch (ex) { - return delay(_, "caught ") + ex.message; - } - }, "caught indirect"); -}) -asyncTest("try finally 1", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - x += delay(_, "try") - } - finally { - x += delay(_, " finally"); - } - x += " end" - return x; - }, "try finally end"); -}) -asyncTest("try finally 2", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - x += delay(_, "try") - return x; - } - finally { - x += delay(_, " finally"); - } - x += " end" - return x; - }, "try"); -}) -asyncTest("try finally 3", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - x += delay(_, "try") - throw "bad try"; - } - finally { - x += delay(_, " finally"); - } - x += " end" - return x; - }, "ERR: bad try"); -}) -asyncTest("try finally 4", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - x += delay(_, "try") - throwError("except"); - } - finally { - x += delay(_, " finally"); - } - x += " end" - return x; - }, "ERR: Error: except"); -}) -asyncTest("try finally 5", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - try { - x += delay(_, "try") - throwError("except"); - x += " unreached" - } - finally { - x += delay(_, " finally"); - } - x += " end" - return x; - } - catch (ex) { - return x + "/" + ex.message; - } - }, "try finally/except"); -}) -asyncTest("try catch finally 1", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - try { - x += delay(_, "try") - throw new Error("except"); - x += " unreached" - } - catch (ex) { - x += delay(_, " catch " + ex.message); - throw ex; - } - finally { - x += delay(_, " finally"); - } - x += " end" - return x; - } - catch (ex) { - return x + "/" + ex.message; - } - }, "try catch except finally/except"); -}) -asyncTest("try catch finally 2", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - try { - x += delay(_, "try") - throwError("except"); - x += " unreached" - } - catch (ex) { - x += " catch " + ex.message; - throw ex; - } - finally { - x += " finally"; - } - x += " end" - return x; - } - catch (ex) { - return x + "/" + ex.message; - } - }, "try catch except finally/except"); -}) -asyncTest("nested try/catch 1", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - try { - x += delay(_, "try") - } - catch (ex) { - x += delay(_, " inner catch " + ex.message); - } - throwError(" except"); - } - catch (ex) { - return x + " outer catch" + ex.message; - } - }, "try outer catch except"); -}) -asyncTest("nested try/catch 2", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - try { - x += delay(_, "try") - } - catch (ex) { - x += " inner catch " + ex.message; - } - throw new Error(" except"); - } - catch (ex) { - return x + " outer catch" + ex.message; - } - }, "try outer catch except"); -}) -asyncTest("nested try/catch 3", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - try { - x += delay(_, "try") - } - catch (ex) { - x += delay(_, " inner catch " + ex.message); - } - throw new Error(" except"); - } - catch (ex) { - return x + " outer catch" + ex.message; - } - }, "try outer catch except"); -}) -asyncTest("nested try/finally 1", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - try { - x += delay(_, "try") - } - finally { - x += delay(_, " inner finally"); - } - throwError(" except"); - } - catch (ex) { - return x + " outer catch" + ex.message; - } - }, "try inner finally outer catch except"); -}) -asyncTest("nested try/finally 2", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - try { - x += delay(_, "try") - } - finally { - x += " inner finally"; - } - throwError(" except"); - } - catch (ex) { - return x + " outer catch" + ex.message; - } - }, "try inner finally outer catch except"); -}) -asyncTest("nested try/finally 3", 2, function(){ - evalTest(function f(_){ - var x = ""; - try { - try { - x += delay(_, "try") - } - finally { - x += delay(_, " inner finally"); - } - throw new Error(" except"); - } - catch (ex) { - return x + " outer catch" + ex.message; - } - }, "try inner finally outer catch except"); -}) -asyncTest("and ok", 2, function(){ - evalTest(function f(_){ - var x = "<<"; - if (delay(_, true) && delay(_, true)) - x += "T1"; - else - x += "F1" - if (delay(_, true) && delay(_, false)) - x += "T2"; - else - x += "F2" - if (delay(_, false) && delay(_, true)) - x += "T3"; - else - x += "F3" - if (delay(_, false) && delay(_, false)) - x += "T4"; - else - x += "F4" - if (delay(_, false) && delayFail(_, "bad")) - x += "T5"; - else - x += "F5" - x += ">>"; - return x; - }, "<>"); -}) -asyncTest("or ok", 2, function(){ - evalTest(function f(_){ - var x = "<<"; - if (delay(_, true) || delay(_, true)) - x += "T1"; - else - x += "F1" - if (delay(_, true) || delay(_, false)) - x += "T2"; - else - x += "F2" - if (delay(_, false) || delay(_, true)) - x += "T3"; - else - x += "F3" - if (delay(_, false) || delay(_, false)) - x += "T4"; - else - x += "F4" - if (delay(_, true) || delayFail(_, "bad")) - x += "T5"; - else - x += "F5" - x += ">>"; - return x; - }, "<>"); -}) -asyncTest("switch with default", 2, function(){ - evalTest(function f(_){ - function g(_, i){ - var result = "a" - switch (delay(_, i)) { - case 1: - result = delay(_, "b"); - break; - case 2: - return delay(_, "c"); - case 3: - case 4: - result = delay(_, "d"); - break; - default: - result = delay(_, "e"); - } - return result; - } - - return g(_, 0) + g(_, 1) + g(_, 2) + g(_, 3) + g(_, 4) + g(_, 5); - }, "ebcdde"); -}) -asyncTest("switch without default", 2, function(){ - evalTest(function f(_){ - function g(_, i){ - var result = "a" - switch (delay(_, i)) { - case 1: - result = "b"; - break; - case 2: - return "c"; - case 3: - case 4: - result = "d"; - break; - } - return result; - } - - return g(_, 0) + g(_, 1) + g(_, 2) + g(_, 3) + g(_, 4) + g(_, 5); - }, "abcdda"); -}) -asyncTest("this", 10, function(){ - evalTest(function f(_){ - function O(x){ - this.x = x; - } - - O.prototype.test1 = function(_){ - var self = this; - this.x = delay(_, this.x + 1); - strictEqual(this, self); - } - O.prototype.test2 = function(_){ - var self = this; - try { - this.x = delay(_, this.x + 1); - strictEqual(this, self); - } - catch (ex) { - ok(false); - } - } - O.prototype.test3 = function(_){ - var self = this; - try { - this.x = delay(_, this.x + 1); - throwError("test3"); - ok(false); - } - catch (ex) { - strictEqual(this, self); - this.x = delay(_, this.x + 1); - } - } - function delay2(val, _){ - return delay(_, val); - } - - O.prototype.test4 = function(_){ - var self = this; - v1 = delay2(this.x + 1); - v2 = delay2(1); - this.x = v1(_) + v2(_); - strictEqual(this, self); - } - var o = new O(1); - o.test1(_); - o.test2(_); - o.test3(_); - o.test4(_); - return o.x; - }, 7); -}) -asyncTest("scoping", 2, function(){ - evalTest(function f(_){ - function test(_){ - var foo = "abc"; - function bar(){ - return foo; - } - - delay(_); - var foo = "xyz"; - return bar; - } - - return test(_)(); - }, "xyz"); -}) -asyncTest("return undefined", 2, function(){ - evalTest(function f(_){ - function test(_){ - delay(_); - return; - } - - return test(_); - }, undefined); -}) -asyncTest("futures test", 2, function(){ - evalTest(function f(_){ - function delay2(val, _){ - return delay(_, val); - } - - var a = delay2('a'); - var b = delay2('b'); - var c = delay2('c'); - var d = delay2('d'); - return a(_) + b(_) + d(_) + c(_); - }, "abdc"); -}) -asyncTest("last case without break", 2, function(){ - evalTest(function f(_){ - switch (true) { - case true: - delay(_); - } - return 1; - }, 1); -}) - diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/test/qunit/jquery.js b/lib/adapters/neo4j-lib/node_modules/streamline/test/qunit/jquery.js deleted file mode 100644 index 7c243080..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/test/qunit/jquery.js +++ /dev/null @@ -1,154 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.2 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Sat Feb 13 22:33:48 2010 -0500 - */ -(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, -Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& -(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, -a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== -"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, -function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
      a"; -var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, -parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= -false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= -s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, -applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; -else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, -a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== -w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, -cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= -c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); -a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, -function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); -k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), -C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= -e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& -f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; -if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", -e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, -"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, -d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, -e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); -t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| -g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, -CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, -g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, -text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, -setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= -h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== -"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, -h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& -q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; -if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

      ";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); -(function(){var g=s.createElement("div");g.innerHTML="
      ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: -function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= -{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== -"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", -d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? -a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== -1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
      ","
      "],thead:[1,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],col:[2,"","
      "],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
      ","
      "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= -c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, -wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, -prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, -this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); -return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, -""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); -return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", -""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= -c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? -c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= -function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= -Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, -"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= -a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= -a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== -"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
      ").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, -serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), -function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, -global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& -e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? -"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== -false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= -false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", -c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| -d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); -g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== -1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== -"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; -if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== -"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| -c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; -this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= -this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, -e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
      "; -a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); -c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, -d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- -f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": -"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in -e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/test/qunit/qunit.css b/lib/adapters/neo4j-lib/node_modules/streamline/test/qunit/qunit.css deleted file mode 100644 index 5714bf4a..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/test/qunit/qunit.css +++ /dev/null @@ -1,119 +0,0 @@ - -ol#qunit-tests { - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - margin:0; - padding:0; - list-style-position:inside; - - font-size: smaller; -} -ol#qunit-tests li{ - padding:0.4em 0.5em 0.4em 2.5em; - border-bottom:1px solid #fff; - font-size:small; - list-style-position:inside; -} -ol#qunit-tests li ol{ - box-shadow: inset 0px 2px 13px #999; - -moz-box-shadow: inset 0px 2px 13px #999; - -webkit-box-shadow: inset 0px 2px 13px #999; - margin-top:0.5em; - margin-left:0; - padding:0.5em; - background-color:#fff; - border-radius:15px; - -moz-border-radius: 15px; - -webkit-border-radius: 15px; -} -ol#qunit-tests li li{ - border-bottom:none; - margin:0.5em; - background-color:#fff; - list-style-position: inside; - padding:0.4em 0.5em 0.4em 0.5em; -} - -ol#qunit-tests li li.pass{ - border-left:26px solid #C6E746; - background-color:#fff; - color:#5E740B; - } -ol#qunit-tests li li.fail{ - border-left:26px solid #EE5757; - background-color:#fff; - color:#710909; -} -ol#qunit-tests li.pass{ - background-color:#D2E0E6; - color:#528CE0; -} -ol#qunit-tests li.fail{ - background-color:#EE5757; - color:#000; -} -ol#qunit-tests li strong { - cursor:pointer; -} -h1#qunit-header{ - background-color:#0d3349; - margin:0; - padding:0.5em 0 0.5em 1em; - color:#fff; - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - border-top-right-radius:15px; - border-top-left-radius:15px; - -moz-border-radius-topright:15px; - -moz-border-radius-topleft:15px; - -webkit-border-top-right-radius:15px; - -webkit-border-top-left-radius:15px; - text-shadow: rgba(0, 0, 0, 0.5) 4px 4px 1px; -} -h2#qunit-banner{ - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - height:5px; - margin:0; - padding:0; -} -h2#qunit-banner.qunit-pass{ - background-color:#C6E746; -} -h2#qunit-banner.qunit-fail, #qunit-testrunner-toolbar { - background-color:#EE5757; -} -#qunit-testrunner-toolbar { - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - padding:0; - /*width:80%;*/ - padding:0em 0 0.5em 2em; - font-size: small; -} -h2#qunit-userAgent { - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - background-color:#2b81af; - margin:0; - padding:0; - color:#fff; - font-size: small; - padding:0.5em 0 0.5em 2.5em; - text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; -} -p#qunit-testresult{ - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - margin:0; - font-size: small; - color:#2b81af; - border-bottom-right-radius:15px; - border-bottom-left-radius:15px; - -moz-border-radius-bottomright:15px; - -moz-border-radius-bottomleft:15px; - -webkit-border-bottom-right-radius:15px; - -webkit-border-bottom-left-radius:15px; - background-color:#D2E0E6; - padding:0.5em 0.5em 0.5em 2.5em; -} -strong b.fail{ - color:#710909; - } -strong b.pass{ - color:#5E740B; - } diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/test/qunit/qunit.js b/lib/adapters/neo4j-lib/node_modules/streamline/test/qunit/qunit.js deleted file mode 100644 index 5007582f..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/test/qunit/qunit.js +++ /dev/null @@ -1,1073 +0,0 @@ -/* - * QUnit - A JavaScript Unit Testing Framework - * - * http://docs.jquery.com/QUnit - * - * Copyright (c) 2009 John Resig, Jörn Zaefferer - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - */ - -(function(window) { - -var QUnit = { - - // Initialize the configuration options - init: function() { - config = { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date, - updateRate: 1000, - blocking: false, - autorun: false, - assertions: [], - filters: [], - queue: [] - }; - - var tests = id("qunit-tests"), - banner = id("qunit-banner"), - result = id("qunit-testresult"); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - }, - - // call on start of module test to prepend name to all tests - module: function(name, testEnvironment) { - config.currentModule = name; - - synchronize(function() { - if ( config.currentModule ) { - QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all ); - } - - config.currentModule = name; - config.moduleTestEnvironment = testEnvironment; - config.moduleStats = { all: 0, bad: 0 }; - - QUnit.moduleStart( name, testEnvironment ); - }); - }, - - asyncTest: function(testName, expected, callback) { - if ( arguments.length === 2 ) { - callback = expected; - expected = 0; - } - - QUnit.test(testName, expected, callback, true); - }, - - test: function(testName, expected, callback, async) { - var name = testName, testEnvironment, testEnvironmentArg; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - // is 2nd argument a testEnvironment? - if ( expected && typeof expected === 'object') { - testEnvironmentArg = expected; - expected = null; - } - - if ( config.currentModule ) { - name = config.currentModule + " module: " + name; - } - - if ( !validTest(name) ) { - return; - } - - synchronize(function() { - QUnit.testStart( testName ); - - testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, config.moduleTestEnvironment); - if (testEnvironmentArg) { - extend(testEnvironment,testEnvironmentArg); - } - - // allow utility functions to access the current test environment - QUnit.current_testEnvironment = testEnvironment; - - config.assertions = []; - config.expected = expected; - - try { - if ( !config.pollution ) { - saveGlobal(); - } - - testEnvironment.setup.call(testEnvironment); - } catch(e) { - QUnit.ok( false, "Setup failed on " + name + ": " + e.message ); - } - }); - - synchronize(function() { - if ( async ) { - QUnit.stop(); - } - - try { - callback.call(testEnvironment); - } catch(e) { - fail("Test " + name + " died, exception and test follows", e, callback); - QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - start(); - } - } - }); - - synchronize(function() { - try { - checkPollution(); - testEnvironment.teardown.call(testEnvironment); - } catch(e) { - QUnit.ok( false, "Teardown failed on " + name + ": " + e.message ); - } - }); - - synchronize(function() { - try { - QUnit.reset(); - } catch(e) { - fail("reset() failed, following Test " + name + ", exception and reset fn follows", e, reset); - } - - if ( config.expected && config.expected != config.assertions.length ) { - QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" ); - } - - var good = 0, bad = 0, - tests = id("qunit-tests"); - - config.stats.all += config.assertions.length; - config.moduleStats.all += config.assertions.length; - - if ( tests ) { - var ol = document.createElement("ol"); - ol.style.display = "none"; - - for ( var i = 0; i < config.assertions.length; i++ ) { - var assertion = config.assertions[i]; - - var li = document.createElement("li"); - li.className = assertion.result ? "pass" : "fail"; - li.appendChild(document.createTextNode(assertion.message || "(no message)")); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - var b = document.createElement("strong"); - b.innerHTML = name + " (" + bad + ", " + good + ", " + config.assertions.length + ")"; - - addEvent(b, "click", function() { - var next = b.nextSibling, display = next.style.display; - next.style.display = display === "none" ? "block" : "none"; - }); - - addEvent(b, "dblclick", function(e) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() === "strong" ) { - var text = "", node = target.firstChild; - - while ( node.nodeType === 3 ) { - text += node.nodeValue; - node = node.nextSibling; - } - - text = text.replace(/(^\s*|\s*$)/g, ""); - - if ( window.location ) { - window.location.href = window.location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent(text); - } - } - }); - - var li = document.createElement("li"); - li.className = bad ? "fail" : "pass"; - li.appendChild( b ); - li.appendChild( ol ); - tests.appendChild( li ); - - if ( bad ) { - var toolbar = id("qunit-testrunner-toolbar"); - if ( toolbar ) { - toolbar.style.display = "block"; - id("qunit-filter-pass").disabled = null; - id("qunit-filter-missing").disabled = null; - } - } - - } else { - for ( var i = 0; i < config.assertions.length; i++ ) { - if ( !config.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - QUnit.testDone( testName, bad, config.assertions.length ); - - if ( !window.setTimeout && !config.queue.length ) { - done(); - } - }); - - if ( window.setTimeout && !config.doneTimer ) { - config.doneTimer = window.setTimeout(function(){ - if ( !config.queue.length ) { - done(); - } else { - synchronize( done ); - } - }, 13); - } - }, - - /** - * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - */ - expect: function(asserts) { - config.expected = asserts; - }, - - /** - * Asserts true. - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function(a, msg) { - QUnit.log(a, msg); - - config.assertions.push({ - result: !!a, - message: msg - }); - }, - - /** - * Checks that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * - * Prefered to ok( actual == expected, message ) - * - * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." ); - * - * @param Object actual - * @param Object expected - * @param String message (optional) - */ - equal: function(actual, expected, message) { - push(expected == actual, actual, expected, message); - }, - - notEqual: function(actual, expected, message) { - push(expected != actual, actual, expected, message); - }, - - deepEqual: function(a, b, message) { - push(QUnit.equiv(a, b), a, b, message); - }, - - notDeepEqual: function(a, b, message) { - push(!QUnit.equiv(a, b), a, b, message); - }, - - strictEqual: function(actual, expected, message) { - push(expected === actual, actual, expected, message); - }, - - notStrictEqual: function(actual, expected, message) { - push(expected !== actual, actual, expected, message); - }, - - start: function() { - // A slight delay, to avoid any current callbacks - if ( window.setTimeout ) { - window.setTimeout(function() { - if ( config.timeout ) { - clearTimeout(config.timeout); - } - - config.blocking = false; - process(); - }, 13); - } else { - config.blocking = false; - process(); - } - }, - - stop: function(timeout) { - config.blocking = true; - - if ( timeout && window.setTimeout ) { - config.timeout = window.setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - QUnit.start(); - }, timeout); - } - }, - - /** - * Resets the test setup. Useful for tests that modify the DOM. - */ - reset: function() { - if ( window.jQuery ) { - jQuery("#main").html( config.fixture ); - jQuery.event.global = {}; - jQuery.ajaxSettings = extend({}, config.ajaxSettings); - } - }, - - /** - * Trigger an event on an element. - * - * @example triggerEvent( document.body, "click" ); - * - * @param DOMElement elem - * @param String type - */ - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent("MouseEvents"); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - elem.dispatchEvent( event ); - - } else if ( elem.fireEvent ) { - elem.fireEvent("on"+type); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return Object.prototype.toString.call( obj ) === "[object "+ type +"]"; - }, - - // Logging callbacks - done: function(failures, total) {}, - log: function(result, message) {}, - testStart: function(name) {}, - testDone: function(name, failures, total) {}, - moduleStart: function(name, testEnvironment) {}, - moduleDone: function(name, failures, total) {} -}; - -// Backwards compatibility, deprecated -QUnit.equals = QUnit.equal; -QUnit.same = QUnit.deepEqual; - -// Maintain internal state -var config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true -}; - -// Load paramaters -(function() { - var location = window.location || { search: "", protocol: "file:" }, - GETParams = location.search.slice(1).split('&'); - - for ( var i = 0; i < GETParams.length; i++ ) { - GETParams[i] = decodeURIComponent( GETParams[i] ); - if ( GETParams[i] === "noglobals" ) { - GETParams.splice( i, 1 ); - i--; - config.noglobals = true; - } else if ( GETParams[i].search('=') > -1 ) { - GETParams.splice( i, 1 ); - i--; - } - } - - // restrict modules/tests by get parameters - config.filters = GETParams; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = !!(location.protocol === 'file:'); -})(); - -// Expose the API as global variables, unless an 'exports' -// object exists, in that case we assume we're in CommonJS -if ( typeof exports === "undefined" || typeof require === "undefined" ) { - extend(window, QUnit); - window.QUnit = QUnit; -} else { - extend(exports, QUnit); - exports.QUnit = QUnit; -} - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -addEvent(window, "load", function() { - // Initialize the config, saving the execution queue - var oldconfig = extend({}, config); - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - var userAgent = id("qunit-userAgent"); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - - var toolbar = id("qunit-testrunner-toolbar"); - if ( toolbar ) { - toolbar.style.display = "none"; - - var filter = document.createElement("input"); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - filter.disabled = true; - addEvent( filter, "click", function() { - var li = document.getElementsByTagName("li"); - for ( var i = 0; i < li.length; i++ ) { - if ( li[i].className.indexOf("pass") > -1 ) { - li[i].style.display = filter.checked ? "none" : ""; - } - } - }); - toolbar.appendChild( filter ); - - var label = document.createElement("label"); - label.setAttribute("for", "qunit-filter-pass"); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - - var missing = document.createElement("input"); - missing.type = "checkbox"; - missing.id = "qunit-filter-missing"; - missing.disabled = true; - addEvent( missing, "click", function() { - var li = document.getElementsByTagName("li"); - for ( var i = 0; i < li.length; i++ ) { - if ( li[i].className.indexOf("fail") > -1 && li[i].innerHTML.indexOf('missing test - untested code is broken code') > - 1 ) { - li[i].parentNode.parentNode.style.display = missing.checked ? "none" : "block"; - } - } - }); - toolbar.appendChild( missing ); - - label = document.createElement("label"); - label.setAttribute("for", "qunit-filter-missing"); - label.innerHTML = "Hide missing tests (untested code is broken code)"; - toolbar.appendChild( label ); - } - - var main = id('main'); - if ( main ) { - config.fixture = main.innerHTML; - } - - if ( window.jQuery ) { - config.ajaxSettings = window.jQuery.ajaxSettings; - } - - QUnit.start(); -}); - -function done() { - if ( config.doneTimer && window.clearTimeout ) { - window.clearTimeout( config.doneTimer ); - config.doneTimer = null; - } - - if ( config.queue.length ) { - config.doneTimer = window.setTimeout(function(){ - if ( !config.queue.length ) { - done(); - } else { - synchronize( done ); - } - }, 13); - - return; - } - - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all ); - } - - var banner = id("qunit-banner"), - tests = id("qunit-tests"), - html = ['Tests completed in ', - +new Date - config.started, ' milliseconds.
      ', - '', config.stats.all - config.stats.bad, ' tests of ', config.stats.all, ' passed, ', config.stats.bad,' failed.'].join(''); - - if ( banner ) { - banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass"); - } - - if ( tests ) { - var result = id("qunit-testresult"); - - if ( !result ) { - result = document.createElement("p"); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests.nextSibling ); - } - - result.innerHTML = html; - } - - QUnit.done( config.stats.bad, config.stats.all ); -} - -function validTest( name ) { - var i = config.filters.length, - run = false; - - if ( !i ) { - return true; - } - - while ( i-- ) { - var filter = config.filters[i], - not = filter.charAt(0) == '!'; - - if ( not ) { - filter = filter.slice(1); - } - - if ( name.indexOf(filter) !== -1 ) { - return !not; - } - - if ( not ) { - run = true; - } - } - - return run; -} - -function push(result, actual, expected, message) { - message = message || (result ? "okay" : "failed"); - QUnit.ok( result, result ? message + ": " + QUnit.jsDump.parse(expected) : message + ", expected: " + QUnit.jsDump.parse(expected) + " result: " + QUnit.jsDump.parse(actual) ); -} - -function synchronize( callback ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process(); - } -} - -function process() { - var start = (new Date()).getTime(); - - while ( config.queue.length && !config.blocking ) { - if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) { - config.queue.shift()(); - - } else { - setTimeout( process, 13 ); - break; - } - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - config.pollution.push( key ); - } - } -} - -function checkPollution( name ) { - var old = config.pollution; - saveGlobal(); - - var newGlobals = diff( old, config.pollution ); - if ( newGlobals.length > 0 ) { - ok( false, "Introduced global variable(s): " + newGlobals.join(", ") ); - config.expected++; - } - - var deletedGlobals = diff( config.pollution, old ); - if ( deletedGlobals.length > 0 ) { - ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") ); - config.expected++; - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var result = a.slice(); - for ( var i = 0; i < result.length; i++ ) { - for ( var j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice(i, 1); - i--; - break; - } - } - } - return result; -} - -function fail(message, exception, callback) { - if ( typeof console !== "undefined" && console.error && console.warn ) { - console.error(message); - console.error(exception); - console.warn(callback.toString()); - - } else if ( window.opera && opera.postError ) { - opera.postError(message, exception, callback.toString); - } -} - -function extend(a, b) { - for ( var prop in b ) { - a[prop] = b[prop]; - } - - return a; -} - -function addEvent(elem, type, fn) { - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, fn ); - } else { - fn(); - } -} - -function id(name) { - return !!(typeof document !== "undefined" && document && document.getElementById) && - document.getElementById( name ); -} - -// Test for equality any JavaScript type. -// Discussions and reference: http://philrathe.com/articles/equiv -// Test suites: http://philrathe.com/tests/equiv -// Author: Philippe Rathé -QUnit.equiv = function () { - - var innerEquiv; // the real equiv function - var callers = []; // stack to decide between skip/abort functions - var parents = []; // stack to avoiding loops from circular referencing - - - // Determine what is o. - function hoozit(o) { - if (QUnit.is("String", o)) { - return "string"; - - } else if (QUnit.is("Boolean", o)) { - return "boolean"; - - } else if (QUnit.is("Number", o)) { - - if (isNaN(o)) { - return "nan"; - } else { - return "number"; - } - - } else if (typeof o === "undefined") { - return "undefined"; - - // consider: typeof null === object - } else if (o === null) { - return "null"; - - // consider: typeof [] === object - } else if (QUnit.is( "Array", o)) { - return "array"; - - // consider: typeof new Date() === object - } else if (QUnit.is( "Date", o)) { - return "date"; - - // consider: /./ instanceof Object; - // /./ instanceof RegExp; - // typeof /./ === "function"; // => false in IE and Opera, - // true in FF and Safari - } else if (QUnit.is( "RegExp", o)) { - return "regexp"; - - } else if (typeof o === "object") { - return "object"; - - } else if (QUnit.is( "Function", o)) { - return "function"; - } else { - return undefined; - } - } - - // Call the o related callback with the given arguments. - function bindCallbacks(o, callbacks, args) { - var prop = hoozit(o); - if (prop) { - if (hoozit(callbacks[prop]) === "function") { - return callbacks[prop].apply(callbacks, args); - } else { - return callbacks[prop]; // or undefined - } - } - } - - var callbacks = function () { - - // for string, boolean, number and null - function useStrictEquality(b, a) { - if (b instanceof a.constructor || a instanceof b.constructor) { - // to catch short annotaion VS 'new' annotation of a declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function (b) { - return isNaN(b); - }, - - "date": function (b, a) { - return hoozit(b) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function (b, a) { - return hoozit(b) === "regexp" && - a.source === b.source && // the regex itself - a.global === b.global && // and its modifers (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function () { - var caller = callers[callers.length - 1]; - return caller !== Object && - typeof caller !== "undefined"; - }, - - "array": function (b, a) { - var i, j, loop; - var len; - - // b could be an object literal here - if ( ! (hoozit(b) === "array")) { - return false; - } - - len = a.length; - if (len !== b.length) { // safe and faster - return false; - } - - //track reference to avoid circular references - parents.push(a); - for (i = 0; i < len; i++) { - loop = false; - for(j=0;j= 0) { - type = "array"; - } else { - type = typeof obj; - } - return type; - }, - separator:function() { - return this.multiline ? this.HTML ? '
      ' : '\n' : this.HTML ? ' ' : ' '; - }, - indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing - if ( !this.multiline ) - return ''; - var chr = this.indentChar; - if ( this.HTML ) - chr = chr.replace(/\t/g,' ').replace(/ /g,' '); - return Array( this._depth_ + (extra||0) ).join(chr); - }, - up:function( a ) { - this._depth_ += a || 1; - }, - down:function( a ) { - this._depth_ -= a || 1; - }, - setParser:function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote:quote, - literal:literal, - join:join, - // - _depth_: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers:{ - window: '[Window]', - document: '[Document]', - error:'[ERROR]', //when no parser is found, shouldn't happen - unknown: '[Unknown]', - 'null':'null', - undefined:'undefined', - 'function':function( fn ) { - var ret = 'function', - name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE - if ( name ) - ret += ' ' + name; - ret += '('; - - ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join(''); - return join( ret, this.parse(fn,'functionCode'), '}' ); - }, - array: array, - nodelist: array, - arguments: array, - object:function( map ) { - var ret = [ ]; - this.up(); - for ( var key in map ) - ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) ); - this.down(); - return join( '{', ret, '}' ); - }, - node:function( node ) { - var open = this.HTML ? '<' : '<', - close = this.HTML ? '>' : '>'; - - var tag = node.nodeName.toLowerCase(), - ret = open + tag; - - for ( var a in this.DOMAttrs ) { - var val = node[this.DOMAttrs[a]]; - if ( val ) - ret += ' ' + a + '=' + this.parse( val, 'attribute' ); - } - return ret + close + open + '/' + tag + close; - }, - functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function - var l = fn.length; - if ( !l ) return ''; - - var args = Array(l); - while ( l-- ) - args[l] = String.fromCharCode(97+l);//97 is 'a' - return ' ' + args.join(', ') + ' '; - }, - key:quote, //object calls it internally, the key part of an item in a map - functionCode:'[code]', //function calls it internally, it's the content of the function - attribute:quote, //node calls it internally, it's an html attribute value - string:quote, - date:quote, - regexp:literal, //regex - number:literal, - 'boolean':literal - }, - DOMAttrs:{//attributes to dump from nodes, name=>realName - id:'id', - name:'name', - 'class':'className' - }, - HTML:false,//if true, entities are escaped ( <, >, \t, space and \n ) - indentChar:' ',//indentation unit - multiline:false //if true, items in a collection, are separated by a \n, else just a space. - }; - - return jsDump; -})(); - -})(this); diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/test/server/streams-test.js b/lib/adapters/neo4j-lib/node_modules/streamline/test/server/streams-test.js deleted file mode 100644 index d1caa6d1..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/test/server/streams-test.js +++ /dev/null @@ -1,136 +0,0 @@ -/*** Generated by streamline 0.1.35 - DO NOT EDIT ***/ - "use strict"; var __global = typeof global !== 'undefined' ? global : window; function __cb(_, fn){ var ctx = __global.__context; return function(err, result){ __global.__context = ctx; if (err) return _(err); try { return fn(null, result); } catch (ex) { return __propagate(_, ex); } } } function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function(e, r){ cb(e, r); }; fn.apply(this, args); return function(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } function __nt(_, fn){ var i = 0; var cb = __cb(_, fn); var safeCb = function(){ try { cb(); } catch (ex) { __propagate(cb, ex); } }; if (typeof process != "undefined" && typeof process.nextTick == "function") return function(){ if (++i % 20 == 0) process.nextTick(safeCb); else cb(); }; else return function(){ if (++i % 20 == 0) setTimeout(safeCb); else cb(); }; } function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } var streams = require("streamline/lib/streams/streams"); - - -var module = QUnit.module; - -var bufSize = 100; -var bufCount = 3; -var totalSize = (bufCount * bufSize); -var modulo = 17; - -function makeBuffer(i) { - var buf = new Buffer(bufSize); - for (var j = 0; (j < bufSize); j++) { buf[j] = ((48 + i) + ((j % modulo)));; }; - - - return buf;}; - - -function checkBuffer(buf, start) { - ok((buf != null), "buffer not null"); - var i = Math.floor((start / bufSize)); - var j = (start % bufSize); - for (var k = 0; (k < buf.length); k++, j++) { - if ((j == bufSize)) { - i++; - j = 0; } ; - - if ((buf[k] !== ((48 + i) + ((j % modulo))))) { - return ok(false, ((((((("buffer verification failed: i=" + i) + ", j=") + j) + " k=") + k) + " val=") + buf[k])) }; }; - - ok(true, "buffer content is valid"); - return (start + buf.length);}; - - -new streams.HttpServer(function __1(req, res, _) { if (!_) { return __future(__1, arguments, 2); }; var i; - res.writeHead(200, { "Content-Type": "application/octet-stream" }); - res.emitter.on("drain", function() { - process.stderr.write("*"); }); - - i = 0; var __2 = false; return (function(__break) { var __loop = __nt(_, function() { if (__2) { i++; } else { __2 = true; } ; var __1 = (i < bufCount); if (__1) { - return res.write(__cb(_, function() { - return process.nextTick(__cb(_, __loop)); }), makeBuffer(i)); } else { __break(); } ; }); __loop(); })(function() { - - res.end(); _(); }); -}).listen(null, 1337, "127.0.0.1"); - - -var paused = 0, resumed = 0; -var doStop = false; - -module("node streams test", { - setup: function() { }, - - teardown: function() { - if (doStop) { - - setTimeout(function() { - process.kill(process.pid); - }, 0); } ; }}); - - - - -function addBufferHooks(stream) { - var pause = stream.pause.bind(stream); - stream.pause = function() { - - paused++; - pause(); }; - - var resume = stream.resume.bind(stream); - stream.resume = function() { - - resumed++; - resume(); };}; - - - -function doTest(_, name, options, fn) { if (!_) { return __future(doTest, arguments, 0); }; var resp, last; - - options.url = "http://127.0.0.1:1337/"; - return streams.httpRequest(options).end().response(__cb(_, function(__0, __1) { resp = __1; - addBufferHooks(resp.emitter); - return fn(__cb(_, function() { - return resp.read(__cb(_, function(__0, __2) { last = __2; - strictEqual(last, null, "read return null at end"); _(); })); }), resp); }));}; - - - -function dot(_) { if (!_) { return __future(dot, arguments, 0); }; - return process.nextTick(_);}; - - - - -function testPass(name, options) { - - var t0 = Date.now(); - - function testRead(name, detail, size) { - asyncTest(((name + " / ") + detail), function __1(_) { if (!_) { return __future(__1, arguments, 0); } ; - return doTest(__cb(_, function() { - - - - - - - - start(); _(); }), name, options, function __1(_, resp) { if (!_) { return __future(__1, arguments, 0); } ; var i, total, len, buf; i = 0; total = 0; var __3 = false; return (function(__break) { var __loop = __nt(_, function() { if (__3) { i++; } else { __3 = true; } ; var __2 = (total < totalSize); if (__2) { len = ((size && (typeof size === "function")) ? size() : size); return resp.read(__cb(_, function(__0, __1) { buf = __1; total = checkBuffer(buf, total); __loop(); }), len); } else { __break(); } ; }); __loop(); })(_); }); }); }; - - - - testRead(name, "chunk read"); - testRead(name, "half size read", Math.floor((bufSize / 2))); - testRead(name, "double size read", (bufSize * 2)); - testRead(name, "odd size read", Math.floor(((4 * bufSize) / 7))); - (false && testRead(name, "random size read", function() { - var r = Math.random(); - return Math.floor((((((r * r) * r) * r) * 3) * bufSize)); }));}; - - - - -var oneTenth = Math.floor(((bufCount * bufSize) / 10)); - -testPass("default buffering", {}); -testPass("buffer 0/1 tenth", { lowMark: 0, highMark: oneTenth}); -testPass("buffer 2/3 tenth", { lowMark: (2 * oneTenth), highMark: (3 * oneTenth)}); -testPass("buffer 1 tenth and above", { lowMark: oneTenth, highMark: (11 * oneTenth)}); -testPass("buffer all", { lowMark: 0, highMark: (11 * oneTenth)}); - -asyncTest("stop tests", 0, function __2(_) { if (!_) { return __future(__2, arguments, 0); }; - doStop = true; - start(); _();}); \ No newline at end of file diff --git a/lib/adapters/neo4j-lib/node_modules/streamline/test/server/streams-test_.js b/lib/adapters/neo4j-lib/node_modules/streamline/test/server/streams-test_.js deleted file mode 100644 index e49ba3fb..00000000 --- a/lib/adapters/neo4j-lib/node_modules/streamline/test/server/streams-test_.js +++ /dev/null @@ -1,136 +0,0 @@ -//streamline.options = { "lines" : "preserve" } -"use strict"; -var streams = require('streamline/lib/streams/streams'); -var module = QUnit.module; - -var bufSize = 100; -var bufCount = 3; -var totalSize = bufCount * bufSize; -var modulo = 17; - -function makeBuffer(i) { - var buf = new Buffer(bufSize); - for (var j = 0; j < bufSize; j++) - buf[j] = 0x30 + i + (j % modulo); - //console.error("\nGEN: " + i + ": " + buf) - return buf; -} - -function checkBuffer(buf, start) { - ok(buf != null, "buffer not null"); - var i = Math.floor(start / bufSize); - var j = start % bufSize; - for (var k = 0; k < buf.length; k++, j++) { - if (j == bufSize) { - i++; - j = 0; - } - if (buf[k] !== 0x30 + i + (j % modulo)) - return ok(false, "buffer verification failed: i=" + i + ", j=" + j + " k=" + k + " val=" + buf[k]); - } - ok(true, "buffer content is valid") - return start + buf.length; -} - -new streams.HttpServer( function (req, res, _) { - res.writeHead(200, {'Content-Type': 'application/octet-stream'}); - res.emitter.on("drain", function() { - process.stderr.write("*"); - }) - for (var i = 0; i < bufCount; i++) { - res.write(_, makeBuffer(i)); - process.nextTick(_); - } - res.end(); -}).listen(null, 1337, "127.0.0.1"); -//console.error('Server running at http://127.0.0.1:1337/'); - -var paused = 0, resumed = 0; -var doStop = false; - -module("node streams test", { - setup: function() { - }, - teardown: function() { - if (doStop) { - //syracuse.server.close(); - setTimeout( function() { - process.kill(process.pid); - }, 0) - } - } -}); - -function addBufferHooks(stream) { - var pause = stream.pause.bind(stream); - stream.pause = function() { - //process.stderr.write("<"); - paused++; - pause(); - } - var resume = stream.resume.bind(stream); - stream.resume = function() { - //process.stderr.write(">"); - resumed++; - resume(); - } -} - -function doTest(_, name, options, fn) { - //process.stderr.write("\ttesting " + name); - options.url = 'http://127.0.0.1:1337/'; - var resp = streams.httpRequest(options).end().response(_); - addBufferHooks(resp.emitter); - fn(_, resp); - var last = resp.read(_); - strictEqual(last, null, "read return null at end") - //console.error(" ok"); -} - -function dot(_) { - process.nextTick(_); - //process.stderr.write("."); - -} - -function testPass(name, options) { - //console.error("pass " + name); - var t0 = Date.now(); - - function testRead(name, detail, size) { - asyncTest(name + " / " + detail, function(_) { - doTest(_, name, options, function(_, resp) { - for (var i = 0, total = 0; total < totalSize; i++) { - var len = size && typeof size === "function" ? size() : size; - var buf = resp.read(_, len); - total = checkBuffer(buf, total); - //dot(_); - } - }); - start(); - }); - } - - testRead(name, "chunk read"); - testRead(name, "half size read", Math.floor(bufSize / 2)); - testRead(name, "double size read", bufSize * 2); - testRead(name, "odd size read", Math.floor(4 * bufSize / 7)); - false && testRead(name, "random size read", function() { - var r = Math.random(); - return Math.floor(r * r * r * r * 3 * bufSize); - }); - //console.error("pass completed in " + (Date.now() - t0) + " ms"); -} - -var oneTenth = Math.floor(bufCount * bufSize / 10); -//testPass("default buffering (warm up)", {}); -testPass("default buffering", {}); -testPass("buffer 0/1 tenth", { lowMark: 0, highMark: oneTenth }); -testPass("buffer 2/3 tenth", { lowMark: 2 * oneTenth, highMark: 3 * oneTenth }); -testPass("buffer 1 tenth and above", { lowMark: oneTenth, highMark: 11 * oneTenth }); -testPass("buffer all", { lowMark: 0, highMark: 11 * oneTenth }); - -asyncTest("stop tests", 0, function(_) { - doStop = true; - start(); -}); diff --git a/lib/adapters/neo4j-lib/package.json b/lib/adapters/neo4j-lib/package.json deleted file mode 100644 index f4905c67..00000000 --- a/lib/adapters/neo4j-lib/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "neo4j", - "description": "Neo4j driver for Node", - "version": "0.2.1", - "author": "Daniel Gasienica ", - "contributors": [ - {"name": "Sergio Haro", "email": "sergio.haro.jr@gmail.com"}, - {"name": "Aseem Kishore", "email": "aseem.kishore@gmail.com"} - ], - "main": "./lib", - "dependencies": { - "coffee-script": "1.1.x >= 1.1.2", - "http-status": "0.1.0", - "request": "2.1.x", - "streamline": "0.1.35" - }, - "keywords": [ - "neo4j", - "graph", - "database", - "driver", - "rest" - ], - "licenses": [ - { - "type": "Apache License, Version 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - } - ], - "repository" : { - "type" : "git", - "url" : "https://github.com/gasi/node-neo4j.git" - }, - "scripts": { - "test": "node test" - }, - "engines": { - "node": ">= 0.4.5" - } -} diff --git a/lib/adapters/neo4j.js b/lib/adapters/neo4j.js index 50202eac..86c35660 100644 --- a/lib/adapters/neo4j.js +++ b/lib/adapters/neo4j.js @@ -1,7 +1,9 @@ +var safeRequire = require('../utils').safeRequire; + /** * Module dependencies */ -var neo4j = require('./neo4j-lib'); +var neo4j = safeRequire('neo4j'); exports.initialize = function initializeSchema(schema, callback) { schema.client = new neo4j.GraphDatabase(schema.settings.url); @@ -179,7 +181,7 @@ Neo4j.prototype.updateIndexes = function updateIndexes(model, node, cb) { var props = this._models[model].properties; var wait = 1; Object.keys(props).forEach(function (key) { - if (props[key].index) { + if (props[key].index && node.data[key]) { wait += 1; node.index(model, key, node.data[key], done); } @@ -262,9 +264,12 @@ Neo4j.prototype.all = function all(model, filter, callback) { if (filter) { nodes = nodes ? nodes.filter(applyFilter(filter)) : nodes; if (filter.order) { + var key = filter.order.split(' ')[0]; + var dir = filter.order.split(' ')[1]; nodes = nodes.sort(function (a, b) { - return a[filter.order] > b[filter.order]; + return a[key] > b[key]; }); + if (dir === 'DESC') nodes = nodes.reverse(); } } callback(err, nodes); diff --git a/package.json b/package.json index 11a3ace1..14f6fb9a 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "main": "index.js", "scripts": { - "test": "EXCEPT=sequelize,neo4j nodeunit test/*_test*" + "test": "EXCEPT=sequelize nodeunit test/*_test*" }, "engines": [ "node >= 0.4.0" @@ -23,6 +23,7 @@ "pg": "*", "sqlite3": "*", "nodeunit": ">= 0", - "coffee-script": ">= 0" + "coffee-script": ">= 0", + "neo4j": ">= 0" } } diff --git a/test/common_test.js b/test/common_test.js index d231aa95..5302978d 100644 --- a/test/common_test.js +++ b/test/common_test.js @@ -37,7 +37,7 @@ Object.keys(schemas).forEach(function (schemaName) { context(schemaName, function () { var schema = new Schema(schemaName, schemas[schemaName]); schema.log = function (a) { - // console.log(a); + console.log(a); }; testOrm(schema); if (specificTest[schemaName]) specificTest[schemaName](schema); @@ -562,7 +562,7 @@ function testOrm(schema) { }); - if (schema.name !== 'redis' && schema.name !== 'memory') + if (schema.name !== 'redis' && schema.name !== 'memory' && schema.name !== 'neo4j') it('should allow advanced queying: lt, gt, lte, gte, between', function (test) { Post.destroyAll(function () { Post.create({date: new Date('Wed, 01 Feb 2012 13:56:12 GMT')}, done); @@ -584,31 +584,31 @@ function testOrm(schema) { function makeTest() { // gt Post.all({where: {date: {gt: new Date('Tue, 07 Feb 2012 13:56:12 GMT')}}}, function (err, posts) { - test.equal(posts.length, 2); + test.equal(posts.length, 2, 'gt'); ok(); }); // gte Post.all({where: {date: {gte: new Date('Tue, 07 Feb 2012 13:56:12 GMT')}}}, function (err, posts) { - test.equal(posts.length, 3); + test.equal(posts.length, 3, 'gte'); ok(); }); // lte Post.all({where: {date: {lte: new Date('Tue, 07 Feb 2012 13:56:12 GMT')}}}, function (err, posts) { - test.equal(posts.length, 7); + test.equal(posts.length, 7, 'lte'); ok(); }); // lt Post.all({where: {date: {lt: new Date('Tue, 07 Feb 2012 13:56:12 GMT')}}}, function (err, posts) { - test.equal(posts.length, 6); + test.equal(posts.length, 6, 'lt'); ok(); }); // between Post.all({where: {date: {between: [new Date('Tue, 05 Feb 2012 13:56:12 GMT'), new Date('Tue, 09 Feb 2012 13:56:12 GMT')]}}}, function (err, posts) { - test.equal(posts.length, 5); + test.equal(posts.length, 5, 'between'); ok(); }); }