diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-17 04:32:58 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-18 17:54:57 +0530 |
| commit | 084f3bcfd4e378d5c2b6daccda5c963c757c1bc5 (patch) | |
| tree | de68eb074135b3331abfa1e4f81e2ba5c69939dd /src/libsyntax | |
| parent | b08d5eee6a1bb3aaf7385c84b255be964caff9d1 (diff) | |
| download | rust-084f3bcfd4e378d5c2b6daccda5c963c757c1bc5.tar.gz rust-084f3bcfd4e378d5c2b6daccda5c963c757c1bc5.zip | |
ast: Document Lit
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 479ae40f0d6..a16cd8bfa19 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<Stmt_>; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] @@ -722,6 +723,7 @@ pub enum LocalSource { pub struct Local { pub pat: P<Pat>, pub ty: Option<P<Ty>>, + /// Initializer expression to set the value, if any pub init: Option<P<Expr>>, 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<Lit_>; #[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<Vec<u8>>), + /// 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), } |
