Skip to content

Float parser does not parse negative numbers #115

Closed
@Swordlash

Description

@Swordlash

Describe the bug
Token parser created by (makeTokenParser emptyDef).float does not parse negative numbers.

To Reproduce
In repl, import Text.Parsing.Parser, Text.Parsing.Parser.Language and Text.Parsing.Parser.Token.
Evaluate runParser "(-6.0)" (makeTokenParser emptyDef).float (parentheses don't matter).

Expected behavior
Right (-6.0)

Actual behavior
(Left (ParseError "Expected float" (Position { line: 1, column: 1 })))

Additional context
I think the parser should be able to parse negative numbers. integer parser already does. Perhaps add a sign-aware parser?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething that should function correctly isn't.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions