LayeredHaskell-0.1.0.0: A friendly layered implementation of a subset of Haskell.
Copyright(c) Hangil Kim 2026
Kairon Johnson 2026
Leonidas Sallos 2026
Oscar Abelanet 2026
LicenseMIT
Maintainerkimhang@oregonstate.edu
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

LH.Text.Lexer

Description

This module provides the lexer for Layered Haskell.

Synopsis

Lexical tokenization

scanToken :: LHsParser LHsLexeme Source #

Scans a single LHsToken from the input, producing a LHsLexeme.

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.