making all assignment-y operators use a colon -- now it's +: -: *: /:, and friends

This commit is contained in:
Jeremy Ashkenas
2009-12-24 22:25:29 -08:00
parent 6865f5be92
commit beae912a91
4 changed files with 14 additions and 8 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,7 +26,7 @@ prechigh
left '<=' '<' '>' '>='
right '==' '!=' IS ISNT
left '&&' '||' AND OR
right '-=' '+=' '/=' '*='
right '-:' '+:' '/:' '*:' '%:'
right DELETE INSTANCEOF TYPEOF
left "."
right THROW FOR IN WHILE NEW SUPER
@@ -179,10 +179,11 @@ 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]) }

View File

@@ -359,6 +359,11 @@ module CoffeeScript
'is' => '===',
"isnt" => "!==",
'not' => '!',
'+:' => '+=',
'-:' => '-=',
'*:' => '*=',
'/:' => '/=',
'%:' => '%='
}
CONDITIONALS = ['||:', '&&:']
PREFIX_OPERATORS = ['typeof', 'delete']