Commit eaafffcc authored by Peter Jin's avatar Peter Jin

Separate lexer and parser features.

Both the lexer and parser need quote.

Formatting.
parent 38a720a6
......@@ -16,10 +16,16 @@ keywords = ["tokenizer", "scanner", "lexer", "parser", "generator"]
name = "plex"
proc-macro = true
[features]
default = ["lexer", "parser"]
lexer = ["redfa"]
parser = ["lalr"]
[dependencies]
lalr = "0.0.2"
redfa = "0.0.2"
lalr = { version = "0.0.2", optional = true }
redfa = { version = "0.0.2", optional = true }
syn = { version = "0.14.0", features = ["extra-traits", "full"] }
proc-macro2 = { version = "0.4.3", features = ["nightly"] }
quote = "0.6.0"
......@@ -3,25 +3,31 @@
#![feature(proc_macro_span)]
#![warn(unused_extern_crates)]
#[cfg(feature = "parser")]
extern crate lalr;
extern crate proc_macro2;
extern crate proc_macro;
#[macro_use]
extern crate quote;
#[cfg(feature = "lexer")]
extern crate redfa;
#[macro_use]
extern crate syn;
#[cfg(feature = "lexer")]
mod lexer;
#[cfg(feature = "parser")]
mod parser;
use proc_macro::TokenStream;
#[cfg(feature = "lexer")]
#[proc_macro]
pub fn lexer(tok: TokenStream) -> TokenStream {
lexer::lexer(tok.into()).into()
}
#[cfg(feature = "parser")]
#[proc_macro]
pub fn parser(tok: TokenStream) -> TokenStream {
parser::parser(tok.into()).into()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment