File tree Expand file tree Collapse file tree 5 files changed +13
-1
lines changed
main/java/io/github/treesitter/jtreesitter
test/java/io/github/treesitter/jtreesitter Expand file tree Collapse file tree 5 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ $env:package = 'io.github.treesitter.jtreesitter.internal'
174174 -- include- constant TSSymbolTypeAnonymous `
175175 -- include- constant TSSymbolTypeAuxiliary `
176176 -- include- constant TSSymbolTypeRegular `
177+ -- include- constant TSSymbolTypeSupertype `
177178 -- header- class- name TreeSitter `
178179 -- output " $ ( $args [1 ]) /generated-sources/jextract" `
179180 - t $env: package `
Original file line number Diff line number Diff line change @@ -175,6 +175,7 @@ exec jextract \
175175 --include-constant TSSymbolTypeAnonymous \
176176 --include-constant TSSymbolTypeAuxiliary \
177177 --include-constant TSSymbolTypeRegular \
178+ --include-constant TSSymbolTypeSupertype \
178179 --header-class-name TreeSitter \
179180 --output " $2 " /generated-sources/jextract \
180181 -t " $package " \
Original file line number Diff line number Diff line change @@ -133,6 +133,11 @@ public boolean isVisible(@Unsigned short symbol) {
133133 return ts_language_symbol_type (self , symbol ) <= TSSymbolTypeAnonymous ();
134134 }
135135
136+ /** Check if the node for the given numerical ID is a supertype. */
137+ public boolean isSupertype (@ Unsigned short symbol ) {
138+ return ts_language_symbol_type (self , symbol ) == TSSymbolTypeSupertype ();
139+ }
140+
136141 /** Get the field name for the given numerical id. */
137142 public @ Nullable String getFieldNameForId (@ Unsigned short id ) {
138143 var name = ts_language_field_name_for_id (self , id );
Original file line number Diff line number Diff line change @@ -325,7 +325,7 @@ public List<Node> getChildrenByFieldName(String name) {
325325 public @ Nullable String getFieldNameForNamedChild (@ Unsigned int index ) throws IndexOutOfBoundsException {
326326 if (index >= getChildCount ()) {
327327 throw new IndexOutOfBoundsException (
328- "Child index %s is out of bounds" .formatted (Integer .toUnsignedString (index )));
328+ "Child index %s is out of bounds" .formatted (Integer .toUnsignedString (index )));
329329 }
330330 var segment = ts_node_field_name_for_named_child (self , index );
331331 return segment .equals (MemorySegment .NULL ) ? null : segment .getString (0 );
Original file line number Diff line number Diff line change @@ -56,6 +56,11 @@ void isVisible() {
5656 assertTrue (language .isVisible ((short ) 1 ));
5757 }
5858
59+ @ Test
60+ void isSupertype () {
61+ assertFalse (language .isSupertype ((short ) 1 ));
62+ }
63+
5964 @ Test
6065 void getFieldNameForId () {
6166 assertNotNull (language .getFieldNameForId ((short ) 20 ));
You can’t perform that action at this time.
0 commit comments