2019-04-23 14:29:46 -07:00
|
|
|
mergeInto(LibraryManager.library, {
|
|
|
|
|
tree_sitter_parse_callback: function(
|
|
|
|
|
inputBufferAddress,
|
|
|
|
|
index,
|
|
|
|
|
row,
|
|
|
|
|
column,
|
|
|
|
|
lengthAddress
|
|
|
|
|
) {
|
|
|
|
|
var INPUT_BUFFER_SIZE = 10 * 1024;
|
|
|
|
|
var string = currentParseCallback(index, {row: row, column: column});
|
2019-04-26 17:28:15 -07:00
|
|
|
if (typeof string === 'string') {
|
|
|
|
|
setValue(lengthAddress, string.length, 'i32');
|
|
|
|
|
stringToUTF16(string, inputBufferAddress, INPUT_BUFFER_SIZE);
|
|
|
|
|
} else {
|
|
|
|
|
setValue(lengthAddress, 0, 'i32');
|
|
|
|
|
}
|
2019-04-23 14:29:46 -07:00
|
|
|
},
|
|
|
|
|
|
2020-11-30 14:28:27 -08:00
|
|
|
tree_sitter_log_callback: function(isLexMessage, messageAddress) {
|
2019-04-23 14:29:46 -07:00
|
|
|
if (currentLogCallback) {
|
|
|
|
|
const message = UTF8ToString(messageAddress);
|
2019-04-26 17:28:15 -07:00
|
|
|
currentLogCallback(message, isLexMessage !== 0);
|
2019-04-23 14:29:46 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|