Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Python: Fixed numbers ending with a dot (#3106)
  • Loading branch information
RunDevelopment committed Oct 5, 2021
1 parent 00f77a2 commit 2c63efa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/prism-python.js
Expand Up @@ -54,7 +54,7 @@ Prism.languages.python = {
'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(?: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?\b/i,
'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': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
'punctuation': /[{}[\];(),.:]/
};
Expand Down
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.

5 changes: 3 additions & 2 deletions tests/languages/python/number_feature.test
Expand Up @@ -3,6 +3,7 @@
0xBadFace
42
3.14159
10.
2.1E10
0.3e-7
4.8e+1
Expand All @@ -24,6 +25,7 @@
["number", "0xBadFace"],
["number", "42"],
["number", "3.14159"],
["number", "10."],
["number", "2.1E10"],
["number", "0.3e-7"],
["number", "4.8e+1"],
Expand All @@ -36,9 +38,8 @@
["number", "0xBad_Face"],
["number", "4_200"],
["number", "4_200j"]

]

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

Checks for hexadecimal, octal, binary and decimal numbers.
Checks for hexadecimal, octal, binary and decimal numbers.

0 comments on commit 2c63efa

Please sign in to comment.