[PATCH 4/4] diff.c: convert builtin funcname patterns to extended regular expressions
- From
Brandon Casey <casey@nrlssc.navy.mil>
- Date
- Sep 18, 2008, 00:21 UTC
- Message-ID
- <-f-gqL4SkA8Uh7hSuKT-JDY0g26jHn3fDQCE24MB1nKWUMLZWuSseg@cipher.nrlssc.navy.mil>
- In-Reply-To
- <7v3ak06jzj.fsf@gitster.siamese.dyndns.org>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> ---
This is a blind conversion removing \\ before ( and { etc. and adding \\ before naked ( and { etc.
I hope the authors who last touched these patterns will help with testing:
bibtex: Johan Herland html: Johan Herland java: Junio Hamano, Jeff King pascal: Avery Pennarun php: Andreas Ericsson python: Kirill Smelkov ruby: Giuseppe Bilotta tex: Johan Herland
thanks, -brandon
diff.c | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/diff.c b/diff.c index ad5e551..25d2259 100644 --- a/diff.c +++ b/diff.c @@ -1401,23 +1401,23 @@ static struct funcname_pattern_entry { const char *pattern; const int cflags; } builtin_funcname_pattern[] = { - { "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$", 0 }, - { "html", "^\\s*\\(<[Hh][1-6]\\s.*>.*\\)$", 0 }, - { "java", "!^[ ]*\\(catch\\|do\\|for\\|if\\|instanceof\\|" - "new\\|return\\|switch\\|throw\\|while\\)\n" - "^[ ]*\\(\\([ ]*" - "[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}" - "[ ]*([^;]*\\)$", 0 }, - { "pascal", "^\\(\\(procedure\\|function\\|constructor\\|" - "destructor\\|interface\\|implementation\\|" - "initialization\\|finalization\\)[ \t]*.*\\)$" - "\\|" - "^\\(.*=[ \t]*\\(class\\|record\\).*\\)$", - 0 }, - { "php", "^[\t ]*\\(\\(function\\|class\\).*\\)", 0 }, - { "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$", 0 }, - { "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$", 0 }, - { "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$", 0 }, + { "bibtex", "(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#\\}\\{~%]*).*$", 1 }, + { "html", "^\\s*(<[Hh][1-6]\\s.*>.*)$", 1 }, + { "java", "!^[ ]*(catch|do|for|if|instanceof|" + "new|return|switch|throw|while)\n" + "^[ ]*(([ ]*" + "[A-Za-z_][A-Za-z_0-9]*){2,}" + "[ ]*\\([^;]*)$", 1 }, + { "pascal", "^((procedure|function|constructor|" + "destructor|interface|implementation|" + "initialization|finalization)[ \t]*.*)$" + "|" + "^(.*=[ \t]*(class|record).*)$", + 1 }, + { "php", "^[\t ]*((function|class).*)", 1 }, + { "python", "^\\s*((class|def)\\s.*)$", 1 }, + { "ruby", "^\\s*((class|module|def)\\s.*)$", 1 }, + { "tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$", 1 }, }; static const struct funcname_pattern_entry *funcname_pattern(const char *ident)
-- 1.6.0.1.244.gdc19