cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] SmPL highlighting on GitHub and GitLab
@ 2019-08-27 14:30 Paul Chaignon
  2019-08-27 14:44 ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Chaignon @ 2019-08-27 14:30 UTC (permalink / raw)
  To: cocci

Hello dear Coccinelle community,

Since a few hours ago, SmPL code is detected and highlighted on GitHub.
Examples [1, 2] are visible in the Linux repository.  Other repositories
should receive highlighting when they'll be updated (after a git push).
Highlighting on GitLab should follow if/when they update their Linguist
dependency.

This change follows an update to the Linguist library [3], used to detect
languages on GitHub and GitLab.  At the moment, all .cocci files are
detected as SmPL.  The grammar for highlighting [4] was written by John
Gardner and should also work for the Atom editor.  If you want to change
the color, aliases, or extensions associated with SmPL, we'd welcome pull
requests to Linguist and I'm confident John would too for the grammar!

Regards,
Paul Chaignon

1 - https://github.com/torvalds/linux/blob/master/scripts/coccinelle/api/d_find_alias.cocci
2 - https://github.com/torvalds/linux/blob/master/scripts/coccinelle/misc/boolreturn.cocci
3 - https://github.com/github/linguist
4 - https://github.com/Alhadis/language-etc/blob/master/grammars/smpl.cson
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] SmPL highlighting on GitHub and GitLab
  2019-08-27 14:30 [Cocci] SmPL highlighting on GitHub and GitLab Paul Chaignon
@ 2019-08-27 14:44 ` Julia Lawall
  2019-08-28  7:40   ` Paul Chaignon
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2019-08-27 14:44 UTC (permalink / raw)
  To: Paul Chaignon; +Cc: cocci



On Tue, 27 Aug 2019, Paul Chaignon wrote:

> Hello dear Coccinelle community,
>
> Since a few hours ago, SmPL code is detected and highlighted on GitHub.
> Examples [1, 2] are visible in the Linux repository.  Other repositories
> should receive highlighting when they'll be updated (after a git push).
> Highlighting on GitLab should follow if/when they update their Linguist
> dependency.
>
> This change follows an update to the Linguist library [3], used to detect
> languages on GitHub and GitLab.  At the moment, all .cocci files are
> detected as SmPL.  The grammar for highlighting [4] was written by John
> Gardner and should also work for the Atom editor.  If you want to change
> the color, aliases, or extensions associated with SmPL, we'd welcome pull
> requests to Linguist and I'm confident John would too for the grammar!

Wow, thanks for this!

However, I don't see anything for [1], only for [2].

As far as I can see, the - code has a background and the + code does not.
Is there a reason for that?

It could also be good to use a different color for the * code; I've been
using purple.

I also use blue for the @@s and black for the metavariable declarations,
but I find your color choices rather appealing in this case.

If there are no further color suggestions on the list, I will look into
how to make a pull request.

Thanks!

julia

>
> Regards,
> Paul Chaignon
>
> 1 - https://github.com/torvalds/linux/blob/master/scripts/coccinelle/api/d_find_alias.cocci
> 2 - https://github.com/torvalds/linux/blob/master/scripts/coccinelle/misc/boolreturn.cocci
> 3 - https://github.com/github/linguist
> 4 - https://github.com/Alhadis/language-etc/blob/master/grammars/smpl.cson
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] SmPL highlighting on GitHub and GitLab
  2019-08-27 14:44 ` Julia Lawall
@ 2019-08-28  7:40   ` Paul Chaignon
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Chaignon @ 2019-08-28  7:40 UTC (permalink / raw)
  To: Julia Lawall; +Cc: John Gardner, cocci

On Tue, Aug 27, 2019 at 10:44:43PM +0800, Julia Lawall wrote:
>
>
> On Tue, 27 Aug 2019, Paul Chaignon wrote:
>
> > Hello dear Coccinelle community,
> >
> > Since a few hours ago, SmPL code is detected and highlighted on GitHub.
> > Examples [1, 2] are visible in the Linux repository.  Other repositories
> > should receive highlighting when they'll be updated (after a git push).
> > Highlighting on GitLab should follow if/when they update their Linguist
> > dependency.
> >
> > This change follows an update to the Linguist library [3], used to detect
> > languages on GitHub and GitLab.  At the moment, all .cocci files are
> > detected as SmPL.  The grammar for highlighting [4] was written by John
> > Gardner and should also work for the Atom editor.  If you want to change
> > the color, aliases, or extensions associated with SmPL, we'd welcome pull
> > requests to Linguist and I'm confident John would too for the grammar!
>
> Wow, thanks for this!
>
> However, I don't see anything for [1], only for [2].

Are you sure?  I just checked again and I see it for both.  Maybe a
caching issue?

>
> As far as I can see, the - code has a background and the + code does not.
> Is there a reason for that?

All three signs (-, +, and *) should have a background color (red, green,
and orange respectively).  The green background (#f0fff4) is very light
however, so it may not be visible depending on your screen configuration.

>
> It could also be good to use a different color for the * code; I've been
> using purple.
>
> I also use blue for the @@s and black for the metavariable declarations,
> but I find your color choices rather appealing in this case.
>
> If there are no further color suggestions on the list, I will look into
> how to make a pull request.

I should clarify I haven't chosen the colors.  John did, to some extent.
Grammars used by GitHub associate "scopes" to tokens (in an imperfect way,
using regular expressions).  Colors are then associated to each scope by
GitHub through CSS [1].  So grammar authors have a limited control over
the colors.

It might still be possible to change the colors to your preferences.  I've
cc'ed John who might be better able to help you.  He also pointed me to
the mapping of scopes to available colors [2] he derived some time ago.

1 - https://github.com/primer/github-syntax-light
2 - https://github.com/github/linguist/pull/4568#issuecomment-513739638

>
> Thanks!
>
> julia
>
> >
> > Regards,
> > Paul Chaignon
> >
> > 1 - https://github.com/torvalds/linux/blob/master/scripts/coccinelle/api/d_find_alias.cocci
> > 2 - https://github.com/torvalds/linux/blob/master/scripts/coccinelle/misc/boolreturn.cocci
> > 3 - https://github.com/github/linguist
> > 4 - https://github.com/Alhadis/language-etc/blob/master/grammars/smpl.cson
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

end of thread, other threads:[~2019-08-28  7:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 14:30 [Cocci] SmPL highlighting on GitHub and GitLab Paul Chaignon
2019-08-27 14:44 ` Julia Lawall
2019-08-28  7:40   ` Paul Chaignon

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