this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cue/scanner: don't allow repeated _ in numbers

Fixes discrepency with spec.

Change-Id: Ib6f4a08dabeb26861414d03b91af7d1e62119bb1
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/3040
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>

authored by

Marcel van Lohuizen and committed by
Marcel van Lohuizen
1c4d5979 8b4cab62

+4
+3
cue/scanner/scanner.go
··· 304 304 func (s *Scanner) scanMantissa(base int) { 305 305 var last rune 306 306 for digitVal(s.ch) < base { 307 + if last == '_' && s.ch == '_' { 308 + s.errf(s.offset, "illegal '_' in number") 309 + } 307 310 last = s.ch 308 311 s.next() 309 312 }
+1
cue/scanner/scanner_test.go
··· 801 801 {"0x", token.INT, 0, "0x", "illegal hexadecimal number"}, 802 802 {"0X", token.INT, 0, "0X", "illegal hexadecimal number"}, 803 803 {"0Xbeef_", token.INT, 6, "0Xbeef_", "illegal '_' in number"}, 804 + {"0Xbeef__beef", token.INT, 7, "0Xbeef__beef", "illegal '_' in number"}, 804 805 {"0b", token.INT, 0, "0b", "illegal binary number"}, 805 806 {"0o", token.INT, 0, "0o", "illegal octal number"}, 806 807 // {"123456789012345678890_i", IMAG, 21, "123456789012345678890_i", "illegal '_' in number"},