From 57ae44d1670dfce3d630a04aea760dde89315c7e Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Sat, 25 Oct 2014 13:29:00 +0100 Subject: [PATCH] Fix a bug in lexer --- Stencil/Lexer.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Stencil/Lexer.swift b/Stencil/Lexer.swift index 133daaa..8913290 100644 --- a/Stencil/Lexer.swift +++ b/Stencil/Lexer.swift @@ -43,7 +43,7 @@ public struct Lexer { let nsTemplateString = templateString as NSString regex.enumerateMatchesInString(templateString, options: nil, range: range) { (result, flags, b) in if result.range.location != lastIndex { - let previousMatch = nsTemplateString.substringWithRange(NSMakeRange(lastIndex, result.range.location)) + let previousMatch = nsTemplateString.substringWithRange(NSMakeRange(lastIndex, result.range.location - lastIndex)) tokens.append(self.createToken(previousMatch)) }