summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Corbett <corbett.dav@husky.neu.edu>2014-05-17 13:13:55 -0400
committerDavid Corbett <corbett.dav@husky.neu.edu>2014-05-17 13:13:55 -0400
commit0a0a38ada22cfe4b163753a8fe0c2e14dd263a91 (patch)
tree50c9c22420132fa82a181ba46e31ab253a8c6930
parenta62cdcfaa5a260274303cb93b92a3f2e2ce3be98 (diff)
downloadpygments-0a0a38ada22cfe4b163753a8fe0c2e14dd263a91.tar.gz
Fix VbNetLexer.analyse_text
A file would only be detected as VB.NET if `#If` matched on the first line. The other regex search always raised an error.
-rw-r--r--pygments/lexers/dotnet.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py
index 5a07cd0d..b80b6c58 100644
--- a/pygments/lexers/dotnet.py
+++ b/pygments/lexers/dotnet.py
@@ -460,12 +460,11 @@ class VbNetLexer(RegexLexer):
}
def analyse_text(text):
- if (re.search(r'^[ \t]*#If', text, re.I)
- or re.search(r'^[ \t]*(Module|Namespace)', re.I)):
+ if re.search(r'^\s*(#If|Module|Namespace)', text,
+ re.IGNORECASE | re.MULTILINE):
return 0.5
-
class GenericAspxLexer(RegexLexer):
"""
Lexer for ASP.NET pages.