going back to familiar operators +: is just too strange

This commit is contained in:
Jeremy Ashkenas
2009-12-25 07:31:51 -08:00
parent 968aeec523
commit 55bf0a2c61
9 changed files with 24 additions and 29 deletions

View File

@@ -241,7 +241,7 @@
</dict>
<dict>
<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|isnt|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>
<string>keyword.operator.cs</string>
</dict>

View File

@@ -26,12 +26,12 @@ prechigh
left '<=' '<' '>' '>='
right '==' '!=' IS ISNT
left '&&' '||' AND OR
right '-:' '+:' '/:' '*:' '%:'
right '-=' '+=' '/=' '*=' '%='
right DELETE INSTANCEOF TYPEOF
left "."
right THROW FOR IN WHILE NEW SUPER
left UNLESS IF ELSE EXTENDS
left ":" '||:' '&&:'
left ":" '||=' '&&='
right RETURN
preclow
@@ -179,13 +179,13 @@ rule
| Expression AND Expression { result = OpNode.new(val[1], val[0], val[2]) }
| Expression OR 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]) }
| 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 '+=' 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]) }
| Expression '&&=' Expression { result = OpNode.new(val[1], val[0], val[2]) }
| DELETE Expression { result = OpNode.new(val[0], val[1]) }
| TYPEOF Expression { result = OpNode.new(val[0], val[1]) }

View File

@@ -7,12 +7,12 @@ loader: {
# Reload the coffee-script environment from source.
reload: topId, path =>
coffeescript ||: require('coffee-script')
coffeescript ||= require('coffee-script')
factories[topId]: coffeescript.makeNarwhalFactory(path).
# Ensure that the coffee-script environment is loaded.
load: topId, path =>
factories[topId] ||: this.reload(topId, path).
factories[topId] ||= this.reload(topId, path).
}

View File

@@ -358,14 +358,9 @@ module CoffeeScript
'or' => '||',
'is' => '===',
"isnt" => "!==",
'not' => '!',
'+:' => '+=',
'-:' => '-=',
'*:' => '*=',
'/:' => '/=',
'%:' => '%='
'not' => '!'
}
CONDITIONALS = ['||:', '&&:']
CONDITIONALS = ['||=', '&&=']
PREFIX_OPERATORS = ['typeof', 'delete']
attr_reader :operator, :first, :second