Decimals = Rule
  { name = "decimal number"
  , pattern =
    [ regex "(\\d*\\.\\d+)"
    ]
  , prod = \case
      (Token RegexMatch (GroupMatch (match:_)):_) -> parseDecimal True match
      _ -> Nothing
  }

ruleCommas :: Rule
ruleCommas = Rule
  { name = "comma-separated numbers"
  , pattern =
    [ regex "(\\d+(,\\d\\d\\d)+(\\.\\d+)?)"
    ]
  , prod = \case
      (Token RegexMatch (GroupMatch (match:_)):_) ->
        parseDouble (Text.re
ruleCompositeHundreds :: Rule
ruleCompositeHundreds = Rule
  { name = "integer 100..999"
  , pattern =
    [ oneOf [100,200..900]
    , oneOf [20,40..90]
    , numberBetween 1 20
    ]
  , prod = \case
      (Token Numeral NumeralData{TNumeral.value = hundreds}:
       Token Numeral NumeralData{TNumeral.value = tens}:
       Token Numeral NumeralData{TNumeral.value = units}:
       _) -> double $ hundreds + tens + units
      _ -> Nothing
  }
ruleCompositeHundreds = Rule
  { name = "integer 100..999"
  , pattern =
    [ oneOf [100,200..900]
    , oneOf [20,40..90]
    , numberBetween 1 20
    ]
  , prod = \case
      (Token Numeral NumeralData{TNumeral.value = hundreds}:
       Token Numeral NumeralData{TNumeral.value = tens}:
       Token Numeral NumeralData{TNumeral.value = units}:
       _) -> double $ hundreds + tens + units
      _ -> Nothing
  }