Get parse command handling multiple files, add --time, --quiet flags

This commit is contained in:
Max Brunsfeld 2019-01-17 17:15:10 -08:00
parent 71357afb2f
commit cbcc61a8cf
4 changed files with 157 additions and 62 deletions

View file

@ -19,6 +19,7 @@ use std::marker::PhantomData;
use std::os::raw::{c_char, c_void};
use std::ptr;
use std::str;
use std::u16;
#[derive(Clone, Copy)]
#[repr(transparent)]
@ -479,6 +480,14 @@ impl<'tree> Node<'tree> {
unsafe { ffi::ts_node_has_error(self.0) }
}
pub fn is_error(&self) -> bool {
self.kind_id() == u16::MAX
}
pub fn is_missing(&self) -> bool {
unsafe { ffi::ts_node_is_missing(self.0) }
}
pub fn start_byte(&self) -> usize {
unsafe { ffi::ts_node_start_byte(self.0) as usize }
}
@ -622,6 +631,10 @@ impl<'a> TreeCursor<'a> {
Some(result as usize)
}
}
pub fn reset(&mut self, node: Node<'a>) {
unsafe { ffi::ts_tree_cursor_reset(&mut self.0, node.0) };
}
}
impl<'a> Drop for TreeCursor<'a> {