Skip to content

Commit

Permalink
Fixs for docs build
Browse files Browse the repository at this point in the history
  • Loading branch information
c42f committed Mar 17, 2023
1 parent 0094fa0 commit ef42ebf
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 38 deletions.
20 changes: 10 additions & 10 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.3"

[[JuliaSyntax]]
git-tree-sha1 = "db2bdeda30e452485863799be4515f6305431a46"
git-tree-sha1 = "5f0b864db9e8d7c109eba0fe7d306a108fda5056"
uuid = "70703baa-626e-46a2-a12c-08ffd08c73b4"
version = "0.3.2"
version = "0.3.3"

[[LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
Expand Down Expand Up @@ -109,14 +109,14 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.28.2+0"
version = "2.28.0+0"

[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2022.10.11"
version = "2022.2.1"

[[NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
Expand All @@ -126,7 +126,7 @@ version = "1.2.0"
deps = ["Crayons", "JLFzf", "JuliaSyntax", "Markdown", "Pkg", "Printf", "REPL"]
path = ".."
uuid = "5fb14364-9ced-5910-84b2-373655c76a03"
version = "0.5.17"
version = "0.5.18"

[[Parsers]]
deps = ["Dates", "SnoopPrecompile"]
Expand All @@ -140,9 +140,9 @@ uuid = "b98c9c47-44ae-5843-9183-064241ee97a0"
version = "1.3.0"

[[Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.9.0"
version = "1.8.0"

[[Preferences]]
deps = ["TOML"]
Expand Down Expand Up @@ -181,12 +181,12 @@ uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[TOML]]
deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
version = "1.0.3"
version = "1.0.0"

[[Tar]]
deps = ["ArgTools", "SHA"]
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
version = "1.10.0"
version = "1.10.1"

[[Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
Expand All @@ -202,7 +202,7 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
[[Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
version = "1.2.13+0"
version = "1.2.12+3"

[[fzf_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
Expand Down
57 changes: 29 additions & 28 deletions docs/src/internals/passes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Passes

In `OhMyREPL` each plugin that changes the way text is printed to the REPL is implemented as a **pass**. A **pass** is defined as a function (or a call overloaded type) that takes a list of Julia tokens from [`Tokenize.jl`](https://github.com/KristofferC/Tokenize.jl), a list of `Crayon`s from [`Crayons.jl`](https://github.com/KristofferC/Crayons.jl), the position of the cursor and sets the `Crayon`s to however the pass wants the Julia tokens to be printed. Both the [Syntax highlighting](@ref) and the [Bracket highlighting](@ref) are implemented as passses.
In `OhMyREPL` each plugin that changes the way text is printed to the REPL is implemented as a **pass**. A **pass** is defined as a function (or a call overloaded type) that takes a list of Julia tokens from [`JuliaSyntax.jl`](https://github.com/JuliaLang/JuliaSyntax.jl), a list of `Crayon`s from [`Crayons.jl`](https://github.com/KristofferC/Crayons.jl), the position of the cursor and sets the `Crayon`s to however the pass wants the Julia tokens to be printed. Both the [Syntax highlighting](@ref) and the [Bracket highlighting](@ref) are implemented as passses.

All the passes are registered in a global pass handler. To show all the passes use `OhMyREPL.showpasses()`:

Expand All @@ -26,33 +26,34 @@ This section shows how text from the REPL get transformed into syntax highlighte
str = "function f(x::Float64) return :x + 'a' end"
```

First the text is tokenized with [`Tokenize.jl`](https://github.com/KristofferC/Tokenize.jl):
First the text is tokenized with [`JuliaSyntax.jl`](https://github.com/JuliaLang/JuliaSyntax.jl):

```jl
julia> using Tokenize

julia> tokens = collect(Tokenize.tokenize(str))
20-element Array{Tokenize.Tokens.Token,1}:
1,1-1,8: KEYWORD "function"
1,9-1,9: WHITESPACE " "
1,10-1,10: IDENTIFIER "f"
1,11-1,11: LPAREN "("
1,12-1,12: IDENTIFIER "x"
1,13-1,14: OP "::"
1,15-1,21: IDENTIFIER "Float64"
1,22-1,22: RPAREN ")"
1,23-1,23: WHITESPACE " "
1,24-1,29: KEYWORD "return"
1,30-1,30: WHITESPACE " "
1,31-1,31: OP ":"
1,32-1,32: IDENTIFIER "x"
1,33-1,33: WHITESPACE " "
1,34-1,34: OP "+"
1,35-1,35: WHITESPACE " "
1,36-1,38: CHAR "'a'"
1,39-1,39: WHITESPACE " "
1,40-1,42: KEYWORD "end"
1,43-1,42: ENDMARKER ""
julia> using JuliaSyntax

julia> tokens = JuliaSyntax.tokenize(str)
21-element Vector{JuliaSyntax.Token}:
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"function", 0x0001), 0x00000001:0x00000008)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x00000009:0x00000009)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Identifier", 0x0000), 0x0000000a:0x0000000a)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"(", 0x0001), 0x0000000b:0x0000000b)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Identifier", 0x0000), 0x0000000c:0x0000000c)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"::", 0x0001), 0x0000000d:0x0000000e)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Identifier", 0x0000), 0x0000000f:0x00000015)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K")", 0x0001), 0x00000016:0x00000016)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x00000017:0x00000017)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"return", 0x0001), 0x00000018:0x0000001d)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x0000001e:0x0000001e)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K":", 0x0001), 0x0000001f:0x0000001f)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Identifier", 0x0000), 0x00000020:0x00000020)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x00000021:0x00000021)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"+", 0x0000), 0x00000022:0x00000022)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x00000023:0x00000023)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"'", 0x0001), 0x00000024:0x00000024)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Char", 0x0000), 0x00000025:0x00000025)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"'", 0x0001), 0x00000026:0x00000026)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x00000027:0x00000027)
JuliaSyntax.Token(JuliaSyntax.SyntaxHead(K"end", 0x0001), 0x00000028:0x0000002a)
```

A vector of `Crayon`s of the same length as the Julia tokens is then created and filled with empty tokens.
Expand Down Expand Up @@ -83,14 +84,14 @@ Each registered and enabled pass does this updating and the contributions from e
This section shows how to create a pass that let the user define a `Crayon` for each typeassertion / declaration that happens to be a `Float64`.

!!! info
Please refer to the [Tokenize.jl API](https://github.com/KristofferC/Tokenize.jl#api) section and the [`Crayons.jl` documentation](https://github.com/KristofferC/Crayons.jl) while reading this section.
Please refer to the [JuliaSyntax.jl API](https://github.com/JuliaLang/JuliaSyntax.jl) and the [`Crayons.jl` documentation](https://github.com/KristofferC/Crayons.jl) while reading this section.

We start off with a few imports and creating a new struct which will hold the setting for the pass:

```jl
using Crayons
import JuliaSyntax
import JuliaSyntax.Tokenize: Token, untokenize, kind
import JuliaSyntax: Token, untokenize, kind
using OhMyREPL

mutable struct Float64Modifier
Expand Down

0 comments on commit ef42ebf

Please sign in to comment.