I meant this 
code: https://golang.org/src/cmd/compile/internal/syntax/scanner.go#L187 .

On Wednesday, October 7, 2020 at 1:29:24 AM UTC-7 Ryan Keppel 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.
>
> On Wednesday, October 7, 2020 at 1:04:21 AM UTC-7 Jan Mercl wrote:
>
>> On Wed, Oct 7, 2020 at 9:23 AM Ryan Keppel <ryan.k...@gmail.com> wrote:
>>
>> > In the current Golang
>>
>> The name is Go. There's no Golang programming language.
>>
>> > implementation of scanning, there's some extra code to handle ".." in 
>> the source (as two dot tokens).
>>
>> Do you mean this? https://golang.org/src/go/scanner/scanner.go#L837
>>
>> > Would this ever happen in practice?
>>
>> Sure, why not? Scanner will happily scan two consecutive dot tokens,
>> that's its job.
>>
>> > Two floats together?
>>
>> No. This seems to conflate what a scanner is for with the grammar of
>> the language. Package scanner can handle sources like `for package if
>> not break ..123..` just fine. The language specification not so much.
>> But in Go, as in many other languages, the lexical and syntax grammars
>> are two different things, even though the latter builds upon the
>> former.
>>
>

-- 
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/e451452f-230c-4c33-ba86-6d6125c12d73n%40googlegroups.com.

Reply via email to