Add pass statement just for compatibility.

This commit is contained in:
K. Lange 2021-01-19 18:22:13 +09:00
parent b98751d991
commit fdc1a500fe
5 changed files with 6 additions and 1 deletions

View File

@ -1625,6 +1625,8 @@ static void statement() {
breakStatement();
} else if (match(TOKEN_CONTINUE)) {
continueStatement();
} else if (match(TOKEN_PASS)) {
/* Do nothing. */
} else {
expressionStatement();
}

View File

@ -22,7 +22,7 @@ let FLAG_ESCAPE = 13
let keywords = [
'and','class','def','else','export','for','if','in','import','let','not',
'or','return','while','try','except','raise','continue','break','as','from',
'elif', 'lambda'
'elif', 'lambda', 'pass',
]
let types = [

View File

@ -535,6 +535,7 @@ char * syn_krk_keywords[] = {
"and","class","def","else","for","if","in","import","del",
"let","not","or","return","while","try","except","raise",
"continue","break","as","from","elif","lambda","with","is",
"pass",
NULL
};

View File

@ -234,6 +234,7 @@ static KrkTokenType identifierType() {
case 'n': return checkKeyword(1, "ot", TOKEN_NOT);
case 'N': return checkKeyword(1, "one", TOKEN_NONE);
case 'o': return checkKeyword(1, "r", TOKEN_OR);
case 'p': return checkKeyword(1, "ass", TOKEN_PASS);
case 'r': if (MORE(1)) switch (scanner.start[1]) {
case 'e': return checkKeyword(2, "turn", TOKEN_RETURN);
case 'a': return checkKeyword(2, "ise", TOKEN_RAISE);

View File

@ -55,6 +55,7 @@ typedef enum {
TOKEN_NOT,
TOKEN_OR,
TOKEN_ELIF,
TOKEN_PASS,
TOKEN_RETURN,
TOKEN_SELF,
TOKEN_SUPER,