mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 15:43:01 +00:00 
			
		
		
		
	Make number syntax a bit stricter - no leading underscores
and no underscores in exponent.
This commit is contained in:
		| @@ -308,8 +308,9 @@ int janet_scan_number( | ||||
|         } else if (base == 10 && (*str == 'E' || *str == 'e')) { | ||||
|             foundexp = 1; | ||||
|             break; | ||||
|         } else if (*str != '_') { | ||||
|             /* underscores are ignored - can be used for separator */ | ||||
|         } else if (*str == '_') { | ||||
|             if (!seenadigit) goto error; | ||||
|         } else { | ||||
|             int digit = digit_lookup[*str & 0x7F]; | ||||
|             if (*str > 127 || digit >= base) goto error; | ||||
|             if (seenpoint) ex--; | ||||
| @@ -342,10 +343,6 @@ int janet_scan_number( | ||||
|         } | ||||
|         while (str < end && ee < (INT32_MAX / 40)) { | ||||
|             int digit = digit_lookup[*str & 0x7F]; | ||||
|             if (*str == '_') { | ||||
|                 str++; | ||||
|                 continue; | ||||
|             } | ||||
|             if (*str > 127 || digit >= base) goto error; | ||||
|             ee = base * ee + digit; | ||||
|             str++; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose