mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 19:21:33 +03:00
5d5f861b9d
- rustc toolchain to "nightly-2018-05-30" - rustfmt to 0.8.6 - rustc-ap-* to 150 - syn to 0.14 - proc-macro2 to 0.4 - quote to 0.6
43 lines
745 B
Rust
43 lines
745 B
Rust
#[macro_use]
|
|
extern crate enum_kind;
|
|
|
|
#[derive(Debug, Kind)]
|
|
#[kind(functions(is_a = "bool", prec = "u8"))]
|
|
pub enum Tokens {
|
|
#[kind(is_a)]
|
|
#[kind(prec = "7")]
|
|
A,
|
|
#[kind(prec = "6")]
|
|
StructLike {},
|
|
#[kind(prec = "5")]
|
|
TupleLike(u8),
|
|
|
|
#[kind(prec = "6")]
|
|
#[cfg(feature = "not-used")]
|
|
Unused,
|
|
}
|
|
|
|
#[test]
|
|
fn simple_bool() {
|
|
assert!(Tokens::A.is_a());
|
|
assert!(!Tokens::StructLike {}.is_a());
|
|
assert!(!Tokens::TupleLike(5).is_a());
|
|
}
|
|
|
|
#[derive(Debug, Kind)]
|
|
#[kind(functions(wanted = "bool"))]
|
|
pub enum Delegate {
|
|
#[kind(wanted)]
|
|
Wanted,
|
|
#[kind(delegate)]
|
|
May(Del),
|
|
}
|
|
|
|
#[derive(Debug, Kind)]
|
|
#[kind(functions(wanted = "bool"))]
|
|
pub enum Del {
|
|
#[kind(wanted)]
|
|
Yes,
|
|
No,
|
|
}
|