Skip to content

Commit 62bf2c0

Browse files
Sijaasterite
authored andcommittedJun 11, 2017
Enclose types in backticks and italicize argument names
1 parent 96e7222 commit 62bf2c0

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed
 

‎src/compiler/crystal/macros.cr

+34-34
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The Macros module is a fictitious module used to document macros
1+
# The `Macros` module is a fictitious module used to document macros
22
# and macro methods.
33
#
44
# You can invoke a **fixed subset** of methods on AST nodes at compile-time. These methods
@@ -44,7 +44,7 @@ module Crystal::Macros
4444
def system(command) : MacroId
4545
end
4646

47-
# Gives a compile-time error with the given message.
47+
# Gives a compile-time error with the given *message*.
4848
def raise(message) : NoReturn
4949
end
5050

@@ -133,7 +133,7 @@ module Crystal::Macros
133133
end
134134

135135
# Returns a `StringLiteral` that contains this node's textual representation.
136-
# Note that invoking stringify on a string literal will return a StringLiteral
136+
# Note that invoking stringify on a string literal will return a `StringLiteral`
137137
# that contains a string literal.
138138
#
139139
# ```
@@ -159,49 +159,49 @@ module Crystal::Macros
159159
end
160160

161161
# Returns the filename where this node is located.
162-
# Might return nil if the location is not known.
162+
# Might return `nil` if the location is not known.
163163
def filename : StringLiteral | NilLiteral
164164
end
165165

166166
# Returns the line number where this node begins.
167-
# Might return nil if the location is not known.
167+
# Might return `nil` if the location is not known.
168168
#
169169
# The first line number in a file is 1.
170170
def line_number : StringLiteral | NilLiteral
171171
end
172172

173173
# Returns the column number where this node begins.
174-
# Might return nil if the location is not known.
174+
# Might return `nil` if the location is not known.
175175
#
176-
# The first column number in a line is 1.
176+
# The first column number in a line is `1`.
177177
def column_number : StringLiteral | NilLiteral
178178
end
179179

180180
# Returns the line number where this node ends.
181-
# Might return nil if the location is not known.
181+
# Might return `nil` if the location is not known.
182182
#
183-
# The first line number in a file is 1.
183+
# The first line number in a file is `1`.
184184
def end_line_number : StringLiteral | NilLiteral
185185
end
186186

187187
# Returns the column number where this node ends.
188-
# Might return nil if the location is not known.
188+
# Might return `nil` if the location is not known.
189189
#
190-
# The first column number in a line is 1.
190+
# The first column number in a line is `1`.
191191
def end_column_number : StringLiteral | NilLiteral
192192
end
193193

194-
# Returns true if this node's textual representation is the same as
195-
# the other node.
194+
# Returns `true` if this node's textual representation is the same as
195+
# the *other* node.
196196
def ==(other : ASTNode) : BoolLiteral
197197
end
198198

199-
# Returns true if this node's textual representation is not the same as
200-
# the other node.
199+
# Returns `true` if this node's textual representation is not the same as
200+
# the *other* node.
201201
def !=(other : ASTNode) : BoolLiteral
202202
end
203203

204-
# Gives a compile-time error with the given message. This will
204+
# Gives a compile-time error with the given *message*. This will
205205
# highlight this node in the error message.
206206
def raise(message) : NoReturn
207207
end
@@ -535,7 +535,7 @@ module Crystal::Macros
535535
def find(&block) : ASTNode | NilLiteral
536536
end
537537

538-
# Similar to `Array#first`, but returns a NilLiteral if the array is empty.
538+
# Similar to `Array#first`, but returns a `NilLiteral` if the array is empty.
539539
def first : ASTNode | NilLiteral
540540
end
541541

@@ -547,7 +547,7 @@ module Crystal::Macros
547547
def join(separator) : StringLiteral
548548
end
549549

550-
# Similar to `Array#last`, but returns a NilLiteral if the array is empty.
550+
# Similar to `Array#last`, but returns a `NilLiteral` if the array is empty.
551551
def last : ASTNode | NilLiteral
552552
end
553553

@@ -738,7 +738,7 @@ module Crystal::Macros
738738
end
739739

740740
# Similar to `Regex#options`,
741-
# but returns an array of symbols such as [:i, :m, :x]
741+
# but returns an array of symbols such as `[:i, :m, :x]`
742742
def options : ArrayLiteral(SymbolLiteral)
743743
end
744744
end
@@ -838,11 +838,11 @@ module Crystal::Macros
838838
def cond : ASTNode
839839
end
840840

841-
# Returns this if's "then" clause's body.
841+
# Returns this if's `then` clause's body.
842842
def then : ASTNode
843843
end
844844

