{"thread":{"id":"26077","subject":"[PATCH 1/4] diff.c: pass struct diff_words into find_word_boundaries","startedAt":"2010-12-15T15:13:24Z","lastAt":"2011-01-18T18:00:57Z","messageCount":23,"participants":["Thomas Rast","Scott Johnson","Junio C Hamano","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"158185","messageId":"cover.1292424926.git.trast@student.ethz.ch","threadId":"26077","inReplyTo":"561247.22837.qm@web110707.mail.gq1.yahoo.com","subject":"[PATCH 0/4] --word-regex sanity checking and such","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-15T15:13:24Z","receivedAt":"2010-12-15T15:13:24Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"[Forgot the list and Matthijs on the first sending.  Sorry for the\nspam!]\n\nScott Johnson wrote [trimmed and wraps fixed up]:\n> Here's the default `git diff --word-diff`:\n>         [-<li class=\"yws-maps\"><em></em><a-]{+<li><em></em><a+} href=\"#\">yws-maps</a></li>\n>         [-<li class=\"ydn-delicious\"><em></em><a-]{+<li><em></em><a+} href=\"#\">ydn-delicious</a></li>\n> \n> Which is correct, but less than ideal because it highlights much more than the \n> actual changes.\n> \n> So I create a .gitattributes file with one line:\n> *.html diff=html\n> \n> And rerun `git diff --word-diff`:\n>         <li[-class=\"yws-maps\"-]><em></em><a href=\"#\">yws-maps</a></li>\n>         <li><em></em><a href=\"#\">ydn-delicious</a></li>\n> \n> Yikes! What happened to the second line of changes? The removed code is not \n> displayed at all.\n\nMichael J Gruber wrote:\n> Yep, I just found out myself experimenting with a wordRegex for csv.\n> Seems like quite a \"Gimme rope\" feature...\n> \n> So, it's the regex.\n\nWell. Yes. No. Maybe.\n\nThanks for bringing this to my attention.  I currently have enough\nmore serious work to avoid that this actually motivated me to hack up\na sanity check.  It's just far too error prone as it is now.\n\nBut I cannot reproduce the problem!  I put Scott's two offending lines\n(taken from his \"straight\" diff) into t4034/html/{pre,post}, and I\nthink the output is valid.  Also, the word regex for html has long\nincluded the |[^[:space:]] safeguard (actually they all do except for\nbibtex, which is even more lenient on what it matches).  So you either\nfound an example that depends on more context (which would be *really*\nbad) or there is another source of bad regexes.  Anyway, the safeguard\nshould easily catch the latter case.\n\nThis did unearth a bug in the ruby regex, though, so it's been worth\nthe trouble.\n\nVarious small issues with this patch series:\n\n* [4/4] I stole the html test from Scott's mail, and some of the rest\n  from various Wikibooks sources on \"Hello World\" in each language,\n  usually extended by a bit of code that tests the world-splitting\n  power.  I hope this is ok with Scott and the Copyright overlords.\n  There are only so many ways to spell \"Hello World\", and only so many\n  languages I know myself.\n\n* [4/4] Many patterns do not split 1+2, probably because they stick +2\n  together as a signed integer literal, even though I think they\n  should.  I ran out of time to investigate however.\n\n* [3/4] was actually detected with the help of [4/4], but putting it\n  after would require heavy special casing.\n\n* [2/4] It's a weird idiosyncrasy of the word-diff code that the exit\n  status of git-diff does not depend on whether word-diff found any\n  differences, and in fact the shown hunks do not either.  So the\n  tests are \"test_must_fail\" regardless of word regex, because the\n  input files differ at a byte level.  Maybe at least hunks without\n  word differences should be suppressed?\n\n\nThomas Rast (4):\n  diff.c: pass struct diff_words into find_word_boundaries\n  diff.c: implement a sanity check for word regexes\n  userdiff: fix typo in ruby word regex\n  t4034: bulk verify builtin word regex sanity\n\n Documentation/config.txt |    8 ++++\n diff.c                   |  104 +++++++++++++++++++++++++++++++++++++++++----\n diff.h                   |    1 +\n t/t4034-diff-words.sh    |   85 +++++++++++++++++++++++++++++++++++++-\n t/t4034/bibtex/expect    |   15 +++++++\n t/t4034/bibtex/post      |   10 ++++\n t/t4034/bibtex/pre       |    9 ++++\n t/t4034/cpp/expect       |   10 ++++\n t/t4034/cpp/post         |    5 ++\n t/t4034/cpp/pre          |    4 ++\n t/t4034/csharp/expect    |   12 +++++\n t/t4034/csharp/post      |    8 ++++\n t/t4034/csharp/pre       |    8 ++++\n t/t4034/fortran/expect   |   12 +++++\n t/t4034/fortran/post     |    7 +++\n t/t4034/fortran/pre      |    7 +++\n t/t4034/html/expect      |    7 +++\n t/t4034/html/post        |    2 +\n t/t4034/html/pre         |    2 +\n t/t4034/java/expect      |   11 +++++\n t/t4034/java/post        |    6 +++\n t/t4034/java/pre         |    6 +++\n t/t4034/objc/expect      |   11 +++++\n t/t4034/objc/post        |    7 +++\n t/t4034/objc/pre         |    7 +++\n t/t4034/pascal/expect    |   12 +++++\n t/t4034/pascal/post      |    7 +++\n t/t4034/pascal/pre       |    7 +++\n t/t4034/php/expect       |    7 +++\n t/t4034/php/post         |    2 +\n t/t4034/php/pre          |    2 +\n t/t4034/python/expect    |    8 ++++\n t/t4034/python/post      |    3 +\n t/t4034/python/pre       |    3 +\n t/t4034/ruby/expect      |    7 +++\n t/t4034/ruby/post        |    2 +\n t/t4034/ruby/pre         |    2 +\n t/t4034/tex/expect       |    9 ++++\n t/t4034/tex/post         |    4 ++\n t/t4034/tex/pre          |    4 ++\n userdiff.c               |    2 +-\n 41 files changed, 433 insertions(+), 12 deletions(-)\n create mode 100644 t/t4034/bibtex/expect\n create mode 100644 t/t4034/bibtex/post\n create mode 100644 t/t4034/bibtex/pre\n create mode 100644 t/t4034/cpp/expect\n create mode 100644 t/t4034/cpp/post\n create mode 100644 t/t4034/cpp/pre\n create mode 100644 t/t4034/csharp/expect\n create mode 100644 t/t4034/csharp/post\n create mode 100644 t/t4034/csharp/pre\n create mode 100644 t/t4034/fortran/expect\n create mode 100644 t/t4034/fortran/post\n create mode 100644 t/t4034/fortran/pre\n create mode 100644 t/t4034/html/expect\n create mode 100644 t/t4034/html/post\n create mode 100644 t/t4034/html/pre\n create mode 100644 t/t4034/java/expect\n create mode 100644 t/t4034/java/post\n create mode 100644 t/t4034/java/pre\n create mode 100644 t/t4034/objc/expect\n create mode 100644 t/t4034/objc/post\n create mode 100644 t/t4034/objc/pre\n create mode 100644 t/t4034/pascal/expect\n create mode 100644 t/t4034/pascal/post\n create mode 100644 t/t4034/pascal/pre\n create mode 100644 t/t4034/php/expect\n create mode 100644 t/t4034/php/post\n create mode 100644 t/t4034/php/pre\n create mode 100644 t/t4034/python/expect\n create mode 100644 t/t4034/python/post\n create mode 100644 t/t4034/python/pre\n create mode 100644 t/t4034/ruby/expect\n create mode 100644 t/t4034/ruby/post\n create mode 100644 t/t4034/ruby/pre\n create mode 100644 t/t4034/tex/expect\n create mode 100644 t/t4034/tex/post\n create mode 100644 t/t4034/tex/pre\n\n-- \n1.7.3.3.807.g6ee1f\n"},{"id":"158182","messageId":"3ced19036dcc25304d13a665af04485e2c5ad350.1292424926.git.trast@student.ethz.ch","threadId":"26077","inReplyTo":"cover.1292424926.git.trast@student.ethz.ch","subject":"[PATCH 1/4] diff.c: pass struct diff_words into find_word_boundaries","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-15T15:13:25Z","receivedAt":"2010-12-15T15:13:25Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"We need the word_regex_check member.  Instead of adding another\nargument, just pass in the whole struct for future extensibility.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n diff.c |   11 ++++++-----\n 1 files changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex a16ce69..8758a51 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -778,12 +778,13 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)\n }\n \n /* This function starts looking at *begin, and returns 0 iff a word was found. */\n-static int find_word_boundaries(mmfile_t *buffer, regex_t *word_regex,\n+static int find_word_boundaries(mmfile_t *buffer, struct diff_words_data *diff_words,\n \t\tint *begin, int *end)\n {\n-\tif (word_regex && *begin < buffer->size) {\n+\tif (diff_words->word_regex && *begin < buffer->size) {\n \t\tregmatch_t match[1];\n-\t\tif (!regexec(word_regex, buffer->ptr + *begin, 1, match, 0)) {\n+\t\tif (!regexec(diff_words->word_regex, buffer->ptr + *begin,\n+\t\t\t     1, match, 0)) {\n \t\t\tchar *p = memchr(buffer->ptr + *begin + match[0].rm_so,\n \t\t\t\t\t'\\n', match[0].rm_eo - match[0].rm_so);\n \t\t\t*end = p ? p - buffer->ptr : match[0].rm_eo + *begin;\n@@ -813,7 +814,7 @@ static int find_word_boundaries(mmfile_t *buffer, regex_t *word_regex,\n  * in buffer->orig.\n  */\n static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,\n-\t\tregex_t *word_regex)\n+\t\tstruct diff_words_data *diff_words)\n {\n \tint i, j;\n \tlong alloc = 0;\n@@ -827,7 +828,7 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,\n \tbuffer->orig_nr = 1;\n \n \tfor (i = 0; i < buffer->text.size; i++) {\n-\t\tif (find_word_boundaries(&buffer->text, word_regex, &i, &j))\n+\t\tif (find_word_boundaries(&buffer->text, diff_words, &i, &j))\n \t\t\treturn;\n \n \t\t/* store original boundaries */\n-- \n1.7.3.3.807.g6ee1f\n"},{"id":"158183","messageId":"cc4ccf1a93c4de1b3229730fcac1409ac70b9ae1.1292424926.git.trast@student.ethz.ch","threadId":"26077","inReplyTo":"cover.1292424926.git.trast@student.ethz.ch","subject":"[PATCH 2/4] diff.c: implement a sanity check for word regexes","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-15T15:13:26Z","receivedAt":"2010-12-15T15:13:26Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Word regexes are a bit of a dangerous beast, since it is easily\npossible to not match a non-space part, which is subsequently ignored\nfor the purposes of emitting the word diff.  This was clearly stated\nin the docs, but users still tripped over it.\n\nImplement a safeguard that verifies two basic sanity assumptions:\n\n* The word regex matches anything that is !isspace().\n\n* The word regex does not match '\\n'.  (This case is not very harmful,\n  but we used to silently cut off at the '\\n' which may go against\n  user expectations.)\n\nThis is configurable via 'diff.wordRegexCheck', and defaults to\n'warn'.\n\nReported-by: Scott Johnson <scottj75074@yahoo.com>\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/config.txt |    8 ++++\n diff.c                   |   93 +++++++++++++++++++++++++++++++++++++++++++--\n diff.h                   |    1 +\n t/t4034-diff-words.sh    |   65 +++++++++++++++++++++++++++++++-\n 4 files changed, 161 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex bf9479e..2e033ea 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -897,6 +897,14 @@ diff.wordRegex::\n \tsequences that match the regular expression are \"words\", all other\n \tcharacters are *ignorable* whitespace.\n \n+diff.wordRegexCheck::\n+\tPerform a simple sanity check on matches of the word regex.\n+\tCurrently this check ensures that the word regex matches all\n+\tnon-space characters, and that the word regex does not match a\n+\tnewline.  The setting controls what to do when the check\n+\tfails: 'false'/'off'/'ignore' ignore, 'true'/'on'/'warn' emit\n+\ta warning, and 'error' abort with an error message.\n+\n fetch.recurseSubmodules::\n \tA boolean value which changes the behavior for fetch and pull, the\n \tdefault is to not recursively fetch populated sumodules unless\ndiff --git a/diff.c b/diff.c\nindex 8758a51..becefcf 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -22,11 +22,17 @@\n #define FAST_WORKING_DIRECTORY 1\n #endif\n \n+#define REGEX_CHECK_UNSET -1\n+#define REGEX_CHECK_OFF 0\n+#define REGEX_CHECK_WARN 1\n+#define REGEX_CHECK_ERROR 2\n+\n static int diff_detect_rename_default;\n static int diff_rename_limit_default = 200;\n static int diff_suppress_blank_empty;\n int diff_use_color_default = -1;\n static const char *diff_word_regex_cfg;\n+static int diff_word_regex_check_cfg = REGEX_CHECK_UNSET;\n static const char *external_diff_cmd_cfg;\n int diff_auto_refresh_index = 1;\n static int diff_mnemonic_prefix;\n@@ -75,6 +81,19 @@ static int git_config_rename(const char *var, const char *value)\n \treturn git_config_bool(var,value) ? DIFF_DETECT_RENAME : 0;\n }\n \n+static int parse_regex_check_level(int *b, const char *k, const char *v)\n+{\n+\tif (v && !strcasecmp(v, \"ignore\"))\n+\t\t*b = REGEX_CHECK_OFF;\n+\telse if (v && !strcasecmp(v, \"warn\"))\n+\t\t*b = REGEX_CHECK_WARN;\n+\telse if (v && !strcasecmp(v, \"error\"))\n+\t\t*b = REGEX_CHECK_ERROR;\n+\telse\n+\t\t*b = git_config_bool(k, v);\n+\treturn 1;\n+}\n+\n /*\n  * These are to give UI layer defaults.\n  * The core-level commands such as git-diff-files should\n@@ -107,6 +126,8 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)\n \t\treturn git_config_string(&external_diff_cmd_cfg, var, value);\n \tif (!strcmp(var, \"diff.wordregex\"))\n \t\treturn git_config_string(&diff_word_regex_cfg, var, value);\n+\tif (!strcmp(var, \"diff.wordregexcheck\"))\n+\t\treturn parse_regex_check_level(&diff_word_regex_check_cfg, var, value);\n \n \tif (!strcmp(var, \"diff.ignoresubmodules\"))\n \t\thandle_ignore_submodules_arg(&default_diff_options, value);\n@@ -777,6 +798,50 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)\n \tdiff_words->last_minus = minus_first;\n }\n \n+\n+static void check_word_regex_match(struct diff_words_data *diff_words,\n+\t\tchar *start, int len, int unmatched)\n+{\n+\tint check = diff_words->opt->word_regex_check;\n+\tvoid (*report_fn)(const char *, ...);\n+\n+\tif (check == REGEX_CHECK_OFF)\n+\t\treturn;\n+\n+\tif (check == REGEX_CHECK_WARN)\n+\t\treport_fn = warning;\n+\telse if (check == REGEX_CHECK_ERROR)\n+\t\treport_fn = die;\n+\telse\n+\t\tassert(!\"expected REGEX_CHECK_WARN or _ERROR\");\n+\n+\tif (unmatched) {\n+\t\tint i;\n+\t\tchar *match_str;\n+\t\tfor (i = 0; i < len; i++) {\n+\t\t\tif (isspace(start[i]))\n+\t\t\t\tcontinue;\n+\t\t\tmatch_str = xmemdupz(start, len);\n+\t\t\treport_fn(\"The following snippet contains non-space \"\n+\t\t\t\t  \"characters, but was not\\nmatched by the \"\n+\t\t\t\t  \"word regex:\\n'%s'\\n\"\n+\t\t\t\t  \"They would be ignored for the purposes of \"\n+\t\t\t\t  \"the diff, which is\\nusually not what you want.\",\n+\t\t\t\t  match_str);\n+\t\t\tfree(match_str);\n+\t\t\tbreak;\n+\t\t}\n+\t} else {\n+\t\tif (memchr(start, '\\n', len)) {\n+\t\t\tchar *match_str = xmemdupz(start, len);\n+\t\t\treport_fn(\"The following word regex match contains a newline \"\n+\t\t\t\t  \"and will be truncated there:\\n'%s'\",\n+\t\t\t\t  match_str);\n+\t\t\tfree(match_str);\n+\t\t}\n+\t}\n+}\n+\n /* This function starts looking at *begin, and returns 0 iff a word was found. */\n static int find_word_boundaries(mmfile_t *buffer, struct diff_words_data *diff_words,\n \t\tint *begin, int *end)\n@@ -785,8 +850,15 @@ static int find_word_boundaries(mmfile_t *buffer, struct diff_words_data *diff_w\n \t\tregmatch_t match[1];\n \t\tif (!regexec(diff_words->word_regex, buffer->ptr + *begin,\n \t\t\t     1, match, 0)) {\n-\t\t\tchar *p = memchr(buffer->ptr + *begin + match[0].rm_so,\n-\t\t\t\t\t'\\n', match[0].rm_eo - match[0].rm_so);\n+\t\t\tchar *prev_start = buffer->ptr + *begin;\n+\t\t\tchar *match_start = prev_start + match[0].rm_so;\n+\t\t\tint match_len = match[0].rm_eo - match[0].rm_so;\n+\t\t\tchar *p;\n+\t\t\tcheck_word_regex_match(diff_words, prev_start,\n+\t\t\t\t\t       match_start-prev_start, 1);\n+\t\t\tcheck_word_regex_match(diff_words, match_start,\n+\t\t\t\t\t       match_len, 0);\n+\t\t\tp = memchr(match_start, '\\n', match_len);\n \t\t\t*end = p ? p - buffer->ptr : match[0].rm_eo + *begin;\n \t\t\t*begin += match[0].rm_so;\n \t\t\treturn *begin >= *end;\n@@ -829,7 +901,7 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,\n \n \tfor (i = 0; i < buffer->text.size; i++) {\n \t\tif (find_word_boundaries(&buffer->text, diff_words, &i, &j))\n-\t\t\treturn;\n+\t\t\tbreak;\n \n \t\t/* store original boundaries */\n \t\tALLOC_GROW(buffer->orig, buffer->orig_nr + 1,\n@@ -846,6 +918,11 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,\n \n \t\ti = j - 1;\n \t}\n+\n+\t/* no more boundaries, check any non-matched chunk remaining */\n+\tif (i < buffer->text.size)\n+\t\tcheck_word_regex_match(diff_words, buffer->text.ptr + i,\n+\t\t\t\t       buffer->text.size-i, 1);\n }\n \n /* this executes the word diff on the accumulated buffers */\n@@ -882,8 +959,8 @@ static void diff_words_show(struct diff_words_data *diff_words)\n \n \tmemset(&xpp, 0, sizeof(xpp));\n \tmemset(&xecfg, 0, sizeof(xecfg));\n-\tdiff_words_fill(&diff_words->minus, &minus, diff_words->word_regex);\n-\tdiff_words_fill(&diff_words->plus, &plus, diff_words->word_regex);\n+\tdiff_words_fill(&diff_words->minus, &minus, diff_words);\n+\tdiff_words_fill(&diff_words->plus, &plus, diff_words);\n \txpp.flags = 0;\n \t/* as only the hunk header will be parsed, we need a 0-context */\n \txecfg.ctxlen = 0;\n@@ -2021,6 +2098,10 @@ static void builtin_diff(const char *name_a,\n \t\t\t\to->word_regex = userdiff_word_regex(two);\n \t\t\tif (!o->word_regex)\n \t\t\t\to->word_regex = diff_word_regex_cfg;\n+\t\t\tif (o->word_regex_check == REGEX_CHECK_UNSET)\n+\t\t\t\to->word_regex_check = diff_word_regex_check_cfg;\n+\t\t\tif (o->word_regex_check == REGEX_CHECK_UNSET)\n+\t\t\t\to->word_regex_check = REGEX_CHECK_WARN;\n \t\t\tif (o->word_regex) {\n \t\t\t\tecbdata.diff_words->word_regex = (regex_t *)\n \t\t\t\t\txmalloc(sizeof(regex_t));\n@@ -2861,6 +2942,8 @@ void diff_setup(struct diff_options *options)\n \t\toptions->a_prefix = \"a/\";\n \t\toptions->b_prefix = \"b/\";\n \t}\n+\n+\toptions->word_regex_check = REGEX_CHECK_UNSET;\n }\n \n int diff_setup_done(struct diff_options *options)\ndiff --git a/diff.h b/diff.h\nindex 165f368..5f6a7be 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -123,6 +123,7 @@ struct diff_options {\n \tint stat_width;\n \tint stat_name_width;\n \tconst char *word_regex;\n+\tint word_regex_check;\n \tenum diff_words_type word_diff;\n \n \t/* this is set by diffcore for DIFF_FORMAT_PATCH */\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex 8096d8a..ebe72ce 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -8,7 +8,8 @@ test_expect_success setup '\n \n \tgit config diff.color.old red &&\n \tgit config diff.color.new green &&\n-\tgit config diff.color.func magenta\n+\tgit config diff.color.func magenta &&\n+\tgit config diff.wordRegexCheck off\n \n '\n \n@@ -331,4 +332,66 @@ test_expect_success '--word-diff=none' '\n \n '\n \n+echo abcd > pre\n+echo aXYd > post\n+\n+test_expect_success 'diff.wordRegexCheck=\"error\" catches nonspaces' '\n+\n+\tgit config diff.wordRegexCheck error &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\tgrep \"fatal.*contains non-space characters\" out\n+\n+'\n+\n+newline=\"\n+\"\n+\n+test_expect_success 'diff.wordRegexCheck=\"error\" catches newlines' '\n+\n+\tgit config diff.wordRegexCheck error &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\".|$newline\" pre post 2>out &&\n+\tgrep \"fatal.*contains a newline\" out\n+\n+'\n+\n+test_expect_success 'diff.wordRegexCheck=\"warn\" works' '\n+\n+\tgit config diff.wordRegexCheck warn &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\tgrep \"warning.*contains non-space characters\" out\n+\n+'\n+\n+test_expect_success 'diff.wordRegexCheck=\"ignore\" works' '\n+\n+\tgit config diff.wordRegexCheck ignore &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\t! grep \"contains non-space characters\" out\n+\n+'\n+\n+test_expect_success 'diff.wordRegexCheck=\"false\" is like \"ignore\"' '\n+\n+\tgit config diff.wordRegexCheck false &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\t! grep \"contains non-space characters\" out\n+\n+'\n+\n+test_expect_success 'diff.wordRegexCheck=\"true\" is like \"warn\"' '\n+\n+\tgit config diff.wordRegexCheck true &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\tgrep \"warning.*contains non-space characters\" out\n+\n+'\n+\n+test_expect_success 'diff.wordRegexCheck unset is like \"warn\"' '\n+\n+\tgit config --unset diff.wordRegexCheck &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\tgrep \"warning.*contains non-space characters\" out\n+\n+'\n+\n test_done\n-- \n1.7.3.3.807.g6ee1f\n"},{"id":"158184","messageId":"a6566faa303d37d3ec469c8fb2501be9094168c2.1292424926.git.trast@student.ethz.ch","threadId":"26077","inReplyTo":"cover.1292424926.git.trast@student.ethz.ch","subject":"[PATCH 3/4] userdiff: fix typo in ruby word regex","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-15T15:13:27Z","receivedAt":"2010-12-15T15:13:27Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"The regex had an unclosed ] that pretty much ruined the safeguard\nagainst not matching a non-space char.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n userdiff.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/userdiff.c b/userdiff.c\nindex f9e05b5..4d6433b 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -81,7 +81,7 @@\n \t \"(@|@@|\\\\$)?[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\\\?(\\\\\\\\C-)?(\\\\\\\\M-)?.\"\n \t \"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\\\.{1,3}|::|[!=]~\"\n-\t \"|[^[:space:]|[\\x80-\\xff]+\"),\n+\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n PATTERNS(\"bibtex\", \"(@[a-zA-Z]{1,}[ \\t]*\\\\{{0,1}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*).*$\",\n \t \"[={}\\\"]|[^={}\\\" \\t]+\"),\n PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n-- \n1.7.3.3.807.g6ee1f\n"},{"id":"158186","messageId":"43966a52d144d79d22c98a24cab53403537dfcac.1292424926.git.trast@student.ethz.ch","threadId":"26077","inReplyTo":"cover.1292424926.git.trast@student.ethz.ch","subject":"[PATCH 4/4] t4034: bulk verify builtin word regex sanity","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-15T15:13:28Z","receivedAt":"2010-12-15T15:13:28Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"The builtin word regexes should be tested with some simple examples\nagainst simple issues, like failing to match a non-space character.\n\nDo this in bulk.  Many of these patterns are a rather ad-hoc\ncombination of a few simple lines of code, so they can certainly be\nimproved.  However, they already unearthed a typo in the ruby pattern\n(previous commit).\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n t/t4034-diff-words.sh  |   20 ++++++++++++++++++++\n t/t4034/bibtex/expect  |   15 +++++++++++++++\n t/t4034/bibtex/post    |   10 ++++++++++\n t/t4034/bibtex/pre     |    9 +++++++++\n t/t4034/cpp/expect     |   10 ++++++++++\n t/t4034/cpp/post       |    5 +++++\n t/t4034/cpp/pre        |    4 ++++\n t/t4034/csharp/expect  |   12 ++++++++++++\n t/t4034/csharp/post    |    8 ++++++++\n t/t4034/csharp/pre     |    8 ++++++++\n t/t4034/fortran/expect |   12 ++++++++++++\n t/t4034/fortran/post   |    7 +++++++\n t/t4034/fortran/pre    |    7 +++++++\n t/t4034/html/expect    |    7 +++++++\n t/t4034/html/post      |    2 ++\n t/t4034/html/pre       |    2 ++\n t/t4034/java/expect    |   11 +++++++++++\n t/t4034/java/post      |    6 ++++++\n t/t4034/java/pre       |    6 ++++++\n t/t4034/objc/expect    |   11 +++++++++++\n t/t4034/objc/post      |    7 +++++++\n t/t4034/objc/pre       |    7 +++++++\n t/t4034/pascal/expect  |   12 ++++++++++++\n t/t4034/pascal/post    |    7 +++++++\n t/t4034/pascal/pre     |    7 +++++++\n t/t4034/php/expect     |    7 +++++++\n t/t4034/php/post       |    2 ++\n t/t4034/php/pre        |    2 ++\n t/t4034/python/expect  |    8 ++++++++\n t/t4034/python/post    |    3 +++\n t/t4034/python/pre     |    3 +++\n t/t4034/ruby/expect    |    7 +++++++\n t/t4034/ruby/post      |    2 ++\n t/t4034/ruby/pre       |    2 ++\n t/t4034/tex/expect     |    9 +++++++++\n t/t4034/tex/post       |    4 ++++\n t/t4034/tex/pre        |    4 ++++\n 37 files changed, 265 insertions(+), 0 deletions(-)\n create mode 100644 t/t4034/bibtex/expect\n create mode 100644 t/t4034/bibtex/post\n create mode 100644 t/t4034/bibtex/pre\n create mode 100644 t/t4034/cpp/expect\n create mode 100644 t/t4034/cpp/post\n create mode 100644 t/t4034/cpp/pre\n create mode 100644 t/t4034/csharp/expect\n create mode 100644 t/t4034/csharp/post\n create mode 100644 t/t4034/csharp/pre\n create mode 100644 t/t4034/fortran/expect\n create mode 100644 t/t4034/fortran/post\n create mode 100644 t/t4034/fortran/pre\n create mode 100644 t/t4034/html/expect\n create mode 100644 t/t4034/html/post\n create mode 100644 t/t4034/html/pre\n create mode 100644 t/t4034/java/expect\n create mode 100644 t/t4034/java/post\n create mode 100644 t/t4034/java/pre\n create mode 100644 t/t4034/objc/expect\n create mode 100644 t/t4034/objc/post\n create mode 100644 t/t4034/objc/pre\n create mode 100644 t/t4034/pascal/expect\n create mode 100644 t/t4034/pascal/post\n create mode 100644 t/t4034/pascal/pre\n create mode 100644 t/t4034/php/expect\n create mode 100644 t/t4034/php/post\n create mode 100644 t/t4034/php/pre\n create mode 100644 t/t4034/python/expect\n create mode 100644 t/t4034/python/post\n create mode 100644 t/t4034/python/pre\n create mode 100644 t/t4034/ruby/expect\n create mode 100644 t/t4034/ruby/post\n create mode 100644 t/t4034/ruby/pre\n create mode 100644 t/t4034/tex/expect\n create mode 100644 t/t4034/tex/post\n create mode 100644 t/t4034/tex/pre\n\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex ebe72ce..b085948 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -394,4 +394,24 @@ test_expect_success 'diff.wordRegexCheck unset is like \"warn\"' '\n \n '\n \n+test_expect_success 'set diff.wordRegexCheck=error for language tests' '\n+\n+\tgit config diff.wordRegexCheck error\n+\n+'\n+\n+word_diff_for_language () {\n+\tcp $TEST_DIRECTORY/t4034/$1/pre $TEST_DIRECTORY/t4034/$1/post \\\n+\t\t$TEST_DIRECTORY/t4034/$1/expect . &&\n+\techo \"* diff=$1\" > .gitattributes &&\n+\tword_diff --color-words\n+}\n+\n+for lang_dir in $TEST_DIRECTORY/t4034/*; do\n+\tlang=${lang_dir#$TEST_DIRECTORY/t4034/}\n+\ttest_expect_success \"diff driver '$lang' has sane word regex\" \"\n+\t\tword_diff_for_language $lang\n+\t\"\n+done\n+\n test_done\ndiff --git a/t/t4034/bibtex/expect b/t/t4034/bibtex/expect\nnew file mode 100644\nindex 0000000..a157774\n--- /dev/null\n+++ b/t/t4034/bibtex/expect\n@@ -0,0 +1,15 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 95cd55b..ddcba9b 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,9 +1,10 @@<RESET>\n+@article{aldous1987uie,<RESET>\n+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},<RESET>\n+  author={Aldous, <RED>D.<RESET><GREEN>David<RESET>},\n+  journal={Information Theory, IEEE Transactions on},<RESET>\n+  volume={<RED>33<RESET><GREEN>Bogus.<RESET>},\n+  number={<RED>2<RESET><GREEN>4<RESET>},\n+  pages={219--223},<RESET>\n+  year=<GREEN>1987,<RESET>\n+<GREEN>  note={This is in fact a rather funny read since ethernet works well in practice. The<RESET> {<RED>1987<RESET><GREEN>\\em pre} reference is the right one, however.<RESET>}<RED>,<RESET>\n+}<RESET>\ndiff --git a/t/t4034/bibtex/post b/t/t4034/bibtex/post\nnew file mode 100644\nindex 0000000..ddcba9b\n--- /dev/null\n+++ b/t/t4034/bibtex/post\n@@ -0,0 +1,10 @@\n+@article{aldous1987uie,\n+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},\n+  author={Aldous, David},\n+  journal={Information Theory, IEEE Transactions on},\n+  volume={Bogus.},\n+  number={4},\n+  pages={219--223},\n+  year=1987,\n+  note={This is in fact a rather funny read since ethernet works well in practice. The {\\em pre} reference is the right one, however.}\n+}\ndiff --git a/t/t4034/bibtex/pre b/t/t4034/bibtex/pre\nnew file mode 100644\nindex 0000000..95cd55b\n--- /dev/null\n+++ b/t/t4034/bibtex/pre\n@@ -0,0 +1,9 @@\n+@article{aldous1987uie,\n+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},\n+  author={Aldous, D.},\n+  journal={Information Theory, IEEE Transactions on},\n+  volume={33},\n+  number={2},\n+  pages={219--223},\n+  year={1987},\n+}\ndiff --git a/t/t4034/cpp/expect b/t/t4034/cpp/expect\nnew file mode 100644\nindex 0000000..e529842\n--- /dev/null\n+++ b/t/t4034/cpp/expect\n@@ -0,0 +1,10 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 5517c3c..17aa265 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,4 +1,5 @@<RESET>\n+class Foo : public Thing{\n+\tFoo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) {\n+\t\t<GREEN>bar(x);<RESET>\n+\t}\n+}<GREEN>;<RESET>\ndiff --git a/t/t4034/cpp/post b/t/t4034/cpp/post\nnew file mode 100644\nindex 0000000..17aa265\n--- /dev/null\n+++ b/t/t4034/cpp/post\n@@ -0,0 +1,5 @@\n+class Foo : public Thing{\n+\tFoo() : x(0&42) {\n+\t\tbar(x);\n+\t}\n+};\ndiff --git a/t/t4034/cpp/pre b/t/t4034/cpp/pre\nnew file mode 100644\nindex 0000000..5517c3c\n--- /dev/null\n+++ b/t/t4034/cpp/pre\n@@ -0,0 +1,4 @@\n+class Foo:public Thing{\n+\tFoo():x(0&&1){}\n+}\n+\ndiff --git a/t/t4034/csharp/expect b/t/t4034/csharp/expect\nnew file mode 100644\nindex 0000000..c8b6b8f\n--- /dev/null\n+++ b/t/t4034/csharp/expect\n@@ -0,0 +1,12 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 8ff9319..9869fa9 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -2,7 +2,7 @@<RESET> <RESET><MAGENTA>class Program<RESET>\n+{<RESET>\n+\tstatic void Main()<RESET>\n+\t{<RESET>\n+\t\tConsole.WriteLine(\"Hello, <GREEN>New<RESET> World!\");\n+\t\tint i = <RED>5<RESET><GREEN>5+0<RESET>;\n+\t}<RESET>\n+}<RESET>\ndiff --git a/t/t4034/csharp/post b/t/t4034/csharp/post\nnew file mode 100644\nindex 0000000..9869fa9\n--- /dev/null\n+++ b/t/t4034/csharp/post\n@@ -0,0 +1,8 @@\n+class Program\n+{\n+\tstatic void Main()\n+\t{\n+\t\tConsole.WriteLine(\"Hello, New World!\");\n+\t\tint i = 5+0;\n+\t}\n+}\ndiff --git a/t/t4034/csharp/pre b/t/t4034/csharp/pre\nnew file mode 100644\nindex 0000000..8ff9319\n--- /dev/null\n+++ b/t/t4034/csharp/pre\n@@ -0,0 +1,8 @@\n+class Program\n+{\n+\tstatic void Main()\n+\t{\n+\t\tConsole.WriteLine(\"Hello, World!\");\n+\t\tint i=5;\n+\t}\n+}\ndiff --git a/t/t4034/fortran/expect b/t/t4034/fortran/expect\nnew file mode 100644\nindex 0000000..5a25663\n--- /dev/null\n+++ b/t/t4034/fortran/expect\n@@ -0,0 +1,12 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 08b4e5a..fb7cb51 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,7 +1,7 @@<RESET>\n+program hello<RESET>\n+   print *, \"Hello World<RED>!<RESET><GREEN>?<RESET>\"\n+\n+   DO10I = 1,10<RESET>\n+   <RED>DO10I<RESET><GREEN>DO 10 I<RESET> = 1,10\n+   <RED>DO10I<RESET><GREEN>DO 1 0 I<RESET> = 1,10\n+end program hello<RESET>\ndiff --git a/t/t4034/fortran/post b/t/t4034/fortran/post\nnew file mode 100644\nindex 0000000..fb7cb51\n--- /dev/null\n+++ b/t/t4034/fortran/post\n@@ -0,0 +1,7 @@\n+program hello\n+   print *, \"Hello World?\"\n+\n+   DO10I = 1,10\n+   DO 10 I = 1,10\n+   DO 1 0 I = 1,10\n+end program hello\ndiff --git a/t/t4034/fortran/pre b/t/t4034/fortran/pre\nnew file mode 100644\nindex 0000000..08b4e5a\n--- /dev/null\n+++ b/t/t4034/fortran/pre\n@@ -0,0 +1,7 @@\n+program hello\n+   print *, \"Hello World!\"\n+\n+   DO10I = 1,10\n+   DO10I = 1,10\n+   DO10I = 1,10\n+end program hello\ndiff --git a/t/t4034/html/expect b/t/t4034/html/expect\nnew file mode 100644\nindex 0000000..78d28d4\n--- /dev/null\n+++ b/t/t4034/html/expect\n@@ -0,0 +1,7 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 8bf936a..125bdd5 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,2 +1,2 @@<RESET>\n+<li<RED>class=\"yws-maps\"<RESET>><em></em><a href=\"#\">yws-maps</a></li>\n+<li<RED>class=\"ydn-delicious\"<RESET>><em></em><a href=\"#\">ydn-delicious</a></li>\ndiff --git a/t/t4034/html/post b/t/t4034/html/post\nnew file mode 100644\nindex 0000000..125bdd5\n--- /dev/null\n+++ b/t/t4034/html/post\n@@ -0,0 +1,2 @@\n+<li><em></em><a href=\"#\">yws-maps</a></li>\n+<li><em></em><a href=\"#\">ydn-delicious</a></li>\ndiff --git a/t/t4034/html/pre b/t/t4034/html/pre\nnew file mode 100644\nindex 0000000..8bf936a\n--- /dev/null\n+++ b/t/t4034/html/pre\n@@ -0,0 +1,2 @@\n+<li class=\"yws-maps\"><em></em><a href=\"#\">yws-maps</a></li>\n+<li class=\"ydn-delicious\"><em></em><a href=\"#\">ydn-delicious</a></li>\ndiff --git a/t/t4034/java/expect b/t/t4034/java/expect\nnew file mode 100644\nindex 0000000..9d99523\n--- /dev/null\n+++ b/t/t4034/java/expect\n@@ -0,0 +1,11 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index ae11cd3..fd61213 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,6 +1,6 @@<RESET>\n+public class HelloWorld {<RESET>\n+   public static void main(String[] args) {<RESET>\n+       System.out.println(\"Hello <RED>,<RESET><GREEN>--<RESET> world!\");\n+       int i = <RED>1+2<RESET><GREEN>1 + 2<RESET>;\n+   }<RESET>\n+}<RESET>\ndiff --git a/t/t4034/java/post b/t/t4034/java/post\nnew file mode 100644\nindex 0000000..fd61213\n--- /dev/null\n+++ b/t/t4034/java/post\n@@ -0,0 +1,6 @@\n+public class HelloWorld {\n+   public static void main(String[] args) {\n+       System.out.println(\"Hello -- world!\");\n+       int i = 1 + 2;\n+   }\n+}\ndiff --git a/t/t4034/java/pre b/t/t4034/java/pre\nnew file mode 100644\nindex 0000000..ae11cd3\n--- /dev/null\n+++ b/t/t4034/java/pre\n@@ -0,0 +1,6 @@\n+public class HelloWorld {\n+   public static void main(String[] args) {\n+       System.out.println(\"Hello, world!\");\n+       int i = 1+2;\n+   }\n+}\ndiff --git a/t/t4034/objc/expect b/t/t4034/objc/expect\nnew file mode 100644\nindex 0000000..a29fec5\n--- /dev/null\n+++ b/t/t4034/objc/expect\n@@ -0,0 +1,11 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 8eb298d..e728a08 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -2,6 +2,6 @@<RESET>\n+ <RESET>\n+int main (void)<RESET>\n+{<RESET>\n+\tint i = <RED>1+2<RESET><GREEN>1 + 2<RESET>;\n+\tprintf (\"Hello<GREEN>, new<RESET> world!\\n\");\n+}<RESET>\ndiff --git a/t/t4034/objc/post b/t/t4034/objc/post\nnew file mode 100644\nindex 0000000..e728a08\n--- /dev/null\n+++ b/t/t4034/objc/post\n@@ -0,0 +1,7 @@\n+#import <stdio.h>\n+ \n+int main (void)\n+{\n+\tint i = 1 + 2;\n+\tprintf (\"Hello, new world!\\n\");\n+}\ndiff --git a/t/t4034/objc/pre b/t/t4034/objc/pre\nnew file mode 100644\nindex 0000000..8eb298d\n--- /dev/null\n+++ b/t/t4034/objc/pre\n@@ -0,0 +1,7 @@\n+#import <stdio.h>\n+ \n+int main (void)\n+{\n+\tint i = 1+2;\n+\tprintf (\"Hello world!\\n\");\n+}\ndiff --git a/t/t4034/pascal/expect b/t/t4034/pascal/expect\nnew file mode 100644\nindex 0000000..10953cf\n--- /dev/null\n+++ b/t/t4034/pascal/expect\n@@ -0,0 +1,12 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 7c5fbef..bdd5df9 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,7 +1,7 @@<RESET>\n+program HelloWorld;<RESET>\n+var<RESET>\n+   i : integer;\n+begin<RESET>\n+   i = i <RED>+1<RESET><GREEN>+ 1<RESET>;\n+   writeln('Hello<GREEN>, new<RESET> world!');\n+end.<RESET>\ndiff --git a/t/t4034/pascal/post b/t/t4034/pascal/post\nnew file mode 100644\nindex 0000000..bdd5df9\n--- /dev/null\n+++ b/t/t4034/pascal/post\n@@ -0,0 +1,7 @@\n+program HelloWorld;\n+var\n+   i : integer;\n+begin\n+   i = i + 1;\n+   writeln('Hello, new world!');\n+end.\ndiff --git a/t/t4034/pascal/pre b/t/t4034/pascal/pre\nnew file mode 100644\nindex 0000000..7c5fbef\n--- /dev/null\n+++ b/t/t4034/pascal/pre\n@@ -0,0 +1,7 @@\n+program HelloWorld;\n+var\n+   i: integer;\n+begin\n+   i = i+1;\n+   writeln('Hello world!');\n+end.\ndiff --git a/t/t4034/php/expect b/t/t4034/php/expect\nnew file mode 100644\nindex 0000000..171cfd5\n--- /dev/null\n+++ b/t/t4034/php/expect\n@@ -0,0 +1,7 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 646a13d..1b1fe22 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,2 +1,2 @@<RESET>\n+$i =<RED>$i+1<RESET><GREEN>CONSTANT + 1<RESET>;\n+echo \"Hello, <GREEN>New<RESET> World!\\n\";\ndiff --git a/t/t4034/php/post b/t/t4034/php/post\nnew file mode 100644\nindex 0000000..1b1fe22\n--- /dev/null\n+++ b/t/t4034/php/post\n@@ -0,0 +1,2 @@\n+$i =CONSTANT + 1;\n+echo \"Hello, New World!\\n\";\ndiff --git a/t/t4034/php/pre b/t/t4034/php/pre\nnew file mode 100644\nindex 0000000..646a13d\n--- /dev/null\n+++ b/t/t4034/php/pre\n@@ -0,0 +1,2 @@\n+$i=$i+1;\n+echo \"Hello, World!\\n\";\ndiff --git a/t/t4034/python/expect b/t/t4034/python/expect\nnew file mode 100644\nindex 0000000..bf6a30b\n--- /dev/null\n+++ b/t/t4034/python/expect\n@@ -0,0 +1,8 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 2261a37..1076af0 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,3 +1,3 @@<RESET>\n+<RED>foo.bar()<RESET><GREEN>foo . bar (stuff)<RESET>\n+i = <RED>i+1<RESET><GREEN>i + 1<RESET>\n+print \"Hello, <GREEN>New<RESET> World!\\n\"\ndiff --git a/t/t4034/python/post b/t/t4034/python/post\nnew file mode 100644\nindex 0000000..1076af0\n--- /dev/null\n+++ b/t/t4034/python/post\n@@ -0,0 +1,3 @@\n+foo . bar (stuff)\n+i = i + 1\n+print \"Hello, New World!\\n\"\ndiff --git a/t/t4034/python/pre b/t/t4034/python/pre\nnew file mode 100644\nindex 0000000..2261a37\n--- /dev/null\n+++ b/t/t4034/python/pre\n@@ -0,0 +1,3 @@\n+foo.bar()\n+i = i+1\n+print \"Hello, World!\\n\"\ndiff --git a/t/t4034/ruby/expect b/t/t4034/ruby/expect\nnew file mode 100644\nindex 0000000..72ff72b\n--- /dev/null\n+++ b/t/t4034/ruby/expect\n@@ -0,0 +1,7 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 1961e79..d954376 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,2 +1,2 @@<RESET>\n+10.downto(<RED>1<RESET><GREEN>2<RESET>) { |x| puts x }\n+puts 'Hello <GREEN>new<RESET> world'\ndiff --git a/t/t4034/ruby/post b/t/t4034/ruby/post\nnew file mode 100644\nindex 0000000..d954376\n--- /dev/null\n+++ b/t/t4034/ruby/post\n@@ -0,0 +1,2 @@\n+10.downto(2) { |x| puts x }\n+puts 'Hello new world'\ndiff --git a/t/t4034/ruby/pre b/t/t4034/ruby/pre\nnew file mode 100644\nindex 0000000..1961e79\n--- /dev/null\n+++ b/t/t4034/ruby/pre\n@@ -0,0 +1,2 @@\n+10.downto(1) {|x| puts x}\n+puts 'Hello world'\ndiff --git a/t/t4034/tex/expect b/t/t4034/tex/expect\nnew file mode 100644\nindex 0000000..604969b\n--- /dev/null\n+++ b/t/t4034/tex/expect\n@@ -0,0 +1,9 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 2b2dfcb..65cab61 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,4 +1,4 @@<RESET>\n+\\section{Something <GREEN>new<RESET>}\n+<RED>\\emph<RESET><GREEN>\\textbf<RESET>{Macro style}\n+{<RED>\\em<RESET><GREEN>\\bfseries<RESET> State toggle style}\n+\\\\[<RED>1em<RESET><GREEN>1cm<RESET>]\ndiff --git a/t/t4034/tex/post b/t/t4034/tex/post\nnew file mode 100644\nindex 0000000..65cab61\n--- /dev/null\n+++ b/t/t4034/tex/post\n@@ -0,0 +1,4 @@\n+\\section{Something new}\n+\\textbf{Macro style}\n+{\\bfseries State toggle style}\n+\\\\[1cm]\ndiff --git a/t/t4034/tex/pre b/t/t4034/tex/pre\nnew file mode 100644\nindex 0000000..2b2dfcb\n--- /dev/null\n+++ b/t/t4034/tex/pre\n@@ -0,0 +1,4 @@\n+\\section{Something}\n+\\emph{Macro style}\n+{\\em State toggle style}\n+\\\\[1em]\n-- \n1.7.3.3.807.g6ee1f\n"},{"id":"158192","messageId":"201012152051.15159.trast@student.ethz.ch","threadId":"26077","inReplyTo":"913156.57703.qm@web110711.mail.gq1.yahoo.com","subject":"Re: [PATCH 0/4] --word-regex sanity checking and such","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-15T19:51:14Z","receivedAt":"2010-12-15T19:51:14Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Scott Johnson wrote:\n> I've attached a pre and post with the complete file that is showing this \n> problem. I hope you'll be able to reproduce the issue with this.\n\nI can't reproduce.  I did this:\n\n  $ ls -l\n  total 16\n  -rw-r--r-- 1 thomas users 2128 2010-12-15 20:42 post.html\n  -rw-r--r-- 1 thomas users 2354 2010-12-15 20:42 pre.html\n  $ echo '*.html diff=html'  >.gitattributes\n  $ git diff --no-index pre.html post.html\n  diff --git 1/pre.html 2/post.html\n[...]\n  -        <li class=\"ydn-patterns\"><em></em><a href=\"#\">ydn-patterns</a></li>\n  -        <li class=\"ydn-mail\"><em></em><a href=\"#\">ydn-mail</a></li>\n  -        <li class=\"yws-maps\"><em></em><a href=\"#\">yws-maps</a></li>\n  -        <li class=\"ydn-delicious\"><em></em><a href=\"#\">ydn-delicious</a></li>\n  -        <li class=\"yws-flickr\"><em></em><a href=\"#\">yws-flickr</a></li>\n  -        <li class=\"yws-events\"><em></em><a href=\"#\">yws-events</a></li>\n  +        <li><em></em><a href=\"#\">ydn-patterns</a></li>\n  +        <li><em></em><a href=\"#\">ydn-mail</a></li>\n  +        <li><em></em><a href=\"#\">yws-maps</a></li>\n  +        <li><em></em><a href=\"#\">ydn-delicious</a></li>\n  +        <li><em></em><a href=\"#\">yws-flickr</a></li>\n  +        <li><em></em><a href=\"#\">yws-events</a></li>\n         </ul>\n       </div><!-- wrap -->\n     </div><!-- folder_list -->\n  $ git diff --word-diff --no-index pre.html post.html\n  diff --git 1/pre.html 2/post.html\n[...]\n          <li[-class=\"ydn-patterns\"-]><em></em><a href=\"#\">ydn-patterns</a></li>\n          <li[-class=\"ydn-mail\"-]><em></em><a href=\"#\">ydn-mail</a></li>\n          <li[-class=\"yws-maps\"-]><em></em><a href=\"#\">yws-maps</a></li>\n          <li[-class=\"ydn-delicious\"-]><em></em><a href=\"#\">ydn-delicious</a></li>\n          <li[-class=\"yws-flickr\"-]><em></em><a href=\"#\">yws-flickr</a></li>\n          <li[-class=\"yws-events\"-]><em></em><a href=\"#\">yws-events</a></li>\n        </ul>\n      </div><!-- wrap -->\n    </div><!-- folder_list -->\n\nThat's running bleeding-edge git, like I always do, but the userdiff\nstuff hasn't changed in ages.\n\nWhat does\n\n  git config diff.html.wordregex\n\nsay on your system?\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"158194","messageId":"254678.14296.qm@web110704.mail.gq1.yahoo.com","threadId":"26077","inReplyTo":"201012152051.15159.trast@student.ethz.ch","subject":"Re: [PATCH 0/4] --word-regex sanity checking and such","fromName":"Scott Johnson","fromEmail":"scottj75074@yahoo.com","sentAt":"2010-12-15T20:48:50Z","receivedAt":"2010-12-15T20:48:50Z","isPatch":true,"sender":{"key":"scottj75074@yahoo.com","avatar":null},"body":"Turns out to be system-dependent. I built v1.7.3.3 from source on three \ndifferent boxes and only one of them is broken.\n\n\nThe /etc/redhat-release shows:\n\nBroken:\nFedora Core release 6 (Zod)\n\nCorrect:\nRed Hat Enterprise Linux WS release 4 (Nahant Update 6)\nFedora release 9 (Sulphur)\n\nSo I guess that means the problem is in some library that has most likely been \nfixed since Fedora 6.\n\n\n\n----- Original Message ----\nFrom: Thomas Rast <trast@student.ethz.ch>\nTo: Scott Johnson <scottj75074@yahoo.com>\nCc: Michael J Gruber <git@drmicha.warpmail.net>; Matthijs Kooijman \n<matthijs@stdin.nl>; git@vger.kernel.org\nSent: Wed, December 15, 2010 11:51:14 AM\nSubject: Re: [PATCH 0/4] --word-regex sanity checking and such\n\nScott Johnson wrote:\n> I've attached a pre and post with the complete file that is showing this \n> problem. I hope you'll be able to reproduce the issue with this.\n\nI can't reproduce.  I did this:\n\n  $ ls -l\n  total 16\n  -rw-r--r-- 1 thomas users 2128 2010-12-15 20:42 post.html\n  -rw-r--r-- 1 thomas users 2354 2010-12-15 20:42 pre.html\n  $ echo '*.html diff=html'  >.gitattributes\n  $ git diff --no-index pre.html post.html\n  diff --git 1/pre.html 2/post.html\n[...]\n  -        <li class=\"ydn-patterns\"><em></em><a href=\"#\">ydn-patterns</a></li>\n  -        <li class=\"ydn-mail\"><em></em><a href=\"#\">ydn-mail</a></li>\n  -        <li class=\"yws-maps\"><em></em><a href=\"#\">yws-maps</a></li>\n  -        <li class=\"ydn-delicious\"><em></em><a href=\"#\">ydn-delicious</a></li>\n  -        <li class=\"yws-flickr\"><em></em><a href=\"#\">yws-flickr</a></li>\n  -        <li class=\"yws-events\"><em></em><a href=\"#\">yws-events</a></li>\n  +        <li><em></em><a href=\"#\">ydn-patterns</a></li>\n  +        <li><em></em><a href=\"#\">ydn-mail</a></li>\n  +        <li><em></em><a href=\"#\">yws-maps</a></li>\n  +        <li><em></em><a href=\"#\">ydn-delicious</a></li>\n  +        <li><em></em><a href=\"#\">yws-flickr</a></li>\n  +        <li><em></em><a href=\"#\">yws-events</a></li>\n         </ul>\n       </div><!-- wrap -->\n     </div><!-- folder_list -->\n  $ git diff --word-diff --no-index pre.html post.html\n  diff --git 1/pre.html 2/post.html\n[...]\n          <li[-class=\"ydn-patterns\"-]><em></em><a href=\"#\">ydn-patterns</a></li>\n          <li[-class=\"ydn-mail\"-]><em></em><a href=\"#\">ydn-mail</a></li>\n          <li[-class=\"yws-maps\"-]><em></em><a href=\"#\">yws-maps</a></li>\n          <li[-class=\"ydn-delicious\"-]><em></em><a \nhref=\"#\">ydn-delicious</a></li>\n          <li[-class=\"yws-flickr\"-]><em></em><a href=\"#\">yws-flickr</a></li>\n          <li[-class=\"yws-events\"-]><em></em><a href=\"#\">yws-events</a></li>\n        </ul>\n      </div><!-- wrap -->\n    </div><!-- folder_list -->\n\nThat's running bleeding-edge git, like I always do, but the userdiff\nstuff hasn't changed in ages.\n\nWhat does\n\n  git config diff.html.wordregex\n\nsay on your system?\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"158318","messageId":"cover.1292688058.git.trast@student.ethz.ch","threadId":"26077","inReplyTo":"254678.14296.qm@web110704.mail.gq1.yahoo.com","subject":"[PATCH v2 0/4] --word-regex sanity checking and such","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-18T16:17:50Z","receivedAt":"2010-12-18T16:17:50Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"I wrote:\n> * [4/4] I stole the html test from Scott's mail, and some of the rest\n>   from various Wikibooks sources on \"Hello World\" in each language,\n>   usually extended by a bit of code that tests the world-splitting\n>   power.  I hope this is ok with Scott and the Copyright overlords.\n>   There are only so many ways to spell \"Hello World\", and only so many\n>   languages I know myself.\n\nI decided to play it safe, and removed these parts.  In addition I\nextended the bulk tests to a C operator table and some forms of\nliterals for the C-style languages so as to catch issues with\nnon-matches.  This showed that the python regex had the same typo as\nthe ruby one. *blush*\n\nScott's problem still remains:\n\nScott Johnson wrote:\n> Turns out to be system-dependent. I built v1.7.3.3 from source on three \n> different boxes and only one of them is broken.\n[...]\n> Fedora Core release 6 (Zod)\n\nI briefly considered installing FC6 on a VM, but my VirtualBox is\nbroken and I'm having a hard time finding a FC6 installation medium.\nRight now the only other systems I have are darwin 10.5 and RHEL5.5,\nand the test works on both.\n\nSo in the absence of any way of testing this, someone with a breaking\nsystem will have to investigate.  I think it's worth including the\nseries anyway, since the regexes give wrong results in the case of\nmatch failures, and we would want users to know about this.\n\n\nThomas Rast (4):\n  diff.c: pass struct diff_words into find_word_boundaries\n  diff.c: implement a sanity check for word regexes\n  userdiff: fix typo in ruby and python word regexes\n  t4034: bulk verify builtin word regex sanity\n\n Documentation/config.txt |    8 ++++\n diff.c                   |  104 +++++++++++++++++++++++++++++++++++++++++----\n diff.h                   |    1 +\n t/t4034-diff-words.sh    |   85 +++++++++++++++++++++++++++++++++++++-\n t/t4034/bibtex/expect    |   15 +++++++\n t/t4034/bibtex/post      |   10 ++++\n t/t4034/bibtex/pre       |    9 ++++\n t/t4034/cpp/expect       |   36 ++++++++++++++++\n t/t4034/cpp/post         |   19 ++++++++\n t/t4034/cpp/pre          |   19 ++++++++\n t/t4034/csharp/expect    |   35 +++++++++++++++\n t/t4034/csharp/post      |   18 ++++++++\n t/t4034/csharp/pre       |   18 ++++++++\n t/t4034/fortran/expect   |   10 ++++\n t/t4034/fortran/post     |    5 ++\n t/t4034/fortran/pre      |    5 ++\n t/t4034/html/expect      |    8 ++++\n t/t4034/html/post        |    3 +\n t/t4034/html/pre         |    3 +\n t/t4034/java/expect      |   36 ++++++++++++++++\n t/t4034/java/post        |   19 ++++++++\n t/t4034/java/pre         |   19 ++++++++\n t/t4034/objc/expect      |   35 +++++++++++++++\n t/t4034/objc/post        |   18 ++++++++\n t/t4034/objc/pre         |   18 ++++++++\n t/t4034/pascal/expect    |   35 +++++++++++++++\n t/t4034/pascal/post      |   18 ++++++++\n t/t4034/pascal/pre       |   18 ++++++++\n t/t4034/php/expect       |   35 +++++++++++++++\n t/t4034/php/post         |   18 ++++++++\n t/t4034/php/pre          |   18 ++++++++\n t/t4034/python/expect    |   34 +++++++++++++++\n t/t4034/python/post      |   17 +++++++\n t/t4034/python/pre       |   17 +++++++\n t/t4034/ruby/expect      |   34 +++++++++++++++\n t/t4034/ruby/post        |   17 +++++++\n t/t4034/ruby/pre         |   17 +++++++\n t/t4034/tex/expect       |    9 ++++\n t/t4034/tex/post         |    4 ++\n t/t4034/tex/pre          |    4 ++\n userdiff.c               |    4 +-\n 41 files changed, 842 insertions(+), 13 deletions(-)\n create mode 100644 t/t4034/bibtex/expect\n create mode 100644 t/t4034/bibtex/post\n create mode 100644 t/t4034/bibtex/pre\n create mode 100644 t/t4034/cpp/expect\n create mode 100644 t/t4034/cpp/post\n create mode 100644 t/t4034/cpp/pre\n create mode 100644 t/t4034/csharp/expect\n create mode 100644 t/t4034/csharp/post\n create mode 100644 t/t4034/csharp/pre\n create mode 100644 t/t4034/fortran/expect\n create mode 100644 t/t4034/fortran/post\n create mode 100644 t/t4034/fortran/pre\n create mode 100644 t/t4034/html/expect\n create mode 100644 t/t4034/html/post\n create mode 100644 t/t4034/html/pre\n create mode 100644 t/t4034/java/expect\n create mode 100644 t/t4034/java/post\n create mode 100644 t/t4034/java/pre\n create mode 100644 t/t4034/objc/expect\n create mode 100644 t/t4034/objc/post\n create mode 100644 t/t4034/objc/pre\n create mode 100644 t/t4034/pascal/expect\n create mode 100644 t/t4034/pascal/post\n create mode 100644 t/t4034/pascal/pre\n create mode 100644 t/t4034/php/expect\n create mode 100644 t/t4034/php/post\n create mode 100644 t/t4034/php/pre\n create mode 100644 t/t4034/python/expect\n create mode 100644 t/t4034/python/post\n create mode 100644 t/t4034/python/pre\n create mode 100644 t/t4034/ruby/expect\n create mode 100644 t/t4034/ruby/post\n create mode 100644 t/t4034/ruby/pre\n create mode 100644 t/t4034/tex/expect\n create mode 100644 t/t4034/tex/post\n create mode 100644 t/t4034/tex/pre\n\n-- \n1.7.3.4.789.g74ad1\n"},{"id":"158321","messageId":"944a3f9ff6419115de6665f069eb87f5c81afd34.1292688058.git.trast@student.ethz.ch","threadId":"26077","inReplyTo":"cover.1292688058.git.trast@student.ethz.ch","subject":"[PATCH v2 1/4] diff.c: pass struct diff_words into find_word_boundaries","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-18T16:17:51Z","receivedAt":"2010-12-18T16:17:51Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"We need the word_regex_check member.  Instead of adding another\nargument, just pass in the whole struct for future extensibility.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n diff.c |   11 ++++++-----\n 1 files changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 0a43869..5fdcb15 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -778,12 +778,13 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)\n }\n \n /* This function starts looking at *begin, and returns 0 iff a word was found. */\n-static int find_word_boundaries(mmfile_t *buffer, regex_t *word_regex,\n+static int find_word_boundaries(mmfile_t *buffer, struct diff_words_data *diff_words,\n \t\tint *begin, int *end)\n {\n-\tif (word_regex && *begin < buffer->size) {\n+\tif (diff_words->word_regex && *begin < buffer->size) {\n \t\tregmatch_t match[1];\n-\t\tif (!regexec(word_regex, buffer->ptr + *begin, 1, match, 0)) {\n+\t\tif (!regexec(diff_words->word_regex, buffer->ptr + *begin,\n+\t\t\t     1, match, 0)) {\n \t\t\tchar *p = memchr(buffer->ptr + *begin + match[0].rm_so,\n \t\t\t\t\t'\\n', match[0].rm_eo - match[0].rm_so);\n \t\t\t*end = p ? p - buffer->ptr : match[0].rm_eo + *begin;\n@@ -813,7 +814,7 @@ static int find_word_boundaries(mmfile_t *buffer, regex_t *word_regex,\n  * in buffer->orig.\n  */\n static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,\n-\t\tregex_t *word_regex)\n+\t\tstruct diff_words_data *diff_words)\n {\n \tint i, j;\n \tlong alloc = 0;\n@@ -827,7 +828,7 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,\n \tbuffer->orig_nr = 1;\n \n \tfor (i = 0; i < buffer->text.size; i++) {\n-\t\tif (find_word_boundaries(&buffer->text, word_regex, &i, &j))\n+\t\tif (find_word_boundaries(&buffer->text, diff_words, &i, &j))\n \t\t\treturn;\n \n \t\t/* store original boundaries */\n-- \n1.7.3.4.789.g74ad1\n"},{"id":"158319","messageId":"ee3026bd997fc6d8508b8e5617e572f99c8bf3d6.1292688058.git.trast@student.ethz.ch","threadId":"26077","inReplyTo":"cover.1292688058.git.trast@student.ethz.ch","subject":"[PATCH v2 2/4] diff.c: implement a sanity check for word regexes","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-18T16:17:52Z","receivedAt":"2010-12-18T16:17:52Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Word regexes are a bit of a dangerous beast, since it is easily\npossible to not match a non-space part, which is subsequently ignored\nfor the purposes of emitting the word diff.  This was clearly stated\nin the docs, but users still tripped over it.\n\nImplement a safeguard that verifies two basic sanity assumptions:\n\n* The word regex matches anything that is !isspace().\n\n* The word regex does not match '\\n'.  (This case is not very harmful,\n  but we used to silently cut off at the '\\n' which may go against\n  user expectations.)\n\nThis is configurable via 'diff.wordRegexCheck', and defaults to\n'warn'.\n\nReported-by: Scott Johnson <scottj75074@yahoo.com>\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/config.txt |    8 ++++\n diff.c                   |   93 +++++++++++++++++++++++++++++++++++++++++++--\n diff.h                   |    1 +\n t/t4034-diff-words.sh    |   65 +++++++++++++++++++++++++++++++-\n 4 files changed, 161 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex bf9479e..2e033ea 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -897,6 +897,14 @@ diff.wordRegex::\n \tsequences that match the regular expression are \"words\", all other\n \tcharacters are *ignorable* whitespace.\n \n+diff.wordRegexCheck::\n+\tPerform a simple sanity check on matches of the word regex.\n+\tCurrently this check ensures that the word regex matches all\n+\tnon-space characters, and that the word regex does not match a\n+\tnewline.  The setting controls what to do when the check\n+\tfails: 'false'/'off'/'ignore' ignore, 'true'/'on'/'warn' emit\n+\ta warning, and 'error' abort with an error message.\n+\n fetch.recurseSubmodules::\n \tA boolean value which changes the behavior for fetch and pull, the\n \tdefault is to not recursively fetch populated sumodules unless\ndiff --git a/diff.c b/diff.c\nindex 5fdcb15..7213b2b 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -22,11 +22,17 @@\n #define FAST_WORKING_DIRECTORY 1\n #endif\n \n+#define REGEX_CHECK_UNSET -1\n+#define REGEX_CHECK_OFF 0\n+#define REGEX_CHECK_WARN 1\n+#define REGEX_CHECK_ERROR 2\n+\n static int diff_detect_rename_default;\n static int diff_rename_limit_default = 200;\n static int diff_suppress_blank_empty;\n int diff_use_color_default = -1;\n static const char *diff_word_regex_cfg;\n+static int diff_word_regex_check_cfg = REGEX_CHECK_UNSET;\n static const char *external_diff_cmd_cfg;\n int diff_auto_refresh_index = 1;\n static int diff_mnemonic_prefix;\n@@ -75,6 +81,19 @@ static int git_config_rename(const char *var, const char *value)\n \treturn git_config_bool(var,value) ? DIFF_DETECT_RENAME : 0;\n }\n \n+static int parse_regex_check_level(int *b, const char *k, const char *v)\n+{\n+\tif (v && !strcasecmp(v, \"ignore\"))\n+\t\t*b = REGEX_CHECK_OFF;\n+\telse if (v && !strcasecmp(v, \"warn\"))\n+\t\t*b = REGEX_CHECK_WARN;\n+\telse if (v && !strcasecmp(v, \"error\"))\n+\t\t*b = REGEX_CHECK_ERROR;\n+\telse\n+\t\t*b = git_config_bool(k, v);\n+\treturn 1;\n+}\n+\n /*\n  * These are to give UI layer defaults.\n  * The core-level commands such as git-diff-files should\n@@ -107,6 +126,8 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)\n \t\treturn git_config_string(&external_diff_cmd_cfg, var, value);\n \tif (!strcmp(var, \"diff.wordregex\"))\n \t\treturn git_config_string(&diff_word_regex_cfg, var, value);\n+\tif (!strcmp(var, \"diff.wordregexcheck\"))\n+\t\treturn parse_regex_check_level(&diff_word_regex_check_cfg, var, value);\n \n \tif (!strcmp(var, \"diff.ignoresubmodules\"))\n \t\thandle_ignore_submodules_arg(&default_diff_options, value);\n@@ -777,6 +798,50 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)\n \tdiff_words->last_minus = minus_first;\n }\n \n+\n+static void check_word_regex_match(struct diff_words_data *diff_words,\n+\t\tchar *start, int len, int unmatched)\n+{\n+\tint check = diff_words->opt->word_regex_check;\n+\tvoid (*report_fn)(const char *, ...);\n+\n+\tif (check == REGEX_CHECK_OFF)\n+\t\treturn;\n+\n+\tif (check == REGEX_CHECK_WARN)\n+\t\treport_fn = warning;\n+\telse if (check == REGEX_CHECK_ERROR)\n+\t\treport_fn = die;\n+\telse\n+\t\tassert(!\"expected REGEX_CHECK_WARN or _ERROR\");\n+\n+\tif (unmatched) {\n+\t\tint i;\n+\t\tchar *match_str;\n+\t\tfor (i = 0; i < len; i++) {\n+\t\t\tif (isspace(start[i]))\n+\t\t\t\tcontinue;\n+\t\t\tmatch_str = xmemdupz(start, len);\n+\t\t\treport_fn(\"The following snippet contains non-space \"\n+\t\t\t\t  \"characters, but was not\\nmatched by the \"\n+\t\t\t\t  \"word regex:\\n'%s'\\n\"\n+\t\t\t\t  \"They would be ignored for the purposes of \"\n+\t\t\t\t  \"the diff, which is\\nusually not what you want.\",\n+\t\t\t\t  match_str);\n+\t\t\tfree(match_str);\n+\t\t\tbreak;\n+\t\t}\n+\t} else {\n+\t\tif (memchr(start, '\\n', len)) {\n+\t\t\tchar *match_str = xmemdupz(start, len);\n+\t\t\treport_fn(\"The following word regex match contains a newline \"\n+\t\t\t\t  \"and will be truncated there:\\n'%s'\",\n+\t\t\t\t  match_str);\n+\t\t\tfree(match_str);\n+\t\t}\n+\t}\n+}\n+\n /* This function starts looking at *begin, and returns 0 iff a word was found. */\n static int find_word_boundaries(mmfile_t *buffer, struct diff_words_data *diff_words,\n \t\tint *begin, int *end)\n@@ -785,8 +850,15 @@ static int find_word_boundaries(mmfile_t *buffer, struct diff_words_data *diff_w\n \t\tregmatch_t match[1];\n \t\tif (!regexec(diff_words->word_regex, buffer->ptr + *begin,\n \t\t\t     1, match, 0)) {\n-\t\t\tchar *p = memchr(buffer->ptr + *begin + match[0].rm_so,\n-\t\t\t\t\t'\\n', match[0].rm_eo - match[0].rm_so);\n+\t\t\tchar *prev_start = buffer->ptr + *begin;\n+\t\t\tchar *match_start = prev_start + match[0].rm_so;\n+\t\t\tint match_len = match[0].rm_eo - match[0].rm_so;\n+\t\t\tchar *p;\n+\t\t\tcheck_word_regex_match(diff_words, prev_start,\n+\t\t\t\t\t       match_start-prev_start, 1);\n+\t\t\tcheck_word_regex_match(diff_words, match_start,\n+\t\t\t\t\t       match_len, 0);\n+\t\t\tp = memchr(match_start, '\\n', match_len);\n \t\t\t*end = p ? p - buffer->ptr : match[0].rm_eo + *begin;\n \t\t\t*begin += match[0].rm_so;\n \t\t\treturn *begin >= *end;\n@@ -829,7 +901,7 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,\n \n \tfor (i = 0; i < buffer->text.size; i++) {\n \t\tif (find_word_boundaries(&buffer->text, diff_words, &i, &j))\n-\t\t\treturn;\n+\t\t\tbreak;\n \n \t\t/* store original boundaries */\n \t\tALLOC_GROW(buffer->orig, buffer->orig_nr + 1,\n@@ -846,6 +918,11 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,\n \n \t\ti = j - 1;\n \t}\n+\n+\t/* no more boundaries, check any non-matched chunk remaining */\n+\tif (i < buffer->text.size)\n+\t\tcheck_word_regex_match(diff_words, buffer->text.ptr + i,\n+\t\t\t\t       buffer->text.size-i, 1);\n }\n \n /* this executes the word diff on the accumulated buffers */\n@@ -882,8 +959,8 @@ static void diff_words_show(struct diff_words_data *diff_words)\n \n \tmemset(&xpp, 0, sizeof(xpp));\n \tmemset(&xecfg, 0, sizeof(xecfg));\n-\tdiff_words_fill(&diff_words->minus, &minus, diff_words->word_regex);\n-\tdiff_words_fill(&diff_words->plus, &plus, diff_words->word_regex);\n+\tdiff_words_fill(&diff_words->minus, &minus, diff_words);\n+\tdiff_words_fill(&diff_words->plus, &plus, diff_words);\n \txpp.flags = 0;\n \t/* as only the hunk header will be parsed, we need a 0-context */\n \txecfg.ctxlen = 0;\n@@ -2021,6 +2098,10 @@ static void builtin_diff(const char *name_a,\n \t\t\t\to->word_regex = userdiff_word_regex(two);\n \t\t\tif (!o->word_regex)\n \t\t\t\to->word_regex = diff_word_regex_cfg;\n+\t\t\tif (o->word_regex_check == REGEX_CHECK_UNSET)\n+\t\t\t\to->word_regex_check = diff_word_regex_check_cfg;\n+\t\t\tif (o->word_regex_check == REGEX_CHECK_UNSET)\n+\t\t\t\to->word_regex_check = REGEX_CHECK_WARN;\n \t\t\tif (o->word_regex) {\n \t\t\t\tecbdata.diff_words->word_regex = (regex_t *)\n \t\t\t\t\txmalloc(sizeof(regex_t));\n@@ -2861,6 +2942,8 @@ void diff_setup(struct diff_options *options)\n \t\toptions->a_prefix = \"a/\";\n \t\toptions->b_prefix = \"b/\";\n \t}\n+\n+\toptions->word_regex_check = REGEX_CHECK_UNSET;\n }\n \n int diff_setup_done(struct diff_options *options)\ndiff --git a/diff.h b/diff.h\nindex 0083d92..4d02981 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -122,6 +122,7 @@ struct diff_options {\n \tint stat_width;\n \tint stat_name_width;\n \tconst char *word_regex;\n+\tint word_regex_check;\n \tenum diff_words_type word_diff;\n \n \t/* this is set by diffcore for DIFF_FORMAT_PATCH */\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex 8096d8a..ebe72ce 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -8,7 +8,8 @@ test_expect_success setup '\n \n \tgit config diff.color.old red &&\n \tgit config diff.color.new green &&\n-\tgit config diff.color.func magenta\n+\tgit config diff.color.func magenta &&\n+\tgit config diff.wordRegexCheck off\n \n '\n \n@@ -331,4 +332,66 @@ test_expect_success '--word-diff=none' '\n \n '\n \n+echo abcd > pre\n+echo aXYd > post\n+\n+test_expect_success 'diff.wordRegexCheck=\"error\" catches nonspaces' '\n+\n+\tgit config diff.wordRegexCheck error &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\tgrep \"fatal.*contains non-space characters\" out\n+\n+'\n+\n+newline=\"\n+\"\n+\n+test_expect_success 'diff.wordRegexCheck=\"error\" catches newlines' '\n+\n+\tgit config diff.wordRegexCheck error &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\".|$newline\" pre post 2>out &&\n+\tgrep \"fatal.*contains a newline\" out\n+\n+'\n+\n+test_expect_success 'diff.wordRegexCheck=\"warn\" works' '\n+\n+\tgit config diff.wordRegexCheck warn &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\tgrep \"warning.*contains non-space characters\" out\n+\n+'\n+\n+test_expect_success 'diff.wordRegexCheck=\"ignore\" works' '\n+\n+\tgit config diff.wordRegexCheck ignore &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\t! grep \"contains non-space characters\" out\n+\n+'\n+\n+test_expect_success 'diff.wordRegexCheck=\"false\" is like \"ignore\"' '\n+\n+\tgit config diff.wordRegexCheck false &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\t! grep \"contains non-space characters\" out\n+\n+'\n+\n+test_expect_success 'diff.wordRegexCheck=\"true\" is like \"warn\"' '\n+\n+\tgit config diff.wordRegexCheck true &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\tgrep \"warning.*contains non-space characters\" out\n+\n+'\n+\n+test_expect_success 'diff.wordRegexCheck unset is like \"warn\"' '\n+\n+\tgit config --unset diff.wordRegexCheck &&\n+\ttest_must_fail git diff --no-index --word-diff-regex=\"a|d\" pre post 2>out &&\n+\tgrep \"warning.*contains non-space characters\" out\n+\n+'\n+\n test_done\n-- \n1.7.3.4.789.g74ad1\n"},{"id":"158320","messageId":"a358c476187b1220bf6e2368c0723cefe60a5763.1292688058.git.trast@student.ethz.ch","threadId":"26077","inReplyTo":"cover.1292688058.git.trast@student.ethz.ch","subject":"[PATCH v2 3/4] userdiff: fix typo in ruby and python word regexes","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-18T16:17:53Z","receivedAt":"2010-12-18T16:17:53Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Both had an unclosed ] that ruined the safeguard against not matching\na non-space char.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n userdiff.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/userdiff.c b/userdiff.c\nindex f9e05b5..2d54536 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -74,14 +74,14 @@\n \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?\"\n \t \"|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\\\*\\\\*=?\"\n-\t \"|[^[:space:]|[\\x80-\\xff]+\"),\n+\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n \t /* -- */\n PATTERNS(\"ruby\", \"^[ \\t]*((class|module|def)[ \\t].*)$\",\n \t /* -- */\n \t \"(@|@@|\\\\$)?[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\\\?(\\\\\\\\C-)?(\\\\\\\\M-)?.\"\n \t \"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\\\.{1,3}|::|[!=]~\"\n-\t \"|[^[:space:]|[\\x80-\\xff]+\"),\n+\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n PATTERNS(\"bibtex\", \"(@[a-zA-Z]{1,}[ \\t]*\\\\{{0,1}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*).*$\",\n \t \"[={}\\\"]|[^={}\\\" \\t]+\"),\n PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n-- \n1.7.3.4.789.g74ad1\n"},{"id":"158322","messageId":"854c8b6fa8a368bb34cc22d3fc948ae7136ed177.1292688058.git.trast@student.ethz.ch","threadId":"26077","inReplyTo":"cover.1292688058.git.trast@student.ethz.ch","subject":"[PATCH v2 4/4] t4034: bulk verify builtin word regex sanity","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-18T16:17:54Z","receivedAt":"2010-12-18T16:17:54Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"The builtin word regexes should be tested with some simple examples\nagainst simple issues, like failing to match a non-space character.\nDo this in bulk.\n\nMainly due to a lack of language knowledge and inspiration, most of\nthe test cases (cpp, csharp, java, objc, pascal, php, python, ruby)\nare directly based off a C operator precedence table to verify that\nall operators are split correctly.  This means that they are probably\nincomplete or inaccurate except for 'cpp' itself.\n\nStill, they are good enough to already have uncovered a typo in the\npython and ruby patterns.\n\n'fortran' is based on my anecdotal knowledge of the DO10I parsing\nrules, and thus probably useless.  The rest (bibtex, html, tex) are an\nad-hoc test of what I consider important splits in those languages.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n t/t4034-diff-words.sh  |   20 ++++++++++++++++++++\n t/t4034/bibtex/expect  |   15 +++++++++++++++\n t/t4034/bibtex/post    |   10 ++++++++++\n t/t4034/bibtex/pre     |    9 +++++++++\n t/t4034/cpp/expect     |   36 ++++++++++++++++++++++++++++++++++++\n t/t4034/cpp/post       |   19 +++++++++++++++++++\n t/t4034/cpp/pre        |   19 +++++++++++++++++++\n t/t4034/csharp/expect  |   35 +++++++++++++++++++++++++++++++++++\n t/t4034/csharp/post    |   18 ++++++++++++++++++\n t/t4034/csharp/pre     |   18 ++++++++++++++++++\n t/t4034/fortran/expect |   10 ++++++++++\n t/t4034/fortran/post   |    5 +++++\n t/t4034/fortran/pre    |    5 +++++\n t/t4034/html/expect    |    8 ++++++++\n t/t4034/html/post      |    3 +++\n t/t4034/html/pre       |    3 +++\n t/t4034/java/expect    |   36 ++++++++++++++++++++++++++++++++++++\n t/t4034/java/post      |   19 +++++++++++++++++++\n t/t4034/java/pre       |   19 +++++++++++++++++++\n t/t4034/objc/expect    |   35 +++++++++++++++++++++++++++++++++++\n t/t4034/objc/post      |   18 ++++++++++++++++++\n t/t4034/objc/pre       |   18 ++++++++++++++++++\n t/t4034/pascal/expect  |   35 +++++++++++++++++++++++++++++++++++\n t/t4034/pascal/post    |   18 ++++++++++++++++++\n t/t4034/pascal/pre     |   18 ++++++++++++++++++\n t/t4034/php/expect     |   35 +++++++++++++++++++++++++++++++++++\n t/t4034/php/post       |   18 ++++++++++++++++++\n t/t4034/php/pre        |   18 ++++++++++++++++++\n t/t4034/python/expect  |   34 ++++++++++++++++++++++++++++++++++\n t/t4034/python/post    |   17 +++++++++++++++++\n t/t4034/python/pre     |   17 +++++++++++++++++\n t/t4034/ruby/expect    |   34 ++++++++++++++++++++++++++++++++++\n t/t4034/ruby/post      |   17 +++++++++++++++++\n t/t4034/ruby/pre       |   17 +++++++++++++++++\n t/t4034/tex/expect     |    9 +++++++++\n t/t4034/tex/post       |    4 ++++\n t/t4034/tex/pre        |    4 ++++\n 37 files changed, 673 insertions(+), 0 deletions(-)\n create mode 100644 t/t4034/bibtex/expect\n create mode 100644 t/t4034/bibtex/post\n create mode 100644 t/t4034/bibtex/pre\n create mode 100644 t/t4034/cpp/expect\n create mode 100644 t/t4034/cpp/post\n create mode 100644 t/t4034/cpp/pre\n create mode 100644 t/t4034/csharp/expect\n create mode 100644 t/t4034/csharp/post\n create mode 100644 t/t4034/csharp/pre\n create mode 100644 t/t4034/fortran/expect\n create mode 100644 t/t4034/fortran/post\n create mode 100644 t/t4034/fortran/pre\n create mode 100644 t/t4034/html/expect\n create mode 100644 t/t4034/html/post\n create mode 100644 t/t4034/html/pre\n create mode 100644 t/t4034/java/expect\n create mode 100644 t/t4034/java/post\n create mode 100644 t/t4034/java/pre\n create mode 100644 t/t4034/objc/expect\n create mode 100644 t/t4034/objc/post\n create mode 100644 t/t4034/objc/pre\n create mode 100644 t/t4034/pascal/expect\n create mode 100644 t/t4034/pascal/post\n create mode 100644 t/t4034/pascal/pre\n create mode 100644 t/t4034/php/expect\n create mode 100644 t/t4034/php/post\n create mode 100644 t/t4034/php/pre\n create mode 100644 t/t4034/python/expect\n create mode 100644 t/t4034/python/post\n create mode 100644 t/t4034/python/pre\n create mode 100644 t/t4034/ruby/expect\n create mode 100644 t/t4034/ruby/post\n create mode 100644 t/t4034/ruby/pre\n create mode 100644 t/t4034/tex/expect\n create mode 100644 t/t4034/tex/post\n create mode 100644 t/t4034/tex/pre\n\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex ebe72ce..c537116 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -394,4 +394,24 @@ test_expect_success 'diff.wordRegexCheck unset is like \"warn\"' '\n \n '\n \n+test_expect_success 'set diff.wordRegexCheck=error for language tests' '\n+\n+\tgit config diff.wordRegexCheck error\n+\n+'\n+\n+word_diff_for_language () {\n+\tcp $TEST_DIRECTORY/t4034/$1/pre $TEST_DIRECTORY/t4034/$1/post \\\n+\t\t$TEST_DIRECTORY/t4034/$1/expect . &&\n+\techo \"* diff=$1\" > .gitattributes &&\n+\tword_diff --color-words && cp output output.$1\n+}\n+\n+for lang_dir in $TEST_DIRECTORY/t4034/*; do\n+\tlang=${lang_dir#$TEST_DIRECTORY/t4034/}\n+\ttest_expect_success \"diff driver '$lang' has sane word regex\" \"\n+\t\tword_diff_for_language $lang\n+\t\"\n+done\n+\n test_done\ndiff --git a/t/t4034/bibtex/expect b/t/t4034/bibtex/expect\nnew file mode 100644\nindex 0000000..a157774\n--- /dev/null\n+++ b/t/t4034/bibtex/expect\n@@ -0,0 +1,15 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 95cd55b..ddcba9b 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,9 +1,10 @@<RESET>\n+@article{aldous1987uie,<RESET>\n+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},<RESET>\n+  author={Aldous, <RED>D.<RESET><GREEN>David<RESET>},\n+  journal={Information Theory, IEEE Transactions on},<RESET>\n+  volume={<RED>33<RESET><GREEN>Bogus.<RESET>},\n+  number={<RED>2<RESET><GREEN>4<RESET>},\n+  pages={219--223},<RESET>\n+  year=<GREEN>1987,<RESET>\n+<GREEN>  note={This is in fact a rather funny read since ethernet works well in practice. The<RESET> {<RED>1987<RESET><GREEN>\\em pre} reference is the right one, however.<RESET>}<RED>,<RESET>\n+}<RESET>\ndiff --git a/t/t4034/bibtex/post b/t/t4034/bibtex/post\nnew file mode 100644\nindex 0000000..ddcba9b\n--- /dev/null\n+++ b/t/t4034/bibtex/post\n@@ -0,0 +1,10 @@\n+@article{aldous1987uie,\n+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},\n+  author={Aldous, David},\n+  journal={Information Theory, IEEE Transactions on},\n+  volume={Bogus.},\n+  number={4},\n+  pages={219--223},\n+  year=1987,\n+  note={This is in fact a rather funny read since ethernet works well in practice. The {\\em pre} reference is the right one, however.}\n+}\ndiff --git a/t/t4034/bibtex/pre b/t/t4034/bibtex/pre\nnew file mode 100644\nindex 0000000..95cd55b\n--- /dev/null\n+++ b/t/t4034/bibtex/pre\n@@ -0,0 +1,9 @@\n+@article{aldous1987uie,\n+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},\n+  author={Aldous, D.},\n+  journal={Information Theory, IEEE Transactions on},\n+  volume={33},\n+  number={2},\n+  pages={219--223},\n+  year={1987},\n+}\ndiff --git a/t/t4034/cpp/expect b/t/t4034/cpp/expect\nnew file mode 100644\nindex 0000000..37d1ea2\n--- /dev/null\n+++ b/t/t4034/cpp/expect\n@@ -0,0 +1,36 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 23d5c8a..7e8c026 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,19 +1,19 @@<RESET>\n+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }\n+cout<<\"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<<endl;\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\n+<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>\ndiff --git a/t/t4034/cpp/post b/t/t4034/cpp/post\nnew file mode 100644\nindex 0000000..7e8c026\n--- /dev/null\n+++ b/t/t4034/cpp/post\n@@ -0,0 +1,19 @@\n+Foo() : x(0&42) { bar(x); }\n+cout<<\"Hello World?\\n\"<<endl;\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\n+x::y\ndiff --git a/t/t4034/cpp/pre b/t/t4034/cpp/pre\nnew file mode 100644\nindex 0000000..23d5c8a\n--- /dev/null\n+++ b/t/t4034/cpp/pre\n@@ -0,0 +1,19 @@\n+Foo():x(0&&1){}\n+cout<<\"Hello World!\\n\"<<endl;\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\n+a::b\ndiff --git a/t/t4034/csharp/expect b/t/t4034/csharp/expect\nnew file mode 100644\nindex 0000000..e5d1dd2\n--- /dev/null\n+++ b/t/t4034/csharp/expect\n@@ -0,0 +1,35 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 9106d63..dd5f421 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,18 +1,18 @@<RESET>\n+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }\n+cout<<\"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<<endl;\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/csharp/post b/t/t4034/csharp/post\nnew file mode 100644\nindex 0000000..dd5f421\n--- /dev/null\n+++ b/t/t4034/csharp/post\n@@ -0,0 +1,18 @@\n+Foo() : x(0&42) { bar(x); }\n+cout<<\"Hello World?\\n\"<<endl;\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/csharp/pre b/t/t4034/csharp/pre\nnew file mode 100644\nindex 0000000..9106d63\n--- /dev/null\n+++ b/t/t4034/csharp/pre\n@@ -0,0 +1,18 @@\n+Foo():x(0&&1){}\n+cout<<\"Hello World!\\n\"<<endl;\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\ndiff --git a/t/t4034/fortran/expect b/t/t4034/fortran/expect\nnew file mode 100644\nindex 0000000..b233dbd\n--- /dev/null\n+++ b/t/t4034/fortran/expect\n@@ -0,0 +1,10 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 87f0d0b..d308da2 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,5 +1,5 @@<RESET>\n+print *, \"Hello World<RED>!<RESET><GREEN>?<RESET>\"\n+\n+DO10I = 1,10<RESET>\n+<RED>DO10I<RESET><GREEN>DO 10 I<RESET> = 1,10\n+<RED>DO10I<RESET><GREEN>DO 1 0 I<RESET> = 1,10\ndiff --git a/t/t4034/fortran/post b/t/t4034/fortran/post\nnew file mode 100644\nindex 0000000..d308da2\n--- /dev/null\n+++ b/t/t4034/fortran/post\n@@ -0,0 +1,5 @@\n+print *, \"Hello World?\"\n+\n+DO10I = 1,10\n+DO 10 I = 1,10\n+DO 1 0 I = 1,10\ndiff --git a/t/t4034/fortran/pre b/t/t4034/fortran/pre\nnew file mode 100644\nindex 0000000..87f0d0b\n--- /dev/null\n+++ b/t/t4034/fortran/pre\n@@ -0,0 +1,5 @@\n+print *, \"Hello World!\"\n+\n+DO10I = 1,10\n+DO10I = 1,10\n+DO10I = 1,10\ndiff --git a/t/t4034/html/expect b/t/t4034/html/expect\nnew file mode 100644\nindex 0000000..447b49a\n--- /dev/null\n+++ b/t/t4034/html/expect\n@@ -0,0 +1,8 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 8ca4aea..46921e5 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,3 +1,3 @@<RESET>\n+<tag <GREEN>newattr=\"newvalue\"<RESET>><GREEN>added<RESET> content</tag>\n+<tag attr=<RED>\"value\"<RESET><GREEN>\"newvalue\"<RESET>><RED>content<RESET><GREEN>changed<RESET></tag>\n+<<RED>tag<RESET><GREEN>newtag<RESET>>content <RED>&entity;<RESET><GREEN>&newentity;<RESET><<RED>/tag<RESET><GREEN>/newtag<RESET>>\ndiff --git a/t/t4034/html/post b/t/t4034/html/post\nnew file mode 100644\nindex 0000000..46921e5\n--- /dev/null\n+++ b/t/t4034/html/post\n@@ -0,0 +1,3 @@\n+<tag newattr=\"newvalue\">added content</tag>\n+<tag attr=\"newvalue\">changed</tag>\n+<newtag>content &newentity;</newtag>\ndiff --git a/t/t4034/html/pre b/t/t4034/html/pre\nnew file mode 100644\nindex 0000000..8ca4aea\n--- /dev/null\n+++ b/t/t4034/html/pre\n@@ -0,0 +1,3 @@\n+<tag>content</tag>\n+<tag attr=\"value\">content</tag>\n+<tag>content &entity;</tag>\ndiff --git a/t/t4034/java/expect b/t/t4034/java/expect\nnew file mode 100644\nindex 0000000..37d1ea2\n--- /dev/null\n+++ b/t/t4034/java/expect\n@@ -0,0 +1,36 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 23d5c8a..7e8c026 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,19 +1,19 @@<RESET>\n+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }\n+cout<<\"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<<endl;\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\n+<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>\ndiff --git a/t/t4034/java/post b/t/t4034/java/post\nnew file mode 100644\nindex 0000000..7e8c026\n--- /dev/null\n+++ b/t/t4034/java/post\n@@ -0,0 +1,19 @@\n+Foo() : x(0&42) { bar(x); }\n+cout<<\"Hello World?\\n\"<<endl;\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\n+x::y\ndiff --git a/t/t4034/java/pre b/t/t4034/java/pre\nnew file mode 100644\nindex 0000000..23d5c8a\n--- /dev/null\n+++ b/t/t4034/java/pre\n@@ -0,0 +1,19 @@\n+Foo():x(0&&1){}\n+cout<<\"Hello World!\\n\"<<endl;\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\n+a::b\ndiff --git a/t/t4034/objc/expect b/t/t4034/objc/expect\nnew file mode 100644\nindex 0000000..e5d1dd2\n--- /dev/null\n+++ b/t/t4034/objc/expect\n@@ -0,0 +1,35 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 9106d63..dd5f421 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,18 +1,18 @@<RESET>\n+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }\n+cout<<\"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<<endl;\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/objc/post b/t/t4034/objc/post\nnew file mode 100644\nindex 0000000..dd5f421\n--- /dev/null\n+++ b/t/t4034/objc/post\n@@ -0,0 +1,18 @@\n+Foo() : x(0&42) { bar(x); }\n+cout<<\"Hello World?\\n\"<<endl;\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/objc/pre b/t/t4034/objc/pre\nnew file mode 100644\nindex 0000000..9106d63\n--- /dev/null\n+++ b/t/t4034/objc/pre\n@@ -0,0 +1,18 @@\n+Foo():x(0&&1){}\n+cout<<\"Hello World!\\n\"<<endl;\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\ndiff --git a/t/t4034/pascal/expect b/t/t4034/pascal/expect\nnew file mode 100644\nindex 0000000..2ce4230\n--- /dev/null\n+++ b/t/t4034/pascal/expect\n@@ -0,0 +1,35 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 077046c..8865e6b 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,18 +1,18 @@<RESET>\n+writeln(\"Hello World<RED>!<RESET><GREEN>?<RESET>\");\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\n+<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>\ndiff --git a/t/t4034/pascal/post b/t/t4034/pascal/post\nnew file mode 100644\nindex 0000000..8865e6b\n--- /dev/null\n+++ b/t/t4034/pascal/post\n@@ -0,0 +1,18 @@\n+writeln(\"Hello World?\");\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\n+x::y\ndiff --git a/t/t4034/pascal/pre b/t/t4034/pascal/pre\nnew file mode 100644\nindex 0000000..077046c\n--- /dev/null\n+++ b/t/t4034/pascal/pre\n@@ -0,0 +1,18 @@\n+writeln(\"Hello World!\");\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\n+a::b\ndiff --git a/t/t4034/php/expect b/t/t4034/php/expect\nnew file mode 100644\nindex 0000000..0404408\n--- /dev/null\n+++ b/t/t4034/php/expect\n@@ -0,0 +1,35 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index cf6e06b..4420a49 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,18 +1,18 @@<RESET>\n+<GREEN>(<RESET>$var<GREEN>)<RESET> $ var\n+<?=\"Hello World<RED>!<RESET><GREEN>?<RESET>\"?>\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/php/post b/t/t4034/php/post\nnew file mode 100644\nindex 0000000..4420a49\n--- /dev/null\n+++ b/t/t4034/php/post\n@@ -0,0 +1,18 @@\n+($var) $ var\n+<?=\"Hello World?\"?>\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/php/pre b/t/t4034/php/pre\nnew file mode 100644\nindex 0000000..cf6e06b\n--- /dev/null\n+++ b/t/t4034/php/pre\n@@ -0,0 +1,18 @@\n+$var $var\n+<?= \"Hello World!\" ?>\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\ndiff --git a/t/t4034/python/expect b/t/t4034/python/expect\nnew file mode 100644\nindex 0000000..8abb8a4\n--- /dev/null\n+++ b/t/t4034/python/expect\n@@ -0,0 +1,34 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 438f776..68baf34 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,17 +1,17 @@<RESET>\n+print<RED>u<RESET> \"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<GREEN>; print<RESET>\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>) u<RESET>'<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/python/post b/t/t4034/python/post\nnew file mode 100644\nindex 0000000..68baf34\n--- /dev/null\n+++ b/t/t4034/python/post\n@@ -0,0 +1,17 @@\n+print \"Hello World?\\n\"; print\n+(1) (-1e10) (0xabcdef) u'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/python/pre b/t/t4034/python/pre\nnew file mode 100644\nindex 0000000..438f776\n--- /dev/null\n+++ b/t/t4034/python/pre\n@@ -0,0 +1,17 @@\n+print u\"Hello World!\\n\"\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\ndiff --git a/t/t4034/ruby/expect b/t/t4034/ruby/expect\nnew file mode 100644\nindex 0000000..16e1dd5\n--- /dev/null\n+++ b/t/t4034/ruby/expect\n@@ -0,0 +1,34 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 30ed9a1..7678f14 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,17 +1,17 @@<RESET>\n+10.downto(1) {|<RED>x<RESET><GREEN>y<RESET>| puts <RED>x<RESET><GREEN>y<RESET>}\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a?b<RESET><GREEN>y<RESET>\n+<GREEN>x?y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/ruby/post b/t/t4034/ruby/post\nnew file mode 100644\nindex 0000000..7678f14\n--- /dev/null\n+++ b/t/t4034/ruby/post\n@@ -0,0 +1,17 @@\n+10.downto(1) {|y| puts y}\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/ruby/pre b/t/t4034/ruby/pre\nnew file mode 100644\nindex 0000000..30ed9a1\n--- /dev/null\n+++ b/t/t4034/ruby/pre\n@@ -0,0 +1,17 @@\n+10.downto(1) {|x| puts x}\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\ndiff --git a/t/t4034/tex/expect b/t/t4034/tex/expect\nnew file mode 100644\nindex 0000000..604969b\n--- /dev/null\n+++ b/t/t4034/tex/expect\n@@ -0,0 +1,9 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 2b2dfcb..65cab61 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,4 +1,4 @@<RESET>\n+\\section{Something <GREEN>new<RESET>}\n+<RED>\\emph<RESET><GREEN>\\textbf<RESET>{Macro style}\n+{<RED>\\em<RESET><GREEN>\\bfseries<RESET> State toggle style}\n+\\\\[<RED>1em<RESET><GREEN>1cm<RESET>]\ndiff --git a/t/t4034/tex/post b/t/t4034/tex/post\nnew file mode 100644\nindex 0000000..65cab61\n--- /dev/null\n+++ b/t/t4034/tex/post\n@@ -0,0 +1,4 @@\n+\\section{Something new}\n+\\textbf{Macro style}\n+{\\bfseries State toggle style}\n+\\\\[1cm]\ndiff --git a/t/t4034/tex/pre b/t/t4034/tex/pre\nnew file mode 100644\nindex 0000000..2b2dfcb\n--- /dev/null\n+++ b/t/t4034/tex/pre\n@@ -0,0 +1,4 @@\n+\\section{Something}\n+\\emph{Macro style}\n+{\\em State toggle style}\n+\\\\[1em]\n-- \n1.7.3.4.789.g74ad1\n"},{"id":"158323","messageId":"201012181724.29916.trast@student.ethz.ch","threadId":"26077","inReplyTo":"cover.1292688058.git.trast@student.ethz.ch","subject":"Re: [PATCH v2 0/4] --word-regex sanity checking and such","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-18T16:24:29Z","receivedAt":"2010-12-18T16:24:29Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"I wrote:\n>   diff.c: pass struct diff_words into find_word_boundaries\n>   diff.c: implement a sanity check for word regexes\n>   userdiff: fix typo in ruby and python word regexes\n>   t4034: bulk verify builtin word regex sanity\n\nBTW, Junio, you could move the third patch to the front and merge it\nto maint.  I think it's an obvious fix to a real bug, and it does not\ndepend on the other patches except that the test in 4/4 will fail\nwithout the fix.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"158334","messageId":"7v4oaahknn.fsf@alter.siamese.dyndns.org","threadId":"26077","inReplyTo":"201012181724.29916.trast@student.ethz.ch","subject":"Re: [PATCH v2 0/4] --word-regex sanity checking and such","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-12-18T20:48:44Z","receivedAt":"2010-12-18T20:48:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Rast <trast@student.ethz.ch> writes:\n\n> I wrote:\n>>   diff.c: pass struct diff_words into find_word_boundaries\n>>   diff.c: implement a sanity check for word regexes\n>>   userdiff: fix typo in ruby and python word regexes\n>>   t4034: bulk verify builtin word regex sanity\n>\n> BTW, Junio, you could move the third patch to the front and merge it\n> to maint.  I think it's an obvious fix to a real bug, and it does not\n> depend on the other patches except that the test in 4/4 will fail\n> without the fix.\n\nMakes sense; thanks.\n"},{"id":"158336","messageId":"7vvd2qg5jj.fsf@alter.siamese.dyndns.org","threadId":"26077","inReplyTo":"ee3026bd997fc6d8508b8e5617e572f99c8bf3d6.1292688058.git.trast@student.ethz.ch","subject":"Re: [PATCH v2 2/4] diff.c: implement a sanity check for word regexes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-12-18T21:00:32Z","receivedAt":"2010-12-18T21:00:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Rast <trast@student.ethz.ch> writes:\n\n> Word regexes are a bit of a dangerous beast, since it is easily\n> possible to not match a non-space part, which is subsequently ignored\n> for the purposes of emitting the word diff.  This was clearly stated\n> in the docs, but users still tripped over it.\n>\n> Implement a safeguard that verifies two basic sanity assumptions:\n>\n> * The word regex matches anything that is !isspace().\n>\n> * The word regex does not match '\\n'.  (This case is not very harmful,\n>   but we used to silently cut off at the '\\n' which may go against\n>   user expectations.)\n>\n> This is configurable via 'diff.wordRegexCheck', and defaults to\n> 'warn'.\n\nHow expensive to run this check twice, every time word_regex finds a\nmatch?\n\nAs this is about making sure that we got a sane regex from the user (or a\nbuiltin pattern), I wonder if we can make it not depend on the payload we\nare matching the regex against.  Then before using a word_regex that we\nhave not checked, we check if that regex is sane, mark it checked, and do\nnot have to do the check over and over again.\n"},{"id":"158337","messageId":"7vr5deg5fp.fsf@alter.siamese.dyndns.org","threadId":"26077","inReplyTo":"a358c476187b1220bf6e2368c0723cefe60a5763.1292688058.git.trast@student.ethz.ch","subject":"Re: [PATCH v2 3/4] userdiff: fix typo in ruby and python word regexes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-12-18T21:02:50Z","receivedAt":"2010-12-18T21:02:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Rast <trast@student.ethz.ch> writes:\n\n> Both had an unclosed ] that ruined the safeguard against not matching\n> a non-space char.\n\nThanks.\n\nCouldn't we have found this without your \"sanity check\" patch?  Are we\nignoring error returns from regcomp() in some codepath, or is it just that\nwe are catching them but our test suite lacks ruby and python test\nvectors?\n"},{"id":"158348","messageId":"201012190259.45301.trast@student.ethz.ch","threadId":"26077","inReplyTo":"7vvd2qg5jj.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 2/4] diff.c: implement a sanity check for word regexes","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-19T01:59:44Z","receivedAt":"2010-12-19T01:59:44Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Junio C Hamano wrote:\n> Thomas Rast <trast@student.ethz.ch> writes:\n> \n> > * The word regex matches anything that is !isspace().\n> >\n> > * The word regex does not match '\\n'.  (This case is not very harmful,\n> >   but we used to silently cut off at the '\\n' which may go against\n> >   user expectations.)\n> \n> How expensive to run this check twice, every time word_regex finds a\n> match?\n\nIt runs the first bullet point for every non-match, and the second\nbullet point for every match.  So it looks at every input character\nexactly once.\n\n> As this is about making sure that we got a sane regex from the user (or a\n> builtin pattern), I wonder if we can make it not depend on the payload we\n> are matching the regex against.  Then before using a word_regex that we\n> have not checked, we check if that regex is sane, mark it checked, and do\n> not have to do the check over and over again.\n\nAlgorithmically it should be easy once you have the finite state\nautomaton corresponding to the regex: just verify that for every\npossible non-terminal state, there is a transition for every\n!isspace() character to a state other than \"fail to match\" or \"match\nthe empty string\".\n\nIn the implementation, it might be doable if we switch to compat/regex\non all platforms, since we then have ready access to all internal\nstructures regcomp() creates, including the DFA.\n\nI'll think about at least using compat/regex for a static check of all\n*builtin* patterns, which would be superior to the brute force\napproach in 4/4.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"158349","messageId":"201012190310.43308.trast@student.ethz.ch","threadId":"26077","inReplyTo":"7vr5deg5fp.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 3/4] userdiff: fix typo in ruby and python word regexes","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-12-19T02:10:43Z","receivedAt":"2010-12-19T02:10:43Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Junio C Hamano wrote:\n> Thomas Rast <trast@student.ethz.ch> writes:\n> \n> > Both had an unclosed ] that ruined the safeguard against not matching\n> > a non-space char.\n> \n> Thanks.\n> \n> Couldn't we have found this without your \"sanity check\" patch?  Are we\n> ignoring error returns from regcomp() in some codepath, or is it just that\n> we are catching them but our test suite lacks ruby and python test\n> vectors?\n\nWe lacked test vectors, but we still couldn't have caught it.  We do\ncheck for errors in regcomp():\n\n\tif (o->word_regex) {\n\t\tecbdata.diff_words->word_regex = (regex_t *)\n\t\t\txmalloc(sizeof(regex_t));\n\t\tif (regcomp(ecbdata.diff_words->word_regex,\n\t\t\t\to->word_regex,\n\t\t\t\tREG_EXTENDED | REG_NEWLINE))\n\t\t\tdie (\"Invalid regular expression: %s\",\n\t\t\t\t\to->word_regex);\n\t}\n\n(Now that I'm seeing this and comparing with regcomp(3), we should\nactually report regerror() as part of the error message.)\n\nThe problem is that the pattern is still valid.  Consider that it was\na final two arms to the regex:\n\n-        \"|[^[:space:]|[\\x80-\\xff]+\"),\n+        \"|[^[:space:]]|[\\x80-\\xff]+\"),\n\nIn the preimage, it parses like so:\n\n  | [^\n      [:space:]|[\\x80-\\xff\n     ]+\n\nThat is, the third [ is part of the (negated) character class.  So the\nonly problem is with | or [ characters in the input.  Any other\nnon-space character is part of the class.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"159383","messageId":"20110111214707.GA29133@burratino","threadId":"26077","inReplyTo":"854c8b6fa8a368bb34cc22d3fc948ae7136ed177.1292688058.git.trast@student.ethz.ch","subject":"[RFC/PATCH 0/3] Re: t4034: bulk verify builtin word regex sanity","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-11T21:47:07Z","receivedAt":"2011-01-11T21:47:07Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Thomas Rast wrote:\n\n> The builtin word regexes should be tested with some simple examples\n> against simple issues, like failing to match a non-space character.\n> Do this in bulk.\n\nThe above patch depends on \"diff.c: implement a sanity check for word\nregexes\" but not in any essential way.  Patch 1 below is the part that\nis still relevant without it.\n\nPatch 2 changes the UTF-8 catchall to match a single non-ASCII\ncharacter[1], at the same time as making it harder to forget to use.\n(My motivation is that the UTF-8 catchall is missing in the new perl\nsupport.)\n\nPatch 3 contains some cosmetic tweaks to the tests.  They were meant\nas preparations for patch 2 but I checkened out and stopped there.\n\nThoughts and improvements welcome, as always.\n\nJonathan Nieder (2):\n  userdiff: simplify word-diff safeguard\n  t4034 (diff --word-diff): style suggestions\n\nThomas Rast (1):\n  t4034: bulk verify builtin word regex sanity\n\n t/t4034-diff-words.sh  |  463 +++++++++++++++++++++++-------------------------\n t/t4034/bibtex/expect  |   15 ++\n t/t4034/bibtex/post    |   10 +\n t/t4034/bibtex/pre     |    9 +\n t/t4034/cpp/expect     |   36 ++++\n t/t4034/cpp/post       |   19 ++\n t/t4034/cpp/pre        |   19 ++\n t/t4034/csharp/expect  |   35 ++++\n t/t4034/csharp/post    |   18 ++\n t/t4034/csharp/pre     |   18 ++\n t/t4034/fortran/expect |   10 +\n t/t4034/fortran/post   |    5 +\n t/t4034/fortran/pre    |    5 +\n t/t4034/html/expect    |    8 +\n t/t4034/html/post      |    3 +\n t/t4034/html/pre       |    3 +\n t/t4034/java/expect    |   36 ++++\n t/t4034/java/post      |   19 ++\n t/t4034/java/pre       |   19 ++\n t/t4034/objc/expect    |   35 ++++\n t/t4034/objc/post      |   18 ++\n t/t4034/objc/pre       |   18 ++\n t/t4034/pascal/expect  |   35 ++++\n t/t4034/pascal/post    |   18 ++\n t/t4034/pascal/pre     |   18 ++\n t/t4034/php/expect     |   35 ++++\n t/t4034/php/post       |   18 ++\n t/t4034/php/pre        |   18 ++\n t/t4034/python/expect  |   34 ++++\n t/t4034/python/post    |   17 ++\n t/t4034/python/pre     |   17 ++\n t/t4034/ruby/expect    |   34 ++++\n t/t4034/ruby/post      |   17 ++\n t/t4034/ruby/pre       |   17 ++\n t/t4034/tex/expect     |    9 +\n t/t4034/tex/post       |    4 +\n t/t4034/tex/pre        |    4 +\n userdiff.c             |   37 ++---\n 38 files changed, 887 insertions(+), 266 deletions(-)\n create mode 100644 t/t4034/bibtex/expect\n create mode 100644 t/t4034/bibtex/post\n create mode 100644 t/t4034/bibtex/pre\n create mode 100644 t/t4034/cpp/expect\n create mode 100644 t/t4034/cpp/post\n create mode 100644 t/t4034/cpp/pre\n create mode 100644 t/t4034/csharp/expect\n create mode 100644 t/t4034/csharp/post\n create mode 100644 t/t4034/csharp/pre\n create mode 100644 t/t4034/fortran/expect\n create mode 100644 t/t4034/fortran/post\n create mode 100644 t/t4034/fortran/pre\n create mode 100644 t/t4034/html/expect\n create mode 100644 t/t4034/html/post\n create mode 100644 t/t4034/html/pre\n create mode 100644 t/t4034/java/expect\n create mode 100644 t/t4034/java/post\n create mode 100644 t/t4034/java/pre\n create mode 100644 t/t4034/objc/expect\n create mode 100644 t/t4034/objc/post\n create mode 100644 t/t4034/objc/pre\n create mode 100644 t/t4034/pascal/expect\n create mode 100644 t/t4034/pascal/post\n create mode 100644 t/t4034/pascal/pre\n create mode 100644 t/t4034/php/expect\n create mode 100644 t/t4034/php/post\n create mode 100644 t/t4034/php/pre\n create mode 100644 t/t4034/python/expect\n create mode 100644 t/t4034/python/post\n create mode 100644 t/t4034/python/pre\n create mode 100644 t/t4034/ruby/expect\n create mode 100644 t/t4034/ruby/post\n create mode 100644 t/t4034/ruby/pre\n create mode 100644 t/t4034/tex/expect\n create mode 100644 t/t4034/tex/post\n create mode 100644 t/t4034/tex/pre\n\n[1] suggested in <201012261206.11942.trast@student.ethz.ch>, which is\nmissing from gmane for some reason.\n"},{"id":"159384","messageId":"20110111214811.GB29133@burratino","threadId":"26077","inReplyTo":"20110111214707.GA29133@burratino","subject":"[PATCH 1/3] t4034: bulk verify builtin word regex sanity","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-11T21:48:11Z","receivedAt":"2011-01-11T21:48:11Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"From: Thomas Rast <trast@student.ethz.ch>\nDate: Sat, 18 Dec 2010 17:17:54 +0100\n\nThe builtin word regexes should be tested with some simple examples\nagainst simple issues.  Do this in bulk.\n\nMainly due to a lack of language knowledge and inspiration, most of\nthe test cases (cpp, csharp, java, objc, pascal, php, python, ruby)\nare directly based off a C operator precedence table to verify that\nall operators are split correctly.  This means that they are probably\nincomplete or inaccurate except for 'cpp' itself.\n\nStill, they are good enough to already have uncovered a typo in the\npython and ruby patterns.\n\n'fortran' is based on my anecdotal knowledge of the DO10I parsing\nrules, and thus probably useless.  The rest (bibtex, html, tex) are an\nad-hoc test of what I consider important splits in those languages.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t4034-diff-words.sh  |   15 +++++++++++++++\n t/t4034/bibtex/expect  |   15 +++++++++++++++\n t/t4034/bibtex/post    |   10 ++++++++++\n t/t4034/bibtex/pre     |    9 +++++++++\n t/t4034/cpp/expect     |   36 ++++++++++++++++++++++++++++++++++++\n t/t4034/cpp/post       |   19 +++++++++++++++++++\n t/t4034/cpp/pre        |   19 +++++++++++++++++++\n t/t4034/csharp/expect  |   35 +++++++++++++++++++++++++++++++++++\n t/t4034/csharp/post    |   18 ++++++++++++++++++\n t/t4034/csharp/pre     |   18 ++++++++++++++++++\n t/t4034/fortran/expect |   10 ++++++++++\n t/t4034/fortran/post   |    5 +++++\n t/t4034/fortran/pre    |    5 +++++\n t/t4034/html/expect    |    8 ++++++++\n t/t4034/html/post      |    3 +++\n t/t4034/html/pre       |    3 +++\n t/t4034/java/expect    |   36 ++++++++++++++++++++++++++++++++++++\n t/t4034/java/post      |   19 +++++++++++++++++++\n t/t4034/java/pre       |   19 +++++++++++++++++++\n t/t4034/objc/expect    |   35 +++++++++++++++++++++++++++++++++++\n t/t4034/objc/post      |   18 ++++++++++++++++++\n t/t4034/objc/pre       |   18 ++++++++++++++++++\n t/t4034/pascal/expect  |   35 +++++++++++++++++++++++++++++++++++\n t/t4034/pascal/post    |   18 ++++++++++++++++++\n t/t4034/pascal/pre     |   18 ++++++++++++++++++\n t/t4034/php/expect     |   35 +++++++++++++++++++++++++++++++++++\n t/t4034/php/post       |   18 ++++++++++++++++++\n t/t4034/php/pre        |   18 ++++++++++++++++++\n t/t4034/python/expect  |   34 ++++++++++++++++++++++++++++++++++\n t/t4034/python/post    |   17 +++++++++++++++++\n t/t4034/python/pre     |   17 +++++++++++++++++\n t/t4034/ruby/expect    |   34 ++++++++++++++++++++++++++++++++++\n t/t4034/ruby/post      |   17 +++++++++++++++++\n t/t4034/ruby/pre       |   17 +++++++++++++++++\n t/t4034/tex/expect     |    9 +++++++++\n t/t4034/tex/post       |    4 ++++\n t/t4034/tex/pre        |    4 ++++\n 37 files changed, 668 insertions(+), 0 deletions(-)\n create mode 100644 t/t4034/bibtex/expect\n create mode 100644 t/t4034/bibtex/post\n create mode 100644 t/t4034/bibtex/pre\n create mode 100644 t/t4034/cpp/expect\n create mode 100644 t/t4034/cpp/post\n create mode 100644 t/t4034/cpp/pre\n create mode 100644 t/t4034/csharp/expect\n create mode 100644 t/t4034/csharp/post\n create mode 100644 t/t4034/csharp/pre\n create mode 100644 t/t4034/fortran/expect\n create mode 100644 t/t4034/fortran/post\n create mode 100644 t/t4034/fortran/pre\n create mode 100644 t/t4034/html/expect\n create mode 100644 t/t4034/html/post\n create mode 100644 t/t4034/html/pre\n create mode 100644 t/t4034/java/expect\n create mode 100644 t/t4034/java/post\n create mode 100644 t/t4034/java/pre\n create mode 100644 t/t4034/objc/expect\n create mode 100644 t/t4034/objc/post\n create mode 100644 t/t4034/objc/pre\n create mode 100644 t/t4034/pascal/expect\n create mode 100644 t/t4034/pascal/post\n create mode 100644 t/t4034/pascal/pre\n create mode 100644 t/t4034/php/expect\n create mode 100644 t/t4034/php/post\n create mode 100644 t/t4034/php/pre\n create mode 100644 t/t4034/python/expect\n create mode 100644 t/t4034/python/post\n create mode 100644 t/t4034/python/pre\n create mode 100644 t/t4034/ruby/expect\n create mode 100644 t/t4034/ruby/post\n create mode 100644 t/t4034/ruby/pre\n create mode 100644 t/t4034/tex/expect\n create mode 100644 t/t4034/tex/post\n create mode 100644 t/t4034/tex/pre\n\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex 8096d8a..2647191 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -331,4 +331,19 @@ test_expect_success '--word-diff=none' '\n \n '\n \n+word_diff_for_language () {\n+\tcp \"$TEST_DIRECTORY/t4034/$1/pre\" \\\n+\t\t\"$TEST_DIRECTORY/t4034/$1/post\" \\\n+\t\t\"$TEST_DIRECTORY/t4034/$1/expect\" . &&\n+\techo \"* diff=$1\" >.gitattributes &&\n+\tword_diff --color-words && cp output output.$1\n+}\n+\n+for lang_dir in $TEST_DIRECTORY/t4034/*; do\n+\tlang=${lang_dir#$TEST_DIRECTORY/t4034/}\n+\ttest_expect_success \"diff driver '$lang' has sane word regex\" \"\n+\t\tword_diff_for_language $lang\n+\t\"\n+done\n+\n test_done\ndiff --git a/t/t4034/bibtex/expect b/t/t4034/bibtex/expect\nnew file mode 100644\nindex 0000000..a157774\n--- /dev/null\n+++ b/t/t4034/bibtex/expect\n@@ -0,0 +1,15 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 95cd55b..ddcba9b 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,9 +1,10 @@<RESET>\n+@article{aldous1987uie,<RESET>\n+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},<RESET>\n+  author={Aldous, <RED>D.<RESET><GREEN>David<RESET>},\n+  journal={Information Theory, IEEE Transactions on},<RESET>\n+  volume={<RED>33<RESET><GREEN>Bogus.<RESET>},\n+  number={<RED>2<RESET><GREEN>4<RESET>},\n+  pages={219--223},<RESET>\n+  year=<GREEN>1987,<RESET>\n+<GREEN>  note={This is in fact a rather funny read since ethernet works well in practice. The<RESET> {<RED>1987<RESET><GREEN>\\em pre} reference is the right one, however.<RESET>}<RED>,<RESET>\n+}<RESET>\ndiff --git a/t/t4034/bibtex/post b/t/t4034/bibtex/post\nnew file mode 100644\nindex 0000000..ddcba9b\n--- /dev/null\n+++ b/t/t4034/bibtex/post\n@@ -0,0 +1,10 @@\n+@article{aldous1987uie,\n+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},\n+  author={Aldous, David},\n+  journal={Information Theory, IEEE Transactions on},\n+  volume={Bogus.},\n+  number={4},\n+  pages={219--223},\n+  year=1987,\n+  note={This is in fact a rather funny read since ethernet works well in practice. The {\\em pre} reference is the right one, however.}\n+}\ndiff --git a/t/t4034/bibtex/pre b/t/t4034/bibtex/pre\nnew file mode 100644\nindex 0000000..95cd55b\n--- /dev/null\n+++ b/t/t4034/bibtex/pre\n@@ -0,0 +1,9 @@\n+@article{aldous1987uie,\n+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},\n+  author={Aldous, D.},\n+  journal={Information Theory, IEEE Transactions on},\n+  volume={33},\n+  number={2},\n+  pages={219--223},\n+  year={1987},\n+}\ndiff --git a/t/t4034/cpp/expect b/t/t4034/cpp/expect\nnew file mode 100644\nindex 0000000..37d1ea2\n--- /dev/null\n+++ b/t/t4034/cpp/expect\n@@ -0,0 +1,36 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 23d5c8a..7e8c026 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,19 +1,19 @@<RESET>\n+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }\n+cout<<\"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<<endl;\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\n+<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>\ndiff --git a/t/t4034/cpp/post b/t/t4034/cpp/post\nnew file mode 100644\nindex 0000000..7e8c026\n--- /dev/null\n+++ b/t/t4034/cpp/post\n@@ -0,0 +1,19 @@\n+Foo() : x(0&42) { bar(x); }\n+cout<<\"Hello World?\\n\"<<endl;\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\n+x::y\ndiff --git a/t/t4034/cpp/pre b/t/t4034/cpp/pre\nnew file mode 100644\nindex 0000000..23d5c8a\n--- /dev/null\n+++ b/t/t4034/cpp/pre\n@@ -0,0 +1,19 @@\n+Foo():x(0&&1){}\n+cout<<\"Hello World!\\n\"<<endl;\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\n+a::b\ndiff --git a/t/t4034/csharp/expect b/t/t4034/csharp/expect\nnew file mode 100644\nindex 0000000..e5d1dd2\n--- /dev/null\n+++ b/t/t4034/csharp/expect\n@@ -0,0 +1,35 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 9106d63..dd5f421 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,18 +1,18 @@<RESET>\n+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }\n+cout<<\"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<<endl;\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/csharp/post b/t/t4034/csharp/post\nnew file mode 100644\nindex 0000000..dd5f421\n--- /dev/null\n+++ b/t/t4034/csharp/post\n@@ -0,0 +1,18 @@\n+Foo() : x(0&42) { bar(x); }\n+cout<<\"Hello World?\\n\"<<endl;\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/csharp/pre b/t/t4034/csharp/pre\nnew file mode 100644\nindex 0000000..9106d63\n--- /dev/null\n+++ b/t/t4034/csharp/pre\n@@ -0,0 +1,18 @@\n+Foo():x(0&&1){}\n+cout<<\"Hello World!\\n\"<<endl;\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\ndiff --git a/t/t4034/fortran/expect b/t/t4034/fortran/expect\nnew file mode 100644\nindex 0000000..b233dbd\n--- /dev/null\n+++ b/t/t4034/fortran/expect\n@@ -0,0 +1,10 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 87f0d0b..d308da2 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,5 +1,5 @@<RESET>\n+print *, \"Hello World<RED>!<RESET><GREEN>?<RESET>\"\n+\n+DO10I = 1,10<RESET>\n+<RED>DO10I<RESET><GREEN>DO 10 I<RESET> = 1,10\n+<RED>DO10I<RESET><GREEN>DO 1 0 I<RESET> = 1,10\ndiff --git a/t/t4034/fortran/post b/t/t4034/fortran/post\nnew file mode 100644\nindex 0000000..d308da2\n--- /dev/null\n+++ b/t/t4034/fortran/post\n@@ -0,0 +1,5 @@\n+print *, \"Hello World?\"\n+\n+DO10I = 1,10\n+DO 10 I = 1,10\n+DO 1 0 I = 1,10\ndiff --git a/t/t4034/fortran/pre b/t/t4034/fortran/pre\nnew file mode 100644\nindex 0000000..87f0d0b\n--- /dev/null\n+++ b/t/t4034/fortran/pre\n@@ -0,0 +1,5 @@\n+print *, \"Hello World!\"\n+\n+DO10I = 1,10\n+DO10I = 1,10\n+DO10I = 1,10\ndiff --git a/t/t4034/html/expect b/t/t4034/html/expect\nnew file mode 100644\nindex 0000000..447b49a\n--- /dev/null\n+++ b/t/t4034/html/expect\n@@ -0,0 +1,8 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 8ca4aea..46921e5 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,3 +1,3 @@<RESET>\n+<tag <GREEN>newattr=\"newvalue\"<RESET>><GREEN>added<RESET> content</tag>\n+<tag attr=<RED>\"value\"<RESET><GREEN>\"newvalue\"<RESET>><RED>content<RESET><GREEN>changed<RESET></tag>\n+<<RED>tag<RESET><GREEN>newtag<RESET>>content <RED>&entity;<RESET><GREEN>&newentity;<RESET><<RED>/tag<RESET><GREEN>/newtag<RESET>>\ndiff --git a/t/t4034/html/post b/t/t4034/html/post\nnew file mode 100644\nindex 0000000..46921e5\n--- /dev/null\n+++ b/t/t4034/html/post\n@@ -0,0 +1,3 @@\n+<tag newattr=\"newvalue\">added content</tag>\n+<tag attr=\"newvalue\">changed</tag>\n+<newtag>content &newentity;</newtag>\ndiff --git a/t/t4034/html/pre b/t/t4034/html/pre\nnew file mode 100644\nindex 0000000..8ca4aea\n--- /dev/null\n+++ b/t/t4034/html/pre\n@@ -0,0 +1,3 @@\n+<tag>content</tag>\n+<tag attr=\"value\">content</tag>\n+<tag>content &entity;</tag>\ndiff --git a/t/t4034/java/expect b/t/t4034/java/expect\nnew file mode 100644\nindex 0000000..37d1ea2\n--- /dev/null\n+++ b/t/t4034/java/expect\n@@ -0,0 +1,36 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 23d5c8a..7e8c026 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,19 +1,19 @@<RESET>\n+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }\n+cout<<\"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<<endl;\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\n+<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>\ndiff --git a/t/t4034/java/post b/t/t4034/java/post\nnew file mode 100644\nindex 0000000..7e8c026\n--- /dev/null\n+++ b/t/t4034/java/post\n@@ -0,0 +1,19 @@\n+Foo() : x(0&42) { bar(x); }\n+cout<<\"Hello World?\\n\"<<endl;\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\n+x::y\ndiff --git a/t/t4034/java/pre b/t/t4034/java/pre\nnew file mode 100644\nindex 0000000..23d5c8a\n--- /dev/null\n+++ b/t/t4034/java/pre\n@@ -0,0 +1,19 @@\n+Foo():x(0&&1){}\n+cout<<\"Hello World!\\n\"<<endl;\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\n+a::b\ndiff --git a/t/t4034/objc/expect b/t/t4034/objc/expect\nnew file mode 100644\nindex 0000000..e5d1dd2\n--- /dev/null\n+++ b/t/t4034/objc/expect\n@@ -0,0 +1,35 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 9106d63..dd5f421 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,18 +1,18 @@<RESET>\n+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }\n+cout<<\"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<<endl;\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/objc/post b/t/t4034/objc/post\nnew file mode 100644\nindex 0000000..dd5f421\n--- /dev/null\n+++ b/t/t4034/objc/post\n@@ -0,0 +1,18 @@\n+Foo() : x(0&42) { bar(x); }\n+cout<<\"Hello World?\\n\"<<endl;\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/objc/pre b/t/t4034/objc/pre\nnew file mode 100644\nindex 0000000..9106d63\n--- /dev/null\n+++ b/t/t4034/objc/pre\n@@ -0,0 +1,18 @@\n+Foo():x(0&&1){}\n+cout<<\"Hello World!\\n\"<<endl;\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\ndiff --git a/t/t4034/pascal/expect b/t/t4034/pascal/expect\nnew file mode 100644\nindex 0000000..2ce4230\n--- /dev/null\n+++ b/t/t4034/pascal/expect\n@@ -0,0 +1,35 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 077046c..8865e6b 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,18 +1,18 @@<RESET>\n+writeln(\"Hello World<RED>!<RESET><GREEN>?<RESET>\");\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\n+<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>\ndiff --git a/t/t4034/pascal/post b/t/t4034/pascal/post\nnew file mode 100644\nindex 0000000..8865e6b\n--- /dev/null\n+++ b/t/t4034/pascal/post\n@@ -0,0 +1,18 @@\n+writeln(\"Hello World?\");\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\n+x::y\ndiff --git a/t/t4034/pascal/pre b/t/t4034/pascal/pre\nnew file mode 100644\nindex 0000000..077046c\n--- /dev/null\n+++ b/t/t4034/pascal/pre\n@@ -0,0 +1,18 @@\n+writeln(\"Hello World!\");\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\n+a::b\ndiff --git a/t/t4034/php/expect b/t/t4034/php/expect\nnew file mode 100644\nindex 0000000..0404408\n--- /dev/null\n+++ b/t/t4034/php/expect\n@@ -0,0 +1,35 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index cf6e06b..4420a49 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,18 +1,18 @@<RESET>\n+<GREEN>(<RESET>$var<GREEN>)<RESET> $ var\n+<?=\"Hello World<RED>!<RESET><GREEN>?<RESET>\"?>\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/php/post b/t/t4034/php/post\nnew file mode 100644\nindex 0000000..4420a49\n--- /dev/null\n+++ b/t/t4034/php/post\n@@ -0,0 +1,18 @@\n+($var) $ var\n+<?=\"Hello World?\"?>\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/php/pre b/t/t4034/php/pre\nnew file mode 100644\nindex 0000000..cf6e06b\n--- /dev/null\n+++ b/t/t4034/php/pre\n@@ -0,0 +1,18 @@\n+$var $var\n+<?= \"Hello World!\" ?>\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\ndiff --git a/t/t4034/python/expect b/t/t4034/python/expect\nnew file mode 100644\nindex 0000000..8abb8a4\n--- /dev/null\n+++ b/t/t4034/python/expect\n@@ -0,0 +1,34 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 438f776..68baf34 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,17 +1,17 @@<RESET>\n+print<RED>u<RESET> \"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<GREEN>; print<RESET>\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>) u<RESET>'<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/python/post b/t/t4034/python/post\nnew file mode 100644\nindex 0000000..68baf34\n--- /dev/null\n+++ b/t/t4034/python/post\n@@ -0,0 +1,17 @@\n+print \"Hello World?\\n\"; print\n+(1) (-1e10) (0xabcdef) u'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/python/pre b/t/t4034/python/pre\nnew file mode 100644\nindex 0000000..438f776\n--- /dev/null\n+++ b/t/t4034/python/pre\n@@ -0,0 +1,17 @@\n+print u\"Hello World!\\n\"\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\ndiff --git a/t/t4034/ruby/expect b/t/t4034/ruby/expect\nnew file mode 100644\nindex 0000000..16e1dd5\n--- /dev/null\n+++ b/t/t4034/ruby/expect\n@@ -0,0 +1,34 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 30ed9a1..7678f14 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,17 +1,17 @@<RESET>\n+10.downto(1) {|<RED>x<RESET><GREEN>y<RESET>| puts <RED>x<RESET><GREEN>y<RESET>}\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>|<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>||<RED>b<RESET>\n+<RED>a?b<RESET><GREEN>y<RESET>\n+<GREEN>x?y<RESET>:z\n+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/ruby/post b/t/t4034/ruby/post\nnew file mode 100644\nindex 0000000..7678f14\n--- /dev/null\n+++ b/t/t4034/ruby/post\n@@ -0,0 +1,17 @@\n+10.downto(1) {|y| puts y}\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/ruby/pre b/t/t4034/ruby/pre\nnew file mode 100644\nindex 0000000..30ed9a1\n--- /dev/null\n+++ b/t/t4034/ruby/pre\n@@ -0,0 +1,17 @@\n+10.downto(1) {|x| puts x}\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a,y\ndiff --git a/t/t4034/tex/expect b/t/t4034/tex/expect\nnew file mode 100644\nindex 0000000..604969b\n--- /dev/null\n+++ b/t/t4034/tex/expect\n@@ -0,0 +1,9 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 2b2dfcb..65cab61 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,4 +1,4 @@<RESET>\n+\\section{Something <GREEN>new<RESET>}\n+<RED>\\emph<RESET><GREEN>\\textbf<RESET>{Macro style}\n+{<RED>\\em<RESET><GREEN>\\bfseries<RESET> State toggle style}\n+\\\\[<RED>1em<RESET><GREEN>1cm<RESET>]\ndiff --git a/t/t4034/tex/post b/t/t4034/tex/post\nnew file mode 100644\nindex 0000000..65cab61\n--- /dev/null\n+++ b/t/t4034/tex/post\n@@ -0,0 +1,4 @@\n+\\section{Something new}\n+\\textbf{Macro style}\n+{\\bfseries State toggle style}\n+\\\\[1cm]\ndiff --git a/t/t4034/tex/pre b/t/t4034/tex/pre\nnew file mode 100644\nindex 0000000..2b2dfcb\n--- /dev/null\n+++ b/t/t4034/tex/pre\n@@ -0,0 +1,4 @@\n+\\section{Something}\n+\\emph{Macro style}\n+{\\em State toggle style}\n+\\\\[1em]\n-- \n1.7.4.rc1\n"},{"id":"159385","messageId":"20110111214850.GC29133@burratino","threadId":"26077","inReplyTo":"20110111214707.GA29133@burratino","subject":"[PATCH 2/3] userdiff: simplify word-diff safeguard","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-11T21:48:50Z","receivedAt":"2011-01-11T21:48:50Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"git's diff-words support has a detail that can be a little dangerous:\nany text not matched by a given language's tokenization pattern is\ntreated as whitespace and changes in such text would go unnoticed.\nTherefore each of the built-in regexes allows a special token type\nconsisting of a single non-whitespace character [^[:space:]].\n\nTo make sure UTF-8 sequences remain human readable, the builtin\nregexes also have a special token type for runs of bytes with the high\nbit set.  In English, non-ASCII characters are usually isolated so\nthis is analogous to the [^[:space:]] pattern, except it matches a\nsingle _multibyte_ character despite use of the C locale.\n\nUnfortunately it is easy to make typos or forget entirely to include\nthese catch-all token types when adding support for new languages (see\nv1.7.3.5~16, userdiff: fix typo in ruby and python word regexes,\n2010-12-18).  Avoid this by including them automatically within the\nPATTERNS and IPATTERN macros.\n\nWhile at it, change the UTF-8 sequence token type to match exactly one\nnon-ASCII multi-byte character, rather than an arbitrary run of them.\n\nSuggested-by: Thomas Rast <trast@student.ethz.ch>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n userdiff.c |   37 +++++++++++++++----------------------\n 1 files changed, 15 insertions(+), 22 deletions(-)\n\ndiff --git a/userdiff.c b/userdiff.c\nindex 2d54536..91586cf 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -8,9 +8,11 @@ static int ndrivers;\n static int drivers_alloc;\n \n #define PATTERNS(name, pattern, word_regex)\t\t\t\\\n-\t{ name, NULL, -1, { pattern, REG_EXTENDED }, word_regex }\n+\t{ name, NULL, -1, { pattern, REG_EXTENDED },\t\t\\\n+\t  word_regex \"|[^[:space:]]|[\\xc0-\\xff][\\x80-\\xbf]+\" }\n #define IPATTERN(name, pattern, word_regex)\t\t\t\\\n-\t{ name, NULL, -1, { pattern, REG_EXTENDED | REG_ICASE }, word_regex }\n+\t{ name, NULL, -1, { pattern, REG_EXTENDED | REG_ICASE }, \\\n+\t  word_regex \"|[^[:space:]]|[\\xc0-\\xff][\\x80-\\xbf]+\" }\n static struct userdiff_driver builtin_drivers[] = {\n IPATTERN(\"fortran\",\n \t \"!^([C*]|[ \\t]*!)\\n\"\n@@ -24,10 +26,9 @@ IPATTERN(\"fortran\",\n \t  * Don't worry about format statements without leading digits since\n \t  * they would have been matched above as a variable anyway. */\n \t \"|[-+]?[0-9.]+([AaIiDdEeFfLlTtXx][Ss]?[-+]?[0-9.]*)?(_[a-zA-Z0-9][a-zA-Z0-9_]*)?\"\n-\t \"|//|\\\\*\\\\*|::|[/<>=]=\"\n-\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+\t \"|//|\\\\*\\\\*|::|[/<>=]=\"),\n PATTERNS(\"html\", \"^[ \\t]*(<[Hh][1-6][ \\t].*>.*)$\",\n-\t \"[^<>= \\t]+|[^[:space:]]|[\\x80-\\xff]+\"),\n+\t \"[^<>= \\t]+\"),\n PATTERNS(\"java\",\n \t \"!^[ \\t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\\n\"\n \t \"^[ \\t]*(([A-Za-z_][A-Za-z_0-9]*[ \\t]+)+[A-Za-z_][A-Za-z_0-9]*[ \\t]*\\\\([^;]*)$\",\n@@ -35,8 +36,7 @@ PATTERNS(\"java\",\n \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n \t \"|[-+*/<>%&^|=!]=\"\n-\t \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"\n-\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+\t \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"),\n PATTERNS(\"objc\",\n \t /* Negate C statements that can look like functions */\n \t \"!^[ \\t]*(do|for|if|else|return|switch|while)\\n\"\n@@ -49,8 +49,7 @@ PATTERNS(\"objc\",\n \t /* -- */\n \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n-\t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"\n-\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+\t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"),\n PATTERNS(\"pascal\",\n \t \"^((procedure|function|constructor|destructor|interface|\"\n \t\t\"implementation|initialization|finalization)[ \\t]*.*)$\"\n@@ -59,33 +58,29 @@ PATTERNS(\"pascal\",\n \t /* -- */\n \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+\"\n-\t \"|<>|<=|>=|:=|\\\\.\\\\.\"\n-\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+\t \"|<>|<=|>=|:=|\\\\.\\\\.\"),\n PATTERNS(\"php\",\n \t \"^[\\t ]*(((public|protected|private|static)[\\t ]+)*function.*)$\\n\"\n \t \"^[\\t ]*(class.*)$\",\n \t /* -- */\n \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+\"\n-\t \"|[-+*/<>%&^|=!.]=|--|\\\\+\\\\+|<<=?|>>=?|===|&&|\\\\|\\\\||::|->\"\n-\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+\t \"|[-+*/<>%&^|=!.]=|--|\\\\+\\\\+|<<=?|>>=?|===|&&|\\\\|\\\\||::|->\"),\n PATTERNS(\"python\", \"^[ \\t]*((class|def)[ \\t].*)$\",\n \t /* -- */\n \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?\"\n-\t \"|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\\\*\\\\*=?\"\n-\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+\t \"|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\\\*\\\\*=?\"),\n \t /* -- */\n PATTERNS(\"ruby\", \"^[ \\t]*((class|module|def)[ \\t].*)$\",\n \t /* -- */\n \t \"(@|@@|\\\\$)?[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\\\?(\\\\\\\\C-)?(\\\\\\\\M-)?.\"\n-\t \"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\\\.{1,3}|::|[!=]~\"\n-\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+\t \"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\\\.{1,3}|::|[!=]~\"),\n PATTERNS(\"bibtex\", \"(@[a-zA-Z]{1,}[ \\t]*\\\\{{0,1}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*).*$\",\n \t \"[={}\\\"]|[^={}\\\" \\t]+\"),\n PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n-\t \"\\\\\\\\[a-zA-Z@]+|\\\\\\\\.|[a-zA-Z0-9\\x80-\\xff]+|[^[:space:]]\"),\n+\t \"\\\\\\\\[a-zA-Z@]+|\\\\\\\\.|[a-zA-Z0-9\\x80-\\xff]+\"),\n PATTERNS(\"cpp\",\n \t /* Jump targets or access declarations */\n \t \"!^[ \\t]*[A-Za-z_][A-Za-z_0-9]*:.*$\\n\"\n@@ -96,8 +91,7 @@ PATTERNS(\"cpp\",\n \t /* -- */\n \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n-\t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"\n-\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+\t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"),\n PATTERNS(\"csharp\",\n \t /* Keywords */\n \t \"!^[ \\t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\\n\"\n@@ -112,8 +106,7 @@ PATTERNS(\"csharp\",\n \t /* -- */\n \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n-\t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"\n-\t \"|[^[:space:]]|[\\x80-\\xff]+\"),\n+\t \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\"),\n { \"default\", NULL, -1, { NULL, 0 } },\n };\n #undef PATTERNS\n-- \n1.7.4.rc1\n"},{"id":"159386","messageId":"20110111214957.GD29133@burratino","threadId":"26077","inReplyTo":"20110111214707.GA29133@burratino","subject":"[PATCH 3/3] t4034 (diff --word-diff): style suggestions","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-11T21:49:57Z","receivedAt":"2011-01-11T21:49:57Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Rearrange code to be easier to browse:\n\n - first data\n - then functions\n - then test assertions\n\nMark up inline test vectors as\n\n  cat >vector <<-\\EOF\n\tdata\n\tdata\n  EOF\n\nfor visual scannability.  Use words like \"set up\" for tests that set\nup for other tests, to make it obvious which tests are safe to skip.\nUse repeated function calls instead of a loop for the\nlanguage-specific tests, so the invocations can be easily tweaked\nindividually (for example if one starts to fail).\n\nThis means if you add a new subdirectory to t4034/, it will not be\nautomatically used.  I think that's worth it for the added\nexplicitness.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t4034-diff-words.sh |  476 ++++++++++++++++++++++--------------------------\n 1 files changed, 218 insertions(+), 258 deletions(-)\n\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex 2647191..c3b1c48 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -4,346 +4,306 @@ test_description='word diff colors'\n \n . ./test-lib.sh\n \n+cat >pre.simple <<-\\EOF\n+\th(4)\n+\n+\ta = b + c\n+EOF\n+cat >post.simple <<-\\EOF\n+\th(4),hh[44]\n+\n+\ta = b + c\n+\n+\taa = a\n+\n+\taeff = aeff * ( aaa )\n+EOF\n+cat >expect.letter-runs-are-words <<-\\EOF\n+\t<BOLD>diff --git a/pre b/post<RESET>\n+\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n+\t<BOLD>--- a/pre<RESET>\n+\t<BOLD>+++ b/post<RESET>\n+\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n+\th(4),<GREEN>hh<RESET>[44]\n+\n+\ta = b + c<RESET>\n+\n+\t<GREEN>aa = a<RESET>\n+\n+\t<GREEN>aeff = aeff * ( aaa<RESET> )\n+EOF\n+cat >expect.non-whitespace-is-word <<-\\EOF\n+\t<BOLD>diff --git a/pre b/post<RESET>\n+\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n+\t<BOLD>--- a/pre<RESET>\n+\t<BOLD>+++ b/post<RESET>\n+\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n+\th(4)<GREEN>,hh[44]<RESET>\n+\n+\ta = b + c<RESET>\n+\n+\t<GREEN>aa = a<RESET>\n+\n+\t<GREEN>aeff = aeff * ( aaa )<RESET>\n+EOF\n+\n+word_diff () {\n+\ttest_must_fail git diff --no-index \"$@\" pre post >output &&\n+\ttest_decode_color <output >output.decrypted &&\n+\ttest_cmp expect output.decrypted\n+}\n+\n+test_language_driver () {\n+\tlang=$1\n+\ttest_expect_success \"diff driver '$lang'\" '\n+\t\tcp \"$TEST_DIRECTORY/t4034/'\"$lang\"'/pre\" \\\n+\t\t\t\"$TEST_DIRECTORY/t4034/'\"$lang\"'/post\" \\\n+\t\t\t\"$TEST_DIRECTORY/t4034/'\"$lang\"'/expect\" . &&\n+\t\techo \"* diff='\"$lang\"'\" >.gitattributes &&\n+\t\tword_diff --color-words\n+\t'\n+}\n+\n test_expect_success setup '\n-\n \tgit config diff.color.old red &&\n \tgit config diff.color.new green &&\n \tgit config diff.color.func magenta\n-\n '\n \n-word_diff () {\n-\ttest_must_fail git diff --no-index \"$@\" pre post > output &&\n-\ttest_decode_color <output >output.decrypted &&\n-\ttest_cmp expect output.decrypted\n-}\n-\n-cat > pre <<\\EOF\n-h(4)\n-\n-a = b + c\n-EOF\n-\n-cat > post <<\\EOF\n-h(4),hh[44]\n-\n-a = b + c\n-\n-aa = a\n-\n-aeff = aeff * ( aaa )\n-EOF\n-\n-cat > expect <<\\EOF\n-<BOLD>diff --git a/pre b/post<RESET>\n-<BOLD>index 330b04f..5ed8eff 100644<RESET>\n-<BOLD>--- a/pre<RESET>\n-<BOLD>+++ b/post<RESET>\n-<CYAN>@@ -1,3 +1,7 @@<RESET>\n-<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>\n-\n-a = b + c<RESET>\n-\n-<GREEN>aa = a<RESET>\n-\n-<GREEN>aeff = aeff * ( aaa )<RESET>\n-EOF\n+test_expect_success 'set up pre and post with runs of whitespace' '\n+\tcp pre.simple pre &&\n+\tcp post.simple post\n+'\n \n test_expect_success 'word diff with runs of whitespace' '\n+\tcat >expect <<-\\EOF &&\n+\t\t<BOLD>diff --git a/pre b/post<RESET>\n+\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n+\t\t<BOLD>--- a/pre<RESET>\n+\t\t<BOLD>+++ b/post<RESET>\n+\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n+\t\t<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>\n \n-\tword_diff --color-words\n+\t\ta = b + c<RESET>\n \n-'\n-\n-test_expect_success '--word-diff=color' '\n-\n-\tword_diff --word-diff=color\n-\n-'\n-\n-test_expect_success '--color --word-diff=color' '\n+\t\t<GREEN>aa = a<RESET>\n \n+\t\t<GREEN>aeff = aeff * ( aaa )<RESET>\n+\tEOF\n+\tword_diff --color-words &&\n+\tword_diff --word-diff=color &&\n \tword_diff --color --word-diff=color\n-\n '\n \n-sed 's/#.*$//' > expect <<EOF\n-diff --git a/pre b/post\n-index 330b04f..5ed8eff 100644\n---- a/pre\n-+++ b/post\n-@@ -1,3 +1,7 @@\n--h(4)\n-+h(4),hh[44]\n-~\n- # significant space\n-~\n- a = b + c\n-~\n-~\n-+aa = a\n-~\n-~\n-+aeff = aeff * ( aaa )\n-~\n-EOF\n-\n test_expect_success '--word-diff=porcelain' '\n-\n+\tsed 's/#.*$//' >expect <<-\\EOF &&\n+\t\tdiff --git a/pre b/post\n+\t\tindex 330b04f..5ed8eff 100644\n+\t\t--- a/pre\n+\t\t+++ b/post\n+\t\t@@ -1,3 +1,7 @@\n+\t\t-h(4)\n+\t\t+h(4),hh[44]\n+\t\t~\n+\t\t # significant space\n+\t\t~\n+\t\t a = b + c\n+\t\t~\n+\t\t~\n+\t\t+aa = a\n+\t\t~\n+\t\t~\n+\t\t+aeff = aeff * ( aaa )\n+\t\t~\n+\tEOF\n \tword_diff --word-diff=porcelain\n-\n '\n \n-cat > expect <<EOF\n-diff --git a/pre b/post\n-index 330b04f..5ed8eff 100644\n---- a/pre\n-+++ b/post\n-@@ -1,3 +1,7 @@\n-[-h(4)-]{+h(4),hh[44]+}\n-\n-a = b + c\n-\n-{+aa = a+}\n-\n-{+aeff = aeff * ( aaa )+}\n-EOF\n-\n test_expect_success '--word-diff=plain' '\n+\tcat >expect <<-\\EOF &&\n+\t\tdiff --git a/pre b/post\n+\t\tindex 330b04f..5ed8eff 100644\n+\t\t--- a/pre\n+\t\t+++ b/post\n+\t\t@@ -1,3 +1,7 @@\n+\t\t[-h(4)-]{+h(4),hh[44]+}\n \n-\tword_diff --word-diff=plain\n+\t\ta = b + c\n \n-'\n-\n-test_expect_success '--word-diff=plain --no-color' '\n+\t\t{+aa = a+}\n \n+\t\t{+aeff = aeff * ( aaa )+}\n+\tEOF\n+\tword_diff --word-diff=plain &&\n \tword_diff --word-diff=plain --no-color\n-\n '\n \n-cat > expect <<EOF\n-<BOLD>diff --git a/pre b/post<RESET>\n-<BOLD>index 330b04f..5ed8eff 100644<RESET>\n-<BOLD>--- a/pre<RESET>\n-<BOLD>+++ b/post<RESET>\n-<CYAN>@@ -1,3 +1,7 @@<RESET>\n-<RED>[-h(4)-]<RESET><GREEN>{+h(4),hh[44]+}<RESET>\n-\n-a = b + c<RESET>\n-\n-<GREEN>{+aa = a+}<RESET>\n-\n-<GREEN>{+aeff = aeff * ( aaa )+}<RESET>\n-EOF\n-\n test_expect_success '--word-diff=plain --color' '\n+\tcat >expect <<-\\EOF &&\n+\t\t<BOLD>diff --git a/pre b/post<RESET>\n+\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n+\t\t<BOLD>--- a/pre<RESET>\n+\t\t<BOLD>+++ b/post<RESET>\n+\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n+\t\t<RED>[-h(4)-]<RESET><GREEN>{+h(4),hh[44]+}<RESET>\n \n+\t\ta = b + c<RESET>\n+\n+\t\t<GREEN>{+aa = a+}<RESET>\n+\n+\t\t<GREEN>{+aeff = aeff * ( aaa )+}<RESET>\n+\tEOF\n \tword_diff --word-diff=plain --color\n-\n '\n \n-cat > expect <<\\EOF\n-<BOLD>diff --git a/pre b/post<RESET>\n-<BOLD>index 330b04f..5ed8eff 100644<RESET>\n-<BOLD>--- a/pre<RESET>\n-<BOLD>+++ b/post<RESET>\n-<CYAN>@@ -1 +1 @@<RESET>\n-<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>\n-<CYAN>@@ -3,0 +4,4 @@<RESET> <RESET><MAGENTA>a = b + c<RESET>\n-\n-<GREEN>aa = a<RESET>\n-\n-<GREEN>aeff = aeff * ( aaa )<RESET>\n-EOF\n-\n test_expect_success 'word diff without context' '\n+\tcat >expect <<-\\EOF &&\n+\t\t<BOLD>diff --git a/pre b/post<RESET>\n+\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n+\t\t<BOLD>--- a/pre<RESET>\n+\t\t<BOLD>+++ b/post<RESET>\n+\t\t<CYAN>@@ -1 +1 @@<RESET>\n+\t\t<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>\n+\t\t<CYAN>@@ -3,0 +4,4 @@<RESET> <RESET><MAGENTA>a = b + c<RESET>\n \n+\t\t<GREEN>aa = a<RESET>\n+\n+\t\t<GREEN>aeff = aeff * ( aaa )<RESET>\n+\tEOF\n \tword_diff --color-words --unified=0\n-\n '\n \n-cat > expect <<\\EOF\n-<BOLD>diff --git a/pre b/post<RESET>\n-<BOLD>index 330b04f..5ed8eff 100644<RESET>\n-<BOLD>--- a/pre<RESET>\n-<BOLD>+++ b/post<RESET>\n-<CYAN>@@ -1,3 +1,7 @@<RESET>\n-h(4),<GREEN>hh<RESET>[44]\n-\n-a = b + c<RESET>\n-\n-<GREEN>aa = a<RESET>\n-\n-<GREEN>aeff = aeff * ( aaa<RESET> )\n-EOF\n-cp expect expect.letter-runs-are-words\n-\n test_expect_success 'word diff with a regular expression' '\n-\n+\tcp expect.letter-runs-are-words expect &&\n \tword_diff --color-words=\"[a-z]+\"\n-\n '\n \n-test_expect_success 'set a diff driver' '\n+test_expect_success 'set up a diff driver' '\n \tgit config diff.testdriver.wordRegex \"[^[:space:]]\" &&\n-\tcat <<EOF > .gitattributes\n-pre diff=testdriver\n-post diff=testdriver\n-EOF\n+\tcat <<-\\EOF >.gitattributes\n+\t\tpre diff=testdriver\n+\t\tpost diff=testdriver\n+\tEOF\n '\n \n test_expect_success 'option overrides .gitattributes' '\n-\n+\tcp expect.letter-runs-are-words expect &&\n \tword_diff --color-words=\"[a-z]+\"\n-\n '\n \n-cat > expect <<\\EOF\n-<BOLD>diff --git a/pre b/post<RESET>\n-<BOLD>index 330b04f..5ed8eff 100644<RESET>\n-<BOLD>--- a/pre<RESET>\n-<BOLD>+++ b/post<RESET>\n-<CYAN>@@ -1,3 +1,7 @@<RESET>\n-h(4)<GREEN>,hh[44]<RESET>\n-\n-a = b + c<RESET>\n-\n-<GREEN>aa = a<RESET>\n-\n-<GREEN>aeff = aeff * ( aaa )<RESET>\n-EOF\n-cp expect expect.non-whitespace-is-word\n-\n test_expect_success 'use regex supplied by driver' '\n-\n+\tcp expect.non-whitespace-is-word expect &&\n \tword_diff --color-words\n-\n '\n \n-test_expect_success 'set diff.wordRegex option' '\n+test_expect_success 'set up diff.wordRegex option' '\n \tgit config diff.wordRegex \"[[:alnum:]]+\"\n '\n \n-cp expect.letter-runs-are-words expect\n-\n test_expect_success 'command-line overrides config' '\n+\tcp expect.letter-runs-are-words expect &&\n \tword_diff --color-words=\"[a-z]+\"\n '\n \n-cat > expect <<\\EOF\n-<BOLD>diff --git a/pre b/post<RESET>\n-<BOLD>index 330b04f..5ed8eff 100644<RESET>\n-<BOLD>--- a/pre<RESET>\n-<BOLD>+++ b/post<RESET>\n-<CYAN>@@ -1,3 +1,7 @@<RESET>\n-h(4),<GREEN>{+hh+}<RESET>[44]\n-\n-a = b + c<RESET>\n-\n-<GREEN>{+aa = a+}<RESET>\n-\n-<GREEN>{+aeff = aeff * ( aaa+}<RESET> )\n-EOF\n-\n test_expect_success 'command-line overrides config: --word-diff-regex' '\n+\tcat >expect <<-\\EOF &&\n+\t\t<BOLD>diff --git a/pre b/post<RESET>\n+\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n+\t\t<BOLD>--- a/pre<RESET>\n+\t\t<BOLD>+++ b/post<RESET>\n+\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n+\t\th(4),<GREEN>{+hh+}<RESET>[44]\n+\n+\t\ta = b + c<RESET>\n+\n+\t\t<GREEN>{+aa = a+}<RESET>\n+\n+\t\t<GREEN>{+aeff = aeff * ( aaa+}<RESET> )\n+\tEOF\n \tword_diff --color --word-diff-regex=\"[a-z]+\"\n '\n \n-cp expect.non-whitespace-is-word expect\n-\n test_expect_success '.gitattributes override config' '\n+\tcp expect.non-whitespace-is-word expect &&\n \tword_diff --color-words\n '\n \n-test_expect_success 'remove diff driver regex' '\n-\tgit config --unset diff.testdriver.wordRegex\n+test_expect_success 'setup: remove diff driver regex' '\n+\ttest_might_fail git config --unset diff.testdriver.wordRegex\n '\n \n-cat > expect <<\\EOF\n-<BOLD>diff --git a/pre b/post<RESET>\n-<BOLD>index 330b04f..5ed8eff 100644<RESET>\n-<BOLD>--- a/pre<RESET>\n-<BOLD>+++ b/post<RESET>\n-<CYAN>@@ -1,3 +1,7 @@<RESET>\n-h(4),<GREEN>hh[44<RESET>]\n-\n-a = b + c<RESET>\n-\n-<GREEN>aa = a<RESET>\n-\n-<GREEN>aeff = aeff * ( aaa<RESET> )\n-EOF\n-\n test_expect_success 'use configured regex' '\n+\tcat >expect <<-\\EOF &&\n+\t\t<BOLD>diff --git a/pre b/post<RESET>\n+\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n+\t\t<BOLD>--- a/pre<RESET>\n+\t\t<BOLD>+++ b/post<RESET>\n+\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n+\t\th(4),<GREEN>hh[44<RESET>]\n+\n+\t\ta = b + c<RESET>\n+\n+\t\t<GREEN>aa = a<RESET>\n+\n+\t\t<GREEN>aeff = aeff * ( aaa<RESET> )\n+\tEOF\n \tword_diff --color-words\n '\n \n-echo 'aaa (aaa)' > pre\n-echo 'aaa (aaa) aaa' > post\n-\n-cat > expect <<\\EOF\n-<BOLD>diff --git a/pre b/post<RESET>\n-<BOLD>index c29453b..be22f37 100644<RESET>\n-<BOLD>--- a/pre<RESET>\n-<BOLD>+++ b/post<RESET>\n-<CYAN>@@ -1 +1 @@<RESET>\n-aaa (aaa) <GREEN>aaa<RESET>\n-EOF\n-\n test_expect_success 'test parsing words for newline' '\n-\n+\techo \"aaa (aaa)\" >pre &&\n+\techo \"aaa (aaa) aaa\" >post &&\n+\tcat >expect <<-\\EOF &&\n+\t\t<BOLD>diff --git a/pre b/post<RESET>\n+\t\t<BOLD>index c29453b..be22f37 100644<RESET>\n+\t\t<BOLD>--- a/pre<RESET>\n+\t\t<BOLD>+++ b/post<RESET>\n+\t\t<CYAN>@@ -1 +1 @@<RESET>\n+\t\taaa (aaa) <GREEN>aaa<RESET>\n+\tEOF\n \tword_diff --color-words=\"a+\"\n-\n-\n '\n \n-echo '(:' > pre\n-echo '(' > post\n-\n-cat > expect <<\\EOF\n-<BOLD>diff --git a/pre b/post<RESET>\n-<BOLD>index 289cb9d..2d06f37 100644<RESET>\n-<BOLD>--- a/pre<RESET>\n-<BOLD>+++ b/post<RESET>\n-<CYAN>@@ -1 +1 @@<RESET>\n-(<RED>:<RESET>\n-EOF\n-\n test_expect_success 'test when words are only removed at the end' '\n-\n+\techo \"(:\" >pre &&\n+\techo \"(\" >post &&\n+\tcat >expect <<-\\EOF &&\n+\t\t<BOLD>diff --git a/pre b/post<RESET>\n+\t\t<BOLD>index 289cb9d..2d06f37 100644<RESET>\n+\t\t<BOLD>--- a/pre<RESET>\n+\t\t<BOLD>+++ b/post<RESET>\n+\t\t<CYAN>@@ -1 +1 @@<RESET>\n+\t\t(<RED>:<RESET>\n+\tEOF\n \tword_diff --color-words=.\n-\n '\n \n-cat > expect <<\\EOF\n-diff --git a/pre b/post\n-index 289cb9d..2d06f37 100644\n---- a/pre\n-+++ b/post\n-@@ -1 +1 @@\n--(:\n-+(\n-EOF\n-\n test_expect_success '--word-diff=none' '\n-\n+\techo \"(:\" >pre &&\n+\techo \"(\" >post &&\n+\tcat >expect <<-\\EOF &&\n+\t\tdiff --git a/pre b/post\n+\t\tindex 289cb9d..2d06f37 100644\n+\t\t--- a/pre\n+\t\t+++ b/post\n+\t\t@@ -1 +1 @@\n+\t\t-(:\n+\t\t+(\n+\tEOF\n \tword_diff --word-diff=plain --word-diff=none\n-\n '\n \n-word_diff_for_language () {\n-\tcp \"$TEST_DIRECTORY/t4034/$1/pre\" \\\n-\t\t\"$TEST_DIRECTORY/t4034/$1/post\" \\\n-\t\t\"$TEST_DIRECTORY/t4034/$1/expect\" . &&\n-\techo \"* diff=$1\" >.gitattributes &&\n-\tword_diff --color-words && cp output output.$1\n-}\n-\n-for lang_dir in $TEST_DIRECTORY/t4034/*; do\n-\tlang=${lang_dir#$TEST_DIRECTORY/t4034/}\n-\ttest_expect_success \"diff driver '$lang' has sane word regex\" \"\n-\t\tword_diff_for_language $lang\n-\t\"\n-done\n+test_language_driver bibtex\n+test_language_driver cpp\n+test_language_driver csharp\n+test_language_driver fortran\n+test_language_driver html\n+test_language_driver java\n+test_language_driver objc\n+test_language_driver pascal\n+test_language_driver php\n+test_language_driver python\n+test_language_driver ruby\n+test_language_driver tex\n \n test_done\n-- \n1.7.4.rc1\n"},{"id":"159588","messageId":"7voc7eks6e.fsf_-_@alter.siamese.dyndns.org","threadId":"26077","inReplyTo":"20110111214811.GB29133@burratino","subject":"Re*: [PATCH 1/3] t4034: bulk verify builtin word regex sanity","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-18T18:00:57Z","receivedAt":"2011-01-18T18:00:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> From: Thomas Rast <trast@student.ethz.ch>\n> Date: Sat, 18 Dec 2010 17:17:54 +0100\n>\n> The builtin word regexes should be tested with some simple examples\n> against simple issues.  Do this in bulk.\n\nThanks.\n\n> diff --git a/t/t4034/bibtex/expect b/t/t4034/bibtex/expect\n> new file mode 100644\n> index 0000000..a157774\n> --- /dev/null\n> +++ b/t/t4034/bibtex/expect\n> @@ -0,0 +1,15 @@\n> +<BOLD>diff --git a/pre b/post<RESET>\n> +<BOLD>index 95cd55b..ddcba9b 100644<RESET>\n\nHaving to change this line every time the test input (or output) has\nchanged is somewhat unfortunate.\n\nAlso I noticed that \"word_diff\" shell function has this:\n\n       test_must_fail git diff --no-index \"$@\" pre post >output &&\n\nwhich solicits two comments:\n\n - We do not seem to document that --no-index implies --exit-code, ever\n   since the latter option was introduced at 41bbf9d (Allow git-diff exit\n   with codes similar to diff(1), 2007-03-14).  Probably we should.\n\n - This assumes that no test vector would have identical pre/post pair\n   that expects no output, which feels somewhat limiting.\n\nWhat we care about in this test is that \"git diff --no-index\" does not die\nan uncontrolled death, so test_might_fail may be more appropriate.\n\nHere is another that probably should be squashed to this patch together\nwith 3/3 to add tests for the perl driver (I noticed it only because 2/3\nhad trivial conflict due to recent addition of it).\n\n-- >8 --\nFrom: Junio C Hamano <gitster@pobox.com>\nDate: Tue, 18 Jan 2011 09:43:43 -0800\nSubject: [PATCH] t4034 (diff --word-diff): add a minimum Perl drier test vector\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4034-diff-words.sh |    1 +\n t/t4034/perl/expect   |   13 +++++++++++++\n t/t4034/perl/post     |   22 ++++++++++++++++++++++\n t/t4034/perl/pre      |   22 ++++++++++++++++++++++\n 4 files changed, 58 insertions(+), 0 deletions(-)\n create mode 100644 t/t4034/perl/expect\n create mode 100644 t/t4034/perl/post\n create mode 100644 t/t4034/perl/pre\n\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex c3b1c48..37aeab0 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -301,6 +301,7 @@ test_language_driver html\n test_language_driver java\n test_language_driver objc\n test_language_driver pascal\n+test_language_driver perl\n test_language_driver php\n test_language_driver python\n test_language_driver ruby\ndiff --git a/t/t4034/perl/expect b/t/t4034/perl/expect\nnew file mode 100644\nindex 0000000..a1deb6b\n--- /dev/null\n+++ b/t/t4034/perl/expect\n@@ -0,0 +1,13 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index f6610d3..e8b72ef 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -4,8 +4,8 @@<RESET>\n+\n+package Frotz;<RESET>\n+sub new {<RESET>\n+\tmy <GREEN>(<RESET>$class<GREEN>, %opts)<RESET> = <RED>shift<RESET><GREEN>@_<RESET>;\n+\treturn bless { <GREEN>xyzzy => \"nitfol\", %opts<RESET> }, $class;\n+}<RESET>\n+\n+__END__<RESET>\ndiff --git a/t/t4034/perl/post b/t/t4034/perl/post\nnew file mode 100644\nindex 0000000..e8b72ef\n--- /dev/null\n+++ b/t/t4034/perl/post\n@@ -0,0 +1,22 @@\n+#!/usr/bin/perl\n+\n+use strict;\n+\n+package Frotz;\n+sub new {\n+\tmy ($class, %opts) = @_;\n+\treturn bless { xyzzy => \"nitfol\", %opts }, $class;\n+}\n+\n+__END__\n+=head1 NAME\n+\n+frotz - Frotz\n+\n+=head1 SYNOPSIS\n+\n+  use frotz;\n+\n+  $nitfol = new Frotz();\n+\n+=cut\ndiff --git a/t/t4034/perl/pre b/t/t4034/perl/pre\nnew file mode 100644\nindex 0000000..f6610d3\n--- /dev/null\n+++ b/t/t4034/perl/pre\n@@ -0,0 +1,22 @@\n+#!/usr/bin/perl\n+\n+use strict;\n+\n+package Frotz;\n+sub new {\n+\tmy $class = shift;\n+\treturn bless {}, $class;\n+}\n+\n+__END__\n+=head1 NAME\n+\n+frotz - Frotz\n+\n+=head1 SYNOPSIS\n+\n+  use frotz;\n+\n+  $nitfol = new Frotz();\n+\n+=cut\n-- \n1.7.4.rc2.226.g63d9a\n"}]}