Changeset 11801 for utils/developer/fortran.py
- Timestamp:
- 2019-10-25T17:13:45+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
utils/developer/fortran.py
r11788 r11801 40 40 tokens = { 41 41 42 # 42 43 'root': [ 43 include('cmt' ), 44 include('nlst'), 44 include('cmt'), 45 46 # Namelist 47 (r'^&[a-z]\w*', Name.Namespace), 48 (r'^\/$' , Name.Namespace), 49 45 50 include('str' ), 51 52 # Modules and routines 53 (r'(MODULE)(\s+)?([a-z]\w*)' , bygroups( 54 Keyword, Text, Name.Function 55 )), 56 (r'(USE)(\s+)?([a-z]\w*)(\s*)?(,)?(\s*)?(ONLY)?(\s*)?(:)?(\s*)?([a-z]\w*)?(\s*)?(!.*)?$', bygroups( 57 Keyword, Text, Name.Function, 58 Text, Punctuation, Text, 59 Keyword, Text, Punctuation, Text, Name.Function, 60 Text, Comment 61 )), 62 (r'(CALL)(\s+)?([a-z]\w*)' , bygroups( 63 Keyword, Text, Name.Function 64 )), 65 (r'(SUBROUTINE)(\s+)?([a-z]\w*)', bygroups( 66 Keyword, Text, Name.Function 67 )), 68 69 # Format 70 (r'^\d+', Name.Label), 71 (r'(WRITE)(\()([a-z]\w*)(,)(\d+)?', bygroups( 72 Keyword, Punctuation, Name, Punctuation, Name.Label 73 )), 74 75 include('core'), include('opr' ), include('bool'), include('punc'), 76 include('var'), 46 77 include('num' ), 47 include('bool'), 48 include('opr' ), 49 include('punc'), 50 include('core'), 78 79 # End 51 80 (r'[a-z][\w$]*', Name), 52 81 (r'[\s]+', Text), 53 82 ], 54 83 55 'cmt': [ 56 (r'^#.*\n', Comment.Preproc), 57 (r'!.*\n' , Comment ), 84 # Commment 85 'cmt' : [ 86 (r'^(#)(\s*)(define|if|ifdef|undef)(\s+)?(!)?(\s+)?(defined)?', bygroups( 87 Comment.Preproc, Text, Comment.Preproc, Text, Operator.Word, Text, Comment.Preproc 88 )), 89 (r'^(#)(\s*)(else|endif)', Comment.Preproc), 90 (r'!.*\n' , Comment) 91 ], 92 93 # Variable 94 'var': [ 95 (r'([a-z]\w*)(\()?(\s+)?(\d+)?(\))?(%[a-z]\w*)?(\s*)(=)', bygroups( 96 Name.Variable, Punctuation, Text, Number.Integer, Punctuation, Name.Variable, 97 Text, Operator 98 )), 99 ], 100 101 # String 102 'str' : [ 103 (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double), 104 (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), 105 ], 106 107 # Number 108 'num' : [ 109 (r'\d+(?![.e])(_[a-z]\w+)?' , Number.Integer), 110 (r'[+-]?\d*\.\d+([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float ), 111 (r'[+-]?\d+\.\d*([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float ), 112 (r'[+-]?\d+(\.\d*)?[ed][-+]?\d+(_[a-z]\w+)?', Number.Float ), 113 ], 114 115 # Booleans 116 'bool': [ (r'\.(true|false)\.', Keyword.Constant) ], 117 118 # Punctuation 119 'punc': [ (r'[()\[\],:&%;.]', Punctuation)], 120 121 # Operators 122 'opr' : [ 123 (r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)' , Operator ), 124 (r'\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\.', Operator.Word) 58 125 ], 59 126 … … 66 133 'CODIMENSION', 'COMMON', 'CONCURRRENT', 'CONTIGUOUS', 'CONTAINS', 67 134 'CONTINUE', 'CRITICAL', 'CYCLE', 'DATA', 'DEALLOCATE', 'DECODE', 68 'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ENCODE', 'END', 'ENDIF',135 'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ENCODE', 'END', 69 136 'ENTRY', 'ENUM', 'ENUMERATOR', 'EQUIVALENCE', 'EXIT', 'EXTENDS', 70 137 'EXTERNAL', 'EXTRINSIC', 'FILE', 'FINAL', 'FORALL', 'FORMAT', … … 72 139 'IMPORT', 'IMPURE', 'INCLUDE', 'INQUIRE', 'INTENT', 'INTERFACE', 73 140 'INTRINSIC', 'IS', 'LOCK', 'MEMORY', 'MODULE', 'NAMELIST', 'NULLIFY', 74 'NONE', 'NON_INTRINSIC', 'NON_OVERRIDABLE', 'NOPASS', 'O PEN', 'OPTIONAL',141 'NONE', 'NON_INTRINSIC', 'NON_OVERRIDABLE', 'NOPASS', 'ONLY', 'OPEN', 'OPTIONAL', 75 142 'OPTIONS', 'PARAMETER', 'PASS', 'PAUSE', 'POINTER', 'PRINT', 'PRIVATE', 76 143 'PROGRAM', 'PROCEDURE', 'PROTECTED', 'PUBLIC', 'PURE', 'READ', … … 150 217 ), prefix=r'\b', suffix=r'\s*\b'), Name.Builtin), 151 218 ], 152 153 'bool': [154 # Booleans155 (r'\.(true|false)\.', Keyword.Constant),156 ],157 158 'opr': [159 # Operators160 (r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)', Operator),161 162 # Comparing Operators163 (r'\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\.', Operator.Word),164 ],165 166 'punc': [167 # Punctuation168 (r'[()\[\],:%;.]', Punctuation),169 (r'&(?=\s)' , Punctuation),170 ],171 172 'nlst': [173 (r'^&[a-z]\w*', Name.Namespace),174 (r'([a-z]\w*)(\()?(\s*)?(\d*)?(\s*)?(\))?(%[a-z]\w*)?(\s*)(=)', bygroups(175 Name.Variable,176 Punctuation , Text , Number.Integer, Text, Punctuation,177 Name.Variable,178 Text , Operator179 )),180 (r'^\/$', Name.Namespace),181 ],182 183 'str': [184 (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),185 (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),186 ],187 188 'num': [189 (r'\d+(?![.e])(_[a-z]\w+)?' , Number.Integer),190 (r'[+-]?\d*\.\d+([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float ),191 (r'[+-]?\d+\.\d*([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float ),192 (r'[+-]?\d+(\.\d*)?[ed][-+]?\d+(_[a-z]\w+)?', Number.Float ),193 ],194 219 } 195 220
Note: See TracChangeset
for help on using the changeset viewer.