aboutsummaryrefslogtreecommitdiff
path: root/codegen/lib/utils.py
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-06-11 09:50:14 -0500
committermat <github@matdoes.dev>2022-06-11 09:50:14 -0500
commitb852bdc48150c0c01f341f73dfb84084b50eda9c (patch)
treeda2dfe72251908c87d0932d3bb85534f3b7859e8 /codegen/lib/utils.py
parent6926907528135f7b6c891540b1aa2fdbe7696014 (diff)
downloadazalea-drasl-b852bdc48150c0c01f341f73dfb84084b50eda9c.tar.xz
Separate int properties
Diffstat (limited to 'codegen/lib/utils.py')
-rw-r--r--codegen/lib/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/codegen/lib/utils.py b/codegen/lib/utils.py
index fb43af21..3887bb35 100644
--- a/codegen/lib/utils.py
+++ b/codegen/lib/utils.py
@@ -11,13 +11,15 @@ def to_snake_case(name: str):
def to_camel_case(name: str):
s = re.sub('_([a-z])', lambda m: m.group(1).upper(), name)
- s = s[0].upper() + s[1:]
+ s = upper_first_letter(s)
# if the first character is a number, we need to add an underscore
# maybe we could convert it to the number name (like 2 would become "two")?
if s[0].isdigit():
s = f'_{s}'
return s
+def upper_first_letter(name: str):
+ return name[0].upper() + name[1:]
def padded_hex(n: int):
return f'0x{n:02x}'