mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 18:34:06 +00:00
feat(script/gen_constants_cpp): generate snake_case C++ function names
This commit is contained in:
@@ -20,13 +20,20 @@ def error(msg):
|
||||
|
||||
def to_c_const(s):
|
||||
out = ""
|
||||
first = True
|
||||
for c in s:
|
||||
if c == '.' or c == '_':
|
||||
out += '_'
|
||||
elif c.isalpha() or c.isdigit():
|
||||
out += c
|
||||
if c.isupper():
|
||||
if not first:
|
||||
out += "_"
|
||||
out += c.lower()
|
||||
else:
|
||||
out += c
|
||||
else:
|
||||
error("unsupported character in constant: %s" % s)
|
||||
first = False
|
||||
return out
|
||||
|
||||
def main(argv=None):
|
||||
|
||||
Reference in New Issue
Block a user