trading aint for isnt -- let's be serious

This commit is contained in:
Jeremy Ashkenas
2009-12-24 17:21:20 -08:00
parent 95bfb0b45c
commit 985e0a080b
12 changed files with 14 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
launch() if ignition is on launch() if ignition is on
volume: 10 if band aint spinal_tap volume: 10 if band isnt spinal_tap
let_the_wild_rumpus_begin() unless answer is no let_the_wild_rumpus_begin() unless answer is no

View File

@@ -278,7 +278,7 @@ coffee-script --print app/scripts/*.cs > concatenation.js</pre>
CoffeeScript compiles <tt>==</tt> into <tt>===</tt>, and <tt>!=</tt> into CoffeeScript compiles <tt>==</tt> into <tt>===</tt>, and <tt>!=</tt> into
<tt>!==</tt>. <tt>!==</tt>.
In addition, <tt>is</tt> compiles into <tt>===</tt>, In addition, <tt>is</tt> compiles into <tt>===</tt>,
and <tt>aint</tt> into <tt>!==</tt>. and <tt>isnt</tt> into <tt>!==</tt>.
</p> </p>
<p> <p>
You can use <tt>not</tt> as an alias for <tt>!</tt>. You can use <tt>not</tt> as an alias for <tt>!</tt>.

View File

@@ -5,7 +5,7 @@ sum: x, y => x + y.
odd: x => x % 2 is 0. odd: x => x % 2 is 0.
even: x => x % 2 aint 0. even: x => x % 2 isnt 0.
run_loop: => run_loop: =>
fire_events( e => e.stopPropagation(). ) fire_events( e => e.stopPropagation(). )

View File

@@ -49,7 +49,7 @@ _.each: obj, iterator, context =>
return iterator.call(context, item, i, obj) for item, i in obj. if _.isArray(obj) or _.isArguments(obj) return iterator.call(context, item, i, obj) for item, i in obj. if _.isArray(obj) or _.isArguments(obj)
iterator.call(context, obj[key], key, obj) for key in _.keys(obj). iterator.call(context, obj[key], key, obj) for key in _.keys(obj).
catch e catch e
throw e if e aint breaker. throw e if e isnt breaker.
obj. obj.
# Return the results of applying the iterator to each element. Use JavaScript # Return the results of applying the iterator to each element. Use JavaScript

View File

@@ -453,7 +453,7 @@ var eldest = 24 > 21 ? "Liz" : "Ike";
CoffeeScript compiles <tt>==</tt> into <tt>===</tt>, and <tt>!=</tt> into CoffeeScript compiles <tt>==</tt> into <tt>===</tt>, and <tt>!=</tt> into
<tt>!==</tt>. <tt>!==</tt>.
In addition, <tt>is</tt> compiles into <tt>===</tt>, In addition, <tt>is</tt> compiles into <tt>===</tt>,
and <tt>aint</tt> into <tt>!==</tt>. and <tt>isnt</tt> into <tt>!==</tt>.
</p> </p>
<p> <p>
You can use <tt>not</tt> as an alias for <tt>!</tt>. You can use <tt>not</tt> as an alias for <tt>!</tt>.
@@ -476,7 +476,7 @@ var eldest = 24 > 21 ? "Liz" : "Ike";
</p> </p>
<div class='code'><pre class="idle">launch() <span class="Keyword">if</span> ignition <span class="Keyword">is</span> <span class="BuiltInConstant">on</span> <div class='code'><pre class="idle">launch() <span class="Keyword">if</span> ignition <span class="Keyword">is</span> <span class="BuiltInConstant">on</span>
volume<span class="Keyword">:</span> <span class="Number">10</span> <span class="Keyword">if</span> band <span class="Keyword">aint</span> spinal_tap volume<span class="Keyword">:</span> <span class="Number">10</span> <span class="Keyword">if</span> band isnt spinal_tap
let_the_wild_rumpus_begin() <span class="Keyword">unless</span> answer <span class="Keyword">is</span> <span class="BuiltInConstant">no</span> let_the_wild_rumpus_begin() <span class="Keyword">unless</span> answer <span class="Keyword">is</span> <span class="BuiltInConstant">no</span>

View File

@@ -241,7 +241,7 @@
</dict> </dict>
<dict> <dict>
<key>match</key> <key>match</key>
<string>!|\$|%|&amp;|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|&lt;=|&gt;=|&lt;&lt;=|&gt;&gt;=|&gt;&gt;&gt;=|&lt;&gt;|&lt;|&gt;|!|&amp;&amp;|\?|\|\||\:|\*=|(?&lt;!\()/=|%=|\+=|\-=|&amp;=|\^=|\b(in|instanceof|new|delete|typeof|and|or|is|aint|not)\b</string> <string>!|\$|%|&amp;|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|&lt;=|&gt;=|&lt;&lt;=|&gt;&gt;=|&gt;&gt;&gt;=|&lt;&gt;|&lt;|&gt;|!|&amp;&amp;|\?|\|\||\:|\*=|(?&lt;!\()/=|%=|\+=|\-=|&amp;=|\^=|\b(in|instanceof|new|delete|typeof|and|or|is|isnt|not)\b</string>
<key>name</key> <key>name</key>
<string>keyword.operator.cs</string> <string>keyword.operator.cs</string>
</dict> </dict>

View File

@@ -24,7 +24,7 @@ prechigh
left '<<' '>>' '>>>' left '<<' '>>' '>>>'
left '&' '|' '^' left '&' '|' '^'
left '<=' '<' '>' '>=' left '<=' '<' '>' '>='
right '==' '!=' IS AINT right '==' '!=' IS ISNT
left '&&' '||' AND OR left '&&' '||' AND OR
right '-=' '+=' '/=' '*=' right '-=' '+=' '/=' '*='
right DELETE INSTANCEOF TYPEOF right DELETE INSTANCEOF TYPEOF
@@ -172,7 +172,7 @@ rule
| Expression '==' Expression { result = OpNode.new(val[1], val[0], val[2]) } | Expression '==' Expression { result = OpNode.new(val[1], val[0], val[2]) }
| Expression '!=' Expression { result = OpNode.new(val[1], val[0], val[2]) } | Expression '!=' Expression { result = OpNode.new(val[1], val[0], val[2]) }
| Expression IS Expression { result = OpNode.new(val[1], val[0], val[2]) } | Expression IS Expression { result = OpNode.new(val[1], val[0], val[2]) }
| Expression AINT Expression { result = OpNode.new(val[1], val[0], val[2]) } | Expression ISNT Expression { result = OpNode.new(val[1], val[0], val[2]) }
| Expression '&&' Expression { result = OpNode.new(val[1], val[0], val[2]) } | Expression '&&' Expression { result = OpNode.new(val[1], val[0], val[2]) }
| Expression '||' Expression { result = OpNode.new(val[1], val[0], val[2]) } | Expression '||' Expression { result = OpNode.new(val[1], val[0], val[2]) }

View File

@@ -8,7 +8,7 @@ module CoffeeScript
# The list of keywords passed verbatim to the parser. # The list of keywords passed verbatim to the parser.
KEYWORDS = ["if", "else", "then", "unless", KEYWORDS = ["if", "else", "then", "unless",
"true", "false", "yes", "no", "on", "off", "true", "false", "yes", "no", "on", "off",
"and", "or", "is", "aint", "not", "and", "or", "is", "isnt", "not",
"new", "return", "new", "return",
"try", "catch", "finally", "throw", "try", "catch", "finally", "throw",
"break", "continue", "break", "continue",

View File

@@ -357,7 +357,7 @@ module CoffeeScript
'and' => '&&', 'and' => '&&',
'or' => '||', 'or' => '||',
'is' => '===', 'is' => '===',
"aint" => "!==", "isnt" => "!==",
'not' => '!', 'not' => '!',
} }
CONDITIONALS = ['||:', '&&:'] CONDITIONALS = ['||:', '&&:']

View File

@@ -10,5 +10,5 @@ _.each: obj, iterator, context =>
else else
iterator.call(context, obj[key], key, obj) for key in _.keys(obj).. iterator.call(context, obj[key], key, obj) for key in _.keys(obj)..
catch e catch e
throw e if e aint breaker. throw e if e isnt breaker.
obj. obj.

View File

@@ -1 +1 @@
[[:COMMENT, [" The cornerstone, an each implementation.", " Handles objects implementing forEach, arrays, and raw objects."]], ["\n", "\n"], [:IDENTIFIER, "_"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "each"], [":", ":"], [:PARAM, "obj"], [",", ","], [:PARAM, "iterator"], [",", ","], [:PARAM, "context"], ["=>", "=>"], ["\n", "\n"], [:IDENTIFIER, "index"], [":", ":"], [:NUMBER, "0"], ["\n", "\n"], [:TRY, "try"], ["\n", "\n"], [:IF, "if"], [:IDENTIFIER, "obj"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "forEach"], ["\n", "\n"], [:IDENTIFIER, "obj"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "forEach"], ["(", "("], [:IDENTIFIER, "iterator"], [",", ","], [:IDENTIFIER, "context"], [")", ")"], ["\n", "\n"], [:ELSE, "else"], [:IF, "if"], [:IDENTIFIER, "_"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "isArray"], ["(", "("], [:IDENTIFIER, "obj"], [")", ")"], [:OR, "or"], [:IDENTIFIER, "_"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "isArguments"], ["(", "("], [:IDENTIFIER, "obj"], [")", ")"], ["\n", "\n"], [:IDENTIFIER, "iterator"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "call"], ["(", "("], [:IDENTIFIER, "context"], [",", ","], [:IDENTIFIER, "item"], [",", ","], [:IDENTIFIER, "i"], [",", ","], [:IDENTIFIER, "obj"], [")", ")"], [:FOR, "for"], [:IDENTIFIER, "item"], [",", ","], [:IDENTIFIER, "i"], [:IN, "in"], [:IDENTIFIER, "obj"], [".", "."], ["\n", "\n"], [:ELSE, "else"], ["\n", "\n"], [:IDENTIFIER, "iterator"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "call"], ["(", "("], [:IDENTIFIER, "context"], [",", ","], [:IDENTIFIER, "obj"], ["[", "["], [:IDENTIFIER, "key"], ["]", "]"], [",", ","], [:IDENTIFIER, "key"], [",", ","], [:IDENTIFIER, "obj"], [")", ")"], [:FOR, "for"], [:IDENTIFIER, "key"], [:IN, "in"], [:IDENTIFIER, "_"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "keys"], ["(", "("], [:IDENTIFIER, "obj"], [")", ")"], [".", "."], [".", "."], ["\n", "\n"], [:CATCH, "catch"], [:IDENTIFIER, "e"], ["\n", "\n"], [:THROW, "throw"], [:IDENTIFIER, "e"], [:IF, "if"], [:IDENTIFIER, "e"], [:AINT, "aint"], [:IDENTIFIER, "breaker"], [".", "."], ["\n", "\n"], [:IDENTIFIER, "obj"], [".", "."]] [[:COMMENT, [" The cornerstone, an each implementation.", " Handles objects implementing forEach, arrays, and raw objects."]], ["\n", "\n"], [:IDENTIFIER, "_"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "each"], [":", ":"], [:PARAM, "obj"], [",", ","], [:PARAM, "iterator"], [",", ","], [:PARAM, "context"], ["=>", "=>"], ["\n", "\n"], [:IDENTIFIER, "index"], [":", ":"], [:NUMBER, "0"], ["\n", "\n"], [:TRY, "try"], ["\n", "\n"], [:IF, "if"], [:IDENTIFIER, "obj"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "forEach"], ["\n", "\n"], [:IDENTIFIER, "obj"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "forEach"], ["(", "("], [:IDENTIFIER, "iterator"], [",", ","], [:IDENTIFIER, "context"], [")", ")"], ["\n", "\n"], [:ELSE, "else"], [:IF, "if"], [:IDENTIFIER, "_"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "isArray"], ["(", "("], [:IDENTIFIER, "obj"], [")", ")"], [:OR, "or"], [:IDENTIFIER, "_"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "isArguments"], ["(", "("], [:IDENTIFIER, "obj"], [")", ")"], ["\n", "\n"], [:IDENTIFIER, "iterator"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "call"], ["(", "("], [:IDENTIFIER, "context"], [",", ","], [:IDENTIFIER, "item"], [",", ","], [:IDENTIFIER, "i"], [",", ","], [:IDENTIFIER, "obj"], [")", ")"], [:FOR, "for"], [:IDENTIFIER, "item"], [",", ","], [:IDENTIFIER, "i"], [:IN, "in"], [:IDENTIFIER, "obj"], [".", "."], ["\n", "\n"], [:ELSE, "else"], ["\n", "\n"], [:IDENTIFIER, "iterator"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "call"], ["(", "("], [:IDENTIFIER, "context"], [",", ","], [:IDENTIFIER, "obj"], ["[", "["], [:IDENTIFIER, "key"], ["]", "]"], [",", ","], [:IDENTIFIER, "key"], [",", ","], [:IDENTIFIER, "obj"], [")", ")"], [:FOR, "for"], [:IDENTIFIER, "key"], [:IN, "in"], [:IDENTIFIER, "_"], [:PROPERTY_ACCESS, "."], [:IDENTIFIER, "keys"], ["(", "("], [:IDENTIFIER, "obj"], [")", ")"], [".", "."], [".", "."], ["\n", "\n"], [:CATCH, "catch"], [:IDENTIFIER, "e"], ["\n", "\n"], [:THROW, "throw"], [:IDENTIFIER, "e"], [:IF, "if"], [:IDENTIFIER, "e"], [:ISNT, "isnt"], [:IDENTIFIER, "breaker"], [".", "."], ["\n", "\n"], [:IDENTIFIER, "obj"], [".", "."]]

View File

@@ -1,4 +1,4 @@
nums: n * n for n in [1, 2, 3] if n % 2 aint 0. nums: n * n for n in [1, 2, 3] if n % 2 isnt 0.
result: n * 2 for n in nums. result: n * 2 for n in nums.
print(result.join(',') is '2,18') print(result.join(',') is '2,18')