File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
crates/postgresql-cst-parser/src Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,16 @@ impl<'a> Node<'a> {
186186 } )
187187 }
188188
189+ pub fn prev_sibling ( & self ) -> Option < Node < ' a > > {
190+ self . node_or_token
191+ . prev_sibling_or_token ( )
192+ . map ( |sibling| Node {
193+ input : self . input ,
194+ range_map : Rc :: clone ( & self . range_map ) ,
195+ node_or_token : sibling,
196+ } )
197+ }
198+
189199 pub fn parent ( & self ) -> Option < Node < ' a > > {
190200 self . node_or_token . parent ( ) . map ( |parent| Node {
191201 input : self . input ,
@@ -246,6 +256,15 @@ impl<'a> TreeCursor<'a> {
246256 }
247257 }
248258
259+ pub fn goto_prev_sibling ( & mut self ) -> bool {
260+ if let Some ( sibling) = self . node_or_token . prev_sibling_or_token ( ) {
261+ self . node_or_token = sibling;
262+ true
263+ } else {
264+ false
265+ }
266+ }
267+
249268 pub fn is_comment ( & self ) -> bool {
250269 matches ! (
251270 self . node_or_token. kind( ) ,
You can’t perform that action at this time.
0 commit comments