Re: [PATCH] userdiff: add built-in pattern for CSS
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 2, 2016, 23:07 UTC
- Message-ID
- <xmqq1t4frxz6.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160602224809.5167-1-william.duclot@ensimag.grenoble-inp.fr>
William Duclot <william.duclot@ensimag.grenoble-inp.fr> writes:
Show 19 quoted lines
> diff --git a/userdiff.c b/userdiff.c
> index 6bf2505..00fc3bf 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -148,6 +148,18 @@ PATTERNS("csharp",
> "[a-zA-Z_][a-zA-Z0-9_]*"
> "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
> "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"),
> +IPATTERN("css",
> + "!^.*;\n"
> + "^[_a-z0-9].*$",
> + /* -- */
> + /*
> + * This regex comes from W3C CSS specs. Should theoretically also
> + * allow ISO 10646 characters U+00A0 and higher,
> + * but they are not handled in this regex.
> + */
> + "-?[_a-zA-F][-_a-zA-F0-9]*" /* identifiers */
> + "|-?[0-9]+|\\#[0-9a-fA-F]+" /* numbers */You could now lose A-F from the above two lines. In fact, the first line "identifiers" has "a-zA-F", which probably would work correctly under IPATTERN() to include 'G-Z' as part of the legit letters for identifiers, but is indeed misleading.
> +),
> { "default", NULL, -1, { NULL, 0 } },
> };
> #undef PATTERNS