summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorhhsprings <xwhhsprings@gmail.com>2015-11-07 22:54:45 +0900
committerhhsprings <xwhhsprings@gmail.com>2015-11-07 22:54:45 +0900
commitd95d22cae75d2d60ce9c4553b92013b86ae7ceb8 (patch)
tree82ed362a3b22dbf0aa0dfeac5b510b1c14c514f5 /pygments
parent92b38ef6e43ea87f525bd753f0f9c4e823f3f7e7 (diff)
downloadpygments-d95d22cae75d2d60ce9c4553b92013b86ae7ceb8.tar.gz
See `#1164 <https://bitbucket.org/birkenfeld/pygments-main/issues/1164/linter-to-check-for-single-character#comment-23138389>`_.
Before: 810 bytes, 4.6200 [ms] / 0.005704 [ms/byte] 156 bytes, 1.1100 [ms] / 0.007115 [ms/byte] 580 bytes, 2.1100 [ms] / 0.003638 [ms/byte] 810 bytes, 4.5600 [ms] / 0.005630 [ms/byte] 156 bytes, 0.7300 [ms] / 0.004679 [ms/byte] 580 bytes, 1.5600 [ms] / 0.002690 [ms/byte] 810 bytes, 3.5000 [ms] / 0.004321 [ms/byte] 156 bytes, 0.6800 [ms] / 0.004359 [ms/byte] 580 bytes, 1.1900 [ms] / 0.002052 [ms/byte] After: 810 bytes, 1.9700 [ms] / 0.002432 [ms/byte] 156 bytes, 0.4300 [ms] / 0.002756 [ms/byte] 580 bytes, 0.7300 [ms] / 0.001259 [ms/byte] 810 bytes, 1.9400 [ms] / 0.002395 [ms/byte] 156 bytes, 0.4500 [ms] / 0.002885 [ms/byte] 580 bytes, 0.6700 [ms] / 0.001155 [ms/byte] 810 bytes, 1.9300 [ms] / 0.002383 [ms/byte] 156 bytes, 0.4600 [ms] / 0.002949 [ms/byte] 580 bytes, 0.6700 [ms] / 0.001155 [ms/byte]
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/grammar_notation.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/pygments/lexers/grammar_notation.py b/pygments/lexers/grammar_notation.py
index 60466def..1c5f1163 100644
--- a/pygments/lexers/grammar_notation.py
+++ b/pygments/lexers/grammar_notation.py
@@ -59,6 +59,7 @@ class BnfLexer(RegexLexer):
(r'::=', Operator),
# fallback
+ (r'[^<>:=]+', Text), # for performance
(r'.', Text),
],
}
@@ -99,7 +100,8 @@ class AbnfLexer(RegexLexer):
(r';.*$', Comment.Single),
# quoted
- (r'(%[si])?"', Literal, 'quoted-termination'),
+ # double quote itself in this state, it is as '%x22'.
+ (r'(%[si])?"[^"]*"', Literal),
# binary (but i have never seen...)
(r'%b[01]+\-[01]+\b', Literal), # range
@@ -129,11 +131,7 @@ class AbnfLexer(RegexLexer):
(r'[\[\]()]', Punctuation),
# fallback
+ (r'\s+', Text),
(r'.', Text),
],
- 'quoted-termination': [
- # double quote itself in this state, it is as '%x22'.
- (r'"', Literal, '#pop'),
- (r'.', Literal),
- ]
}