parseKeyword function
Implementation
Token? parseKeyword(String input, int index, int line, int column) {
final entries = keywordTokensMap.entries;
for (int i = 0; i < entries.length; i++) {
final entry = entries.elementAt(i);
final keyLen = entry.key.length;
final nextLen = index + keyLen;
final lastIndex = nextLen > input.length ? input.length : nextLen;
if (safeSubstring(input, index, lastIndex) == entry.key) {
return new Token(
entry.value, line, column + keyLen, lastIndex, entry.key);
}
}
return null;
}