# HG changeset patch # User Peter Hosey # Date 1294478511 28800 # Node ID 3b33b1c488809a681ffdb92c3fc81211cba2de48 # Parent 94e9ee861fc34d254cebfe47531cf79fbf450295 Changed the token expression to add support for sub-identifier word differencing. Example (this change causes only “Disable” and “Enable” to be highlighted): - CLVSuddenTerminationDisable(); + CLVSuddenTerminationEnable(); diff --git a/diff-colorize.py b/diff-colorize.py --- a/diff-colorize.py +++ b/diff-colorize.py @@ -174,8 +174,8 @@ def common_and_distinct_substrings(a, b) def tokenize(a): "Each token is an identifier, a number, or a single character." import re - # Identifier, binary number, hex number, decimal number, operator, other punctuation. - token_exp = re.compile('[_a-zA-Z][_a-zA-Z0-9]+:?|0b[01]+|0[xX][0-9A-Fa-f]+|[0-9]+|[-+*|&^/%\[\]<=>,]|[()\\\\;`{}]') + # Word in identifier, word in macro name (MACRO_NAME), binary number, hex number, decimal 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): for ch in a[start:match.start()]: