Skip to content

Input parser rework: migrate FPType to MSTD_ENUM (reserved-keyword naming) + floating_point_type key #577

Description

@97gamjak

Part of #515. Depends on Phase 3 being complete (as precedent, not a hard
technical dependency).

Scope

Convert FPType from a plain enum class to MSTD_ENUM, and migrate the
floating_point_type key in generalInputParser.

Real gotcha, not hypothetical: the accepted input tokens are
"float"/"double" -- both reserved C++ keywords, so they cannot be
literal enumerator names. Use non-colliding identifiers (e.g. flt/dbl)
and a customParser mapping the real input tokens to them:

customParser = [](std::string_view raw) -> std::optional<FPType>
{
    if (raw == "float")  return FPType::flt;
    if (raw == "double") return FPType::dbl;
    return std::nullopt;
};

Single key -- no reason to split enum conversion and key migration into
separate PRs here.

Acceptance criteria

  • "float"/"double" input tokens resolve correctly via the
    customParser alias.
  • Existing integration tests for floating_point_type pass unchanged.
  • New unit test covering the alias explicitly (not just the happy path).
  • Old parseFloatingPointType and fpTypeFromString/string(FPType)
    deleted in this PR once unreferenced elsewhere.

Risk

Low-moderate -- the naming workaround needs to be gotten right, but blast
radius is one key.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions