Parse other types of array length expressions
diff --git a/src/constant.rs b/src/constant.rs
index 1688dbf..b2420c0 100644
--- a/src/constant.rs
+++ b/src/constant.rs
@@ -22,8 +22,20 @@
Index(Box<ConstExpr>, Box<ConstExpr>),
/// No-op: used solely so we can pretty-print faithfully
Paren(Box<ConstExpr>),
+ /// If compiling with full support for expression syntax, any expression is
+ /// allowed
+ Other(Other),
}
+#[cfg(not(feature = "full"))]
+#[derive(Debug, Clone, Eq, PartialEq)]
+pub struct Other {
+ _private: (),
+}
+
+#[cfg(feature = "full")]
+pub type Other = Expr;
+
#[cfg(feature = "parsing")]
pub mod parsing {
use super::*;
@@ -139,7 +151,17 @@
expr.to_tokens(tokens);
tokens.append(")");
}
+ ConstExpr::Other(ref other) => {
+ other.to_tokens(tokens);
+ }
}
}
}
+
+ #[cfg(not(feature = "full"))]
+ impl ToTokens for Other {
+ fn to_tokens(&self, _tokens: &mut Tokens) {
+ unreachable!()
+ }
+ }
}