git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH]v2 adding built-in driver for javascript

From
SMsourav mondal <souravcristiano502@gmail.com>
Date
Mar 13, 2017, 20:08 UTC
Message-ID
<20170313200854.6905-1-souravcristiano502@gmail.com>
javascript is one of the famous langugae,it's needs a built-in driver. As it was not present in the userdiff & this leads to the patch.
	first line consists of some of the well used javascript keywords.statements in js use one or many keywords like variable declaration, function definition, logical opreation etc.The following line is for statements of type object.method() & it is expected to end any statement using ";". The word_regex in js is usual alpha-numeric.last two line shows all the different types of opreators in js and different types of number system used in js are also defined.     
Signed-off-by: sourav mondal <souravcristiano502@gmail.com>
---
I'm working on "Add more built-in driver for userdiff" as my microproject for Gsoc17. This patch is for javascript which is one of the popular language at this time. I'm willing to add more driver for other laguage that isn't present in userdiff.c and again I'm willing to participate in Gsoc17 with git. I'm eager to know about this patch.
thanks & regards
sourav
   
 userdiff.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/userdiff.c b/userdiff.c
index 8b732e4..2f8e078 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -160,6 +160,16 @@ IPATTERN("css",
 	 "-?[_a-zA-Z][-_a-zA-Z0-9]*" /* identifiers */
 	 "|-?[0-9]+|\\#[0-9a-fA-F]+" /* numbers */
 ),
+PATTERNS("javascript",
+	 /* keywords/patterns*/
+	 "^[ \t]*(var|if|else|for|do|while|switch|case|function|break|continue|new|return|class|super|instanceof)"
+	 "^[ \t]*(([a-zA-Z_][a-zA-Z0-9])*[ \t]*\\.?[a-zA-Z_]*\\(\\)[ \t]*);$",
+	 /* word_regex */
+	 "[a-zA-Z_][a-zA-Z0-9]*"
+	 "|[-+0-9.eE]+|0[bB]?|[xX]?|o?[0-9a-fA-F]+"
+	 "|[==-+*/%<>&|!**=^]="
+	 "|--|\\+\\+|<<=?|>>>?=?|&&|\|\|"
+),
 { "default", NULL, -1, { NULL, 0 } },
 };
 #undef PATTERNS
-- 
2.9.3
Next: Christian Couder
Message 1 of 5 in “v2 adding built-in driver for javascript”
  1. v2 adding built-in driver for javascriptsourav mondal, Mar 13, 2017
  2. Christian CouderMar 16, 2017
  3. Junio C HamanoMar 16, 2017
  4. Christian CouderMar 16, 2017
  5. Brandon WilliamsMar 16, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.