From 084f3bcfd4e378d5c2b6daccda5c963c757c1bc5 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 17 Mar 2015 04:32:58 +0530 Subject: [PATCH] ast: Document Lit --- src/libsyntax/ast.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 479ae40f0d6a..a16cd8bfa19f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -678,6 +678,7 @@ pub enum UnOp { UnNeg } +/// A statement pub type Stmt = Spanned; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] @@ -722,6 +723,7 @@ pub enum LocalSource { pub struct Local { pub pat: P, pub ty: Option>, + /// Initializer expression to set the value, if any pub init: Option>, pub id: NodeId, pub span: Span, @@ -768,6 +770,7 @@ pub enum UnsafeSource { UserProvided, } +/// An expression #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Expr { pub id: NodeId, @@ -981,7 +984,6 @@ pub enum KleeneOp { /// The RHS of an MBE macro is the only place `SubstNt`s are substituted. /// Nothing special happens to misnamed or misplaced `SubstNt`s. #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] -#[doc="For macro invocations; parsing is delegated to the macro"] pub enum TokenTree { /// A single token TtToken(Span, token::Token), @@ -1092,10 +1094,14 @@ pub enum Mac_ { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum StrStyle { + /// A regular string, like `"fooo"` CookedStr, + /// A raw string, like `r##"foo"##` + /// The uint is the number of `#` symbols used RawStr(usize) } +/// A literal pub type Lit = Spanned; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] @@ -1133,13 +1139,21 @@ impl LitIntType { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Lit_ { + /// A string literal (`"foo"`) LitStr(InternedString, StrStyle), + /// A byte string (`b"foo"`) LitBinary(Rc>), + /// A byte char (`b'f'`) LitByte(u8), + /// A character literal (`'a'`) LitChar(char), + /// An integer liteal (`1u8`) LitInt(u64, LitIntType), + /// A float literal (`1f64` or `1E10f64`) LitFloat(InternedString, FloatTy), + /// A float literal without a suffix (`1.0 or 1.0E10`) LitFloatUnsuffixed(InternedString), + /// A boolean literal LitBool(bool), }