{ {-# OPTIONS -w #-} -- Suppress warnings from alex-generated code module Text.Highlighting.Illuminate.HTML (lexer) where import qualified Text.Highlighting.Illuminate.CSS as CSS import qualified Text.Highlighting.Illuminate.Javascript as Javascript } %wrapper "illuminate" $wordchar = [0-9a-zA-Z\_] $symbol = [\~ \! \% \^ \* \( \) \- \+ \= \[ \] \" \: \; \, \. \/ \? \& \< \> \| \/] $digit = [0-9] $hexdigit = [0-9a-fA-F] @style = [Ss][Tt][Yy][Ll][Ee] @styletag = \< $white* @style @endstyletag = \< $white* \/ $white* @style $white* \> @script = [Ss][Cc][Rr][Ii][Pp][Tt] @scripttag = \< $white* @script @endscripttag = \< $white* \/ $white* @script $white* \> @entity = \& [^ $white]+ \; tokens :- { [^ \-]+ { tok Comment } "-->" { tok Comment ==> popContext } \- { tok Comment } } { [^ \>]+ { tok Preproc } \> { tok Preproc ==> popContext } } { [^ \]]+ { tok Preproc } "]]>" { tok Preproc ==> popContext } \] { tok Preproc } } { \> { tok Tag ==> scanWith CSS.lexer } @endstyletag { tok Tag ==> popContext } } { \> { tok Tag ==> scanWith Javascript.lexer } @endscripttag { tok Tag ==> popContext } } { \> { tok Tag ==> popContext } } { $wordchar+ / \= { tok Keyword } \= { tok Symbol } \" [^\"]* \" { tok String } \' [^\']* \' { tok String } [0-9]+ { tok Number } } <0> { [^ \< \&]+ { plain } @entity { tok Entity } "