Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

Typos and small tweaks

+39 -26
+39 -26
erlang-generation/src/lib.rs
··· 293 293 294 294 /// Starts a `-record` attribute. 295 295 /// 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`. 297 297 /// 298 298 /// For example: 299 299 /// ··· 329 329 330 330 /// This starts a function type spec. 331 331 /// 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 333 333 /// function type. 334 334 /// 335 335 /// After that is complete, this has to be closed using `end_function_spec`. ··· 340 340 /// let spec = builder.start_function_spec("wibble", 1) 341 341 /// let function_type = builder.start_function_type(); 342 342 /// 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); 344 344 /// builder.variable_type("A"); 345 345 /// builder.end_function_type(function_type); 346 346 /// ``` ··· 393 393 /// This starts a function type. 394 394 /// Any code generated after this is gonna be an argument type of the open 395 395 /// 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 397 397 /// type, and then end the function. 398 398 /// 399 399 /// For example: ··· 419 419 /// This means that the next type that is generated is going to be the 420 420 /// return type of the open function type. 421 421 /// 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 423 423 /// type. 424 424 /// 425 425 fn end_function_type_arguments(&mut self, function_type: FunctionTypeArguments) ··· 438 438 /// For example: 439 439 /// 440 440 /// ```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_); 443 443 /// ``` 444 444 /// 445 445 /// Corresponds to: 446 446 /// 447 447 /// ```erl 448 - /// integer(). 448 + /// wibble(). 449 449 /// ``` 450 450 /// 451 451 fn start_named_type(&mut self, name: &str) -> NamedType; ··· 546 546 /// 547 547 fn type_variable(&mut self, name: &str); 548 548 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()`). 550 551 /// 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: 553 554 /// 554 555 /// ```ignore 555 556 /// let function = builder.start_function_type(); ··· 711 712 /// Corresponds to: 712 713 /// 713 714 /// ```erl 714 - /// { ~"Hello", 1 }. 715 + /// {~"Hello", 1}. 715 716 /// ``` 716 717 /// 717 718 fn start_tuple(&mut self) -> Tuple; ··· 847 848 /// 848 849 /// ```erl 849 850 /// [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"] 853 858 /// ``` 854 859 /// 855 860 fn cons_list(&mut self); ··· 904 909 /// `start_case` documentation. 905 910 fn start_case_clause(&mut self) -> ClausePattern; 906 911 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 908 913 /// clause guards and then call `end_clause_guards`. 909 914 /// If the clause you're generating has no guards you can immediately call 910 915 /// that function without generating anything inbetween. ··· 983 988 fn function_reference(&mut self, module: Option<ErlangModuleName>, name: &str, arity: usize); 984 989 985 990 /// 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 987 992 /// a pattern (the left-hand side of the assignment), and of an expression 988 993 /// (the right-hand side of the assignment). 989 994 /// ··· 1004 1009 fn match_operator(&mut self); 1005 1010 1006 1011 /// 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 1008 1013 /// a pattern (the left-hand side of the assignment), and of another pattern 1009 1014 /// (the right-hand side of the assignment). 1010 1015 /// ··· 1171 1176 /// 1172 1177 /// ```erl 1173 1178 /// [_ | [ ~"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"] 1178 1187 /// ``` 1179 1188 /// 1180 1189 fn cons_list_pattern(&mut self); ··· 1197 1206 /// 1198 1207 /// ```erl 1199 1208 /// ~"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>> 1203 1216 /// ``` 1204 1217 /// 1205 1218 fn string(&mut self, string: &str); ··· 1634 1647 1635 1648 /// How does pretty printing work? Here's a high level overview of how it works: 1636 1649 /// 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. 1638 1651 /// If I'm generating an integer (or any expression) I call `new_expression`; 1639 1652 /// if I'm generating a pattern I call `new_pattern`. 1640 1653 /// - The `new_x` functions make sure that we're allowed to generate that