Skip to content

Commit

Permalink
Export lexToken
Browse files Browse the repository at this point in the history
  • Loading branch information
natefaubion committed Aug 22, 2021
1 parent f83c1ff commit 2816d10
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/PureScript/CST/Lexer.purs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module PureScript.CST.Lexer
( lex
, lexWithState
, lexToken
) where

import Prelude
Expand All @@ -9,6 +10,7 @@ import Control.Alt (class Alt, (<|>))
import Data.Array as Array
import Data.Array.NonEmpty as NonEmptyArray
import Data.Char as Char
import Data.Either (Either(..))
import Data.Foldable (fold, foldl, foldMap)
import Data.Int (hexadecimal)
import Data.Int as Int
Expand Down Expand Up @@ -211,6 +213,14 @@ lexWithState = init
<*> trailingComments
<*> leadingComments

lexToken :: String -> Either LexError Token
lexToken = k >>> case _ of
LexSucc tok "" -> Right tok
LexSucc tok _ -> Left (\_ -> ExpectedEof tok)
LexFail err _ -> Left err
where
(Lex k) = token

bumpToken :: SourcePos -> Token -> SourcePos
bumpToken pos@{ line, column } = case _ of
TokLeftParen ->
Expand Down

0 comments on commit 2816d10

Please sign in to comment.