Skip to content

Support currency/dollar value #31

@cogentParadigm

Description

@cogentParadigm

Thanks for sharing this work! I would like to parse dollar values in my expression, for example:

$1,500.75 - $200.00

I'm not sure the best way to do this, but it looks like I can create a custom Lexer and add a token definition with an custom pattern that will match dollar values.

However, I would still need to parse the token into a float. For TokenType::RealNumber this happens in the Node::factory method which is called from the private function shuntingYard in the the Parser class. This doesn't look easily extendable.

Do you have any suggestions on how I should go about this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions