advanceNextId method
void
advanceNextId()
Advances the next ID and returns it using the following
algorithm:
Bumps the last letter in the set to the next in the
collection [a-z, A-Z, 0-9].
If the last letter was '9', then flip it back to 'a' and
append a new alphabet entry to the _newId list.
If _newId is empty, then the letter "a" is inserted.
If _newId is of length 1 and is letter "Z", then
skip numbers [0-9] b/c lua needs a non-number character
for valid identifiers.
Implementation
void advanceNextId() {
final n = _nextId.length-1;
if(_nextId.last == 'z') {
_nextId[n] = 'A';
} else if(_nextId.last == 'Z') {
if(_nextId.length == 1) {
_nextId[n] = 'a';
_nextId.add('a');
} else {
_nextId[n] = '0';
}
} else if(_nextId.last == '9') {
_nextId[n] = 'a';
_nextId.add('a');
} else {
_nextId[n] = String.fromCharCode(_nextId.last.codeUnitAt(0) + 1);
}
}