 
 -- | Obtain the token identifier for the specified token.
 --
--- @
---   foreign export ccall isInt :: Ptr InputStream -> IO Bool
---   isInt input =
---     do 
---       token1 <- lT input 1 >>= tokenGetType
---       return (token1 == INT)
--- @
+-- > foreign export ccall isInt :: Ptr InputStream -> IO Bool
+-- > isInt input =
+-- >   do 
+-- >     token1 <- lT input 1 >>= tokenGetType
+-- >     return (token1 == INT)
 --
 tokenGetType :: (Enum e) => Ptr (CommonToken) -> IO e
 tokenGetType token = {#get ANTLR3_COMMON_TOKEN->type#} token >>= return . cToEnum

-- | Obtain the character position in the source code line of where the token
-- | was read, for non-imaginary tokens.
--
-- @
--   foreign export ccall saTrue :: Ptr CommonToken -> IO (StablePtr TermInfo)
--   saTrue token =
--     do
--       -- obtain the source code line and charPosition from the token
--       l <- tokenGetLine token
--       c <- tokenGetCharPositionInLine token
--       -- return the TmTrue term
--       newStablePtr (TmTrue (Info l c))
-- @
--
tokenGetCharPositionInLine :: Ptr (CommonToken) -> IO Int
tokenGetCharPositionInLine token = {#get ANTLR3_COMMON_TOKEN->charPosition#} token >>= return . cIntConv

-- | Obtain the the source code line of where the token was read, for non-imaginary tokens.
--
-- @
--   foreign export ccall saFalse :: Ptr CommonToken -> IO (StablePtr TermInfo)
--   saFalse token =
--     do
--       -- obtain the source code line and charPosition from the token
--       l <- tokenGetLine token
--       c <- tokenGetCharPositionInLine token
--       -- return the TmFalse term
--       newStablePtr (TmFalse (Info l c))
-- @
--
tokenGetLine :: Ptr (CommonToken) -> IO Int
tokenGetLine token = {#get ANTLR3_COMMON_TOKEN->line#} token >>= return . cIntConv

-- | Note: the peekCStringLen function does not say what will happen if the
-- | c pointer is 0.
--
-- > foreign export ccall saIntV :: Ptr CommonToken -> IO (StablePtr TermInfo)
-- > saIntV token =
-- >   do
-- >     -- read the IntV integer value from the token text into n
-- >     t <- tokenGetText token
-- >     n <- readIO t
-- >     -- obtain the source code line and charPosition from the token
-- >     l <- tokenGetLine token
-- >     c <- tokenGetCharPositionInLine token
-- >     -- return the term, which is TmZero, or TmSucc TmZero, or TmSucc (TmSucc (...TmSucc TmZero))
-- >     newStablePtr (intV (Info l c) n)
--
tokenGetText :: Ptr (CommonToken) -> IO String
tokenGetText c =
