Skip to content

Commit c5e4c03

Browse files
authored
Minor fixes for whitespace and typos for migration to the main Julia tree (#603)
* Fix whitespace using Julia contrib/check-whitespace.jl * Fix typos as detected by the rust "typos" tool
1 parent 99e975a commit c5e4c03

File tree

15 files changed

+18
-29
lines changed

15 files changed

+18
-29
lines changed

LICENSE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,3 @@ package and is also licensed under the MIT "Expat" License:
4343
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4444
> SOFTWARE.
4545
>
46-

docs/src/design.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,4 +848,3 @@ indentation from the syntax tree? Source formatting involves a big pile of
848848
heuristics to get something which "looks nice"... and ML systems have become
849849
very good at heuristics. Also, we've got huge piles of training data — just
850850
choose some high quality, tastefully hand-formatted libraries.
851-

docs/src/howto.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,3 @@ To reduce startup latency you can combine with a custom system as described in
3535
the [Julia VScode docs](https://www.julia-vscode.org/docs/dev/userguide/compilesysimage/#Creating-a-sysimage-for-the-active-environment),
3636
combined with the precompile execution file in `sysimage/precompile_exec.jl` in the source tree.
3737
For additional detail see the discussion in [issue #128](https://github.com/JuliaLang/JuliaSyntax.jl/issues/128).
38-

docs/src/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,3 @@ Julia `Expr` can also be produced:
7777
julia> JuliaSyntax.parsestmt(Expr, "(x + y)*z")
7878
:((x + y) * z)
7979
```
80-

docs/src/reference.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class of tokenization errors and lets the parser deal with them.
8080
* We use flags rather than child nodes to represent the difference between `struct` and `mutable struct`, `module` and `baremodule` (#220)
8181
* Iterations are represented with the `iteration` and `in` heads rather than `=` within the header of a `for`. Thus `for i=is ; body end` parses to `(for (iteration (in i is)) (block body))`. Cartesian iteration as in `for a=as, b=bs body end` are represented with a nested `(iteration (in a as) (in b bs))` rather than a `block` containing `=` because these lists of iterators are neither semantically nor syntactically a sequence of statements, unlike other uses of `block`. Generators also use the `iteration` head - see information on that below.
8282
* Short form functions like `f(x) = x + 1` are represented with the `function` head rather than the `=` head. In this case the `SHORT_FORM_FUNCTION_FLAG` flag is set to allow the surface syntactic form to be easily distinguished from long form functions.
83-
* All kinds of updating assignment operators like `+=` are represented with a single `K"op="` head, with the operator itself in infix position. For example, `x += 1` is `(op= x + 1)`, where the plus token is of kind `K"Identifer"`. This greatly reduces the number of distinct forms here from a rather big list (`$=` `%=` `&=` `*=` `+=` `-=` `//=` `/=` `<<=` `>>=` `>>>=` `\=` `^=` `|=` `÷=` `⊻=`) and makes the operator itself appear in the AST as kind `K"Identifier"`, as it should. It also makes it possible to add further unicode updating operators while keeping the AST stable.
83+
* All kinds of updating assignment operators like `+=` are represented with a single `K"op="` head, with the operator itself in infix position. For example, `x += 1` is `(op= x + 1)`, where the plus token is of kind `K"Identifier"`. This greatly reduces the number of distinct forms here from a rather big list (`$=` `%=` `&=` `*=` `+=` `-=` `//=` `/=` `<<=` `>>=` `>>>=` `\=` `^=` `|=` `÷=` `⊻=`) and makes the operator itself appear in the AST as kind `K"Identifier"`, as it should. It also makes it possible to add further unicode updating operators while keeping the AST stable.
8484

8585
## More detail on tree differences
8686

@@ -324,4 +324,3 @@ Expr(:ncat)
324324
│ └─ :d
325325
└─ :x
326326
```
327-

src/core/parse_stream.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ mutable struct ParseStream
269269
lexer = Tokenize.Lexer(io)
270270
# To avoid keeping track of the exact Julia development version where new
271271
# features were added or comparing prerelease strings, we treat prereleases
272-
# or dev versons as the release version using only major and minor version
272+
# or dev versions as the release version using only major and minor version
273273
# numbers. This means we're inexact for old dev versions but that seems
274274
# like an acceptable tradeoff.
275275
ver = (version.major, version.minor)

src/julia/literal_parsing.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,4 +471,3 @@ function lower_identifier_name(name::Symbol, k::Kind)
471471
Symbol(lower_identifier_name(string(name), k))
472472
end
473473
end
474-

src/julia/parser.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ function parse_decl_with_initial_ex(ps::ParseState, mark)
14181418
# (x) -> y
14191419
# (x; a=1) -> y
14201420
elseif kb == K"where"
1421-
# `where` and `->` have the "wrong" precedence when writing anon functons.
1421+
# `where` and `->` have the "wrong" precedence when writing anon functions.
14221422
# So ignore this case to allow use of grouping brackets with `where`.
14231423
# This needs to worked around in lowering :-(
14241424
# (x where T) -> y ==> (-> (x where T) y)

sysimage/compile.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ PackageCompiler.create_sysimage(
4545
4646
Use it with `julia -J "$image_path"`
4747
"""
48-

test/diagnostics.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ end
3434
end
3535

3636
@testset "parser errors" begin
37-
@test diagnostic("+ #==# (a,b)") ==
37+
@test diagnostic("+ #==# (a,b)") ==
3838
Diagnostic(2, 7, :error, "whitespace not allowed between prefix function call and argument list")
3939
@test diagnostic("1 -+ (a=1, b=2)") ==
4040
Diagnostic(5, 5, :error, "whitespace not allowed between prefix function call and argument list")
@@ -44,18 +44,18 @@ end
4444
@test diagnostic("function (\$f) body end") ==
4545
Diagnostic(10, 13, :error, "Ambiguous signature. Add a trailing comma if this is a 1-argument anonymous function; remove parentheses if this is a macro call acting as function signature.")
4646

47-
@test diagnostic("[email protected]", only_first=true) ==
47+
@test diagnostic("[email protected]", only_first=true) ==
4848
Diagnostic(3, 4, :error, "`@` must appear on first or last macro name component")
49-
@test diagnostic("@M.(x)") ==
49+
@test diagnostic("@M.(x)") ==
5050
Diagnostic(1, 3, :error, "dot call syntax not supported for macros")
5151

52-
@test diagnostic("try x end") ==
52+
@test diagnostic("try x end") ==
5353
Diagnostic(1, 9, :error, "try without catch or finally")
5454
# TODO: better range
55-
@test diagnostic("@A.\$x a") ==
55+
@test diagnostic("@A.\$x a") ==
5656
Diagnostic(4, 5, :error, "invalid macro name")
5757

58-
@test diagnostic("a, , b") ==
58+
@test diagnostic("a, , b") ==
5959
Diagnostic(4, 4, :error, "unexpected `,`")
6060
@test diagnostic(")", allow_multiple=true) == [
6161
Diagnostic(1, 1, :error, "unexpected `)`")
@@ -118,15 +118,15 @@ end
118118
end
119119

120120
@testset "parser warnings" begin
121-
@test diagnostic("@(A)", only_first=true) ==
121+
@test diagnostic("@(A)", only_first=true) ==
122122
Diagnostic(2, 4, :warning, "parenthesizing macro names is unnecessary")
123-
@test diagnostic("try finally catch a ; b end") ==
123+
@test diagnostic("try finally catch a ; b end") ==
124124
Diagnostic(13, 23, :warning, "`catch` after `finally` will execute out of order")
125-
@test diagnostic("import . .A") ==
125+
@test diagnostic("import . .A") ==
126126
Diagnostic(9, 10, :warning, "space between dots in import path")
127-
@test diagnostic("import A .==") ==
127+
@test diagnostic("import A .==") ==
128128
Diagnostic(9, 9, :warning, "space between dots in import path")
129-
@test diagnostic("import A.:+") ==
129+
@test diagnostic("import A.:+") ==
130130
Diagnostic(10, 10, :warning, "quoting with `:` is not required here")
131131
# No warnings for imports of `:` and parenthesized `(..)`
132132
@test diagnostic("import A.:, :", allow_multiple=true) == []
@@ -244,8 +244,8 @@ end
244244
tempdirname = mktempdir()
245245
cd(tempdirname) do
246246
rm(tempdirname)
247-
# Test _file_url doesn't fail with nonexistant directories
248-
@test isnothing(JuliaSyntax._file_url(joinpath("__nonexistant__", "test.jl")))
247+
# Test _file_url doesn't fail with nonexistent directories
248+
@test isnothing(JuliaSyntax._file_url(joinpath("__nonexistent__", "test.jl")))
249249
end
250250
end
251251
end

0 commit comments

Comments
 (0)