ddc-source-tetra-0.4.3.1: Disciplined Disciple Compiler source language.

Safe HaskellNone
LanguageHaskell98

DDC.Source.Tetra.Lexer

Description

Lexer for Source Tetra tokens.

Synopsis

Documentation

data Name Source #

Union of all names that we detect during lexing.

Constructors

NameVar !Text

A user defined variable.

NameCon !Text

A user defined constructor.

NamePrimType !PrimType

Primitive type names.

NamePrimValLit !PrimLit

Primitive literal values.

NamePrimValOp !PrimVal

Primitive operator values.

Instances

Eq Name Source # 

Methods

(==) :: Name -> Name -> Bool #

(/=) :: Name -> Name -> Bool #

Ord Name Source # 

Methods

compare :: Name -> Name -> Ordering #

(<) :: Name -> Name -> Bool #

(<=) :: Name -> Name -> Bool #

(>) :: Name -> Name -> Bool #

(>=) :: Name -> Name -> Bool #

max :: Name -> Name -> Name #

min :: Name -> Name -> Name #

Show Name Source # 

Methods

showsPrec :: Int -> Name -> ShowS #

show :: Name -> String #

showList :: [Name] -> ShowS #

Pretty Name Source # 

Associated Types

data PrettyMode Name :: * #

Methods

pprDefaultMode :: PrettyMode Name #

ppr :: Name -> Doc #

pprPrec :: Int -> Name -> Doc #

pprModePrec :: PrettyMode Name -> Int -> Name -> Doc #

NFData Name Source # 

Methods

rnf :: Name -> () #

lexModuleString :: String -> Int -> String -> [Located (Token Name)] Source #

Lex a string to tokens, using primitive names.

The first argument gives the starting source line number.

We're currently re-using the lexer for the core language, which has *mostly* the same lexical structure as Source Tetra. There are a few tokens accepted by one language but not the other, but it'll do for now.