[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode b3af0b0 252/496: Constraint all look backs to t
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode b3af0b0 252/496: Constraint all look backs to the reasonable amount of lines |
Date: |
Sun, 29 Aug 2021 11:33:45 -0400 (EDT) |
branch: elpa/swift-mode
commit b3af0b0106ababd5e4190eb0cc4af7e34c95c459
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>
Constraint all look backs to the reasonable amount of lines
`looking-back` is notoriously slow and can reduce performance of the
lexer. In most cases this operations can be naturally constrained to a
several chars. But several lexer rules require deeper search, in this
case we can constraint such operations by a `line-beginning-position`.
---
swift-mode.el | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/swift-mode.el b/swift-mode.el
index b45391c..561a00b 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -257,14 +257,14 @@
";")
((looking-at "{") (forward-char 1)
- (if (looking-back "\\(class\\|protocol\\) [^{]+{")
+ (if (looking-back "\\(class\\|protocol\\) [^{]+{"
(line-beginning-position) t)
(concat (match-string 1) "-{")
"{"))
((looking-at "}") (forward-char 1) "}")
((looking-at ",") (forward-char 1) ",")
((looking-at ":") (forward-char 1)
- (if (looking-back "case [^:]+:")
+ (if (looking-back "case [^:]+:" (line-beginning-position 0) t)
"case-:"
":"))
@@ -297,7 +297,7 @@
"case"
"ecase"))
((equal tok "else")
- (if (looking-back "\\(guard.*\\)")
+ (if (looking-back "\\(guard.*\\)" (line-beginning-position) t)
"elseguard"
"else"))
(t tok))))
@@ -312,14 +312,14 @@
";")
((eq (char-before) ?\{) (backward-char 1)
- (if (looking-back "\\(class\\|protocol\\) [^{]+")
+ (if (looking-back "\\(class\\|protocol\\) [^{]+"
(line-beginning-position) t)
(concat (match-string 1) "-{")
"{"))
((eq (char-before) ?\}) (backward-char 1) "}")
((eq (char-before) ?,) (backward-char 1) ",")
((eq (char-before) ?:) (backward-char 1)
- (if (looking-back "case [^:]+")
+ (if (looking-back "case [^:]+" (line-beginning-position 0))
"case-:"
":"))
@@ -354,7 +354,7 @@
"case"
"ecase"))
((equal tok "else")
- (if (looking-back "\\(guard.*\\)")
+ (if (looking-back "\\(guard.*\\)" (line-beginning-position) t)
"elseguard"
"else"))
(t tok))))
- [nongnu] elpa/swift-mode 5fabebd 196/496: Improve indentation rules for function arguments, (continued)
- [nongnu] elpa/swift-mode 5fabebd 196/496: Improve indentation rules for function arguments, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 38933b9 208/496: Don't use implicit semicolon when operator is placed on the second line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode d0c65bc 212/496: Fix bug with the closing parentheses in method calls and function, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 107195e 219/496: Improve lexer rule for generics with optional or implicit unwrapping, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode cdf7ad4 220/496: Fix indentation issues with deep nested if cluase, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 9941c27 224/496: Bring failing tests for #81 contributed in #82 by @dougbeal, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 4ae6cc2 228/496: Fix indent when after comment, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 68a3a29 231/496: Support for choosing framework search paths., ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 8e0f8d6 240/496: Merge pull request #94 from wiruzx/new-range-operator, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 17bf117 242/496: Merge pull request #95 from wiruzx/add-as!-operator, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b3af0b0 252/496: Constraint all look backs to the reasonable amount of lines,
ELPA Syncer <=
- [nongnu] elpa/swift-mode 52a01b1 269/496: Add test case for backward-sexp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 5c09b07 289/496: Merge pull request #114 from uk-ar/fix-indent-for-ternary-operator, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 4e9da69 299/496: Release 0.4.0, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c303245 291/496: Merge pull request #115 from uk-ar/add-melpa-badge, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 9211980 312/496: Bump version to 2.1.2, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 3d27871 313/496: Tweak README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 86eb49c 323/496: Fix indentation of for-in, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 78cea9d 337/496: Improve CI, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 63580e8 339/496: Speed-up indentation for colon, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e91e924 347/496: Bump version to 2.2.4, ELPA Syncer, 2021/08/29