* [PATCH 1/2] userdiff: support C# async methods and correct C# keywords
@ 2014-06-02 4:13 Sup Yut Sum
2014-06-02 4:13 ` [PATCH 2/2] userdiff: support Java try keyword Sup Yut Sum
2014-06-05 22:59 ` [PATCH 1/2] userdiff: support C# async methods and correct C# keywords Junio C Hamano
0 siblings, 2 replies; 7+ messages in thread
From: Sup Yut Sum @ 2014-06-02 4:13 UTC (permalink / raw
To: git; +Cc: gitster, Sup Yut Sum
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
default, try are in C# 1.0
Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
---
userdiff.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 */
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] userdiff: support Java try keyword
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 ` 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
1 sibling, 1 reply; 7+ messages in thread
From: Sup Yut Sum @ 2014-06-02 4:13 UTC (permalink / raw
To: git; +Cc: gitster, Sup Yut Sum
try keyword is enhanced in Java 7, see try-with-resources Statement
try (XX yy = new XX()) {
} catch (Exception e){
}
Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
---
userdiff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/userdiff.c b/userdiff.c
index 96eda6c..49e898b 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -39,7 +39,7 @@ IPATTERN("fortran",
PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$",
"[^<>= \t]+"),
PATTERNS("java",
- "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
+ "!^[ \t]*(try|catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
"^[ \t]*(([A-Za-z_][A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$",
/* -- */
"[a-zA-Z_][a-zA-Z0-9_]*"
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] userdiff: support Java try keyword
2014-06-02 4:13 ` [PATCH 2/2] userdiff: support Java try keyword Sup Yut Sum
@ 2014-06-02 19:25 ` Junio C Hamano
0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2014-06-02 19:25 UTC (permalink / raw
To: Sup Yut Sum; +Cc: git
Sup Yut Sum <ch3cooli@gmail.com> writes:
> try keyword is enhanced in Java 7, see try-with-resources Statement
> try (XX yy = new XX()) {
> } catch (Exception e){
> }
Sorry, but I do not see the connection between the proposed log
message and what the patch does.
The patch seems to tell me this:
We did not know 'try' was a keyword to begin a block for java,
whether that 'try' is a traditional 'try' or 'try' in
'try-with-resources'. With this patch we start recognising
'try' as a keyword.
and nothing else, but the log message makes it sound as if the more
prevalent use of try-with-resources in Java 7 makes it for some
reason more important to recognise it as a keyword than it used to
be---or is that what you meant to say?
Puzzled...
> Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
> ---
> userdiff.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/userdiff.c b/userdiff.c
> index 96eda6c..49e898b 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -39,7 +39,7 @@ IPATTERN("fortran",
> PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$",
> "[^<>= \t]+"),
> PATTERNS("java",
> - "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
> + "!^[ \t]*(try|catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
> "^[ \t]*(([A-Za-z_][A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$",
> /* -- */
> "[a-zA-Z_][a-zA-Z0-9_]*"
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] userdiff: support C# async methods and correct C# keywords
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-05 22:59 ` Junio C Hamano
2014-06-06 13:27 ` Steve Hoelzer
1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2014-06-05 22:59 UTC (permalink / raw
To: Sup Yut Sum; +Cc: git
Sup Yut Sum <ch3cooli@gmail.com> 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
> default, try are in C# 1.0
>
> Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
> ---
> userdiff.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> 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 */
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] userdiff: support C# async methods and correct C# keywords
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
0 siblings, 1 reply; 7+ messages in thread
From: Steve Hoelzer @ 2014-06-06 13:27 UTC (permalink / raw
To: Junio C Hamano; +Cc: Sup Yut Sum, git
On Thu, Jun 5, 2014 at 5:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Sup Yut Sum <ch3cooli@gmail.com> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] userdiff: support C# async methods and correct C# keywords
2014-06-06 13:27 ` Steve Hoelzer
@ 2014-06-06 17:34 ` Junio C Hamano
2014-06-07 16:00 ` Steve Hoelzer
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2014-06-06 17:34 UTC (permalink / raw
To: Steve Hoelzer; +Cc: Sup Yut Sum, git
Steve Hoelzer <shoelzer@gmail.com> writes:
> On Thu, Jun 5, 2014 at 5:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Sup Yut Sum <ch3cooli@gmail.com> 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 */
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] userdiff: support C# async methods and correct C# keywords
2014-06-06 17:34 ` Junio C Hamano
@ 2014-06-07 16:00 ` Steve Hoelzer
0 siblings, 0 replies; 7+ messages in thread
From: Steve Hoelzer @ 2014-06-07 16:00 UTC (permalink / raw
To: Junio C Hamano; +Cc: Sup Yut Sum, git
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 */
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-06-07 16:01 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).