Skip to content
Snippets Groups Projects
Commit bee12555 authored by Pierre-Emmanuel Patry's avatar Pierre-Emmanuel Patry Committed by Arthur Cohen
Browse files

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: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
parent dcba437a
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment