diff --git a/packages/tm-grammars/NOTICE b/packages/tm-grammars/NOTICE index 4a0d00f..5907fa7 100644 --- a/packages/tm-grammars/NOTICE +++ b/packages/tm-grammars/NOTICE @@ -2378,7 +2378,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ========================================================================================================= -Files: fortran-free-form.json +Files: fortran-fixed-form.json, fortran-free-form.json License: https://raw.githubusercontent.com/fortran-lang/vscode-fortran-support/main/LICENSE SPDX: MIT --------------------------------------------------------------------------------------------------------- diff --git a/packages/tm-grammars/README.md b/packages/tm-grammars/README.md index 56dd08a..1720f56 100644 --- a/packages/tm-grammars/README.md +++ b/packages/tm-grammars/README.md @@ -66,6 +66,7 @@ import { grammars } from 'tm-grammars' | `erb` | | [textmate/ruby.tmbundle](https://github.com/textmate/ruby.tmbundle/blob/ecf0f1df23984bcff9b51552e35d9696cb0d9539/Syntaxes/HTML%20(Ruby%20-%20ERB).tmLanguage) | | `html` `ruby` | 1.90 kB | | `erlang` | `erl` | [erlang-ls/grammar](https://github.com/erlang-ls/grammar/blob/20fc9036e3c2b2ada5f14925bffc7041951f38af/Erlang.plist) | [Apache-2.0](https://raw.githubusercontent.com/erlang-ls/grammar/main/LICENSE) | | 28.16 kB | | `fish` | | [bmalehorn/vscode-fish](https://github.com/bmalehorn/vscode-fish/blob/2fe4ccc72fdcd9b9f54fbb2c05fe9b350c32d718/syntaxes/fish.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/bmalehorn/vscode-fish/master/LICENSE) | | 5.06 kB | +| `fortran-fixed-form` | | [fortran-lang/vscode-fortran-support](https://github.com/fortran-lang/vscode-fortran-support/blob/e642012094fc0a7379f204bb4e61243005afb1da/syntaxes/fortran_fixed-form.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/fortran-lang/vscode-fortran-support/main/LICENSE) | `fortran-free-form` | 905.00 B | | `fortran-free-form` | | [fortran-lang/vscode-fortran-support](https://github.com/fortran-lang/vscode-fortran-support/blob/f7fb41579770a0d8c75b9f295d167b31147b4f33/syntaxes/fortran_free-form.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/fortran-lang/vscode-fortran-support/main/LICENSE) | | 92.92 kB | | `fsharp` | `f#` `fs` | [microsoft/vscode](https://github.com/microsoft/vscode/blob/35d97bc7e439fce0f50f42074041ab2d8571b20a/extensions/fsharp/syntaxes/fsharp.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/microsoft/vscode/main/LICENSE.txt) | `markdown` | 24.18 kB | | `gdresource` | | [godotengine/godot-vscode-plugin](https://github.com/godotengine/godot-vscode-plugin/blob/e7e2d0439dea0fb3a568378554c81e0a17348a84/syntaxes/GDResource.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/godotengine/godot-vscode-plugin/master/LICENSE) | `gdshader` `gdscript` | 4.90 kB | diff --git a/packages/tm-grammars/grammars/fortran-fixed-form.json b/packages/tm-grammars/grammars/fortran-fixed-form.json new file mode 100644 index 0000000..a01d1f1 --- /dev/null +++ b/packages/tm-grammars/grammars/fortran-fixed-form.json @@ -0,0 +1,74 @@ +{ + "displayName": "Fortran (Fixed Form)", + "fileTypes": [ + "f", + "F", + "f77", + "F77", + "for", + "FOR" + ], + "injections": { + "source.fortran.fixed - ( string | comment )": { + "patterns": [ + { + "include": "#line-header" + }, + { + "include": "#line-end-comment" + } + ] + } + }, + "name": "fortran-fixed-form", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#line-header" + }, + { + "include": "source.fortran.free" + } + ], + "repository": { + "comments": { + "patterns": [ + { + "begin": "^[cC\\*]", + "end": "\\n", + "name": "comment.line.fortran" + }, + { + "begin": "^ *!", + "end": "\\n", + "name": "comment.line.fortran" + } + ] + }, + "line-end-comment": { + "begin": "(?<=^.{72})(?!\\n)", + "end": "(?=\\n)", + "name": "comment.line-end.fortran" + }, + "line-header": { + "captures": { + "1": { + "name": "constant.numeric.fortran" + }, + "2": { + "name": "keyword.line-continuation-operator.fortran" + }, + "3": { + "name": "source.fortran.free" + }, + "4": { + "name": "invalid.error.fortran" + } + }, + "match": "^(?!\\s*[!#])(?:([ \\d]{5} )|( {5}.)|(\\t)|(.{1,5}))" + } + }, + "scopeName": "source.fortran.fixed" +} diff --git a/packages/tm-grammars/index.js b/packages/tm-grammars/index.js index 1bd5597..a3e13b0 100644 --- a/packages/tm-grammars/index.js +++ b/packages/tm-grammars/index.js @@ -666,6 +666,20 @@ export const grammars = [ sha: '2fe4ccc72fdcd9b9f54fbb2c05fe9b350c32d718', source: 'https://github.com/bmalehorn/vscode-fish/blob/2fe4ccc72fdcd9b9f54fbb2c05fe9b350c32d718/syntaxes/fish.tmLanguage.json', }, + { + byteSize: 905, + displayName: 'Fortran (Fixed Form)', + embedded: [ + 'fortran-free-form', + ], + lastUpdate: '2021-11-09T22:09:17Z', + license: 'MIT', + licenseUrl: 'https://raw.githubusercontent.com/fortran-lang/vscode-fortran-support/main/LICENSE', + name: 'fortran-fixed-form', + scopeName: 'source.fortran.fixed', + sha: 'e642012094fc0a7379f204bb4e61243005afb1da', + source: 'https://github.com/fortran-lang/vscode-fortran-support/blob/e642012094fc0a7379f204bb4e61243005afb1da/syntaxes/fortran_fixed-form.tmLanguage.json', + }, { byteSize: 95147, displayName: 'Fortran (Free Form)', diff --git a/samples/fortran-fixed-form.sample b/samples/fortran-fixed-form.sample new file mode 100644 index 0000000..e0789a1 --- /dev/null +++ b/samples/fortran-fixed-form.sample @@ -0,0 +1,34 @@ +* euclid.f (FORTRAN 77) +* Find greatest common divisor using the Euclidean algorithm + + PROGRAM EUCLID + PRINT *, 'A?' + READ *, NA + IF (NA.LE.0) THEN + PRINT *, 'A must be a positive integer.' + STOP + END IF + PRINT *, 'B?' + READ *, NB + IF (NB.LE.0) THEN + PRINT *, 'B must be a positive integer.' + STOP + END IF + PRINT *, 'The GCD of', NA, ' and', NB, ' is', NGCD(NA, NB), '.' + STOP + END + + FUNCTION NGCD(NA, NB) + IA = NA + IB = NB + 1 IF (IB.NE.0) THEN + ITEMP = IA + IA = IB + IB = MOD(ITEMP, IB) + GOTO 1 + END IF + NGCD = IA + RETURN + END + +* From https://en.wikibooks.org/wiki/Fortran/Fortran_examples#Greatest_common_divisor \ No newline at end of file diff --git a/sources-grammars.ts b/sources-grammars.ts index ad764aa..13597b9 100644 --- a/sources-grammars.ts +++ b/sources-grammars.ts @@ -478,6 +478,11 @@ export const sourcesCommunity: GrammarSource[] = [ displayName: 'Fortran (Free Form)', source: 'https://github.com/fortran-lang/vscode-fortran-support/blob/main/syntaxes/fortran_free-form.tmLanguage.json', }, + { + name: 'fortran-fixed-form', + displayName: 'Fortran (Fixed Form)', + source: 'https://github.com/fortran-lang/vscode-fortran-support/blob/main/syntaxes/fortran_fixed-form.tmLanguage.json', + }, { name: 'gdresource', displayName: 'GDResource',