diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+* 0.12.2.3 (2014-10-27)
+  - fixed another lexing bug (issue #45)
+
 * 0.12.2.2 (2014-10-22)
   - fixed lexing bug (some source files were not parsed properly)
   - fixed bug where wrong module name was generated
diff --git a/HTF.cabal b/HTF.cabal
--- a/HTF.cabal
+++ b/HTF.cabal
@@ -1,5 +1,5 @@
 Name:             HTF
-Version:          0.12.2.2
+Version:          0.12.2.3
 License:          LGPL
 License-File:     LICENSE
 Copyright:        (c) 2005-2014 Stefan Wehr
diff --git a/Test/Framework/Preprocessor.hs b/Test/Framework/Preprocessor.hs
--- a/Test/Framework/Preprocessor.hs
+++ b/Test/Framework/Preprocessor.hs
@@ -280,15 +280,18 @@
 cleanupInputString :: String -> String
 cleanupInputString s =
     case s of
+      c:'\'':'\'':x:rest
+          | isSpace c && isUpper x ->         -- TH type quote
+              c:x:cleanupInputString rest
+      c:'\'':'\'':d:rest
+          | not (isAlphaNum c) || not (isAlphaNum d)
+              -> c:'\'':'x':'\'':d:rest
       '\'':rest ->
           case characterLitRest rest of
             Just (restLit, rest') ->
                 '\'':restLit ++ cleanupInputString rest'
             Nothing ->
                 '\'':cleanupInputString rest
-      c:'\'':'\'':x:rest
-          | isSpace c && isUpper x ->         -- TH type quote
-              c:x:cleanupInputString rest
       c:'\'':x:rest                -- TH name quote
           | isSpace c && isNothing (characterLitRest (x:rest)) && isLower x ->
               c:x:cleanupInputString rest
