[elpa] externals/phps-mode 970cd47: Improved lexing of variables with offset in double quoted strings
branch: externals/phps-mode commit 970cd47da808fe12d5162dff2b8b5ec7c79ee723 Author: Christian Johansson Commit: Christian Johansson Improved lexing of variables with offset in double quoted strings --- Makefile| 2 +- phps-mode-lex-analyzer.el | 24 +++- phps-mode-lexer.el | 3 ++- test/phps-mode-test.el => phps-mode-test.el | 0 phps-mode.el| 4 ++-- test/phps-mode-test-lex-analyzer.el | 5 + test/phps-mode-test-lexer.el| 18 +- 7 files changed, 42 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 4500e66..2a6e1ee 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ ifdef emacs endif EMACS_CMD := $(EMACS) -Q -batch -L . -L test/ -EL := admin/phps-mode-automation.el phps-mode-flymake.el phps-mode-lex-analyzer.el phps-mode-lexer.el phps-mode-macros.el phps-mode-syntax-table.el phps-mode-parser-grammar-macro.el phps-mode.el test/phps-mode-test.el test/phps-mode-test-lex-analyzer.el test/phps-mode-test-integration.el test/phps-mode-test-lexer.el test/phps-mode-test-parser.el test/phps-mode-test-syntax-table.el +EL := admin/phps-mode-automation.el phps-mode-flymake.el phps-mode-lex-analyzer.el phps-mode-lexer.el phps-mode-macros.el phps-mode-syntax-table.el phps-mode-parser-grammar-macro.el phps-mode.el phps-mode-test.el test/phps-mode-test-lex-analyzer.el test/phps-mode-test-integration.el test/phps-mode-test-lexer.el test/phps-mode-test-parser.el test/phps-mode-test-syntax-table.el ELC := $(EL:.el=.elc) .PHONY: clean diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el index 79d02df..5f23658 100644 --- a/phps-mode-lex-analyzer.el +++ b/phps-mode-lex-analyzer.el @@ -1501,10 +1501,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL." ;; Keep track of square bracket level (when (string= token "[") (setq square-bracket-level (1+ square-bracket-level))) -(when (and - (string= token "]") - (not in-double-quotes)) - ;; You can have stuff like this $var = "abc $b[test]"; and only the closing square bracket will be tokenized +(when (string= token "]") (setq square-bracket-level (1- square-bracket-level)) (when first-token-on-line (setq first-token-is-nesting-decrease t))) @@ -1615,9 +1612,13 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL." (when (or (equal token 'T_CURLY_OPEN) (equal token 'T_DOLLAR_OPEN_CURLY_BRACES) (string= token "{")) - (setq curly-bracket-level (1+ curly-bracket-level))) + (setq curly-bracket-level (1+ curly-bracket-level)) + (phps-mode-debug-message + (message "New-curly-bracket-level: %s" curly-bracket-level))) (when (string= token "}") (setq curly-bracket-level (1- curly-bracket-level)) + (phps-mode-debug-message + (message "New-curly-bracket-level: %s" curly-bracket-level)) (when (and switch-curly-stack (= (1+ curly-bracket-level) (car switch-curly-stack))) @@ -1976,6 +1977,19 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL." in-return-level in-object-operator-level)) +(phps-mode-debug-message + (message "Nesting-end: %s from (+ %s %s %s %s %s %s %s %s %s)" + nesting-end + round-bracket-level + square-bracket-level + curly-bracket-level + alternative-control-structure-level + in-assignment-level + in-class-declaration-level + in-concatenation-level + in-return-level + in-object-operator-level)) + ;; Keep track of whether we are inside a HEREDOC or NOWDOC (when (equal token 'T_START_HEREDOC) (setq in-heredoc t) diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el index c1990b4..d2ba03a 100644 --- a/phps-mode-lexer.el +++ b/phps-mode-lexer.el @@ -1047,7 +1047,8 @@ phps-mode-lexer--LABEL "\\["))) (phps-mode-lexer--yy_push_state 'ST_VAR_OFFSET) - (phps-mode-lexer--RETURN_TOKEN 'T_VARIABLE (match-beginning 0) (match-end 0))) + (forward-char -1) + (phps-mode-lexer--RETURN_TOKEN 'T_VARIABLE (match-beginning 0) (- (match-end 0) 1))) (phps-mode-lexer--match-macro (and (or ST_IN_SCRIPTING ST_DOUBLE_QUOTES ST_HEREDOC ST_BACKQUOTE ST_VAR_OFFSET) diff --git a/te
[elpa] master 0be73c7: [gnus-mock] Add guard around setting sendmail-program
branch: master commit 0be73c7ff8c58264dc0c28bffef4957b8c4a1c3b Author: Eric Abrahamsen Commit: Eric Abrahamsen [gnus-mock] Add guard around setting sendmail-program * packages/gnus-mock/gnus-mock.el (gnus-mock-start): If gnus-mock-sendmail-program is nil this code would error. Check first. --- packages/gnus-mock/gnus-mock.el | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/gnus-mock/gnus-mock.el b/packages/gnus-mock/gnus-mock.el index bfa7f92..2c7604f 100644 --- a/packages/gnus-mock/gnus-mock.el +++ b/packages/gnus-mock/gnus-mock.el @@ -148,9 +148,6 @@ will start a mock Gnus session." (prin1 `(setq gnus-home-directory ,mock-tmp-dir init-file-user "mockturtle" - sendmail-program - ,(expand-file-name gnus-mock-sendmail-program -mock-tmp-dir) message-directory ,mock-tmp-dir gnus-startup-file ,(expand-file-name ".newsrc" mock-tmp-dir) @@ -162,6 +159,12 @@ will start a mock Gnus session." ,(expand-file-name "agent/" mock-tmp-dir) gnus-directory ,(expand-file-name "News/" mock-tmp-dir))) + (when gnus-mock-sendmail-program + (princ "\n\n") + (prin1 +`(setq sendmail-program + ,(expand-file-name gnus-mock-sendmail-program + mock-tmp-dir (princ "\n\n") ;; Constant that can be checked if we need to know it's a mock ;; session.
[elpa] externals/phps-mode 88ad178: Bookkeeping support for arrow function variables
branch: externals/phps-mode commit 88ad17844c57efdb9bb75092810865b3ad0c282a Author: Christian Johansson Commit: Christian Johansson Bookkeeping support for arrow function variables --- phps-mode-lex-analyzer.el | 67 + phps-mode.el| 4 +-- test/phps-mode-test-lex-analyzer.el | 14 3 files changed, 77 insertions(+), 8 deletions(-) diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el index 5f23658..35ff67e 100644 --- a/phps-mode-lex-analyzer.el +++ b/phps-mode-lex-analyzer.el @@ -1081,6 +1081,10 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL." (in-anonymous-function-declaration) (in-anonymous-function-number 0) (in-anonymous-function-nesting-level) + (in-global-declaration nil) + (in-arrow-fn nil) + (in-arrow-fn-declaration nil) + (in-arrow-fn-number 0) (bookkeeping (make-hash-table :test 'equal))) (push `(END_PARSE ,(length string) . ,(length string)) tokens) @@ -1154,6 +1158,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL." (equal next-token "[") (let ((bookkeeping-namespace namespace) +(bookkeeping-alternative-namespace nil) (bookkeeping-index (list token-start token-end)) (bookkeeping-variable-name (substring string (1- token-start) (1- token-end))) (bookkeeping-in-assignment nil) @@ -1218,12 +1223,24 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL." ;; Anonymous function level (when in-anonymous-function-nesting-level -(setq bookkeeping-namespace (format "%s anonymous function %s" bookkeeping-namespace in-anonymous-function-number +(setq bookkeeping-namespace (format "%s anonymous function %s" bookkeeping-namespace in-anonymous-function-number))) + + ;; In arrow function body + (when in-arrow-fn +(if in-arrow-fn-declaration +(setq bookkeeping-namespace (format "%s arrow function %s" bookkeeping-namespace in-arrow-fn-number)) + (setq bookkeeping-alternative-namespace bookkeeping-namespace) + (setq bookkeeping-namespace (format "%s arrow function %s" bookkeeping-namespace in-arrow-fn-number) (unless bookkeeping-named (when (equal previous-token 'T_STATIC) -(setq bookkeeping-namespace (concat bookkeeping-namespace " static"))) - (setq bookkeeping-namespace (concat bookkeeping-namespace " id " bookkeeping-variable-name))) +(setq bookkeeping-namespace (concat bookkeeping-namespace " static")) +(when bookkeeping-alternative-namespace + (setq bookkeeping-alternative-namespace (concat bookkeeping-alternative-namespace " static" + + (setq bookkeeping-namespace (concat bookkeeping-namespace " id " bookkeeping-variable-name)) + (when bookkeeping-alternative-namespace +(setq bookkeeping-alternative-namespace (concat bookkeeping-alternative-namespace " id " bookkeeping-variable-name (phps-mode-debug-message (message "Bookkeeping-namespace: '%s'" bookkeeping-namespace)) @@ -1293,6 +1310,17 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL." (equal token 'T_VARIABLE)) (setq bookkeeping-in-assignment t)) +;; In arrow function variable declaration +(when (and in-arrow-fn-declaration + (equal token 'T_VARIABLE)) + (setq bookkeeping-in-assignment t)) + +;; In global variable declaration +(when (and in-global-declaration + (equal token 'T_VARIABLE) + imenu-in-function-name) + (setq bookkeeping-in-assignment t)) + ;; In [$abc, $def] = .. or array($abc, $def) = ... (when (and array-variable-declaration @@ -1332,9 +1360,15 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL." (phps-mode-debug-message (message "Bookkeeping-hit: %s" bookkeeping-index)) (puthash bookkeeping-index 1 bookkeeping)) -(phps-mode-debug-message - (message "Bookkeeping-miss: %s" bookkeeping-index)) -(puthash bookkeeping-index 0 bookkeeping) +