const lang = Object.freeze({ "displayName": "Fortran (Free Form)", "fileTypes": ["f90", "F90", "f95", "F95", "f03", "F03", "f08", "F08", "f18", "F18", "fpp", "FPP", ".pf", ".PF"], "firstLineMatch": "(?i)-[*]- mode: fortran free -[*]-", "injections": { "source.fortran.free - ( string | comment | meta.preprocessor )": { "patterns": [{ "include": "#line-continuation-operator" }, { "include": "#preprocessor" }] }, "string.quoted.double.fortran": { "patterns": [{ "include": "#string-line-continuation-operator" }] }, "string.quoted.single.fortran": { "patterns": [{ "include": "#string-line-continuation-operator" }] } }, "name": "fortran-free-form", "patterns": [{ "include": "#preprocessor" }, { "include": "#comments" }, { "include": "#constants" }, { "include": "#operators" }, { "include": "#array-constructor" }, { "include": "#parentheses" }, { "include": "#include-statement" }, { "include": "#import-statement" }, { "include": "#block-data-definition" }, { "include": "#function-definition" }, { "include": "#module-definition" }, { "include": "#program-definition" }, { "include": "#submodule-definition" }, { "include": "#subroutine-definition" }, { "include": "#procedure-definition" }, { "include": "#derived-type-definition" }, { "include": "#enum-block-construct" }, { "include": "#interface-block-constructs" }, { "include": "#procedure-specification-statement" }, { "include": "#type-specification-statements" }, { "include": "#specification-statements" }, { "include": "#control-constructs" }, { "include": "#control-statements" }, { "include": "#execution-statements" }, { "include": "#intrinsic-functions" }, { "include": "#variable" }], "repository": { "IO-item-list": { "begin": `(?i)(?=\\s*[a-z0-9"'])`, "comment": "Name list.", "contentName": "meta.name-list.fortran", "end": "(?=[\\);!\\n])", "patterns": [{ "include": "#constants" }, { "include": "#operators" }, { "include": "#intrinsic-functions" }, { "include": "#array-constructor" }, { "include": "#parentheses" }, { "include": "#brackets" }, { "include": "#assignment-keyword" }, { "include": "#operator-keyword" }, { "include": "#variable" }] }, "IO-keywords": { "begin": "(?i)\\G\\s*\\b(?:(read)|(write))\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.control.generic-spec.read.fortran" }, "2": { "name": "keyword.control.generic-spec.write.fortran" }, "3": { "name": "punctuation.parentheses.left.fortran" } }, "comment": "IO generic specification.", "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.parentheses.right.fortran" } }, "patterns": [{ "captures": { "1": { "name": "keyword.control.generic-spec.formatted.fortran" }, "2": { "name": "keyword.control.generic-spec.unformatted.fortran" } }, "match": "(?i)\\G\\s*\\b(?:(formatted)|(unformatted))\\b" }, { "include": "#invalid-word" }] }, "IO-statements": { "patterns": [{ "begin": "(?ix)\\b(?:(backspace)|(close)|(endfile)|(format)|(inquire)|(open)|(read)|(rewind)|(write))\\s*(?=\\()", "beginCaptures": { "1": { "name": "keyword.control.backspace.fortran" }, "2": { "name": "keyword.control.close.fortran" }, "3": { "name": "keyword.control.endfile.fortran" }, "4": { "name": "keyword.control.format.fortran" }, "5": { "name": "keyword.control.inquire.fortran" }, "6": { "name": "keyword.control.open.fortran" }, "7": { "name": "keyword.control.read.fortran" }, "8": { "name": "keyword.control.rewind.fortran" }, "9": { "name": "keyword.control.write.fortran" }, "10": { "name": "punctuation.parentheses.left.fortran" } }, "comment": "Introduced in the Fortran 1977 standard.", "end": "(?=[;!\\n])", "endCaptures": { "1": { "name": "punctuation.parentheses.right.fortran" } }, "name": "meta.statement.IO.fortran", "patterns": [{ "include": "#parentheses-dummy-variables" }, { "include": "#IO-item-list" }] }, { "captures": { "1": { "name": "keyword.control.backspace.fortran" }, "2": { "name": "keyword.control.endfile.fortran" }, "3": { "name": "keyword.control.format.fortran" }, "4": { "name": "keyword.control.print.fortran" }, "5": { "name": "keyword.control.read.fortran" }, "6": { "name": "keyword.control.rewind.fortran" } }, "comment": "Introduced in the Fortran 1977 standard.", "match": "(?i)\\b(?:(backspace)|(endfile)|(format)|(print)|(read)|(rewind))\\b" }, { "begin": "(?i)\\b(?:(flush)|(wait))\\s*(?=\\()", "beginCaptures": { "1": { "name": "keyword.control.flush.fortran" }, "2": { "name": "keyword.control.wait.fortran" }, "3": { "name": "punctuation.parentheses.left.fortran" } }, "comment": "Introduced in the Fortran 2003 standard.", "end": "(?)(\\=)(?!\\=|\\>)", "name": "keyword.operator.assignment.fortran" }, "associate-construct": { "begin": "(?i)\\b(associate)\\b(?=\\s*\\()", "beginCaptures": { "1": { "name": "keyword.control.associate.fortran" } }, "comment": "Introduced in the Fortran 2003 standard.", "contentName": "meta.block.associate.fortran", "end": "(?i)\\b(end\\s*associate)\\b", "endCaptures": { "1": { "name": "keyword.control.endassociate.fortran" } }, "patterns": [{ "include": "$base" }] }, "asynchronous-attribute": { "captures": { "1": { "name": "storage.modifier.asynchronous.fortran" } }, "comment": "Introduced in the Fortran 2003 standard.", "match": "(?i)\\G\\s*\\b(asynchronous)\\b" }, "attribute-specification-statement": { "begin": "(?ix)(?=\\b(?:allocatable|asynchronous|contiguous |external|intrinsic|optional|parameter|pointer|private|protected|public|save|target|value|volatile)\\b |(bind|dimension|intent)\\s*\\( |(codimension)\\s*\\[)", "end": "(?=[;!\\n])", "name": "meta.statement.attribute-specification.fortran", "patterns": [{ "include": "#access-attribute" }, { "include": "#allocatable-attribute" }, { "include": "#asynchronous-attribute" }, { "include": "#codimension-attribute" }, { "include": "#contiguous-attribute" }, { "include": "#dimension-attribute" }, { "include": "#external-attribute" }, { "include": "#intent-attribute" }, { "include": "#intrinsic-attribute" }, { "include": "#language-binding-attribute" }, { "include": "#optional-attribute" }, { "include": "#parameter-attribute" }, { "include": "#pointer-attribute" }, { "include": "#protected-attribute" }, { "include": "#save-attribute" }, { "include": "#target-attribute" }, { "include": "#value-attribute" }, { "include": "#volatile-attribute" }, { "begin": "(?=\\s*::)", "comment": "Attribute list.", "contentName": "meta.attribute-list.normal.fortran", "end": "(::)|(?=[;!\\n])", "endCaptures": { "1": { "name": "keyword.operator.double-colon.fortran" } }, "patterns": [{ "include": "#invalid-word" }] }, { "include": "#name-list" }] }, "block-construct": { "begin": "(?i)\\b(block)\\b(?!\\s*\\bdata\\b)", "beginCaptures": { "1": { "name": "keyword.control.associate.fortran" } }, "comment": "Introduced in the Fortran 2008 standard.", "contentName": "meta.block.block.fortran", "end": "(?i)\\b(end\\s*block)\\b", "endCaptures": { "1": { "name": "keyword.control.endassociate.fortran" } }, "patterns": [{ "include": "$base" }] }, "block-data-definition": { "begin": "(?i)\\b(block\\s*data)\\b(?:\\s+([a-z]\\w*)\\b)?", "beginCaptures": { "1": { "name": "keyword.control.block-data.fortran" }, "2": { "name": "entity.name.block-data.fortran" } }, "end": "(?ix)\\b(?:(end\\s*block\\s*data)(?:\\s+(\\2))?|(end))\\b (?:\\s*(\\S((?!\\n).)*))?", "endCaptures": { "1": { "name": "keyword.control.end-block-data.fortran" }, "2": { "name": "entity.name.block-data.fortran" }, "3": { "name": "keyword.control.end-block-data.fortran" }, "4": { "name": "invalid.error.block-data-definition.fortran" } }, "name": "meta.block-data.fortran", "patterns": [{ "include": "$base" }] }, "brackets": { "begin": "\\s*(\\[)", "beginCaptures": { "1": { "name": "punctuation.bracket.left.fortran" } }, "end": "(\\])", "endCaptures": { "1": { "name": "punctuation.bracket.left.fortran" } }, "patterns": [{ "include": "#comments" }, { "include": "#constants" }, { "include": "#operators" }, { "include": "#array-constructor" }, { "include": "#parentheses" }, { "include": "#intrinsic-functions" }, { "include": "#variable" }] }, "call-statement": { "patterns": [{ "begin": "(?i)\\s*\\b(call)\\b", "beginCaptures": { "1": { "name": "keyword.control.call.fortran" } }, "comment": "Introduced in the Fortran 1977 standard.", "end": "(?=[;!\\n])", "name": "meta.statement.control.call.fortran", "patterns": [{ "begin": "(?ix)\\G\\s*([a-z]\\w*)(%)([a-z]\\w*)\\b\\s*(?=\\()", "beginCaptures": { "1": { "name": "variable.other.fortran" }, "2": { "name": "keyword.accessor.fortran" }, "3": { "name": "entity.name.function.subroutine.fortran" } }, "comment": "type-bound subroutines", "end": "(?\\=|\\>|\\<|\\<\\=|\\-|\\+|\\/|\\/\\/|\\*\\*|\\*) |(\\S.*) )\\s*(\\))", "beginCaptures": { "1": { "name": "keyword.other.operator.fortran" }, "2": { "name": "punctuation.parentheses.left.fortran" }, "3": { "name": "keyword.operator.fortran" }, "4": { "name": "invalid.error.generic-interface-block-op.fortran" }, "5": { "name": "punctuation.parentheses.right.fortran" } }, "comment": "Operator generic interface.", "end": "(?ix)\\b(end\\s*interface)\\b (?:\\s*\\b(\\1)\\b\\s*(\\()\\s*(?:(\\3)|(\\S.*))\\s*(\\)))?", "endCaptures": { "1": { "name": "keyword.control.endinterface.fortran" }, "2": { "name": "keyword.other.operator.fortran" }, "3": { "name": "punctuation.parentheses.left.fortran" }, "4": { "name": "keyword.operator.fortran" }, "5": { "name": "invalid.error.generic-interface-block-op-end.fortran" }, "6": { "name": "punctuation.parentheses.right.fortran" } }, "patterns": [{ "include": "#interface-procedure-statement" }, { "include": "$base" }] }, { "begin": "(?ix)\\G\\s*\\b(?:(read)|(write))\\s* (\\()\\s*(?:(formatted)|(unformatted)|(\\S.*))\\s*(\\))", "beginCaptures": { "1": { "name": "keyword.other.read.fortran" }, "2": { "name": "keyword.other.write.fortran" }, "3": { "name": "punctuation.parentheses.left.fortran" }, "4": { "name": "keyword.other.formatted.fortran" }, "5": { "name": "keyword.other.unformatted.fortran" }, "6": { "name": "invalid.error.generic-interface-block.fortran" }, "7": { "name": "punctuation.parentheses.right.fortran" } }, "comment": "Read/Write generic interface.", "end": "(?ix)\\b(end\\s*interface)\\b(?:\\s*\\b(?:(\\2)|(\\3))\\b\\s* (\\()\\s*(?:(\\4)|(\\5)|(\\S.*))\\s*(\\)))?", "endCaptures": { "1": { "name": "keyword.control.endinterface.fortran" }, "2": { "name": "keyword.other.read.fortran" }, "3": { "name": "keyword.other.write.fortran" }, "4": { "name": "punctuation.parentheses.left.fortran" }, "5": { "name": "keyword.other.formatted.fortran" }, "6": { "name": "keyword.other.unformatted.fortran" }, "7": { "name": "invalid.error.generic-interface-block-end.fortran" }, "8": { "name": "punctuation.parentheses.right.fortran" } }, "patterns": [{ "include": "#interface-procedure-statement" }, { "include": "$base" }] }, { "begin": "(?i)\\G\\s*\\b([a-z]\\w*)\\b", "beginCaptures": { "1": { "name": "entity.name.function.fortran" } }, "comment": "Generic interface.", "end": "(?i)\\b(end\\s*interface)\\b(?:\\s*\\b(\\1)\\b)?", "endCaptures": { "1": { "name": "keyword.control.endinterface.fortran" }, "2": { "name": "entity.name.function.fortran" } }, "patterns": [{ "include": "#interface-procedure-statement" }, { "include": "$base" }] }] }, "goto-statement": { "begin": "(?i)\\s*\\b(go\\s*to)\\b", "beginCaptures": { "1": { "name": "keyword.control.goto.fortran" } }, "comment": "Introduced in the Fortran 1977 standard.", "end": "(?=[;!\\n])", "name": "meta.statement.control.goto.fortran", "patterns": [{ "include": "$base" }] }, "if-construct": { "patterns": [{ "begin": "(?i)\\b(if)\\b", "beginCaptures": { "1": { "name": "keyword.control.if.fortran" } }, "end": "(?=[;!\\n])", "patterns": [{ "include": "#logical-control-expression" }, { "begin": "(?i)\\s*\\b(then)\\b", "beginCaptures": { "1": { "name": "keyword.control.then.fortran" } }, "contentName": "meta.block.if.fortran", "end": "(?i)\\b(end\\s*if)\\b", "endCaptures": { "1": { "name": "keyword.control.endif.fortran" } }, "patterns": [{ "begin": "(?i)\\b(else\\s*if)\\b", "beginCaptures": { "1": { "name": "keyword.control.elseif.fortran" } }, "comment": "else if statement", "end": "(?=[;!\\n])", "patterns": [{ "include": "#parentheses" }, { "captures": { "1": { "name": "keyword.control.then.fortran" }, "2": { "name": "meta.label.elseif.fortran" } }, "comment": "capture the label if present", "match": "(?i)\\b(then)\\b(\\s*[a-z]\\w*)?" }, { "include": "#invalid-word" }] }, { "begin": "(?i)\\b(else)\\b", "beginCaptures": { "1": { "name": "keyword.control.else.fortran" } }, "comment": "else block", "end": "(?i)(?=\\b(end\\s*if)\\b)", "patterns": [{ "begin": "(?!(\\s*(;|!|\\n)))", "comment": "rest of else line", "end": "(?=[;!\\n])", "patterns": [{ "captures": { "1": { "name": "meta.label.else.fortran" }, "2": { "name": "invalid.error.label.else.fortran" } }, "comment": "capture the label if present", "match": "\\s*([a-z]\\w*)?\\s*\\b(\\w*)\\b" }, { "include": "#invalid-word" }] }, { "begin": "(?i)(?!\\b(end\\s*if)\\b)", "end": "(?i)(?=\\b(end\\s*if)\\b)", "patterns": [{ "include": "$base" }] }] }, { "include": "$base" }] }, { "begin": "(?i)(?=\\s*[a-z])", "end": "(?=[;!\\n])", "name": "meta.statement.control.if.fortran", "patterns": [{ "include": "$base" }] }] }] }, "image-control-statement": { "patterns": [{ "include": "#sync-all-statement" }, { "include": "#sync-statement" }, { "include": "#event-statement" }, { "include": "#form-team-statement" }, { "include": "#fail-image-statement" }] }, "implicit-statement": { "begin": "(?i)\\b(implicit)\\b", "beginCaptures": { "1": { "name": "keyword.other.implicit.fortran" } }, "end": "(?=[;!\\n])", "name": "meta.statement.implicit.fortran", "patterns": [{ "captures": { "1": { "name": "keyword.other.none.fortran" } }, "match": "(?i)\\s*\\b(none)\\b" }, { "include": "$base" }] }, "import-statement": { "begin": "(?i)\\b(import)\\b", "beginCaptures": { "1": { "name": "keyword.control.include.fortran" } }, "comment": "Introduced in the Fortran 1990 standard.", "end": "(?=[;!\\n])", "name": "meta.statement.include.fortran", "patterns": [{ "begin": "(?i)\\G\\s*(?:(::)|(?=[a-z]))", "beginCaptures": { "1": { "name": "keyword.operator.double-colon.fortran" } }, "end": "(?=[;!\\n])", "patterns": [{ "include": "#name-list" }] }, { "begin": "\\G\\s*(,)", "beginCaptures": { "1": { "name": "punctuation.comma.fortran" } }, "end": "(?=[;!\\n])", "patterns": [{ "captures": { "1": { "name": "keyword.other.all.fortran" } }, "match": "(?i)\\G\\s*\\b(all)\\b" }, { "captures": { "1": { "name": "keyword.other.none.fortran" } }, "match": "(?i)\\G\\s*\\b(none)\\b" }, { "begin": "(?i)\\G\\s*\\b(only)\\s*(:)", "beginCaptures": { "1": { "name": "keyword.other.only.fortran" }, "2": { "name": "keyword.other.colon.fortran" } }, "end": "(?=[;!\\n])", "patterns": [{ "include": "#name-list" }] }, { "include": "#invalid-word" }] }] }, "include-statement": { "begin": "(?i)\\b(include)\\b", "beginCaptures": { "1": { "name": "keyword.control.include.fortran" } }, "comment": "Introduced in the Fortran 1990 standard.", "end": "(?=[;!\\n])", "name": "meta.statement.include.fortran", "patterns": [{ "include": "#string-constant" }, { "include": "#invalid-character" }] }, "intent-attribute": { "begin": "(?i)\\s*\\b(intent)\\s*(\\()", "beginCaptures": { "1": { "name": "storage.modifier.intent.fortran" }, "2": { "name": "punctuation.parentheses.left.fortran" } }, "comment": "Introduced in the Fortran 1990 standard.", "end": "(\\))|(?=[;!\\n])", "endCaptures": { "1": { "name": "punctuation.parentheses.left.fortran" } }, "patterns": [{ "captures": { "1": { "name": "storage.modifier.intent.in-out.fortran" }, "2": { "name": "storage.modifier.intent.in.fortran" }, "3": { "name": "storage.modifier.intent.out.fortran" } }, "match": "(?i)\\b(?:(in\\s*out)|(in)|(out))\\b" }, { "include": "#invalid-word" }] }, "interface-block-constructs": { "patterns": [{ "include": "#abstract-interface-block-construct" }, { "include": "#explicit-interface-block-construct" }, { "include": "#generic-interface-block-construct" }] }, "interface-procedure-statement": { "begin": `(?i)(?=[^'";!\\n]*\\bprocedure\\b)`, "comment": "Introduced in the Fortran 1990 standard.", "end": "(?=[;!\\n])", "name": "meta.statement.procedure.fortran", "patterns": [{ "begin": "(?i)(?=\\G\\s*(?!\\bprocedure\\b))", "comment": "Attribute list.", "end": "(?i)(?=\\bprocedure\\b)", "name": "meta.attribute-list.interface.fortran", "patterns": [{ "include": "#module-attribute" }, { "include": "#invalid-word" }] }, { "begin": "(?i)\\s*\\b(procedure)\\b", "beginCaptures": { "1": { "name": "keyword.other.procedure.fortran" } }, "comment": "Procedure statement.", "end": "(?=[;!\\n])", "patterns": [{ "captures": { "1": { "name": "keyword.operator.double-colon.fortran" } }, "match": "\\G\\s*(::)" }, { "include": "#procedure-name-list" }] }] }, "intrinsic-attribute": { "captures": { "1": { "name": "storage.modifier.intrinsic.fortran" } }, "comment": "Introduced in the Fortran 1977 standard.", "match": "(?i)\\s*\\b(intrinsic)\\b" }, "intrinsic-functions": { "patterns": [{ "begin": "(?ix)\\b(acosh|asinh|atanh|bge|bgt|ble|blt|dshiftl|dshiftr| findloc|hypot|iall|iany|image_index|iparity|is_contiguous|lcobound| leadz|mask[lr]|merge_bits|norm2|num_images|parity|popcnt|poppar| shift[alr]|storage_size|this_image|trailz|ucobound)\\s*(?=\\()", "beginCaptures": { "1": { "name": "support.function.intrinsic.fortran" }, "2": { "name": "punctuation.parentheses.left.fortran" } }, "comment": "Intrinsic functions introduced in the Fortran 2008 standard.", "end": "(?\\=|(?|\\<\\=|\\<)", "name": "keyword.logical.fortran.modern" }] }, "logical-type": { "comment": "Introduced in the Fortran 1977 standard.", "patterns": [{ "begin": "(?i)\\b(logical)\\s*(?=\\()", "beginCaptures": { "1": { "name": "storage.type.logical.fortran" }, "2": { "name": "punctuation.parentheses.left.fortran" } }, "contentName": "meta.type-spec.fortran", "end": "(?)", "name": "keyword.other.point.fortran" }, "preprocessor": { "begin": "^\\s*(#:?)", "beginCaptures": { "1": { "name": "keyword.control.preprocessor.indicator.fortran" } }, "end": "\\n", "name": "meta.preprocessor", "patterns": [{ "include": "#preprocessor-if-construct" }, { "include": "#preprocessor-statements" }] }, "preprocessor-arithmetic-operators": { "captures": { "1": { "name": "keyword.operator.subtraction.fortran" }, "2": { "name": "keyword.operator.addition.fortran" }, "3": { "name": "keyword.operator.division.fortran" }, "4": { "name": "keyword.operator.multiplication.fortran" } }, "comment": "division regex is different than in main fortran", "match": "(\\-)|(\\+)|(\\/)|(\\*)" }, "preprocessor-assignment-operator": { "comment": "assignments with = are not allowed", "match": "(?", "endCaptures": { "0": { "name": "punctuation.definition.string.end.preprocessor.fortran" } }, "name": "string.quoted.other.lt-gt.include.preprocessor.fortran" }, { "include": "#line-continuation-operator" }] }, "preprocessor-line-continuation-operator": { "begin": "\\s*(\\\\)", "beginCaptures": { "1": { "name": "constant.character.escape.line-continuation.preprocessor.fortran" } }, "end": "(?i)^" }, "preprocessor-logical-operators": { "captures": { "1": { "name": "keyword.operator.logical.preprocessor.and.fortran" }, "2": { "name": "keyword.operator.logical.preprocessor.equals.fortran" }, "3": { "name": "keyword.operator.logical.preprocessor.not_equals.fortran" }, "4": { "name": "keyword.operator.logical.preprocessor.or.fortran" }, "5": { "name": "keyword.operator.logical.preprocessor.less_eq.fortran" }, "6": { "name": "keyword.operator.logical.preprocessor.more_eq.fortran" }, "7": { "name": "keyword.operator.logical.preprocessor.less.fortran" }, "8": { "name": "keyword.operator.logical.preprocessor.more.fortran" }, "9": { "name": "keyword.operator.logical.preprocessor.complementary.fortran" }, "10": { "name": "keyword.operator.logical.preprocessor.xor.fortran" }, "11": { "name": "keyword.operator.logical.preprocessor.bitand.fortran" }, "12": { "name": "keyword.operator.logical.preprocessor.not.fortran" }, "13": { "name": "keyword.operator.logical.preprocessor.bitor.fortran" } }, "comment": "and:&&, bitand:&, or:||, bitor:|, not eq:!=, not:!, xor:^, compl:~", "match": "(&&)|(==)|(\\!=)|(\\|\\|)|(\\<\\=)|(\\>=)|(\\<)|(\\>)|(~)|(\\^)|(&)|(\\!)|(\\|)", "name": "keyword.operator.logical.preprocessor.fortran" }, "preprocessor-operators": { "patterns": [{ "include": "#preprocessor-line-continuation-operator" }, { "include": "#preprocessor-logical-operators" }, { "include": "#preprocessor-arithmetic-operators" }] }, "preprocessor-pragma-statement": { "begin": "(?i)\\G\\s*\\b(pragma)\\b", "beginCaptures": { "1": { "name": "keyword.control.preprocessor.pragma.fortran" } }, "end": "(?=\\n)", "name": "meta.preprocessor.pragma.fortran", "patterns": [{ "include": "#preprocessor-comments" }, { "include": "#preprocessor-string-constant" }] }, "preprocessor-statements": { "patterns": [{ "include": "#preprocessor-define-statement" }, { "include": "#preprocessor-error-statement" }, { "include": "#preprocessor-include-statement" }, { "include": "#preprocessor-preprocessor-pragma-statement" }, { "include": "#preprocessor-undefine-statement" }] }, "preprocessor-string-constant": { "patterns": [{ "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.preprocessor.fortran" } }, "comment": "Double quote string", "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.preprocessor.fortran" } }, "name": "string.quoted.double.include.preprocessor.fortran" }, { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.preprocessor.fortran" } }, "comment": "Single quote string", "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.preprocessor.fortran" } }, "name": "string.quoted.single.include.preprocessor.fortran" }] }, "preprocessor-undefine-statement": { "begin": "(?i)\\G\\s*\\b(undef)\\b", "beginCaptures": { "1": { "name": "keyword.control.preprocessor.undef.fortran" } }, "end": "(?=\\n)", "name": "meta.preprocessor.undef.fortran", "patterns": [{ "include": "#preprocessor-comments" }, { "include": "#preprocessor-line-continuation-operator" }] }, "private-attribute": { "captures": { "1": { "name": "storage.modifier.private.fortran" } }, "comment": "Introduced in the Fortran 1990 standard.", "match": "(?i)\\s*\\b(private)\\b" }, "procedure-call-dummy-variable": { "match": "(?i)\\s*([a-z]\\w*)(?=\\s*\\=)(?!\\s*\\=\\=)", "name": "variable.parameter.dummy-variable.fortran.modern" }, "procedure-definition": { "begin": `(?i)(?=[^'";!\\n]*\\bmodule\\s+procedure\\b)`, "comment": "Procedure program unit. Introduced in the Fortran 2008 standard.", "end": "(?=[;!\\n])", "name": "meta.procedure.fortran", "patterns": [{ "begin": "(?i)\\s*\\b(module\\s+procedure)\\b", "beginCaptures": { "1": { "name": "keyword.other.procedure.fortran" } }, "end": "(?=[;!\\n])", "patterns": [{ "begin": "(?i)\\G\\s*\\b([a-z]\\w*)\\b", "beginCaptures": { "1": { "name": "entity.name.function.procedure.fortran" } }, "comment": "Procedure body.", "end": "(?ix)\\s*\\b(?:(end\\s*procedure)(?:\\s+([a-z_]\\w*))?|(end))\\b \\s*([^;!\\n]+)?(?=[;!\\n])", "endCaptures": { "1": { "name": "keyword.other.endprocedure.fortran" }, "2": { "name": "entity.name.function.procedure.fortran" }, "3": { "name": "keyword.other.endprocedure.fortran" }, "4": { "name": "invalid.error.procedure-definition.fortran" } }, "patterns": [{ "begin": "\\G(?!\\s*[;!\\n])", "comment": "Rest of the first line in procedure construct - should be empty.", "end": "(?=[;!\\n])", "name": "meta.first-line.fortran", "patterns": [{ "include": "#invalid-character" }] }, { "begin": "(?i)(?!\\s*(?:contains\\b|end\\s*[;!\\n]|end\\s*procedure\\b))", "comment": "Specification and execution block.", "end": "(?i)(?=\\s*(?:contains\\b|end\\s*[;!\\n]|end\\s*procedure\\b))", "name": "meta.block.specification.procedure.fortran", "patterns": [{ "include": "$self" }] }, { "begin": "(?i)\\s*(contains)\\b", "beginCaptures": { "1": { "name": "keyword.control.contains.fortran" } }, "comment": "Contains block.", "end": "(?i)(?=\\s*(?:end\\s*[;!\\n]|end\\s*procedure\\b))", "name": "meta.block.contains.fortran", "patterns": [{ "include": "$self" }] }] }] }] }, "procedure-name": { "captures": { "1": { "name": "entity.name.function.procedure.fortran" } }, "comment": "Procedure name.", "match": "(?i)\\s*\\b([a-z]\\w*)\\b" }, "procedure-name-list": { "begin": "(?i)(?=\\s*[a-z])", "comment": "Name list.", "contentName": "meta.name-list.fortran", "end": "(?=[;!\\n])", "patterns": [{ "begin": "(?!\\s*\\n)", "end": "(,)|(?=[!;\\n])", "endCaptures": { "1": { "name": "punctuation.comma.fortran" } }, "patterns": [{ "include": "#procedure-name" }, { "include": "#pointer-operators" }] }] }, "procedure-specification-statement": { "begin": "(?i)(?=\\b(?:procedure)\\b)", "comment": "Introduced in the Fortran 2003 standard.", "end": "(?=[;!\\n])", "name": "meta.specification.procedure.fortran", "patterns": [{ "include": "#procedure-type" }, { "begin": "(?=\\s*(,|::|\\())", "comment": "Attribute list.", "contentName": "meta.attribute-list.procedure.fortran", "end": "(::)|(?=[;!\\n])", "endCaptures": { "1": { "name": "keyword.operator.double-colon.fortran" } }, "patterns": [{ "begin": "(,)|^|(?<=&)", "beginCaptures": { "1": { "name": "punctuation.comma.fortran" } }, "end": "(?=::|[,&;!\\n])", "patterns": [{ "include": "#access-attribute" }, { "include": "#intent-attribute" }, { "include": "#optional-attribute" }, { "include": "#pointer-attribute" }, { "include": "#protected-attribute" }, { "include": "#save-attribute" }, { "include": "#invalid-word" }] }] }, { "include": "#procedure-name-list" }] }, "procedure-type": { "comment": "Introduced in the Fortran ???? standard.", "patterns": [{ "begin": "(?i)\\b(procedure)\\s*(\\()", "beginCaptures": { "1": { "name": "storage.type.procedure.fortran" }, "2": { "name": "punctuation.parentheses.left.fortran" } }, "contentName": "meta.type-spec.fortran", "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.parentheses.right.fortran" } }, "patterns": [{ "include": "#types" }, { "include": "#procedure-name" }] }, { "captures": { "1": { "name": "storage.type.procedure.fortran" } }, "match": "(?i)\\b(procedure)\\b" }] }, "program-definition": { "begin": "(?i)(?=\\b(program)\\b)", "comment": "Introduced in the Fortran 1977 standard.", "end": "(?=[;!\\n])", "name": "meta.program.fortran", "patterns": [{ "captures": { "1": { "name": "keyword.control.program.fortran" } }, "match": "(?i)\\G\\s*\\b(program)\\b" }, { "applyEndPatternLast": 1, "begin": "(?i)\\s*\\b([a-z]\\w*)\\b", "beginCaptures": { "1": { "name": "entity.name.program.fortran" } }, "comment": "Program body.", "end": "(?ix)\\b(?:(end\\s*program)(?:\\s+([a-z_]\\w*))?|(end))\\b\\s*([^;!\\n]+)?(?=[;!\\n])", "endCaptures": { "1": { "name": "keyword.control.endprogram.fortran" }, "2": { "name": "entity.name.program.fortran" }, "3": { "name": "keyword.control.endprogram.fortran" }, "4": { "name": "invalid.error.program-definition.fortran" } }, "patterns": [{ "begin": "\\G", "comment": "Program specification block.", "end": "(?i)(?=\\b(?:end\\s*[;!\\n]|end\\s*program\\b))", "name": "meta.block.specification.program.fortran", "patterns": [{ "begin": "(?i)\\b(contains)\\b", "beginCaptures": { "1": { "name": "keyword.control.contains.fortran" } }, "comment": "Program contains block.", "end": "(?i)(?=(?:end\\s*[;!\\n]|end\\s*program\\b))", "name": "meta.block.contains.fortran", "patterns": [{ "include": "$base" }] }, { "include": "$base" }] }] }] }, "protected-attribute": { "captures": { "1": { "name": "storage.modifier.protected.fortran" } }, "comment": "Introduced in the Fortran 2003 standard.", "match": "(?i)\\s*\\b(protected)\\b" }, "public-attribute": { "captures": { "1": { "name": "storage.modifier.public.fortran" } }, "comment": "Introduced in the Fortran 1990 standard.", "match": "(?i)\\s*\\b(public)\\b" }, "pure-attribute": { "captures": { "1": { "name": "storage.modifier.impure.fortran" }, "2": { "name": "storage.modifier.pure.fortran" } }, "comment": "Introduced in the Fortran 1995 standard.", "match": "(?i)\\s*\\b(?:(impure)|(pure))\\b" }, "recursive-attribute": { "captures": { "1": { "name": "storage.modifier.non_recursive.fortran" }, "2": { "name": "storage.modifier.recursive.fortran" } }, "comment": "Introduced in the Fortran 1977 standard.", "match": "(?i)\\s*\\b(?:(non_recursive)|(recursive))\\b" }, "result-statement": { "begin": "(?i)\\s*\\b(result)\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.control.result.fortran" }, "2": { "name": "punctuation.parentheses.left.fortran" } }, "comment": "Introduced in the Fortran 1990 standard.", "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.parentheses.right.fortran" } }, "patterns": [{ "include": "#dummy-variable" }] }, "return-statement": { "begin": "(?i)\\s*\\b(return)\\b", "beginCaptures": { "1": { "name": "keyword.control.return.fortran" } }, "comment": "Introduced in the Fortran 1977 standard.", "end": "(?=[;!\\n])", "name": "meta.statement.control.return.fortran", "patterns": [{ "include": "#invalid-character" }] }, "save-attribute": { "captures": { "1": { "name": "storage.modifier.save.fortran" } }, "comment": "Introduced in the Fortran 1977 standard.", "match": "(?i)\\s*\\b(save)\\b" }, "select-case-construct": { "begin": "(?i)\\b(select\\s*case)\\b", "beginCaptures": { "1": { "name": "keyword.control.selectcase.fortran" } }, "comment": "Select case construct. Introduced in the Fortran 1990 standard.", "end": "(?i)\\b(end\\s*select)\\b", "endCaptures": { "1": { "name": "keyword.control.endselect.fortran" } }, "name": "meta.block.select.case.fortran", "patterns": [{ "include": "#parentheses" }, { "begin": "(?i)\\b(case)\\b", "beginCaptures": { "1": { "name": "keyword.control.case.fortran" } }, "end": "(?i)(?=[;!\\n])", "patterns": [{ "captures": { "1": { "name": "keyword.control.default.fortran" } }, "match": "(?i)\\G\\s*\\b(default)\\b" }, { "include": "#parentheses" }, { "include": "#invalid-word" }] }, { "include": "$base" }] }, "select-rank-construct": { "begin": "(?i)\\b(select\\s*rank)\\b", "beginCaptures": { "1": { "name": "keyword.control.selectrank.fortran" } }, "comment": "Select rank construct. Introduced in the Fortran 2008 standard.", "end": "(?i)\\b(end\\s*select)\\b", "endCaptures": { "1": { "name": "keyword.control.endselect.fortran" } }, "name": "meta.block.select.rank.fortran", "patterns": [{ "include": "#parentheses" }, { "begin": "(?i)\\b(rank)\\b", "beginCaptures": { "1": { "name": "keyword.control.rank.fortran" } }, "end": "(?i)(?=[;!\\n])", "patterns": [{ "captures": { "1": { "name": "keyword.control.default.fortran" } }, "match": "(?i)\\G\\s*\\b(default)\\b" }, { "include": "#parentheses" }, { "include": "#invalid-word" }] }, { "include": "$base" }] }, "select-type-construct": { "begin": "(?i)\\b(select\\s*type)\\b", "beginCaptures": { "1": { "name": "keyword.control.selecttype.fortran" } }, "comment": "Select type construct. Introduced in the Fortran 2003 standard.", "end": "(?i)\\b(end\\s*select)\\b", "endCaptures": { "1": { "name": "keyword.control.endselect.fortran" } }, "name": "meta.block.select.type.fortran", "patterns": [{ "include": "#parentheses" }, { "begin": "(?i)\\b(?:(class)|(type))\\b", "beginCaptures": { "1": { "name": "keyword.control.class.fortran" }, "2": { "name": "keyword.control.type.fortran" } }, "end": "(?i)(?=[;!\\n])", "patterns": [{ "captures": { "1": { "name": "keyword.control.default.fortran" } }, "match": "(?i)\\G\\s*\\b(default)\\b" }, { "captures": { "1": { "name": "keyword.control.is.fortran" } }, "match": "(?i)\\G\\s*\\b(is)\\b" }, { "include": "#parentheses" }, { "include": "#invalid-word" }] }, { "include": "$base" }] }, "sequence-attribute": { "captures": { "1": { "name": "storage.modifier.sequence.fortran" } }, "comment": "Introduced in the Fortran 20?? standard.", "match": "(?i)\\s*\\b(sequence)\\b" }, "specification-statements": { "patterns": [{ "include": "#attribute-specification-statement" }, { "include": "#common-statement" }, { "include": "#data-statement" }, { "include": "#equivalence-statement" }, { "include": "#implicit-statement" }, { "include": "#namelist-statement" }, { "include": "#use-statement" }] }, "stop-statement": { "begin": "(?i)\\s*\\b(stop)\\b(?:\\s*\\b([a-z]\\w*)\\b)?", "beginCaptures": { "1": { "name": "keyword.control.stop.fortran" }, "2": { "name": "meta.label.stop.stop" } }, "comment": "Introduced in the Fortran 1977 standard.", "end": "(?=[;!\\n])", "name": "meta.statement.control.stop.fortran", "patterns": [{ "include": "#constants" }, { "include": "#string-operators" }, { "include": "#invalid-character" }] }, "string-constant": { "comment": "Introduced in the Fortran 1977 standard.", "patterns": [{ "applyEndPatternLast": 1, "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.fortran" } }, "comment": "String", "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.fortran" } }, "name": "string.quoted.single.fortran", "patterns": [{ "match": "''", "name": "constant.character.escape.apostrophe.fortran" }] }, { "applyEndPatternLast": 1, "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.fortran" } }, "comment": "String", "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.fortran" } }, "name": "string.quoted.double.fortran", "patterns": [{ "match": '""', "name": "constant.character.escape.quote.fortran" }] }] }, "string-line-continuation-operator": { "begin": "(&)(?=\\s*\\n)", "beginCaptures": { "1": { "name": "keyword.operator.line-continuation.fortran" } }, "comment": "Operator that allows a line to be continued on the next line.", "end": "(?i)^(?:(?=\\s*[^\\s!&])|\\s*(&))", "endCaptures": { "1": { "name": "keyword.operator.line-continuation.fortran" } }, "patterns": [{ "include": "#comments" }, { "match": "\\S.*", "name": "invalid.error.string-line-cont.fortran" }] }, "string-operators": { "comment": "Introduced in the Fortran 19?? standard.", "match": "(\\/\\/)", "name": "keyword.other.concatination.fortran" }, "submodule-definition": { "begin": "(?i)(?=\\b(submodule)\\s*\\()", "comment": "Introduced in the Fortran 2008 standard.", "end": "(?=[;!\\n])", "name": "meta.submodule.fortran", "patterns": [{ "begin": "(?i)\\G\\s*\\b(submodule)\\s*(\\()\\s*(\\w+)", "beginCaptures": { "1": { "name": "keyword.other.submodule.fortran" }, "2": { "name": "punctuation.parentheses.left.fortran" }, "3": { "name": "entity.name.class.submodule.fortran" } }, "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.parentheses.left.fortran" } }, "patterns": [] }, { "applyEndPatternLast": 1, "begin": "(?i)\\s*\\b([a-z]\\w*)\\b", "beginCaptures": { "1": { "name": "entity.name.module.submodule.fortran" } }, "comment": "Submodule body.", "end": "(?ix)\\s*\\b(?:(end\\s*submodule)(?:\\s+([a-z_]\\w*))?|(end))\\b \\s*([^;!\\n]+)?(?=[;!\\n])", "endCaptures": { "1": { "name": "keyword.other.endsubmodule.fortran" }, "2": { "name": "entity.name.module.submodule.fortran" }, "3": { "name": "keyword.other.endsubmodule.fortran" }, "4": { "name": "invalid.error.submodule.fortran" } }, "patterns": [{ "begin": "\\G", "comment": "Submodule specification block.", "end": "(?i)(?=\\b(?:end\\s*[;!\\n]|end\\s*submodule\\b))", "name": "meta.block.specification.submodule.fortran", "patterns": [{ "begin": "(?i)\\b(contains)\\b", "beginCaptures": { "1": { "name": "keyword.control.contains.fortran" } }, "comment": "Submodule contains block.", "end": "(?i)(?=\\s*(?:end\\s*[;!\\n]|end\\s*submodule\\b))", "name": "meta.block.contains.fortran", "patterns": [{ "include": "$base" }] }, { "include": "$base" }] }] }] }, "subroutine-definition": { "begin": `(?i)(?=([^:'";!\\n](?!\\bend))*\\bsubroutine\\b)`, "comment": "Subroutine program unit. Introduced in the Fortran 1977 standard.", "end": "(?=[;!\\n])", "name": "meta.subroutine.fortran", "patterns": [{ "begin": "(?i)(?=\\G\\s*(?!\\bsubroutine\\b))", "comment": "Attribute list.", "end": "(?i)(?=\\bsubroutine\\b)", "name": "meta.attribute-list.subroutine.fortran", "patterns": [{ "include": "#elemental-attribute" }, { "include": "#module-attribute" }, { "include": "#pure-attribute" }, { "include": "#recursive-attribute" }, { "include": "#invalid-word" }] }, { "begin": "(?i)\\s*\\b(subroutine)\\b", "beginCaptures": { "1": { "name": "keyword.other.subroutine.fortran" } }, "end": "(?=[;!\\n])", "patterns": [{ "begin": "(?i)\\G\\s*\\b([a-z]\\w*)\\b", "beginCaptures": { "1": { "name": "entity.name.function.subroutine.fortran" } }, "comment": "Subroutine body.", "end": "(?ix)\\b(?:(end\\s*subroutine)(?:\\s+([a-z_]\\w*))?|(end))\\b \\s*([^;!\\n]+)?(?=[;!\\n])", "endCaptures": { "1": { "name": "keyword.other.endsubroutine.fortran" }, "2": { "name": "entity.name.function.subroutine.fortran" }, "3": { "name": "keyword.other.endsubroutine.fortran" }, "4": { "name": "invalid.error.subroutine.fortran" } }, "patterns": [{ "begin": "\\G(?!\\s*[;!\\n])", "comment": "Rest of the first line in subroutine construct.", "end": "(?=[;!\\n])", "name": "meta.first-line.fortran", "patterns": [{ "include": "#dummy-variable-list" }, { "include": "#language-binding-attribute" }] }, { "begin": "(?i)(?!\\b(?:end\\s*[;!\\n]|end\\s*subroutine\\b))", "comment": "Specification and execution block.", "end": "(?i)(?=\\b(?:end\\s*[;!\\n]|end\\s*subroutine\\b))", "name": "meta.block.specification.subroutine.fortran", "patterns": [{ "begin": "(?i)\\b(contains)\\b", "beginCaptures": { "1": { "name": "keyword.control.contains.fortran" } }, "comment": "Contains block.", "end": "(?i)(?=(?:end\\s*[;!\\n]|end\\s*subroutine\\b))", "name": "meta.block.contains.fortran", "patterns": [{ "include": "$base" }] }, { "include": "$base" }] }] }] }] }, "sync-all-statement": { "begin": "(?i)\\b(sync all|sync memory)(\\s*(?=\\())?", "beginCaptures": { "1": { "name": "keyword.control.sync-all-memory.fortran" }, "2": { "name": "punctuation.parentheses.left.fortran" } }, "comment": "Introduced in the Fortran 2018 standard.", "end": "(?