dparkins / language-fortran

Syntax highlighting for FORTRAN for atom
MIT License
35 stars 16 forks source link

gcov highlighting if you are interested #95

Closed stadelmanma closed 7 years ago

stadelmanma commented 7 years ago

I spent a few hours the other day extending your syntax highlighting to work (reasonably well) when viewing a Fortran gcov file. There are still a few quirks. My line numbers don't pick up a consistent style, some of them miss the italics. Somewhere line-continuations override my gcov patterns, at least in Fixed form. All the Fortran I write is fixed, but there is a fairly large base of free form code where I work so I'll see what it does then.

It looks best in a dark theme, but light schemes do alright. I've seen the fancy packages that take advantage of lcov but I wanted something light and clean that I could just keep in the other panel. This was my first stab at extending atom functionality.

https://github.com/stadelmanma/language-fortran-gcov

Cheers and thanks for taking the time to make this syntax highlighting package. -Matt

image

tomedunn commented 7 years ago

Sounds like an interesting extension. I'm not terribly familiar with the formatting Fortran gcov files but from the looks of it from the image your provided I'm not surprised your having some trouble with fixed form Fortran files. The Fortran - Fixed Form grammar takes the Fortran - Free Form grammar and injects some rules that require the first six characters of each line follow one of a few specific formats. Since it looks like your gcov files add extra bits to the start of each line, your grammar rules are probably conflicting with the line header rules in Fortran - Fixed Form. If that's the case you might find it easier to extend Fortran - Free Form instead.

stadelmanma commented 7 years ago

Thanks, I'll give that a go when I have time. If the only difference between Fixed Form and Free Form grammars are those three injections then that will be easy enough to replace/spoof as I already have had to do that to an extent anyways.

Eventually I'll get around to releasing it on apm since I was surprised to find nothing that works with gcov by itself, only lcov. In theory general idea would work with C/C++ code as well but I don't work with those languages so thats outside my wheel house.