Skip to content

'scanner::readDecimal' succeeds with '0: Int' on empty/malformed input #1247

@jiribenes

Description

@jiribenes

Playground link

import scanner

def lex() = 
  returning::scanner[Char, Int] { 
    readDecimal()
  }

def main() = {
  feed("") {
    println(lex()) // 0
  }
  feed("\n") {
    println(lex()) // 0
  }
  feed("hello") {
    println(lex()) // 0
  }
}

I don't like this behaviour because it silences errors. :(

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions