Skip to content

Commit 084f3bc

Browse files
committed
ast: Document Lit
1 parent b08d5ee commit 084f3bc

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/libsyntax/ast.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ pub enum UnOp {
678678
UnNeg
679679
}
680680

681+
/// A statement
681682
pub type Stmt = Spanned<Stmt_>;
682683

683684
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
@@ -722,6 +723,7 @@ pub enum LocalSource {
722723
pub struct Local {
723724
pub pat: P<Pat>,
724725
pub ty: Option<P<Ty>>,
726+
/// Initializer expression to set the value, if any
725727
pub init: Option<P<Expr>>,
726728
pub id: NodeId,
727729
pub span: Span,
@@ -768,6 +770,7 @@ pub enum UnsafeSource {
768770
UserProvided,
769771
}
770772

773+
/// An expression
771774
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
772775
pub struct Expr {
773776
pub id: NodeId,
@@ -981,7 +984,6 @@ pub enum KleeneOp {
981984
/// The RHS of an MBE macro is the only place `SubstNt`s are substituted.
982985
/// Nothing special happens to misnamed or misplaced `SubstNt`s.
983986
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
984-
#[doc="For macro invocations; parsing is delegated to the macro"]
985987
pub enum TokenTree {
986988
/// A single token
987989
TtToken(Span, token::Token),
@@ -1092,10 +1094,14 @@ pub enum Mac_ {
10921094

10931095
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
10941096
pub enum StrStyle {
1097+
/// A regular string, like `"fooo"`
10951098
CookedStr,
1099+
/// A raw string, like `r##"foo"##`
1100+
/// The uint is the number of `#` symbols used
10961101
RawStr(usize)
10971102
}
10981103

1104+
/// A literal
10991105
pub type Lit = Spanned<Lit_>;
11001106

11011107
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
@@ -1133,13 +1139,21 @@ impl LitIntType {
11331139

11341140
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
11351141
pub enum Lit_ {
1142+
/// A string literal (`"foo"`)
11361143
LitStr(InternedString, StrStyle),
1144+
/// A byte string (`b"foo"`)
11371145
LitBinary(Rc<Vec<u8>>),
1146+
/// A byte char (`b'f'`)
11381147
LitByte(u8),
1148+
/// A character literal (`'a'`)
11391149
LitChar(char),
1150+
/// An integer liteal (`1u8`)
11401151
LitInt(u64, LitIntType),
1152+
/// A float literal (`1f64` or `1E10f64`)
11411153
LitFloat(InternedString, FloatTy),
1154+
/// A float literal without a suffix (`1.0 or 1.0E10`)
11421155
LitFloatUnsuffixed(InternedString),
1156+
/// A boolean literal
11431157
LitBool(bool),
11441158
}
11451159

0 commit comments

Comments
 (0)