mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 19:11:22 -05:00
made In node invertible
This commit is contained in:
@@ -525,37 +525,34 @@ grammar =
|
||||
# -type rule, but in order to make the precedence binding possible, separate
|
||||
# rules are necessary.
|
||||
Operation: [
|
||||
o "UNARY Expression", -> new Op $1, $2
|
||||
o "- Expression", (-> new Op '-', $2), prec: 'UNARY'
|
||||
o "+ Expression", (-> new Op '+', $2), prec: 'UNARY'
|
||||
o 'UNARY Expression', -> new Op $1 , $2
|
||||
o '- Expression', (-> new Op '-', $2), prec: 'UNARY'
|
||||
o '+ Expression', (-> new Op '+', $2), prec: 'UNARY'
|
||||
|
||||
o "-- SimpleAssignable", -> new Op '--', $2
|
||||
o "++ SimpleAssignable", -> new Op '++', $2
|
||||
o "SimpleAssignable --", -> new Op '--', $1, null, true
|
||||
o "SimpleAssignable ++", -> new Op '++', $1, null, true
|
||||
o '-- SimpleAssignable', -> new Op '--', $2
|
||||
o '++ SimpleAssignable', -> new Op '++', $2
|
||||
o 'SimpleAssignable --', -> new Op '--', $1, null, true
|
||||
o 'SimpleAssignable ++', -> new Op '++', $1, null, true
|
||||
|
||||
o "Expression + Expression", -> new Op '+', $1, $3
|
||||
o "Expression - Expression", -> new Op '-', $1, $3
|
||||
o "Expression == Expression", -> new Op '==', $1, $3
|
||||
o "Expression != Expression", -> new Op '!=', $1, $3
|
||||
o 'Expression + Expression', -> new Op '+' , $1, $3
|
||||
o 'Expression - Expression', -> new Op '-' , $1, $3
|
||||
o 'Expression == Expression', -> new Op '==', $1, $3
|
||||
o 'Expression != Expression', -> new Op '!=', $1, $3
|
||||
|
||||
o "Expression MATH Expression", -> new Op $2, $1, $3
|
||||
o "Expression SHIFT Expression", -> new Op $2, $1, $3
|
||||
o "Expression COMPARE Expression", -> new Op $2, $1, $3
|
||||
o "Expression LOGIC Expression", -> new Op $2, $1, $3
|
||||
o "SimpleAssignable COMPOUND_ASSIGN Expression",
|
||||
-> new Assign $1, $3, $2
|
||||
o "SimpleAssignable COMPOUND_ASSIGN INDENT Expression OUTDENT",
|
||||
-> new Assign $1, $4, $2
|
||||
|
||||
o "Expression RELATION Expression", ->
|
||||
o 'Expression MATH Expression', -> new Op $2, $1, $3
|
||||
o 'Expression SHIFT Expression', -> new Op $2, $1, $3
|
||||
o 'Expression COMPARE Expression', -> new Op $2, $1, $3
|
||||
o 'Expression LOGIC Expression', -> new Op $2, $1, $3
|
||||
o 'Expression RELATION Expression', ->
|
||||
if $2.charAt(0) is '!'
|
||||
if $2 is '!in'
|
||||
new Op '!', new In $1, $3
|
||||
else
|
||||
new Op '!', new Parens new Op $2.slice(1), $1, $3
|
||||
new Op($2.slice(1), $1, $3).invert()
|
||||
else
|
||||
if $2 is 'in' then new In $1, $3 else new Op $2, $1, $3
|
||||
new Op $2, $1, $3
|
||||
|
||||
o 'SimpleAssignable COMPOUND_ASSIGN Expression',
|
||||
-> new Assign $1, $3, $2
|
||||
o 'SimpleAssignable COMPOUND_ASSIGN INDENT Expression OUTDENT',
|
||||
-> new Assign $1, $4, $2
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user