     if stack[stack.length - 1] > 0 and (IMPLICIT_END.indexOf(token[0]) >= 0 or !post?)
       idx: if token[0] is 'OUTDENT' then i + 1 else i
       for tmp in [0...stack[stack.length - 1]]
-        this.tokens.splice(idx, 0, ['CALL_END', ')', token[2]])
+        @tokens.splice(idx, 0, ['CALL_END', ')', token[2]])
       size: stack[stack.length - 1] + 1
       stack[stack.length - 1]: 0
       return size
     return 1 unless prev and IMPLICIT_FUNC.indexOf(prev[0]) >= 0 and IMPLICIT_CALL.indexOf(token[0]) >= 0
-    this.tokens.splice(i, 0, ['CALL_START', '(', token[2]])
+    @tokens.splice(i, 0, ['CALL_START', '(', token[2]])
     stack[stack.length - 1] += 1
     return 2
 

# blocks, so it doesn't need to.
# ')' can close a single-line block, but we need to make sure it's balanced.
re::add_implicit_indentation: ->
  this.scan_tokens (prev, token, post, i) =>
    return 1 unless SINGLE_LINERS.indexOf(token[0]) >= 0 and post[0] isnt 'INDENT' and
      not (token[0] is 'ELSE' and post[0] is 'IF')
    starter: token[0]
    this.tokens.splice(i + 1, 0, ['INDENT', 2, token[2]])
    idx: i + 1
    parens: 0
    while true
      idx += 1
      tok: this.tokens[idx]
      if (not tok or SINGLE_CLOSERS.indexOf(tok[0]) >= 0 or
          (tok[0] is ')' && parens is 0)) and
          not (starter is 'ELSE' and tok[0] is 'ELSE')
        insertion: if this.tokens[idx - 1][0] is "," then idx - 1 else idx
        this.tokens.splice(insertion, 0, ['OUTDENT', 2, token[2]])
        break
      parens += 1 if tok[0] is '('
      parens -= 1 if tok[0] is ')'
    return 1 unless token[0] is 'THEN'
    this.tokens.splice(i, 1)
    return 0

# Ensure that all listed pairs of tokens are correctly balanced throughout
# the course of the token stream.
re::ensure_balance: (pairs) ->
  levels: {}
  this.scan_tokens (prev, token, post, i) =>
    for pair in pairs
      [open, close]: pair
      levels[open] ||= 0

      # If the tag is already in our debt, swallow it.
      if debt[inv] > 0
        debt[inv] -= 1
        @tokens.splice(i, 1)
        return 0
      else
        # Pop the stack of open delimiters.
