Merge pull request #236 from zachwaugh/add-parse-encoding-param
Enable direct parsing of UTF-16 strings
This commit is contained in:
commit
6d97cbd2b6
2 changed files with 7 additions and 1 deletions
|
|
@ -87,6 +87,7 @@ void ts_parser_print_dot_graphs(TSParser *, FILE *);
|
|||
void ts_parser_halt_on_error(TSParser *, bool);
|
||||
TSTree *ts_parser_parse(TSParser *, const TSTree *, TSInput);
|
||||
TSTree *ts_parser_parse_string(TSParser *, const TSTree *, const char *, uint32_t);
|
||||
TSTree *ts_parser_parse_string_encoding(TSParser *, const TSTree *, const char *, uint32_t, TSInputEncoding);
|
||||
bool ts_parser_enabled(const TSParser *);
|
||||
void ts_parser_set_enabled(TSParser *, bool);
|
||||
size_t ts_parser_operation_limit(const TSParser *);
|
||||
|
|
|
|||
|
|
@ -1688,11 +1688,16 @@ TSTree *ts_parser_parse(TSParser *self, const TSTree *old_tree, TSInput input) {
|
|||
|
||||
TSTree *ts_parser_parse_string(TSParser *self, const TSTree *old_tree,
|
||||
const char *string, uint32_t length) {
|
||||
return ts_parser_parse_string_encoding(self, old_tree, string, length, TSInputEncodingUTF8);
|
||||
}
|
||||
|
||||
TSTree *ts_parser_parse_string_encoding(TSParser *self, const TSTree *old_tree,
|
||||
const char *string, uint32_t length, TSInputEncoding encoding) {
|
||||
TSStringInput input = {string, length};
|
||||
return ts_parser_parse(self, old_tree, (TSInput) {
|
||||
&input,
|
||||
ts_string_input_read,
|
||||
TSInputEncodingUTF8,
|
||||
encoding,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue