Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve literal define counting #428

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/preprocessor_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,10 +1651,10 @@ def handleDefineConstants(lines, define_cache = None):
newLines.append(l)
continue

# count number of string replacement token openers to figure out if we're defining literals
num_literals = m.group("val").count("{")
# count how many literals we have
num_literals = m.group("val").count(",") + 1

if num_literals > 0:
if num_literals > 1:
# add define for amount of entries in a literal define (.SIZE suffix)
defineSizeObj = DefineConstant(m.group("whole") + '.SIZE', str(num_literals), None, l)
defineConstants.append(defineSizeObj)
Expand Down