[BUG] Disallow decimals on array decl and indices
[FEAT] Parser checks index out of bounds errors
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "tokenizer.h"
|
||||
#include "error.h"
|
||||
#include <string>
|
||||
|
||||
static bool streq(const char* a, const char* b) {
|
||||
while (*a != 0 && *b != 0) {
|
||||
@@ -79,8 +80,8 @@ static void tkn_do_next() {
|
||||
if (CCHR >= 48 && CCHR <= 57) {
|
||||
do { value = value * 10 + (CCHR - 48); NEXT; } while (CCHR >= 48 && CCHR <= 57);
|
||||
if (CCHR == '.') {
|
||||
int d = 10;
|
||||
do { value = value + ((CCHR - 48) / d); d *= 10; NEXT; } while (CCHR >= 48 && CCHR <= 57);
|
||||
float d = 0.1f; NEXT;
|
||||
do { value = value + (float(CCHR - 48) * d); d *= 0.1f; NEXT; } while (CCHR >= 48 && CCHR <= 57);
|
||||
}
|
||||
current_token = TOKEN_NUMBER; return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user