{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_HADDOCK show-extensions #-}
module Yi.Lexer.Alex ( module Yi.Lexer.Alex
, (+~), (~-), Size(..), Stroke ) where
import Lens.Micro.Platform (_1, view, makeLenses)
import qualified Data.Bits
import Data.Char (ord)
import Data.Function (on)
import Data.Ix
import Data.List (foldl')
import Data.Ord (comparing)
import Data.Word (Word8)
import Yi.Style (StyleName)
import Yi.Syntax hiding (mkHighlighter)
import Yi.Utils
utf8Encode :: Char -> [Word8]
utf8Encode :: Char -> [Word8]
utf8Encode = (Int -> Word8) -> [Int] -> [Word8]
forall a b. (a -> b) -> [a] -> [b]
map Int -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Int] -> [Word8]) -> (Char -> [Int]) -> Char -> [Word8]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> [Int]
forall a. (Ord a, Num a, Bits a) => a -> [a]
go (Int -> [Int]) -> (Char -> Int) -> Char -> [Int]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
ord
where
go :: a -> [a]
go a
oc
| a
oc a -> a -> Bool
forall a. Ord a => a -> a -> Bool
<= a
0x7f = [a
oc]
| a
oc a -> a -> Bool
forall a. Ord a => a -> a -> Bool
<= a
0x7ff = [ a
0xc0 a -> a -> a
forall a. Num a => a -> a -> a
+ (a
oc a -> Int -> a
forall a. Bits a => a -> Int -> a
`Data.Bits.shiftR` Int
6)
, a
0x80 a -> a -> a
forall a. Num a => a -> a -> a
+ a
oc a -> a -> a
forall a. Bits a => a -> a -> a
Data.Bits..&. a
0x3f
]
| a
oc a -> a -> Bool
forall a. Ord a => a -> a -> Bool
<= a
0xffff = [ a
0xe0 a -> a -> a
forall a. Num a => a -> a -> a
+ (a
oc a -> Int -> a
forall a. Bits a => a -> Int -> a
`Data.Bits.shiftR` Int
12)
, a
0x80 a -> a -> a
forall a. Num a => a -> a -> a
+ ((a
oc a -> Int -> a
forall a. Bits a => a -> Int -> a
`Data.Bits.shiftR` Int
6) a -> a -> a
forall a. Bits a => a -> a -> a
Data.Bits..&. a
0x3f)
, a
0x80 a -> a -> a
forall a. Num a => a -> a -> a
+ a
oc a -> a -> a
forall a. Bits a => a -> a -> a
Data.Bits..&. a
0x3f
]
| Bool
otherwise = [ a
0xf0 a -> a -> a
forall a. Num a => a -> a -> a
+ (a
oc a -> Int -> a
forall a. Bits a => a -> Int -> a
`Data.Bits.shiftR` Int
18)
, a
0x80 a -> a -> a
forall a. Num a => a -> a -> a
+ ((a
oc a -> Int -> a
forall a. Bits a => a -> Int -> a
`Data.Bits.shiftR` Int
12) a -> a -> a
forall a. Bits a => a -> a -> a
Data.Bits..&. a
0x3f)
, a
0x80 a -> a -> a
forall a. Num a => a -> a -> a
+ ((a
oc a -> Int -> a
forall a. Bits a => a -> Int -> a
`Data.Bits.shiftR` Int
6) a -> a -> a
forall a. Bits a => a -> a -> a
Data.Bits..&. a
0x3f)
, a
0x80 a -> a -> a
forall a. Num a => a -> a -> a
+ a
oc a -> a -> a
forall a. Bits a => a -> a -> a
Data.Bits..&. a
0x3f
]
type Byte = Word8
type IndexedStr = [(Point, Char)]
type AlexInput = (Char, [Byte], IndexedStr)
type Action hlState token = IndexedStr -> hlState -> (hlState, token)
data AlexState lexerState = AlexState {
AlexState lexerState -> lexerState
stLexer :: lexerState,
AlexState lexerState -> Point
lookedOffset :: !Point,
AlexState lexerState -> Posn
stPosn :: !Posn
} deriving Int -> AlexState lexerState -> ShowS
[AlexState lexerState] -> ShowS
AlexState lexerState -> String
(Int -> AlexState lexerState -> ShowS)
-> (AlexState lexerState -> String)
-> ([AlexState lexerState] -> ShowS)
-> Show (AlexState lexerState)
forall lexerState.
Show lexerState =>
Int -> AlexState lexerState -> ShowS
forall lexerState.
Show lexerState =>
[AlexState lexerState] -> ShowS
forall lexerState.
Show lexerState =>
AlexState lexerState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlexState lexerState] -> ShowS
$cshowList :: forall lexerState.
Show lexerState =>
[AlexState lexerState] -> ShowS
show :: AlexState lexerState -> String
$cshow :: forall lexerState.
Show lexerState =>
AlexState lexerState -> String
showsPrec :: Int -> AlexState lexerState -> ShowS
$cshowsPrec :: forall lexerState.
Show lexerState =>
Int -> AlexState lexerState -> ShowS
Show
data Tok t = Tok { Tok t -> t
tokT :: t
, Tok t -> Size
tokLen :: Size
, Tok t -> Posn
tokPosn :: Posn
} deriving a -> Tok b -> Tok a
(a -> b) -> Tok a -> Tok b
(forall a b. (a -> b) -> Tok a -> Tok b)
-> (forall a b. a -> Tok b -> Tok a) -> Functor Tok
forall a b. a -> Tok b -> Tok a
forall a b. (a -> b) -> Tok a -> Tok b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Tok b -> Tok a
$c<$ :: forall a b. a -> Tok b -> Tok a
fmap :: (a -> b) -> Tok a -> Tok b
$cfmap :: forall a b. (a -> b) -> Tok a -> Tok b
Functor
instance Eq (Tok a) where
== :: Tok a -> Tok a -> Bool
(==) = Posn -> Posn -> Bool
forall a. Eq a => a -> a -> Bool
(==) (Posn -> Posn -> Bool) -> (Tok a -> Posn) -> Tok a -> Tok a -> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` Tok a -> Posn
forall t. Tok t -> Posn
tokPosn
tokToSpan :: Tok t -> Span t
tokToSpan :: Tok t -> Span t
tokToSpan (Tok t
t Size
len Posn
posn) = Point -> t -> Point -> Span t
forall a. Point -> a -> Point -> Span a
Span (Posn -> Point
posnOfs Posn
posn) t
t (Posn -> Point
posnOfs Posn
posn Point -> Size -> Point
forall absolute relative.
SemiNum absolute relative =>
absolute -> relative -> absolute
+~ Size
len)
tokFromT :: t -> Tok t
tokFromT :: t -> Tok t
tokFromT t
t = t -> Size -> Posn -> Tok t
forall t. t -> Size -> Posn -> Tok t
Tok t
t Size
0 Posn
startPosn
tokBegin :: Tok t -> Point
tokBegin :: Tok t -> Point
tokBegin = Posn -> Point
posnOfs (Posn -> Point) -> (Tok t -> Posn) -> Tok t -> Point
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Tok t -> Posn
forall t. Tok t -> Posn
tokPosn
tokEnd :: Tok t -> Point
tokEnd :: Tok t -> Point
tokEnd Tok t
t = Tok t -> Point
forall t. Tok t -> Point
tokBegin Tok t
t Point -> Size -> Point
forall absolute relative.
SemiNum absolute relative =>
absolute -> relative -> absolute
+~ Tok t -> Size
forall t. Tok t -> Size
tokLen Tok t
t
instance Show t => Show (Tok t) where
show :: Tok t -> String
show Tok t
tok = Posn -> String
forall a. Show a => a -> String
show (Tok t -> Posn
forall t. Tok t -> Posn
tokPosn Tok t
tok) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
": " String -> ShowS
forall a. [a] -> [a] -> [a]
++ t -> String
forall a. Show a => a -> String
show (Tok t -> t
forall t. Tok t -> t
tokT Tok t
tok)
data Posn = Posn {
Posn -> Point
posnOfs :: !Point
, Posn -> Int
posnLine :: !Int
, Posn -> Int
posnCol :: !Int
} deriving (Posn -> Posn -> Bool
(Posn -> Posn -> Bool) -> (Posn -> Posn -> Bool) -> Eq Posn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Posn -> Posn -> Bool
$c/= :: Posn -> Posn -> Bool
== :: Posn -> Posn -> Bool
$c== :: Posn -> Posn -> Bool
Eq, Ord Posn
Ord Posn
-> ((Posn, Posn) -> [Posn])
-> ((Posn, Posn) -> Posn -> Int)
-> ((Posn, Posn) -> Posn -> Int)
-> ((Posn, Posn) -> Posn -> Bool)
-> ((Posn, Posn) -> Int)
-> ((Posn, Posn) -> Int)
-> Ix Posn
(Posn, Posn) -> Int
(Posn, Posn) -> [Posn]
(Posn, Posn) -> Posn -> Bool
(Posn, Posn) -> Posn -> Int
forall a.
Ord a
-> ((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
unsafeRangeSize :: (Posn, Posn) -> Int
$cunsafeRangeSize :: (Posn, Posn) -> Int
rangeSize :: (Posn, Posn) -> Int
$crangeSize :: (Posn, Posn) -> Int
inRange :: (Posn, Posn) -> Posn -> Bool
$cinRange :: (Posn, Posn) -> Posn -> Bool
unsafeIndex :: (Posn, Posn) -> Posn -> Int
$cunsafeIndex :: (Posn, Posn) -> Posn -> Int
index :: (Posn, Posn) -> Posn -> Int
$cindex :: (Posn, Posn) -> Posn -> Int
range :: (Posn, Posn) -> [Posn]
$crange :: (Posn, Posn) -> [Posn]
$cp1Ix :: Ord Posn
Ix)
instance Ord Posn where
compare :: Posn -> Posn -> Ordering
compare = (Posn -> Point) -> Posn -> Posn -> Ordering
forall a b. Ord a => (b -> a) -> b -> b -> Ordering
comparing Posn -> Point
posnOfs
instance Show Posn where
show :: Posn -> String
show (Posn Point
o Int
l Int
c) = String
"L" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
l String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"C" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
c String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"@" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Point -> String
forall a. Show a => a -> String
show Point
o
startPosn :: Posn
startPosn :: Posn
startPosn = Point -> Int -> Int -> Posn
Posn Point
0 Int
1 Int
0
moveStr :: Posn -> IndexedStr -> Posn
moveStr :: Posn -> IndexedStr -> Posn
moveStr Posn
posn IndexedStr
str = (Posn -> Char -> Posn) -> Posn -> String -> Posn
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' Posn -> Char -> Posn
moveCh Posn
posn (((Point, Char) -> Char) -> IndexedStr -> String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Point, Char) -> Char
forall a b. (a, b) -> b
snd IndexedStr
str)
moveCh :: Posn -> Char -> Posn
moveCh :: Posn -> Char -> Posn
moveCh (Posn Point
o Int
l Int
c) Char
'\t' = Point -> Int -> Int -> Posn
Posn (Point
oPoint -> Point -> Point
forall a. Num a => a -> a -> a
+Point
1) Int
l (((Int
cInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
8) Int -> Int -> Int
forall a. Integral a => a -> a -> a
`div` Int
8)Int -> Int -> Int
forall a. Num a => a -> a -> a
*Int
8)
moveCh (Posn Point
o Int
l Int
_) Char
'\n' = Point -> Int -> Int -> Posn
Posn (Point
oPoint -> Point -> Point
forall a. Num a => a -> a -> a
+Point
1) (Int
lInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1) Int
0
moveCh (Posn Point
o Int
l Int
c) Char
_ = Point -> Int -> Int -> Posn
Posn (Point
oPoint -> Point -> Point
forall a. Num a => a -> a -> a
+Point
1) Int
l (Int
cInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)
alexGetChar :: AlexInput -> Maybe (Char, AlexInput)
alexGetChar :: AlexInput -> Maybe (Char, AlexInput)
alexGetChar (Char
_,[Word8]
_,[]) = Maybe (Char, AlexInput)
forall a. Maybe a
Nothing
alexGetChar (Char
_,[Word8]
b,(Point
_,Char
c):IndexedStr
rest) = (Char, AlexInput) -> Maybe (Char, AlexInput)
forall a. a -> Maybe a
Just (Char
c, (Char
c,[Word8]
b,IndexedStr
rest))
alexGetByte :: AlexInput -> Maybe (Word8,AlexInput)
alexGetByte :: AlexInput -> Maybe (Word8, AlexInput)
alexGetByte (Char
c, Word8
b:[Word8]
bs, IndexedStr
s) = (Word8, AlexInput) -> Maybe (Word8, AlexInput)
forall a. a -> Maybe a
Just (Word8
b,(Char
c,[Word8]
bs,IndexedStr
s))
alexGetByte (Char
_, [], []) = Maybe (Word8, AlexInput)
forall a. Maybe a
Nothing
alexGetByte (Char
_, [], (Point, Char)
c:IndexedStr
s) = case Char -> [Word8]
utf8Encode ((Point, Char) -> Char
forall a b. (a, b) -> b
snd (Point, Char)
c) of
(Word8
b:[Word8]
bs) -> (Word8, AlexInput) -> Maybe (Word8, AlexInput)
forall a. a -> Maybe a
Just (Word8
b, (((Point, Char) -> Char
forall a b. (a, b) -> b
snd (Point, Char)
c), [Word8]
bs, IndexedStr
s))
[] -> Maybe (Word8, AlexInput)
forall a. Maybe a
Nothing
{-# ANN alexCollectChar "HLint: ignore Use String" #-}
alexCollectChar :: AlexInput -> [Char]
alexCollectChar :: AlexInput -> String
alexCollectChar (Char
_, [Word8]
_, []) = []
alexCollectChar (Char
_, [Word8]
b, (Point
_, Char
c):IndexedStr
rest) = Char
c Char -> ShowS
forall a. a -> [a] -> [a]
: AlexInput -> String
alexCollectChar (Char
c, [Word8]
b, IndexedStr
rest)
alexInputPrevChar :: AlexInput -> Char
alexInputPrevChar :: AlexInput -> Char
alexInputPrevChar = Getting Char AlexInput Char -> AlexInput -> Char
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Char AlexInput Char
forall s t a b. Field1 s t a b => Lens s t a b
_1
actionConst :: token -> Action lexState token
actionConst :: token -> Action lexState token
actionConst token
token = \IndexedStr
_str lexState
state -> (lexState
state, token
token)
actionAndModify :: (lexState -> lexState) -> token -> Action lexState token
actionAndModify :: (lexState -> lexState) -> token -> Action lexState token
actionAndModify lexState -> lexState
modifierFct token
token = \IndexedStr
_str lexState
state -> (lexState -> lexState
modifierFct lexState
state, token
token)
actionStringAndModify :: (s -> s) -> (String -> token) -> Action s token
actionStringAndModify :: (s -> s) -> (String -> token) -> Action s token
actionStringAndModify s -> s
modF String -> token
f = \IndexedStr
istr s
s -> (s -> s
modF s
s, String -> token
f (String -> token) -> String -> token
forall a b. (a -> b) -> a -> b
$ ((Point, Char) -> Char) -> IndexedStr -> String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Point, Char) -> Char
forall a b. (a, b) -> b
snd IndexedStr
istr)
actionStringConst :: (String -> token) -> Action lexState token
actionStringConst :: (String -> token) -> Action lexState token
actionStringConst String -> token
f = \IndexedStr
indexedStr lexState
state -> (lexState
state, String -> token
f (String -> token) -> String -> token
forall a b. (a -> b) -> a -> b
$ ((Point, Char) -> Char) -> IndexedStr -> String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Point, Char) -> Char
forall a b. (a, b) -> b
snd IndexedStr
indexedStr)
type ASI s = (AlexState s, AlexInput)
type TokenLexer l s t i = (l s, i) -> Maybe (t, (l s, i))
type CharScanner = Scanner Point Char
data Lexer l s t i = Lexer
{ Lexer l s t i -> TokenLexer l s t i
_step :: TokenLexer l s t i
, Lexer l s t i -> s -> Point -> Posn -> l s
_starting :: s -> Point -> Posn -> l s
, Lexer l s t i -> Char -> IndexedStr -> i
_withChars :: Char -> [(Point, Char)] -> i
, Lexer l s t i -> l s -> Point
_looked :: l s -> Point
, Lexer l s t i -> l s -> Posn
_statePosn :: l s -> Posn
, Lexer l s t i -> t
_lexEmpty :: t
, Lexer l s t i -> s
_startingState :: s
}
data StyleLexer l s t i = StyleLexer
{ StyleLexer l s t i -> t -> StyleName
_tokenToStyle :: t -> StyleName
, StyleLexer l s t i -> Lexer l s (Tok t) i
_styleLexer :: Lexer l s (Tok t) i
}
type StyleLexerASI s t = StyleLexer AlexState s t AlexInput
commonLexer :: (ASI s -> Maybe (Tok t, ASI s))
-> s
-> Lexer AlexState s (Tok t) AlexInput
commonLexer :: (ASI s -> Maybe (Tok t, ASI s))
-> s -> Lexer AlexState s (Tok t) AlexInput
commonLexer ASI s -> Maybe (Tok t, ASI s)
l s
st0 = Lexer :: forall (l :: * -> *) s t i.
TokenLexer l s t i
-> (s -> Point -> Posn -> l s)
-> (Char -> IndexedStr -> i)
-> (l s -> Point)
-> (l s -> Posn)
-> t
-> s
-> Lexer l s t i
Lexer
{ _step :: ASI s -> Maybe (Tok t, ASI s)
_step = ASI s -> Maybe (Tok t, ASI s)
l
, _starting :: s -> Point -> Posn -> AlexState s
_starting = s -> Point -> Posn -> AlexState s
forall lexerState.
lexerState -> Point -> Posn -> AlexState lexerState
AlexState
, _withChars :: Char -> IndexedStr -> AlexInput
_withChars = \Char
c IndexedStr
p -> (Char
c, [], IndexedStr
p)
, _looked :: AlexState s -> Point
_looked = AlexState s -> Point
forall lexerState. AlexState lexerState -> Point
lookedOffset
, _statePosn :: AlexState s -> Posn
_statePosn = AlexState s -> Posn
forall lexerState. AlexState lexerState -> Posn
stPosn
, _lexEmpty :: Tok t
_lexEmpty = String -> Tok t
forall a. HasCallStack => String -> a
error String
"Yi.Lexer.Alex.commonLexer: lexEmpty"
, _startingState :: s
_startingState = s
st0
}
lexScanner :: Lexer l s t i -> CharScanner -> Scanner (l s) t
lexScanner :: Lexer l s t i -> CharScanner -> Scanner (l s) t
lexScanner Lexer {s
t
s -> Point -> Posn -> l s
l s -> Point
l s -> Posn
Char -> IndexedStr -> i
TokenLexer l s t i
_startingState :: s
_lexEmpty :: t
_statePosn :: l s -> Posn
_looked :: l s -> Point
_withChars :: Char -> IndexedStr -> i
_starting :: s -> Point -> Posn -> l s
_step :: TokenLexer l s t i
_startingState :: forall (l :: * -> *) s t i. Lexer l s t i -> s
_lexEmpty :: forall (l :: * -> *) s t i. Lexer l s t i -> t
_statePosn :: forall (l :: * -> *) s t i. Lexer l s t i -> l s -> Posn
_looked :: forall (l :: * -> *) s t i. Lexer l s t i -> l s -> Point
_withChars :: forall (l :: * -> *) s t i.
Lexer l s t i -> Char -> IndexedStr -> i
_starting :: forall (l :: * -> *) s t i.
Lexer l s t i -> s -> Point -> Posn -> l s
_step :: forall (l :: * -> *) s t i. Lexer l s t i -> TokenLexer l s t i
..} CharScanner
src = Scanner :: forall st a.
st -> (st -> Point) -> a -> (st -> [(st, a)]) -> Scanner st a
Scanner
{ scanLooked :: l s -> Point
scanLooked = l s -> Point
_looked
, scanInit :: l s
scanInit = s -> Point -> Posn -> l s
_starting s
_startingState Point
0 Posn
startPosn
, scanRun :: l s -> [(l s, t)]
scanRun = \l s
st -> case Posn -> Point
posnOfs (Posn -> Point) -> Posn -> Point
forall a b. (a -> b) -> a -> b
$ l s -> Posn
_statePosn l s
st of
Point
0 -> TokenLexer l s t i -> (l s, i) -> [(l s, t)]
forall state input token.
((state, input) -> Maybe (token, (state, input)))
-> (state, input) -> [(state, token)]
unfoldLexer TokenLexer l s t i
_step (l s
st, Char -> IndexedStr -> i
_withChars Char
'\n' (IndexedStr -> i) -> IndexedStr -> i
forall a b. (a -> b) -> a -> b
$ CharScanner -> Point -> IndexedStr
forall st a. Scanner st a -> st -> [(st, a)]
scanRun CharScanner
src Point
0)
Point
ofs -> case CharScanner -> Point -> IndexedStr
forall st a. Scanner st a -> st -> [(st, a)]
scanRun CharScanner
src (Point
ofs Point -> Point -> Point
forall a. Num a => a -> a -> a
-Point
1) of
[] -> []
(Point
_, Char
ch) : IndexedStr
rest -> TokenLexer l s t i -> (l s, i) -> [(l s, t)]
forall state input token.
((state, input) -> Maybe (token, (state, input)))
-> (state, input) -> [(state, token)]
unfoldLexer TokenLexer l s t i
_step (l s
st, Char -> IndexedStr -> i
_withChars Char
ch IndexedStr
rest)
, scanEmpty :: t
scanEmpty = t
_lexEmpty
}
unfoldLexer :: ((state, input) -> Maybe (token, (state, input)))
-> (state, input) -> [(state, token)]
unfoldLexer :: ((state, input) -> Maybe (token, (state, input)))
-> (state, input) -> [(state, token)]
unfoldLexer (state, input) -> Maybe (token, (state, input))
f (state, input)
b = (state, input) -> state
forall a b. (a, b) -> a
fst (state, input)
b state -> [(state, token)] -> [(state, token)]
`seq` case (state, input) -> Maybe (token, (state, input))
f (state, input)
b of
Maybe (token, (state, input))
Nothing -> []
Just (token
t, (state, input)
b') -> ((state, input) -> state
forall a b. (a, b) -> a
fst (state, input)
b, token
t) (state, token) -> [(state, token)] -> [(state, token)]
forall a. a -> [a] -> [a]
: ((state, input) -> Maybe (token, (state, input)))
-> (state, input) -> [(state, token)]
forall state input token.
((state, input) -> Maybe (token, (state, input)))
-> (state, input) -> [(state, token)]
unfoldLexer (state, input) -> Maybe (token, (state, input))
f (state, input)
b'
makeLensesWithSuffix "A" ''Posn
makeLensesWithSuffix "A" ''Tok
makeLenses ''Lexer
makeLenses ''StyleLexer