Skip to content

Commit

Permalink
Python: Operator keywords are now keywords (#1617)
Browse files Browse the repository at this point in the history
Change `and`, `not`, and `or` to keywords.
  • Loading branch information
RunDevelopment authored and mAAdhaTTah committed Nov 29, 2018
1 parent 3590edd commit 1d1fb80
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions components/prism-python.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Prism.languages.python = {
pattern: /(\bclass\s+)\w+/i,
lookbehind: true
},
'keyword': /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|pass|print|raise|return|try|while|with|yield)\b/,
'keyword': /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
'builtin':/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
'boolean': /\b(?:True|False|None)\b/,
'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
'punctuation': /[{}[\];(),.:]/
};
2 changes: 1 addition & 1 deletion components/prism-python.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/languages/python/keyword_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import in is lambda
pass print raise return
try while with yield
nonlocal
and not or

----------------------------------------------------

Expand All @@ -21,7 +22,8 @@ nonlocal
["keyword", "import"], ["keyword", "in"], ["keyword", "is"], ["keyword", "lambda"],
["keyword", "pass"], ["keyword", "print"], ["keyword", "raise"], ["keyword", "return"],
["keyword", "try"], ["keyword", "while"], ["keyword", "with"], ["keyword", "yield"],
["keyword", "nonlocal"]
["keyword", "nonlocal"],
["keyword", "and"], ["keyword", "not"], ["keyword", "or"]
]

----------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions tests/languages/python/operator_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
= ==
!=
& | ^ ~
or and not

----------------------------------------------------

Expand All @@ -22,8 +21,7 @@ or and not
["operator", ">"], ["operator", ">="], ["operator", ">>"],
["operator", "="], ["operator", "=="],
["operator", "!="],
["operator", "&"], ["operator", "|"], ["operator", "^"], ["operator", "~"],
["operator", "or"], ["operator", "and"], ["operator", "not"]
["operator", "&"], ["operator", "|"], ["operator", "^"], ["operator", "~"]
]

----------------------------------------------------
Expand Down

0 comments on commit 1d1fb80

Please sign in to comment.