feat: add the semantic version to TSLanguage, and expose an API for retrieving it
This commit is contained in:
parent
f0222107b8
commit
8bb1448a6f
24 changed files with 371 additions and 77 deletions
|
|
@ -5,6 +5,7 @@ import { Tree } from "./tree";
|
|||
import { Query, QueryCapture, type QueryMatch } from "./query";
|
||||
import { TreeCursor } from "./tree_cursor";
|
||||
import { TRANSFER_BUFFER } from "./parser";
|
||||
import { LanguageMetadata } from "./language";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -161,3 +162,16 @@ export function marshalEdit(edit: Edit, address = TRANSFER_BUFFER) {
|
|||
C.setValue(address, edit.oldEndIndex, 'i32'); address += SIZE_OF_INT;
|
||||
C.setValue(address, edit.newEndIndex, 'i32'); address += SIZE_OF_INT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Unmarshals a {@link LanguageMetadata} from the transfer buffer.
|
||||
*/
|
||||
export function unmarshalLanguageMetadata(address: number): LanguageMetadata {
|
||||
const result = {} as LanguageMetadata;
|
||||
result.major_version = C.getValue(address, 'i32'); address += SIZE_OF_INT;
|
||||
result.minor_version = C.getValue(address, 'i32'); address += SIZE_OF_INT;
|
||||
result.field_count = C.getValue(address, 'i32');
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue