dparkins/language-fortran — pull request #13 by tomedunn (2014-11-24 06:50:54+00:00)
Title: More intrinsic functions/subroutines. Better rule consistency. Fixes #10 #11 #12.

I had only intended to add more functions and subroutines to the language but in doing so I ran into a heap of new issues that in the end caused me to do some major overhaul of the Modern Fortran syntax. You'll notice the `patterns` section of the Modern Fortran syntax now is just
```coffee-script
'patterns':[
{
'include': 'source.fortran'
}
]
```
All of the rules previously kept in `patterns` have either been moved into the repository or to the new `injections` section. The `injections` section is kind of a weird thing so I'll try to explain as best I can. Previously, the Modern Fortran grammar imported all the rules from the Punchcard Fortran grammar from the `'include': 'source.fortran'` rule. However while this would import structures like `subroutine` and `function`, those structures wouldn't have the new Modern Fortran grammars inside of them. There was a sketchy "fix" for this issue in that the `subroutine` and `function` structures also included a reference to `'include': 'source.fortran.modern'` but this meant someone using only Punchcard Fortran would also always have access to the grammars defined in Modern Fortran. This fix also didn't address similar issues in other structures like `interface` or `module`.

The way the new `injection` rules work is that when the Modern Fortran grammar is loaded the Punchcard Fortran grammar is first loaded, then all the rules in the `injection` section are inserted into the loaded Punchcard Fortran grammar, finally the modified Punchcard Fortran grammar is loaded into the Modern Fortran grammar which is then applied to the source. This also gives greater flexibility in where rules can be applied. For instance it would be possible to highlight the `exit` statement only when it is embedded inside a `do` loop at some level, which could be quite useful.