@@ -193,6 +193,7 @@ pub Ty: Ty = {
193193};
194194
195195TyWithoutFor: Ty = {
196+ <ScalarType> => Ty::Scalar { ty: <> },
196197 <n:Id> => Ty::Id { name: n},
197198 "fn" "(" <t:Ty> ")" => Ty::ForAll {
198199 lifetime_names: vec![],
@@ -203,7 +204,37 @@ TyWithoutFor: Ty = {
203204 },
204205 <n:Id> "<" <a:Comma<Parameter>> ">" => Ty::Apply { name: n, args: a },
205206 <p:ProjectionTy> => Ty::Projection { proj: p },
206- "(" <Ty> ")",
207+ "(" <t:TupleOrParensInner> ")" => t,
208+ };
209+
210+ ScalarType: ScalarType = {
211+ "u8" => ScalarType::Uint(UintTy::U8),
212+ "u16" => ScalarType::Uint(UintTy::U16),
213+ "u32" => ScalarType::Uint(UintTy::U32),
214+ "u64" => ScalarType::Uint(UintTy::U64),
215+ "u128" => ScalarType::Uint(UintTy::U128),
216+ "usize" => ScalarType::Uint(UintTy::Usize),
217+ "i8" => ScalarType::Int(IntTy::I8),
218+ "i16" => ScalarType::Int(IntTy::I16),
219+ "i32" => ScalarType::Int(IntTy::I32),
220+ "i64" => ScalarType::Int(IntTy::I64),
221+ "i128" => ScalarType::Int(IntTy::I128),
222+ "isize" => ScalarType::Int(IntTy::Isize),
223+ "f32" => ScalarType::Float(FloatTy::F32),
224+ "f64" => ScalarType::Float(FloatTy::F64),
225+ "bool" => ScalarType::Bool,
226+ "char" => ScalarType::Char,
227+ };
228+
229+ TupleOrParensInner: Ty = {
230+ <Ty>,
231+ <first:Ty> "," <rest:Comma<Ty>> => {
232+ let mut types = Vec::with_capacity(rest.len() + 1);
233+ types.push(Box::new(first));
234+ types.extend(rest.into_iter().map(Box::new));
235+ Ty::Tuple { types }
236+ },
237+ () => Ty::Tuple { types: vec![] },
207238};
208239
209240Lifetime: Lifetime = {
0 commit comments