diff options
author | Matthäus G. Chajdas <dev@anteru.net> | 2020-09-22 20:40:58 +0200 |
---|---|---|
committer | Matthäus G. Chajdas <dev@anteru.net> | 2020-09-22 20:40:58 +0200 |
commit | f0d31da6b26e7057dc488d8ee04e06b1a448a49c (patch) | |
tree | bb01aa5da7a5f4aa4e3e2a4836b040c535ea977d /pygments/lexers/unicon.py | |
parent | 07f596dbb9357c1ec2077bdc4319f594d287ae15 (diff) | |
download | pygments-git-task/add-analyze-text.tar.gz |
Improve various analyse_text methods.task/add-analyze-text
* Make Perl less confident in presence of :=.
* Improve brainfuck check to not parse the whole input.
* Improve Unicon by matching \self, /self
* Fix Ezhil not matching against the input text
Diffstat (limited to 'pygments/lexers/unicon.py')
-rw-r--r-- | pygments/lexers/unicon.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pygments/lexers/unicon.py b/pygments/lexers/unicon.py index 45b4c15a..95815907 100644 --- a/pygments/lexers/unicon.py +++ b/pygments/lexers/unicon.py @@ -387,7 +387,8 @@ class UcodeLexer(RegexLexer): } def analyse_text(text): - """endsuspend and endrepeat are unique to this language.""" + """endsuspend and endrepeat are unique to this language, and + \\self, /self doesn't seem to get used anywhere else either.""" result = 0 if 'endsuspend' in text: @@ -402,4 +403,10 @@ class UcodeLexer(RegexLexer): if 'procedure' in text and 'end' in text: result += 0.01 + # This seems quite unique to unicon -- doesn't appear in any other + # example source we have (A quick search reveals that \SELF appears in + # Perl/Raku code) + if r'\self' in text and r'/self' in text: + result += 0.5 + return result |