845-
# Returns this if's "else" clause's body.
845+
# Returns this if's `else` clause's body.
846846
def else : ASTNode
847847
end
848848
end
@@ -927,13 +927,13 @@ module Crystal::Macros
927927
class Arg < ASTNode
928928
# Returns the external name of this argument.
929929
#
930-
# For example, for `def write(to file)` this returns "to".
930+
# For example, for `def write(to file)` returns `to`.
931931
def name : MacroId
932932
end
933933

934934
# Returns the internal name of this argument.
935935
#
936-
# For example, for `def write(to file)` this returns "file".
936+
# For example, for `def write(to file)` returns `file`.
937937
def internal_name : MacroId
938938
end
939939

@@ -1027,7 +1027,7 @@ module Crystal::Macros
10271027
end
10281028
end
10291029

1030-
# An unary "not" (`!`).
1030+
# An unary `not` (`!`).
10311031
class Not < UnaryExpression
10321032
end
10331033

@@ -1131,7 +1131,7 @@ module Crystal::Macros
11311131
def names : ArrayLiteral(MacroId)
11321132
end
11331133

1134-
# Returns true if this is a global path (starts with `::`)
1134+
# Returns `true` if this is a global path (starts with `::`)
11351135
def global? : BoolLiteral
11361136
end
11371137

@@ -1346,7 +1346,7 @@ module Crystal::Macros
13461346
# A fictitious node representing an idenfitifer like, `foo`, `Bar` or `something_else`.
13471347
#
13481348
# The parser doesn't create this nodes. Instead, you create them by invoking `id`
1349-
# on some nodes. For example, invoking `id` on a `StringLiteral` returns a MacroId
1349+
# on some nodes. For example, invoking `id` on a `StringLiteral` returns a `MacroId`
13501350
# for the string's content. Similarly, invoking ID on a `SymbolLiteral`, `Call`, `Var` and `Path`
13511351
# return MacroIds for the node's content.
13521352
#
@@ -1474,11 +1474,11 @@ module Crystal::Macros
14741474

14751475
# Represents a type in the program, like `Int32` or `String`.
14761476
class TypeNode < ASTNode
1477-
# Returns true if this type is abstract.
1477+
# Returns `true` if this type is abstract.
14781478
def abstract? : BoolLiteral
14791479
end
14801480

1481-
# Returns true if this type is a union type, false otherwise.
1481+
# Returns `true` if this type is a union type, `false` otherwise.
14821482
#
14831483
# See also: `union_types`.
14841484
def union? : BoolLiteral
@@ -1527,13 +1527,13 @@ module Crystal::Macros
15271527
# Returns a constant defined in this type.
15281528
#
15291529
# If the constant is a constant (like `A = 1`), then its value
1530-
# as an ASTNode is returned. If the constant is a type, the
1530+
# as an `ASTNode` is returned. If the constant is a type, the
15311531
# type is returned as a `TypeNode`. Otherwise, `NilLiteral` is returned.
15321532
def constant(name : StringLiteral | SymbolLiteral | MacroId) : ASTNode
15331533
end
15341534

1535-
# Returns true if this type has a constant. For example `DEFAULT_OPTIONS`
1536-
# (the name you pass to this method is "DEFAULT_OPTIONS" or :DEFAULT_OPTIONS
1535+
# Returns `true` if this type has a constant. For example `DEFAULT_OPTIONS`
1536+
# (the name you pass to this method is `"DEFAULT_OPTIONS"` or `:DEFAULT_OPTIONS`
15371537
# in this cases).
15381538
def has_constant?(name : StringLiteral | SymbolLiteral) : BoolLiteral
15391539
end
@@ -1544,13 +1544,13 @@ module Crystal::Macros
15441544
end
15451545

15461546
# Returns `true` if this type has a method. For example `default_options`
1547-
# (the name you pass to this method is "default_options" or :default_options
1547+
# (the name you pass to this method is `"default_options"` or `:default_options`
15481548
# in this cases).
15491549
def has_method?(name : StringLiteral | SymbolLiteral) : BoolLiteral
15501550
end
15511551

1552-
# Returns true if this type has an attribute. For example `@[Flags]`
1553-
# or `@[Packed]` (the name you pass to this method is "Flags" or "Packed"
1552+
# Returns `true` if this type has an attribute. For example `@[Flags]`
1553+
# or `@[Packed]` (the name you pass to this method is `"Flags"` or `"Packed"`
15541554
# in these cases).
15551555
def has_attribute?(name : StringLiteral | SymbolLiteral) : BoolLiteral
15561556
end

0 commit comments

Comments
 (0)
Please sign in to comment.