   return s
 
 -- | Obtain the token String for the specified token.
--- | Note: the peekCStringLen function does not say what will happen if the
--- | c pointer is 0.
+--   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 =

--
-- > tokenGetAntlrString token
--
-- | For identifier tokens, the token string is interesting.  For
-- | other tokens such as operator tokens, the token string is
-- | uninteresting, and may not be present, the token identifier enum 
-- | should be used instead.
{#fun tokenGetAntlrString
 { toCommonToken `Ptr (CommonToken)' } -> `Ptr (AntlrString)' fromAntlrString#}


    return (Just s)

-- | Obtain the token Maybe String for the specified token.
--   For identifier tokens, the token string is interesting.  For
--   other tokens such as operator tokens, the token string is
--   uninteresting, and may not be present, the token identifier enum 
--   should be used instead.
tokenGetTextMaybe :: Ptr (CommonToken) -> IO (Maybe String)
tokenGetTextMaybe c =
  tokenGetAntlrString c >>= \s ->
  fromAntlrStringToMaybeString (AntlrString s)

-- | Convert from an ANTLR string to a String.
--   Note: the peekCStringLen function does not say what will happen if the
--   c pointer is 0.
fromAntlrStringToString :: AntlrString -> IO String
fromAntlrStringToString (AntlrString x) = 
  {#get ANTLR3_STRING->chars#} x >>= \c ->
