cryptol-2.8.0: Cryptol: The Language of Cryptography
Copyright(c) 2013-2016 Galois Inc.
LicenseBSD3
Maintainercryptol@galois.com
Stabilityprovisional
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Cryptol.Parser.Lexer

Description

At present Alex generates code with too many warnings.

Synopsis

Documentation

primLexer :: Config -> Text -> ([Located Token], Position) Source #

Returns the tokens and the last position of the input that we processed. The tokens include whte space tokens.

lexer :: Config -> Text -> ([Located Token], Position) Source #

Returns the tokens in the last position of the input that we processed. White space is removed, and layout processing is done as requested. This stream is fed to the parser.

data Layout Source #

Constructors

Layout 
NoLayout 

data Token Source #

Constructors

Token 

Fields

Instances

Instances details
Show Token Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Generic Token Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Associated Types

type Rep Token :: Type -> Type Source #

Methods

from :: Token -> Rep Token x Source #

to :: Rep Token x -> Token Source #

NFData Token Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Methods

rnf :: Token -> () Source #

PP Token Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Methods

ppPrec :: Int -> Token -> Doc Source #

type Rep Token Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

type Rep Token = D1 ('MetaData "Token" "Cryptol.Parser.LexerUtils" "cryptol-2.8.0-11Z6ZaBuQbo1UTYpHYMeUg" 'False) (C1 ('MetaCons "Token" 'PrefixI 'True) (S1 ('MetaSel ('Just "tokenType") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TokenT) :*: S1 ('MetaSel ('Just "tokenText") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))

data TokenT Source #

Constructors

Num !Integer !Int !Int

value, base, number of digits

ChrLit !Char

character literal

Ident ![Text] !Text

(qualified) identifier

StrLit !String

string literal

KW !TokenKW

keyword

Op !TokenOp

operator

Sym !TokenSym

symbol

Virt !TokenV

virtual token (for layout)

White !TokenW

white space token

Err !TokenErr

error token

EOF 

Instances

Instances details
Eq TokenT Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Show TokenT Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Generic TokenT Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Associated Types

type Rep TokenT :: Type -> Type Source #

NFData TokenT Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Methods

rnf :: TokenT -> () Source #

type Rep TokenT Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

type Rep TokenT

data TokenV Source #

Virtual tokens, inserted by layout processing.

Constructors

VCurlyL 
VCurlyR 
VSemi 

Instances

Instances details
Eq TokenV Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Show TokenV Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Generic TokenV Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Associated Types

type Rep TokenV :: Type -> Type Source #

NFData TokenV Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Methods

rnf :: TokenV -> () Source #

type Rep TokenV Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

type Rep TokenV = D1 ('MetaData "TokenV" "Cryptol.Parser.LexerUtils" "cryptol-2.8.0-11Z6ZaBuQbo1UTYpHYMeUg" 'False) (C1 ('MetaCons "VCurlyL" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "VCurlyR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "VSemi" 'PrefixI 'False) (U1 :: Type -> Type)))

data TokenKW Source #

Instances

Instances details
Eq TokenKW Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Show TokenKW Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Generic TokenKW Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Associated Types

type Rep TokenKW :: Type -> Type Source #

NFData TokenKW Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Methods

rnf :: TokenKW -> () Source #

type Rep TokenKW Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

type Rep TokenKW = D1 ('MetaData "TokenKW" "Cryptol.Parser.LexerUtils" "cryptol-2.8.0-11Z6ZaBuQbo1UTYpHYMeUg" 'False) ((((C1 ('MetaCons "KW_else" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KW_extern" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_fin" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "KW_if" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_private" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "KW_include" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_inf" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "KW_lg2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_lengthFromThen" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "KW_lengthFromThenTo" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_max" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "KW_min" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_module" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "KW_newtype" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_pragma" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: ((((C1 ('MetaCons "KW_property" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_then" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "KW_type" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_where" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "KW_let" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_x" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "KW_import" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_as" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "KW_hiding" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_infixl" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "KW_infixr" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_infix" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "KW_primitive" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_parameter" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "KW_constraint" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "KW_Prop" 'PrefixI 'False) (U1 :: Type -> Type))))))

data TokenErr Source #

Instances

Instances details
Eq TokenErr Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Show TokenErr Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Generic TokenErr Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Associated Types

type Rep TokenErr :: Type -> Type Source #

NFData TokenErr Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Methods

rnf :: TokenErr -> () Source #

type Rep TokenErr Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

type Rep TokenErr = D1 ('MetaData "TokenErr" "Cryptol.Parser.LexerUtils" "cryptol-2.8.0-11Z6ZaBuQbo1UTYpHYMeUg" 'False) ((C1 ('MetaCons "UnterminatedComment" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "UnterminatedString" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UnterminatedChar" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "InvalidString" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "InvalidChar" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LexicalError" 'PrefixI 'False) (U1 :: Type -> Type))))

data TokenSym Source #

Instances

Instances details
Eq TokenSym Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Show TokenSym Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Generic TokenSym Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Associated Types

type Rep TokenSym :: Type -> Type Source #

NFData TokenSym Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Methods

rnf :: TokenSym -> () Source #

type Rep TokenSym Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

type Rep TokenSym = D1 ('MetaData "TokenSym" "Cryptol.Parser.LexerUtils" "cryptol-2.8.0-11Z6ZaBuQbo1UTYpHYMeUg" 'False) ((((C1 ('MetaCons "Bar" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ArrL" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ArrR" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FatArrR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Lambda" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "EqDef" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Comma" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Semi" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Dot" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "DotDot" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DotDotDot" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "Colon" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BackTick" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ParenL" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ParenR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BracketL" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "BracketR" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CurlyL" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CurlyR" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "TriL" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TriR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Underscore" 'PrefixI 'False) (U1 :: Type -> Type))))))

data TokenW Source #

Instances

Instances details
Eq TokenW Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Show TokenW Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Generic TokenW Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Associated Types

type Rep TokenW :: Type -> Type Source #

NFData TokenW Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

Methods

rnf :: TokenW -> () Source #

type Rep TokenW Source # 
Instance details

Defined in Cryptol.Parser.LexerUtils

type Rep TokenW = D1 ('MetaData "TokenW" "Cryptol.Parser.LexerUtils" "cryptol-2.8.0-11Z6ZaBuQbo1UTYpHYMeUg" 'False) ((C1 ('MetaCons "BlockComment" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LineComment" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Space" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DocStr" 'PrefixI 'False) (U1 :: Type -> Type)))

data Located a Source #

Constructors

Located 

Fields

Instances

Instances details
Functor Located Source # 
Instance details

Defined in Cryptol.Parser.Position

Methods

fmap :: (a -> b) -> Located a -> Located b Source #

(<$) :: a -> Located b -> Located a Source #

Eq a => Eq (Located a) Source # 
Instance details

Defined in Cryptol.Parser.Position

Methods

(==) :: Located a -> Located a -> Bool Source #

(/=) :: Located a -> Located a -> Bool Source #

Show a => Show (Located a) Source # 
Instance details

Defined in Cryptol.Parser.Position

Generic (Located a) Source # 
Instance details

Defined in Cryptol.Parser.Position

Associated Types

type Rep (Located a) :: Type -> Type Source #

Methods

from :: Located a -> Rep (Located a) x Source #

to :: Rep (Located a) x -> Located a Source #

NFData a => NFData (Located a) Source # 
Instance details

Defined in Cryptol.Parser.Position

Methods

rnf :: Located a -> () Source #

PPName a => PPName (Located a) Source # 
Instance details

Defined in Cryptol.Parser.Position

PP a => PP (Located a) Source # 
Instance details

Defined in Cryptol.Parser.Position

Methods

ppPrec :: Int -> Located a -> Doc Source #

AddLoc (Located a) Source # 
Instance details

Defined in Cryptol.Parser.Position

HasLoc (Located a) Source # 
Instance details

Defined in Cryptol.Parser.Position

Methods

getLoc :: Located a -> Maybe Range Source #

NoPos (Located t) Source # 
Instance details

Defined in Cryptol.Parser.AST

Methods

noPos :: Located t -> Located t Source #

ShowParseable a => ShowParseable (Located a) Source # 
Instance details

Defined in Cryptol.TypeCheck.Parseable

type Rep (Located a) Source # 
Instance details

Defined in Cryptol.Parser.Position

type Rep (Located a) = D1 ('MetaData "Located" "Cryptol.Parser.Position" "cryptol-2.8.0-11Z6ZaBuQbo1UTYpHYMeUg" 'False) (C1 ('MetaCons "Located" 'PrefixI 'True) (S1 ('MetaSel ('Just "srcRange") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Range) :*: S1 ('MetaSel ('Just "thing") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

data Config Source #

Constructors

Config 

Fields