tree-sitter-julia
tree-sitter-julia copied to clipboard
Add true, false as literals
This PR adds (nothing)
, (missing)
, (true)
, (false)
literals.
Makes querying these a bit easier.
Edit:
only add (true)
and (false)
, see discussion below
When I was revising the other literals I left these out because of the following:
julia> true === :true
true
julia> false === :false
true
julia> nothing === :nothing
false
julia> missing === :missing
false
The booleans behave like numbers or any other literal, but nothing
and missing
are regular values (aliases for Nothing()
and Missing()
respectively).
Yes, that's a good argument, undef
also belongs to the same category. The (new) Julia parser also treats these as identifiers:
julia> parseall(GreenNode, "true; false; nothing; missing")
1:29 │[toplevel]
1:29 │ [toplevel]
1:4 │ true ✔
5:5 │ ;
6:6 │ Whitespace
7:11 │ false ✔
12:12 │ ;
13:13 │ Whitespace
14:20 │ Identifier ✔
21:21 │ ;
22:22 │ Whitespace
23:29 │ Identifier ✔
Best to keep this PR to true
and false
.
updated and regenerated