diff options
author | Georg Brandl <georg@python.org> | 2014-11-09 12:48:11 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-11-09 12:48:11 +0100 |
commit | 4978e0fa9c0dc91ffeb4afd9ee0e97b1ff83d859 (patch) | |
tree | 28999a91b8aacb35b959b8b5405f4dba7b52e71a | |
parent | 85a486b6addfc4b7b0564d933ce26c91c14e06d1 (diff) | |
download | pygments-4978e0fa9c0dc91ffeb4afd9ee0e97b1ff83d859.tar.gz |
Closes #1057: adjust lexer analysis functions; remove too broad analysis for SystemVerilog and strengthen C.
-rw-r--r-- | pygments/lexers/c_cpp.py | 4 | ||||
-rw-r--r-- | pygments/lexers/dotnet.py | 3 | ||||
-rw-r--r-- | pygments/lexers/hdl.py | 4 |
3 files changed, 4 insertions, 7 deletions
diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py index 2e12ec4b..128cc6ce 100644 --- a/pygments/lexers/c_cpp.py +++ b/pygments/lexers/c_cpp.py @@ -177,7 +177,9 @@ class CLexer(CFamilyLexer): priority = 0.1 def analyse_text(text): - if re.search('#include [<"]', text): + if re.search('^\s*#include [<"]', text, re.MULTILINE): + return 0.1 + if re.search('^\s*#ifdef ', text, re.MULTILINE): return 0.1 diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py index 7c72d8f3..39c03d47 100644 --- a/pygments/lexers/dotnet.py +++ b/pygments/lexers/dotnet.py @@ -467,8 +467,7 @@ class VbNetLexer(RegexLexer): } def analyse_text(text): - if re.search(r'^\s*(#If|Module|Namespace)', text, - re.IGNORECASE | re.MULTILINE): + if re.search(r'^\s*(#If|Module|Namespace)', text, re.MULTILINE): return 0.5 diff --git a/pygments/lexers/hdl.py b/pygments/lexers/hdl.py index 8b395965..c8e34718 100644 --- a/pygments/lexers/hdl.py +++ b/pygments/lexers/hdl.py @@ -285,10 +285,6 @@ class SystemVerilogLexer(RegexLexer): token = Name.Constant yield index, token, value - def analyse_text(text): - if text.startswith('//') or text.startswith('/*'): - return 0.5 - class VhdlLexer(RegexLexer): """ |