1.1 --- a/python.editor/src/org/netbeans/modules/python/editor/PythonUtils.java Fri Sep 11 15:32:16 2015 +0200
1.2 +++ b/python.editor/src/org/netbeans/modules/python/editor/PythonUtils.java Fri Aug 14 23:18:24 2015 +0200
1.3 @@ -189,8 +189,12 @@
1.4 return module;
1.5 }
1.6
1.7 - // Keywords - according to http://docs.python.org/ref/keywords.html
1.8 + // According to https://hg.python.org/cpython/file/3.5/Lib/keyword.py
1.9 + // and https://hg.python.org/cpython/file/2.7/Lib/keyword.py
1.10 static final String[] PYTHON_KEYWORDS = new String[]{
1.11 + "False", // NOI18N
1.12 + "None", // NOI18N
1.13 + "True", // NOI18N
1.14 "and", // NOI18N
1.15 "as", // NOI18N
1.16 "assert", // NOI18N
1.17 @@ -202,7 +206,6 @@
1.18 "elif", // NOI18N
1.19 "else", // NOI18N
1.20 "except", // NOI18N
1.21 - "exec", // NOI18N
1.22 "finally", // NOI18N
1.23 "for", // NOI18N
1.24 "from", // NOI18N
1.25 @@ -212,16 +215,20 @@
1.26 "in", // NOI18N
1.27 "is", // NOI18N
1.28 "lambda", // NOI18N
1.29 + "nonlocal", // NOI18N
1.30 "not", // NOI18N
1.31 "or", // NOI18N
1.32 "pass", // NOI18N
1.33 - "print", // NOI18N
1.34 "raise", // NOI18N
1.35 "return", // NOI18N
1.36 "try", // NOI18N
1.37 "while", // NOI18N
1.38 "with", // NOI18N
1.39 "yield", // NOI18N
1.40 + "async", // NOI18N, Python 3.5 only
1.41 + "await", // NOI18N, Python 3.5 only
1.42 + "exec", // NOI18N, Python 2 only
1.43 + "print", // NOI18N, Pytohn 2 only, function in python 3
1.44 };
1.45
1.46 public static boolean isPythonKeyword(String name) {
2.1 --- a/python.editor/src/org/netbeans/modules/python/editor/lexer/PythonLexer.java Fri Sep 11 15:32:16 2015 +0200
2.2 +++ b/python.editor/src/org/netbeans/modules/python/editor/lexer/PythonLexer.java Fri Aug 14 23:18:24 2015 +0200
2.3 @@ -843,6 +843,8 @@
2.4 case 'n': // not
2.5 if (length == 3 && TokenUtilities.textEquals(s, "not")) { // NOI18N
2.6 return PythonTokenId.ANY_KEYWORD;
2.7 + } else if (length == 8 && TokenUtilities.textEquals(s, "nonlocal")) { // NOI18N
2.8 + return PythonTokenId.ANY_KEYWORD;
2.9 }
2.10 break;
2.11 case 'o': // or, object