Skip to content

Commit

Permalink
Handle floats
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr committed May 15, 2022
1 parent 440c40e commit 8e2709f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/python/qmk/c_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ def _coerce_led_token(_type, value):
}
if _type is Token.Literal.Number.Integer:
return int(value)
if _type is Token.Literal.Number.Float:
return float(value)
if _type is Token.Literal.Number.Hex:
return int(value, 0)
if _type is Token.Name and value in value_map.keys():
Expand Down Expand Up @@ -233,7 +235,7 @@ def _parse_led_config(file, matrix_cols, matrix_rows):
bracket_count -= 1
else:
# Assume any non whitespace value here is important enough to stash
if _type in [Token.Literal.Number.Integer, Token.Literal.Number.Hex, Token.Name]:
if _type in [Token.Literal.Number.Integer, Token.Literal.Number.Float, Token.Literal.Number.Hex, Token.Name]:
if section == 1 and bracket_count == 3:
matrix_raw.append(_coerce_led_token(_type, value))
if section == 2 and bracket_count == 3:
Expand Down

0 comments on commit 8e2709f

Please sign in to comment.