-
Effekt Library
- scanner
- Scan
- peek
- skip
- read
- scanner
- expect
- readIf
- skipIf
- readSome
- tryRead
- readWhile
- skipWhile
- readIf
- skipIf
- skipWhitespace
- readString
- readDigit
- readDecimal
- readHexDigit
- readHexadecimal
- readInteger
- scanner
- expect
- main
- scanner Jump to source: libraries/common/scanner.effekt
- Scan
[A]
- peek
: A / {stop}
- skip
: Unit / {stop}
- read
[A]: A / {Scan[A], stop}
- scanner
[A] { scanner: => Unit / {Scan[A]} }: Unit / {read[A]}
- expect
(message: String) { scanner: => Unit / {stop} }: Unit / {Exception[WrongFormat]}
- readIf
[A] { predicate: (A) => Bool }: A / {Scan[A], stop}
- skipIf
[A] { predicate: (A) => Bool }: Unit / {Scan[A], stop}
- readSome
[A, B] { convert: (A) => Option[B] }: B / {Scan[A], stop}
- tryRead
[A, B] { convert: (A) => B / {Exception[WrongFormat]} }: B / {Scan[A], stop}
- readWhile
[A] { predicate: (A) => Bool }: Unit / {Scan[A], emit[A]}
- skipWhile
[A] { predicate: (A) => Bool }: Unit / {Scan[A]}
- readIf
(e: Char): Unit / {Scan[Char], stop}
- skipIf
(e: Char): Unit / {Scan[Char], stop}
- skipWhitespace
: Unit / {Scan[Char]}
- readString
(string: String): Unit / {Scan[Char], stop}
- readDigit
: Int / {Scan[Char], stop}
- readDecimal
: Int / {Scan[Char]}
- readHexDigit
: Int / {Scan[Char], stop}
- readHexadecimal
: Int / {Scan[Char]}
- readInteger
: Int / {Scan[Char]}
- scanner
[A, R] { scanner: => R / {Scan[A]} }: R / {read[A]}
- expect
[R] (message: String) { scanner: => R / {stop} }: R / {Exception[WrongFormat]}
- main
: Unit / {}
Example usage: examples/stdlib/scanner
Return the next character, not advancing. That is, this does not change what any future calls on the Scanner return.
Advance the Scanner to the next character.
Advance the Scanner to the next character, returning it.
Run a scanner by reading from an input stream, discarding its output.
Check that the next token satisfies the predicate and skip and return it when it does.
Check that the next token satisfies the predicate and skip it when it does.
like `readSome`, but for functions `A => B / Exception[WrongFormat]` such as `char::digitValue`
Reads until the predicate does not hold for the next token. Emits the tokens read.
Skips until the predicate does not hold for the next token.
Read the next character if it is the given one and return true in this case.
Check that the next token satisfies the predicate and skip it when it does.
Skip until the next character is not a whitespace character
Read as many characters corresponding to the given string as possible.
Check that the next character is a digit in base 10, and if so read and return it.
Read a positive decimal number.
Check that the next character is a digit in base 16, and if so read and return it.
Read a hexadecimal number.
Read a decimal integer.
Run a scanner by reading from an input stream.