           substring = template.slice lastIndex - 2
           lastToken = tokens[tokens.length - 1]
 
-          if lastToken?.type is types.text
+          if lastToken?.type is @types.text
             lastToken.value += substring
           else
-            tokens.push type: types.text, value: substring
+            tokens.push type: @types.text, value: substring
 
           break
 
         value = template.slice(lastIndex, index).trim()
-        tokens.push type: types.binding, value: value
+        tokens.push type: @types.binding, value: value
         lastIndex = index + 2
 
     tokens

# Rivets.js text template parser and tokenizer for mustache-style text content
# binding declarations.
class Rivets.TextTemplateParser
  types =
    text: 0
    binding: 1


      index = template.indexOf '{{', lastIndex

      if index < 0
        tokens.push type: @types.text, value: template.slice lastIndex
        break
      else
        if index > 0 and lastIndex < index
          tokens.push type: @types.text, value: template.slice lastIndex, index

        lastIndex = index + 2
        index = template.indexOf '}}', lastIndex
