Skip to content

Commit

Permalink
refact(rivetc.codegen): simplify keywords escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS authored Oct 10, 2023
1 parent c8e39ce commit 54c348c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rivetc/src/codegen/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
'auto', 'bool', 'case', 'char', 'complex', 'default', 'delete', 'do',
'double', 'export', 'float', 'goto', 'inline', 'int', 'long', 'namespace',
'new', 'register', 'restrict', 'short', 'signed', 'sizeof', 'small',
'static', 'typedef', 'typename', 'union', 'unix', 'unsigned', 'void',
'volatile', 'template', 'far', 'near', 'huge', 'linux'
'static', 'typedef', 'typename', 'union', 'unsigned', 'void',
'volatile', 'template', 'far', 'near', 'huge'
]

def c_escape(kw):
return f"_ri_{kw}" if kw in C_RESERVED else kw
return f"_{kw}_" if kw in C_RESERVED else kw

class CGen:
def __init__(self, comp):
Expand Down

0 comments on commit 54c348c

Please sign in to comment.