eric6/ThirdParty/Pygments/pygments/lexers/unicon.py

changeset 7983
54c5cfbb1e29
parent 7701
25f42e208e08
equal deleted inserted replaced
7982:48d210e41c65 7983:54c5cfbb1e29
3 pygments.lexers.unicon 3 pygments.lexers.unicon
4 ~~~~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~~~~
5 5
6 Lexers for the Icon and Unicon languages, including ucode VM. 6 Lexers for the Icon and Unicon languages, including ucode VM.
7 7
8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
9 :license: BSD, see LICENSE for details. 9 :license: BSD, see LICENSE for details.
10 """ 10 """
11 11
12 import re 12 import re
13 13
383 (r"(<>|=>|[()|:;,.'`]|[{}]|[%^]|[&?])", Punctuation), 383 (r"(<>|=>|[()|:;,.'`]|[{}]|[%^]|[&?])", Punctuation),
384 (r'\s+\b', Text), 384 (r'\s+\b', Text),
385 (r'[\w-]+', Text), 385 (r'[\w-]+', Text),
386 ], 386 ],
387 } 387 }
388
389 def analyse_text(text):
390 """endsuspend and endrepeat are unique to this language, and
391 \\self, /self doesn't seem to get used anywhere else either."""
392 result = 0
393
394 if 'endsuspend' in text:
395 result += 0.1
396
397 if 'endrepeat' in text:
398 result += 0.1
399
400 if ':=' in text:
401 result += 0.01
402
403 if 'procedure' in text and 'end' in text:
404 result += 0.01
405
406 # This seems quite unique to unicon -- doesn't appear in any other
407 # example source we have (A quick search reveals that \SELF appears in
408 # Perl/Raku code)
409 if r'\self' in text and r'/self' in text:
410 result += 0.5
411
412 return result

eric ide

mercurial