@@ -16,14 +16,18 @@ const {Query, Parser, NodeMethods, Tree, TreeCursor} = binding;
1616 * Tree
1717 */
1818
19- const { rootNode, edit} = Tree . prototype ;
19+ const { rootNode, rootNodeWithOffset , edit} = Tree . prototype ;
2020
2121Object . defineProperty ( Tree . prototype , 'rootNode' , {
2222 get ( ) {
2323 return unmarshalNode ( rootNode . call ( this ) , this ) ;
2424 }
2525} ) ;
2626
27+ Tree . prototype . rootNodeWithOffset = function ( offset_bytes , offset_extent ) {
28+ return unmarshalNode ( rootNodeWithOffset . call ( this , offset_bytes , offset_extent . row , offset_extent . column ) , this ) ;
29+ }
30+
2731Tree . prototype . edit = function ( arg ) {
2832 edit . call (
2933 this ,
@@ -164,6 +168,21 @@ class SyntaxNode {
164168 return unmarshalNode ( NodeMethods . previousNamedSibling ( this . tree ) , this . tree ) ;
165169 }
166170
171+ get parseState ( ) {
172+ marshalNode ( this ) ;
173+ return NodeMethods . parseState ( this . tree ) ;
174+ }
175+
176+ get nextParseState ( ) {
177+ marshalNode ( this ) ;
178+ return NodeMethods . nextParseState ( this . tree ) ;
179+ }
180+
181+ get descendantCount ( ) {
182+ marshalNode ( this ) ;
183+ return NodeMethods . descendantCount ( this . tree ) ;
184+ }
185+
167186 hasChanges ( ) {
168187 marshalNode ( this ) ;
169188 return NodeMethods . hasChanges ( this . tree ) ;
@@ -179,6 +198,16 @@ class SyntaxNode {
179198 return NodeMethods . isMissing ( this . tree ) ;
180199 }
181200
201+ isExtra ( ) {
202+ marshalNode ( this ) ;
203+ return NodeMethods . isExtra ( this . tree ) ;
204+ }
205+
206+ isError ( ) {
207+ marshalNode ( this ) ;
208+ return NodeMethods . isError ( this . tree ) ;
209+ }
210+
182211 toString ( ) {
183212 marshalNode ( this ) ;
184213 return NodeMethods . toString ( this . tree ) ;
@@ -194,6 +223,31 @@ class SyntaxNode {
194223 return unmarshalNode ( NodeMethods . namedChild ( this . tree , index ) , this . tree ) ;
195224 }
196225
226+ childForFieldName ( fieldName ) {
227+ marshalNode ( this ) ;
228+ return unmarshalNode ( NodeMethods . childForFieldName ( this . tree , fieldName ) , this . tree ) ;
229+ }
230+
231+ childForFieldId ( fieldId ) {
232+ marshalNode ( this ) ;
233+ return unmarshalNode ( NodeMethods . childForFieldId ( this . tree , fieldId ) , this . tree ) ;
234+ }
235+
236+ fieldNameForChild ( childIndex ) {
237+ marshalNode ( this ) ;
238+ return NodeMethods . fieldNameForChild ( this . tree , childIndex ) ;
239+ }
240+
241+ childrenForFieldName ( fieldName , cursor ) {
242+ marshalNode ( this ) ;
243+ return unmarshalNodes ( NodeMethods . childrenForFieldName ( this . tree , fieldName , cursor ) , this . tree ) ;
244+ }
245+
246+ childrenForFieldId ( fieldId ) {
247+ marshalNode ( this ) ;
248+ return unmarshalNodes ( NodeMethods . childrenForFieldId ( this . tree , fieldId ) , this . tree ) ;
249+ }
250+
197251 firstChildForIndex ( index ) {
198252 marshalNode ( this ) ;
199253 return unmarshalNode ( NodeMethods . firstChildForIndex ( this . tree , index ) , this . tree ) ;
@@ -282,7 +336,7 @@ Parser.prototype.parse = function(input, oldTree, {bufferSize, includedRanges}={
282336 input ,
283337 oldTree ,
284338 bufferSize ,
285- includedRanges
339+ includedRanges ,
286340 ) ;
287341 if ( tree ) {
288342 tree . input = treeInput
0 commit comments