build method
Implementation
@override
String build(Context context, ParserResult? result) {
for (final item in reservedWords) {
if (item.isEmpty) {
throw ArgumentError(
'The list of reserved words must not contain empty elements');
}
}
context.refersToStateSource = true;
final fast = result == null;
final values = context.allocateLocals(['pos']);
final isContUnicode = identCont.isUnicode;
final isStartUnicode = identStart.isUnicode;
final sortedWords = reservedWords.toSet().toList();
sortedWords.sort();
values.addAll({
'identCont': identCont.build(context, 'identCont', ['c']),
'identStart': identStart.build(context, 'identStart', ['c']),
'readCont': isContUnicode ? 'readRune(state)' : 'codeUnitAt(state.pos++)',
'readStart':
isStartUnicode ? 'readRune(state)' : 'codeUnitAt(state.pos++)',
'words': helper.getAsCode(reservedWords.toSet()),
});
return render2(fast, _templateFast, _template, values, [result]);
}