@@ -2,19 +2,19 @@ use crate::{ast::AstIndex, constant_pool::ConstantIndex, StringFormatOptions, St
22use smallvec:: SmallVec ;
33use std:: fmt;
44
5- /// The vec type used in the AST
5+ /// The Vec type used in the AST
66//
7- // Q. Why 4 elements in the small vec ?
7+ // Q. Why 4 elements in the small Vec ?
88// A. It's the maximum number of elements that can be used in [Node] without increasing its overall
99// size.
1010pub type AstVec < T > = SmallVec < [ T ; 4 ] > ;
1111
12- /// A convenience macro for initializing [ AstVec]s
12+ /// A convenience macro for initializing an [` AstVec`]
1313pub use smallvec:: smallvec as astvec;
1414
1515/// A parsed node that can be included in the [AST](crate::Ast).
1616///
17- /// Nodes refer to each other via [AstIndex]s , see [AstNode](crate::AstNode).
17+ /// Nodes refer to each other via [` AstIndex`] , see [` AstNode` ](crate::AstNode).
1818#[ derive( Clone , Debug , Default , PartialEq , Eq , derive_name:: VariantName ) ]
1919pub enum Node {
2020 /// The `null` keyword
@@ -24,14 +24,14 @@ pub enum Node {
2424 /// A single expression wrapped in parentheses
2525 Nested ( AstIndex ) ,
2626
27- /// An identifer , and optionally the type hint node
27+ /// An identifier , and optionally the type hint node
2828 Id ( ConstantIndex , Option < AstIndex > ) ,
2929
3030 /// A meta identifier, e.g. `@display` or `@test my_test`
3131 Meta ( MetaKeyId , Option < ConstantIndex > ) ,
3232
3333 /// A chained expression, and optionally the node that follows it in the chain
34- Chain ( ( ChainNode , Option < AstIndex > ) ) , // chain node, next node
34+ Chain ( ( ChainNode , Option < AstIndex > ) ) , // Chain node, next node
3535
3636 /// The `true` keyword
3737 BoolTrue ,
@@ -53,12 +53,12 @@ pub enum Node {
5353
5454 /// A list literal
5555 ///
56- /// e .g. `[foo, bar, 42]`
56+ /// E .g. `[foo, bar, 42]`
5757 List ( AstVec < AstIndex > ) ,
5858
5959 /// A tuple literal
6060 ///
61- /// e .g. `(foo, bar, 42)`
61+ /// E .g. `(foo, bar, 42)`
6262 ///
6363 /// Note that this is also used for implicit tuples, e.g. in `x = 1, 2, 3`
6464 Tuple ( AstVec < AstIndex > ) ,
@@ -78,8 +78,8 @@ pub enum Node {
7878 end : AstIndex ,
7979 /// Whether or not the end of the range includes the end value itself
8080 ///
81- /// e .g. `1..10` - a range from 1 up to but not including 10
82- /// e .g. `1..=10` - a range from 1 up to and including 10
81+ /// E .g. `1..10` - a range from 1 up to but not including 10
82+ /// E .g. `1..=10` - a range from 1 up to and including 10
8383 inclusive : bool ,
8484 } ,
8585
@@ -128,15 +128,15 @@ pub enum Node {
128128 /// A block node
129129 ///
130130 /// Used for indented blocks that share the context of the frame they're in,
131- /// e.g. if expressions, arms in match or switch experssions , loop bodies
131+ /// e.g. if expressions, arms in match or switch expressions , loop bodies.
132132 Block ( AstVec < AstIndex > ) ,
133133
134134 /// A function node
135135 Function ( Function ) ,
136136
137137 /// An import expression
138138 ///
139- /// e .g. `from foo.bar import baz, 'qux'
139+ /// E .g. `from foo.bar import baz, 'qux'`
140140 Import {
141141 /// Where the items should be imported from
142142 ///
@@ -163,7 +163,7 @@ pub enum Node {
163163
164164 /// A multiple-assignment expression
165165 ///
166- /// e .g. `x, y = foo()`, or `foo, bar, baz = 1, 2, 3`
166+ /// E .g. `x, y = foo()`, or `foo, bar, baz = 1, 2, 3`
167167 MultiAssign {
168168 /// The targets of the assignment
169169 targets : AstVec < AstIndex > ,
@@ -269,7 +269,7 @@ pub enum Node {
269269
270270 /// A type hint
271271 ///
272- /// e .g. `let x: Number = 0`
272+ /// E .g. `let x: Number = 0`
273273 /// ^~~ This is the beginning of the type hint
274274 Type ( ConstantIndex ) ,
275275}
0 commit comments