Skip to content

Unexpected behaviour of parseDeref for expressions with trailing spaces #211

@arowM

Description

@arowM

As examples bellow, Text.Shakespeare.Base.parseDeref does not behave naturally when an expression including infix operator and trailing spaces.

-- Without trailing spaces, it parses as expected
>>> runParserT parseDeref () "" " a + b"
Identity (Right (DerefBranch (DerefBranch (DerefIdent (Ident "+")) (DerefIdent (Ident "a"))) (DerefIdent (Ident "b"))))

-- With trailing spaces, it ignores charactors after infix operator
>>> runParserT parseDeref () "" "a + b "
Identity (Right (DerefIdent (Ident "a")))
>>> runParserT parseDeref () "" " a + b "
Identity (Right (DerefIdent (Ident "a")))

-- It works well without infix operators even if it has trailing spaces.
>>> runParserT parseDeref () "" " (+) a b "
Identity (Right (DerefBranch (DerefBranch (DerefIdent (Ident "+")) (DerefIdent (Ident "a"))) (DerefIdent (Ident "b"))))

Is this behaviour in the specifications?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions