New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 11779 for utils/developer – NEMO

Changeset 11779 for utils/developer


Ignore:
Timestamp:
2019-10-23T18:03:10+02:00 (4 years ago)
Author:
nicolasmartin
Message:

Create 'namelist' state to handle highlighting of this particular statement
Probably not optimized but it works.

The line have to start with the expecting syntax for declaring a namelist &[a-z][\w$]*
The token type that seems appropriate is the namespace (Name.Namespace).
The declaration of variables, arrays and data structures are taken into account in the same regexp
with bygroups
The slash terminator to end the namelist will also be colorized to make some kind of an envelope
surrounding the variables and arrays.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • utils/developer/fortran.py

    r11767 r11779  
    4141        'root': [ 
    4242            (r'^#.*\n', Comment.Preproc), 
     43            (r'^&[a-z]\w*', Name.Namespace, 'namelist'), 
    4344            (r'!.*\n', Comment), 
    4445            include('strings'), 
     
    8788            (r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)', Operator), 
    8889 
     90            #  
    8991            (r'(::)', Keyword.Declaration), 
    9092 
     
    145147            # Booleans 
    146148            (r'\.(true|false)\.', Name.Builtin), 
     149 
    147150            # Comparing Operators 
    148151            (r'\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\.', Operator.Word), 
     
    150153            # Punctuation 
    151154            (r'[()\[\],:&%;.]', Punctuation), 
     155        ], 
     156        'namelist': [ 
     157            (r'!.*\n', Comment), 
     158            (r'([a-z]\w*)(\()?(\s*)?(\d*)?(\s*)?(\))?(%[a-z]\w*)?(\s*)(=)', bygroups( 
     159               Name.Variable, Punctuation, Text, Number.Integer, Text, Punctuation,  
     160               Name.Variable, Text, Operator)), 
     161            (r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)', Operator), 
     162            (r'\.(true|false)\.', Name.Builtin), 
     163            include('strings'), 
     164            include('nums'), 
     165            (r'[()\[\],:&%;.]', Punctuation), 
     166            (r'[\s]+', Text), 
     167            (r'^\/$', Name.Namespace), 
    152168        ], 
    153169        'strings': [ 
     
    155171            (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), 
    156172        ], 
    157  
    158173        'nums': [ 
    159174            (r'\d+(?![.e])(_[a-z]\w+)?', Number.Integer), 
Note: See TracChangeset for help on using the changeset viewer.