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