| Copyright | (c) Hangil Kim 2026 Kairon Johnson 2026 Leonidas Sallos 2026 Oscar Abelanet 2026 |
|---|---|
| License | MIT |
| Maintainer | kimhang@oregonstate.edu |
| Stability | experimental |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
LH.Text.Lexer
Description
This module provides the lexer for Layered Haskell.
Synopsis
- scanToken :: LHsParser LHsLexeme
- scanTokens :: Text -> Either LHsTextError [LHsLexeme]
- scanTokensAsProgram :: Text -> Either LHsTextError [LHsLexeme]
- beginProgram :: LHsParser ()
Lexical tokenization
scanTokens :: Text -> Either LHsTextError [LHsLexeme] Source #
Tokenizes the entirety of the input, producing a (potential) list of LHsLexemes.
If the input is a program, one should use scanTokensAsProgram instead.
scanTokensAsProgram :: Text -> Either LHsTextError [LHsLexeme] Source #
Tokenizes the entirety of the input as a program, producing a (potential) list of LHsLexemes.
This function invokes beginProgram, so it is preferable for lexing entire programs over scanTokens.
Stack initialization
beginProgram :: LHsParser () Source #
Warning: This should be invoked before lexing a program. Otherwise, layout rules won't be applied to top-level declarations. See scanTokensAsProgram.
Immediately pushes the layout startcode onto the stack, indicating the beginning of a program.