in wasm/wasm-sharding-js/sharding/strgen.js [231:269]
getCharacterSet() { // if the operator was the start of a character class definition, begin reading the pattern, and react according to a set of comparisons
do { // starts at the [ which was successfully read in the stage before this function
this.createLogEntry("Processing range at pattern position " + (this.current_index + 1));
var current_character = this.next();
if (this.current() == '\\') {
this.createLogEntry("Preset character at position " + (this.current_index + 1) + ", getting values for preset", this.lookahead());
this.getPresetValues(this.next());
this.generateRangeValue();
} else if (this.operators.includes(this.current()) == true && this.last() != '/' && this.current() != '/') {// if the current character is an unbroken operator, throw error
if(this.pattern.charAt(this.current_index) != "") {
this.outputError("Unexpected operator at position " + (this.current_index + 1) + ", operator '" + this.pattern.charAt(this.current_index) + "'.");
} else {
this.outputError("Character class not closed.");
}
break;
} else if (this.lookahead() == '-' && current_character != '/') { // if the next character is an unbroken '-' operator
this.createLogEntry("Unbroken operator", "-");
var character_store;
character_store = current_character; // take current character (left side of hyphen) and store it temp
this.next(); // skip hyphen
if (this.lookahead() == '/') { // if character after hyphen is / break character
this.next() // skip \
current_character = this.next(); // character after the /
} else {
current_character = this.next(); // assign the next character (right side of hyphen) and store it as the current character
}
this.createLogEntry("Range found", character_store + " , " + current_character);
this.generateRangeValue(character_store.charCodeAt(0), current_character.charCodeAt(0)); // generate_range_value(ascii value of left side , ascii value of right side)
} else if (this.lookahead() != '-' && current_character != '/') { // if the next character is not the "-" operator, and the current isn't a character break, then push current()
this.createLogEntry("Literal added to range", current_character);
this.generated_value_list.push(this.current());
}
} while (this.lookahead() != ']')
};