[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 3fb73ee 37/62: Added bookkeeping support of s
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 3fb73ee 37/62: Added bookkeeping support of superglobals $argc, $argv and $http_response_header |
Date: |
Tue, 20 Apr 2021 10:56:19 -0400 (EDT) |
branch: externals/phps-mode
commit 3fb73eee4f156ce59330d6bb5f3186b1cf1c082a
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Added bookkeeping support of superglobals $argc, $argv and
$http_response_header
---
phps-mode-lex-analyzer.el | 29 ++++++++++++++---------------
test/phps-mode-test-lex-analyzer.el | 4 ++--
2 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 4a0dd5f..ed66b6d 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -726,21 +726,17 @@
;; 1. Determine state (incremental-state) and
state-stack (incremental-state-stack) heredoc label (incremental-heredoc-label)
heredoc-label-stack (heredoc-label-stack) before incremental start
;; 2. Build list of states before incremental start
(head-states)
(catch 'quit
- (let ((previous-state))
- (dolist (state-object (nreverse old-states))
- (let ((end (nth 1 state-object)))
- (if (<= end incremental-start-new-buffer)
- (progn
- (setq incremental-state (nth 2
state-object))
- (setq incremental-state-stack (nth 3
state-object))
- (setq incremental-heredoc-label (nth 4
state-object))
- (setq incremental-heredoc-label-stack (nth
5 state-object))
- (setq incremental-nest-location-stack (nth
6 state-object))
- (push state-object head-states))
- (throw 'quit "break")))
- (setq
- previous-state
- state-object))))
+ (dolist (state-object (nreverse old-states))
+ (let ((end (nth 1 state-object)))
+ (if (<= end incremental-start-new-buffer)
+ (progn
+ (setq incremental-state (nth 2 state-object))
+ (setq incremental-state-stack (nth 3
state-object))
+ (setq incremental-heredoc-label (nth 4
state-object))
+ (setq incremental-heredoc-label-stack (nth 5
state-object))
+ (setq incremental-nest-location-stack (nth 6
state-object))
+ (push state-object head-states))
+ (throw 'quit "break")))))
(phps-mode-debug-message
(message "Head states: %s" head-states)
@@ -1250,6 +1246,9 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
(equal bookkeeping-variable-name "$_REQUEST")
(equal bookkeeping-variable-name "$_SERVER")
(equal bookkeeping-variable-name "$_SESSION")
+ (equal bookkeeping-variable-name "$argc")
+ (equal bookkeeping-variable-name "$argv")
+ (equal bookkeeping-variable-name
"$http_response_header")
))
(setq bookkeeping-is-superglobal t))
diff --git a/test/phps-mode-test-lex-analyzer.el
b/test/phps-mode-test-lex-analyzer.el
index 80d4318..75a2e2b 100644
--- a/test/phps-mode-test-lex-analyzer.el
+++ b/test/phps-mode-test-lex-analyzer.el
@@ -1404,12 +1404,12 @@
(list (list " id $var2" 1) (list (list 8 13) 1) (list " function
myFunction id $var" 1) (list (list 40 44) 1) (list " function myFunction id
$var3" 1) (list (list 52 57) 1) (list (list 70 74) 1) (list (list 112 117) 0)
(list (list 156 161) 1) (list " function myFunction2 id $abc" 1) (list (list
215 219) 1) (list (list 231 235) 0) (list (list 274 278) 1) (list (list 315
319) 0) (list (list 346 351) 1)))))
(phps-mode-test--with-buffer
- "<?php\n\n// Super-globals\n\nif ($_GET) {\n echo 'Hit';\n}\nif ($_POST)
{\n echo 'Hit';\n}\nif ($_COOKIE) {\n echo 'Hit';\n}\nif ($_SESSION) {\n
echo 'Hit';\n}\nif ($_REQUEST) {\n echo 'Hit';\n}\nif ($GLOBALS) {\n
echo 'Hit';\n}\nif ($_SERVER) {\n echo 'Hit';\n}\nif ($_FILES) {\n echo
'Hit';\n}\nif ($_ENV) {\n echo 'Hit';\n}"
+ "<?php\n\n// Super-globals\n\nif ($_GET) {\n echo 'Hit';\n}\nif ($_POST)
{\n echo 'Hit';\n}\nif ($_COOKIE) {\n echo 'Hit';\n}\nif ($_SESSION) {\n
echo 'Hit';\n}\nif ($_REQUEST) {\n echo 'Hit';\n}\nif ($GLOBALS) {\n
echo 'Hit';\n}\nif ($_SERVER) {\n echo 'Hit';\n}\nif ($_FILES) {\n echo
'Hit';\n}\nif ($_ENV) {\n echo 'Hit';\n}\nif ($argc) {\n echo
'Hit';\n}\nif ($argv) {\n echo 'Hit';\n}\nif ($http_response_header) {\n
echo 'Hit';\n}"
"Bookkeeping of super-globals"
(should
(equal
(phps-mode-test--hash-to-list (phps-mode-lex-analyzer--get-bookkeeping) t)
- (list (list (list 30 35) 1) (list (list 61 67) 1) (list (list 93 101) 1)
(list (list 127 136) 1) (list (list 162 171) 1) (list (list 197 205) 1) (list
(list 231 239) 1) (list (list 265 272) 1) (list (list 298 303) 1)))))
+ (list (list (list 30 35) 1) (list (list 61 67) 1) (list (list 93 101) 1)
(list (list 127 136) 1) (list (list 162 171) 1) (list (list 197 205) 1) (list
(list 231 239) 1) (list (list 265 272) 1) (list (list 298 303) 1) (list (list
329 334) 1) (list (list 360 365) 1) (list (list 391 414) 1)))))
(phps-mode-test--with-buffer
"<?php\n\nnamespace myNamespaceA {\n $var = 123;\n class myClassA {\n
private $var2 = 123;\n function myFunctionA($var3) {\n
$var4 = 123;\n if ($var) {\n echo 'Miss';\n
}\n if ($var2) {\n echo 'Miss';\n }\n
if ($var3) {\n echo 'Hit';\n }\n if
($var4) {\n echo 'Hit';\n }\n }\n\n
function myFuncti [...]
- [elpa] externals/phps-mode 050fe6a 36/62: Updated version and modified date, (continued)
- [elpa] externals/phps-mode 050fe6a 36/62: Updated version and modified date, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode ec19574 43/62: More implementation of grammar, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode a99284a 39/62: Added TODO item, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode 209055b 62/62: Updated date and version, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode 86de51b 51/62: Fixed bug with incremental nesting stack, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode a164e82 33/62: Updated README about PHP 8.0 lexer, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode 5a3bee3 40/62: More work on implementing PHP 8.0 grammar, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode a4b641d 56/62: Improved Make-script for compile and clean, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode d56472c 50/62: Added precedence attributes to grammar, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode e92bed3 54/62: Started debugging failing indentation in some weird cases, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode 3fb73ee 37/62: Added bookkeeping support of superglobals $argc, $argv and $http_response_header,
Christian Johansson <=
- [elpa] externals/phps-mode 2efba0b 38/62: Started on generated parser via emacs-parser-generator, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode fd971ee 48/62: Fixed missing lex-analyzer tokens, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode 30e1317 59/62: Removed test-file from master branch, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode b04da34 60/62: Fixed tests, only clearing imenu when starting to process changes, if idle inteval is set to nil process changes directly, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode 1991912 49/62: Fixed bug in grammar syntax, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode afaf192 53/62: Resolved conflict, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode daff735 58/62: Removed debug output, Christian Johansson, 2021/04/20
- [elpa] externals/phps-mode b115fdc 57/62: Added ELPA copyright to file missing it, Christian Johansson, 2021/04/20