git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Hoelzer <shoelzer@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Sup Yut Sum <ch3cooli@gmail.com>, git <git@vger.kernel.org>
Subject: Re: [PATCH 1/2] userdiff: support C# async methods and correct C# keywords
Date: Sat, 7 Jun 2014 11:00:57 -0500	[thread overview]
Message-ID: <CACbrTHeue4VW7B6vBLyaBFGHEghQ-reQX_Rnk_PKKTDLsgi+xg@mail.gmail.com> (raw)
In-Reply-To: <xmqq61keq6wc.fsf@gitster.dls.corp.google.com>

On Fri, Jun 6, 2014 at 12:34 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Steve Hoelzer <shoelzer@gmail.com> writes:
>
>> 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" ;-)

Indeed. Doh.

> 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?

No, I would never expect to see 'is' or 'as' at the beginning of a line.

> 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.

Not sure about the purpose of those lines, but I think you're correct.

Steve

>> 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 */

      reply	other threads:[~2014-06-07 16:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-02  4:13 [PATCH 1/2] userdiff: support C# async methods and correct C# keywords Sup Yut Sum
2014-06-02  4:13 ` [PATCH 2/2] userdiff: support Java try keyword Sup Yut Sum
2014-06-02 19:25   ` Junio C Hamano
2014-06-05 22:59 ` [PATCH 1/2] userdiff: support C# async methods and correct C# keywords Junio C Hamano
2014-06-06 13:27   ` Steve Hoelzer
2014-06-06 17:34     ` Junio C Hamano
2014-06-07 16:00       ` Steve Hoelzer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACbrTHeue4VW7B6vBLyaBFGHEghQ-reQX_Rnk_PKKTDLsgi+xg@mail.gmail.com \
    --to=shoelzer@gmail.com \
    --cc=ch3cooli@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).