Skip to content
This repository
Browse code

Inline awaits now work

  • Loading branch information...
commit 6f69b862e278d1a0dfeca12160a131c721367aa4 1 parent 628bebd
Maxwell Krohn authored November 24, 2011
6  lib/coffee-script/grammar.js
@@ -38,6 +38,8 @@
38 38
     Await: [
39 39
       o('AWAIT Block', function() {
40 40
         return new Await($2);
  41
+      }), o('AWAIT Expression', function() {
  42
+        return new Await(Block.wrap([$2]));
41 43
       })
42 44
     ],
43 45
     Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class'), o('Throw')],
@@ -297,8 +299,6 @@
297 299
         return new Range($1, null, $2);
298 300
       }), o('RangeDots Expression', function() {
299 301
         return new Range(null, $2, $1);
300  
-      }), o('RangeDots', function() {
301  
-        return new Range(null, null, $1);
302 302
       })
303 303
     ],
304 304
     ArgList: [
@@ -567,7 +567,7 @@
567 567
     ]
568 568
   };
569 569
 
570  
-  operators = [['left', '.', '?.', '::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['right', 'POST_IF']];
  570
+  operators = [['left', '.', '?.', '::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'DO', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS', 'AWAIT'], ['right', 'POST_IF']];
571 571
 
572 572
   tokens = [];
573 573
 
380  lib/coffee-script/parser.js
227 additions, 153 deletions not shown
5  src/grammar.coffee
@@ -83,7 +83,8 @@ grammar =
83 83
   ]
84 84
 
85 85
   Await: [
86  
-    o 'AWAIT Block',                            -> new Await $2
  86
+    o 'AWAIT Block',                             -> new Await $2
  87
+    o 'AWAIT Expression',                        -> new Await Block.wrap [$2 ]
87 88
   ]
88 89
 
89 90
   # All the different types of expressions in our language. The basic unit of
@@ -574,7 +575,7 @@ operators = [
574 575
   ['nonassoc',  'INDENT', 'OUTDENT']
575 576
   ['right',     '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS']
576 577
   ['right',     'FORIN', 'FOROF', 'BY', 'WHEN']
577  
-  ['right',     'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS']
  578
+  ['right',     'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS', 'AWAIT' ]
578 579
   ['right',     'POST_IF']
579 580
 ]
580 581
 

0 notes on commit 6f69b86

Please sign in to comment.
Something went wrong with that request. Please try again.