mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Add Pop to the list of idents that GetNextShortest can't generate
It's unlikely to hit this one (requires more than 10,000 identifiers to trigger) but it's a bug nevertheless. While touching the file, try to explain the situation better in the first comment.
This commit is contained in:
parent
81906475ff
commit
da05d1e1c2
1 changed files with 10 additions and 6 deletions
|
@ -15,11 +15,12 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with LSL PyOptimizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This module renames all kinds of variables. Globals and function/event
|
||||
# parameters take memory space, so shrinking the identifiers as much as
|
||||
# possible ensures their memory usage will be minimized. It also reuses some
|
||||
# preexisting names when possible. Locals are renamed also so that they don't
|
||||
# stand in the way of globals.
|
||||
# This module renames all kinds of variables. Global variables, user functions,
|
||||
# state names, event names and function/event parameters all take memory space,
|
||||
# so shrinking the identifiers as much as possible, when possible (i.e. not for
|
||||
# events or the default state), ensures their memory usage will be minimized.
|
||||
# It also reuses some preexisting names. Locals are renamed also so that they
|
||||
# don't stand in the way of globals.
|
||||
#
|
||||
# A side effect of this change is that the script becomes unreadable gibberish.
|
||||
|
||||
|
@ -28,8 +29,11 @@ from strutil import xrange
|
|||
class renamer(object):
|
||||
CharSet1 = '_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
CharSet2 = '0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
# As a special case, 'Pop' is not a keyword, but it's one of the predefined
|
||||
# identifiers, therefore it must not be generated by GetNextShortest
|
||||
# because it's already in the list of identifiers available from the start.
|
||||
Kws = frozenset({'do', 'if', 'PI',
|
||||
'for', 'key', 'EOF',
|
||||
'for', 'key', 'EOF', 'Pop',
|
||||
'jump', 'else', 'list', 'TRUE', 'LOOP', 'case'
|
||||
})
|
||||
def GetNextShortest(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue