diff --git a/alex-tools.cabal b/alex-tools.cabal
--- a/alex-tools.cabal
+++ b/alex-tools.cabal
@@ -1,5 +1,5 @@
 name:                alex-tools
-version:             0.3.1
+version:             0.4
 synopsis:            A set of functions for a common use case of Alex.
 description:         This captures a common patter for using Alex.
 license:             ISC
diff --git a/src/AlexTools.hs b/src/AlexTools.hs
--- a/src/AlexTools.hs
+++ b/src/AlexTools.hs
@@ -3,7 +3,7 @@
   ( -- * Lexer Basics
     initialInput, Input(..), inputFile
   , Lexeme(..)
-  , SourcePos(..), startPos, beforeStartPos
+  , SourcePos(..), startPos, beforeStartPos, prevPos
   , SourceRange(..)
   , prettySourcePos, prettySourceRange
   , prettySourcePosLong, prettySourceRangeLong
@@ -207,10 +207,11 @@
 lexeme tok =
   do r   <- matchRange
      txt <- matchText
-     return [ Lexeme { lexemeRange = r
-                     , lexemeToken = tok
-                     , lexemeText  = txt
-                     } ]
+     let l = Lexeme { lexemeRange = r
+                    , lexemeToken = tok
+                    , lexemeText  = txt
+                    }
+     l `seq` return [ l ]
 
 -- | Information about the lexer's input.
 data Input = Input
@@ -251,6 +252,26 @@
                                 , sourceFile    = file
                                 }
 
+{- | Move one position back.  Assumes that newlines use a single bytes.
+
+This function is intended to be used when starting the lexing somewhere
+in the middle of the input, for example, if we are implementing a quasi
+quoter, and the previous part of the input is not in our language.
+-}
+prevPos :: SourcePos -> SourcePos
+prevPos p
+  | sourceColumn p > 1 = p { sourceColumn = sourceColumn p - 1
+                           , sourceIndex = sourceIndex p - 1
+                           }
+
+  | sourceLine p > 1   = p { sourceLine   = sourceLine p - 1
+                           , sourceColumn = 1
+                           , sourceIndex  = sourceIndex p - 1
+                           }
+
+  | otherwise          = beforeStartPos (sourceFile p)
+
+
 -- | The file/thing for the current position.
 inputFile :: Input -> Text
 inputFile = sourceFile . inputPos
@@ -264,7 +285,7 @@
   , lexerStateMode :: s -> Int
     -- ^ Determine the current lexer mode from the lexer's state.
 
-  , lexerEOF       :: s -> [Lexeme t]
+  , lexerEOF       :: s -> SourcePos -> [Lexeme t]
     -- ^ Emit some lexemes at the end of the input.
   }
 
@@ -274,7 +295,7 @@
 simpleLexer = LexerConfig
   { lexerInitialState = ()
   , lexerStateMode = \_ -> 0
-  , lexerEOF       = \_ -> []
+  , lexerEOF       = \_ _ -> []
   }
 
 
@@ -297,7 +318,7 @@
      let p ~> e = match p (normalB e) []
          body go mode inp cfg =
            caseE [| $alexScanUser $mode $inp (lexerStateMode $cfg $mode) |]
-             [ alexEOF   ~> [| lexerEOF $cfg $mode |]
+             [ alexEOF   ~> [| lexerEOF $cfg $mode (inputPrev $inp) |]
              , alexError ~> [| error "internal error in lexer (AlexTools.hs)" |]
              , alexSkip  ~> [| $go $mode $xE |]
              , alexToken ~> [| case runA $zE $inp $xE $yE $mode of
