Fix up some syntax errors
This commit is contained in:
parent
3bfa32ac83
commit
75e0ec9e54
@ -467,6 +467,9 @@ static void consume(KrkTokenType type, const char * message) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parser.current.type == TOKEN_EOL || parser.current.type == TOKEN_EOF) {
|
||||||
|
parser.current = parser.previous;
|
||||||
|
}
|
||||||
errorAtCurrent("%s", message);
|
errorAtCurrent("%s", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1973,6 +1976,12 @@ static void forStatement(void) {
|
|||||||
int sawComma = 0;
|
int sawComma = 0;
|
||||||
ssize_t varCount = 0;
|
ssize_t varCount = 0;
|
||||||
int matchedEquals = 0;
|
int matchedEquals = 0;
|
||||||
|
|
||||||
|
if (!check(TOKEN_IDENTIFIER)) {
|
||||||
|
errorAtCurrent("Empty variable list in 'for'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!check(TOKEN_IDENTIFIER)) break;
|
if (!check(TOKEN_IDENTIFIER)) break;
|
||||||
ssize_t ind = parseVariable("Expected name for loop iterator.");
|
ssize_t ind = parseVariable("Expected name for loop iterator.");
|
||||||
@ -2800,6 +2809,10 @@ static void comprehensionInner(KrkScanner scannerBefore, Parser parserBefore, vo
|
|||||||
ssize_t loopInd = current->localCount;
|
ssize_t loopInd = current->localCount;
|
||||||
ssize_t varCount = 0;
|
ssize_t varCount = 0;
|
||||||
int sawComma = 0;
|
int sawComma = 0;
|
||||||
|
if (!check(TOKEN_IDENTIFIER)) {
|
||||||
|
errorAtCurrent("Empty variable list in comprehension");
|
||||||
|
return;
|
||||||
|
}
|
||||||
do {
|
do {
|
||||||
if (!check(TOKEN_IDENTIFIER)) break;
|
if (!check(TOKEN_IDENTIFIER)) break;
|
||||||
defineVariable(parseVariable("Expected name for iteration variable."));
|
defineVariable(parseVariable("Expected name for iteration variable."));
|
||||||
|
Loading…
Reference in New Issue
Block a user