|
44 | 44 | KEYWORD_lambda, |
45 | 45 | KEYWORD_pass, |
46 | 46 | KEYWORD_return, |
| 47 | + KEYWORD_REST |
47 | 48 | }; |
48 | 49 | typedef int keywordId; /* to allow KEYWORD_NONE */ |
49 | 50 |
|
@@ -164,6 +165,22 @@ static const keywordTable PythonKeywordTable[] = { |
164 | 165 | { "return", KEYWORD_return }, |
165 | 166 | }; |
166 | 167 |
|
| 168 | +/* Taken from https://docs.python.org/3/reference/lexical_analysis.html#keywords */ |
| 169 | +const static struct keywordGroup PythonRestKeywords = { |
| 170 | + .value = KEYWORD_REST, |
| 171 | + .addingUnlessExisting = true, |
| 172 | + .keywords = { |
| 173 | + "False", "await", "else", "import", "pass", |
| 174 | + "None", "break", "except", "in", "raise", |
| 175 | + "True", "class", "finally", "is", "return", |
| 176 | + "and", "continue", "for", "lambda", "try", |
| 177 | + "as", "def", "from", "nonlocal", "while", |
| 178 | + "assert", "del", "global", "not", "with", |
| 179 | + "async", "elif", "if", "or", "yield", |
| 180 | + NULL |
| 181 | + }, |
| 182 | +}; |
| 183 | + |
167 | 184 | typedef enum eTokenType { |
168 | 185 | /* 0..255 are the byte's value */ |
169 | 186 | TOKEN_EOF = 256, |
@@ -1718,6 +1735,7 @@ static void initialize (const langType language) |
1718 | 1735 | Lang_python = language; |
1719 | 1736 |
|
1720 | 1737 | TokenPool = objPoolNew (16, newPoolToken, deletePoolToken, clearPoolToken, NULL); |
| 1738 | + addKeywordGroup (&PythonRestKeywords, Lang_python); |
1721 | 1739 | } |
1722 | 1740 |
|
1723 | 1741 | static void finalize (langType language CTAGS_ATTR_UNUSED, bool initialized) |
|
0 commit comments