[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode ad53b6c 330/405: Fixed warning when expected
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode ad53b6c 330/405: Fixed warning when expected integer was nil |
Date: |
Sat, 13 Jul 2019 10:00:42 -0400 (EDT) |
branch: externals/phps-mode
commit ad53b6cd3ec10590853214b3d98d3ea8b5d29d2f
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Fixed warning when expected integer was nil
---
phps-mode-lexer.el | 117 +++++++++++++++++++++++++++--------------------------
1 file changed, 59 insertions(+), 58 deletions(-)
diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index 6da9ffa..a47daca 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -1684,66 +1684,67 @@
(defun phps-mode-lexer-run-incremental ()
"Run incremental lexer based on
`(phps-mode-functions-get-buffer-changes-start)'."
;; (message "Running incremental lexer")
- (when (and (> (phps-mode-functions-get-buffer-changes-start) 1)
- phps-mode-lexer-states)
- (let ((state nil)
- (state-stack nil)
- (new-states '())
- (states (nreverse phps-mode-lexer-states))
- (change-start (phps-mode-functions-get-buffer-changes-start))
- (previous-token-start nil)
- (previous-token-end nil)
- (tokens phps-mode-lexer-tokens))
-
- ;; Find state and state stack before point of change
- ;; also determine were previous token to change starts
- (catch 'stop-iteration
- (dolist (state-object states)
- (let ((start (nth 0 state-object))
- (end (nth 1 state-object)))
- (when (< end change-start)
- (setq state (nth 2 state-object))
- (setq state-stack (nth 3 state-object))
- (setq previous-token-start start)
- (setq previous-token-end end)
- (push state-object new-states))
- (when (> start change-start)
- (throw 'stop-iteration nil)))))
-
- (if (and state
- state-stack)
- (let ((old-tokens '()))
-
- ;; Build new list of tokens before point of change
- (catch 'stop-iteration
- (dolist (token tokens)
- (let ((_start (car (cdr token)))
- (end (cdr (cdr token))))
- (if (< end previous-token-end)
- (progn
- ;; NOTE Does following line make any difference?
- ;; (semantic-lex-push-token (semantic-lex-token token
_start end))
- (push token old-tokens))
- (throw 'stop-iteration nil)))))
- (setq old-tokens (nreverse old-tokens))
-
- ;; Delete all overlays from point of change to end of buffer
- (dolist (overlay (overlays-in previous-token-end (point-max)))
- (delete-overlay overlay))
-
- (let* ((new-tokens (semantic-lex previous-token-start (point-max)))
- (appended-tokens (append old-tokens new-tokens)))
- ;; (message "old-tokens: %s, new-tokens: %s" old-tokens
new-tokens)
- (setq phps-mode-lexer-tokens appended-tokens)
- (setq phps-mode-lexer-STATE state)
- (setq phps-mode-lexer-state_stack state-stack)
- (setq phps-mode-lexer-states new-states)
+ (let ((change-start (phps-mode-functions-get-buffer-changes-start)))
+ (when (and change-start
+ (> change-start 1)
+ phps-mode-lexer-states)
+ (let ((state nil)
+ (state-stack nil)
+ (new-states '())
+ (states (nreverse phps-mode-lexer-states))
+ (previous-token-start nil)
+ (previous-token-end nil)
+ (tokens phps-mode-lexer-tokens))
+
+ ;; Find state and state stack before point of change
+ ;; also determine were previous token to change starts
+ (catch 'stop-iteration
+ (dolist (state-object states)
+ (let ((start (nth 0 state-object))
+ (end (nth 1 state-object)))
+ (when (< end change-start)
+ (setq state (nth 2 state-object))
+ (setq state-stack (nth 3 state-object))
+ (setq previous-token-start start)
+ (setq previous-token-end end)
+ (push state-object new-states))
+ (when (> start change-start)
+ (throw 'stop-iteration nil)))))
+
+ (if (and state
+ state-stack)
+ (let ((old-tokens '()))
+
+ ;; Build new list of tokens before point of change
+ (catch 'stop-iteration
+ (dolist (token tokens)
+ (let ((_start (car (cdr token)))
+ (end (cdr (cdr token))))
+ (if (< end previous-token-end)
+ (progn
+ ;; NOTE Does following line make any difference?
+ ;; (semantic-lex-push-token (semantic-lex-token
token _start end))
+ (push token old-tokens))
+ (throw 'stop-iteration nil)))))
+ (setq old-tokens (nreverse old-tokens))
+
+ ;; Delete all overlays from point of change to end of buffer
+ (dolist (overlay (overlays-in previous-token-end (point-max)))
+ (delete-overlay overlay))
- ;; (message "Rewinding lex to state: %s and stack: %s and
states: %s and start: %s old tokens: %s" state state-stack new-states
previous-token-start old-tokens)
+ (let* ((new-tokens (semantic-lex previous-token-start
(point-max)))
+ (appended-tokens (append old-tokens new-tokens)))
+ ;; (message "old-tokens: %s, new-tokens: %s" old-tokens
new-tokens)
+ (setq phps-mode-lexer-tokens appended-tokens)
+ (setq phps-mode-lexer-STATE state)
+ (setq phps-mode-lexer-state_stack state-stack)
+ (setq phps-mode-lexer-states new-states)
+
+ ;; (message "Rewinding lex to state: %s and stack: %s and
states: %s and start: %s old tokens: %s" state state-stack new-states
previous-token-start old-tokens)
- ))
- ;; (display-warning "phps-mode" (format "Found no state to rewind to
for %s in stack %s, buffer point max: %s" change-start states (point-max)))
- )))
+ ))
+ ;; (display-warning "phps-mode" (format "Found no state to rewind to
for %s in stack %s, buffer point max: %s" change-start states (point-max)))
+ ))))
(phps-mode-lexer-run)
(phps-mode-functions-reset-buffer-changes-start))
- [elpa] externals/phps-mode 5d5ec06 313/405: Started on test for automatic quotations, (continued)
- [elpa] externals/phps-mode 5d5ec06 313/405: Started on test for automatic quotations, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7e755e1 303/405: Fixed indentation for argument assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a852669 320/405: Fix bug in syntax colouring, added debug outputs for incremental lexer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ad94b0b 319/405: Removed some fixed TODO itemsc, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2427c7e 318/405: Improved README, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 6d834c1 312/405: Added support for (comment-region) and (uncomment-region), Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b1d2820 309/405: Fixed issue with indentation of square bracket arrays in assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3bc2411 317/405: Moved syntax-table tests to own file, using local electric-pair-mode in PHPs buffers, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c2b8a16 335/405: Passes new test for concatenated string inside function arguments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b4e416a 336/405: (comment-region) tests working with custom function, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ad53b6c 330/405: Fixed warning when expected integer was nil,
Stefan Monnier <=
- [elpa] externals/phps-mode c8c5b62 337/405: Made custom functions for (comment-region) and (uncomment-region), Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7e22fdb 323/405: Added failing incremental indentation test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a45b39a 339/405: Added two failing indentation tests for concatenated equal assignment and double arrow multi-line array declaration, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3e1ff06 332/405: Added integration-tests for syntax colouring and update goals, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ced201d 322/405: Updated syntax colouring for namespace, class, function and constant names, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8298a6a 325/405: Colorized strings after namespace separator, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a30e5ff 331/405: Run incremental lexer when processing file if buffer change, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e9475f7 321/405: Merge branch 'master' of https://github.com/cjohansson/emacs-phps-mode, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 55b3087 333/405: Optimized lexer calling, do not call when using (indent-line), Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a309998 326/405: Integration tests passes with new function, Stefan Monnier, 2019/07/13