rthornton128 / calc

BSD 2-Clause "Simplified" License
65 stars 12 forks source link

[Question] How is the scanner dealing with two characters literals (like == ) ? #27

Open auyer opened 6 years ago

auyer commented 6 years ago

At a first glance, the code below from scan.go seems to be responsible for dealing with it.

tok = s.selectToken('=', token.EQL, token.ASSIGN)

But it seams like it will return token.EQL no matter what. selectToken will compare the current rune with the provided run, while it would make more sense to compare the next rune, ou the previous one.

Thanks

auyer commented 6 years ago

If this problem is not solved yet, I have changed it a bit in my local code. Tell me, and I will create a PR.