Mercurial > diff-colorize
changeset 27:5f17911c4fe6
Expanded this comment to acknowledge that the same sub-expression covers both decimal and octal (beginning with 0) number literals.
author | Peter Hosey <hg@boredzo.org> |
---|---|
date | Sat, 08 Jan 2011 01:27:44 -0800 |
parents | 3b33b1c48880 |
children | 58221373fc6f |
files | diff-colorize.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/diff-colorize.py +++ b/diff-colorize.py @@ -174,7 +174,7 @@ def common_and_distinct_substrings(a, b) def tokenize(a): "Each token is an identifier, a number, or a single character." import re - # Word in identifier, word in macro name (MACRO_NAME), binary number, hex number, decimal number, operator, other punctuation. + # Word in identifier, word in macro name (MACRO_NAME), binary number, hex number, decimal or octal number, operator, other punctuation. token_exp = re.compile('[_A-Z]*[_a-z0-9]+:?|_??[A-Z0-9]+:?|0b[01]+|0[xX][0-9A-Fa-f]+|[0-9]+|[-+*|&^/%\[\]<=>,]|[()\\\\;`{}]') start = 0 for match in token_exp.finditer(a):