On Wed, Oct 7, 2020 at 10:29 AM Ryan Keppel <ryan.kepp...@gmail.com> wrote:

> Yes, I mean that code section. I did a quick test and two floats tokenizes
> just fine (2..5 tokenizes to "2." and ".5")--it doesn't invoke the
> described code. I don't think Go in practice would allow two dot tokens in
> a row. Go's parser is very loose ("1 + 10 = 20" isn't a syntax error) and I
> don't see it allowing that.
>
>
That code section scans for token.ELLIPSIS, i.e., '...'.

The scanner has ch := s.ch already from the "outer" switch. When you hit
the default case, you run s.next() which advances the scanner. Now, s.ch
points to the second '.' and the s.peek() will have us peek at the third
'.'. The calls to s.next() twice advances us beyond that, and we have an
ellipsis, i.e., '...'

Lines of interest, though they might move: 791, 809, 837-844 (The future
reader might be interested in knowing this was around go version 1.15.2)

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGrdgiV_K8ufXR8JMm%3DSy9bL2iuAuJOtxnpA02jEMV3bVs9%2BTA%40mail.gmail.com.

Reply via email to