|
Ruby 3.4.7p58 (2025-10-08 revision 7a5688e2a27668e48f8d6ff4af5b2208b98a2f5e)
|
When you are lexing through a file, the lexer needs all of the information that the parser additionally provides (for example, the local table). More...
#include <parser.h>
Data Fields | |
| void * | data |
| This opaque pointer is used to provide whatever information the user deemed necessary to the callback. | |
| void(* | callback )(void *data, pm_parser_t *parser, pm_token_t *token) |
| This is the callback that is called when a token is lexed. | |
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.
| void(* pm_lex_callback_t::callback) (void *data, pm_parser_t *parser, pm_token_t *token) |
| void* pm_lex_callback_t::data |