[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode d39152b 279/405: Added unit test for NUM_STRI
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode d39152b 279/405: Added unit test for NUM_STRING token inside double-quoted string |
Date: |
Sat, 13 Jul 2019 10:00:32 -0400 (EDT) |
branch: externals/phps-mode
commit d39152b89bff8f762f8b1b92b9fbbe58de3fb380
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Added unit test for NUM_STRING token inside double-quoted string
---
phps-mode-lexer.el | 18 ++++++------------
phps-mode-test-functions.el | 2 +-
phps-mode-test-lexer.el | 7 +++++++
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index 45d7edf..f6e51809 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -1137,18 +1137,12 @@
(phps-mode-lexer-RETURN_TOKEN 'T_DNUMBER start end)
(phps-mode-lexer-RETURN_TOKEN 'T_LNUMBER start end)))))
- ;; TODO Implement this
- ;; (phps-mode-lexer-re2c-rule
- ;; (and ST_VAR_OFFSET (looking-at "\\([0]\\|\\([1-9][0-9]*\\)\\)"))
- ;; (lambda()
- ;; (let* ((start (match-beginning 0))
- ;; (end (match-end 0))
- ;; (data (buffer-substring-no-properties (+ start 2) end))
- ;; (long-number (string-to-number data 16)))
- ;; ;; (message "Hexadecimal number %s from %s" long-number data)
- ;; (if (> long-number phps-mode-lexer-long-limit)
- ;; (phps-mode-lexer-RETURN_TOKEN 'T_DNUMBER start end)
- ;; (phps-mode-lexer-RETURN_TOKEN 'T_LNUMBER start end)))))
+ (phps-mode-lexer-re2c-rule
+ (and ST_VAR_OFFSET (looking-at "\\([0]\\|[1-9][0-9]*\\)"))
+ (lambda()
+ (let ((start (match-beginning 0))
+ (end (match-end 0)))
+ (phps-mode-lexer-RETURN_TOKEN 'T_NUM_STRING start end))))
(phps-mode-lexer-re2c-rule
(and ST_VAR_OFFSET (looking-at (concat "\\("
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 29c1f35..f93e4d5 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -370,7 +370,7 @@
(phps-mode-test-with-buffer
"<html><head><title><?php if ($myCondition) {\nif ($mySeconCondition)
{\necho $title3;\n\n}\n?>\n</title><body>Bla bla</body></html>"
"Curly bracket test 4"
- (message "Tokens: %s" (phps-mode-lexer-get-tokens))
+ ;; (message "Tokens: %s" (phps-mode-lexer-get-tokens))
(goto-char 110)
(phps-mode-functions-indent-line)
(let ((buffer-contents (buffer-substring-no-properties (point-min)
(point-max))))
diff --git a/phps-mode-test-lexer.el b/phps-mode-test-lexer.el
index e688032..22f6575 100644
--- a/phps-mode-test-lexer.el
+++ b/phps-mode-test-lexer.el
@@ -168,6 +168,13 @@
(should (equal (phps-mode-lexer-get-tokens)
'((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 16) ("=" 17 . 18)
(T_VARIABLE 19 . 24) ("[" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 31) ("]" 31
. 32) (T_COALESCE 33 . 35) (T_CONSTANT_ENCAPSED_STRING 36 . 44) (";" 44 . 45)
(T_VARIABLE 46 . 51) (T_OBJECT_OPERATOR 51 . 53) (T_STRING 53 . 60)
(T_OBJECT_OPERATOR 60 . 62) (T_STRING 62 . 66) ("[" 66 . 67)
(T_CONSTANT_ENCAPSED_STRING 67 . 77) ("]" 77 . 78) ("[" 78 . 79)
(T_CONSTANT_ENCAPSED_STRING 79 . 88) ("]" 88 . 89) (T_COALESCE_EQUA [...]
+ (phps-mode-test-with-buffer
+ "<?php\necho $array['abc'];\necho \"My $array[12] random statement\";\n"
+ "Long inside array offset"
+ (message "Tokens: %s" (phps-mode-lexer-get-tokens))
+ (should (equal (phps-mode-lexer-get-tokens)
+ '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 18)
("[" 18 . 19) (T_CONSTANT_ENCAPSED_STRING 19 . 24) ("]" 24 . 25) (";" 25 . 26)
(T_ECHO 27 . 31) ("\"" 32 . 33) (T_ENCAPSED_AND_WHITESPACE 33 . 36) (T_VARIABLE
36 . 43) (T_NUM_STRING 43 . 45) ("]" 45 . 46) (T_CONSTANT_ENCAPSED_STRING 46 .
63) ("\"" 63 . 64) (";" 64 . 65)))))
+
;; TODO Add test for long as var offset
;; (phps-mode-test-with-buffer
- [elpa] externals/phps-mode 11309b8 256/405: Updated readme, (continued)
- [elpa] externals/phps-mode 11309b8 256/405: Updated readme, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode fcc920f 258/405: More preparations for merging indent and Imenu into one function, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 41c12c1 251/405: Updated paths for byte-compilation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0e927e8 252/405: Fixed compilation command in makefile, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 6593242 257/405: Preparations for doing indentation and imenu in one pass, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 318001e 259/405: Merged Imenu and indentation generation into one iteration of tokens, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 5bb45ce 253/405: Added lexer test for properties inside heredoc, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode caafeba 260/405: Changed idle interval for incremental lexer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c7ad55c 255/405: Passed first integration-test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 310521b 254/405: Started with first integration-test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d39152b 279/405: Added unit test for NUM_STRING token inside double-quoted string,
Stefan Monnier <=
- [elpa] externals/phps-mode 44a997e 270/405: Added syntax coloring for "." tokens, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode aa0c23d 263/405: Updated font-locks for token color syntax, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b86dd54 262/405: Indentation now supports new lexer token T_INLINE HTML, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2c8f28c 275/405: Added docstrings to variables, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c9f0254 271/405: Fixed some minor flycheck complains in lexer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 68ef657 280/405: Removed debugging output from unit tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 40bffbc 265/405: Added syntax coloring for [ )( ,, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9deb882 266/405: Added syntax coloring for ? ! < > :, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 969a4d1 278/405: Fixed syntax for coalesce assignment operator, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode bd08a00 277/405: Added unit test for COALESCING EQUAL token, Stefan Monnier, 2019/07/13