File tree 3 files changed +40
-5
lines changed
3 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -31,3 +31,4 @@ quote = "0.3"
31
31
serde-serialization = [ " serde" ]
32
32
heap_size = [ " heapsize" ]
33
33
bench = []
34
+ dummy_match_byte = []
Original file line number Diff line number Diff line change @@ -5,15 +5,33 @@ extern crate syn;
5
5
use std:: env;
6
6
use std:: path:: Path ;
7
7
8
+
9
+ #[ cfg( feature = "dummy_match_byte" ) ]
10
+ mod codegen {
11
+ use std:: path:: Path ;
12
+ pub fn main ( _: & Path ) { }
13
+ }
14
+
15
+ #[ cfg( not( feature = "dummy_match_byte" ) ) ]
8
16
#[ path = "src/macros/mod.rs" ]
9
17
mod macros;
10
18
19
+ #[ cfg( not( feature = "dummy_match_byte" ) ) ]
20
+ mod codegen {
21
+ use macros;
22
+ use std:: env;
23
+ use std:: path:: Path ;
24
+
25
+ pub fn main ( tokenizer_rs : & Path ) {
26
+ macros:: match_byte:: expand ( tokenizer_rs,
27
+ & Path :: new ( & env:: var ( "OUT_DIR" ) . unwrap ( ) ) . join ( "tokenizer.rs" ) ) ;
28
+
29
+ }
30
+ }
31
+
11
32
fn main ( ) {
12
33
let manifest_dir = env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ;
13
-
14
34
let tokenizer_rs = Path :: new ( & manifest_dir) . join ( "src/tokenizer.rs" ) ;
15
- macros:: match_byte:: expand ( & tokenizer_rs,
16
- & Path :: new ( & env:: var ( "OUT_DIR" ) . unwrap ( ) ) . join ( "tokenizer.rs" ) ) ;
17
-
18
- println ! ( "cargo:rerun-if-changed={}" , tokenizer_rs. display( ) ) ;
35
+ codegen:: main ( & tokenizer_rs) ;
36
+ println ! ( "cargo:rerun-if-changed={}" , tokenizer_rs. display( ) ) ;
19
37
}
Original file line number Diff line number Diff line change @@ -137,6 +137,22 @@ macro_rules! match_ignore_ascii_case {
137
137
}
138
138
139
139
mod rules_and_declarations;
140
+
141
+ #[ cfg( feature = "dummy_match_byte" ) ]
142
+ macro_rules! match_byte {
143
+ ( $value: expr, $( $rest: tt) * ) => {
144
+ match $value {
145
+ $(
146
+ $rest
147
+ ) +
148
+ }
149
+ } ;
150
+ }
151
+
152
+ #[ cfg( feature = "dummy_match_byte" ) ]
153
+ mod tokenizer;
154
+
155
+ #[ cfg( not( feature = "dummy_match_byte" ) ) ]
140
156
mod tokenizer {
141
157
include ! ( concat!( env!( "OUT_DIR" ) , "/tokenizer.rs" ) ) ;
142
158
}
You can’t perform that action at this time.
0 commit comments