Skip to content

Commit b4547e2

Browse files
committed
Typos and small tweaks
1 parent b4f9be9 commit b4547e2

1 file changed

Lines changed: 39 additions & 26 deletions

File tree

erlang-generation/src/lib.rs

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ pub trait ErlangBuilder<Output> {
293293

294294
/// Starts a `-record` attribute.
295295
/// After this you're supposed to generate a sequence of `record_field`, and
296-
/// once you're done you should end it with `edn_record_attribute`.
296+
/// once you're done you must end it with `end_record_attribute`.
297297
///
298298
/// For example:
299299
///
@@ -329,7 +329,7 @@ pub trait ErlangBuilder<Output> {
329329

330330
/// This starts a function type spec.
331331
/// Everything that is generated after this call is interpreted as the
332-
/// annotated type of the function. So this should be followed by a single
332+
/// annotated type of the function. So this must be followed by a single
333333
/// function type.
334334
///
335335
/// After that is complete, this has to be closed using `end_function_spec`.
@@ -340,7 +340,7 @@ pub trait ErlangBuilder<Output> {
340340
/// let spec = builder.start_function_spec("wibble", 1)
341341
/// let function_type = builder.start_function_type();
342342
/// builder.int_type();
343-
/// let function_type builder.end_function_type_arguments(function_type);
343+
/// let function_type = builder.end_function_type_arguments(function_type);
344344
/// builder.variable_type("A");
345345
/// builder.end_function_type(function_type);
346346
/// ```
@@ -393,7 +393,7 @@ pub trait ErlangBuilder<Output> {
393393
/// This starts a function type.
394394
/// Any code generated after this is gonna be an argument type of the open
395395
/// function type until `end_function_type_arguments` is called.
396-
/// After that you should generate a single type that's gonna be the return
396+
/// After that you must generate a single type that's gonna be the return
397397
/// type, and then end the function.
398398
///
399399
/// For example:
@@ -419,7 +419,7 @@ pub trait ErlangBuilder<Output> {
419419
/// This means that the next type that is generated is going to be the
420420
/// return type of the open function type.
421421
///
422-
/// After that you should call `end_function_type` to close the function
422+
/// After that you must call `end_function_type` to close the function
423423
/// type.
424424
///
425425
fn end_function_type_arguments(&mut self, function_type: FunctionTypeArguments)
@@ -438,14 +438,14 @@ pub trait ErlangBuilder<Output> {
438438
/// For example:
439439
///
440440
/// ```ignore
441-
/// let integer = builder.start_named_type("integer");
442-
/// builder.end_named_type(integer);
441+
/// let type_ = builder.start_named_type("wibble");
442+
/// builder.end_named_type(type_);
443443
/// ```
444444
///
445445
/// Corresponds to:
446446
///
447447
/// ```erl
448-
/// integer().
448+
/// wibble().
449449
/// ```
450450
///
451451
fn start_named_type(&mut self, name: &str) -> NamedType;
@@ -546,10 +546,11 @@ pub trait ErlangBuilder<Output> {
546546
///
547547
fn type_variable(&mut self, name: &str);
548548

549-
/// This generated the code for a literal atom type.
549+
/// This generated the code for a literal atom type (as opposed to the
550+
/// type `atom()`).
550551
///
551-
/// For example, the annotation of a function returning the atom `nil` is
552-
/// be defined like this:
552+
/// For example, the annotation of a function returning the atom `nil`
553+
/// is be defined like this:
553554
///
554555
/// ```ignore
555556
/// let function = builder.start_function_type();
@@ -711,7 +712,7 @@ pub trait ErlangBuilder<Output> {
711712
/// Corresponds to:
712713
///
713714
/// ```erl
714-
/// { ~"Hello", 1 }.
715+
/// {~"Hello", 1}.
715716
/// ```
716717
///
717718
fn start_tuple(&mut self) -> Tuple;
@@ -847,9 +848,13 @@ pub trait ErlangBuilder<Output> {
847848
///
848849
/// ```erl
849850
/// [Hello | [ ~"Giacomo" | []]].
850-
/// % Which, with some syntax sugar, is how we represent a list with two
851-
/// % elements:
852-
/// % [Hello, ~"Giacomo"]
851+
/// ```
852+
///
853+
/// Which, with some syntax sugar, is how we represent a list with two
854+
/// elements:
855+
///
856+
/// ```erl
857+
/// [Hello, ~"Giacomo"]
853858
/// ```
854859
///
855860
fn cons_list(&mut self);
@@ -904,7 +909,7 @@ pub trait ErlangBuilder<Output> {
904909
/// `start_case` documentation.
905910
fn start_case_clause(&mut self) -> ClausePattern;
906911

907-
/// This ends the case clause's pattern. After this you should generate the
912+
/// This ends the case clause's pattern. After this you must generate the
908913
/// clause guards and then call `end_clause_guards`.
909914
/// If the clause you're generating has no guards you can immediately call
910915
/// that function without generating anything inbetween.
@@ -983,7 +988,7 @@ pub trait ErlangBuilder<Output> {
983988
fn function_reference(&mut self, module: Option<ErlangModuleName>, name: &str, arity: usize);
984989

985990
/// This is used to create the code that corresponds to an assignment.
986-
/// A call to this function should always be followed by the generation of
991+
/// A call to this function must always be followed by the generation of
987992
/// a pattern (the left-hand side of the assignment), and of an expression
988993
/// (the right-hand side of the assignment).
989994
///
@@ -1004,7 +1009,7 @@ pub trait ErlangBuilder<Output> {
10041009
fn match_operator(&mut self);
10051010

10061011
/// This is used to create the code that corresponds to a match pattern.
1007-
/// A call to this function should always be followed by the generation of
1012+
/// A call to this function must always be followed by the generation of
10081013
/// a pattern (the left-hand side of the assignment), and of another pattern
10091014
/// (the right-hand side of the assignment).
10101015
///
@@ -1171,10 +1176,14 @@ pub trait ErlangBuilder<Output> {
11711176
///
11721177
/// ```erl
11731178
/// [_ | [ ~"Louis" | []]].
1174-
/// % Which, with some syntax sugar, is how we represent a pattern matching
1175-
/// % on a list with two elements, where the second element is the string
1176-
/// % ~"Louis":
1177-
/// % [_, ~"Louis"]
1179+
/// ```
1180+
///
1181+
/// Which, with some syntax sugar, is how we represent a pattern matching
1182+
/// on a list with two elements, where the second element is the string
1183+
/// `~"Louis"`:
1184+
///
1185+
/// ```erl
1186+
/// [_, ~"Louis"]
11781187
/// ```
11791188
///
11801189
fn cons_list_pattern(&mut self);
@@ -1197,9 +1206,13 @@ pub trait ErlangBuilder<Output> {
11971206
///
11981207
/// ```erl
11991208
/// ~"ksiąskę".
1200-
/// % Which is the same as <<"ksiąskę"/utf8>>
1201-
/// % Or the same as writing the bytes directly:
1202-
/// % <<107, 115, 105, 196, 133, 115, 107, 196, 153>>
1209+
/// ```
1210+
///
1211+
/// Which is the same as `<<"ksiąskę"/utf8>>`
1212+
/// Or the same as writing the bytes directly:
1213+
///
1214+
/// ```erl
1215+
/// <<107, 115, 105, 196, 133, 115, 107, 196, 153>>
12031216
/// ```
12041217
///
12051218
fn string(&mut self, string: &str);
@@ -1634,7 +1647,7 @@ static UNICODE_ESCAPE_SEQUENCE_PATTERN: OnceLock<Regex> = OnceLock::new();
16341647

16351648
/// How does pretty printing work? Here's a high level overview of how it works:
16361649
///
1637-
/// - when a new element is generated we call the `new_x` method.
1650+
/// - When a new element is generated we call the `new_x` method.
16381651
/// If I'm generating an integer (or any expression) I call `new_expression`;
16391652
/// if I'm generating a pattern I call `new_pattern`.
16401653
/// - The `new_x` functions make sure that we're allowed to generate that

0 commit comments

Comments
 (0)