Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fortran90 Punchcard.tmLanguage with proper "!" comment handling
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>?i: has to be added everywhere because fortran is case insensitive; NB: order of matching matters</string>
<key>fileTypes</key>
<array>
<string>f</string>
<string>F</string>
<string>f77</string>
<string>F77</string>
<string>for</string>
<string>FOR</string>
<string>fpp</string>
<string>FPP</string>
</array>
<key>name</key>
<string>Fortran - Punchcard</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.fortran</string>
</dict>
</dict>
<key>match</key>
<string>(!).*$\n?</string>
<key>name</key>
<string>comment.line.number-sign.fortran</string>
</dict>
<dict>
<key>include</key>
<string>#preprocessor-rule-enabled</string>
</dict>
<dict>
<key>include</key>
<string>#preprocessor-rule-disabled</string>
</dict>
<dict>
<key>include</key>
<string>#preprocessor-rule-other</string>
</dict>
<dict>
<key>comment</key>
<string>built-in constants</string>
<key>match</key>
<string>(?i:(r8|r4|\.TRUE\.|\.FALSE\.))</string>
<key>name</key>
<string>constant.language.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>numbers</string>
<key>match</key>
<string>\b[\+\-]?[0-9]+\.?[0-9a-zA-Z_]*\b</string>
<key>name</key>
<string>constant.numeric.fortran</string>
</dict>
<dict>
<key>begin</key>
<string>(?x: # extended mode
^
\s* # start of line and possibly some space
([a-zA-Z\(\)]*)(?&lt;!end) # 1: possibly some type specification but not the word end
\s* # possibly some space
(?i:(function|subroutine))\b # 2: function or subroutine
\s+ # some space
([A-Za-z_][A-Za-z0-9_]*) # 3: name
\s* # possibly some space
(?: # optional parameters
(\() # 4: opening parenthesis
([^)]*)? # 5: arguments (anything but a parenthesis)
(\))? # 6: closing parenthesis
)?
)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.fortran</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>storage.type.function.fortran</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.function.fortran</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>punctuation.definition.parameters.fortran</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>variable.parameter.fortran</string>
</dict>
<key>6</key>
<dict>
<key>name</key>
<string>punctuation.definition.parameters.fortran</string>
</dict>
</dict>
<key>comment</key>
<string>First line of function/subroutine definition</string>
<key>end</key>
<string>(?x: # extended mode
((?i:end)) # 1: the word end
( # followed by
$ # end of line
| # or
\s* # possibly some space
(?i:(function|subroutine)) # 2: function or subroutine
((\s+[A-Za-z_][A-Za-z0-9_]*)?) # 3: possibly the name
)
)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.other.fortran</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>storage.type.function.fortran</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>entity.name.function.end.fortran</string>
</dict>
</dict>
<key>name</key>
<string>meta.function.fortran</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$self</string>
</dict>
<dict>
<key>include</key>
<string>source.fortran.modern</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>\b(?i:(integer|real|double\s+precision|complex|logical|character))\b(?=.*::)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.fortran</string>
</dict>
</dict>
<key>comment</key>
<string>Line of type specification</string>
<key>end</key>
<string>(?=!)|$</string>
<key>name</key>
<string>meta.specification.fortran</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$self</string>
</dict>
</array>
</dict>
<dict>
<key>comment</key>
<string>statements controling the flow of the program</string>
<key>match</key>
<string>\b(?i:(go\s*to|assign|to|if|then|else|elseif|end\s*if|continue|stop|pause|do|end\s*do|while|cycle))\b</string>
<key>name</key>
<string>keyword.control.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>programming units</string>
<key>match</key>
<string>\b(?i:(program|end\s+program|entry|block\s+data|call|return|contains|include))\b</string>
<key>name</key>
<string>keyword.control.programming-units.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>i/o statements</string>
<key>match</key>
<string>\b(?i:(open|close|read|write|print|inquire|backspace|endfile|format))\b</string>
<key>name</key>
<string>keyword.control.io.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>operators</string>
<key>match</key>
<string>((?&lt;!\=)\=(?!\=)|\-|\+|\/\/|\/|(?!^)\*|::)</string>
<key>name</key>
<string>keyword.operator.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>logical operators</string>
<key>match</key>
<string>(?i:(\.and\.|\.or\.|\.eq\.|\.lt\.|\.le\.|\.gt\.|\.ge\.|\.ne\.|\.not\.|\.eqv\.|\.neqv\.))</string>
<key>name</key>
<string>keyword.operator.logical.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>argument related intrisics</string>
<key>match</key>
<string>\b(?i:(present)(?=\())</string>
<key>name</key>
<string>keyword.other.instrisic.argument.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>numeric intrisics</string>
<key>match</key>
<string>\b(?i:(abs|aimag|aint|anint|cmplx|conjg|dble|dim|dprod|int|max|min|mod|nint|real|sign|digits|epsilon|huge|maxexponent|minexponent|precision|radix|range|tiny)(?=\())</string>
<key>name</key>
<string>keyword.other.instrisic.numeric.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>character string intrinsics</string>
<key>match</key>
<string>\b(?i:(achar|adjustl|adjustr|char|iachar|ichar|index|len_trim|repeat|scan|string|trim|verify|len)(?=\())</string>
<key>name</key>
<string>keyword.other.instrisic.string.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>mathematical intrisics</string>
<key>match</key>
<string>\b(?i:(((acos|asin|atan|atan2|cos|cosh|exp|log|log10|sin|sinh|sqrt|tan|tanh)(?=\())|(random_number|random_seed)))\b</string>
<key>name</key>
<string>keyword.other.instrisic.math.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>data kind intrinsics</string>
<key>match</key>
<string>\b(?i:(kind|selected_int_kind|selected_real_kind|transfer)(?=\())</string>
<key>name</key>
<string>keyword.other.instrisic.data.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>logical intrinsics</string>
<key>match</key>
<string>\b(?i:(logical)(?=\())</string>
<key>name</key>
<string>keyword.other.instrisic.logical.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>bit operations intrinsics</string>
<key>match</key>
<string>\b(?i:(((bit_size|btest|iand|ibclr|ibits|ibset|ieor|ior|ishift|ishiftc|not)(?=\())|mvbits))\b</string>
<key>name</key>
<string>keyword.other.instrisic.bit.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>floating point intrinsics</string>
<key>match</key>
<string>\b(?i:(exponent|fraction|nearest|rrspacing|scale|set_exponent|spacing)(?=\())</string>
<key>name</key>
<string>keyword.other.instrisic.floating-point.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>matrix/vector/array intrisics</string>
<key>match</key>
<string>\b(?i:(((dot_product|sum|matmul|transpose|all|any|count|maxval|minval|maxloc|minloc|product|sum|lbound|ubound|shape|size|merge|pack|unpack|reshape|spread|cshift|eoshift)(?=\())|(where|elsewhere|end\s*where)))\b</string>
<key>name</key>
<string>keyword.other.instrisic.array.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>other intrisics</string>
<key>match</key>
<string>\b(?i:(((dtime)(?=\())|(date_and_time|system_clock)))\b</string>
<key>name</key>
<string>keyword.other.instrisic.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>data specification</string>
<key>match</key>
<string>\b(?i:(integer|real|double\s+precision|complex|logical|character|block\sdata|operator|assignment))\b</string>
<key>name</key>
<string>storage.type.fortran</string>
</dict>
<dict>
<key>comment</key>
<string>data type attributes</string>
<key>match</key>
<string>\b(?i:(dimension|common|equivalence|parameter|external|intrinsic|save|data|implicit\s*none|implicit|intent|in|out|inout))\b</string>
<key>name</key>
<string>storage.modifier.fortran</string>
</dict>
<dict>
<key>applyEndPatternLast</key>
<integer>1</integer>
<key>begin</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.fortran</string>
</dict>
</dict>
<key>comment</key>
<string>String</string>
<key>end</key>
<string>'</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.fortran</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.fortran</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>''</string>
<key>name</key>
<string>constant.character.escape.apostrophe.fortran</string>
</dict>
</array>
</dict>
<dict>
<key>applyEndPatternLast</key>
<integer>1</integer>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.fortran</string>
</dict>
</dict>
<key>comment</key>
<string>String</string>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.fortran</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.fortran</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>""</string>
<key>name</key>
<string>constant.character.escape.quote.fortran</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^[Cc](?=\b|[Cc])</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.fortran</string>
</dict>
</dict>
<key>end</key>
<string>$\n?</string>
<key>name</key>
<string>comment.line.c.fortran</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\\s*\n</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^\*</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.fortran</string>
</dict>
</dict>
<key>end</key>
<string>$\n?</string>
<key>name</key>
<string>comment.line.asterisk.fortran</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\\s*\n</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^\s*#\s*(error|warning)\b</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.import.error.fortran</string>
</dict>
</dict>
<key>end</key>
<string>$\n?</string>
<key>name</key>
<string>meta.preprocessor.diagnostic.fortran</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(?&gt;\\\s*\n)</string>
<key>name</key>
<string>punctuation.separator.continuation.fortran</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^\s*#\s*(include|import)\b\s+</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.import.include.fortran</string>
</dict>
</dict>
<key>end</key>
<string>(?=(?://|/\*))|$\n?</string>
<key>name</key>
<string>meta.preprocessor.fortran.include</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(?&gt;\\\s*\n)</string>
<key>name</key>
<string>punctuation.separator.continuation.fortran</string>
</dict>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.fortran</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.fortran</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.include.fortran</string>
</dict>
<dict>
<key>begin</key>
<string>&lt;</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.fortran</string>
</dict>
</dict>
<key>end</key>
<string>&gt;</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.fortran</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.other.lt-gt.include.fortran</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>#pragma-mark</string>
</dict>
<dict>
<key>begin</key>
<string>^\s*#\s*(define|defined|elif|else|if|ifdef|ifndef|line|pragma|undef)\b</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.import.fortran</string>
</dict>
</dict>
<key>end</key>
<string>(?=(?://|/\*))|$\n?</string>
<key>name</key>
<string>meta.preprocessor.fortran</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(?&gt;\\\s*\n)</string>
<key>name</key>
<string>punctuation.separator.continuation.fortran</string>
</dict>
</array>
</dict>
</array>
<key>repository</key>
<dict>
<key>disabled</key>
<dict>
<key>begin</key>
<string>^\s*#\s*if(n?def)?\b.*$</string>
<key>comment</key>
<string>eat nested preprocessor if(def)s</string>
<key>end</key>
<string>^\s*#\s*endif\b.*$</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#disabled</string>
</dict>
<dict>
<key>include</key>
<string>#pragma-mark</string>
</dict>
</array>
</dict>
<key>pragma-mark</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.preprocessor.fortran</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.import.pragma.fortran</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>meta.toc-list.pragma-mark.fortran</string>
</dict>
</dict>
<key>match</key>
<string>^\s*(#\s*(pragma\s+mark)\s+(.*))</string>
<key>name</key>
<string>meta.section</string>
</dict>
<key>preprocessor-rule-disabled</key>
<dict>
<key>begin</key>
<string>^\s*(#(if)\s+(0)\b).*</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.preprocessor.fortran</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.import.if.fortran</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>constant.numeric.preprocessor.fortran</string>
</dict>
</dict>
<key>end</key>
<string>^\s*(#\s*(endif)\b)</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>^\s*(#\s*(else)\b)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.preprocessor.fortran</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.import.else.fortran</string>
</dict>
</dict>
<key>end</key>
<string>(?=^\s*#\s*endif\b.*$)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$base</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string></string>
<key>end</key>
<string>(?=^\s*#\s*(else|endif)\b.*$)</string>
<key>name</key>
<string>comment.block.preprocessor.if-branch</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#disabled</string>
</dict>
<dict>
<key>include</key>
<string>#pragma-mark</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>preprocessor-rule-enabled</key>
<dict>
<key>begin</key>
<string>^\s*(#(if)\s+(0*1)\b)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.preprocessor.fortran</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.import.if.fortran</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>constant.numeric.preprocessor.fortran</string>
</dict>
</dict>
<key>end</key>
<string>^\s*(#\s*(endif)\b)</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>^\s*(#\s*(else)\b).*</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.preprocessor.fortran</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.import.else.fortran</string>
</dict>
</dict>
<key>contentName</key>
<string>comment.block.preprocessor.else-branch</string>
<key>end</key>
<string>(?=^\s*#\s*endif\b.*$)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#disabled</string>
</dict>
<dict>
<key>include</key>
<string>#pragma-mark</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string></string>
<key>end</key>
<string>(?=^\s*#\s*(else|endif)\b.*$)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$base</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>preprocessor-rule-other</key>
<dict>
<key>begin</key>
<string>^\s*(#\s*(if(n?def)?)\b.*?(?:(?=(?://|/\*))|$))</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.preprocessor.fortran</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.import.fortran</string>
</dict>
</dict>
<key>end</key>
<string>^\s*(#\s*(endif)\b).*$</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$base</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>source.fortran</string>
<key>uuid</key>
<string>45253F88-F7CC-49C5-9C32-F3FADD2AB579</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.