#[repr(C)]pub struct pm_lex_callback_t {
pub data: *mut c_void,
pub callback: Option<unsafe extern "C" fn(data: *mut c_void, parser: *mut pm_parser_t, token: *mut pm_token_t)>,
}
Expand description
When you are lexing through a file, the lexer needs all of the information that the parser additionally provides (for example, the local table). So if you want to properly lex Ruby, you need to actually lex it in the context of the parser. In order to provide this functionality, we optionally allow a struct to be attached to the parser that calls back out to a user-provided callback when each token is lexed.
Fields§
§data: *mut c_void
This opaque pointer is used to provide whatever information the user deemed necessary to the callback. In our case we use it to pass the array that the tokens get appended into.
callback: Option<unsafe extern "C" fn(data: *mut c_void, parser: *mut pm_parser_t, token: *mut pm_token_t)>
This is the callback that is called when a token is lexed. It is passed the opaque data pointer, the parser, and the token that was lexed.
Trait Implementations§
Source§impl Clone for pm_lex_callback_t
impl Clone for pm_lex_callback_t
Source§fn clone(&self) -> pm_lex_callback_t
fn clone(&self) -> pm_lex_callback_t
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for pm_lex_callback_t
impl Debug for pm_lex_callback_t
Source§impl Default for pm_lex_callback_t
impl Default for pm_lex_callback_t
impl Copy for pm_lex_callback_t
Auto Trait Implementations§
impl Freeze for pm_lex_callback_t
impl RefUnwindSafe for pm_lex_callback_t
impl !Send for pm_lex_callback_t
impl !Sync for pm_lex_callback_t
impl Unpin for pm_lex_callback_t
impl UnwindSafe for pm_lex_callback_t
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more