-
- Downloads
gccrs: proc_macro: Add from string implementation
Add a callback registration function into the proc macro library so the
compiler can register it's own lexing/parsing functions on load.
gcc/rust/ChangeLog:
* expand/rust-proc-macro.cc (tokenstream_from_string): Add a
function that creates a tokenstream from a given string.
(load_macros_array): Add call to registration function.
libgrust/ChangeLog:
* libproc_macro/proc_macro.cc (proc_macro_register_from_str):
Add registration function.
* libproc_macro/proc_macro.h (proc_macro_register_from_str):
Add registration function prototype.
* libproc_macro/tokenstream.cc (TokenStream::make_tokenstream):
Add a new constructor from a string that uses the registered
callback.
(TokenStream__from_string): Add call to new constructor.
* libproc_macro/tokenstream.h: Add registration
declaration.
* libproc_macro/registration.h: New file.
Signed-off-by:
Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Showing
- gcc/rust/expand/rust-proc-macro.cc 62 additions, 0 deletionsgcc/rust/expand/rust-proc-macro.cc
- libgrust/libproc_macro/proc_macro.cc 2 additions, 0 deletionslibgrust/libproc_macro/proc_macro.cc
- libgrust/libproc_macro/proc_macro.h 4 additions, 0 deletionslibgrust/libproc_macro/proc_macro.h
- libgrust/libproc_macro/registration.h 37 additions, 0 deletionslibgrust/libproc_macro/registration.h
- libgrust/libproc_macro/tokenstream.cc 12 additions, 2 deletionslibgrust/libproc_macro/tokenstream.cc
- libgrust/libproc_macro/tokenstream.h 2 additions, 0 deletionslibgrust/libproc_macro/tokenstream.h
Loading
Please register or sign in to comment