{"thread":{"id":"36810","subject":"[PATCH 1/2] userdiff: support C# async methods and correct C# keywords","startedAt":"2014-06-02T04:13:24Z","lastAt":"2014-06-07T16:00:57Z","messageCount":7,"participants":["Sup Yut Sum","Junio C Hamano","Steve Hoelzer"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"243113","messageId":"1401682405-3319-1-git-send-email-ch3cooli@gmail.com","threadId":"36810","inReplyTo":null,"subject":"[PATCH 1/2] userdiff: support C# async methods and correct C# keywords","fromName":"Sup Yut Sum","fromEmail":"ch3cooli@gmail.com","sentAt":"2014-06-02T04:13:24Z","receivedAt":"2014-06-02T04:13:24Z","isPatch":true,"sender":{"key":"ch3cooli@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2804967?v=4"},"body":"async is in C# 5.0\nforeach is in C# 1.0\ninstanceof is in Java. The similar keywords are typeof, is, as in C# 1.0\ndefault, try are in C# 1.0\n\nSigned-off-by: Sup Yut Sum <ch3cooli@gmail.com>\n---\n userdiff.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/userdiff.c b/userdiff.c\nindex fad52d6..96eda6c 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -134,9 +134,9 @@ PATTERNS(\"cpp\",\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+\t \"!^[ \\t]*(do|while|for|foreach|if|else|typeof|is|as|new|return|switch|case|default|throw|try|catch|using)\\n\"\n \t /* Methods and constructors */\n-\t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[<>@._[:alnum:]]+[ \\t]*\\\\(.*\\\\))[ \\t]*$\\n\"\n+\t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe|async)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[<>@._[:alnum:]]+[ \\t]*\\\\(.*\\\\))[ \\t]*$\\n\"\n \t /* Properties */\n \t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[@._[:alnum:]]+)[ \\t]*$\\n\"\n \t /* Type definitions */\n-- \n1.9.1\n"},{"id":"243114","messageId":"1401682405-3319-2-git-send-email-ch3cooli@gmail.com","threadId":"36810","inReplyTo":"1401682405-3319-1-git-send-email-ch3cooli@gmail.com","subject":"[PATCH 2/2] userdiff: support Java try keyword","fromName":"Sup Yut Sum","fromEmail":"ch3cooli@gmail.com","sentAt":"2014-06-02T04:13:25Z","receivedAt":"2014-06-02T04:13:25Z","isPatch":true,"sender":{"key":"ch3cooli@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2804967?v=4"},"body":"try keyword is enhanced in Java 7, see try-with-resources Statement\ntry (XX yy = new XX()) {\n} catch (Exception e){\n}\n\nSigned-off-by: Sup Yut Sum <ch3cooli@gmail.com>\n---\n userdiff.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/userdiff.c b/userdiff.c\nindex 96eda6c..49e898b 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -39,7 +39,7 @@ IPATTERN(\"fortran\",\n PATTERNS(\"html\", \"^[ \\t]*(<[Hh][1-6][ \\t].*>.*)$\",\n \t \"[^<>= \\t]+\"),\n PATTERNS(\"java\",\n-\t \"!^[ \\t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\\n\"\n+\t \"!^[ \\t]*(try|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 \t /* -- */\n \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n-- \n1.9.1\n"},{"id":"243147","messageId":"xmqqr4373yhr.fsf@gitster.dls.corp.google.com","threadId":"36810","inReplyTo":"1401682405-3319-2-git-send-email-ch3cooli@gmail.com","subject":"Re: [PATCH 2/2] userdiff: support Java try keyword","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-06-02T19:25:20Z","receivedAt":"2014-06-02T19:25:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sup Yut Sum <ch3cooli@gmail.com> writes:\n\n> try keyword is enhanced in Java 7, see try-with-resources Statement\n> try (XX yy = new XX()) {\n> } catch (Exception e){\n> }\n\nSorry, but I do not see the connection between the proposed log\nmessage and what the patch does.\n\nThe patch seems to tell me this:\n\n    We did not know 'try' was a keyword to begin a block for java,\n    whether that 'try' is a traditional 'try' or 'try' in\n    'try-with-resources'.  With this patch we start recognising\n    'try' as a keyword.\n\nand nothing else, but the log message makes it sound as if the more\nprevalent use of try-with-resources in Java 7 makes it for some\nreason more important to recognise it as a keyword than it used to\nbe---or is that what you meant to say?\n\nPuzzled...\n\n> Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>\n> ---\n>  userdiff.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/userdiff.c b/userdiff.c\n> index 96eda6c..49e898b 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -39,7 +39,7 @@ IPATTERN(\"fortran\",\n>  PATTERNS(\"html\", \"^[ \\t]*(<[Hh][1-6][ \\t].*>.*)$\",\n>  \t \"[^<>= \\t]+\"),\n>  PATTERNS(\"java\",\n> -\t \"!^[ \\t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\\n\"\n> +\t \"!^[ \\t]*(try|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>  \t /* -- */\n>  \t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n"},{"id":"243429","messageId":"xmqqy4xbq7xo.fsf@gitster.dls.corp.google.com","threadId":"36810","inReplyTo":"1401682405-3319-1-git-send-email-ch3cooli@gmail.com","subject":"Re: [PATCH 1/2] userdiff: support C# async methods and correct C# keywords","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-06-05T22:59:31Z","receivedAt":"2014-06-05T22:59:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sup Yut Sum <ch3cooli@gmail.com> writes:\n\n> async is in C# 5.0\n> foreach is in C# 1.0\n\n> instanceof is in Java. The similar keywords are typeof, is, as in C# 1.0\n\nThis one made me read it twice, until I realized you meant\n\n    instanceof() is listed as keywords, but there is no such thing\n    (it is in Java, though); in C# we use typeof() for similar\n    purposes\n\n> default, try are in C# 1.0\n>\n> Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>\n> ---\n>  userdiff.c | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/userdiff.c b/userdiff.c\n> index fad52d6..96eda6c 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -134,9 +134,9 @@ PATTERNS(\"cpp\",\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> +\t \"!^[ \\t]*(do|while|for|foreach|if|else|typeof|is|as|new|return|switch|case|default|throw|try|catch|using)\\n\"\n>  \t /* Methods and constructors */\n> -\t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[<>@._[:alnum:]]+[ \\t]*\\\\(.*\\\\))[ \\t]*$\\n\"\n> +\t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe|async)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[<>@._[:alnum:]]+[ \\t]*\\\\(.*\\\\))[ \\t]*$\\n\"\n>  \t /* Properties */\n>  \t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[@._[:alnum:]]+)[ \\t]*$\\n\"\n>  \t /* Type definitions */\n"},{"id":"243456","messageId":"CACbrTHcVNmffTHPPnPYDXXwYQacmiS77573Y+GpyjSv-yHQM7g@mail.gmail.com","threadId":"36810","inReplyTo":"xmqqy4xbq7xo.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 1/2] userdiff: support C# async methods and correct C# keywords","fromName":"Steve Hoelzer","fromEmail":"shoelzer@gmail.com","sentAt":"2014-06-06T13:27:43Z","receivedAt":"2014-06-06T13:27:43Z","isPatch":true,"sender":{"key":"shoelzer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/4623209?v=4"},"body":"On Thu, Jun 5, 2014 at 5:59 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Sup Yut Sum <ch3cooli@gmail.com> writes:\n>\n>> async is in C# 5.0\n>> foreach is in C# 1.0\n>\n>> instanceof is in Java. The similar keywords are typeof, is, as in C# 1.0\n>\n> This one made me read it twice, until I realized you meant\n>\n>     instanceof() is listed as keywords, but there is no such thing\n>     (it is in Java, though); in C# we use typeof() for similar\n>     purposes\n\nThe original email was a bit hard to parse. Junio's clarification left\nout the C# keywords 'is' and 'as'. I suggest phrasing it like this:\n\ninstanceof() is listed as keywords, but there is no such thing (it is\nin Java, though); in C# we use typeof(), 'is', and 'as for similar\npurposes\n"},{"id":"243506","messageId":"xmqq61keq6wc.fsf@gitster.dls.corp.google.com","threadId":"36810","inReplyTo":"CACbrTHcVNmffTHPPnPYDXXwYQacmiS77573Y+GpyjSv-yHQM7g@mail.gmail.com","subject":"Re: [PATCH 1/2] userdiff: support C# async methods and correct C# keywords","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-06-06T17:34:11Z","receivedAt":"2014-06-06T17:34:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Steve Hoelzer <shoelzer@gmail.com> writes:\n\n> On Thu, Jun 5, 2014 at 5:59 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Sup Yut Sum <ch3cooli@gmail.com> writes:\n>>\n>>> async is in C# 5.0\n>>> foreach is in C# 1.0\n>>\n>>> instanceof is in Java. The similar keywords are typeof, is, as in C# 1.0\n>>\n>> This one made me read it twice, until I realized you meant\n>>\n>>     instanceof() is listed as keywords, but there is no such thing\n>>     (it is in Java, though); in C# we use typeof() for similar\n>>     purposes\n>\n> The original email was a bit hard to parse. Junio's clarification left\n> out the C# keywords 'is' and 'as'. I suggest phrasing it like this:\n>\n> instanceof() is listed as keywords, but there is no such thing (it is\n> in Java, though); in C# we use typeof(), 'is', and 'as for similar\n> purposes\n\nYou would need to balance the quotes around \"as\" ;-)\n\nBut reading the patch again after noticing that you have () after\ntypeof but not after is/as, I am not sure if the change proposed\nhere is even correct for the latter two.  I do not speal c-sharp, so\nI asked http://msdn.microsoft.com/en-us/library/cscsdfbt.aspx for\nsome examples and here are what I found:\n\n    Type t = typeof(ExampleClass)\n    Base b = derived as Base;\n    if (obj is MyObject) ...\n\nUnlike the control-flow keywords (e.g. do/while/for/...), do they\ntypically appear at the beginning of lines?  \n\nIsn't the purpose of these !^[ \\t]* patterns to reject lines that\nbegin with the language keywords that do not start functions, so\nlisting a keyword that does not usually appear at the beginning of\nline looks like a churn that is not useful.\n\n> diff --git a/userdiff.c b/userdiff.c\n> index fad52d6..96eda6c 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -134,9 +134,9 @@ PATTERNS(\"cpp\",\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> +\t \"!^[ \\t]*(do|while|for|foreach|if|else|typeof|is|as|new|return|switch|case|default|throw|try|catch|using)\\n\"\n>  \t /* Methods and constructors */\n> -\t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[<>@._[:alnum:]]+[ \\t]*\\\\(.*\\\\))[ \\t]*$\\n\"\n> +\t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe|async)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[<>@._[:alnum:]]+[ \\t]*\\\\(.*\\\\))[ \\t]*$\\n\"\n>  \t /* Properties */\n>  \t \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[@._[:alnum:]]+)[ \\t]*$\\n\"\n>  \t /* Type definitions */\n"},{"id":"243597","messageId":"CACbrTHeue4VW7B6vBLyaBFGHEghQ-reQX_Rnk_PKKTDLsgi+xg@mail.gmail.com","threadId":"36810","inReplyTo":"xmqq61keq6wc.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 1/2] userdiff: support C# async methods and correct C# keywords","fromName":"Steve Hoelzer","fromEmail":"shoelzer@gmail.com","sentAt":"2014-06-07T16:00:57Z","receivedAt":"2014-06-07T16:00:57Z","isPatch":true,"sender":{"key":"shoelzer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/4623209?v=4"},"body":"On Fri, Jun 6, 2014 at 12:34 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Steve Hoelzer <shoelzer@gmail.com> writes:\n>\n>> instanceof() is listed as keywords, but there is no such thing (it is\n>> in Java, though); in C# we use typeof(), 'is', and 'as for similar\n>> purposes\n>\n> You would need to balance the quotes around \"as\" ;-)\n\nIndeed. Doh.\n\n> But reading the patch again after noticing that you have () after\n> typeof but not after is/as, I am not sure if the change proposed\n> here is even correct for the latter two.  I do not speal c-sharp, so\n> I asked http://msdn.microsoft.com/en-us/library/cscsdfbt.aspx for\n> some examples and here are what I found:\n>\n>     Type t = typeof(ExampleClass)\n>     Base b = derived as Base;\n>     if (obj is MyObject) ...\n>\n> Unlike the control-flow keywords (e.g. do/while/for/...), do they\n> typically appear at the beginning of lines?\n\nNo, I would never expect to see 'is' or 'as' at the beginning of a line.\n\n> Isn't the purpose of these !^[ \\t]* patterns to reject lines that\n> begin with the language keywords that do not start functions, so\n> listing a keyword that does not usually appear at the beginning of\n> line looks like a churn that is not useful.\n\nNot sure about the purpose of those lines, but I think you're correct.\n\nSteve\n\n>> diff --git a/userdiff.c b/userdiff.c\n>> index fad52d6..96eda6c 100644\n>> --- a/userdiff.c\n>> +++ b/userdiff.c\n>> @@ -134,9 +134,9 @@ PATTERNS(\"cpp\",\n>>        \"|[-+*/<>%&^|=!]=|--|\\\\+\\\\+|<<=?|>>=?|&&|\\\\|\\\\||::|->\\\\*?|\\\\.\\\\*\"),\n>>  PATTERNS(\"csharp\",\n>>        /* Keywords */\n>> -      \"!^[ \\t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\\n\"\n>> +      \"!^[ \\t]*(do|while|for|foreach|if|else|typeof|is|as|new|return|switch|case|default|throw|try|catch|using)\\n\"\n>>        /* Methods and constructors */\n>> -      \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[<>@._[:alnum:]]+[ \\t]*\\\\(.*\\\\))[ \\t]*$\\n\"\n>> +      \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe|async)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[<>@._[:alnum:]]+[ \\t]*\\\\(.*\\\\))[ \\t]*$\\n\"\n>>        /* Properties */\n>>        \"^[ \\t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \\t]+)*[][<>@.~_[:alnum:]]+[ \\t]+[@._[:alnum:]]+)[ \\t]*$\\n\"\n>>        /* Type definitions */\n"}]}