Idris2Doc : Text.Lex.Util

Text.Lex.Util

(source)

Definitions

stripQuotes : SnocList Char -> String
Visibility: public export
ltrim : List Char -> List Char
Visibility: export
countHashtag : List Char -> Nat
Visibility: export
rtrim : SnocList Char -> SnocList Char
Visibility: export
dropHead : Nat -> SnocList Char -> List Char
Visibility: export
countHashtag : SnocList Char -> Nat
Visibility: export
any : Lexer
Visibility: export
non : Lexer -> Lexer
  Recognise any character if the sub-lexer `l` fails.
/(?!`l`)./

Visibility: export
is : Char -> Lexer
  Recognise a specific item.
/[`x`]/

Visibility: export
isNot : Char -> Lexer
  Recognise anything but the given item.
/[\^`x`]/

Visibility: export
space : Lexer
  Recognise a single whitespace character.

Visibility: export
digit : Lexer
  Recognise a single digit.

Visibility: export
like : Char -> Lexer
  Recognise a specific character (case-insensitive).
/[`x`]/i

Visibility: export
notLike : Char -> Lexer
  Recognise anything but the given character (case-insensitive).
/[\^`x`]/i

Visibility: export
oneOf : List Char -> Lexer
  Recognises one of the given characters.

Visibility: export
range : Char -> Char -> Lexer
  Recognise a character in a range. Also works in reverse!
/[`start`-`end`]/

Visibility: export
prefixBy : List (Char -> Bool) -> Lexer
Visibility: export
exact : String -> Lexer
Visibility: export
approx : String -> Lexer
Visibility: export
digits : Lexer
  Recognise a non-empty sequence of digits.

Visibility: export
symbol : Lexer
  Recognise a single non-whitespace, non-alphanumeric character
/[\^\\sA-Za-z0-9]/

Visibility: export
symbols : Lexer
  Recognise one or more non-whitespace, non-alphanumeric characters
/[\^\\sA-Za-z0-9]+/

Visibility: export
control : Lexer
Visibility: export
controls : Lexer
  Recognise one or more control characters
/[\\x00-\\x1f\\x7f-\\x9f]+/

Visibility: export
someOf : List Char -> Lexer
  Recognises a non-empty sequence of the given items

Visibility: export
ranges : Char -> Char -> Lexer
  Recognise some items in a range. Also works in reverse!
/[`start`-`end`]/

Visibility: export
spaces : Lexer
  Recognise a non-empty sequence of whitespace characters.

Visibility: export
spaceChars : Lexer
  Recognise a non-empty sequence of space characters.

Visibility: export
newline : Lexer
  Recognise a single newline character sequence

Visibility: export
manyTillNewline : Recognise False
  Reads characters until the next newline character is
encountered.

Visibility: export
manyTillLineFeed : Recognise False
  Reads characters until the next linefeed character (`'\n'`) is
encountered.

Visibility: export
lineComment : Lexer -> Lexer
  Lexer for single line comments starting with the given prefix.

This reads until (but does not include) the first newline
character `'\n'` or `'\r'`.

Visibility: export
linefeedComment : Lexer -> Lexer
  Lexer for single line comments starting with the given prefix.

This reads until (but does not include) the first line feed
character (`'\n'`).

Visibility: export
atLeast : (n : Nat) -> Lexer -> Recognise (isSucc n)
Visibility: export
exactly : (n : Nat) -> Lexer -> {auto 0 _ : IsSucc n} -> Lexer
Visibility: export
manyUntil : Recognise c -> Lexer -> Recognise False
Visibility: export
someUntil : Recognise c -> Lexer -> Lexer
Visibility: export
manyThen : Recognise c -> Lexer -> Recognise c
Visibility: export
surround : Lexer -> Lexer -> Lexer -> Lexer
  Recognise zero or more occurrences of a sub-lexer between
delimiting lexers
/`start`(`l`)\*?`end`/

Visibility: export
quote : Lexer -> Lexer -> Lexer
  Recognise zero or more occurrences of a sub-lexer surrounded
by the same quote lexer on both sides (useful for strings)
/`q`(`l`)\*?`q`/

Visibility: export
escape : Lexer -> Lexer -> Lexer
  Recognise an escape sub-lexer (often '\\') followed by
another sub-lexer
/[`esc`]`l`/

Visibility: export
stringLit : Lexer
Visibility: export
intLit : Lexer
  Recognise an integer literal (possibly with a '-' prefix)
/-?[0-9]+/

Visibility: export
intLitPlus : Lexer
  Recognise an integer literal (possibly with a '+' or '-' prefix)

Visibility: export
binDigits : Lexer
Visibility: export
hexDigits : Lexer
Visibility: export
octDigits : Lexer
Visibility: export
binLit : Lexer
  Recognise a binary literal, prefixed by "0b"
/0b[0-1]+/

Visibility: export
hexLit : Lexer
  Recognise a hexidecimal literal, prefixed by "0x" or "0X"
/0[Xx][0-9A-Fa-f]+/

Visibility: export
octLit : Lexer
  Recognise an octal literal, prefixed by "0o"
/0o[0-9A-Fa-f]+/

Visibility: export
digitsUnderscoredLit : Lexer
  Recognise a decimal integer literal with optional undescores for
improved readability.

Visibility: export
binUnderscoredLit : Lexer
  Recognise a binary literal with optional undescores for
improved readability.

Visibility: export
hexUnderscoredLit : Lexer
  Recognise a hexadecimal literal with optional undescores for
improved readability.

Visibility: export
octUnderscoredLit : Lexer
  Recognise an octal literal with optional undescores for
improved readability.

Visibility: export
charLit : Lexer
  Recognise a character literal, including escaped characters.
(Note: doesn't yet handle escape sequences such as \123)
/'(\\\\.|[\^'])'/

Visibility: export
doubleLit : Lexer
Visibility: export