Treat ' as digit separator when file extension is .cpp, .cxx, .cc

This commit is contained in:
Duong Do Minh Chau 2020-04-26 20:40:16 +07:00
parent 6d3a04cfef
commit e856bce4e9
1 changed files with 7 additions and 3 deletions

View File

@ -1461,6 +1461,7 @@ def process_c_file(f, patch_infos):
linenumber = 1
ignoreline = -1
cpplanguage = f.endswith(".cpp") or f.endswith(".cxx") or f.endswith(".cc")
incomment = 0
instring = 0
linebegin = 1
@ -1644,9 +1645,12 @@ def process_c_file(f, patch_infos):
startpos + max_lookahead]
hit.hook(hit)
elif p_digits.match(c):
while i < len(text) and p_digits.match(
text[i]): # Process a number.
i += 1
while i < len(text): # Process a number.
# C does not have digit separator
if p_digits.match(text[i]) or (cpplanguage and text[i] == "'"):
i += 1
else:
break
# else some other character, which we ignore.
# End of loop through text. Wrap up.
if codeinline: