Add parse function that accepts input encoding
This commit is contained in:
parent
9ac496aced
commit
2be55244fc
2 changed files with 8 additions and 2 deletions
|
|
@ -87,7 +87,7 @@ typedef enum {
|
|||
} ErrorComparison;
|
||||
|
||||
typedef struct {
|
||||
const char *string;
|
||||
const void *string;
|
||||
uint32_t length;
|
||||
} TSStringInput;
|
||||
|
||||
|
|
@ -1643,11 +1643,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 void *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