Skip to content
Permalink
Browse files
Python: Recognise walrus operator (#3126)
  • Loading branch information
hoonweiting committed Oct 5, 2021
1 parent 3d96eed commit 18bd101cc5e0a11d68d24bbdbd514cc53f313671
Showing with 5 additions and 3 deletions.
  1. +1 −1 components/prism-python.js
  2. +1 −1 components/prism-python.min.js
  3. +3 −1 tests/languages/python/operator_feature.test
@@ -55,7 +55,7 @@ Prism.languages.python = {
'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(?:False|None|True)\b/,
'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
'punctuation': /[{}[\];(),.:]/
};

Some generated files are not rendered by default. Learn more.

@@ -7,6 +7,7 @@
> >= >>
= ==
!=
:=
& | ^ ~

----------------------------------------------------
@@ -21,9 +22,10 @@
["operator", ">"], ["operator", ">="], ["operator", ">>"],
["operator", "="], ["operator", "=="],
["operator", "!="],
["operator", ":="],
["operator", "&"], ["operator", "|"], ["operator", "^"], ["operator", "~"]
]

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

Checks for all operators.
Checks for all operators.

0 comments on commit 18bd101

Please sign in to comment.