altanh commented on pull request #7370:
URL: https://github.com/apache/tvm/pull/7370#issuecomment-769626433
Hmm, the `-inf` case actually makes me wonder about the previous behavior
for parsing numbers. I personally don't think something like `------4` should
be accepted and tokenized as `4`, for example. IMO we should reject these
either right here at tokenizer or at the parser. The behavior of `stod` also
agrees with this.
I also noticed we could maybe use `MatchString` to directly match on
`"inf"`. I feel like the most durable solution is to actually have a single
branch for handling `-` like this:
```
// ...
} else if (next == "-") {
// assuming More()
Next();
if (IsDigit(Peek()) || MatchString("inff")) {
// handle num normally, we might want to refactor previous handling to
make things nicer
} else {
// return TokenType::kMinus normally
}
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]