From 7a085021ea0d790bb3064a779fbd85af38d10ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eirik=20F=2E=20Kj=C3=B8nstad?= <39950849+eirik-kjonstad@users.noreply.github.com> Date: Sat, 22 Jan 2022 18:56:28 +0100 Subject: [PATCH] Old-style declarations (#70) --- modern-fortran.sublime-syntax | 2 ++ syntax_test_fortran.F90 | 28 +++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/modern-fortran.sublime-syntax b/modern-fortran.sublime-syntax index bd6f632..3ce8a6e 100644 --- a/modern-fortran.sublime-syntax +++ b/modern-fortran.sublime-syntax @@ -124,6 +124,8 @@ contexts: types: - match: '(?i)\b{{intrinsicType}}\b(?=.*(function))' # type of return value in function scope: storage.type.intrinsic.fortran + - match: '(?i)\b{{intrinsicType}}\s+(?=\w+)' # old-style declaration + scope: storage.type.intrinsic.fortran - match: '(?i){{firstOnLine}}\b{{intrinsicType}}(?=\,)' # type declaration scope: storage.type.intrinsic.fortran - match: '(?i){{firstOnLine}}\b{{intrinsicType}}(?=\(.*\)\,)' # type declaration diff --git a/syntax_test_fortran.F90 b/syntax_test_fortran.F90 index e10cc7f..8928186 100644 --- a/syntax_test_fortran.F90 +++ b/syntax_test_fortran.F90 @@ -23,6 +23,7 @@ ! ^^^ keyword.control.fortran ! read(unit=myUnit, end=200) byte ! Read until end of file, then go to 200 +! ^^^^ variable.function.subroutine.intrinsic.io.fortran ! ^^^^ variable.language.io.fortran ! ^^^ variable.language.io.fortran ! @@ -47,6 +48,18 @@ ! ^^ punctuation.section.parens.end.fortran - keyword ! integer(kind=8), dimension(:,:), allocatable :: myInt +! ^^^^^^^ storage.type.intrinsic.fortran +! ^ meta.parens.fortran punctuation.section.parens.begin.fortran +! ^^^^ meta.parens.fortran variable.other.fortran +! ^ meta.parens.fortran keyword.operator.assignment.fortran +! ^ meta.parens.fortran meta.number.integer.decimal.fortran constant.numeric.value.fortran +! ^ meta.parens.fortran punctuation.section.parens.end.fortran +! ^ punctuation.separator.comma.fortran +! ^^^^^^^^^ storage.modifier.fortran +! ^ meta.parens.fortran punctuation.section.parens.begin.fortran +! ^ meta.parens.fortran punctuation.separator.single-colon.fortran +! ^ meta.parens.fortran punctuation.separator.comma.fortran +! ^ meta.parens.fortran punctuation.separator.single-colon.fortran ! ^^^^^ variable.other.fortran ! ^ - variable.other.fortran ! ^^^^^^^ storage.type.intrinsic.fortran @@ -57,6 +70,16 @@ ! ^^^^ storage.type.intrinsic.fortran ! ^^ punctuation.separator.double-colon.fortran ! ^^^^^^^ variable.other.fortran +! + integer myInteger +! ^^^^^^^ storage.type.intrinsic.fortran +! ^^^^^^^^^ variable.other.fortran + logical myLogical +! ^^^^^^^ storage.type.intrinsic.fortran +! ^^^^^^^^^ variable.other.fortran + real myReal +! ^^^^ storage.type.intrinsic.fortran +! ^^^^^^ variable.other.fortran ! do while (a .ne. b) ! a side-comment ! ^^ keyword.control.fortran @@ -112,7 +135,7 @@ ! ^^^^^^^^^^^ storage.modifier.fortran ! type :: myClass1 -! ^^^^ keyword.declaration.class.fortran +! ^^^^ meta.class.declaration.fortran keyword.declaration.class.fortran ! ^^ punctuation.separator.double-colon.fortran ! ^^^^^^^^ entity.name.class.fortran ! ^^^^^^^^^^^^^^^^ meta.class.declaration.fortran @@ -221,6 +244,8 @@ recursive module function theFunction(a) ! ^ variable.parameter.input.fortran ! ^ punctuation.section.parens.end.fortran function theFunction(a, bee, cesium) +! ^^^^^^^^ meta.function.declaration.fortran keyword.declaration.function.fortran +! ^^^^^^^^^^^ meta.function.declaration.fortran entity.name.function.fortran ! ^^^^^^^^^^^^^^^^ meta.function.parameters.fortran ! ^ punctuation.section.parens.begin.fortran ! ^ variable.parameter.input.fortran @@ -242,6 +267,7 @@ function result(a) ! ^^^^^^ entity.name.function.fortran - keyword ! pure function getStuff(a) result(theStuff) +! ^^^^ storage.modifier.function.prefix.fortran ! ^^^^^^^^^^^^^^^^^ meta.function.declaration.fortran - meta.function meta.function ! ^^^ meta.function.parameters.fortran - meta.function meta.function ! ^^^^^^^ meta.function.declaration.fortran - meta.function meta.function