mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
2.0.0-beta5 docs
This commit is contained in:
parent
6cea181ff1
commit
458440e57b
14 changed files with 1704 additions and 1050 deletions
|
@ -159,7 +159,7 @@ evaluated from <code>lib/coffeescript</code>.</p>
|
|||
|
||||
<div class="content"><div class='highlight'><pre>exports.VERSION = packageJson.version
|
||||
|
||||
exports.FILE_EXTENSIONS = [<span class="hljs-string">'.coffee'</span>, <span class="hljs-string">'.litcoffee'</span>, <span class="hljs-string">'.coffee.md'</span>]</pre></div></div>
|
||||
exports.FILE_EXTENSIONS = FILE_EXTENSIONS = [<span class="hljs-string">'.coffee'</span>, <span class="hljs-string">'.litcoffee'</span>, <span class="hljs-string">'.coffee.md'</span>]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -252,7 +252,7 @@ didn’t create a source map (faster) but something went wrong and we need
|
|||
a stack trace. Assuming that most of the time, code isn’t throwing
|
||||
exceptions, it’s probably more efficient to compile twice only when we
|
||||
need a stack trace, rather than always generating a source map even when
|
||||
it’s not likely to be used. Save in form of <code>filename</code>: <code>(source)</code></p>
|
||||
it’s not likely to be used. Save in form of <code>filename</code>: [<code>(source)</code>]</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -267,7 +267,7 @@ it’s not likely to be used. Save in form of <code>filename</code>: <code>(sour
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-9">¶</a>
|
||||
</div>
|
||||
<p>Also save source maps if generated, in form of <code>filename</code>: <code>(source map)</code>.</p>
|
||||
<p>Also save source maps if generated, in form of <code>(source)</code>: [<code>(source map)</code>].</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -317,7 +317,8 @@ we need to recompile it to get a source map for <code>prepareStackTrace</code>.<
|
|||
|
||||
checkShebangLine filename, code
|
||||
|
||||
sources[filename] = code
|
||||
sources[filename] ?= []
|
||||
sources[filename].push code
|
||||
map = <span class="hljs-keyword">new</span> SourceMap <span class="hljs-keyword">if</span> generateSourceMap
|
||||
|
||||
tokens = lexer.tokenize code, options</pre></div></div>
|
||||
|
@ -428,8 +429,9 @@ the same name.</p>
|
|||
js = <span class="hljs-string">"// <span class="hljs-subst">#{header}</span>\n<span class="hljs-subst">#{js}</span>"</span>
|
||||
|
||||
<span class="hljs-keyword">if</span> generateSourceMap
|
||||
v3SourceMap = map.generate(options, code)
|
||||
sourceMaps[filename] = map
|
||||
v3SourceMap = map.generate options, code
|
||||
sourceMaps[filename] ?= []
|
||||
sourceMaps[filename].push map
|
||||
|
||||
<span class="hljs-keyword">if</span> options.inlineMap
|
||||
encoded = base64encode JSON.stringify v3SourceMap
|
||||
|
@ -701,9 +703,7 @@ Modified to handle sourceMap</p>
|
|||
<span class="hljs-keyword">else</span>
|
||||
fileLocation
|
||||
<span class="hljs-function">
|
||||
<span class="hljs-title">getSourceMap</span> = <span class="hljs-params">(filename)</span> -></span>
|
||||
<span class="hljs-keyword">if</span> sourceMaps[filename]?
|
||||
sourceMaps[filename]</pre></div></div>
|
||||
<span class="hljs-title">getSourceMap</span> = <span class="hljs-params">(filename, line, column)</span> -></span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -714,22 +714,15 @@ Modified to handle sourceMap</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-28">¶</a>
|
||||
</div>
|
||||
<p>CoffeeScript compiled in a browser may get compiled with <code>options.filename</code>
|
||||
of <code><anonymous></code>, but the browser may request the stack trace with the
|
||||
filename of the script file.</p>
|
||||
<p>Skip files that we didn’t compile, like Node system files that appear in
|
||||
the stack trace, as they never have source maps.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> sourceMaps[<span class="hljs-string">'<anonymous>'</span>]?
|
||||
sourceMaps[<span class="hljs-string">'<anonymous>'</span>]
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> sources[filename]?
|
||||
answer = compile sources[filename],
|
||||
filename: filename
|
||||
sourceMap: <span class="hljs-literal">yes</span>
|
||||
literate: helpers.isLiterate filename
|
||||
answer.sourceMap
|
||||
<span class="hljs-keyword">else</span>
|
||||
<span class="hljs-literal">null</span></pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-literal">null</span> <span class="hljs-keyword">unless</span> filename <span class="hljs-keyword">is</span> <span class="hljs-string">'<anonymous>'</span> <span class="hljs-keyword">or</span> filename.slice(filename.lastIndexOf(<span class="hljs-string">'.'</span>)) <span class="hljs-keyword">in</span> FILE_EXTENSIONS
|
||||
|
||||
<span class="hljs-keyword">if</span> filename <span class="hljs-keyword">isnt</span> <span class="hljs-string">'<anonymous>'</span> <span class="hljs-keyword">and</span> sourceMaps[filename]?
|
||||
<span class="hljs-keyword">return</span> sourceMaps[filename][sourceMaps[filename].length - <span class="hljs-number">1</span>]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -740,6 +733,73 @@ filename of the script file.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-29">¶</a>
|
||||
</div>
|
||||
<p>CoffeeScript compiled in a browser or via <code>CoffeeScript.compile</code> or <code>.run</code>
|
||||
may get compiled with <code>options.filename</code> that’s missing, which becomes
|
||||
<code><anonymous></code>; but the runtime might request the stack trace with the
|
||||
filename of the script file. See if we have a source map cached under
|
||||
<code><anonymous></code> that matches the error.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> sourceMaps[<span class="hljs-string">'<anonymous>'</span>]?</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-30">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-30">¶</a>
|
||||
</div>
|
||||
<p>Work backwards from the most recent anonymous source maps, until we find
|
||||
one that works. This isn’t foolproof; there is a chance that multiple
|
||||
source maps will have line/column pairs that match. But we have no other
|
||||
way to match them. <code>frame.getFunction().toString()</code> doesn’t always work,
|
||||
and it’s not foolproof either.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">for</span> map <span class="hljs-keyword">in</span> sourceMaps[<span class="hljs-string">'<anonymous>'</span>] <span class="hljs-keyword">by</span> <span class="hljs-number">-1</span>
|
||||
sourceLocation = map.sourceLocation [line - <span class="hljs-number">1</span>, column - <span class="hljs-number">1</span>]
|
||||
<span class="hljs-keyword">return</span> map <span class="hljs-keyword">if</span> sourceLocation?[<span class="hljs-number">0</span>]? <span class="hljs-keyword">and</span> sourceLocation[<span class="hljs-number">1</span>]?</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-31">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-31">¶</a>
|
||||
</div>
|
||||
<p>If all else fails, recompile this source to get a source map. We need the
|
||||
previous section (for <code><anonymous></code>) despite this option, because after it
|
||||
gets compiled we will still need to look it up from
|
||||
<code>sourceMaps['<anonymous>']</code> in order to find and return it. That’s why we
|
||||
start searching from the end in the previous block, because most of the
|
||||
time the source map we want is the last one.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> sources[filename]?
|
||||
answer = compile sources[filename][sources[filename].length - <span class="hljs-number">1</span>],
|
||||
filename: filename
|
||||
sourceMap: <span class="hljs-literal">yes</span>
|
||||
literate: helpers.isLiterate filename
|
||||
answer.sourceMap
|
||||
<span class="hljs-keyword">else</span>
|
||||
<span class="hljs-literal">null</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-32">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-32">¶</a>
|
||||
</div>
|
||||
<p>Based on <a href="http://goo.gl/ZTx1p">michaelficarra/CoffeeScriptRedux</a>
|
||||
NodeJS / V8 have no support for transforming positions in stack traces using
|
||||
sourceMap, so we must monkey-patch Error to display CoffeeScript source
|
||||
|
@ -749,7 +809,7 @@ positions.</p>
|
|||
|
||||
<div class="content"><div class='highlight'><pre>Error.prepareStackTrace = <span class="hljs-function"><span class="hljs-params">(err, stack)</span> -></span>
|
||||
<span class="hljs-function"> <span class="hljs-title">getSourceMapping</span> = <span class="hljs-params">(filename, line, column)</span> -></span>
|
||||
sourceMap = getSourceMap filename
|
||||
sourceMap = getSourceMap filename, line, column
|
||||
answer = sourceMap.sourceLocation [line - <span class="hljs-number">1</span>, column - <span class="hljs-number">1</span>] <span class="hljs-keyword">if</span> sourceMap?
|
||||
<span class="hljs-keyword">if</span> answer? <span class="hljs-keyword">then</span> [answer[<span class="hljs-number">0</span>] + <span class="hljs-number">1</span>, answer[<span class="hljs-number">1</span>] + <span class="hljs-number">1</span>] <span class="hljs-keyword">else</span> <span class="hljs-literal">null</span>
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ useWinPathSep = path.sep <span class="hljs-keyword">is</span> <span class="hljs
|
|||
[<span class="hljs-string">'-n'</span>, <span class="hljs-string">'--nodes'</span>, <span class="hljs-string">'print out the parse tree that the parser produces'</span>]
|
||||
[ <span class="hljs-string">'--nodejs [ARGS]'</span>, <span class="hljs-string">'pass options directly to the "node" binary'</span>]
|
||||
[ <span class="hljs-string">'--no-header'</span>, <span class="hljs-string">'suppress the "Generated by" header'</span>]
|
||||
[<span class="hljs-string">'-o'</span>, <span class="hljs-string">'--output [DIR]'</span>, <span class="hljs-string">'set the output directory for compiled JavaScript'</span>]
|
||||
[<span class="hljs-string">'-o'</span>, <span class="hljs-string">'--output [PATH]'</span>, <span class="hljs-string">'set the output path or path/filename for compiled JavaScript'</span>]
|
||||
[<span class="hljs-string">'-p'</span>, <span class="hljs-string">'--print'</span>, <span class="hljs-string">'print out the compiled JavaScript'</span>]
|
||||
[<span class="hljs-string">'-r'</span>, <span class="hljs-string">'--require [MODULE*]'</span>, <span class="hljs-string">'require the given module before eval or REPL'</span>]
|
||||
[<span class="hljs-string">'-s'</span>, <span class="hljs-string">'--stdio'</span>, <span class="hljs-string">'listen for and compile scripts over stdio'</span>]
|
||||
|
@ -305,7 +305,45 @@ Many flags cause us to divert before compiling anything. Flags passed after
|
|||
process.argv = process.argv[<span class="hljs-number">0.</span><span class="hljs-number">.1</span>].concat literals
|
||||
process.argv[<span class="hljs-number">0</span>] = <span class="hljs-string">'coffee'</span>
|
||||
|
||||
opts.output = path.resolve opts.output <span class="hljs-keyword">if</span> opts.output
|
||||
<span class="hljs-keyword">if</span> opts.output
|
||||
outputBasename = path.basename opts.output
|
||||
<span class="hljs-keyword">if</span> <span class="hljs-string">'.'</span> <span class="hljs-keyword">in</span> outputBasename <span class="hljs-keyword">and</span>
|
||||
outputBasename <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> [<span class="hljs-string">'.'</span>, <span class="hljs-string">'..'</span>] <span class="hljs-keyword">and</span>
|
||||
<span class="hljs-keyword">not</span> helpers.ends(opts.output, path.sep)</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-9">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-9">¶</a>
|
||||
</div>
|
||||
<p>An output filename was specified, e.g. <code>/dist/scripts.js</code>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> opts.outputFilename = outputBasename
|
||||
opts.outputPath = path.resolve path.dirname opts.output
|
||||
<span class="hljs-keyword">else</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-10">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-10">¶</a>
|
||||
</div>
|
||||
<p>An output path was specified, e.g. <code>/dist</code>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> opts.outputFilename = <span class="hljs-literal">null</span>
|
||||
opts.outputPath = path.resolve opts.output
|
||||
|
||||
<span class="hljs-keyword">if</span> opts.join
|
||||
opts.join = path.resolve opts.join
|
||||
<span class="hljs-built_in">console</span>.error <span class="hljs-string">'''
|
||||
|
@ -328,19 +366,19 @@ Many flags cause us to divert before compiling anything. Flags passed after
|
|||
<span class="hljs-function">
|
||||
<span class="hljs-title">makePrelude</span> = <span class="hljs-params">(requires)</span> -></span>
|
||||
requires.map (<span class="hljs-built_in">module</span>) ->
|
||||
[_, name, <span class="hljs-built_in">module</span>] = match <span class="hljs-keyword">if</span> match = <span class="hljs-built_in">module</span>.match(<span class="hljs-regexp">/^(.*)=(.*)$/</span>)
|
||||
name ||= helpers.baseFileName <span class="hljs-built_in">module</span>, <span class="hljs-literal">yes</span>, useWinPathSep
|
||||
<span class="hljs-string">"<span class="hljs-subst">#{name}</span> = require('<span class="hljs-subst">#{<span class="hljs-built_in">module</span>}</span>')"</span>
|
||||
[full, name, <span class="hljs-built_in">module</span>] = match <span class="hljs-keyword">if</span> match = <span class="hljs-built_in">module</span>.match(<span class="hljs-regexp">/^(.*)=(.*)$/</span>)
|
||||
name <span class="hljs-keyword">or</span>= helpers.baseFileName <span class="hljs-built_in">module</span>, <span class="hljs-literal">yes</span>, useWinPathSep
|
||||
<span class="hljs-string">"global['<span class="hljs-subst">#{name}</span>'] = require('<span class="hljs-subst">#{<span class="hljs-built_in">module</span>}</span>')"</span>
|
||||
.join <span class="hljs-string">';'</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-9">
|
||||
<li id="section-11">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-9">¶</a>
|
||||
<a class="pilcrow" href="#section-11">¶</a>
|
||||
</div>
|
||||
<p>Compile a path, which could be a script or a directory. If a directory
|
||||
is passed, recursively compile all ‘.coffee’, ‘.litcoffee’, and ‘.coffee.md’
|
||||
|
@ -382,7 +420,7 @@ extension source files in it and all subdirectories.</p>
|
|||
code = fs.readFileSync source
|
||||
<span class="hljs-keyword">catch</span> err
|
||||
<span class="hljs-keyword">if</span> err.code <span class="hljs-keyword">is</span> <span class="hljs-string">'ENOENT'</span> <span class="hljs-keyword">then</span> <span class="hljs-keyword">return</span> <span class="hljs-keyword">else</span> <span class="hljs-keyword">throw</span> err
|
||||
compileScript(source, code.toString(), base)
|
||||
compileScript source, code.toString(), base
|
||||
<span class="hljs-keyword">else</span>
|
||||
notSources[source] = <span class="hljs-literal">yes</span>
|
||||
<span class="hljs-function">
|
||||
|
@ -399,53 +437,56 @@ extension source files in it and all subdirectories.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-10">
|
||||
<li id="section-12">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-10">¶</a>
|
||||
<a class="pilcrow" href="#section-12">¶</a>
|
||||
</div>
|
||||
<p>Compile a single source script, containing the given code, according to the
|
||||
requested options. If evaluating the script directly sets <code>__filename</code>,
|
||||
requested options. If evaluating the script directly, set <code>__filename</code>,
|
||||
<code>__dirname</code> and <code>module.filename</code> to be correct relative to the script’s path.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">compileScript</span> = <span class="hljs-params">(file, input, base = <span class="hljs-literal">null</span>)</span> -></span>
|
||||
o = opts
|
||||
options = compileOptions file, base
|
||||
<span class="hljs-keyword">try</span>
|
||||
t = task = {file, input, options}
|
||||
task = {file, input, options}
|
||||
CoffeeScript.emit <span class="hljs-string">'compile'</span>, task
|
||||
<span class="hljs-keyword">if</span> o.tokens
|
||||
printTokens CoffeeScript.tokens t.input, t.options
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.nodes
|
||||
printLine CoffeeScript.nodes(t.input, t.options).toString().trim()
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.run
|
||||
<span class="hljs-keyword">if</span> opts.tokens
|
||||
printTokens CoffeeScript.tokens task.input, task.options
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> opts.nodes
|
||||
printLine CoffeeScript.nodes(task.input, task.options).toString().trim()
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> opts.run
|
||||
CoffeeScript.register()
|
||||
CoffeeScript.eval opts.prelude, t.options <span class="hljs-keyword">if</span> opts.prelude
|
||||
CoffeeScript.run t.input, t.options
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.join <span class="hljs-keyword">and</span> t.file <span class="hljs-keyword">isnt</span> o.join
|
||||
t.input = helpers.invertLiterate t.input <span class="hljs-keyword">if</span> helpers.isLiterate file
|
||||
sourceCode[sources.indexOf(t.file)] = t.input
|
||||
CoffeeScript.eval opts.prelude, task.options <span class="hljs-keyword">if</span> opts.prelude
|
||||
CoffeeScript.run task.input, task.options
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> opts.join <span class="hljs-keyword">and</span> task.file <span class="hljs-keyword">isnt</span> opts.join
|
||||
task.input = helpers.invertLiterate task.input <span class="hljs-keyword">if</span> helpers.isLiterate file
|
||||
sourceCode[sources.indexOf(task.file)] = task.input
|
||||
compileJoin()
|
||||
<span class="hljs-keyword">else</span>
|
||||
compiled = CoffeeScript.compile t.input, t.options
|
||||
t.output = compiled
|
||||
<span class="hljs-keyword">if</span> o.map
|
||||
t.output = compiled.js
|
||||
t.sourceMap = compiled.v3SourceMap
|
||||
compiled = CoffeeScript.compile task.input, task.options
|
||||
task.output = compiled
|
||||
<span class="hljs-keyword">if</span> opts.map
|
||||
task.output = compiled.js
|
||||
task.sourceMap = compiled.v3SourceMap
|
||||
|
||||
CoffeeScript.emit <span class="hljs-string">'success'</span>, task
|
||||
<span class="hljs-keyword">if</span> o.<span class="hljs-built_in">print</span>
|
||||
printLine t.output.trim()
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> o.compile <span class="hljs-keyword">or</span> o.map
|
||||
writeJs base, t.file, t.output, options.jsPath, t.sourceMap
|
||||
<span class="hljs-keyword">if</span> opts.<span class="hljs-built_in">print</span>
|
||||
printLine task.output.trim()
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> opts.compile <span class="hljs-keyword">or</span> opts.map
|
||||
saveTo = <span class="hljs-keyword">if</span> opts.outputFilename <span class="hljs-keyword">and</span> sources.length <span class="hljs-keyword">is</span> <span class="hljs-number">1</span>
|
||||
path.join opts.outputPath, opts.outputFilename
|
||||
<span class="hljs-keyword">else</span>
|
||||
options.jsPath
|
||||
writeJs base, task.file, task.output, saveTo, task.sourceMap
|
||||
<span class="hljs-keyword">catch</span> err
|
||||
CoffeeScript.emit <span class="hljs-string">'failure'</span>, err, task
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> CoffeeScript.listeners(<span class="hljs-string">'failure'</span>).length
|
||||
message = err?.stack <span class="hljs-keyword">or</span> <span class="hljs-string">"<span class="hljs-subst">#{err}</span>"</span>
|
||||
<span class="hljs-keyword">if</span> o.watch
|
||||
<span class="hljs-keyword">if</span> opts.watch
|
||||
printLine message + <span class="hljs-string">'\x07'</span>
|
||||
<span class="hljs-keyword">else</span>
|
||||
printWarn message
|
||||
|
@ -454,11 +495,11 @@ requested options. If evaluating the script directly sets <code>__filename</code
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-11">
|
||||
<li id="section-13">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-11">¶</a>
|
||||
<a class="pilcrow" href="#section-13">¶</a>
|
||||
</div>
|
||||
<p>Attach the appropriate listeners to compile scripts incoming over <strong>stdin</strong>,
|
||||
and write them back to <strong>stdout</strong>.</p>
|
||||
|
@ -476,11 +517,11 @@ and write them back to <strong>stdout</strong>.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-12">
|
||||
<li id="section-14">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-12">¶</a>
|
||||
<a class="pilcrow" href="#section-14">¶</a>
|
||||
</div>
|
||||
<p>If all of the source files are done being read, concatenate and compile
|
||||
them together.</p>
|
||||
|
@ -498,11 +539,11 @@ them together.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-13">
|
||||
<li id="section-15">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-13">¶</a>
|
||||
<a class="pilcrow" href="#section-15">¶</a>
|
||||
</div>
|
||||
<p>Watch a source CoffeeScript file using <code>fs.watch</code>, recompiling it every
|
||||
time the file is updated. May be used in combination with other options,
|
||||
|
@ -558,11 +599,11 @@ such as <code>--print</code>.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-14">
|
||||
<li id="section-16">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-14">¶</a>
|
||||
<a class="pilcrow" href="#section-16">¶</a>
|
||||
</div>
|
||||
<p>Watch a directory of files for new additions.</p>
|
||||
|
||||
|
@ -609,11 +650,11 @@ such as <code>--print</code>.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-15">
|
||||
<li id="section-17">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-15">¶</a>
|
||||
<a class="pilcrow" href="#section-17">¶</a>
|
||||
</div>
|
||||
<p>Remove a file from our source list, and source code cache. Optionally remove
|
||||
the compiled JS version as well.</p>
|
||||
|
@ -638,11 +679,11 @@ the compiled JS version as well.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-16">
|
||||
<li id="section-18">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-16">¶</a>
|
||||
<a class="pilcrow" href="#section-18">¶</a>
|
||||
</div>
|
||||
<p>Get the corresponding output JavaScript path for a source file.</p>
|
||||
|
||||
|
@ -651,22 +692,22 @@ the compiled JS version as well.</p>
|
|||
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">outputPath</span> = <span class="hljs-params">(source, base, extension=<span class="hljs-string">".js"</span>)</span> -></span>
|
||||
basename = helpers.baseFileName source, <span class="hljs-literal">yes</span>, useWinPathSep
|
||||
srcDir = path.dirname source
|
||||
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> opts.output
|
||||
dir = srcDir
|
||||
dir = <span class="hljs-keyword">unless</span> opts.outputPath
|
||||
srcDir
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> source <span class="hljs-keyword">is</span> base
|
||||
dir = opts.output
|
||||
opts.outputPath
|
||||
<span class="hljs-keyword">else</span>
|
||||
dir = path.join opts.output, path.relative base, srcDir
|
||||
path.join opts.outputPath, path.relative base, srcDir
|
||||
path.join dir, basename + extension</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-17">
|
||||
<li id="section-19">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-17">¶</a>
|
||||
<a class="pilcrow" href="#section-19">¶</a>
|
||||
</div>
|
||||
<p>Recursively mkdir, like <code>mkdir -p</code>.</p>
|
||||
|
||||
|
@ -688,11 +729,11 @@ the compiled JS version as well.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-18">
|
||||
<li id="section-20">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-18">¶</a>
|
||||
<a class="pilcrow" href="#section-20">¶</a>
|
||||
</div>
|
||||
<p>Write out a JavaScript source file with the compiled code. By default, files
|
||||
are written out in <code>cwd</code> as <code>.js</code> files with the same name, but the output
|
||||
|
@ -726,11 +767,11 @@ same directory as the <code>.js</code> file.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-19">
|
||||
<li id="section-21">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-19">¶</a>
|
||||
<a class="pilcrow" href="#section-21">¶</a>
|
||||
</div>
|
||||
<p>Convenience for cleaner setTimeouts.</p>
|
||||
|
||||
|
@ -741,11 +782,11 @@ same directory as the <code>.js</code> file.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-20">
|
||||
<li id="section-22">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-20">¶</a>
|
||||
<a class="pilcrow" href="#section-22">¶</a>
|
||||
</div>
|
||||
<p>When watching scripts, it’s useful to log changes with the timestamp.</p>
|
||||
|
||||
|
@ -757,11 +798,11 @@ same directory as the <code>.js</code> file.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-21">
|
||||
<li id="section-23">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-21">¶</a>
|
||||
<a class="pilcrow" href="#section-23">¶</a>
|
||||
</div>
|
||||
<p>Pretty-print a stream of tokens, sans location data.</p>
|
||||
|
||||
|
@ -777,11 +818,11 @@ same directory as the <code>.js</code> file.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-22">
|
||||
<li id="section-24">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-22">¶</a>
|
||||
<a class="pilcrow" href="#section-24">¶</a>
|
||||
</div>
|
||||
<p>Use the <a href="optparse.html">OptionParser module</a> to extract all options from
|
||||
<code>process.argv</code> that are specified in <code>SWITCHES</code>.</p>
|
||||
|
@ -797,11 +838,11 @@ same directory as the <code>.js</code> file.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-23">
|
||||
<li id="section-25">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-23">¶</a>
|
||||
<a class="pilcrow" href="#section-25">¶</a>
|
||||
</div>
|
||||
<p>The compile-time options to pass to the CoffeeScript compiler.</p>
|
||||
|
||||
|
@ -837,11 +878,11 @@ same directory as the <code>.js</code> file.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-24">
|
||||
<li id="section-26">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-24">¶</a>
|
||||
<a class="pilcrow" href="#section-26">¶</a>
|
||||
</div>
|
||||
<p>Start up a new Node.js instance with the arguments in <code>--nodejs</code> passed to
|
||||
the <code>node</code> binary, preserving the other options.</p>
|
||||
|
@ -864,11 +905,11 @@ the <code>node</code> binary, preserving the other options.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-25">
|
||||
<li id="section-27">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-25">¶</a>
|
||||
<a class="pilcrow" href="#section-27">¶</a>
|
||||
</div>
|
||||
<p>Print the <code>--help</code> usage message and exit. Deprecated switches are not
|
||||
shown.</p>
|
||||
|
@ -881,11 +922,11 @@ shown.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-26">
|
||||
<li id="section-28">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-26">¶</a>
|
||||
<a class="pilcrow" href="#section-28">¶</a>
|
||||
</div>
|
||||
<p>Print the <code>--version</code> message and exit.</p>
|
||||
|
||||
|
|
|
@ -788,6 +788,7 @@ that hoovers up the remaining arguments.</p>
|
|||
<div class="content"><div class='highlight'><pre> SimpleAssignable: [
|
||||
o <span class="hljs-string">'Identifier'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'Value Accessor'</span>, <span class="hljs-function">-></span> $<span class="hljs-number">1.</span>add $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'Code Accessor'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value($<span class="hljs-number">1</span>).add $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'ThisProperty'</span>
|
||||
]</pre></div></div>
|
||||
|
||||
|
|
|
@ -1000,7 +1000,7 @@ inwards past several recorded indents. Sets new @indent value.</p>
|
|||
@token <span class="hljs-string">'OUTDENT'</span>, moveOut, <span class="hljs-number">0</span>, outdentLength
|
||||
moveOut -= dent
|
||||
@outdebt -= moveOut <span class="hljs-keyword">if</span> dent
|
||||
@tokens.pop() <span class="hljs-keyword">while</span> @value() <span class="hljs-keyword">is</span> <span class="hljs-string">';'</span>
|
||||
@suppressSemicolons()
|
||||
|
||||
@token <span class="hljs-string">'TERMINATOR'</span>, <span class="hljs-string">'\n'</span>, outdentLength, <span class="hljs-number">0</span> <span class="hljs-keyword">unless</span> @tag() <span class="hljs-keyword">is</span> <span class="hljs-string">'TERMINATOR'</span> <span class="hljs-keyword">or</span> noNewlines
|
||||
@indent = decreasedIndent
|
||||
|
@ -1042,7 +1042,7 @@ as being “spaced”, because there are some cases where it makes a difference.
|
|||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> newlineToken: <span class="hljs-function"><span class="hljs-params">(offset)</span> -></span>
|
||||
@tokens.pop() <span class="hljs-keyword">while</span> @value() <span class="hljs-keyword">is</span> <span class="hljs-string">';'</span>
|
||||
@suppressSemicolons()
|
||||
@token <span class="hljs-string">'TERMINATOR'</span>, <span class="hljs-string">'\n'</span>, offset, <span class="hljs-number">0</span> <span class="hljs-keyword">unless</span> @tag() <span class="hljs-keyword">is</span> <span class="hljs-string">'TERMINATOR'</span>
|
||||
<span class="hljs-keyword">this</span></pre></div></div>
|
||||
|
||||
|
@ -1278,9 +1278,10 @@ parentheses that indicate a method call from regular parentheses, and so on.</p>
|
|||
@exportSpecifierList = <span class="hljs-literal">no</span>
|
||||
|
||||
<span class="hljs-keyword">if</span> value <span class="hljs-keyword">is</span> <span class="hljs-string">';'</span>
|
||||
@error <span class="hljs-string">'unexpected ;'</span> <span class="hljs-keyword">if</span> prev?[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> [<span class="hljs-string">'='</span>, UNFINISHED...]
|
||||
@seenFor = @seenImport = @seenExport = <span class="hljs-literal">no</span>
|
||||
tag = <span class="hljs-string">'TERMINATOR'</span>
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">is</span> <span class="hljs-string">'*'</span> <span class="hljs-keyword">and</span> prev[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'EXPORT'</span>
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">is</span> <span class="hljs-string">'*'</span> <span class="hljs-keyword">and</span> prev?[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'EXPORT'</span>
|
||||
tag = <span class="hljs-string">'EXPORT_ALL'</span>
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">in</span> MATH <span class="hljs-keyword">then</span> tag = <span class="hljs-string">'MATH'</span>
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">in</span> COMPARE <span class="hljs-keyword">then</span> tag = <span class="hljs-string">'COMPARE'</span>
|
||||
|
@ -1289,11 +1290,12 @@ parentheses that indicate a method call from regular parentheses, and so on.</p>
|
|||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">in</span> UNARY_MATH <span class="hljs-keyword">then</span> tag = <span class="hljs-string">'UNARY_MATH'</span>
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">in</span> SHIFT <span class="hljs-keyword">then</span> tag = <span class="hljs-string">'SHIFT'</span>
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">is</span> <span class="hljs-string">'?'</span> <span class="hljs-keyword">and</span> prev?.spaced <span class="hljs-keyword">then</span> tag = <span class="hljs-string">'BIN?'</span>
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> prev <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> prev.spaced
|
||||
<span class="hljs-keyword">if</span> value <span class="hljs-keyword">is</span> <span class="hljs-string">'('</span> <span class="hljs-keyword">and</span> prev[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> CALLABLE
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> prev
|
||||
<span class="hljs-keyword">if</span> value <span class="hljs-keyword">is</span> <span class="hljs-string">'('</span> <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> prev.spaced <span class="hljs-keyword">and</span> prev[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> CALLABLE
|
||||
prev[<span class="hljs-number">0</span>] = <span class="hljs-string">'FUNC_EXIST'</span> <span class="hljs-keyword">if</span> prev[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'?'</span>
|
||||
tag = <span class="hljs-string">'CALL_START'</span>
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">is</span> <span class="hljs-string">'['</span> <span class="hljs-keyword">and</span> prev[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> INDEXABLE
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">is</span> <span class="hljs-string">'['</span> <span class="hljs-keyword">and</span> ((prev[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> INDEXABLE <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> prev.spaced) <span class="hljs-keyword">or</span>
|
||||
(prev[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'::'</span>)) <span class="hljs-comment"># `.prototype` can’t be a method you can call.</span>
|
||||
tag = <span class="hljs-string">'INDEX_START'</span>
|
||||
<span class="hljs-keyword">switch</span> prev[<span class="hljs-number">0</span>]
|
||||
<span class="hljs-keyword">when</span> <span class="hljs-string">'?'</span> <span class="hljs-keyword">then</span> prev[<span class="hljs-number">0</span>] = <span class="hljs-string">'INDEX_SOAK'</span>
|
||||
|
@ -1590,7 +1592,8 @@ of <code>'NEOSTRING'</code>s are converted using <code>fn</code> and tur
|
|||
<span class="hljs-keyword">for</span> token, i <span class="hljs-keyword">in</span> tokens
|
||||
[tag, value] = token
|
||||
<span class="hljs-keyword">switch</span> tag
|
||||
<span class="hljs-keyword">when</span> <span class="hljs-string">'TOKENS'</span></pre></div></div>
|
||||
<span class="hljs-keyword">when</span> <span class="hljs-string">'TOKENS'</span>
|
||||
<span class="hljs-keyword">if</span> value.length <span class="hljs-keyword">is</span> <span class="hljs-number">2</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -1605,7 +1608,7 @@ of <code>'NEOSTRING'</code>s are converted using <code>fn</code> and tur
|
|||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">continue</span> <span class="hljs-keyword">if</span> value.length <span class="hljs-keyword">is</span> <span class="hljs-number">2</span></pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">continue</span> <span class="hljs-keyword">unless</span> value[<span class="hljs-number">0</span>].comments <span class="hljs-keyword">or</span> value[<span class="hljs-number">1</span>].comments</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -1616,6 +1619,59 @@ of <code>'NEOSTRING'</code>s are converted using <code>fn</code> and tur
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-57">¶</a>
|
||||
</div>
|
||||
<p>There are comments (and nothing else) in this interpolation.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> @csxDepth <span class="hljs-keyword">is</span> <span class="hljs-number">0</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-58">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-58">¶</a>
|
||||
</div>
|
||||
<p>This is an interpolated string, not a CSX tag; and for whatever
|
||||
reason <code>`a${/*test*/}b` </code> is invalid JS. So compile to
|
||||
<code>`a${/*test*/''}b` </code> instead.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> placeholderToken = @makeToken <span class="hljs-string">'STRING'</span>, <span class="hljs-string">"''"</span>
|
||||
<span class="hljs-keyword">else</span>
|
||||
placeholderToken = @makeToken <span class="hljs-string">'JS'</span>, <span class="hljs-string">''</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-59">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-59">¶</a>
|
||||
</div>
|
||||
<p>Use the same location data as the first parenthesis.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> placeholderToken[<span class="hljs-number">2</span>] = value[<span class="hljs-number">0</span>][<span class="hljs-number">2</span>]
|
||||
<span class="hljs-keyword">for</span> val <span class="hljs-keyword">in</span> value <span class="hljs-keyword">when</span> val.comments
|
||||
placeholderToken.comments ?= []
|
||||
placeholderToken.comments.push val.comments...
|
||||
value.splice <span class="hljs-number">1</span>, <span class="hljs-number">0</span>, placeholderToken</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-60">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-60">¶</a>
|
||||
</div>
|
||||
<p>Push all the tokens in the fake <code>'TOKENS'</code> token. These already have
|
||||
sane location data.</p>
|
||||
|
||||
|
@ -1628,11 +1684,11 @@ sane location data.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-58">
|
||||
<li id="section-61">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-58">¶</a>
|
||||
<a class="pilcrow" href="#section-61">¶</a>
|
||||
</div>
|
||||
<p>Convert <code>'NEOSTRING'</code> into <code>'STRING'</code>.</p>
|
||||
|
||||
|
@ -1643,11 +1699,11 @@ sane location data.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-59">
|
||||
<li id="section-62">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-59">¶</a>
|
||||
<a class="pilcrow" href="#section-62">¶</a>
|
||||
</div>
|
||||
<p>Optimize out empty strings. We ensure that the tokens stream always
|
||||
starts with a string token, though, to make sure that the result
|
||||
|
@ -1664,11 +1720,11 @@ really is a string.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-60">
|
||||
<li id="section-63">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-60">¶</a>
|
||||
<a class="pilcrow" href="#section-63">¶</a>
|
||||
</div>
|
||||
<p>However, there is one case where we can optimize away a starting
|
||||
empty string.</p>
|
||||
|
@ -1686,11 +1742,11 @@ empty string.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-61">
|
||||
<li id="section-64">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-61">¶</a>
|
||||
<a class="pilcrow" href="#section-64">¶</a>
|
||||
</div>
|
||||
<p>Create a 0-length “+” token.</p>
|
||||
|
||||
|
@ -1723,11 +1779,11 @@ empty string.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-62">
|
||||
<li id="section-65">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-62">¶</a>
|
||||
<a class="pilcrow" href="#section-65">¶</a>
|
||||
</div>
|
||||
<p>Pairs up a closing token, ensuring that all listed pairs of tokens are
|
||||
correctly balanced throughout the course of the token stream.</p>
|
||||
|
@ -1742,11 +1798,11 @@ correctly balanced throughout the course of the token stream.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-63">
|
||||
<li id="section-66">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-63">¶</a>
|
||||
<a class="pilcrow" href="#section-66">¶</a>
|
||||
</div>
|
||||
<p>Auto-close <code>INDENT</code> to support syntax like this:</p>
|
||||
<pre><code>el.click(<span class="hljs-function"><span class="hljs-params">(event)</span> -></span>
|
||||
|
@ -1762,11 +1818,11 @@ correctly balanced throughout the course of the token stream.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-64">
|
||||
<li id="section-67">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-64">¶</a>
|
||||
<a class="pilcrow" href="#section-67">¶</a>
|
||||
</div>
|
||||
<h2 id="helpers">Helpers</h2>
|
||||
|
||||
|
@ -1775,11 +1831,11 @@ correctly balanced throughout the course of the token stream.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-65">
|
||||
<li id="section-68">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-65">¶</a>
|
||||
<a class="pilcrow" href="#section-68">¶</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -1787,11 +1843,11 @@ correctly balanced throughout the course of the token stream.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-66">
|
||||
<li id="section-69">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-66">¶</a>
|
||||
<a class="pilcrow" href="#section-69">¶</a>
|
||||
</div>
|
||||
<p>Returns the line and column number from an offset into the current chunk.</p>
|
||||
<p><code>offset</code> is a number of characters into <code>@chunk</code>.</p>
|
||||
|
@ -1821,11 +1877,11 @@ correctly balanced throughout the course of the token stream.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-67">
|
||||
<li id="section-70">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-67">¶</a>
|
||||
<a class="pilcrow" href="#section-70">¶</a>
|
||||
</div>
|
||||
<p>Same as <code>token</code>, except this just returns the token without adding it
|
||||
to the results.</p>
|
||||
|
@ -1840,11 +1896,11 @@ to the results.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-68">
|
||||
<li id="section-71">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-68">¶</a>
|
||||
<a class="pilcrow" href="#section-71">¶</a>
|
||||
</div>
|
||||
<p>Use length - 1 for the final offset - we’re supplying the last_line and the last_column,
|
||||
so if last_column == first_column, then we’re looking at a character of length 1.</p>
|
||||
|
@ -1862,11 +1918,11 @@ so if last_column == first_column, then we’re looking at a character of length
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-69">
|
||||
<li id="section-72">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-69">¶</a>
|
||||
<a class="pilcrow" href="#section-72">¶</a>
|
||||
</div>
|
||||
<p>Add a token to the results.
|
||||
<code>offset</code> is the offset into the current <code>@chunk</code> where the token starts.
|
||||
|
@ -1885,11 +1941,11 @@ not specified, the length of <code>value</code> will be used.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-70">
|
||||
<li id="section-73">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-70">¶</a>
|
||||
<a class="pilcrow" href="#section-73">¶</a>
|
||||
</div>
|
||||
<p>Peek at the last tag in the token stream.</p>
|
||||
|
||||
|
@ -1902,11 +1958,11 @@ not specified, the length of <code>value</code> will be used.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-71">
|
||||
<li id="section-74">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-71">¶</a>
|
||||
<a class="pilcrow" href="#section-74">¶</a>
|
||||
</div>
|
||||
<p>Peek at the last value in the token stream.</p>
|
||||
|
||||
|
@ -1919,11 +1975,11 @@ not specified, the length of <code>value</code> will be used.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-72">
|
||||
<li id="section-75">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-72">¶</a>
|
||||
<a class="pilcrow" href="#section-75">¶</a>
|
||||
</div>
|
||||
<p>Get the previous token in the token stream.</p>
|
||||
|
||||
|
@ -1935,11 +1991,11 @@ not specified, the length of <code>value</code> will be used.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-73">
|
||||
<li id="section-76">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-73">¶</a>
|
||||
<a class="pilcrow" href="#section-76">¶</a>
|
||||
</div>
|
||||
<p>Are we in the midst of an unfinished expression?</p>
|
||||
|
||||
|
@ -1967,11 +2023,11 @@ not specified, the length of <code>value</code> will be used.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-74">
|
||||
<li id="section-77">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-74">¶</a>
|
||||
<a class="pilcrow" href="#section-77">¶</a>
|
||||
</div>
|
||||
<p>surrogate pair</p>
|
||||
|
||||
|
@ -1984,11 +2040,11 @@ not specified, the length of <code>value</code> will be used.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-75">
|
||||
<li id="section-78">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-75">¶</a>
|
||||
<a class="pilcrow" href="#section-78">¶</a>
|
||||
</div>
|
||||
<p>Replace <code>\u{...}</code> with <code>\uxxxx[\uxxxx]</code> in regexes without <code>u</code> flag</p>
|
||||
|
||||
|
@ -2011,11 +2067,11 @@ not specified, the length of <code>value</code> will be used.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-76">
|
||||
<li id="section-79">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-76">¶</a>
|
||||
<a class="pilcrow" href="#section-79">¶</a>
|
||||
</div>
|
||||
<p>Validates escapes in strings and regexes.</p>
|
||||
|
||||
|
@ -2043,11 +2099,11 @@ not specified, the length of <code>value</code> will be used.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-77">
|
||||
<li id="section-80">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-77">¶</a>
|
||||
<a class="pilcrow" href="#section-80">¶</a>
|
||||
</div>
|
||||
<p>Constructs a string or regex by escaping certain characters.</p>
|
||||
|
||||
|
@ -2067,11 +2123,11 @@ not specified, the length of <code>value</code> will be used.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-78">
|
||||
<li id="section-81">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-78">¶</a>
|
||||
<a class="pilcrow" href="#section-81">¶</a>
|
||||
</div>
|
||||
<p>Ignore escaped backslashes.</p>
|
||||
|
||||
|
@ -2085,16 +2141,21 @@ not specified, the length of <code>value</code> will be used.</p>
|
|||
<span class="hljs-keyword">when</span> ls <span class="hljs-keyword">then</span> <span class="hljs-string">'\\u2028'</span>
|
||||
<span class="hljs-keyword">when</span> ps <span class="hljs-keyword">then</span> <span class="hljs-string">'\\u2029'</span>
|
||||
<span class="hljs-keyword">when</span> other <span class="hljs-keyword">then</span> (<span class="hljs-keyword">if</span> options.double <span class="hljs-keyword">then</span> <span class="hljs-string">"\\<span class="hljs-subst">#{other}</span>"</span> <span class="hljs-keyword">else</span> other)
|
||||
<span class="hljs-string">"<span class="hljs-subst">#{options.delimiter}</span><span class="hljs-subst">#{body}</span><span class="hljs-subst">#{options.delimiter}</span>"</span></pre></div></div>
|
||||
<span class="hljs-string">"<span class="hljs-subst">#{options.delimiter}</span><span class="hljs-subst">#{body}</span><span class="hljs-subst">#{options.delimiter}</span>"</span>
|
||||
|
||||
suppressSemicolons: <span class="hljs-function">-></span>
|
||||
<span class="hljs-keyword">while</span> @value() <span class="hljs-keyword">is</span> <span class="hljs-string">';'</span>
|
||||
@tokens.pop()
|
||||
@error <span class="hljs-string">'unexpected ;'</span> <span class="hljs-keyword">if</span> @prev()?[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> [<span class="hljs-string">'='</span>, UNFINISHED...]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-79">
|
||||
<li id="section-82">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-79">¶</a>
|
||||
<a class="pilcrow" href="#section-82">¶</a>
|
||||
</div>
|
||||
<p>Throws an error at either a given offset from the current chunk or at the
|
||||
location of a token (<code>token[2]</code>).</p>
|
||||
|
@ -2113,11 +2174,11 @@ location of a token (<code>token[2]</code>).</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-80">
|
||||
<li id="section-83">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-80">¶</a>
|
||||
<a class="pilcrow" href="#section-83">¶</a>
|
||||
</div>
|
||||
<h2 id="helper-functions">Helper functions</h2>
|
||||
|
||||
|
@ -2126,11 +2187,11 @@ location of a token (<code>token[2]</code>).</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-81">
|
||||
<li id="section-84">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-81">¶</a>
|
||||
<a class="pilcrow" href="#section-84">¶</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -2151,11 +2212,11 @@ exports.isUnassignable = isUnassignable</pre></div></div>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-82">
|
||||
<li id="section-85">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-82">¶</a>
|
||||
<a class="pilcrow" href="#section-85">¶</a>
|
||||
</div>
|
||||
<p><code>from</code> isn’t a CoffeeScript keyword, but it behaves like one in <code>import</code> and
|
||||
<code>export</code> statements (handled above) and in the declaration line of a <code>for</code>
|
||||
|
@ -2170,11 +2231,11 @@ loop. Try to detect when <code>from</code> is a variable identifier and when it
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-83">
|
||||
<li id="section-86">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-83">¶</a>
|
||||
<a class="pilcrow" href="#section-86">¶</a>
|
||||
</div>
|
||||
<p><code>for i from from</code>, <code>for from from iterable</code></p>
|
||||
|
||||
|
@ -2187,11 +2248,11 @@ loop. Try to detect when <code>from</code> is a variable identifier and when it
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-84">
|
||||
<li id="section-87">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-84">¶</a>
|
||||
<a class="pilcrow" href="#section-87">¶</a>
|
||||
</div>
|
||||
<p><code>for i from iterable</code></p>
|
||||
|
||||
|
@ -2202,11 +2263,11 @@ loop. Try to detect when <code>from</code> is a variable identifier and when it
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-85">
|
||||
<li id="section-88">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-85">¶</a>
|
||||
<a class="pilcrow" href="#section-88">¶</a>
|
||||
</div>
|
||||
<p><code>for from…</code></p>
|
||||
|
||||
|
@ -2218,11 +2279,11 @@ loop. Try to detect when <code>from</code> is a variable identifier and when it
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-86">
|
||||
<li id="section-89">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-86">¶</a>
|
||||
<a class="pilcrow" href="#section-89">¶</a>
|
||||
</div>
|
||||
<p><code>for {from}…</code>, <code>for [from]…</code>, <code>for {a, from}…</code>, <code>for {a: from}…</code></p>
|
||||
|
||||
|
@ -2236,11 +2297,11 @@ loop. Try to detect when <code>from</code> is a variable identifier and when it
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-87">
|
||||
<li id="section-90">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-87">¶</a>
|
||||
<a class="pilcrow" href="#section-90">¶</a>
|
||||
</div>
|
||||
<h2 id="constants">Constants</h2>
|
||||
|
||||
|
@ -2249,11 +2310,11 @@ loop. Try to detect when <code>from</code> is a variable identifier and when it
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-88">
|
||||
<li id="section-91">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-88">¶</a>
|
||||
<a class="pilcrow" href="#section-91">¶</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -2261,11 +2322,11 @@ loop. Try to detect when <code>from</code> is a variable identifier and when it
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-89">
|
||||
<li id="section-92">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-89">¶</a>
|
||||
<a class="pilcrow" href="#section-92">¶</a>
|
||||
</div>
|
||||
<p>Keywords that CoffeeScript shares in common with JavaScript.</p>
|
||||
|
||||
|
@ -2283,11 +2344,11 @@ loop. Try to detect when <code>from</code> is a variable identifier and when it
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-90">
|
||||
<li id="section-93">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-90">¶</a>
|
||||
<a class="pilcrow" href="#section-93">¶</a>
|
||||
</div>
|
||||
<p>CoffeeScript-only keywords.</p>
|
||||
|
||||
|
@ -2315,11 +2376,11 @@ COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat COFFEE_ALIASES</pre></div></div>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-91">
|
||||
<li id="section-94">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-91">¶</a>
|
||||
<a class="pilcrow" href="#section-94">¶</a>
|
||||
</div>
|
||||
<p>The list of keywords that are reserved by JavaScript, but not used, or are
|
||||
used by CoffeeScript internally. We throw an error when these are encountered,
|
||||
|
@ -2338,11 +2399,11 @@ STRICT_PROSCRIBED = [<span class="hljs-string">'arguments'</span>, <span class="
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-92">
|
||||
<li id="section-95">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-92">¶</a>
|
||||
<a class="pilcrow" href="#section-95">¶</a>
|
||||
</div>
|
||||
<p>The superset of both JavaScript keywords and reserved words, none of which may
|
||||
be used as identifiers or properties.</p>
|
||||
|
@ -2354,11 +2415,11 @@ be used as identifiers or properties.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-93">
|
||||
<li id="section-96">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-93">¶</a>
|
||||
<a class="pilcrow" href="#section-96">¶</a>
|
||||
</div>
|
||||
<p>The character code of the nasty Microsoft madness otherwise known as the BOM.</p>
|
||||
|
||||
|
@ -2369,11 +2430,11 @@ be used as identifiers or properties.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-94">
|
||||
<li id="section-97">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-94">¶</a>
|
||||
<a class="pilcrow" href="#section-97">¶</a>
|
||||
</div>
|
||||
<p>Token matching regexes.</p>
|
||||
|
||||
|
@ -2427,11 +2488,11 @@ HERE_JSTOKEN = <span class="hljs-regexp">///^ ``` ((?: [^`\\] | \\[\s\S] | `
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-95">
|
||||
<li id="section-98">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-95">¶</a>
|
||||
<a class="pilcrow" href="#section-98">¶</a>
|
||||
</div>
|
||||
<p>String-matching-regexes.</p>
|
||||
|
||||
|
@ -2465,11 +2526,11 @@ HEREDOC_INDENT = <span class="hljs-regexp">/\n+([^\n\S]*)(?=\S)/g</span></pr
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-96">
|
||||
<li id="section-99">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-96">¶</a>
|
||||
<a class="pilcrow" href="#section-99">¶</a>
|
||||
</div>
|
||||
<p>Regex-matching-regexes.</p>
|
||||
|
||||
|
@ -2503,11 +2564,11 @@ POSSIBLY_DIVISION = <span class="hljs-regexp">/// ^ /=?\s ///</span></pre></di
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-97">
|
||||
<li id="section-100">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-97">¶</a>
|
||||
<a class="pilcrow" href="#section-100">¶</a>
|
||||
</div>
|
||||
<p>Other regexes.</p>
|
||||
|
||||
|
@ -2550,11 +2611,11 @@ TRAILING_SPACES = <span class="hljs-regexp">/\s+$/</span></pre></div></div>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-98">
|
||||
<li id="section-101">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-98">¶</a>
|
||||
<a class="pilcrow" href="#section-101">¶</a>
|
||||
</div>
|
||||
<p>Compound assignment tokens.</p>
|
||||
|
||||
|
@ -2568,11 +2629,11 @@ TRAILING_SPACES = <span class="hljs-regexp">/\s+$/</span></pre></div></div>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-99">
|
||||
<li id="section-102">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-99">¶</a>
|
||||
<a class="pilcrow" href="#section-102">¶</a>
|
||||
</div>
|
||||
<p>Unary tokens.</p>
|
||||
|
||||
|
@ -2585,11 +2646,11 @@ UNARY_MATH = [<span class="hljs-string">'!'</span>, <span class="hljs-string">'~
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-100">
|
||||
<li id="section-103">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-100">¶</a>
|
||||
<a class="pilcrow" href="#section-103">¶</a>
|
||||
</div>
|
||||
<p>Bit-shifting tokens.</p>
|
||||
|
||||
|
@ -2600,11 +2661,11 @@ UNARY_MATH = [<span class="hljs-string">'!'</span>, <span class="hljs-string">'~
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-101">
|
||||
<li id="section-104">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-101">¶</a>
|
||||
<a class="pilcrow" href="#section-104">¶</a>
|
||||
</div>
|
||||
<p>Comparison tokens.</p>
|
||||
|
||||
|
@ -2615,11 +2676,11 @@ UNARY_MATH = [<span class="hljs-string">'!'</span>, <span class="hljs-string">'~
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-102">
|
||||
<li id="section-105">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-102">¶</a>
|
||||
<a class="pilcrow" href="#section-105">¶</a>
|
||||
</div>
|
||||
<p>Mathematical tokens.</p>
|
||||
|
||||
|
@ -2630,11 +2691,11 @@ UNARY_MATH = [<span class="hljs-string">'!'</span>, <span class="hljs-string">'~
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-103">
|
||||
<li id="section-106">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-103">¶</a>
|
||||
<a class="pilcrow" href="#section-106">¶</a>
|
||||
</div>
|
||||
<p>Relational tokens that are negatable with <code>not</code> prefix.</p>
|
||||
|
||||
|
@ -2645,11 +2706,11 @@ UNARY_MATH = [<span class="hljs-string">'!'</span>, <span class="hljs-string">'~
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-104">
|
||||
<li id="section-107">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-104">¶</a>
|
||||
<a class="pilcrow" href="#section-107">¶</a>
|
||||
</div>
|
||||
<p>Boolean tokens.</p>
|
||||
|
||||
|
@ -2660,11 +2721,11 @@ UNARY_MATH = [<span class="hljs-string">'!'</span>, <span class="hljs-string">'~
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-105">
|
||||
<li id="section-108">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-105">¶</a>
|
||||
<a class="pilcrow" href="#section-108">¶</a>
|
||||
</div>
|
||||
<p>Tokens which could legitimately be invoked or indexed. An opening
|
||||
parentheses or bracket following these tokens will be recorded as the start
|
||||
|
@ -2681,11 +2742,11 @@ INDEXABLE = CALLABLE.concat [
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-106">
|
||||
<li id="section-109">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-106">¶</a>
|
||||
<a class="pilcrow" href="#section-109">¶</a>
|
||||
</div>
|
||||
<p>Tokens which can be the left-hand side of a less-than comparison, i.e. <code>a<b</code>.</p>
|
||||
|
||||
|
@ -2696,11 +2757,11 @@ INDEXABLE = CALLABLE.concat [
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-107">
|
||||
<li id="section-110">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-107">¶</a>
|
||||
<a class="pilcrow" href="#section-110">¶</a>
|
||||
</div>
|
||||
<p>Tokens which a regular expression will never immediately follow (except spaced
|
||||
CALLABLEs in some cases), but which a division operator can.</p>
|
||||
|
@ -2713,11 +2774,11 @@ CALLABLEs in some cases), but which a division operator can.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-108">
|
||||
<li id="section-111">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-108">¶</a>
|
||||
<a class="pilcrow" href="#section-111">¶</a>
|
||||
</div>
|
||||
<p>Tokens that, when immediately preceding a <code>WHEN</code>, indicate that the <code>WHEN</code>
|
||||
occurs at the start of a line. We disambiguate these from trailing whens to
|
||||
|
@ -2730,11 +2791,11 @@ avoid an ambiguity in the grammar.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-109">
|
||||
<li id="section-112">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-109">¶</a>
|
||||
<a class="pilcrow" href="#section-112">¶</a>
|
||||
</div>
|
||||
<p>Additional indent in front of these is ignored.</p>
|
||||
|
||||
|
@ -2745,11 +2806,11 @@ avoid an ambiguity in the grammar.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-110">
|
||||
<li id="section-113">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-110">¶</a>
|
||||
<a class="pilcrow" href="#section-113">¶</a>
|
||||
</div>
|
||||
<p>Tokens that, when appearing at the end of a line, suppress a following TERMINATOR/INDENT token</p>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
0
docs/v2/annotated-source/public/fonts/roboto-black.eot
Executable file → Normal file
0
docs/v2/annotated-source/public/fonts/roboto-black.eot
Executable file → Normal file
0
docs/v2/annotated-source/public/fonts/roboto-black.ttf
Executable file → Normal file
0
docs/v2/annotated-source/public/fonts/roboto-black.ttf
Executable file → Normal file
0
docs/v2/annotated-source/public/fonts/roboto-black.woff
Executable file → Normal file
0
docs/v2/annotated-source/public/fonts/roboto-black.woff
Executable file → Normal file
|
@ -306,9 +306,9 @@ Unwrap that too.</p>
|
|||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> isAsync
|
||||
result = <span class="hljs-keyword">await</span> result
|
||||
cb <span class="hljs-literal">null</span>, result <span class="hljs-keyword">unless</span> sawSIGINT
|
||||
sawSIGINT = <span class="hljs-literal">false</span>
|
||||
result.<span class="hljs-keyword">then</span> (resolvedResult) ->
|
||||
cb <span class="hljs-literal">null</span>, resolvedResult <span class="hljs-keyword">unless</span> sawSIGINT
|
||||
sawSIGINT = <span class="hljs-literal">no</span>
|
||||
<span class="hljs-keyword">else</span>
|
||||
cb <span class="hljs-literal">null</span>, result
|
||||
<span class="hljs-keyword">catch</span> err</pre></div></div>
|
||||
|
|
|
@ -234,6 +234,7 @@ output the token stream after it has been rewritten by this file.</p>
|
|||
@normalizeLines()
|
||||
@tagPostfixConditionals()
|
||||
@addImplicitBracesAndParens()
|
||||
@addParensToChainedDoIife()
|
||||
@rescueStowawayComments()
|
||||
@addLocationDataToGeneratedTokens()
|
||||
@enforceValidCSXAttributes()
|
||||
|
@ -694,7 +695,8 @@ Added support for spread dots on the left side: f …a</p>
|
|||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> (tag <span class="hljs-keyword">in</span> IMPLICIT_FUNC <span class="hljs-keyword">and</span> token.spaced <span class="hljs-keyword">or</span>
|
||||
tag <span class="hljs-keyword">is</span> <span class="hljs-string">'?'</span> <span class="hljs-keyword">and</span> i > <span class="hljs-number">0</span> <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> tokens[i - <span class="hljs-number">1</span>].spaced) <span class="hljs-keyword">and</span>
|
||||
(nextTag <span class="hljs-keyword">in</span> IMPLICIT_CALL <span class="hljs-keyword">or</span> nextTag <span class="hljs-keyword">is</span> <span class="hljs-string">'...'</span> <span class="hljs-keyword">or</span>
|
||||
(nextTag <span class="hljs-keyword">in</span> IMPLICIT_CALL <span class="hljs-keyword">or</span>
|
||||
(nextTag <span class="hljs-keyword">is</span> <span class="hljs-string">'...'</span> <span class="hljs-keyword">and</span> @tag(i + <span class="hljs-number">2</span>) <span class="hljs-keyword">in</span> IMPLICIT_CALL <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> @findTagsBackwards(i, [<span class="hljs-string">'INDEX_START'</span>, <span class="hljs-string">'['</span>])) <span class="hljs-keyword">or</span>
|
||||
nextTag <span class="hljs-keyword">in</span> IMPLICIT_UNSPACED_CALL <span class="hljs-keyword">and</span>
|
||||
<span class="hljs-keyword">not</span> nextToken.spaced <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> nextToken.newLine)
|
||||
tag = token[<span class="hljs-number">0</span>] = <span class="hljs-string">'FUNC_EXIST'</span> <span class="hljs-keyword">if</span> tag <span class="hljs-keyword">is</span> <span class="hljs-string">'?'</span>
|
||||
|
@ -767,7 +769,7 @@ that creates grammatical ambiguities.</p>
|
|||
<span class="hljs-keyword">when</span> @tag(i - <span class="hljs-number">2</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'@'</span> <span class="hljs-keyword">then</span> i - <span class="hljs-number">2</span>
|
||||
<span class="hljs-keyword">else</span> i - <span class="hljs-number">1</span>
|
||||
|
||||
startsLine = s <span class="hljs-keyword">is</span> <span class="hljs-number">0</span> <span class="hljs-keyword">or</span> @tag(s - <span class="hljs-number">1</span>) <span class="hljs-keyword">in</span> LINEBREAKS <span class="hljs-keyword">or</span> tokens[s - <span class="hljs-number">1</span>].newLine</pre></div></div>
|
||||
startsLine = s <= <span class="hljs-number">0</span> <span class="hljs-keyword">or</span> @tag(s - <span class="hljs-number">1</span>) <span class="hljs-keyword">in</span> LINEBREAKS <span class="hljs-keyword">or</span> tokens[s - <span class="hljs-number">1</span>].newLine</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -1197,6 +1199,42 @@ location corresponding to the last “real” token under the node.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-48">¶</a>
|
||||
</div>
|
||||
<p>Add parens around a <code>do</code> IIFE followed by a chained <code>.</code> so that the
|
||||
chaining applies to the executed function rather than the function
|
||||
object (see #3736)</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> addParensToChainedDoIife: <span class="hljs-function">-></span>
|
||||
<span class="hljs-function"> <span class="hljs-title">condition</span> = <span class="hljs-params">(token, i)</span> -></span>
|
||||
@tag(i - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'OUTDENT'</span>
|
||||
<span class="hljs-function"> <span class="hljs-title">action</span> = <span class="hljs-params">(token, i)</span> -></span>
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-keyword">unless</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">in</span> CALL_CLOSERS
|
||||
@tokens.splice doIndex, <span class="hljs-number">0</span>, generate <span class="hljs-string">'('</span>, <span class="hljs-string">'('</span>, @tokens[doIndex]
|
||||
@tokens.splice i + <span class="hljs-number">1</span>, <span class="hljs-number">0</span>, generate <span class="hljs-string">')'</span>, <span class="hljs-string">')'</span>, @tokens[i]
|
||||
doIndex = <span class="hljs-literal">null</span>
|
||||
@scanTokens (token, i, tokens) ->
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span> <span class="hljs-keyword">unless</span> token[<span class="hljs-number">1</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'do'</span>
|
||||
doIndex = i
|
||||
glyphIndex = i + <span class="hljs-number">1</span>
|
||||
<span class="hljs-keyword">if</span> @tag(i + <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'PARAM_START'</span>
|
||||
glyphIndex = <span class="hljs-literal">null</span>
|
||||
@detectEnd i + <span class="hljs-number">1</span>,
|
||||
<span class="hljs-function"><span class="hljs-params">(token, i)</span> -></span> @tag(i - <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'PARAM_END'</span>
|
||||
(token, i) -> glyphIndex = i
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span> <span class="hljs-keyword">unless</span> glyphIndex? <span class="hljs-keyword">and</span> @tag(glyphIndex) <span class="hljs-keyword">in</span> [<span class="hljs-string">'->'</span>, <span class="hljs-string">'=>'</span>] <span class="hljs-keyword">and</span> @tag(glyphIndex + <span class="hljs-number">1</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'INDENT'</span>
|
||||
@detectEnd glyphIndex + <span class="hljs-number">1</span>, condition, action
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-number">2</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-49">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-49">¶</a>
|
||||
</div>
|
||||
<p>Because our grammar is LALR(1), it can’t handle some single-line
|
||||
expressions that lack ending delimiters. The <strong>Rewriter</strong> adds the implicit
|
||||
blocks, so it doesn’t need to. To keep the grammar clean and tidy, trailing
|
||||
|
@ -1250,11 +1288,11 @@ blocks are added.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-49">
|
||||
<li id="section-50">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-49">¶</a>
|
||||
<a class="pilcrow" href="#section-50">¶</a>
|
||||
</div>
|
||||
<p>Tag postfix conditionals as such, so that we can parse them with a
|
||||
different precedence.</p>
|
||||
|
@ -1282,11 +1320,11 @@ different precedence.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-50">
|
||||
<li id="section-51">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-50">¶</a>
|
||||
<a class="pilcrow" href="#section-51">¶</a>
|
||||
</div>
|
||||
<p>Generate the indentation tokens, based on another token on the same line.</p>
|
||||
|
||||
|
@ -1307,11 +1345,11 @@ different precedence.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-51">
|
||||
<li id="section-52">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-51">¶</a>
|
||||
<a class="pilcrow" href="#section-52">¶</a>
|
||||
</div>
|
||||
<p>Look up a tag by token index.</p>
|
||||
|
||||
|
@ -1322,25 +1360,13 @@ different precedence.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-52">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-52">¶</a>
|
||||
</div>
|
||||
<h2 id="constants">Constants</h2>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-53">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-53">¶</a>
|
||||
</div>
|
||||
<h2 id="constants">Constants</h2>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -1353,6 +1379,18 @@ different precedence.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-54">¶</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-55">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-55">¶</a>
|
||||
</div>
|
||||
<p>List of the token pairs that must be balanced.</p>
|
||||
|
||||
</div>
|
||||
|
@ -1372,11 +1410,11 @@ different precedence.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-55">
|
||||
<li id="section-56">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-55">¶</a>
|
||||
<a class="pilcrow" href="#section-56">¶</a>
|
||||
</div>
|
||||
<p>The inverse mappings of <code>BALANCED_PAIRS</code> we’re trying to fix up, so we can
|
||||
look things up from either end.</p>
|
||||
|
@ -1388,11 +1426,11 @@ look things up from either end.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-56">
|
||||
<li id="section-57">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-56">¶</a>
|
||||
<a class="pilcrow" href="#section-57">¶</a>
|
||||
</div>
|
||||
<p>The tokens that signal the start/end of a balanced pair.</p>
|
||||
|
||||
|
@ -1408,11 +1446,11 @@ EXPRESSION_END = []
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-57">
|
||||
<li id="section-58">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-57">¶</a>
|
||||
<a class="pilcrow" href="#section-58">¶</a>
|
||||
</div>
|
||||
<p>Tokens that indicate the close of a clause of an expression.</p>
|
||||
|
||||
|
@ -1423,11 +1461,11 @@ EXPRESSION_END = []
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-58">
|
||||
<li id="section-59">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-58">¶</a>
|
||||
<a class="pilcrow" href="#section-59">¶</a>
|
||||
</div>
|
||||
<p>Tokens that, if followed by an <code>IMPLICIT_CALL</code>, indicate a function invocation.</p>
|
||||
|
||||
|
@ -1438,11 +1476,11 @@ EXPRESSION_END = []
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-59">
|
||||
<li id="section-60">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-59">¶</a>
|
||||
<a class="pilcrow" href="#section-60">¶</a>
|
||||
</div>
|
||||
<p>If preceded by an <code>IMPLICIT_FUNC</code>, indicates a function invocation.</p>
|
||||
|
||||
|
@ -1462,11 +1500,11 @@ IMPLICIT_UNSPACED_CALL = [<span class="hljs-string">'+'</span>, <span class="hlj
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-60">
|
||||
<li id="section-61">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-60">¶</a>
|
||||
<a class="pilcrow" href="#section-61">¶</a>
|
||||
</div>
|
||||
<p>Tokens that always mark the end of an implicit call for single-liners.</p>
|
||||
|
||||
|
@ -1478,11 +1516,11 @@ IMPLICIT_UNSPACED_CALL = [<span class="hljs-string">'+'</span>, <span class="hlj
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-61">
|
||||
<li id="section-62">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-61">¶</a>
|
||||
<a class="pilcrow" href="#section-62">¶</a>
|
||||
</div>
|
||||
<p>Single-line flavors of block expressions that have unclosed endings.
|
||||
The grammar can’t disambiguate them, so we insert the implicit indentation.</p>
|
||||
|
@ -1495,11 +1533,11 @@ SINGLE_CLOSERS = [<span class="hljs-string">'TERMINATOR'</span>, <span class="
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-62">
|
||||
<li id="section-63">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-62">¶</a>
|
||||
<a class="pilcrow" href="#section-63">¶</a>
|
||||
</div>
|
||||
<p>Tokens that end a line.</p>
|
||||
|
||||
|
@ -1510,11 +1548,11 @@ SINGLE_CLOSERS = [<span class="hljs-string">'TERMINATOR'</span>, <span class="
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-63">
|
||||
<li id="section-64">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-63">¶</a>
|
||||
<a class="pilcrow" href="#section-64">¶</a>
|
||||
</div>
|
||||
<p>Tokens that close open calls when they follow a newline.</p>
|
||||
|
||||
|
@ -1525,11 +1563,11 @@ SINGLE_CLOSERS = [<span class="hljs-string">'TERMINATOR'</span>, <span class="
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-64">
|
||||
<li id="section-65">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-64">¶</a>
|
||||
<a class="pilcrow" href="#section-65">¶</a>
|
||||
</div>
|
||||
<p>Tokens that prevent a subsequent indent from ending implicit calls/objects</p>
|
||||
|
||||
|
@ -1540,11 +1578,11 @@ SINGLE_CLOSERS = [<span class="hljs-string">'TERMINATOR'</span>, <span class="
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-65">
|
||||
<li id="section-66">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-65">¶</a>
|
||||
<a class="pilcrow" href="#section-66">¶</a>
|
||||
</div>
|
||||
<p>Tokens that are swallowed up by the parser, never leading to code generation.
|
||||
You can spot these in <code>grammar.coffee</code> because the <code>o</code> function second
|
||||
|
|
|
@ -370,11 +370,18 @@ column for the current line:</p>
|
|||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> v3 =
|
||||
<div class="content"><div class='highlight'><pre> sources = <span class="hljs-keyword">if</span> options.sourceFiles
|
||||
options.sourceFiles
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> options.filename
|
||||
[options.filename]
|
||||
<span class="hljs-keyword">else</span>
|
||||
[<span class="hljs-string">'<anonymous>'</span>]
|
||||
|
||||
v3 =
|
||||
version: <span class="hljs-number">3</span>
|
||||
file: options.generatedFile <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>
|
||||
sourceRoot: options.sourceRoot <span class="hljs-keyword">or</span> <span class="hljs-string">''</span>
|
||||
sources: options.sourceFiles <span class="hljs-keyword">or</span> [<span class="hljs-string">''</span>]
|
||||
sources: sources
|
||||
names: []
|
||||
mappings: buffer
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue