All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Updated C# userdiff patterns.
@ 2014-04-25 23:25 Marius Ungureanu
  2014-04-26  7:10 ` Johannes Sixt
  0 siblings, 1 reply; 16+ messages in thread
From: Marius Ungureanu @ 2014-04-25 23:25 UTC (permalink / raw)
  To: git

New keywords: foreach, break, in, try, finally, as, is, typeof, var,
default, fixed, checked, unchecked, this, lock, readonly, unsafe,
ref, out, base, null, delegate, continue.

Removed keywords: instanceof. It's only in Java.
Moved keywords to happen before modifier parsing, as matching a keyword
will stop modifiers from being matched.

Added method modifiers: extern, abstract.

Added properties modifiers: abstract.

Added parsing of events and delegates, which are like properties, but
take an extra keyword.

The reasoning behind adding unsafe to keywords is being also a
statement that can happen inline in code to mention blocks which are
unsafe. Also, delegates are not necessarily declared in class bodies,
but can also happen inline in other functions.

Keywords are based on MSDN docs.

Signed-off-by: Marius Ungureanu <marius.ungureanu@xamarin.com>
---
 userdiff.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/userdiff.c b/userdiff.c
index fad52d6..7612c5d 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -133,14 +133,14 @@ PATTERNS("cpp",
 	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*"
 	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"),
 PATTERNS("csharp",
-	 /* Keywords */
-	 "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
 	 /* Methods and constructors */
-	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \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"
+	 "^[ \t]*(((abstract|extern|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
+	 /* Properties, events, delegates */
+	 "^[ \t]*(((abstract|internal|new|override|private|protected|public|sealed|static|unsafe|virtual)[ \t]+)*((delegate|event)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
 	 /* Type definitions */
-	 "^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
+	 "^[ \t]*(((abstract|internal|new|override|partial|private|protected|public|sealed|static|unsafe)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
+	 /* Keywords */
+	 "!^[ \t]*(as|base|break|case|catch|checked|continue|default|delegate|do|else|finally|fixed|for|foreach|if|in|is|lock|new|null|out|readonly|ref|return|switch|this|throw|try|typeof|unchecked|unsafe|using|var|while)\n"
 	 /* Namespace */
 	 "^[ \t]*(namespace[ \t]+.*)$",
 	 /* -- */
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-04-27 20:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-25 23:25 [PATCH] Updated C# userdiff patterns Marius Ungureanu
2014-04-26  7:10 ` Johannes Sixt
2014-04-26  9:55   ` Marius Ungureanu
2014-04-26 10:49     ` Marius Ungureanu
2014-04-26 17:49     ` Johannes Sixt
2014-04-26 18:33       ` Marius Ungureanu
2014-04-26 18:50         ` Johannes Sixt
2014-04-26 18:52           ` Marius Ungureanu
2014-04-27 13:43           ` Marius Ungureanu
2014-04-27 13:45           ` [PATCH 1/2] update " Marius Ungureanu
2014-04-27 13:48             ` [PATCH 2/2] add csharp userdiff tests Marius Ungureanu
2014-04-27 13:47           ` Marius Ungureanu
2014-04-27 16:19             ` Johannes Sixt
2014-04-27 16:46               ` Marius Ungureanu
2014-04-27 20:12                 ` Johannes Sixt
2014-04-27 17:11               ` Marius Ungureanu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.