Skip to content

Consider to switch token matching logic from separator to regex #13

@qpanda

Description

@qpanda

At the moment input lines are split into tokens based on separators and then an attempt is made to convert the token to the specified type. This works reasonably well but it requires us to prohibit separators that are (possible) characters in the token we want to parse into a type. For example, if we use $integer in a condition we can't use + or - as separators because those characters can occur in $integer.

An alternative, and maybe better approach, would be to define a regex for each type and use the regex to identify tokens for each type on each input line. The challenge with this approach is that we don't know how the token we want to match with the regex is separated from the text around it. We would need to somehow invert the pattern. The other challenge is that we would need to translate chrono::format::strftime date/time format strings (which can be specified by the user) into a regex. If we can solve those challenges, however, we remove all the nasty separator validation logic in expression::Validator and don't need to bother the user with making sure that the correct separators are supplied using add-separator and remove-separator command arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions