2.0.0-beta4 (#4628)
* 2.0.0-beta4 changelog * Recompile parser, update browser compiler * Updated annotated source and browser tests * Bump version to 2.0.0-beta4
This commit is contained in:
parent
2653b3bbf9
commit
ae7f97b639
|
@ -315,6 +315,8 @@ we need to recompile it to get a source map for <code>prepareStackTrace</code>.<
|
|||
<div class="content"><div class='highlight'><pre> generateSourceMap = options.sourceMap <span class="hljs-keyword">or</span> options.inlineMap <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> options.filename?
|
||||
filename = options.filename <span class="hljs-keyword">or</span> <span class="hljs-string">'<anonymous>'</span>
|
||||
|
||||
checkShebangLine filename, code
|
||||
|
||||
sources[filename] = code
|
||||
map = <span class="hljs-keyword">new</span> SourceMap <span class="hljs-keyword">if</span> generateSourceMap
|
||||
|
||||
|
@ -540,13 +542,11 @@ directly as a “Jison lexer”.</p>
|
|||
@yylineno = @yylloc.first_line
|
||||
<span class="hljs-keyword">else</span>
|
||||
tag = <span class="hljs-string">''</span>
|
||||
|
||||
tag
|
||||
setInput: <span class="hljs-function"><span class="hljs-params">(tokens)</span> -></span>
|
||||
parser.tokens = tokens
|
||||
@pos = <span class="hljs-number">0</span>
|
||||
upcomingInput: <span class="hljs-function">-></span>
|
||||
<span class="hljs-string">""</span></pre></div></div>
|
||||
upcomingInput: <span class="hljs-function">-></span> <span class="hljs-string">''</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -757,7 +757,20 @@ positions.</p>
|
|||
<span class="hljs-keyword">break</span> <span class="hljs-keyword">if</span> frame.getFunction() <span class="hljs-keyword">is</span> exports.run
|
||||
<span class="hljs-string">" at <span class="hljs-subst">#{formatSourcePosition frame, getSourceMapping}</span>"</span>
|
||||
|
||||
<span class="hljs-string">"<span class="hljs-subst">#{err.toString()}</span>\n<span class="hljs-subst">#{frames.join <span class="hljs-string">'\n'</span>}</span>\n"</span></pre></div></div>
|
||||
<span class="hljs-string">"<span class="hljs-subst">#{err.toString()}</span>\n<span class="hljs-subst">#{frames.join <span class="hljs-string">'\n'</span>}</span>\n"</span>
|
||||
<span class="hljs-function">
|
||||
<span class="hljs-title">checkShebangLine</span> = <span class="hljs-params">(file, input)</span> -></span>
|
||||
firstLine = input.split(<span class="hljs-regexp">/$/m</span>)[<span class="hljs-number">0</span>]
|
||||
rest = firstLine?.match(<span class="hljs-regexp">/^#!\s*([^\s]+\s*)(.*)/</span>)
|
||||
args = rest?[<span class="hljs-number">2</span>]?.split(<span class="hljs-regexp">/\s/</span>).filter (s) -> s <span class="hljs-keyword">isnt</span> <span class="hljs-string">''</span>
|
||||
<span class="hljs-keyword">if</span> args?.length > <span class="hljs-number">1</span>
|
||||
<span class="hljs-built_in">console</span>.error <span class="hljs-string">'''
|
||||
The script to be run begins with a shebang line with more than one
|
||||
argument. This script will fail on platforms such as Linux which only
|
||||
allow a single argument.
|
||||
'''</span>
|
||||
<span class="hljs-built_in">console</span>.error <span class="hljs-string">"The shebang line was: '<span class="hljs-subst">#{firstLine}</span>' in file '<span class="hljs-subst">#{file}</span>'"</span>
|
||||
<span class="hljs-built_in">console</span>.error <span class="hljs-string">"The arguments were: <span class="hljs-subst">#{JSON.stringify args}</span>"</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ useWinPathSep = path.sep <span class="hljs-keyword">is</span> <span class="hljs
|
|||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre>BANNER = <span class="hljs-string">'''
|
||||
Usage: coffee [options] path/to/script.coffee -- [args]
|
||||
Usage: coffee [options] path/to/script.coffee [args]
|
||||
|
||||
If called without options, `coffee` will run your script.
|
||||
'''</span></pre></div></div>
|
||||
|
@ -260,7 +260,21 @@ Many flags cause us to divert before compiling anything. Flags passed after
|
|||
|
||||
<div class="content"><div class='highlight'><pre>exports.run = <span class="hljs-function">-></span>
|
||||
optionParser = buildCSOptionParser()
|
||||
parseOptions()</pre></div></div>
|
||||
<span class="hljs-keyword">try</span> parseOptions()
|
||||
<span class="hljs-keyword">catch</span> err
|
||||
<span class="hljs-built_in">console</span>.error <span class="hljs-string">"option parsing error: <span class="hljs-subst">#{err.message}</span>"</span>
|
||||
process.exit <span class="hljs-number">1</span>
|
||||
|
||||
<span class="hljs-keyword">if</span> (<span class="hljs-keyword">not</span> opts.doubleDashed) <span class="hljs-keyword">and</span> (opts.arguments[<span class="hljs-number">1</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'--'</span>)
|
||||
printWarn <span class="hljs-string">'''
|
||||
coffee was invoked with '--' as the second positional argument, which is
|
||||
now deprecated. To pass '--' as an argument to a script to run, put an
|
||||
additional '--' before the path to your script.
|
||||
|
||||
'--' will be removed from the argument list.
|
||||
'''</span>
|
||||
printWarn <span class="hljs-string">"The positional arguments were: <span class="hljs-subst">#{JSON.stringify opts.arguments}</span>"</span>
|
||||
opts.arguments = [opts.arguments[<span class="hljs-number">0</span>]].concat opts.arguments[<span class="hljs-number">2.</span>.]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -842,6 +856,9 @@ the <code>node</code> binary, preserving the other options.</p>
|
|||
cwd: process.cwd()
|
||||
env: process.env
|
||||
stdio: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>]
|
||||
<span class="hljs-keyword">for</span> signal <span class="hljs-keyword">in</span> [<span class="hljs-string">'SIGINT'</span>, <span class="hljs-string">'SIGTERM'</span>]
|
||||
process.<span class="hljs-literal">on</span> signal, <span class="hljs-keyword">do</span> (signal) ->
|
||||
-> p.kill signal
|
||||
p.<span class="hljs-literal">on</span> <span class="hljs-string">'exit'</span>, <span class="hljs-function"><span class="hljs-params">(code)</span> -></span> process.exit code</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
|
|
@ -209,8 +209,8 @@ previous nonterminal.</p>
|
|||
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">o</span> = <span class="hljs-params">(patternString, action, options)</span> -></span>
|
||||
patternString = patternString.replace <span class="hljs-regexp">/\s{2,}/g</span>, <span class="hljs-string">' '</span>
|
||||
patternCount = patternString.split(<span class="hljs-string">' '</span>).length
|
||||
<span class="hljs-keyword">return</span> [patternString, <span class="hljs-string">'$$ = $1;'</span>, options] <span class="hljs-keyword">unless</span> action
|
||||
action = <span class="hljs-keyword">if</span> match = unwrap.exec action <span class="hljs-keyword">then</span> match[<span class="hljs-number">1</span>] <span class="hljs-keyword">else</span> <span class="hljs-string">"(<span class="hljs-subst">#{action}</span>())"</span></pre></div></div>
|
||||
<span class="hljs-keyword">if</span> action
|
||||
action = <span class="hljs-keyword">if</span> match = unwrap.exec action <span class="hljs-keyword">then</span> match[<span class="hljs-number">1</span>] <span class="hljs-keyword">else</span> <span class="hljs-string">"(<span class="hljs-subst">#{action}</span>())"</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -225,8 +225,8 @@ previous nonterminal.</p>
|
|||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> action = action.replace <span class="hljs-regexp">/\bnew /g</span>, <span class="hljs-string">'$&yy.'</span>
|
||||
action = action.replace <span class="hljs-regexp">/\b(?:Block\.wrap|extend)\b/g</span>, <span class="hljs-string">'yy.$&'</span></pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre> action = action.replace <span class="hljs-regexp">/\bnew /g</span>, <span class="hljs-string">'$&yy.'</span>
|
||||
action = action.replace <span class="hljs-regexp">/\b(?:Block\.wrap|extend)\b/g</span>, <span class="hljs-string">'yy.$&'</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -237,22 +237,23 @@ previous nonterminal.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-8">¶</a>
|
||||
</div>
|
||||
<p>Returns a function which adds location data to the first parameter passed
|
||||
in, and returns the parameter. If the parameter is not a node, it will
|
||||
just be passed through unaffected.</p>
|
||||
<p>Returns strings of functions to add to <code>parser.js</code> which add extra data
|
||||
that nodes may have, such as comments or location data. Location data
|
||||
is added to the first parameter passed in, and the parameter is returned.
|
||||
If the parameter is not a node, it will just be passed through unaffected.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">addLocationDataFn</span> = <span class="hljs-params">(first, last)</span> -></span>
|
||||
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> last
|
||||
<span class="hljs-string">"yy.addLocationDataFn(@<span class="hljs-subst">#{first}</span>)"</span>
|
||||
<span class="hljs-keyword">else</span>
|
||||
<span class="hljs-string">"yy.addLocationDataFn(@<span class="hljs-subst">#{first}</span>, @<span class="hljs-subst">#{last}</span>)"</span>
|
||||
<div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">getAddDataToNodeFunctionString</span> = <span class="hljs-params">(first, last)</span> -></span>
|
||||
<span class="hljs-string">"yy.addDataToNode(yy, @<span class="hljs-subst">#{first}</span><span class="hljs-subst">#{<span class="hljs-keyword">if</span> last <span class="hljs-keyword">then</span> <span class="hljs-string">", @<span class="hljs-subst">#{last}</span>"</span> <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>}</span>)"</span>
|
||||
|
||||
action = action.replace <span class="hljs-regexp">/LOC\(([0-9]*)\)/g</span>, addLocationDataFn(<span class="hljs-string">'$1'</span>)
|
||||
action = action.replace <span class="hljs-regexp">/LOC\(([0-9]*),\s*([0-9]*)\)/g</span>, addLocationDataFn(<span class="hljs-string">'$1'</span>, <span class="hljs-string">'$2'</span>)
|
||||
action = action.replace <span class="hljs-regexp">/LOC\(([0-9]*)\)/g</span>, getAddDataToNodeFunctionString(<span class="hljs-string">'$1'</span>)
|
||||
action = action.replace <span class="hljs-regexp">/LOC\(([0-9]*),\s*([0-9]*)\)/g</span>, getAddDataToNodeFunctionString(<span class="hljs-string">'$1'</span>, <span class="hljs-string">'$2'</span>)
|
||||
performActionFunctionString = <span class="hljs-string">"$$ = <span class="hljs-subst">#{getAddDataToNodeFunctionString(<span class="hljs-number">1</span>, patternCount)}</span>(<span class="hljs-subst">#{action}</span>);"</span>
|
||||
<span class="hljs-keyword">else</span>
|
||||
performActionFunctionString = <span class="hljs-string">'$$ = $1;'</span>
|
||||
|
||||
[patternString, <span class="hljs-string">"$$ = <span class="hljs-subst">#{addLocationDataFn(<span class="hljs-number">1</span>, patternCount)}</span>(<span class="hljs-subst">#{action}</span>);"</span>, options]</pre></div></div>
|
||||
[patternString, performActionFunctionString, options]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -380,7 +381,6 @@ grammar.</p>
|
|||
|
||||
<div class="content"><div class='highlight'><pre> Statement: [
|
||||
o <span class="hljs-string">'Return'</span>
|
||||
o <span class="hljs-string">'Comment'</span>
|
||||
o <span class="hljs-string">'STATEMENT'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> StatementLiteral $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'Import'</span>
|
||||
o <span class="hljs-string">'Export'</span>
|
||||
|
@ -404,7 +404,6 @@ them somewhat circular.</p>
|
|||
|
||||
<div class="content"><div class='highlight'><pre> Expression: [
|
||||
o <span class="hljs-string">'Value'</span>
|
||||
o <span class="hljs-string">'Invocation'</span>
|
||||
o <span class="hljs-string">'Code'</span>
|
||||
o <span class="hljs-string">'Operation'</span>
|
||||
o <span class="hljs-string">'Assign'</span>
|
||||
|
@ -500,11 +499,11 @@ through and printed to JavaScript.</p>
|
|||
o <span class="hljs-string">'AlphaNumeric'</span>
|
||||
o <span class="hljs-string">'JS'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> PassthroughLiteral $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'Regex'</span>
|
||||
o <span class="hljs-string">'UNDEFINED'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> UndefinedLiteral
|
||||
o <span class="hljs-string">'NULL'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> NullLiteral
|
||||
o <span class="hljs-string">'UNDEFINED'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> UndefinedLiteral $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'NULL'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> NullLiteral $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'BOOL'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> BooleanLiteral $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'INFINITY'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> InfinityLiteral $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'NAN'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> NaNLiteral
|
||||
o <span class="hljs-string">'NAN'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> NaNLiteral $<span class="hljs-number">1</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
@ -553,7 +552,6 @@ the ordinary <strong>Assign</strong> is that these allow numbers and strings as
|
|||
o <span class="hljs-string">'SimpleObjAssignable =
|
||||
INDENT Expression OUTDENT'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Assign LOC(<span class="hljs-number">1</span>)(<span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>), $<span class="hljs-number">4</span>, <span class="hljs-literal">null</span>,
|
||||
operatorToken: LOC(<span class="hljs-number">2</span>)(<span class="hljs-keyword">new</span> Literal $<span class="hljs-number">2</span>)
|
||||
o <span class="hljs-string">'Comment'</span>
|
||||
]
|
||||
|
||||
SimpleObjAssignable: [
|
||||
|
@ -582,7 +580,9 @@ the ordinary <strong>Assign</strong> is that these allow numbers and strings as
|
|||
|
||||
<div class="content"><div class='highlight'><pre> ObjRestValue: [
|
||||
o <span class="hljs-string">'SimpleObjAssignable ...'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Splat <span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'... SimpleObjAssignable'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Splat <span class="hljs-keyword">new</span> Value $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'ObjSpreadExpr ...'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Splat $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'... ObjSpreadExpr'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Splat $<span class="hljs-number">2</span>
|
||||
]
|
||||
|
||||
ObjSpreadExpr: [
|
||||
|
@ -591,14 +591,19 @@ the ordinary <strong>Assign</strong> is that these allow numbers and strings as
|
|||
o <span class="hljs-string">'Parenthetical'</span>
|
||||
o <span class="hljs-string">'Super'</span>
|
||||
o <span class="hljs-string">'This'</span>
|
||||
o <span class="hljs-string">'SUPER Arguments'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> SuperCall LOC(<span class="hljs-number">1</span>)(<span class="hljs-keyword">new</span> Super), $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'SUPER Arguments'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> SuperCall LOC(<span class="hljs-number">1</span>)(<span class="hljs-keyword">new</span> Super), $<span class="hljs-number">2</span>, <span class="hljs-literal">no</span>, $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'SimpleObjAssignable Arguments'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Call (<span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>), $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'ObjSpreadExpr Arguments'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Call $<span class="hljs-number">1</span>, $<span class="hljs-number">2</span>
|
||||
]
|
||||
|
||||
ObjSpreadIdentifier: [
|
||||
o <span class="hljs-string">'SimpleObjAssignable . Property'</span>, <span class="hljs-function">-></span> (<span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>).add(<span class="hljs-keyword">new</span> Access $<span class="hljs-number">3</span>)
|
||||
o <span class="hljs-string">'SimpleObjAssignable INDEX_START IndexValue INDEX_END'</span>, <span class="hljs-function">-></span> (<span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>).add($<span class="hljs-number">3</span>)
|
||||
o <span class="hljs-string">'SimpleObjAssignable ObjSpreadAccessor'</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">'ObjSpreadExpr ObjSpreadAccessor'</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>
|
||||
]
|
||||
|
||||
ObjSpreadAccessor: [
|
||||
o <span class="hljs-string">'. Property'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Access $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'INDEX_START IndexValue INDEX_END'</span>, <span class="hljs-function">-></span> $<span class="hljs-number">2</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
@ -616,6 +621,7 @@ the ordinary <strong>Assign</strong> is that these allow numbers and strings as
|
|||
|
||||
<div class="content"><div class='highlight'><pre> Return: [
|
||||
o <span class="hljs-string">'RETURN Expression'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Return $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'RETURN INDENT Object OUTDENT'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Return <span class="hljs-keyword">new</span> Value $<span class="hljs-number">3</span>
|
||||
o <span class="hljs-string">'RETURN'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Return
|
||||
]
|
||||
|
||||
|
@ -638,23 +644,6 @@ the ordinary <strong>Assign</strong> is that these allow numbers and strings as
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-24">¶</a>
|
||||
</div>
|
||||
<p>A block comment.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> Comment: [
|
||||
o <span class="hljs-string">'HERECOMMENT'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Comment $<span class="hljs-number">1</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-25">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-25">¶</a>
|
||||
</div>
|
||||
<p>The <strong>Code</strong> node is the function literal. It’s defined by an indented block
|
||||
of <strong>Block</strong> preceded by a function arrow, with an optional parameter list.</p>
|
||||
|
||||
|
@ -668,11 +657,11 @@ of <strong>Block</strong> preceded by a function arrow, with an optional paramet
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-26">
|
||||
<li id="section-25">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-26">¶</a>
|
||||
<a class="pilcrow" href="#section-25">¶</a>
|
||||
</div>
|
||||
<p>CoffeeScript has two different symbols for functions. <code>-></code> is for ordinary
|
||||
functions, and <code>=></code> is for functions bound to the current value of <em>this</em>.</p>
|
||||
|
@ -680,18 +669,18 @@ functions, and <code>=></code> is for functions bound to the current value of
|
|||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> FuncGlyph: [
|
||||
o <span class="hljs-string">'->'</span>, <span class="hljs-function">-></span> <span class="hljs-string">'func'</span>
|
||||
o <span class="hljs-string">'=>'</span>, <span class="hljs-function">-></span> <span class="hljs-string">'boundfunc'</span>
|
||||
o <span class="hljs-string">'->'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> FuncGlyph $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'=>'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> FuncGlyph $<span class="hljs-number">1</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-27">
|
||||
<li id="section-26">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-27">¶</a>
|
||||
<a class="pilcrow" href="#section-26">¶</a>
|
||||
</div>
|
||||
<p>An optional, trailing comma.</p>
|
||||
|
||||
|
@ -705,11 +694,11 @@ functions, and <code>=></code> is for functions bound to the current value of
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-28">
|
||||
<li id="section-27">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-28">¶</a>
|
||||
<a class="pilcrow" href="#section-27">¶</a>
|
||||
</div>
|
||||
<p>The list of parameters that a function accepts can be of any length.</p>
|
||||
|
||||
|
@ -726,11 +715,11 @@ functions, and <code>=></code> is for functions bound to the current value of
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-29">
|
||||
<li id="section-28">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-29">¶</a>
|
||||
<a class="pilcrow" href="#section-28">¶</a>
|
||||
</div>
|
||||
<p>A single parameter in a function definition can be ordinary, or a splat
|
||||
that hoovers up the remaining arguments.</p>
|
||||
|
@ -740,6 +729,7 @@ that hoovers up the remaining arguments.</p>
|
|||
<div class="content"><div class='highlight'><pre> Param: [
|
||||
o <span class="hljs-string">'ParamVar'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Param $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'ParamVar ...'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Param $<span class="hljs-number">1</span>, <span class="hljs-literal">null</span>, <span class="hljs-literal">on</span>
|
||||
o <span class="hljs-string">'... ParamVar'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Param $<span class="hljs-number">2</span>, <span class="hljs-literal">null</span>, <span class="hljs-literal">on</span>
|
||||
o <span class="hljs-string">'ParamVar = Expression'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Param $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>
|
||||
o <span class="hljs-string">'...'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Expansion
|
||||
]</pre></div></div>
|
||||
|
@ -747,11 +737,11 @@ that hoovers up the remaining arguments.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-30">
|
||||
<li id="section-29">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-30">¶</a>
|
||||
<a class="pilcrow" href="#section-29">¶</a>
|
||||
</div>
|
||||
<p>Function Parameters</p>
|
||||
|
||||
|
@ -767,11 +757,11 @@ that hoovers up the remaining arguments.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-31">
|
||||
<li id="section-30">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-31">¶</a>
|
||||
<a class="pilcrow" href="#section-30">¶</a>
|
||||
</div>
|
||||
<p>A splat that occurs outside of a parameter list.</p>
|
||||
|
||||
|
@ -779,6 +769,26 @@ that hoovers up the remaining arguments.</p>
|
|||
|
||||
<div class="content"><div class='highlight'><pre> Splat: [
|
||||
o <span class="hljs-string">'Expression ...'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Splat $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'... Expression'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Splat $<span class="hljs-number">2</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-31">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-31">¶</a>
|
||||
</div>
|
||||
<p>Variables and properties that can be assigned to.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<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">'ThisProperty'</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
@ -790,26 +800,6 @@ that hoovers up the remaining arguments.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-32">¶</a>
|
||||
</div>
|
||||
<p>Variables and properties that can be assigned to.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<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">'Invocation Accessor'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>, [].concat $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'ThisProperty'</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-33">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-33">¶</a>
|
||||
</div>
|
||||
<p>Everything that can be assigned to.</p>
|
||||
|
||||
</div>
|
||||
|
@ -823,11 +813,11 @@ that hoovers up the remaining arguments.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-34">
|
||||
<li id="section-33">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-34">¶</a>
|
||||
<a class="pilcrow" href="#section-33">¶</a>
|
||||
</div>
|
||||
<p>The types of things that can be treated as values – assigned to, invoked
|
||||
as functions, indexed into, named as a class, etc.</p>
|
||||
|
@ -839,8 +829,27 @@ as functions, indexed into, named as a class, etc.</p>
|
|||
o <span class="hljs-string">'Literal'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'Parenthetical'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'Range'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'Invocation'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'This'</span>
|
||||
o <span class="hljs-string">'Super'</span>
|
||||
o <span class="hljs-string">'Super'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value $<span class="hljs-number">1</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-34">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-34">¶</a>
|
||||
</div>
|
||||
<p>A <code>super</code>-based expression that can be used as a value.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> Super: [
|
||||
o <span class="hljs-string">'SUPER . Property'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Super LOC(<span class="hljs-number">3</span>)(<span class="hljs-keyword">new</span> Access $<span class="hljs-number">3</span>), [], <span class="hljs-literal">no</span>, $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'SUPER INDEX_START Expression INDEX_END'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Super LOC(<span class="hljs-number">3</span>)(<span class="hljs-keyword">new</span> Index $<span class="hljs-number">3</span>), [], <span class="hljs-literal">no</span>, $<span class="hljs-number">1</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
@ -852,24 +861,6 @@ as functions, indexed into, named as a class, etc.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-35">¶</a>
|
||||
</div>
|
||||
<p>A <code>super</code>-based expression that can be used as a value.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> Super: [
|
||||
o <span class="hljs-string">'SUPER . Property'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Super LOC(<span class="hljs-number">3</span>) <span class="hljs-keyword">new</span> Access $<span class="hljs-number">3</span>
|
||||
o <span class="hljs-string">'SUPER INDEX_START Expression INDEX_END'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Super LOC(<span class="hljs-number">3</span>) <span class="hljs-keyword">new</span> Index $<span class="hljs-number">3</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-36">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-36">¶</a>
|
||||
</div>
|
||||
<p>The general group of accessors into an object, by property, by prototype
|
||||
or by array index or slice.</p>
|
||||
|
||||
|
@ -887,11 +878,11 @@ or by array index or slice.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-37">
|
||||
<li id="section-36">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-37">¶</a>
|
||||
<a class="pilcrow" href="#section-36">¶</a>
|
||||
</div>
|
||||
<p>Indexing into an object or array using bracket notation.</p>
|
||||
|
||||
|
@ -899,7 +890,7 @@ or by array index or slice.</p>
|
|||
|
||||
<div class="content"><div class='highlight'><pre> Index: [
|
||||
o <span class="hljs-string">'INDEX_START IndexValue INDEX_END'</span>, <span class="hljs-function">-></span> $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'INDEX_SOAK Index'</span>, <span class="hljs-function">-></span> extend $<span class="hljs-number">2</span>, soak : <span class="hljs-literal">yes</span>
|
||||
o <span class="hljs-string">'INDEX_SOAK Index'</span>, <span class="hljs-function">-></span> extend $<span class="hljs-number">2</span>, soak: <span class="hljs-literal">yes</span>
|
||||
]
|
||||
|
||||
IndexValue: [
|
||||
|
@ -910,11 +901,11 @@ or by array index or slice.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-38">
|
||||
<li id="section-37">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-38">¶</a>
|
||||
<a class="pilcrow" href="#section-37">¶</a>
|
||||
</div>
|
||||
<p>In CoffeeScript, an object literal is simply a list of assignments.</p>
|
||||
|
||||
|
@ -927,11 +918,11 @@ or by array index or slice.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-39">
|
||||
<li id="section-38">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-39">¶</a>
|
||||
<a class="pilcrow" href="#section-38">¶</a>
|
||||
</div>
|
||||
<p>Assignment of properties within an object literal can be separated by
|
||||
comma, as in JavaScript, or simply by newline.</p>
|
||||
|
@ -949,11 +940,11 @@ comma, as in JavaScript, or simply by newline.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-40">
|
||||
<li id="section-39">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-40">¶</a>
|
||||
<a class="pilcrow" href="#section-39">¶</a>
|
||||
</div>
|
||||
<p>Class definitions have optional bodies of prototype property assignments,
|
||||
and optional references to the superclass.</p>
|
||||
|
@ -1038,11 +1029,11 @@ and optional references to the superclass.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-41">
|
||||
<li id="section-40">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-41">¶</a>
|
||||
<a class="pilcrow" href="#section-40">¶</a>
|
||||
</div>
|
||||
<p>Ordinary function invocation, or a chained series of calls.</p>
|
||||
|
||||
|
@ -1051,18 +1042,17 @@ and optional references to the superclass.</p>
|
|||
<div class="content"><div class='highlight'><pre> Invocation: [
|
||||
o <span class="hljs-string">'Value OptFuncExist String'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> TaggedTemplateCall $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>, $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'Value OptFuncExist Arguments'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Call $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>, $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'Invocation OptFuncExist Arguments'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Call $<span class="hljs-number">1</span>, $<span class="hljs-number">3</span>, $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'SUPER OptFuncExist Arguments'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> SuperCall LOC(<span class="hljs-number">1</span>)(<span class="hljs-keyword">new</span> Super), $<span class="hljs-number">3</span>, $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'SUPER OptFuncExist Arguments'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> SuperCall LOC(<span class="hljs-number">1</span>)(<span class="hljs-keyword">new</span> Super), $<span class="hljs-number">3</span>, $<span class="hljs-number">2</span>, $<span class="hljs-number">1</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-42">
|
||||
<li id="section-41">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-42">¶</a>
|
||||
<a class="pilcrow" href="#section-41">¶</a>
|
||||
</div>
|
||||
<p>An optional existence check on a function.</p>
|
||||
|
||||
|
@ -1076,11 +1066,11 @@ and optional references to the superclass.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-43">
|
||||
<li id="section-42">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-43">¶</a>
|
||||
<a class="pilcrow" href="#section-42">¶</a>
|
||||
</div>
|
||||
<p>The list of arguments to a function call.</p>
|
||||
|
||||
|
@ -1094,19 +1084,36 @@ and optional references to the superclass.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-44">
|
||||
<li id="section-43">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-44">¶</a>
|
||||
<a class="pilcrow" href="#section-43">¶</a>
|
||||
</div>
|
||||
<p>A reference to the <em>this</em> current object.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> This: [
|
||||
o <span class="hljs-string">'THIS'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value <span class="hljs-keyword">new</span> ThisLiteral
|
||||
o <span class="hljs-string">'@'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value <span class="hljs-keyword">new</span> ThisLiteral
|
||||
o <span class="hljs-string">'THIS'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value <span class="hljs-keyword">new</span> ThisLiteral $<span class="hljs-number">1</span>
|
||||
o <span class="hljs-string">'@'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value <span class="hljs-keyword">new</span> ThisLiteral $<span class="hljs-number">1</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-44">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-44">¶</a>
|
||||
</div>
|
||||
<p>A reference to a property on <em>this</em>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> ThisProperty: [
|
||||
o <span class="hljs-string">'@ Property'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value LOC(<span class="hljs-number">1</span>)(<span class="hljs-keyword">new</span> ThisLiteral $<span class="hljs-number">1</span>), [LOC(<span class="hljs-number">2</span>)(<span class="hljs-keyword">new</span> Access($<span class="hljs-number">2</span>))], <span class="hljs-string">'this'</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
@ -1118,23 +1125,6 @@ and optional references to the superclass.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-45">¶</a>
|
||||
</div>
|
||||
<p>A reference to a property on <em>this</em>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> ThisProperty: [
|
||||
o <span class="hljs-string">'@ Property'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Value LOC(<span class="hljs-number">1</span>)(<span class="hljs-keyword">new</span> ThisLiteral), [LOC(<span class="hljs-number">2</span>)(<span class="hljs-keyword">new</span> Access($<span class="hljs-number">2</span>))], <span class="hljs-string">'this'</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-46">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-46">¶</a>
|
||||
</div>
|
||||
<p>The array literal.</p>
|
||||
|
||||
</div>
|
||||
|
@ -1147,11 +1137,11 @@ and optional references to the superclass.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-47">
|
||||
<li id="section-46">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-47">¶</a>
|
||||
<a class="pilcrow" href="#section-46">¶</a>
|
||||
</div>
|
||||
<p>Inclusive and exclusive range dots.</p>
|
||||
|
||||
|
@ -1165,11 +1155,11 @@ and optional references to the superclass.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-48">
|
||||
<li id="section-47">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-48">¶</a>
|
||||
<a class="pilcrow" href="#section-47">¶</a>
|
||||
</div>
|
||||
<p>The CoffeeScript range literal.</p>
|
||||
|
||||
|
@ -1182,11 +1172,11 @@ and optional references to the superclass.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-49">
|
||||
<li id="section-48">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-49">¶</a>
|
||||
<a class="pilcrow" href="#section-48">¶</a>
|
||||
</div>
|
||||
<p>Array slice literals.</p>
|
||||
|
||||
|
@ -1202,11 +1192,11 @@ and optional references to the superclass.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-50">
|
||||
<li id="section-49">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-50">¶</a>
|
||||
<a class="pilcrow" href="#section-49">¶</a>
|
||||
</div>
|
||||
<p>The <strong>ArgList</strong> is both the list of objects passed into a function call,
|
||||
as well as the contents of an array literal
|
||||
|
@ -1225,11 +1215,11 @@ as well as the contents of an array literal
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-51">
|
||||
<li id="section-50">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-51">¶</a>
|
||||
<a class="pilcrow" href="#section-50">¶</a>
|
||||
</div>
|
||||
<p>Valid arguments are Blocks or Splats.</p>
|
||||
|
||||
|
@ -1244,11 +1234,11 @@ as well as the contents of an array literal
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-52">
|
||||
<li id="section-51">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-52">¶</a>
|
||||
<a class="pilcrow" href="#section-51">¶</a>
|
||||
</div>
|
||||
<p>Just simple, comma-separated, required arguments (no fancy syntax). We need
|
||||
this to be separate from the <strong>ArgList</strong> for use in <strong>Switch</strong> blocks, where
|
||||
|
@ -1264,11 +1254,11 @@ having the newlines wouldn’t make sense.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-53">
|
||||
<li id="section-52">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-53">¶</a>
|
||||
<a class="pilcrow" href="#section-52">¶</a>
|
||||
</div>
|
||||
<p>The variants of <em>try/catch/finally</em> exception handling blocks.</p>
|
||||
|
||||
|
@ -1284,11 +1274,11 @@ having the newlines wouldn’t make sense.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-54">
|
||||
<li id="section-53">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-54">¶</a>
|
||||
<a class="pilcrow" href="#section-53">¶</a>
|
||||
</div>
|
||||
<p>A catch clause names its error and runs a block of code.</p>
|
||||
|
||||
|
@ -1303,11 +1293,11 @@ having the newlines wouldn’t make sense.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-55">
|
||||
<li id="section-54">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-55">¶</a>
|
||||
<a class="pilcrow" href="#section-54">¶</a>
|
||||
</div>
|
||||
<p>Throw an exception object.</p>
|
||||
|
||||
|
@ -1315,16 +1305,17 @@ having the newlines wouldn’t make sense.</p>
|
|||
|
||||
<div class="content"><div class='highlight'><pre> Throw: [
|
||||
o <span class="hljs-string">'THROW Expression'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Throw $<span class="hljs-number">2</span>
|
||||
o <span class="hljs-string">'THROW INDENT Object OUTDENT'</span>, <span class="hljs-function">-></span> <span class="hljs-keyword">new</span> Throw <span class="hljs-keyword">new</span> Value $<span class="hljs-number">3</span>
|
||||
]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-56">
|
||||
<li id="section-55">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-56">¶</a>
|
||||
<a class="pilcrow" href="#section-55">¶</a>
|
||||
</div>
|
||||
<p>Parenthetical expressions. Note that the <strong>Parenthetical</strong> is a <strong>Value</strong>,
|
||||
not an <strong>Expression</strong>, so if you need to use an expression in a place
|
||||
|
@ -1341,11 +1332,11 @@ the trick.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-57">
|
||||
<li id="section-56">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-57">¶</a>
|
||||
<a class="pilcrow" href="#section-56">¶</a>
|
||||
</div>
|
||||
<p>The condition portion of a while loop.</p>
|
||||
|
||||
|
@ -1361,11 +1352,11 @@ the trick.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-58">
|
||||
<li id="section-57">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-58">¶</a>
|
||||
<a class="pilcrow" href="#section-57">¶</a>
|
||||
</div>
|
||||
<p>The while loop can either be normal, with a block of expressions to execute,
|
||||
or postfix, with a single expression. There is no do..while.</p>
|
||||
|
@ -1387,11 +1378,11 @@ or postfix, with a single expression. There is no do..while.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-59">
|
||||
<li id="section-58">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-59">¶</a>
|
||||
<a class="pilcrow" href="#section-58">¶</a>
|
||||
</div>
|
||||
<p>Array, object, and range comprehensions, at the most generic level.
|
||||
Comprehensions can either be normal, with a block of expressions to execute,
|
||||
|
@ -1419,11 +1410,11 @@ or postfix, with a single expression.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-60">
|
||||
<li id="section-59">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-60">¶</a>
|
||||
<a class="pilcrow" href="#section-59">¶</a>
|
||||
</div>
|
||||
<p>An array of all accepted values for a variable inside the loop.
|
||||
This enables support for pattern matching.</p>
|
||||
|
@ -1440,11 +1431,11 @@ This enables support for pattern matching.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-61">
|
||||
<li id="section-60">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-61">¶</a>
|
||||
<a class="pilcrow" href="#section-60">¶</a>
|
||||
</div>
|
||||
<p>An array or range comprehension has variables for the current element
|
||||
and (optional) reference to the current index. Or, <em>key, value</em>, in the case
|
||||
|
@ -1460,11 +1451,11 @@ of object comprehensions.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-62">
|
||||
<li id="section-61">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-62">¶</a>
|
||||
<a class="pilcrow" href="#section-61">¶</a>
|
||||
</div>
|
||||
<p>The source of a comprehension is an array or object with an optional guard
|
||||
clause. If it’s an array comprehension, you can also choose to step through
|
||||
|
@ -1499,11 +1490,11 @@ in fixed-size increments.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-63">
|
||||
<li id="section-62">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-63">¶</a>
|
||||
<a class="pilcrow" href="#section-62">¶</a>
|
||||
</div>
|
||||
<p>An individual <strong>When</strong> clause, with action.</p>
|
||||
|
||||
|
@ -1517,11 +1508,11 @@ in fixed-size increments.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-64">
|
||||
<li id="section-63">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-64">¶</a>
|
||||
<a class="pilcrow" href="#section-63">¶</a>
|
||||
</div>
|
||||
<p>The most basic form of <em>if</em> is a condition and an action. The following
|
||||
if-related rules are broken up along these lines in order to avoid
|
||||
|
@ -1537,11 +1528,11 @@ ambiguity.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-65">
|
||||
<li id="section-64">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-65">¶</a>
|
||||
<a class="pilcrow" href="#section-64">¶</a>
|
||||
</div>
|
||||
<p>The full complement of <em>if</em> expressions, including postfix one-liner
|
||||
<em>if</em> and <em>unless</em>.</p>
|
||||
|
@ -1558,11 +1549,11 @@ ambiguity.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-66">
|
||||
<li id="section-65">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-66">¶</a>
|
||||
<a class="pilcrow" href="#section-65">¶</a>
|
||||
</div>
|
||||
<p>Arithmetic and logical operators, working on one or more operands.
|
||||
Here they are grouped by order of precedence. The actual precedence rules
|
||||
|
@ -1589,11 +1580,11 @@ rules are necessary.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-67">
|
||||
<li id="section-66">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-67">¶</a>
|
||||
<a class="pilcrow" href="#section-66">¶</a>
|
||||
</div>
|
||||
<p><a href="http://coffeescript.org/#existential-operator">The existential operator</a>.</p>
|
||||
|
||||
|
@ -1631,14 +1622,26 @@ rules are necessary.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-67">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-67">¶</a>
|
||||
</div>
|
||||
<h2 id="precedence">Precedence</h2>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-68">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-68">¶</a>
|
||||
</div>
|
||||
<h2 id="precedence">Precedence</h2>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
@ -1650,18 +1653,6 @@ rules are necessary.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-69">¶</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-70">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-70">¶</a>
|
||||
</div>
|
||||
<p>Operators at the top of this list have higher precedence than the ones lower
|
||||
down. Following these rules is what makes <code>2 + 3 * 4</code> parse as:</p>
|
||||
<pre><code><span class="hljs-number">2</span> + (<span class="hljs-number">3</span> * <span class="hljs-number">4</span>)
|
||||
|
@ -1701,14 +1692,26 @@ down. Following these rules is what makes <code>2 + 3 * 4</code> parse as:</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-70">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-70">¶</a>
|
||||
</div>
|
||||
<h2 id="wrapping-up">Wrapping Up</h2>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-71">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-71">¶</a>
|
||||
</div>
|
||||
<h2 id="wrapping-up">Wrapping Up</h2>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
@ -1720,18 +1723,6 @@ down. Following these rules is what makes <code>2 + 3 * 4</code> parse as:</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-72">¶</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-73">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-73">¶</a>
|
||||
</div>
|
||||
<p>Finally, now that we have our <strong>grammar</strong> and our <strong>operators</strong>, we can create
|
||||
our <strong>Jison.Parser</strong>. We do this by processing all of our rules, recording all
|
||||
terminals (every symbol which does not appear as the name of a rule above)
|
||||
|
@ -1750,11 +1741,11 @@ as “tokens”.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-74">
|
||||
<li id="section-73">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-74">¶</a>
|
||||
<a class="pilcrow" href="#section-73">¶</a>
|
||||
</div>
|
||||
<p>Initialize the <strong>Parser</strong> with our list of terminal <strong>tokens</strong>, our <strong>grammar</strong>
|
||||
rules, and the name of the root. Reverse the operators because Jison orders
|
||||
|
|
|
@ -382,7 +382,10 @@ If <code>last</code> is not provided, this will simply return <code>first</code>
|
|||
first_line: first.first_line
|
||||
first_column: first.first_column
|
||||
last_line: last.last_line
|
||||
last_column: last.last_column</pre></div></div>
|
||||
last_column: last.last_column
|
||||
<span class="hljs-function">
|
||||
<span class="hljs-title">buildLocationHash</span> = <span class="hljs-params">(loc)</span> -></span>
|
||||
<span class="hljs-string">"<span class="hljs-subst">#{loc.first_line}</span>x<span class="hljs-subst">#{loc.first_column}</span>-<span class="hljs-subst">#{loc.last_line}</span>x<span class="hljs-subst">#{loc.last_column}</span>"</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -399,12 +402,8 @@ The object is returned either way.</p>
|
|||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre>exports.addLocationDataFn = <span class="hljs-function"><span class="hljs-params">(first, last)</span> -></span>
|
||||
(obj) ->
|
||||
<span class="hljs-keyword">if</span> ((<span class="hljs-keyword">typeof</span> obj) <span class="hljs-keyword">is</span> <span class="hljs-string">'object'</span>) <span class="hljs-keyword">and</span> (!!obj[<span class="hljs-string">'updateLocationDataIfMissing'</span>])
|
||||
obj.updateLocationDataIfMissing buildLocationData(first, last)
|
||||
|
||||
<span class="hljs-keyword">return</span> obj</pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre>exports.addDataToNode = <span class="hljs-function"><span class="hljs-params">(parserState, first, last)</span> -></span>
|
||||
(obj) -></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -415,6 +414,56 @@ The object is returned either way.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-16">¶</a>
|
||||
</div>
|
||||
<p>Add location data</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> obj?.updateLocationDataIfMissing? <span class="hljs-keyword">and</span> first?
|
||||
obj.updateLocationDataIfMissing buildLocationData(first, last)</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-17">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-17">¶</a>
|
||||
</div>
|
||||
<p>Add comments data</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> parserState.tokenComments
|
||||
parserState.tokenComments = {}
|
||||
<span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> parserState.parser.tokens <span class="hljs-keyword">when</span> token.comments
|
||||
tokenHash = buildLocationHash token[<span class="hljs-number">2</span>]
|
||||
<span class="hljs-keyword">unless</span> parserState.tokenComments[tokenHash]?
|
||||
parserState.tokenComments[tokenHash] = token.comments
|
||||
<span class="hljs-keyword">else</span>
|
||||
parserState.tokenComments[tokenHash].push token.comments...
|
||||
|
||||
<span class="hljs-keyword">if</span> obj.locationData?
|
||||
objHash = buildLocationHash obj.locationData
|
||||
<span class="hljs-keyword">if</span> parserState.tokenComments[objHash]?
|
||||
attachCommentsToNode parserState.tokenComments[objHash], obj
|
||||
|
||||
obj
|
||||
|
||||
exports.attachCommentsToNode = attachCommentsToNode = <span class="hljs-function"><span class="hljs-params">(comments, node)</span> -></span>
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> comments? <span class="hljs-keyword">or</span> comments.length <span class="hljs-keyword">is</span> <span class="hljs-number">0</span>
|
||||
node.comments ?= []
|
||||
node.comments.push comments...</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-18">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-18">¶</a>
|
||||
</div>
|
||||
<p>Convert jison location data to a string.
|
||||
<code>obj</code> can be a token, or a locationData.</p>
|
||||
|
||||
|
@ -433,11 +482,11 @@ The object is returned either way.</p>
|
|||
</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>A <code>.coffee.md</code> compatible version of <code>basename</code>, that returns the file sans-extension.</p>
|
||||
|
||||
|
@ -456,11 +505,11 @@ The object is returned either way.</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>Determine if a filename represents a CoffeeScript file.</p>
|
||||
|
||||
|
@ -471,11 +520,11 @@ The object is returned either way.</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>Determine if a filename represents a Literate CoffeeScript file.</p>
|
||||
|
||||
|
@ -486,11 +535,11 @@ The object is returned either way.</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>Throws a SyntaxError from a given location.
|
||||
The error’s <code>toString</code> will return an error message following the “standard”
|
||||
|
@ -507,11 +556,11 @@ marker showing where the error is.</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>Instead of showing the compiler’s stacktrace, show our custom error message
|
||||
(this is useful when the error bubbles up in Node.js applications that
|
||||
|
@ -526,11 +575,11 @@ compile CoffeeScript for example).</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>Update a compiler SyntaxError with source code information if it didn’t have
|
||||
it already.</p>
|
||||
|
@ -542,11 +591,11 @@ it already.</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>Avoid screwing up the <code>stack</code> property of other errors (i.e. possible bugs).</p>
|
||||
|
||||
|
@ -572,11 +621,11 @@ it already.</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>Show only the first line on multi-line errors.</p>
|
||||
|
||||
|
@ -588,11 +637,11 @@ it already.</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>Check to see if we’re running on a color-enabled TTY.</p>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -157,8 +157,8 @@ command-line arguments in <code>src/command.coffee</code>.</p>
|
|||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> constructor: <span class="hljs-function"><span class="hljs-params">(rules, @banner)</span> -></span>
|
||||
@rules = buildRules rules</pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre> constructor: <span class="hljs-function"><span class="hljs-params">(ruleDeclarations, @banner)</span> -></span>
|
||||
@rules = buildRules ruleDeclarations</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -178,20 +178,7 @@ you’re responsible for interpreting the options object.</p>
|
|||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> parse: <span class="hljs-function"><span class="hljs-params">(args)</span> -></span>
|
||||
options = arguments: []
|
||||
skippingArgument = <span class="hljs-literal">no</span>
|
||||
originalArgs = args
|
||||
args = normalizeArguments args
|
||||
<span class="hljs-keyword">for</span> arg, i <span class="hljs-keyword">in</span> args
|
||||
<span class="hljs-keyword">if</span> skippingArgument
|
||||
skippingArgument = <span class="hljs-literal">no</span>
|
||||
<span class="hljs-keyword">continue</span>
|
||||
<span class="hljs-keyword">if</span> arg <span class="hljs-keyword">is</span> <span class="hljs-string">'--'</span>
|
||||
pos = originalArgs.indexOf <span class="hljs-string">'--'</span>
|
||||
options.arguments = options.arguments.concat originalArgs[(pos + <span class="hljs-number">1</span>)..]
|
||||
<span class="hljs-keyword">break</span>
|
||||
isOption = !!(arg.match(LONG_FLAG) <span class="hljs-keyword">or</span> arg.match(SHORT_FLAG))</pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre> parse: <span class="hljs-function"><span class="hljs-params">(args)</span> -></span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -202,27 +189,18 @@ you’re responsible for interpreting the options object.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-5">¶</a>
|
||||
</div>
|
||||
<p>the CS option parser is a little odd; options after the first
|
||||
non-option argument are treated as non-option arguments themselves</p>
|
||||
<p>The CoffeeScript option parser is a little odd; options after the first
|
||||
non-option argument are treated as non-option arguments themselves.
|
||||
Optional arguments are normalized by expanding merged flags into multiple
|
||||
flags. This allows you to have <code>-wl</code> be the same as <code>--watch --lint</code>.
|
||||
Note that executable scripts with a shebang (<code>#!</code>) line should use the
|
||||
line <code>#!/usr/bin/env coffee</code>, or <code>#!/absolute/path/to/coffee</code>, without a
|
||||
<code>--</code> argument after, because that will fail on Linux (see #3946).</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> seenNonOptionArg = options.arguments.length > <span class="hljs-number">0</span>
|
||||
<span class="hljs-keyword">unless</span> seenNonOptionArg
|
||||
matchedRule = <span class="hljs-literal">no</span>
|
||||
<span class="hljs-keyword">for</span> rule <span class="hljs-keyword">in</span> @rules
|
||||
<span class="hljs-keyword">if</span> rule.shortFlag <span class="hljs-keyword">is</span> arg <span class="hljs-keyword">or</span> rule.longFlag <span class="hljs-keyword">is</span> arg
|
||||
value = <span class="hljs-literal">true</span>
|
||||
<span class="hljs-keyword">if</span> rule.hasArgument
|
||||
skippingArgument = <span class="hljs-literal">yes</span>
|
||||
value = args[i + <span class="hljs-number">1</span>]
|
||||
options[rule.name] = <span class="hljs-keyword">if</span> rule.isList <span class="hljs-keyword">then</span> (options[rule.name] <span class="hljs-keyword">or</span> []).concat value <span class="hljs-keyword">else</span> value
|
||||
matchedRule = <span class="hljs-literal">yes</span>
|
||||
<span class="hljs-keyword">break</span>
|
||||
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"unrecognized option: <span class="hljs-subst">#{arg}</span>"</span> <span class="hljs-keyword">if</span> isOption <span class="hljs-keyword">and</span> <span class="hljs-keyword">not</span> matchedRule
|
||||
<span class="hljs-keyword">if</span> seenNonOptionArg <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> isOption
|
||||
options.arguments.push arg
|
||||
options</pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre> {rules, positional} = normalizeArguments args, @rules.flagDict
|
||||
options = {}</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -233,20 +211,27 @@ non-option argument are treated as non-option arguments themselves</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-6">¶</a>
|
||||
</div>
|
||||
<p>Return the help text for this <strong>OptionParser</strong>, listing and describing all
|
||||
of the valid options, for <code>--help</code> and such.</p>
|
||||
<p>The <code>argument</code> field is added to the rule instance non-destructively by
|
||||
<code>normalizeArguments</code>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> help: <span class="hljs-function">-></span>
|
||||
lines = []
|
||||
lines.unshift <span class="hljs-string">"<span class="hljs-subst">#{@banner}</span>\n"</span> <span class="hljs-keyword">if</span> @banner
|
||||
<span class="hljs-keyword">for</span> rule <span class="hljs-keyword">in</span> @rules
|
||||
spaces = <span class="hljs-number">15</span> - rule.longFlag.length
|
||||
spaces = <span class="hljs-keyword">if</span> spaces > <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> repeat <span class="hljs-string">' '</span>, spaces <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>
|
||||
letPart = <span class="hljs-keyword">if</span> rule.shortFlag <span class="hljs-keyword">then</span> rule.shortFlag + <span class="hljs-string">', '</span> <span class="hljs-keyword">else</span> <span class="hljs-string">' '</span>
|
||||
lines.push <span class="hljs-string">' '</span> + letPart + rule.longFlag + spaces + rule.description
|
||||
<span class="hljs-string">"\n<span class="hljs-subst">#{ lines.join(<span class="hljs-string">'\n'</span>) }</span>\n"</span></pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">for</span> {hasArgument, argument, isList, name} <span class="hljs-keyword">in</span> rules
|
||||
<span class="hljs-keyword">if</span> hasArgument
|
||||
<span class="hljs-keyword">if</span> isList
|
||||
options[name] ?= []
|
||||
options[name].push argument
|
||||
<span class="hljs-keyword">else</span>
|
||||
options[name] = argument
|
||||
<span class="hljs-keyword">else</span>
|
||||
options[name] = <span class="hljs-literal">true</span>
|
||||
|
||||
<span class="hljs-keyword">if</span> positional[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'--'</span>
|
||||
options.doubleDashed = <span class="hljs-literal">yes</span>
|
||||
positional = positional[<span class="hljs-number">1.</span>.]
|
||||
|
||||
options.arguments = positional
|
||||
options</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -257,10 +242,21 @@ of the valid options, for <code>--help</code> and such.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-7">¶</a>
|
||||
</div>
|
||||
<h2 id="helpers">Helpers</h2>
|
||||
<p>Return the help text for this <strong>OptionParser</strong>, listing and describing all
|
||||
of the valid options, for <code>--help</code> and such.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> help: <span class="hljs-function">-></span>
|
||||
lines = []
|
||||
lines.unshift <span class="hljs-string">"<span class="hljs-subst">#{@banner}</span>\n"</span> <span class="hljs-keyword">if</span> @banner
|
||||
<span class="hljs-keyword">for</span> rule <span class="hljs-keyword">in</span> @rules.ruleList
|
||||
spaces = <span class="hljs-number">15</span> - rule.longFlag.length
|
||||
spaces = <span class="hljs-keyword">if</span> spaces > <span class="hljs-number">0</span> <span class="hljs-keyword">then</span> repeat <span class="hljs-string">' '</span>, spaces <span class="hljs-keyword">else</span> <span class="hljs-string">''</span>
|
||||
letPart = <span class="hljs-keyword">if</span> rule.shortFlag <span class="hljs-keyword">then</span> rule.shortFlag + <span class="hljs-string">', '</span> <span class="hljs-keyword">else</span> <span class="hljs-string">' '</span>
|
||||
lines.push <span class="hljs-string">' '</span> + letPart + rule.longFlag + spaces + rule.description
|
||||
<span class="hljs-string">"\n<span class="hljs-subst">#{ lines.join(<span class="hljs-string">'\n'</span>) }</span>\n"</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
@ -270,7 +266,8 @@ of the valid options, for <code>--help</code> and such.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-8">¶</a>
|
||||
</div>
|
||||
|
||||
<h2 id="helpers">Helpers</h2>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
@ -282,15 +279,9 @@ of the valid options, for <code>--help</code> and such.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-9">¶</a>
|
||||
</div>
|
||||
<p>Regex matchers for option flags.</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre>LONG_FLAG = <span class="hljs-regexp">/^(--\w[\w\-]*)/</span>
|
||||
SHORT_FLAG = <span class="hljs-regexp">/^(-\w)$/</span>
|
||||
MULTI_FLAG = <span class="hljs-regexp">/^-(\w{2,})/</span>
|
||||
OPTIONAL = <span class="hljs-regexp">/\[(\w+(\*?))\]/</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
@ -300,15 +291,13 @@ OPTIONAL = <span class="hljs-regexp">/\[(\w+(\*?))\]/</span></pre></div></div>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-10">¶</a>
|
||||
</div>
|
||||
<p>Build and return the list of option rules. If the optional <em>short-flag</em> is
|
||||
unspecified, leave it out by padding with <code>null</code>.</p>
|
||||
<p>Regex matchers for option flags on the command line and their rules.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">buildRules</span> = <span class="hljs-params">(rules)</span> -></span>
|
||||
<span class="hljs-keyword">for</span> tuple <span class="hljs-keyword">in</span> rules
|
||||
tuple.unshift <span class="hljs-literal">null</span> <span class="hljs-keyword">if</span> tuple.length < <span class="hljs-number">3</span>
|
||||
buildRule tuple...</pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre>LONG_FLAG = <span class="hljs-regexp">/^(--\w[\w\-]*)/</span>
|
||||
SHORT_FLAG = <span class="hljs-regexp">/^(-\w)$/</span>
|
||||
MULTI_FLAG = <span class="hljs-regexp">/^-(\w{2,})/</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -319,22 +308,12 @@ unspecified, leave it out by padding with <code>null</code>.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-11">¶</a>
|
||||
</div>
|
||||
<p>Build a rule from a <code>-o</code> short flag, a <code>--output [DIR]</code> long flag, and the
|
||||
description of what the option does.</p>
|
||||
<p>Matches the long flag part of a rule for an option with an argument. Not
|
||||
applied to anything in process.argv.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">buildRule</span> = <span class="hljs-params">(shortFlag, longFlag, description, options = {})</span> -></span>
|
||||
match = longFlag.match(OPTIONAL)
|
||||
longFlag = longFlag.match(LONG_FLAG)[<span class="hljs-number">1</span>]
|
||||
{
|
||||
name: longFlag.substr <span class="hljs-number">2</span>
|
||||
shortFlag: shortFlag
|
||||
longFlag: longFlag
|
||||
description: description
|
||||
hasArgument: !!(match <span class="hljs-keyword">and</span> match[<span class="hljs-number">1</span>])
|
||||
isList: !!(match <span class="hljs-keyword">and</span> match[<span class="hljs-number">2</span>])
|
||||
}</pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre>OPTIONAL = <span class="hljs-regexp">/\[(\w+(\*?))\]/</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -345,20 +324,156 @@ description of what the option does.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-12">¶</a>
|
||||
</div>
|
||||
<p>Normalize arguments by expanding merged flags into multiple flags. This allows
|
||||
you to have <code>-wl</code> be the same as <code>--watch --lint</code>.</p>
|
||||
<p>Build and return the list of option rules. If the optional <em>short-flag</em> is
|
||||
unspecified, leave it out by padding with <code>null</code>.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">normalizeArguments</span> = <span class="hljs-params">(args)</span> -></span>
|
||||
args = args[..]
|
||||
result = []
|
||||
<span class="hljs-keyword">for</span> arg <span class="hljs-keyword">in</span> args
|
||||
<span class="hljs-keyword">if</span> match = arg.match MULTI_FLAG
|
||||
result.push <span class="hljs-string">'-'</span> + l <span class="hljs-keyword">for</span> l <span class="hljs-keyword">in</span> match[<span class="hljs-number">1</span>].split <span class="hljs-string">''</span>
|
||||
<span class="hljs-keyword">else</span>
|
||||
result.push arg
|
||||
result</pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">buildRules</span> = <span class="hljs-params">(ruleDeclarations)</span> -></span>
|
||||
ruleList = <span class="hljs-keyword">for</span> tuple <span class="hljs-keyword">in</span> ruleDeclarations
|
||||
tuple.unshift <span class="hljs-literal">null</span> <span class="hljs-keyword">if</span> tuple.length < <span class="hljs-number">3</span>
|
||||
buildRule tuple...
|
||||
flagDict = {}
|
||||
<span class="hljs-keyword">for</span> rule <span class="hljs-keyword">in</span> ruleList</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-13">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-13">¶</a>
|
||||
</div>
|
||||
<p><code>shortFlag</code> is null if not provided in the rule.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">for</span> flag <span class="hljs-keyword">in</span> [rule.shortFlag, rule.longFlag] <span class="hljs-keyword">when</span> flag?
|
||||
<span class="hljs-keyword">if</span> flagDict[flag]?
|
||||
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"flag <span class="hljs-subst">#{flag}</span> for switch <span class="hljs-subst">#{rule.name}</span>
|
||||
was already declared for switch <span class="hljs-subst">#{flagDict[flag].name}</span>"</span>
|
||||
flagDict[flag] = rule
|
||||
|
||||
{ruleList, flagDict}</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-14">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-14">¶</a>
|
||||
</div>
|
||||
<p>Build a rule from a <code>-o</code> short flag, a <code>--output [DIR]</code> long flag, and the
|
||||
description of what the option does.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">buildRule</span> = <span class="hljs-params">(shortFlag, longFlag, description)</span> -></span>
|
||||
match = longFlag.match(OPTIONAL)
|
||||
shortFlag = shortFlag?.match(SHORT_FLAG)[<span class="hljs-number">1</span>]
|
||||
longFlag = longFlag.match(LONG_FLAG)[<span class="hljs-number">1</span>]
|
||||
{
|
||||
name: longFlag.replace <span class="hljs-regexp">/^--/</span>, <span class="hljs-string">''</span>
|
||||
shortFlag: shortFlag
|
||||
longFlag: longFlag
|
||||
description: description
|
||||
hasArgument: !!(match <span class="hljs-keyword">and</span> match[<span class="hljs-number">1</span>])
|
||||
isList: !!(match <span class="hljs-keyword">and</span> match[<span class="hljs-number">2</span>])
|
||||
}
|
||||
<span class="hljs-function">
|
||||
<span class="hljs-title">normalizeArguments</span> = <span class="hljs-params">(args, flagDict)</span> -></span>
|
||||
rules = []
|
||||
positional = []
|
||||
needsArgOpt = <span class="hljs-literal">null</span>
|
||||
<span class="hljs-keyword">for</span> arg, argIndex <span class="hljs-keyword">in</span> args</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-15">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-15">¶</a>
|
||||
</div>
|
||||
<p>If the previous argument given to the script was an option that uses the
|
||||
next command-line argument as its argument, create copy of the option’s
|
||||
rule with an <code>argument</code> field.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> needsArgOpt?
|
||||
withArg = Object.assign {}, needsArgOpt.rule, {argument: arg}
|
||||
rules.push withArg
|
||||
needsArgOpt = <span class="hljs-literal">null</span>
|
||||
<span class="hljs-keyword">continue</span>
|
||||
|
||||
multiFlags = arg.match(MULTI_FLAG)?[<span class="hljs-number">1</span>]
|
||||
.split(<span class="hljs-string">''</span>)
|
||||
.map (flagName) -> <span class="hljs-string">"-<span class="hljs-subst">#{flagName}</span>"</span>
|
||||
<span class="hljs-keyword">if</span> multiFlags?
|
||||
multiOpts = multiFlags.map (flag) ->
|
||||
rule = flagDict[flag]
|
||||
<span class="hljs-keyword">unless</span> rule?
|
||||
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"unrecognized option <span class="hljs-subst">#{flag}</span> in multi-flag <span class="hljs-subst">#{arg}</span>"</span>
|
||||
{rule, flag}</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-16">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-16">¶</a>
|
||||
</div>
|
||||
<p>Only the last flag in a multi-flag may have an argument.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> [innerOpts..., lastOpt] = multiOpts
|
||||
<span class="hljs-keyword">for</span> {rule, flag} <span class="hljs-keyword">in</span> innerOpts
|
||||
<span class="hljs-keyword">if</span> rule.hasArgument
|
||||
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"cannot use option <span class="hljs-subst">#{flag}</span> in multi-flag <span class="hljs-subst">#{arg}</span> except
|
||||
as the last option, because it needs an argument"</span>
|
||||
rules.push rule
|
||||
<span class="hljs-keyword">if</span> lastOpt.rule.hasArgument
|
||||
needsArgOpt = lastOpt
|
||||
<span class="hljs-keyword">else</span>
|
||||
rules.push lastOpt.rule
|
||||
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> ([LONG_FLAG, SHORT_FLAG].some (pat) -> arg.match(pat)?)
|
||||
singleRule = flagDict[arg]
|
||||
<span class="hljs-keyword">unless</span> singleRule?
|
||||
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"unrecognized option <span class="hljs-subst">#{arg}</span>"</span>
|
||||
<span class="hljs-keyword">if</span> singleRule.hasArgument
|
||||
needsArgOpt = {rule: singleRule, flag: arg}
|
||||
<span class="hljs-keyword">else</span>
|
||||
rules.push singleRule
|
||||
<span class="hljs-keyword">else</span></pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-17">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-17">¶</a>
|
||||
</div>
|
||||
<p>This is a positional argument.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> positional = args[argIndex..]
|
||||
<span class="hljs-keyword">break</span>
|
||||
|
||||
<span class="hljs-keyword">if</span> needsArgOpt?
|
||||
<span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"value required for <span class="hljs-subst">#{needsArgOpt.flag}</span>, but it was the last
|
||||
argument provided"</span>
|
||||
{rules, positional}</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
|
|
@ -125,6 +125,8 @@ nodeREPL = <span class="hljs-built_in">require</span> <span class="hljs-string">
|
|||
CoffeeScript = <span class="hljs-built_in">require</span> <span class="hljs-string">'./'</span>
|
||||
{merge, updateSyntaxError} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./helpers'</span>
|
||||
|
||||
sawSIGINT = <span class="hljs-literal">no</span>
|
||||
|
||||
replDefaults =
|
||||
prompt: <span class="hljs-string">'coffee> '</span>,
|
||||
historyFile: <span class="hljs-keyword">do</span> ->
|
||||
|
@ -193,7 +195,7 @@ Unwrap that too.</p>
|
|||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> {Block, Assign, Value, Literal} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./nodes'</span>
|
||||
<div class="content"><div class='highlight'><pre> {Block, Assign, Value, Literal, Call, Code} = <span class="hljs-built_in">require</span> <span class="hljs-string">'./nodes'</span>
|
||||
|
||||
<span class="hljs-keyword">try</span></pre></div></div>
|
||||
|
||||
|
@ -225,9 +227,7 @@ Unwrap that too.</p>
|
|||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> referencedVars = (
|
||||
token[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens <span class="hljs-keyword">when</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'IDENTIFIER'</span>
|
||||
)</pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre> referencedVars = (token[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens <span class="hljs-keyword">when</span> token[<span class="hljs-number">0</span>] <span class="hljs-keyword">is</span> <span class="hljs-string">'IDENTIFIER'</span>)</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -253,16 +253,11 @@ Unwrap that too.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-9">¶</a>
|
||||
</div>
|
||||
<p>Add assignment to <code>_</code> variable to force the input to be an expression.</p>
|
||||
<p>Add assignment to <code>__</code> variable to force the input to be an expression.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> ast = <span class="hljs-keyword">new</span> Block [
|
||||
<span class="hljs-keyword">new</span> Assign (<span class="hljs-keyword">new</span> Value <span class="hljs-keyword">new</span> Literal <span class="hljs-string">'__'</span>), ast, <span class="hljs-string">'='</span>
|
||||
]
|
||||
js = ast.compile {bare: <span class="hljs-literal">yes</span>, locals: Object.keys(context), referencedVars}
|
||||
cb <span class="hljs-literal">null</span>, runInContext js, context, filename
|
||||
<span class="hljs-keyword">catch</span> err</pre></div></div>
|
||||
<div class="content"><div class='highlight'><pre> ast = <span class="hljs-keyword">new</span> Block [<span class="hljs-keyword">new</span> Assign (<span class="hljs-keyword">new</span> Value <span class="hljs-keyword">new</span> Literal <span class="hljs-string">'__'</span>), ast, <span class="hljs-string">'='</span>]</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
@ -273,6 +268,60 @@ Unwrap that too.</p>
|
|||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-10">¶</a>
|
||||
</div>
|
||||
<p>Wrap the expression in a closure to support top-level <code>await</code></p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> ast = <span class="hljs-keyword">new</span> Code [], ast
|
||||
isAsync = ast.isAsync</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-11">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-11">¶</a>
|
||||
</div>
|
||||
<p>Invoke the wrapping closure</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> ast = <span class="hljs-keyword">new</span> Block [<span class="hljs-keyword">new</span> Call ast]
|
||||
js = ast.compile {bare: <span class="hljs-literal">yes</span>, locals: Object.keys(context), referencedVars, sharedScope: <span class="hljs-literal">yes</span>}
|
||||
result = runInContext js, context, filename</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-12">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-12">¶</a>
|
||||
</div>
|
||||
<p>Await an async result, if necessary</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>
|
||||
<span class="hljs-keyword">else</span>
|
||||
cb <span class="hljs-literal">null</span>, result
|
||||
<span class="hljs-keyword">catch</span> err</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-13">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-13">¶</a>
|
||||
</div>
|
||||
<p>AST’s <code>compile</code> does not add source code information to syntax errors.</p>
|
||||
|
||||
</div>
|
||||
|
@ -292,11 +341,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-11">
|
||||
<li id="section-14">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-11">¶</a>
|
||||
<a class="pilcrow" href="#section-14">¶</a>
|
||||
</div>
|
||||
<p>Node 0.11.12 changed API, prompt is now _prompt.</p>
|
||||
|
||||
|
@ -313,11 +362,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-12">
|
||||
<li id="section-15">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-12">¶</a>
|
||||
<a class="pilcrow" href="#section-15">¶</a>
|
||||
</div>
|
||||
<p>Proxy node’s line listener</p>
|
||||
|
||||
|
@ -338,11 +387,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-13">
|
||||
<li id="section-16">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-13">¶</a>
|
||||
<a class="pilcrow" href="#section-16">¶</a>
|
||||
</div>
|
||||
<p>Handle Ctrl-v</p>
|
||||
|
||||
|
@ -355,11 +404,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-14">
|
||||
<li id="section-17">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-14">¶</a>
|
||||
<a class="pilcrow" href="#section-17">¶</a>
|
||||
</div>
|
||||
<p>allow arbitrarily switching between modes any time before multiple lines are entered</p>
|
||||
|
||||
|
@ -374,11 +423,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-15">
|
||||
<li id="section-18">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-15">¶</a>
|
||||
<a class="pilcrow" href="#section-18">¶</a>
|
||||
</div>
|
||||
<p>no-op unless the current line is empty</p>
|
||||
|
||||
|
@ -389,11 +438,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-16">
|
||||
<li id="section-19">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-16">¶</a>
|
||||
<a class="pilcrow" href="#section-19">¶</a>
|
||||
</div>
|
||||
<p>eval, print, loop</p>
|
||||
|
||||
|
@ -408,11 +457,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-17">
|
||||
<li id="section-20">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-17">¶</a>
|
||||
<a class="pilcrow" href="#section-20">¶</a>
|
||||
</div>
|
||||
<p>XXX: multiline hack</p>
|
||||
|
||||
|
@ -430,11 +479,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-18">
|
||||
<li id="section-21">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-18">¶</a>
|
||||
<a class="pilcrow" href="#section-21">¶</a>
|
||||
</div>
|
||||
<p>Store and load command history from a file</p>
|
||||
|
||||
|
@ -447,11 +496,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-19">
|
||||
<li id="section-22">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-19">¶</a>
|
||||
<a class="pilcrow" href="#section-22">¶</a>
|
||||
</div>
|
||||
<p>Get file info and at most maxSize of command history</p>
|
||||
|
||||
|
@ -463,11 +512,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-20">
|
||||
<li id="section-23">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-20">¶</a>
|
||||
<a class="pilcrow" href="#section-23">¶</a>
|
||||
</div>
|
||||
<p>Read last <code>size</code> bytes from the file</p>
|
||||
|
||||
|
@ -481,11 +530,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-21">
|
||||
<li id="section-24">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-21">¶</a>
|
||||
<a class="pilcrow" href="#section-24">¶</a>
|
||||
</div>
|
||||
<p>Set the history on the interpreter</p>
|
||||
|
||||
|
@ -496,11 +545,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-22">
|
||||
<li id="section-25">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-22">¶</a>
|
||||
<a class="pilcrow" href="#section-25">¶</a>
|
||||
</div>
|
||||
<p>If the history file was truncated we should pop off a potential partial line</p>
|
||||
|
||||
|
@ -511,11 +560,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-23">
|
||||
<li id="section-26">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-23">¶</a>
|
||||
<a class="pilcrow" href="#section-26">¶</a>
|
||||
</div>
|
||||
<p>Shift off the final blank newline</p>
|
||||
|
||||
|
@ -533,29 +582,43 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-24">
|
||||
<li id="section-27">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-24">¶</a>
|
||||
<a class="pilcrow" href="#section-27">¶</a>
|
||||
</div>
|
||||
<p>Save the latest command in the file</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> fs.writeSync fd, <span class="hljs-string">"<span class="hljs-subst">#{code}</span>\n"</span>
|
||||
lastLine = code
|
||||
lastLine = code</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-28">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-28">¶</a>
|
||||
</div>
|
||||
<p>XXX: The SIGINT event from REPLServer is undocumented, so this is a bit fragile</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> repl.<span class="hljs-literal">on</span> <span class="hljs-string">'SIGINT'</span>, <span class="hljs-function">-></span> sawSIGINT = <span class="hljs-literal">yes</span>
|
||||
repl.<span class="hljs-literal">on</span> <span class="hljs-string">'exit'</span>, <span class="hljs-function">-></span> fs.closeSync fd</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li id="section-25">
|
||||
<li id="section-29">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-25">¶</a>
|
||||
<a class="pilcrow" href="#section-29">¶</a>
|
||||
</div>
|
||||
<p>Add a command to show the history stack</p>
|
||||
|
||||
|
@ -572,11 +635,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-26">
|
||||
<li id="section-30">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-26">¶</a>
|
||||
<a class="pilcrow" href="#section-30">¶</a>
|
||||
</div>
|
||||
<p>Node 0.11 changed API, a command such as ‘.help’ is now stored as ‘help’</p>
|
||||
|
||||
|
@ -605,11 +668,11 @@ Unwrap that too.</p>
|
|||
</li>
|
||||
|
||||
|
||||
<li id="section-27">
|
||||
<li id="section-31">
|
||||
<div class="annotation">
|
||||
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-27">¶</a>
|
||||
<a class="pilcrow" href="#section-31">¶</a>
|
||||
</div>
|
||||
<p>Adapt help inherited from the node REPL</p>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -778,7 +778,7 @@ textarea {
|
|||
<section id="overview">
|
||||
<p><strong>CoffeeScript is a little language that compiles into JavaScript.</strong> Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.</p>
|
||||
<p>The golden rule of CoffeeScript is: <em>“It’s just JavaScript.”</em> The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly from CoffeeScript (and vice-versa). The compiled output is readable, pretty-printed, and tends to run as fast or faster than the equivalent handwritten JavaScript.</p>
|
||||
<p><strong>Latest Version:</strong> <a href="https://github.com/jashkenas/coffeescript/tarball/2.0.0-beta3">2.0.0-beta3</a></p>
|
||||
<p><strong>Latest Version:</strong> <a href="https://github.com/jashkenas/coffeescript/tarball/2.0.0-beta4">2.0.0-beta4</a></p>
|
||||
<blockquote class="uneditable-code-block"><pre><code class="language-bash">npm install -g coffeescript@next
|
||||
</code></pre>
|
||||
</blockquote>
|
||||
|
@ -3444,7 +3444,7 @@ The CoffeeScript logo is available in SVG for use in presentations.</li>
|
|||
</section>
|
||||
<section id="annotated-source">
|
||||
<h2>Annotated Source</h2>
|
||||
<p>You can browse the CoffeeScript 2.0.0-beta3 source in readable, annotated form <a href="http://coffeescript.org/v2/annotated-source/">here</a>. You can also jump directly to a particular source file:</p>
|
||||
<p>You can browse the CoffeeScript 2.0.0-beta4 source in readable, annotated form <a href="http://coffeescript.org/v2/annotated-source/">here</a>. You can also jump directly to a particular source file:</p>
|
||||
<ul>
|
||||
<li><a href="http://coffeescript.org/v2/annotated-source/grammar.html">Grammar Rules — src/grammar</a></li>
|
||||
<li><a href="http://coffeescript.org/v2/annotated-source/lexer.html">Lexing Tokens — src/lexer</a></li>
|
||||
|
@ -3893,6 +3893,24 @@ x = <span class="number">2</span> + <span class="number">2</span>
|
|||
</section>
|
||||
<section id="changelog">
|
||||
<h2>Changelog</h2>
|
||||
<div class="anchor" id="2.0.0-beta4"></div>
|
||||
<h2 class="header">
|
||||
<a href="https://github.com/jashkenas/coffeescript/compare/2.0.0-beta3...2.0.0-beta4">2.0.0-beta4</a>
|
||||
<span class="timestamp"> — <time datetime="2017-08-03">August 3, 2017</time></span>
|
||||
</h2><ul>
|
||||
<li>This release includes <a href="#1.12.7">all the changes from 1.12.6 to 1.12.7</a>.</li>
|
||||
<li><a href="#comments">Line comments</a> (starting with <code>#</code>) are now output in the generated JavaScript.</li>
|
||||
<li><a href="#comments">Block comments</a> (delimited by <code>###</code>) are now allowed anywhere, including inline where they previously weren’t possible. This provides support for <a href="#type-annotations">static type annotations</a> using Flow’s comments-based syntax.</li>
|
||||
<li>Spread syntax (<code>...</code> for objects) is now supported in JSX tags: <code><div {props...} /></code>.</li>
|
||||
<li>Argument parsing for scripts run via <code>coffee</code> is improved. See <a href="#breaking-changes-argument-parsing-and-shebang-lines">breaking changes</a>.</li>
|
||||
<li>CLI: Propagate <code>SIGINT</code> and <code>SIGTERM</code> signals when node is forked.</li>
|
||||
<li><code>await</code> in the REPL is now allowed without requiring a wrapper function.</li>
|
||||
<li><code>do super</code> is now allowed, and other accesses of <code>super</code> like <code>super.x.y</code> or <code>super['x'].y</code> now work.</li>
|
||||
<li>Splat/spread syntax triple dots are now allowed on either the left or the right (so <code>props...</code> or <code>...props</code> are both valid).</li>
|
||||
<li>Tagged template literals are recognized as callable functions.</li>
|
||||
<li>Bugfixes for object spread syntax in nested properties.</li>
|
||||
<li>Bugfixes for destructured function parameter default values.</li>
|
||||
</ul>
|
||||
<div class="anchor" id="1.12.7"></div>
|
||||
<h2 class="header">
|
||||
<a href="https://github.com/jashkenas/coffeescript/compare/1.12.6...1.12.7">1.12.7</a>
|
||||
|
|
1376
docs/v2/test.html
1376
docs/v2/test.html
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,22 @@
|
|||
## Changelog
|
||||
|
||||
```
|
||||
releaseHeader('2017-08-03', '2.0.0-beta4', '2.0.0-beta3')
|
||||
```
|
||||
|
||||
* This release includes [all the changes from 1.12.6 to 1.12.7](#1.12.7).
|
||||
* [Line comments](#comments) (starting with `#`) are now output in the generated JavaScript.
|
||||
* [Block comments](#comments) (delimited by `###`) are now allowed anywhere, including inline where they previously weren’t possible. This provides support for [static type annotations](#type-annotations) using Flow’s comments-based syntax.
|
||||
* Spread syntax (`...` for objects) is now supported in JSX tags: `<div {props...} />`.
|
||||
* Argument parsing for scripts run via `coffee` is improved. See [breaking changes](#breaking-changes-argument-parsing-and-shebang-lines).
|
||||
* CLI: Propagate `SIGINT` and `SIGTERM` signals when node is forked.
|
||||
* `await` in the REPL is now allowed without requiring a wrapper function.
|
||||
* `do super` is now allowed, and other accesses of `super` like `super.x.y` or `super['x'].y` now work.
|
||||
* Splat/spread syntax triple dots are now allowed on either the left or the right (so `props...` or `...props` are both valid).
|
||||
* Tagged template literals are recognized as callable functions.
|
||||
* Bugfixes for object spread syntax in nested properties.
|
||||
* Bugfixes for destructured function parameter default values.
|
||||
|
||||
```
|
||||
releaseHeader('2017-07-16', '1.12.7', '1.12.6')
|
||||
```
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// This **Browser** compatibility layer extends core CoffeeScript functions
|
||||
// to make things work smoothly when compiling code directly in the browser.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// `cake` is a simplified version of [Make](http://www.gnu.org/software/make/)
|
||||
// ([Rake](http://rake.rubyforge.org/), [Jake](https://github.com/280north/jake))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// CoffeeScript can be used both on the server, as a command-line compiler based
|
||||
// on Node.js/V8, or to run CoffeeScript directly in the browser. This module
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// The `coffee` utility. Handles command-line compilation of CoffeeScript
|
||||
// into various forms: saved into `.js` files or printed to stdout
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// The CoffeeScript parser is generated by [Jison](https://github.com/zaach/jison)
|
||||
// from this grammar file. Jison is a bottom-up parser generator, similar in
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// This file contains the common helper functions that we'd like to share among
|
||||
// the **Lexer**, **Rewriter**, and the **Nodes**. Merge objects, flatten
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// Node.js Implementation
|
||||
var CoffeeScript, compile, ext, fn, fs, helpers, i, len, path, ref, vm,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// The CoffeeScript Lexer. Uses a series of token-matching regexes to attempt
|
||||
// matches against the beginning of the source code. When a match is found,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// `nodes.coffee` contains all of the node classes for the syntax tree. Most
|
||||
// nodes are created as the result of actions in the [grammar](grammar.html),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat,
|
||||
slice = [].slice;
|
||||
|
|
|
@ -105,13 +105,16 @@ case 12:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.StatementLiteral($$[$0]));
|
||||
break;
|
||||
case 27:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Op($$[$0], new yy.Value(new yy.Literal(''))));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Op($$[$0],
|
||||
new yy.Value(new yy.Literal(''))));
|
||||
break;
|
||||
case 28: case 271: case 272: case 275:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op($$[$0-1], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op($$[$0-1],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 29:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Op($$[$0-2].concat($$[$0-1]), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Op($$[$0-2].concat($$[$0-1]),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 30:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Block);
|
||||
|
@ -162,34 +165,49 @@ case 48:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.NaNLiteral($$[$0]));
|
||||
break;
|
||||
case 49:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Assign($$[$0-2],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 50:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Assign($$[$0-3],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 51:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Assign($$[$0-4],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 52: case 108: case 112: case 113: case 115: case 116: case 117: case 118: case 120: case 244: case 245:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Value($$[$0]));
|
||||
break;
|
||||
case 54:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Assign(yy.addDataToNode(yy, _$[$0-2])(new yy.Value($$[$0-2])), $$[$0], 'object', {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Assign(yy.addDataToNode(yy, _$[$0-2])(new yy.Value($$[$0-2])),
|
||||
$$[$0],
|
||||
'object',
|
||||
{
|
||||
operatorToken: yy.addDataToNode(yy, _$[$0-1])(new yy.Literal($$[$0-1]))
|
||||
}));
|
||||
break;
|
||||
case 55:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Assign(yy.addDataToNode(yy, _$[$0-4])(new yy.Value($$[$0-4])), $$[$0-1], 'object', {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Assign(yy.addDataToNode(yy, _$[$0-4])(new yy.Value($$[$0-4])),
|
||||
$$[$0-1],
|
||||
'object',
|
||||
{
|
||||
operatorToken: yy.addDataToNode(yy, _$[$0-3])(new yy.Literal($$[$0-3]))
|
||||
}));
|
||||
break;
|
||||
case 56:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Assign(yy.addDataToNode(yy, _$[$0-2])(new yy.Value($$[$0-2])), $$[$0], null, {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Assign(yy.addDataToNode(yy, _$[$0-2])(new yy.Value($$[$0-2])),
|
||||
$$[$0],
|
||||
null,
|
||||
{
|
||||
operatorToken: yy.addDataToNode(yy, _$[$0-1])(new yy.Literal($$[$0-1]))
|
||||
}));
|
||||
break;
|
||||
case 57:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Assign(yy.addDataToNode(yy, _$[$0-4])(new yy.Value($$[$0-4])), $$[$0-1], null, {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Assign(yy.addDataToNode(yy, _$[$0-4])(new yy.Value($$[$0-4])),
|
||||
$$[$0-1],
|
||||
null,
|
||||
{
|
||||
operatorToken: yy.addDataToNode(yy, _$[$0-3])(new yy.Literal($$[$0-3]))
|
||||
}));
|
||||
break;
|
||||
|
@ -206,13 +224,18 @@ case 66: case 107:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Splat($$[$0]));
|
||||
break;
|
||||
case 72:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.SuperCall(yy.addDataToNode(yy, _$[$0-1])(new yy.Super), $$[$0], false, $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.SuperCall(yy.addDataToNode(yy, _$[$0-1])(new yy.Super),
|
||||
$$[$0],
|
||||
false,
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 73:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Call(new yy.Value($$[$0-1]), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Call(new yy.Value($$[$0-1]),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 74:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Call($$[$0-1], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Call($$[$0-1],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 75: case 76:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])((new yy.Value($$[$0-1])).add($$[$0]));
|
||||
|
@ -242,10 +265,14 @@ case 85:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.AwaitReturn);
|
||||
break;
|
||||
case 86:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Code($$[$0-3], $$[$0], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Code($$[$0-3],
|
||||
$$[$0],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 87:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Code([], $$[$0], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Code([],
|
||||
$$[$0],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 88: case 89:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.FuncGlyph($$[$0]));
|
||||
|
@ -269,13 +296,18 @@ case 97:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Param($$[$0]));
|
||||
break;
|
||||
case 98:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Param($$[$0-1], null, true));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Param($$[$0-1],
|
||||
null,
|
||||
true));
|
||||
break;
|
||||
case 99:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Param($$[$0], null, true));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Param($$[$0],
|
||||
null,
|
||||
true));
|
||||
break;
|
||||
case 100:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Param($$[$0-2], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Param($$[$0-2],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 101: case 210:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Expansion);
|
||||
|
@ -284,25 +316,36 @@ case 109:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])($$[$0-1].add($$[$0]));
|
||||
break;
|
||||
case 121:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Super(yy.addDataToNode(yy, _$[$0])(new yy.Access($$[$0])), [], false, $$[$0-2]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Super(yy.addDataToNode(yy, _$[$0])(new yy.Access($$[$0])),
|
||||
[],
|
||||
false,
|
||||
$$[$0-2]));
|
||||
break;
|
||||
case 122:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Super(yy.addDataToNode(yy, _$[$0-1])(new yy.Index($$[$0-1])), [], false, $$[$0-3]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Super(yy.addDataToNode(yy, _$[$0-1])(new yy.Index($$[$0-1])),
|
||||
[],
|
||||
false,
|
||||
$$[$0-3]));
|
||||
break;
|
||||
case 124:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Access($$[$0], 'soak'));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Access($$[$0],
|
||||
'soak'));
|
||||
break;
|
||||
case 125:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])([yy.addDataToNode(yy, _$[$0-1])(new yy.Access(new yy.PropertyName('prototype'))), yy.addDataToNode(yy, _$[$0])(new yy.Access($$[$0]))]);
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])([yy.addDataToNode(yy, _$[$0-1])(new yy.Access(new yy.PropertyName('prototype'))),
|
||||
yy.addDataToNode(yy, _$[$0])(new yy.Access($$[$0]))]);
|
||||
break;
|
||||
case 126:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])([yy.addDataToNode(yy, _$[$0-1])(new yy.Access(new yy.PropertyName('prototype'), 'soak')), yy.addDataToNode(yy, _$[$0])(new yy.Access($$[$0]))]);
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])([yy.addDataToNode(yy, _$[$0-1])(new yy.Access(new yy.PropertyName('prototype'),
|
||||
'soak')),
|
||||
yy.addDataToNode(yy, _$[$0])(new yy.Access($$[$0]))]);
|
||||
break;
|
||||
case 127:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Access(new yy.PropertyName('prototype')));
|
||||
break;
|
||||
case 130:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(yy.extend($$[$0], {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(yy.extend($$[$0],
|
||||
{
|
||||
soak: true
|
||||
}));
|
||||
break;
|
||||
|
@ -313,52 +356,76 @@ case 132:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Slice($$[$0]));
|
||||
break;
|
||||
case 133:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Obj($$[$0-2], $$[$0-3].generated));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Obj($$[$0-2],
|
||||
$$[$0-3].generated));
|
||||
break;
|
||||
case 139:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Class);
|
||||
break;
|
||||
case 140:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Class(null, null, $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Class(null,
|
||||
null,
|
||||
$$[$0]));
|
||||
break;
|
||||
case 141:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Class(null, $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Class(null,
|
||||
$$[$0]));
|
||||
break;
|
||||
case 142:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Class(null, $$[$0-1], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Class(null,
|
||||
$$[$0-1],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 143:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Class($$[$0]));
|
||||
break;
|
||||
case 144:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Class($$[$0-1], null, $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Class($$[$0-1],
|
||||
null,
|
||||
$$[$0]));
|
||||
break;
|
||||
case 145:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Class($$[$0-2], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Class($$[$0-2],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 146:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Class($$[$0-3], $$[$0-1], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Class($$[$0-3],
|
||||
$$[$0-1],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 147:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.ImportDeclaration(null, $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.ImportDeclaration(null,
|
||||
$$[$0]));
|
||||
break;
|
||||
case 148:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause($$[$0-2], null), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause($$[$0-2],
|
||||
null),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 149:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause(null, $$[$0-2]), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause(null,
|
||||
$$[$0-2]),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 150:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause(null, new yy.ImportSpecifierList([])), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause(null,
|
||||
new yy.ImportSpecifierList([])),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 151:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-6], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause(null, new yy.ImportSpecifierList($$[$0-4])), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-6], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause(null,
|
||||
new yy.ImportSpecifierList($$[$0-4])),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 152:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-5], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause($$[$0-4], $$[$0-2]), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-5], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause($$[$0-4],
|
||||
$$[$0-2]),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 153:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-8], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause($$[$0-7], new yy.ImportSpecifierList($$[$0-4])), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-8], _$[$0])(new yy.ImportDeclaration(new yy.ImportClause($$[$0-7],
|
||||
new yy.ImportSpecifierList($$[$0-4])),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 157: case 177: case 190: case 206:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])($$[$0-2]);
|
||||
|
@ -367,19 +434,22 @@ case 159:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.ImportSpecifier($$[$0]));
|
||||
break;
|
||||
case 160:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ImportSpecifier($$[$0-2], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ImportSpecifier($$[$0-2],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 161:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.ImportSpecifier(new yy.Literal($$[$0])));
|
||||
break;
|
||||
case 162:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ImportSpecifier(new yy.Literal($$[$0-2]), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ImportSpecifier(new yy.Literal($$[$0-2]),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 163:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.ImportDefaultSpecifier($$[$0]));
|
||||
break;
|
||||
case 164:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ImportNamespaceSpecifier(new yy.Literal($$[$0-2]), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ImportNamespaceSpecifier(new yy.Literal($$[$0-2]),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 165:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ExportNamedDeclaration(new yy.ExportSpecifierList([])));
|
||||
|
@ -391,17 +461,26 @@ case 167:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.ExportNamedDeclaration($$[$0]));
|
||||
break;
|
||||
case 168:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.ExportNamedDeclaration(new yy.Assign($$[$0-2], $$[$0], null, {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.ExportNamedDeclaration(new yy.Assign($$[$0-2],
|
||||
$$[$0],
|
||||
null,
|
||||
{
|
||||
moduleDeclaration: 'export'
|
||||
})));
|
||||
break;
|
||||
case 169:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.ExportNamedDeclaration(new yy.Assign($$[$0-3], $$[$0], null, {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.ExportNamedDeclaration(new yy.Assign($$[$0-3],
|
||||
$$[$0],
|
||||
null,
|
||||
{
|
||||
moduleDeclaration: 'export'
|
||||
})));
|
||||
break;
|
||||
case 170:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-5], _$[$0])(new yy.ExportNamedDeclaration(new yy.Assign($$[$0-4], $$[$0-1], null, {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-5], _$[$0])(new yy.ExportNamedDeclaration(new yy.Assign($$[$0-4],
|
||||
$$[$0-1],
|
||||
null,
|
||||
{
|
||||
moduleDeclaration: 'export'
|
||||
})));
|
||||
break;
|
||||
|
@ -409,34 +488,46 @@ case 171:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ExportDefaultDeclaration($$[$0]));
|
||||
break;
|
||||
case 172:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.ExportAllDeclaration(new yy.Literal($$[$0-2]), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.ExportAllDeclaration(new yy.Literal($$[$0-2]),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 173:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-6], _$[$0])(new yy.ExportNamedDeclaration(new yy.ExportSpecifierList($$[$0-4]), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-6], _$[$0])(new yy.ExportNamedDeclaration(new yy.ExportSpecifierList($$[$0-4]),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 179:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.ExportSpecifier($$[$0]));
|
||||
break;
|
||||
case 180:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ExportSpecifier($$[$0-2], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ExportSpecifier($$[$0-2],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 181:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ExportSpecifier($$[$0-2], new yy.Literal($$[$0])));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ExportSpecifier($$[$0-2],
|
||||
new yy.Literal($$[$0])));
|
||||
break;
|
||||
case 182:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.ExportSpecifier(new yy.Literal($$[$0])));
|
||||
break;
|
||||
case 183:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ExportSpecifier(new yy.Literal($$[$0-2]), $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.ExportSpecifier(new yy.Literal($$[$0-2]),
|
||||
$$[$0]));
|
||||
break;
|
||||
case 184:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.TaggedTemplateCall($$[$0-2], $$[$0], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.TaggedTemplateCall($$[$0-2],
|
||||
$$[$0],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 185:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Call($$[$0-2],
|
||||
$$[$0],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 186:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.SuperCall(yy.addDataToNode(yy, _$[$0-2])(new yy.Super), $$[$0], $$[$0-1], $$[$0-2]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.SuperCall(yy.addDataToNode(yy, _$[$0-2])(new yy.Super),
|
||||
$$[$0],
|
||||
$$[$0-1],
|
||||
$$[$0-2]));
|
||||
break;
|
||||
case 187:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(false);
|
||||
|
@ -451,7 +542,9 @@ case 191: case 192:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Value(new yy.ThisLiteral($$[$0])));
|
||||
break;
|
||||
case 193:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Value(yy.addDataToNode(yy, _$[$0-1])(new yy.ThisLiteral($$[$0-1])), [yy.addDataToNode(yy, _$[$0])(new yy.Access($$[$0]))], 'this'));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Value(yy.addDataToNode(yy, _$[$0-1])(new yy.ThisLiteral($$[$0-1])),
|
||||
[yy.addDataToNode(yy, _$[$0])(new yy.Access($$[$0]))],
|
||||
'this'));
|
||||
break;
|
||||
case 194:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Arr([]));
|
||||
|
@ -466,43 +559,65 @@ case 197:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])('exclusive');
|
||||
break;
|
||||
case 198:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Range($$[$0-3], $$[$0-1], $$[$0-2]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Range($$[$0-3],
|
||||
$$[$0-1],
|
||||
$$[$0-2]));
|
||||
break;
|
||||
case 199:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Range($$[$0-2], $$[$0], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Range($$[$0-2],
|
||||
$$[$0],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 200:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Range($$[$0-1], null, $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Range($$[$0-1],
|
||||
null,
|
||||
$$[$0]));
|
||||
break;
|
||||
case 201:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Range(null, $$[$0], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Range(null,
|
||||
$$[$0],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 202:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Range(null, null, $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0], _$[$0])(new yy.Range(null,
|
||||
null,
|
||||
$$[$0]));
|
||||
break;
|
||||
case 212:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])([].concat($$[$0-2], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])([].concat($$[$0-2],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 213:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Try($$[$0]));
|
||||
break;
|
||||
case 214:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Try($$[$0-1], $$[$0][0], $$[$0][1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Try($$[$0-1],
|
||||
$$[$0][0],
|
||||
$$[$0][1]));
|
||||
break;
|
||||
case 215:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Try($$[$0-2], null, null, $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Try($$[$0-2],
|
||||
null,
|
||||
null,
|
||||
$$[$0]));
|
||||
break;
|
||||
case 216:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Try($$[$0-3],
|
||||
$$[$0-2][0],
|
||||
$$[$0-2][1],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 217:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])([$$[$0-1], $$[$0]]);
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])([$$[$0-1],
|
||||
$$[$0]]);
|
||||
break;
|
||||
case 218:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])([yy.addDataToNode(yy, _$[$0-1])(new yy.Value($$[$0-1])), $$[$0]]);
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])([yy.addDataToNode(yy, _$[$0-1])(new yy.Value($$[$0-1])),
|
||||
$$[$0]]);
|
||||
break;
|
||||
case 219:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])([null, $$[$0]]);
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])([null,
|
||||
$$[$0]]);
|
||||
break;
|
||||
case 220:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Throw($$[$0]));
|
||||
|
@ -520,17 +635,20 @@ case 224:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.While($$[$0]));
|
||||
break;
|
||||
case 225:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.While($$[$0-2], {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.While($$[$0-2],
|
||||
{
|
||||
guard: $$[$0]
|
||||
}));
|
||||
break;
|
||||
case 226:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.While($$[$0], {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.While($$[$0],
|
||||
{
|
||||
invert: true
|
||||
}));
|
||||
break;
|
||||
case 227:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.While($$[$0-2], {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.While($$[$0-2],
|
||||
{
|
||||
invert: true,
|
||||
guard: $$[$0]
|
||||
}));
|
||||
|
@ -551,10 +669,12 @@ case 233:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.While(yy.addDataToNode(yy, _$[$0-1])(new yy.BooleanLiteral('true'))).addBody(yy.addDataToNode(yy, _$[$0])(yy.Block.wrap([$$[$0]]))));
|
||||
break;
|
||||
case 234: case 235:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.For($$[$0-1],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 236:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.For($$[$0], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.For($$[$0],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 237:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])({
|
||||
|
@ -587,7 +707,8 @@ this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])((function () {
|
|||
}()));
|
||||
break;
|
||||
case 247:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])([$$[$0-2], $$[$0]]);
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])([$$[$0-2],
|
||||
$$[$0]]);
|
||||
break;
|
||||
case 248:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])({
|
||||
|
@ -647,33 +768,45 @@ this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])({
|
|||
});
|
||||
break;
|
||||
case 257:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Switch($$[$0-3], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Switch($$[$0-3],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 258:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-6], _$[$0])(new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-6], _$[$0])(new yy.Switch($$[$0-5],
|
||||
$$[$0-3],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 259:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Switch(null, $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Switch(null,
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 260:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-5], _$[$0])(new yy.Switch(null, $$[$0-3], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-5], _$[$0])(new yy.Switch(null,
|
||||
$$[$0-3],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 262:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])($$[$0-1].concat($$[$0]));
|
||||
break;
|
||||
case 263:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])([[$$[$0-1], $$[$0]]]);
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])([[$$[$0-1],
|
||||
$$[$0]]]);
|
||||
break;
|
||||
case 264:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])([[$$[$0-2], $$[$0-1]]]);
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])([[$$[$0-2],
|
||||
$$[$0-1]]]);
|
||||
break;
|
||||
case 265:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.If($$[$0-1],
|
||||
$$[$0],
|
||||
{
|
||||
type: $$[$0-2]
|
||||
}));
|
||||
break;
|
||||
case 266:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])($$[$0-4].addElse(yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])($$[$0-4].addElse(yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.If($$[$0-1],
|
||||
$$[$0],
|
||||
{
|
||||
type: $$[$0-2]
|
||||
}))));
|
||||
break;
|
||||
|
@ -681,58 +814,86 @@ case 268:
|
|||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])($$[$0-2].addElse($$[$0]));
|
||||
break;
|
||||
case 269: case 270:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.If($$[$0], yy.addDataToNode(yy, _$[$0-2])(yy.Block.wrap([$$[$0-2]])), {
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.If($$[$0],
|
||||
yy.addDataToNode(yy, _$[$0-2])(yy.Block.wrap([$$[$0-2]])),
|
||||
{
|
||||
type: $$[$0-1],
|
||||
statement: true
|
||||
}));
|
||||
break;
|
||||
case 273:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('-', $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('-',
|
||||
$$[$0]));
|
||||
break;
|
||||
case 274:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('+', $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('+',
|
||||
$$[$0]));
|
||||
break;
|
||||
case 276:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('--', $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('--',
|
||||
$$[$0]));
|
||||
break;
|
||||
case 277:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('++', $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('++',
|
||||
$$[$0]));
|
||||
break;
|
||||
case 278:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('--', $$[$0-1], null, true));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('--',
|
||||
$$[$0-1],
|
||||
null,
|
||||
true));
|
||||
break;
|
||||
case 279:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('++', $$[$0-1], null, true));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Op('++',
|
||||
$$[$0-1],
|
||||
null,
|
||||
true));
|
||||
break;
|
||||
case 280:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-1], _$[$0])(new yy.Existence($$[$0-1]));
|
||||
break;
|
||||
case 281:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Op('+', $$[$0-2], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Op('+',
|
||||
$$[$0-2],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 282:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Op('-', $$[$0-2], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Op('-',
|
||||
$$[$0-2],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 283: case 284: case 285: case 286: case 287: case 288: case 289: case 290: case 291: case 292:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Op($$[$0-1],
|
||||
$$[$0-2],
|
||||
$$[$0]));
|
||||
break;
|
||||
case 293:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])((function () {
|
||||
if ($$[$0-1].charAt(0) === '!') {
|
||||
return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert();
|
||||
return new yy.Op($$[$0-1].slice(1),
|
||||
$$[$0-2],
|
||||
$$[$0]).invert();
|
||||
} else {
|
||||
return new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
|
||||
return new yy.Op($$[$0-1],
|
||||
$$[$0-2],
|
||||
$$[$0]);
|
||||
}
|
||||
}()));
|
||||
break;
|
||||
case 294:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0], $$[$0-1]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-2], _$[$0])(new yy.Assign($$[$0-2],
|
||||
$$[$0],
|
||||
$$[$0-1]));
|
||||
break;
|
||||
case 295:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-4], _$[$0])(new yy.Assign($$[$0-4],
|
||||
$$[$0-1],
|
||||
$$[$0-3]));
|
||||
break;
|
||||
case 296:
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0], $$[$0-2]));
|
||||
this.$ = yy.addDataToNode(yy, _$[$0-3], _$[$0])(new yy.Assign($$[$0-3],
|
||||
$$[$0],
|
||||
$$[$0-2]));
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, i, len, loadFile, path, ref;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, replDefaults, runInContext, sawSIGINT, updateSyntaxError, vm;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// The CoffeeScript language has a good deal of optional syntax, implicit syntax,
|
||||
// and shorthand syntax. This can greatly complicate a grammar and bloat
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// The **Scope** class regulates lexical scoping within CoffeeScript. As you
|
||||
// generate code, you create a tree of scopes in the same shape as the nested
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 2.0.0-beta3
|
||||
// Generated by CoffeeScript 2.0.0-beta4
|
||||
(function() {
|
||||
// Source maps allow JavaScript runtimes to match running JavaScript back to
|
||||
// the original source code that corresponds to it. This can be minified
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"compiler"
|
||||
],
|
||||
"author": "Jeremy Ashkenas",
|
||||
"version": "2.0.0-beta3",
|
||||
"version": "2.0.0-beta4",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=7.6.0"
|
||||
|
|
Loading…
Reference in New Issue