diff --git a/LICENSE.md b/LICENSE.md index 88fc63f3..7efd1908 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -43,4 +43,3 @@ package and is also licensed under the MIT "Expat" License: > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > SOFTWARE. > - diff --git a/docs/src/design.md b/docs/src/design.md index 968a0e11..a11d1b64 100644 --- a/docs/src/design.md +++ b/docs/src/design.md @@ -848,4 +848,3 @@ indentation from the syntax tree? Source formatting involves a big pile of heuristics to get something which "looks nice"... and ML systems have become very good at heuristics. Also, we've got huge piles of training data — just choose some high quality, tastefully hand-formatted libraries. - diff --git a/docs/src/howto.md b/docs/src/howto.md index 0de9e69a..c8bd0503 100644 --- a/docs/src/howto.md +++ b/docs/src/howto.md @@ -35,4 +35,3 @@ To reduce startup latency you can combine with a custom system as described in the [Julia VScode docs](https://www.julia-vscode.org/docs/dev/userguide/compilesysimage/#Creating-a-sysimage-for-the-active-environment), combined with the precompile execution file in `sysimage/precompile_exec.jl` in the source tree. For additional detail see the discussion in [issue #128](https://github.com/JuliaLang/JuliaSyntax.jl/issues/128). - diff --git a/docs/src/index.md b/docs/src/index.md index add8907a..79b8d83b 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -77,4 +77,3 @@ Julia `Expr` can also be produced: julia> JuliaSyntax.parsestmt(Expr, "(x + y)*z") :((x + y) * z) ``` - diff --git a/docs/src/reference.md b/docs/src/reference.md index be6ff90a..086bc57a 100644 --- a/docs/src/reference.md +++ b/docs/src/reference.md @@ -80,7 +80,7 @@ class of tokenization errors and lets the parser deal with them. * We use flags rather than child nodes to represent the difference between `struct` and `mutable struct`, `module` and `baremodule` (#220) * 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. * 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. -* 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. +* 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. ## More detail on tree differences @@ -324,4 +324,3 @@ Expr(:ncat) │ └─ :d └─ :x ``` - diff --git a/src/core/parse_stream.jl b/src/core/parse_stream.jl index da4d70cc..393e23c8 100644 --- a/src/core/parse_stream.jl +++ b/src/core/parse_stream.jl @@ -269,7 +269,7 @@ mutable struct ParseStream lexer = Tokenize.Lexer(io) # To avoid keeping track of the exact Julia development version where new # features were added or comparing prerelease strings, we treat prereleases - # or dev versons as the release version using only major and minor version + # or dev versions as the release version using only major and minor version # numbers. This means we're inexact for old dev versions but that seems # like an acceptable tradeoff. ver = (version.major, version.minor) diff --git a/src/julia/literal_parsing.jl b/src/julia/literal_parsing.jl index 1db36d7f..5a087eac 100644 --- a/src/julia/literal_parsing.jl +++ b/src/julia/literal_parsing.jl @@ -471,4 +471,3 @@ function lower_identifier_name(name::Symbol, k::Kind) Symbol(lower_identifier_name(string(name), k)) end end - diff --git a/src/julia/parser.jl b/src/julia/parser.jl index a2ce4209..70a34505 100644 --- a/src/julia/parser.jl +++ b/src/julia/parser.jl @@ -1418,7 +1418,7 @@ function parse_decl_with_initial_ex(ps::ParseState, mark) # (x) -> y # (x; a=1) -> y elseif kb == K"where" - # `where` and `->` have the "wrong" precedence when writing anon functons. + # `where` and `->` have the "wrong" precedence when writing anon functions. # So ignore this case to allow use of grouping brackets with `where`. # This needs to worked around in lowering :-( # (x where T) -> y ==> (-> (x where T) y) diff --git a/sysimage/compile.jl b/sysimage/compile.jl index fbc17232..390901eb 100755 --- a/sysimage/compile.jl +++ b/sysimage/compile.jl @@ -45,4 +45,3 @@ PackageCompiler.create_sysimage( Use it with `julia -J "$image_path"` """ - diff --git a/test/diagnostics.jl b/test/diagnostics.jl index 1397dd21..151aad91 100644 --- a/test/diagnostics.jl +++ b/test/diagnostics.jl @@ -34,7 +34,7 @@ end end @testset "parser errors" begin - @test diagnostic("+ #==# (a,b)") == + @test diagnostic("+ #==# (a,b)") == Diagnostic(2, 7, :error, "whitespace not allowed between prefix function call and argument list") @test diagnostic("1 -+ (a=1, b=2)") == Diagnostic(5, 5, :error, "whitespace not allowed between prefix function call and argument list") @@ -44,18 +44,18 @@ end @test diagnostic("function (\$f) body end") == 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.") - @test diagnostic("A.@B.x", only_first=true) == + @test diagnostic("A.@B.x", only_first=true) == Diagnostic(3, 4, :error, "`@` must appear on first or last macro name component") - @test diagnostic("@M.(x)") == + @test diagnostic("@M.(x)") == Diagnostic(1, 3, :error, "dot call syntax not supported for macros") - @test diagnostic("try x end") == + @test diagnostic("try x end") == Diagnostic(1, 9, :error, "try without catch or finally") # TODO: better range - @test diagnostic("@A.\$x a") == + @test diagnostic("@A.\$x a") == Diagnostic(4, 5, :error, "invalid macro name") - @test diagnostic("a, , b") == + @test diagnostic("a, , b") == Diagnostic(4, 4, :error, "unexpected `,`") @test diagnostic(")", allow_multiple=true) == [ Diagnostic(1, 1, :error, "unexpected `)`") @@ -118,15 +118,15 @@ end end @testset "parser warnings" begin - @test diagnostic("@(A)", only_first=true) == + @test diagnostic("@(A)", only_first=true) == Diagnostic(2, 4, :warning, "parenthesizing macro names is unnecessary") - @test diagnostic("try finally catch a ; b end") == + @test diagnostic("try finally catch a ; b end") == Diagnostic(13, 23, :warning, "`catch` after `finally` will execute out of order") - @test diagnostic("import . .A") == + @test diagnostic("import . .A") == Diagnostic(9, 10, :warning, "space between dots in import path") - @test diagnostic("import A .==") == + @test diagnostic("import A .==") == Diagnostic(9, 9, :warning, "space between dots in import path") - @test diagnostic("import A.:+") == + @test diagnostic("import A.:+") == Diagnostic(10, 10, :warning, "quoting with `:` is not required here") # No warnings for imports of `:` and parenthesized `(..)` @test diagnostic("import A.:, :", allow_multiple=true) == [] @@ -244,8 +244,8 @@ end tempdirname = mktempdir() cd(tempdirname) do rm(tempdirname) - # Test _file_url doesn't fail with nonexistant directories - @test isnothing(JuliaSyntax._file_url(joinpath("__nonexistant__", "test.jl"))) + # Test _file_url doesn't fail with nonexistent directories + @test isnothing(JuliaSyntax._file_url(joinpath("__nonexistent__", "test.jl"))) end end end diff --git a/test/fuzz_test.jl b/test/fuzz_test.jl index 15bfa79d..e24096a3 100644 --- a/test/fuzz_test.jl +++ b/test/fuzz_test.jl @@ -1022,4 +1022,3 @@ end # # fuzz_test(try_hook_failure, product_token_fuzz(cutdown_tokens, 2)) # fuzz_test(try_parseall_failure, product_token_fuzz(cutdown_tokens, 2)) - diff --git a/test/parser.jl b/test/parser.jl index a6ee4b62..4aa86528 100644 --- a/test/parser.jl +++ b/test/parser.jl @@ -300,7 +300,7 @@ tests = [ # `where` combined with `->` still parses strangely. However: # * It's extra hard to add a tuple around the `x` in this syntax corner case. # * The user already needs to add additional, ugly, parens to get this - # to parse correctly because the precendence of `where` is + # to parse correctly because the precedence of `where` is # inconsistent with `::` and `->` in this case. "(x where T)->c" => "(-> (parens (where x T)) c)" "((x::T) where T)->c" => "(-> (parens (where (parens (::-i x T)) T)) c)" @@ -963,7 +963,7 @@ tests = [ "[a \n b]" => "(vcat a b)" # Can't mix multiple ;'s and spaces ((v=v"1.7",), "[a ;; b c]") => "(ncat-2 a (row b (error-t) c))" - # Empty nd arrays + # Empty N-dimensional arrays ((v=v"1.8",), "[;]") => "(ncat-1)" ((v=v"1.8",), "[;;]") => "(ncat-2)" ((v=v"1.8",), "[\n ;; \n ]") => "(ncat-2)" diff --git a/test/test_utils.jl b/test/test_utils.jl index dae16cc0..ed3d11e2 100644 --- a/test/test_utils.jl +++ b/test/test_utils.jl @@ -482,4 +482,3 @@ function Meta_parseall(text::AbstractString; filename="none", lineno=1) ex,_ = _Meta_parse_string(text, String(filename), lineno, 1, :all) return ex end - diff --git a/test/test_utils_tests.jl b/test/test_utils_tests.jl index 8c68f068..51515515 100644 --- a/test/test_utils_tests.jl +++ b/test/test_utils_tests.jl @@ -35,4 +35,3 @@ Expr(:block, LineNumberNode(1), 1)), Expr(:block, LineNumberNode(1)))) end - diff --git a/tools/bump_in_Base.jl b/tools/bump_in_Base.jl index c9ca7473..aec2876d 100644 --- a/tools/bump_in_Base.jl +++ b/tools/bump_in_Base.jl @@ -72,4 +72,3 @@ if !isinteractive() exit(bump_in_Base(ARGS[1], juliasyntax_dir, ARGS[2])) end end -