Index: utils/developer/fortran.py
===================================================================
--- utils/developer/fortran.py	(revision 11800)
+++ utils/developer/fortran.py	(revision 11801)
@@ -40,20 +40,87 @@
     tokens = {
 
+        #
         'root': [
-            include('cmt' ),
-            include('nlst'),
+            include('cmt'),
+
+            # Namelist
+            (r'^&[a-z]\w*', Name.Namespace),
+            (r'^\/$'      , Name.Namespace),
+
             include('str' ),
+
+            # Modules and routines
+            (r'(MODULE)(\s+)?([a-z]\w*)'    , bygroups(
+                Keyword, Text, Name.Function
+            )),
+            (r'(USE)(\s+)?([a-z]\w*)(\s*)?(,)?(\s*)?(ONLY)?(\s*)?(:)?(\s*)?([a-z]\w*)?(\s*)?(!.*)?$', bygroups(
+                Keyword, Text, Name.Function,
+                Text, Punctuation, Text,
+                Keyword, Text, Punctuation, Text, Name.Function,
+                Text, Comment
+            )),
+            (r'(CALL)(\s+)?([a-z]\w*)'      , bygroups(
+                Keyword, Text, Name.Function
+            )),
+            (r'(SUBROUTINE)(\s+)?([a-z]\w*)', bygroups(
+                Keyword, Text, Name.Function
+            )),
+
+            # Format
+            (r'^\d+', Name.Label),
+            (r'(WRITE)(\()([a-z]\w*)(,)(\d+)?', bygroups(
+                Keyword, Punctuation, Name, Punctuation, Name.Label
+            )),
+
+            include('core'), include('opr' ), include('bool'), include('punc'),
+            include('var'),
             include('num' ),
-            include('bool'),
-            include('opr' ),
-            include('punc'),
-            include('core'),
+
+            # End
             (r'[a-z][\w$]*', Name),
             (r'[\s]+', Text),
         ],
 
-        'cmt': [
-            (r'^#.*\n', Comment.Preproc),
-            (r'!.*\n' , Comment        ),
+        # Commment
+        'cmt' : [
+            (r'^(#)(\s*)(define|if|ifdef|undef)(\s+)?(!)?(\s+)?(defined)?', bygroups(
+                Comment.Preproc, Text, Comment.Preproc, Text, Operator.Word, Text, Comment.Preproc
+            )),
+            (r'^(#)(\s*)(else|endif)', Comment.Preproc),
+            (r'!.*\n' , Comment)
+         ],
+
+        # Variable
+        'var': [
+            (r'([a-z]\w*)(\()?(\s+)?(\d+)?(\))?(%[a-z]\w*)?(\s*)(=)', bygroups(
+                Name.Variable, Punctuation, Text, Number.Integer, Punctuation, Name.Variable,
+                Text, Operator
+            )),
+        ],
+
+        # String
+        'str' : [
+            (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
+            (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
+        ],
+
+        # Number
+        'num' : [
+            (r'\d+(?![.e])(_[a-z]\w+)?'                 , Number.Integer),
+            (r'[+-]?\d*\.\d+([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float  ),
+            (r'[+-]?\d+\.\d*([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float  ),
+            (r'[+-]?\d+(\.\d*)?[ed][-+]?\d+(_[a-z]\w+)?', Number.Float  ),
+        ],
+
+        # Booleans
+        'bool': [ (r'\.(true|false)\.', Keyword.Constant) ],
+
+        # Punctuation
+        'punc': [ (r'[()\[\],:&%;.]', Punctuation)],
+
+        # Operators
+        'opr' : [
+            (r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)'       , Operator     ),
+            (r'\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\.', Operator.Word)
         ],
 
@@ -66,5 +133,5 @@
                 'CODIMENSION', 'COMMON', 'CONCURRRENT', 'CONTIGUOUS', 'CONTAINS',
                 'CONTINUE', 'CRITICAL', 'CYCLE', 'DATA', 'DEALLOCATE', 'DECODE',
-                'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ENCODE', 'END', 'ENDIF',
+                'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ENCODE', 'END',
                 'ENTRY', 'ENUM', 'ENUMERATOR', 'EQUIVALENCE', 'EXIT', 'EXTENDS',
                 'EXTERNAL', 'EXTRINSIC', 'FILE', 'FINAL', 'FORALL', 'FORMAT',
@@ -72,5 +139,5 @@
                 'IMPORT', 'IMPURE', 'INCLUDE', 'INQUIRE', 'INTENT', 'INTERFACE',
                 'INTRINSIC', 'IS', 'LOCK', 'MEMORY', 'MODULE', 'NAMELIST', 'NULLIFY',
-                'NONE', 'NON_INTRINSIC', 'NON_OVERRIDABLE', 'NOPASS', 'OPEN', 'OPTIONAL',
+                'NONE', 'NON_INTRINSIC', 'NON_OVERRIDABLE', 'NOPASS', 'ONLY', 'OPEN', 'OPTIONAL',
                 'OPTIONS', 'PARAMETER', 'PASS', 'PAUSE', 'POINTER', 'PRINT', 'PRIVATE',
                 'PROGRAM', 'PROCEDURE', 'PROTECTED', 'PUBLIC', 'PURE', 'READ',
@@ -150,46 +217,4 @@
             ), prefix=r'\b', suffix=r'\s*\b'), Name.Builtin),
         ],
-
-        'bool': [
-            # Booleans
-            (r'\.(true|false)\.', Keyword.Constant),
-        ],
-
-        'opr': [
-            # Operators
-            (r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)', Operator),
-
-            # Comparing Operators
-            (r'\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\.', Operator.Word),
-        ],
-
-        'punc': [
-            # Punctuation
-            (r'[()\[\],:%;.]', Punctuation),
-            (r'&(?=\s)'      , Punctuation),
-        ],
-
-        'nlst': [
-            (r'^&[a-z]\w*', Name.Namespace),
-            (r'([a-z]\w*)(\()?(\s*)?(\d*)?(\s*)?(\))?(%[a-z]\w*)?(\s*)(=)', bygroups(
-                Name.Variable,
-                Punctuation  , Text         , Number.Integer, Text, Punctuation,
-                Name.Variable,
-                Text         , Operator
-            )),
-            (r'^\/$', Name.Namespace),
-        ],
-
-        'str': [
-            (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
-            (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
-        ],
-
-        'num': [
-            (r'\d+(?![.e])(_[a-z]\w+)?'                 , Number.Integer),
-            (r'[+-]?\d*\.\d+([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float  ),
-            (r'[+-]?\d+\.\d*([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float  ),
-            (r'[+-]?\d+(\.\d*)?[ed][-+]?\d+(_[a-z]\w+)?', Number.Float  ),
-        ],
     }
 
