Skip to content

Commit

Permalink
Update annotated.jl docstrings according to JuliaLang#55741 (JuliaLan…
Browse files Browse the repository at this point in the history
…g#56736)

Annotations now use a NamedTuple
  • Loading branch information
danielwe authored Dec 3, 2024
1 parent 9acf112 commit 2590e67
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions base/strings/annotated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ like [`string`](@ref) but preserves any annotations present in the arguments.
# Examples
```julia-repl
```jldoctest; setup=:(using Base: AnnotatedString)
julia> AnnotatedString("this is an example annotated string",
[(1:18, :A => 1), (12:28, :B => 2), (18:35, :C => 3)])
[(1:18, :A, 1), (12:28, :B, 2), (18:35, :C, 3)])
"this is an example annotated string"
```
"""
Expand Down Expand Up @@ -87,8 +87,8 @@ AnnotatedChar(s::S, annotations::Vector{$Annotation})
# Examples
```julia-repl
julia> AnnotatedChar('j', :label => 1)
```jldoctest; setup=:(using Base: AnnotatedChar)
julia> AnnotatedChar('j', [(:label, 1)])
'j': ASCII/Unicode U+006A (category Ll: Letter, lowercase)
```
"""
Expand Down Expand Up @@ -232,11 +232,11 @@ See also [`AnnotatedString`](@ref) and [`AnnotatedChar`](@ref).
## Examples
```julia-repl
```jldoctest; setup=:(using Base: AnnotatedString, annotatedstring)
julia> annotatedstring("now a AnnotatedString")
"now a AnnotatedString"
julia> annotatedstring(AnnotatedString("annotated", [(1:9, :label => 1)]), ", and unannotated")
julia> annotatedstring(AnnotatedString("annotated", [(1:9, :label, 1)]), ", and unannotated")
"annotated, and unannotated"
```
"""
Expand Down Expand Up @@ -344,7 +344,7 @@ end
annotate!(str::AnnotatedString, [range::UnitRange{Int}], label::Symbol, value)
annotate!(str::SubString{AnnotatedString}, [range::UnitRange{Int}], label::Symbol, value)
Annotate a `range` of `str` (or the entire string) with a labeled value (`label` => `value`).
Annotate a `range` of `str` (or the entire string) with a labeled value `(label, value)`.
To remove existing `label` annotations, use a value of `nothing`.
The order in which annotations are applied to `str` is semantically meaningful,
Expand All @@ -365,7 +365,7 @@ annotate!(s::SubString{<:AnnotatedString}, label::Symbol, @nospecialize(val::Any
"""
annotate!(char::AnnotatedChar, label::Symbol, value::Any)
Annotate `char` with the pair `label => value`.
Annotate `char` with the labeled value `(label, value)`.
"""
annotate!(c::AnnotatedChar, label::Symbol, @nospecialize(val::Any)) =
(push!(c.annotations, Annotation((; label, val))); c)
Expand Down

0 comments on commit 2590e67

Please sign in to comment.