use crate::SourceSpan;
use super::expr::Expr;
use super::item::Path;
use super::punct::Punctuated;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum FundamentalKind {
Void,
Bool,
Char,
Char8,
Char16,
Char32,
Wchar,
Short,
Int,
Long,
LongLong,
Float,
Double,
LongDouble,
SignedChar,
UnsignedChar,
UnsignedShort,
UnsignedInt,
UnsignedLong,
UnsignedLongLong,
}
#[derive(Debug, Clone, Copy, PartialEq, Default)]
pub struct CvQualifiers {
pub const_token: bool,
pub volatile_token: bool,
}
#[derive(Debug, Clone, PartialEq)]
pub enum Type<'de> {
Fundamental(TypeFundamental<'de>),
Path(TypePath<'de>),
Ptr(TypePtr<'de>),
Reference(TypeReference<'de>),
RvalueReference(TypeRvalueReference<'de>),
Array(TypeArray<'de>),
FnPtr(TypeFnPtr<'de>),
Auto(TypeAuto<'de>),
Decltype(TypeDecltype<'de>),
TemplateInst(TypeTemplateInst<'de>),
Qualified(TypeQualified<'de>),
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct TypeFundamental<'de> {
pub span: SourceSpan<'de>,
pub kind: FundamentalKind,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TypePath<'de> {
pub path: Path<'de>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TypePtr<'de> {
pub cv: CvQualifiers,
pub pointee: Box<Type<'de>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TypeReference<'de> {
pub cv: CvQualifiers,
pub referent: Box<Type<'de>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TypeRvalueReference<'de> {
pub referent: Box<Type<'de>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TypeArray<'de> {
pub element: Box<Type<'de>>,
pub size: Option<Expr<'de>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TypeFnPtr<'de> {
pub return_type: Box<Type<'de>>,
pub params: Punctuated<'de, Type<'de>>,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct TypeAuto<'de> {
pub span: SourceSpan<'de>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TypeDecltype<'de> {
pub expr: Expr<'de>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TypeTemplateInst<'de> {
pub path: Path<'de>,
pub args: Vec<TemplateArg<'de>>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum TemplateArg<'de> {
Type(Type<'de>),
Expr(Expr<'de>),
}
#[derive(Debug, Clone, PartialEq)]
pub struct TypeQualified<'de> {
pub cv: CvQualifiers,
pub ty: Box<Type<'de>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct AngleBracketedArgs<'de> {
pub args: Vec<TemplateArg<'de>>,
}