-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Syntax highlighter for Haskell using lexer of GHC itself
--   
--   Syntax highlighter for Haskell using lexer of GHC itself.
@package ghc-syntax-highlighter
@version 0.0.2.0


-- | The module allows you to decompose a <a>Text</a> stream containing
--   Haskell source code into a stream of <a>Text</a> chunks tagged with
--   <a>Token</a>.
--   
--   This library uses GHC's lexer, so the result is guaranteed to be 100%
--   correct, as if it was parsed by GHC itself.
module GHC.SyntaxHighlighter

-- | Token types that are used as tags to mark spans of source code.
data Token

-- | Keyword
KeywordTok :: Token

-- | Pragmas
PragmaTok :: Token

-- | Symbols (punctuation that is not an operator)
SymbolTok :: Token

-- | Variable name (term level)
VariableTok :: Token

-- | Data/type constructor
ConstructorTok :: Token

-- | Operator
OperatorTok :: Token

-- | Character
CharTok :: Token

-- | String
StringTok :: Token

-- | Integer
IntegerTok :: Token

-- | Rational number
RationalTok :: Token

-- | Comment (including Haddocks)
CommentTok :: Token

-- | Space filling
SpaceTok :: Token

-- | Something else?
OtherTok :: Token

-- | Start and end positions of a span. The arguments of the data
--   constructor contain in order:
--   
--   <ul>
--   <li>Line number of start position of a span</li>
--   <li>Column number of start position of a span</li>
--   <li>Line number of end position of a span</li>
--   <li>Column number of end position of a span</li>
--   </ul>
data Loc
Loc :: !Int -> !Int -> !Int -> !Int -> Loc

-- | Tokenize Haskell source code. If the code cannot be parsed, return
--   <a>Nothing</a>. Otherwise return the original input tagged by
--   <a>Token</a>s.
--   
--   The parser does not require the input source code to form a valid
--   Haskell program, so as long as the lexer can decompose your input
--   (most of the time), it'll return something in <a>Just</a>.
tokenizeHaskell :: Text -> Maybe [(Token, Text)]

-- | Similar to <a>tokenizeHaskell</a>, but instead of <a>Text</a> chunks
--   provides locations of corresponding spans in the given input stream.
tokenizeHaskellLoc :: Text -> Maybe [(Token, Loc)]
instance GHC.Enum.Enum GHC.SyntaxHighlighter.ExtBits
instance GHC.Show.Show GHC.SyntaxHighlighter.Text'
instance GHC.Show.Show GHC.SyntaxHighlighter.Loc
instance GHC.Classes.Ord GHC.SyntaxHighlighter.Loc
instance GHC.Classes.Eq GHC.SyntaxHighlighter.Loc
instance GHC.Show.Show GHC.SyntaxHighlighter.Token
instance GHC.Enum.Bounded GHC.SyntaxHighlighter.Token
instance GHC.Enum.Enum GHC.SyntaxHighlighter.Token
instance GHC.Classes.Ord GHC.SyntaxHighlighter.Token
instance GHC.Classes.Eq GHC.SyntaxHighlighter.Token
