summaryrefslogtreecommitdiff
path: root/pygments/lexers/modula2.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/lexers/modula2.py')
-rw-r--r--pygments/lexers/modula2.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/pygments/lexers/modula2.py b/pygments/lexers/modula2.py
index c4b95b38..05144222 100644
--- a/pygments/lexers/modula2.py
+++ b/pygments/lexers/modula2.py
@@ -1563,9 +1563,20 @@ class Modula2Lexer(RegexLexer):
def analyse_text(text):
"""Not much we can go by. (* for comments is our best guess."""
result = 0
+
+ is_pascal_like = 0
if '(*' in text and '*)' in text:
- result += 0.01
+ is_pascal_like += 0.5
if ':=' in text:
- result += 0.01
+ is_pascal_like += 0.5
+
+ if is_pascal_like == 1:
+ # Procedure is in Modula2
+ if re.search(r'\bPROCEDURE\b', text):
+ result += 0.6
+
+ # FUNCTION is only valid in Pascal, but not in Modula2
+ if re.search(r'\bFUNCTION\b', text):
+ result = 0.0
return result