# [PATCH]v2 adding built-in driver for javascript

5 messages from 2017-03-13 to 2017-03-16. Participants: sourav mondal, Christian Couder, Junio C Hamano, Brandon Williams.
Thread: https://gitlist.dev/t/45369

## sourav mondal, 2017-03-13 20:08

Subject: [PATCH]v2 adding built-in driver for javascript
Message-ID: <20170313200854.6905-1-souravcristiano502@gmail.com>
URL: https://gitlist.dev/e/20170313200854.6905-1-souravcristiano502%40gmail.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


```

## Christian Couder, 2017-03-16 18:54

Subject: Re: [PATCH]v2 adding built-in driver for javascript
Message-ID: <CAP8UFD3toXk36wmJu+EeBnTvCa0yHWqCmQOfoJ0+2QTs8MpB-A@mail.gmail.com>
URL: https://gitlist.dev/e/CAP8UFD3toXk36wmJu%2BEeBnTvCa0yHWqCmQOfoJ0%2B2QTs8MpB-A%40mail.gmail.com
In-Reply-To: <20170313200854.6905-1-souravcristiano502@gmail.com>

```
On Mon, Mar 13, 2017 at 9:08 PM, sourav mondal
<souravcristiano502@gmail.com> wrote:
> javascript is one of the famous langugae,it's needs a built-in driver.

Please use "Javascript" instead of "javascript".
There is a typo in "language" above, also maybe "it needs" instead of
"it's needs", and please add a blank space before it.

> As it was not present in the userdiff & this leads to the patch.

Maybe "," instead of "&".

>         first line consists of some of the well used javascript keywords.statements

"First" instead of "first" and no space before it, but a space and an
uppercase letter at the beginning of "statements".

> in js use one or many keywords like variable declaration, function definition, logical opreation etc.The

Typo in "opreation" and please add a space before "The".

I am stopping here but there are also typos and things to improve in
the rest of the commit message.

```

## Junio C Hamano, 2017-03-16 18:56

Subject: Re: [PATCH]v2 adding built-in driver for javascript
Message-ID: <xmqqo9x1aw44.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqo9x1aw44.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <CAP8UFD3toXk36wmJu+EeBnTvCa0yHWqCmQOfoJ0+2QTs8MpB-A@mail.gmail.com>

```
Christian Couder <christian.couder@gmail.com> writes:

> On Mon, Mar 13, 2017 at 9:08 PM, sourav mondal
> <souravcristiano502@gmail.com> wrote:
>> javascript is one of the famous langugae,it's needs a built-in driver.
>
> Please use "Javascript" instead of "javascript".

While we are typo-spotting ;-) Wikipedia seems to prefer to spell it
"JavaScript".

```

## Christian Couder, 2017-03-16 19:03

Subject: Re: [PATCH]v2 adding built-in driver for javascript
Message-ID: <CAP8UFD0Exw4GPeat+xCgJdgd1E0dy0tu8JVpzkq=DnvGWArFDQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAP8UFD0Exw4GPeat%2BxCgJdgd1E0dy0tu8JVpzkq%3DDnvGWArFDQ%40mail.gmail.com
In-Reply-To: <xmqqo9x1aw44.fsf@gitster.mtv.corp.google.com>

```
On Thu, Mar 16, 2017 at 7:56 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Christian Couder <christian.couder@gmail.com> writes:
>
>> On Mon, Mar 13, 2017 at 9:08 PM, sourav mondal
>> <souravcristiano502@gmail.com> wrote:
>>> javascript is one of the famous langugae,it's needs a built-in driver.
>>
>> Please use "Javascript" instead of "javascript".
>
> While we are typo-spotting ;-) Wikipedia seems to prefer to spell it
> "JavaScript".

Yeah thanks, and while at it, the "v2" in the subject should be inside
the square brackets around "PATCH".

```

## Brandon Williams, 2017-03-16 19:06

Subject: Re: [PATCH]v2 adding built-in driver for javascript
Message-ID: <20170316190631.GA168812@google.com>
URL: https://gitlist.dev/e/20170316190631.GA168812%40google.com
In-Reply-To: <CAP8UFD0Exw4GPeat+xCgJdgd1E0dy0tu8JVpzkq=DnvGWArFDQ@mail.gmail.com>

```
On 03/16, Christian Couder wrote:
> On Thu, Mar 16, 2017 at 7:56 PM, Junio C Hamano <gitster@pobox.com> wrote:
> > Christian Couder <christian.couder@gmail.com> writes:
> >
> >> On Mon, Mar 13, 2017 at 9:08 PM, sourav mondal
> >> <souravcristiano502@gmail.com> wrote:
> >>> javascript is one of the famous langugae,it's needs a built-in driver.
> >>
> >> Please use "Javascript" instead of "javascript".
> >
> > While we are typo-spotting ;-) Wikipedia seems to prefer to spell it
> > "JavaScript".
> 
> Yeah thanks, and while at it, the "v2" in the subject should be inside
> the square brackets around "PATCH".

You can use the --reroll-count <n> option to format-patch to have format
patch place the v<n> inside the bracketed PATCH section.

-- 
Brandon Williams

```
