1#![cfg_attr(can_show_location_of_runtime_parse_error, feature(proc_macro_span))]
2#![deny(rust_2018_idioms, unsafe_code)]
3
4#[allow(clippy::useless_attribute)]
5extern crate proc_macro;
6
7use proc_macro_hack::proc_macro_hack;
8
9mod context;
10mod error;
11mod gtk;
12mod lexer;
13mod parser;
14
15#[proc_macro_hack]
16pub fn gtk(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
17 let stream: lexer::Tokens = input.into();
21 let result = parser::grammar::GtkElementParser::new().parse(stream.lexer());
24 match result {
25 Err(err) => error::parse_error(&stream, &err),
26 Ok(element) => gtk::expand_gtk(&element),
27 }
28 .into()
29
30 }