aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-10-23 17:36:26 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-10-23 17:36:26 -0700
commita79d6118ba9af2cdcdc17a43ae2d03327c9e87e3 (patch)
treef346dbbba50dbb52bf2d54a6cb3198d3498e6ba3
parent94ee68349b7510192b7ee89912e64366dac81022 (diff)
remove no longer needed coffeescript
-rw-r--r--tools/eliminator/node_modules/coffee-script/.npmignore11
-rw-r--r--tools/eliminator/node_modules/coffee-script/CNAME1
-rw-r--r--tools/eliminator/node_modules/coffee-script/CONTRIBUTING.md9
-rw-r--r--tools/eliminator/node_modules/coffee-script/Cakefile247
-rw-r--r--tools/eliminator/node_modules/coffee-script/LICENSE22
-rw-r--r--tools/eliminator/node_modules/coffee-script/README51
-rw-r--r--tools/eliminator/node_modules/coffee-script/Rakefile78
-rwxr-xr-xtools/eliminator/node_modules/coffee-script/bin/cake7
-rwxr-xr-xtools/eliminator/node_modules/coffee-script/bin/coffee7
-rw-r--r--tools/eliminator/node_modules/coffee-script/extras/coffee-script.js8
-rw-r--r--tools/eliminator/node_modules/coffee-script/extras/jsl.conf44
-rw-r--r--tools/eliminator/node_modules/coffee-script/index.html3028
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/browser.js92
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/cake.js113
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/coffee-script.js171
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/command.js502
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/grammar.js606
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/helpers.js88
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/index.js11
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/lexer.js788
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/nodes.js2971
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/optparse.js138
-rwxr-xr-xtools/eliminator/node_modules/coffee-script/lib/coffee-script/parser.js683
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/repl.js276
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/rewriter.js349
-rw-r--r--tools/eliminator/node_modules/coffee-script/lib/coffee-script/scope.js146
-rw-r--r--tools/eliminator/node_modules/coffee-script/package.json35
27 files changed, 0 insertions, 10482 deletions
diff --git a/tools/eliminator/node_modules/coffee-script/.npmignore b/tools/eliminator/node_modules/coffee-script/.npmignore
deleted file mode 100644
index 21e430d2..00000000
--- a/tools/eliminator/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/tools/eliminator/node_modules/coffee-script/CNAME b/tools/eliminator/node_modules/coffee-script/CNAME
deleted file mode 100644
index faadabe5..00000000
--- a/tools/eliminator/node_modules/coffee-script/CNAME
+++ /dev/null
@@ -1 +0,0 @@
-coffeescript.org \ No newline at end of file
diff --git a/tools/eliminator/node_modules/coffee-script/CONTRIBUTING.md b/tools/eliminator/node_modules/coffee-script/CONTRIBUTING.md
deleted file mode 100644
index 6390c68b..00000000
--- a/tools/eliminator/node_modules/coffee-script/CONTRIBUTING.md
+++ /dev/null
@@ -1,9 +0,0 @@
-## How to contribute to CoffeeScript
-
-* Before you open a ticket or send a pull request, [search](https://github.com/jashkenas/coffee-script/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one.
-
-* Before sending a pull request for a feature, be sure to have [tests](https://github.com/jashkenas/coffee-script/tree/master/test).
-
-* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/coffee-script/tree/master/src). If you're just getting started with CoffeeScript, there's a nice [style guide](https://github.com/polarmobile/coffeescript-style-guide).
-
-* In your pull request, do not add documentation to `index.html` or re-build the minified `coffee-script.js` file. We'll do those things before cutting a new release. \ No newline at end of file
diff --git a/tools/eliminator/node_modules/coffee-script/Cakefile b/tools/eliminator/node_modules/coffee-script/Cakefile
deleted file mode 100644
index 5c9d56ab..00000000
--- a/tools/eliminator/node_modules/coffee-script/Cakefile
+++ /dev/null
@@ -1,247 +0,0 @@
-fs = require 'fs'
-path = require 'path'
-{extend} = require './lib/coffee-script/helpers'
-CoffeeScript = require './lib/coffee-script'
-{spawn, exec} = require 'child_process'
-
-# ANSI Terminal Colors.
-enableColors = no
-unless process.platform is 'win32'
- enableColors = not process.env.NODE_DISABLE_COLORS
-
-bold = red = green = reset = ''
-if enableColors
- bold = '\x1B[0;1m'
- red = '\x1B[0;31m'
- green = '\x1B[0;32m'
- reset = '\x1B[0m'
-
-# Built file header.
-header = """
- /**
- * CoffeeScript Compiler v#{CoffeeScript.VERSION}
- * http://coffeescript.org
- *
- * Copyright 2011, Jeremy Ashkenas
- * Released under the MIT License
- */
-"""
-
-sources = [
- 'coffee-script', 'grammar', 'helpers'
- 'lexer', 'nodes', 'rewriter', 'scope'
-].map (filename) -> "src/#{filename}.coffee"
-
-# Run a CoffeeScript through our node/coffee interpreter.
-run = (args, cb) ->
- proc = spawn 'node', ['bin/coffee'].concat(args)
- proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
- proc.on 'exit', (status) ->
- process.exit(1) if status != 0
- cb() if typeof cb is 'function'
-
-# Log a message with a color.
-log = (message, color, explanation) ->
- console.log color + message + reset + ' ' + (explanation or '')
-
-option '-p', '--prefix [DIR]', 'set the installation prefix for `cake install`'
-
-task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options) ->
- base = options.prefix or '/usr/local'
- lib = "#{base}/lib/coffee-script"
- bin = "#{base}/bin"
- node = "~/.node_libraries/coffee-script"
- console.log "Installing CoffeeScript to #{lib}"
- console.log "Linking to #{node}"
- console.log "Linking 'coffee' to #{bin}/coffee"
- exec([
- "mkdir -p #{lib} #{bin}"
- "cp -rf bin lib LICENSE README package.json src #{lib}"
- "ln -sfn #{lib}/bin/coffee #{bin}/coffee"
- "ln -sfn #{lib}/bin/cake #{bin}/cake"
- "mkdir -p ~/.node_libraries"
- "ln -sfn #{lib}/lib/coffee-script #{node}"
- ].join(' && '), (err, stdout, stderr) ->
- if err then console.log stderr.trim() else log 'done', green
- )
-
-
-task 'build', 'build the CoffeeScript language from source', build = (cb) ->
- files = fs.readdirSync 'src'
- files = ('src/' + file for file in files when file.match(/\.coffee$/))
- run ['-c', '-o', 'lib/coffee-script'].concat(files), cb
-
-
-task 'build:full', 'rebuild the source twice, and run the tests', ->
- build ->
- build ->
- csPath = './lib/coffee-script'
- delete require.cache[require.resolve csPath]
- unless runTests require csPath
- process.exit 1
-
-
-task 'build:parser', 'rebuild the Jison parser (run build first)', ->
- extend global, require('util')
- require 'jison'
- parser = require('./lib/coffee-script/grammar').parser
- fs.writeFile 'lib/coffee-script/parser.js', parser.generate()
-
-
-task 'build:ultraviolet', 'build and install the Ultraviolet syntax highlighter', ->
- exec 'plist2syntax ../coffee-script-tmbundle/Syntaxes/CoffeeScript.tmLanguage', (err) ->
- throw err if err
- exec 'sudo mv coffeescript.yaml /usr/local/lib/ruby/gems/1.8/gems/ultraviolet-0.10.2/syntax/coffeescript.syntax'
-
-
-task 'build:browser', 'rebuild the merged script for inclusion in the browser', ->
- code = ''
- for name in ['helpers', 'rewriter', 'lexer', 'parser', 'scope', 'nodes', 'coffee-script', 'browser']
- code += """
- require['./#{name}'] = new function() {
- var exports = this;
- #{fs.readFileSync "lib/coffee-script/#{name}.js"}
- };
- """
- code = """
- (function(root) {
- var CoffeeScript = function() {
- function require(path){ return require[path]; }
- #{code}
- return require['./coffee-script'];
- }();
-
- if (typeof define === 'function' && define.amd) {
- define(function() { return CoffeeScript; });
- } else {
- root.CoffeeScript = CoffeeScript;
- }
- }(this));
- """
- unless process.env.MINIFY is 'false'
- {parser, uglify} = require 'uglify-js'
- code = uglify.gen_code uglify.ast_squeeze uglify.ast_mangle parser.parse code
- fs.writeFileSync 'extras/coffee-script.js', header + '\n' + code
- console.log "built ... running browser tests:"
- invoke 'test:browser'
-
-
-task 'doc:site', 'watch and continually rebuild the documentation for the website', ->
- exec 'rake doc', (err) ->
- throw err if err
-
-
-task 'doc:source', 'rebuild the internal documentation', ->
- exec 'docco src/*.coffee && cp -rf docs documentation && rm -r docs', (err) ->
- throw err if err
-
-
-task 'doc:underscore', 'rebuild the Underscore.coffee documentation page', ->
- exec 'docco examples/underscore.coffee && cp -rf docs documentation && rm -r docs', (err) ->
- throw err if err
-
-task 'bench', 'quick benchmark of compilation time', ->
- {Rewriter} = require './lib/coffee-script/rewriter'
- co = sources.map((name) -> fs.readFileSync name).join '\n'
- fmt = (ms) -> " #{bold}#{ " #{ms}".slice -4 }#{reset} ms"
- total = 0
- now = Date.now()
- time = -> total += ms = -(now - now = Date.now()); fmt ms
- tokens = CoffeeScript.tokens co, rewrite: false
- console.log "Lex #{time()} (#{tokens.length} tokens)"
- tokens = new Rewriter().rewrite tokens
- console.log "Rewrite#{time()} (#{tokens.length} tokens)"
- nodes = CoffeeScript.nodes tokens
- console.log "Parse #{time()}"
- js = nodes.compile bare: true
- console.log "Compile#{time()} (#{js.length} chars)"
- console.log "total #{ fmt total }"
-
-task 'loc', 'count the lines of source code in the CoffeeScript compiler', ->
- exec "cat #{ sources.join(' ') } | grep -v '^\\( *#\\|\\s*$\\)' | wc -l | tr -s ' '", (err, stdout) ->
- console.log stdout.trim()
-
-
-# Run the CoffeeScript test suite.
-runTests = (CoffeeScript) ->
- startTime = Date.now()
- currentFile = null
- passedTests = 0
- failures = []
-
- global[name] = func for name, func of require 'assert'
-
- # Convenience aliases.
- global.CoffeeScript = CoffeeScript
-
- # Our test helper function for delimiting different test cases.
- global.test = (description, fn) ->
- try
- fn.test = {description, currentFile}
- fn.call(fn)
- ++passedTests
- catch e
- e.description = description if description?
- e.source = fn.toString() if fn.toString?
- failures.push filename: currentFile, error: e
-
- # See http://wiki.ecmascript.org/doku.php?id=harmony:egal
- egal = (a, b) ->
- if a is b
- a isnt 0 or 1/a is 1/b
- else
- a isnt a and b isnt b
-
- # A recursive functional equivalence helper; uses egal for testing equivalence.
- arrayEgal = (a, b) ->
- if egal a, b then yes
- else if a instanceof Array and b instanceof Array
- return no unless a.length is b.length
- return no for el, idx in a when not arrayEgal el, b[idx]
- yes
-
- global.eq = (a, b, msg) -> ok egal(a, b), msg
- global.arrayEq = (a, b, msg) -> ok arrayEgal(a,b), msg
-
- # When all the tests have run, collect and print errors.
- # If a stacktrace is available, output the compiled function source.
- process.on 'exit', ->
- time = ((Date.now() - startTime) / 1000).toFixed(2)
- message = "passed #{passedTests} tests in #{time} seconds#{reset}"
- return log(message, green) unless failures.length
- log "failed #{failures.length} and #{message}", red
- for fail in failures
- {error, filename} = fail
- jsFilename = filename.replace(/\.coffee$/,'.js')
- match = error.stack?.match(new RegExp(fail.file+":(\\d+):(\\d+)"))
- match = error.stack?.match(/on line (\d+):/) unless match
- [match, line, col] = match if match
- console.log ''
- log " #{error.description}", red if error.description
- log " #{error.stack}", red
- log " #{jsFilename}: line #{line ? 'unknown'}, column #{col ? 'unknown'}", red
- console.log " #{error.source}" if error.source
- return
-
- # Run every test in the `test` folder, recording failures.
- files = fs.readdirSync 'test'
- for file in files when file.match /\.coffee$/i
- currentFile = filename = path.join 'test', file
- code = fs.readFileSync filename
- try
- CoffeeScript.run code.toString(), {filename}
- catch error
- failures.push {filename, error}
- return !failures.length
-
-
-task 'test', 'run the CoffeeScript language test suite', ->
- runTests CoffeeScript
-
-
-task 'test:browser', 'run the test suite against the merged browser script', ->
- source = fs.readFileSync 'extras/coffee-script.js', 'utf-8'
- result = {}
- global.testingBrowser = yes
- (-> eval source).call result
- runTests result.CoffeeScript
diff --git a/tools/eliminator/node_modules/coffee-script/LICENSE b/tools/eliminator/node_modules/coffee-script/LICENSE
deleted file mode 100644
index dbe6b4e3..00000000
--- a/tools/eliminator/node_modules/coffee-script/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2009-2012 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/tools/eliminator/node_modules/coffee-script/README b/tools/eliminator/node_modules/coffee-script/README
deleted file mode 100644
index 69ee6f43..00000000
--- a/tools/eliminator/node_modules/coffee-script/README
+++ /dev/null
@@ -1,51 +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.)
-
- Execute a script:
- coffee /path/to/script.coffee
-
- Compile a script:
- coffee -c /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/tools/eliminator/node_modules/coffee-script/Rakefile b/tools/eliminator/node_modules/coffee-script/Rakefile
deleted file mode 100644
index dfb85dab..00000000
--- a/tools/eliminator/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/tools/eliminator/node_modules/coffee-script/bin/cake b/tools/eliminator/node_modules/coffee-script/bin/cake
deleted file mode 100755
index 5965f4ee..00000000
--- a/tools/eliminator/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 + '/coffee-script/cake').run();
diff --git a/tools/eliminator/node_modules/coffee-script/bin/coffee b/tools/eliminator/node_modules/coffee-script/bin/coffee
deleted file mode 100755
index 3d1d71c8..00000000
--- a/tools/eliminator/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 + '/coffee-script/command').run();
diff --git a/tools/eliminator/node_modules/coffee-script/extras/coffee-script.js b/tools/eliminator/node_modules/coffee-script/extras/coffee-script.js
deleted file mode 100644
index 8fc1f002..00000000
--- a/tools/eliminator/node_modules/coffee-script/extras/coffee-script.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * CoffeeScript Compiler v1.3.3
- * http://coffeescript.org
- *
- * Copyright 2011, Jeremy Ashkenas
- * Released under the MIT License
- */
-(function(root){var CoffeeScript=function(){function require(a){return require[a]}require["./helpers"]=new function(){var a=this;(function(){var b,c;a.starts=function(a,b,c){return b===a.substr(c,b.length)},a.ends=function(a,b,c){var d;d=b.length;return b===a.substr(a.length-d-(c||0),d)},a.compact=function(a){var b,c,d,e;e=[];for(c=0,d=a.length;c<d;c++)b=a[c],b&&e.push(b);return e},a.count=function(a,b){var c,d;c=d=0;if(!b.length)return 1/0;while(d=1+a.indexOf(b,d))c++;return c},a.merge=function(a,c){return b(b({},a),c)},b=a.extend=function(a,b){var c,d;for(c in b)d=b[c],a[c]=d;return a},a.flatten=c=function(a){var b,d,e,f;d=[];for(e=0,f=a.length;e<f;e++)b=a[e],b instanceof Array?d=d.concat(c(b)):d.push(b);return d},a.del=function(a,b){var c;c=a[b],delete a[b];return c},a.last=function(a,b){return a[a.length-(b||0)-1]}}).call(this)},require["./rewriter"]=new function(){var a=this;(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},u=[].slice;a.Rewriter=function(){function a(){}a.prototype.rewrite=function(a){this.tokens=a,this.removeLeadingNewlines(),this.removeMidExpressionNewlines(),this.closeOpenCalls(),this.closeOpenIndexes(),this.addImplicitIndentation(),this.tagPostfixConditionals(),this.addImplicitBraces(),this.addImplicitParentheses();return this.tokens},a.prototype.scanTokens=function(a){var b,c,d;d=this.tokens,b=0;while(c=d[b])b+=a.call(this,c,b,d);return!0},a.prototype.detectEnd=function(a,b,c){var f,g,h,i,j;h=this.tokens,f=0;while(g=h[a]){if(f===0&&b.call(this,g,a))return c.call(this,g,a);if(!g||f<0)return c.call(this,g,a-1);if(i=g[0],t.call(e,i)>=0)f+=1;else if(j=g[0],t.call(d,j)>=0)f-=1;a+=1}return a-1},a.prototype.removeLeadingNewlines=function(){var a,b,c,d,e;e=this.tokens;for(a=c=0,d=e.length;c<d;a=++c){b=e[a][0];if(b!=="TERMINATOR")break}if(a)return this.tokens.splice(0,a)},a.prototype.removeMidExpressionNewlines=function(){return this.scanTokens(function(a,b,d){var e;if(!(a[0]==="TERMINATOR"&&(e=this.tag(b+1),t.call(c,e)>=0)))return 1;d.splice(b,1);return 0})},a.prototype.closeOpenCalls=function(){var a,b;b=function(a,b){var c;return(c=a[0])===")"||c==="CALL_END"||a[0]==="OUTDENT"&&this.tag(b-1)===")"},a=function(a,b){return this.tokens[a[0]==="OUTDENT"?b-1:b][0]="CALL_END"};return this.scanTokens(function(c,d){c[0]==="CALL_START"&&this.detectEnd(d+1,b,a);return 1})},a.prototype.closeOpenIndexes=function(){var a,b;b=function(a,b){var c;return(c=a[0])==="]"||c==="INDEX_END"},a=function(a,b){return a[0]="INDEX_END"};return this.scanTokens(function(c,d){c[0]==="INDEX_START"&&this.detectEnd(d+1,b,a);return 1})},a.prototype.addImplicitBraces=function(){var a,b,c,f,g,i,j,k;f=[],g=null,k=null,c=!0,i=0,j=0,b=function(a,b){var d,e,f,g,i,m;i=this.tokens.slice(b+1,b+3+1||9e9),d=i[0],g=i[1],f=i[2];if("HERECOMMENT"===(d!=null?d[0]:void 0))return!1;e=a[0],t.call(l,e)>=0&&(c=!1);return(e==="TERMINATOR"||e==="OUTDENT"||t.call(h,e)>=0&&c&&b-j!==1)&&(!k&&this.tag(b-1)!==","||(g!=null?g[0]:void 0)!==":"&&((d!=null?d[0]:void 0)!=="@"||(f!=null?f[0]:void 0)!==":"))||e===","&&d&&(m=d[0])!=="IDENTIFIER"&&m!=="NUMBER"&&m!=="STRING"&&m!=="@"&&m!=="TERMINATOR"&&m!=="OUTDENT"},a=function(a,b){var c;c=this.generate("}","}",a[2]);return this.tokens.splice(b,0,c)};return this.scanTokens(function(h,i,m){var n,o,p,q,r,s,u,v;if(u=q=h[0],t.call(e,u)>=0){f.push([q==="INDENT"&&this.tag(i-1)==="{"?"{":q,i]);return 1}if(t.call(d,q)>=0){g=f.pop();return 1}if(q!==":"||(n=this.tag(i-2))!==":"&&((v=f[f.length-1])!=null?v[0]:void 0)==="{")return 1;c=!0,j=i+1,f.push(["{"]),o=n==="@"?i-2:i-1;while(this.tag(o-2)==="HERECOMMENT")o-=2;p=this.tag(o-1),k=!p||t.call(l,p)>=0,s=new String("{"),s.generated=!0,r=this.generate("{",s,h[2]),m.splice(o,0,r),this.detectEnd(i+2,b,a);return 2})},a.prototype.addImplicitParentheses=function(){var a,b,c,d,e;c=e=d=!1,b=function(a,b){var c,g,i,j;g=a[0];if(!e&&a.fromThen)return!0;if(g==="IF"||g==="ELSE"||g==="CATCH"||g==="->"||g==="=>"||g==="CLASS")e=!0;if(g==="IF"||g==="ELSE"||g==="SWITCH"||g==="TRY"||g==="=")d=!0;if((g==="."||g==="?."||g==="::")&&this.tag(b-1)==="OUTDENT")return!0;return!a.generated&&this.tag(b-1)!==","&&(t.call(h,g)>=0||g==="INDENT"&&!d)&&(g!=="INDENT"||(i=this.tag(b-2))!=="CLASS"&&i!=="EXTENDS"&&(j=this.tag(b-1),t.call(f,j)<0)&&(!(c=this.tokens[b+1])||!c.generated||c[0]!=="{"))},a=function(a,b){return this.tokens.splice(b,0,this.generate("CALL_END",")",a[2]))};return this.scanTokens(function(f,h,k){var m,n,o,p,q,r,s,u;q=f[0];if(q==="CLASS"||q==="IF"||q==="FOR"||q==="WHILE")c=!0;r=k.slice(h-1,h+1+1||9e9),p=r[0],n=r[1],o=r[2],m=!c&&q==="INDENT"&&o&&o.generated&&o[0]==="{"&&p&&(s=p[0],t.call(i,s)>=0),e=!1,d=!1,t.call(l,q)>=0&&(c=!1),p&&!p.spaced&&q==="?"&&(f.call=!0);if(f.fromThen)return 1;if(!(m||(p!=null?p.spaced:void 0)&&(p.call||(u=p[0],t.call(i,u)>=0))&&(t.call(g,q)>=0||!f.spaced&&!f.newLine&&t.call(j,q)>=0)))return 1;k.splice(h,0,this.generate("CALL_START","(",f[2])),this.detectEnd(h+1,b,a),p[0]==="?"&&(p[0]="FUNC_EXIST");return 2})},a.prototype.addImplicitIndentation=function(){var a,b,c,d,e;e=c=d=null,b=function(a,b){var c;return a[1]!==";"&&(c=a[0],t.call(m,c)>=0)&&(a[0]!=="ELSE"||e==="IF"||e==="THEN")},a=function(a,b){return this.tokens.splice(this.tag(b-1)===","?b-1:b,0,d)};return this.scanTokens(function(f,g,h){var i,j,k;i=f[0];if(i==="TERMINATOR"&&this.tag(g+1)==="THEN"){h.splice(g,1);return 0}if(i==="ELSE"&&this.tag(g-1)!=="OUTDENT"){h.splice.apply(h,[g,0].concat(u.call(this.indentation(f))));return 2}if(i==="CATCH"&&((j=this.tag(g+2))==="OUTDENT"||j==="TERMINATOR"||j==="FINALLY")){h.splice.apply(h,[g+2,0].concat(u.call(this.indentation(f))));return 4}if(t.call(n,i)>=0&&this.tag(g+1)!=="INDENT"&&(i!=="ELSE"||this.tag(g+1)!=="IF")){e=i,k=this.indentation(f,!0),c=k[0],d=k[1],e==="THEN"&&(c.fromThen=!0),h.splice(g+1,0,c),this.detectEnd(g+2,b,a),i==="THEN"&&h.splice(g,1);return 1}return 1})},a.prototype.tagPostfixConditionals=function(){var a,b,c;c=null,b=function(a,b){var c;return(c=a[0])==="TERMINATOR"||c==="INDENT"},a=function(a,b){if(a[0]!=="INDENT"||a.generated&&!a.fromThen)return c[0]="POST_"+c[0]};return this.scanTokens(function(d,e){if(d[0]!=="IF")return 1;c=d,this.detectEnd(e+1,b,a);return 1})},a.prototype.indentation=function(a,b){var c,d;b==null&&(b=!1),c=["INDENT",2,a[2]],d=["OUTDENT",2,a[2]],b&&(c.generated=d.generated=!0);return[c,d]},a.prototype.generate=function(a,b,c){var d;d=[a,b,c],d.generated=!0;return d},a.prototype.tag=function(a){var b;return(b=this.tokens[a])!=null?b[0]:void 0};return a}(),b=[["(",")"],["[","]"],["{","}"],["INDENT","OUTDENT"],["CALL_START","CALL_END"],["PARAM_START","PARAM_END"],["INDEX_START","INDEX_END"]],a.INVERSES=k={},e=[],d=[];for(q=0,r=b.length;q<r;q++)s=b[q],o=s[0],p=s[1],e.push(k[p]=o),d.push(k[o]=p);c=["CATCH","WHEN","ELSE","FINALLY"].concat(d),i=["IDENTIFIER","SUPER",")","CALL_END","]","INDEX_END","@","THIS"],g=["IDENTIFIER","NUMBER","STRING","JS","REGEX","NEW","PARAM_START","CLASS","IF","TRY","SWITCH","THIS","BOOL","NULL","UNDEFINED","UNARY","SUPER","@","->","=>","[","(","{","--","++"],j=["+","-"],f=["->","=>","{","[",","],h=["POST_IF","FOR","WHILE","UNTIL","WHEN","BY","LOOP","TERMINATOR"],n=["ELSE","->","=>","TRY","FINALLY","THEN"],m=["TERMINATOR","CATCH","FINALLY","ELSE","OUTDENT","LEADING_WHEN"],l=["TERMINATOR","INDENT","OUTDENT"]}).call(this)},require["./lexer"]=new function(){var a=this;(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};V=require("./rewriter"),J=V.Rewriter,r=V.INVERSES,W=require("./helpers"),R=W.count,U=W.starts,Q=W.compact,T=W.last,a.Lexer=y=function(){function a(){}a.prototype.tokenize=function(a,b){var c,d;b==null&&(b={}),P.test(a)&&(a="\n"+a),a=a.replace(/\r/g,"").replace(N,""),this.code=a,this.line=b.line||0,this.indent=0,this.indebt=0,this.outdebt=0,this.indents=[],this.ends=[],this.tokens=[],c=0;while(this.chunk=a.slice(c))c+=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.heredocToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken();this.closeIndentation(),(d=this.ends.pop())&&this.error("missing "+d);if(b.rewrite===!1)return this.tokens;return(new J).rewrite(this.tokens)},a.prototype.identifierToken=function(){var a,b,c,d,h,i,j,k,l;if(!(h=p.exec(this.chunk)))return 0;d=h[0],c=h[1],a=h[2];if(c==="own"&&this.tag()==="FOR"){this.token("OWN",c);return c.length}b=a||(i=T(this.tokens))&&((k=i[0])==="."||k==="?."||k==="::"||!i.spaced&&i[0]==="@"),j="IDENTIFIER",!b&&(X.call(u,c)>=0||X.call(g,c)>=0)&&(j=c.toUpperCase(),j==="WHEN"&&(l=this.tag(),X.call(v,l)>=0)?j="LEADING_WHEN":j==="FOR"?this.seenFor=!0:j==="UNLESS"?j="IF":X.call(O,j)>=0?j="UNARY":X.call(H,j)>=0&&(j!=="INSTANCEOF"&&this.seenFor?(j="FOR"+j,this.seenFor=!1):(j="RELATION",this.value()==="!"&&(this.tokens.pop(),c="!"+c)))),X.call(t,c)>=0&&(b?(j="IDENTIFIER",c=new String(c),c.reserved=!0):X.call(I,c)>=0&&this.error('reserved word "'+c+'"')),b||(X.call(e,c)>=0&&(c=f[c]),j=function(){switch(c){case"!":return"UNARY";case"==":case"!=":return"COMPARE";case"&&":case"||":return"LOGIC";case"true":case"false":return"BOOL";case"break":case"continue":return"STATEMENT";default:return j}}()),this.token(j,c),a&&this.token(":",":");return d.length},a.prototype.numberToken=function(){var a,b,c,d,e;if(!(c=E.exec(this.chunk)))return 0;d=c[0],/^0[BOX]/.test(d)?this.error("radix prefix '"+d+"' must be lowercase"):/E/.test(d)&&!/^0x/.test(d)?this.error("exponential notation '"+d+"' must be indicated with a lowercase 'e'"):/^0\d*[89]/.test(d)?this.error("decimal literal '"+d+"' must not be prefixed with '0'"):/^0\d+/.test(d)&&this.error("octal literal '"+d+"' must be prefixed with '0o'"),b=d.length;if(e=/^0o([0-7]+)/.exec(d))d="0x"+parseInt(e[1],8).toString(16);if(a=/^0b([01]+)/.exec(d))d="0x"+parseInt(a[1],2).toString(16);this.token("NUMBER",d);return b},a.prototype.stringToken=function(){var a,b,c;switch(this.chunk.charAt(0)){case"'":if(!(a=L.exec(this.chunk)))return 0;this.token("STRING",(c=a[0]).replace(A,"\\\n"));break;case'"':if(!(c=this.balancedString(this.chunk,'"')))return 0;0<c.indexOf("#{",1)?this.interpolateString(c.slice(1,-1)):this.token("STRING",this.escapeLines(c));break;default:return 0}(b=/^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(c))&&this.error("octal escape sequences "+c+" are not allowed"),this.line+=R(c,"\n");return c.length},a.prototype.heredocToken=function(){var a,b,c,d;if(!(c=k.exec(this.chunk)))return 0;b=c[0],d=b.charAt(0),a=this.sanitizeHeredoc(c[2],{quote:d,indent:null}),d==='"'&&0<=a.indexOf("#{")?this.interpolateString(a,{heredoc:!0}):this.token("STRING",this.makeString(a,d,!0)),this.line+=R(b,"\n");return b.length},a.prototype.commentToken=function(){var a,b,c;if(!(c=this.chunk.match(h)))return 0;a=c[0],b=c[1],b&&this.token("HERECOMMENT",this.sanitizeHeredoc(b,{herecomment:!0,indent:Array(this.indent+1).join(" ")})),this.line+=R(a,"\n");return a.length},a.prototype.jsToken=function(){var a,b;if(this.chunk.charAt(0)!=="`"||!(a=s.exec(this.chunk)))return 0;this.token("JS",(b=a[0]).slice(1,-1));return b.length},a.prototype.regexToken=function(){var a,b,c,d,e,f,g;if(this.chunk.charAt(0)!=="/")return 0;if(c=n.exec(this.chunk)){b=this.heregexToken(c),this.line+=R(c[0],"\n");return b}d=T(this.tokens);if(d&&(f=d[0],X.call(d.spaced?C:D,f)>=0))return 0;if(!(c=G.exec(this.chunk)))return 0;g=c,c=g[0],e=g[1],a=g[2],e.slice(0,2)==="/*"&&this.error("regular expressions cannot begin with `*`"),e==="//"&&(e="/(?:)/"),this.token("REGEX",""+e+a);return c.length},a.prototype.heregexToken=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;d=a[0],b=a[1],c=a[2];if(0>b.indexOf("#{")){e=b.replace(o,"").replace(/\//g,"\\/"),e.match(/^\*/)&&this.error("regular expressions cannot begin with `*`"),this.token("REGEX","/"+(e||"(?:)")+"/"+c);return d.length}this.token("IDENTIFIER","RegExp"),this.tokens.push(["CALL_START","("]),g=[],k=this.interpolateString(b,{regex:!0});for(i=0,j=k.length;i<j;i++){l=k[i],f=l[0],h=l[1];if(f==="TOKENS")g.push.apply(g,h);else{if(!(h=h.replace(o,"")))continue;h=h.replace(/\\/g,"\\\\"),g.push(["STRING",this.makeString(h,'"',!0)])}g.push(["+","+"])}g.pop(),((m=g[0])!=null?m[0]:void 0)!=="STRING"&&this.tokens.push(["STRING",'""'],["+","+"]),(n=this.tokens).push.apply(n,g),c&&this.tokens.push([",",","],["STRING",'"'+c+'"']),this.token(")",")");return d.length},a.prototype.lineToken=function(){var a,b,c,d,e,f;if(!(c=B.exec(this.chunk)))return 0;b=c[0],this.line+=R(b,"\n"),this.seenFor=!1,e=T(this.tokens,1),f=b.length-1-b.lastIndexOf("\n"),d=this.unfinished();if(f-this.indebt===this.indent){d?this.suppressNewlines():this.newlineToken();return b.length}if(f>this.indent){if(d){this.indebt=f-this.indent,this.suppressNewlines();return b.length}a=f-this.indent+this.outdebt,this.token("INDENT",a),this.indents.push(a),this.ends.push("OUTDENT"),this.outdebt=this.indebt=0}else this.indebt=0,this.outdentToken(this.indent-f,d);this.indent=f;return b.length},a.prototype.outdentToken=function(a,b){var c,d;while(a>0)d=this.indents.length-1,this.indents[d]===void 0?a=0:this.indents[d]===this.outdebt?(a-=this.outdebt,this.outdebt=0):this.indents[d]<this.outdebt?(this.outdebt-=this.indents[d],a-=this.indents[d]):(c=this.indents.pop()-this.outdebt,a-=c,this.outdebt=0,this.pair("OUTDENT"),this.token("OUTDENT",c));c&&(this.outdebt-=a);while(this.value()===";")this.tokens.pop();this.tag()!=="TERMINATOR"&&!b&&this.token("TERMINATOR","\n");return this},a.prototype.whitespaceToken=function(){var a,b,c;if(!(a=P.exec(this.chunk))&&!(b=this.chunk.charAt(0)==="\n"))return 0;c=T(this.tokens),c&&(c[a?"spaced":"newLine"]=!0);return a?a[0].length:0},a.prototype.newlineToken=function(){while(this.value()===";")this.tokens.pop();this.tag()!=="TERMINATOR"&&this.token("TERMINATOR","\n");return this},a.prototype.suppressNewlines=function(){this.value()==="\\"&&this.tokens.pop();return this},a.prototype.literalToken=function(){var a,b,e,f,g,h,k,l;(a=F.exec(this.chunk))?(f=a[0],d.test(f)&&this.tagParameters()):f=this.chunk.charAt(0),e=f,b=T(this.tokens);if(f==="="&&b){!b[1].reserved&&(g=b[1],X.call(t,g)>=0)&&this.error('reserved word "'+this.value()+"\" can't be assigned");if((h=b[1])==="||"||h==="&&"){b[0]="COMPOUND_ASSIGN",b[1]+="=";return f.length}}if(f===";")this.seenFor=!1,e="TERMINATOR";else if(X.call(z,f)>=0)e="MATH";else if(X.call(i,f)>=0)e="COMPARE";else if(X.call(j,f)>=0)e="COMPOUND_ASSIGN";else if(X.call(O,f)>=0)e="UNARY";else if(X.call(K,f)>=0)e="SHIFT";else if(X.call(x,f)>=0||f==="?"&&(b!=null?b.spaced:void 0))e="LOGIC";else if(b&&!b.spaced)if(f==="("&&(k=b[0],X.call(c,k)>=0))b[0]==="?"&&(b[0]="FUNC_EXIST"),e="CALL_START";else i