30 |
30 |
31 flags = re.IGNORECASE | re.MULTILINE |
31 flags = re.IGNORECASE | re.MULTILINE |
32 |
32 |
33 _RESERVED = ( |
33 _RESERVED = ( |
34 'and', 'begin', 'break', 'case', 'common', 'compile_opt', |
34 'and', 'begin', 'break', 'case', 'common', 'compile_opt', |
35 'continue', 'do', 'else', 'end', 'endcase', 'elseelse', |
35 'continue', 'do', 'else', 'end', 'endcase', 'endelse', |
36 'endfor', 'endforeach', 'endif', 'endrep', 'endswitch', |
36 'endfor', 'endforeach', 'endif', 'endrep', 'endswitch', |
37 'endwhile', 'eq', 'for', 'foreach', 'forward_function', |
37 'endwhile', 'eq', 'for', 'foreach', 'forward_function', |
38 'function', 'ge', 'goto', 'gt', 'if', 'inherits', 'le', |
38 'function', 'ge', 'goto', 'gt', 'if', 'inherits', 'le', |
39 'lt', 'mod', 'ne', 'not', 'of', 'on_ioerror', 'or', 'pro', |
39 'lt', 'mod', 'ne', 'not', 'of', 'on_ioerror', 'or', 'pro', |
40 'repeat', 'switch', 'then', 'until', 'while', 'xor') |
40 'repeat', 'switch', 'then', 'until', 'while', 'xor') |
266 (r'\b[+\-]?[0-9]+U?S?\b', Number.Integer), |
266 (r'\b[+\-]?[0-9]+U?S?\b', Number.Integer), |
267 (r'\b[+\-]?[0-9]+B\b', Number), |
267 (r'\b[+\-]?[0-9]+B\b', Number), |
268 (r'.', Text), |
268 (r'.', Text), |
269 ] |
269 ] |
270 } |
270 } |
|
271 |
|
272 def analyse_text(text): |
|
273 """endelse seems to be unique to IDL, endswitch is rare at least.""" |
|
274 result = 0 |
|
275 |
|
276 if 'endelse' in text: |
|
277 result += 0.2 |
|
278 if 'endswitch' in text: |
|
279 result += 0.01 |
|
280 |
|
281 return result |