lib/parser.js
function() {
    var stmt = this.stmt()
      , state = this.prevState
      , block
      , op;

    // special-case statements since it
    // is not an expression. We could
    // implement postfix conditionals at
    // the expression level, however they
    // would then fail to enclose properties
    if (this.allowPostfix) {
      this.allowPostfix = false;
      state = 'expression';
    }

    switch (state) {
      case 'assignment':
      case 'expression':
      case 'function arguments':
        while (op =
             this.accept('if')
          || this.accept('unless')
          || this.accept('for')) {
          switch (op.type) {
            case 'if':
            case 'unless':
              stmt = new nodes.If(this.expression(), stmt);
              stmt.postfix = true;
              stmt.negate = 'unless' == op.type;
              this.accept(';');
              break;
            case 'for':
              var key
                , val = this.id().name;
              if (this.accept(',')) key = this.id().name;
              this.expect('in');
              var each = new nodes.Each(val, key, this.expression());
              block = new nodes.Block(this.parent, each);
              block.push(stmt);
              each.block = block;
              stmt = each;
          }
        }
    }

    return stmt;
  }
function() {
    var stmt = this.stmt()
      , state = this.prevState
      , block
      , op;

    // special-case statements since it
    // is not an expression. We could
    // implement postfix conditionals at
    // the expression level, however they
    // would then fail to enclose properties
    if (this.allowPostfix) {
      this.allowPostfix = false;
      state = 'expression';
    }

    switch (state) {
      case 'assignment':
      case 'expression':
      case 'function arguments':
        while (op =
             this.accept('if')
          || this.accept('unless')
          || this.accept('for')) {
          switch (op.type) {
            case 'if':
            case 'unless':
              stmt = new nodes.If(this.expression(), stmt);
              stmt.postfix = true;
              stmt.negate = 'unless' == op.type;
              this.accept(';');
              break;
            case 'for':
              var key
                , val = this.id().name;
              if (this.accept(',')) key = this.id().name;
              this.expect('in');
              var each = new nodes.Each(val, key, this.expression());
              block = new nodes.Block(this.parent, each);
              block.push(stmt);
              each.block = block;
              stmt = each;
          }
        }
    }

    return stmt;
  }
function ( ) { var stmt = this . stmt ( ) , state = this . prevState , block , op ; // special-case statements since it // is not an expression. We could // implement postfix conditionals at // the expression level, however they // would then fail to enclose properties if ( this . allowPostfix ) { this . allowPostfix = false ; state = 'expression' ; } switch ( state ) { case 'assignment' : case 'expression' : case 'function arguments' : while ( op = this . accept ( 'if' ) || this . accept ( 'unless' ) || this . accept ( 'for' ) ) { switch ( op . type ) { case 'if' : case 'unless' : stmt = new nodes . If ( this . expression ( ) , stmt ) ; stmt . postfix = true ; stmt . negate = 'unless' == op . type ; this . accept ( ';' ) ; break ; case 'for' : var key , val = this . id ( ) . name ; if ( this . accept ( ',' ) ) key = this . id ( ) . name ; this . expect ( 'in' ) ; var each = new nodes . Each ( val , key , this . expression ( ) ) ; block = new nodes . Block ( this . parent , each ) ; block . push ( stmt ) ; each . block = block ; stmt = each ; } } } return stmt ; }
statement
| statement 'if' expression
| statement 'unless' expression
statement | statement if expression | statement unless expression