Closed
Description
Hi,
I am writing an automatic check for a coding standard rule about writing digits on either side of the dot in floating-point literals, but I discovered that I cannot really check it, because the missing zero was added at some earlier time.
julia> import JuliaSyntax as JS
julia> JS.parsestmt(JS.SyntaxNode, ".5")
SyntaxNode:
0.5 :: Float
All my attempts to get the original input have failed. See these attempt I took with the help of Infiltrator:
infil> JS.sourcetext(node)
"0.5"
infil> string(node)
"0.5"
infil> JS.untokenize(node)
ERROR: MethodError: no method matching untokenize(::JuliaSyntax.SyntaxNode)
The function `untokenize` exists, but no method is defined for this combination of argument types.
...
infil> JS.untokenize(node.raw)
ERROR: MethodError: no method matching untokenize(::JuliaSyntax.GreenNode{JuliaSyntax.SyntaxHead})
The function `untokenize` exists, but no method is defined for this combination of argument types.
...
infil> JS.untokenize(JS.head(node.raw))
ERROR: TypeError: in typeassert, expected String, got a value of type Nothing
...
infil> JS.untokenize(JS.head(node))
ERROR: TypeError: in typeassert, expected String, got a value of type Nothing
...
Is it possible to get the original literal .5
? How?
Metadata
Metadata
Assignees
Labels
No labels