I want to make a script which capitalizes the keywords of my source code in Fortran 90, for which I thought about using regular expressions and sed (this might have been my first mistake :P). I have not managed, though, to get a match which discards words on comments (in my code, everything after !) and in strings (everything between single '...' or double quotes "...").
The idea is to have a list with all the keywords of Fortran (if, end if, subroutine, abs, allocate…) and use sed with this regex. Please tell me how one could do this, and also if this approach is correct or there are better ways to accomplish what I want. It has to be possible, because somehow the editors correctly highlight this words. Man, if I could tell Emacs “capitalize the blue words please!” 🙂
https://gist.github.com/3414783
this command should capitalize keywords
Caveat: when keywords are not written the way, Emacs expects, fontification will be lost.