summaryrefslogtreecommitdiff
path: root/pygments/lexers/javascript.py
diff options
context:
space:
mode:
authorChristian Hammond <christian@beanbaginc.com>2017-01-22 12:30:00 -0800
committerChristian Hammond <christian@beanbaginc.com>2017-01-22 12:30:00 -0800
commit7b0550d47360d0b7b814cbb2a82c83584ca83c3c (patch)
tree42fdba82264bf29579616c351913b0eb4a111691 /pygments/lexers/javascript.py
parent4a6c8b3897134e768c66f96f8351fef28198d235 (diff)
downloadpygments-git-7b0550d47360d0b7b814cbb2a82c83584ca83c3c.tar.gz
Remove the fallback values from the new analyse_text changes.
These values would trigger problems when guessing content without a filename, and really aren't needed. They've been removed, allowing the standard behavior to take place. On top of this, the regex for TypeScript has been slightly altered to include a whitespace match after "export" to be within the group for the "export" text.
Diffstat (limited to 'pygments/lexers/javascript.py')
-rw-r--r--pygments/lexers/javascript.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py
index 76b226c2..093e75e3 100644
--- a/pygments/lexers/javascript.py
+++ b/pygments/lexers/javascript.py
@@ -518,13 +518,9 @@ class TypeScriptLexer(RegexLexer):
def analyse_text(text):
if re.search('^(import.+(from\s+)?["\']|'
- '(export)?\s*(interface|class|function)\s+)',
+ '(export\s*)?(interface|class|function)\s+)',
text, re.MULTILINE):
return 1.0
- else:
- # Slightly lower than TypoScript, since we have more we can look
- # for in TypeScript content.
- return 0.8
class LassoLexer(RegexLexer):