eirik-kjonstad / modern-fortran-syntax

Modern Fortran syntax highlighting for Sublime Text 3/4
MIT License
10 stars 2 forks source link

Openacc #62

Closed MeraX closed 3 years ago

MeraX commented 3 years ago

Hi,

Thanks for this nice and simple Fortran syntax package.

I was missing OpenACC support, so here is the PR!

"OpenACC (for open accelerators) is a programming standard for parallel computing developed by Cray, CAPS, Nvidia and PGI. The standard is designed to simplify parallel programming of heterogeneous CPU/GPU systems" (wikipedia)

OpenACC syntax is similar to openMP, thus I adapted the existing openMP code.

This is my first time working on Sublime syntax files and I hope my changes are fine.

Best MareX

eirik-kjonstad commented 3 years ago

Hi, thanks for the PR! Seems like the tests are failing because the "^" for some of the tested scopes are not aligned properly.

I'll have a closer look at the changes tomorrow.

MeraX commented 3 years ago

Hi Eirik, thanks for your comments and corrections!

Regarding the continuation, the ACC standard says:

Continuation directive lines must begin with the sentinel (possibly preceded by white space) and may have an ampersand as the first non-white space character after the sentinel.

the first part is already covered as far as I can see, as a continued line is very much similar to a normal ACC line. But until now, I wasn't aware, that there might also be an ampersand at the beginning of the continued line. This is currently not handled correctly by my modifications.

This means, we could have a test for

!$acc parallel create(I, &
!$acc   someThing) default(none)

which already looks fine with the current code.

And we would need a little adjustment for

!$acc parallel create(I, &
!$acc   & someThing) default(none)

If you would like to fix the latter, you can do so, otherwise I would give it a look on Monday.