Re: [PATCH 1/2] userdiff: support C# async methods and correct C# keywords

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Steve Hoelzer <shoelzer@xxxxxxxxx> writes:

> On Thu, Jun 5, 2014 at 5:59 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> Sup Yut Sum <ch3cooli@xxxxxxxxx> writes:
>>
>>> async is in C# 5.0
>>> foreach is in C# 1.0
>>
>>> instanceof is in Java. The similar keywords are typeof, is, as in C# 1.0
>>
>> This one made me read it twice, until I realized you meant
>>
>>     instanceof() is listed as keywords, but there is no such thing
>>     (it is in Java, though); in C# we use typeof() for similar
>>     purposes
>
> The original email was a bit hard to parse. Junio's clarification left
> out the C# keywords 'is' and 'as'. I suggest phrasing it like this:
>
> instanceof() is listed as keywords, but there is no such thing (it is
> in Java, though); in C# we use typeof(), 'is', and 'as for similar
> purposes

You would need to balance the quotes around "as" ;-)

But reading the patch again after noticing that you have () after
typeof but not after is/as, I am not sure if the change proposed
here is even correct for the latter two.  I do not speal c-sharp, so
I asked http://msdn.microsoft.com/en-us/library/cscsdfbt.aspx for
some examples and here are what I found:

    Type t = typeof(ExampleClass)
    Base b = derived as Base;
    if (obj is MyObject) ...

Unlike the control-flow keywords (e.g. do/while/for/...), do they
typically appear at the beginning of lines?  

Isn't the purpose of these !^[ \t]* patterns to reject lines that
begin with the language keywords that do not start functions, so
listing a keyword that does not usually appear at the beginning of
line looks like a churn that is not useful.

> diff --git a/userdiff.c b/userdiff.c
> index fad52d6..96eda6c 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -134,9 +134,9 @@ PATTERNS("cpp",
>  	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"),
>  PATTERNS("csharp",
>  	 /* Keywords */
> -	 "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
> +	 "!^[ \t]*(do|while|for|foreach|if|else|typeof|is|as|new|return|switch|case|default|throw|try|catch|using)\n"
>  	 /* Methods and constructors */
> -	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
> +	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe|async)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
>  	 /* Properties */
>  	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
>  	 /* Type definitions */
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]