branch: externals/phps-mode commit d121daa997e8f86957707e4f7049b5b911f4a980 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Improved support for non-ascii labels --- README.md | 7 ++++--- docs/todo.md | 2 +- phps-mode-lexer.el | 6 ++++-- phps-mode-test-lexer.el | 4 ++-- phps-mode.el | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ee007c9..d78f641 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,13 @@ This mode does not require PHP installed on your computer because it has a built * PSR-1 and PSR-2 indentation based on lexer tokens * Integration with `(electric-pair)` * Incremental lexer and syntax coloring after buffer changes -* Incremental indentation and imenu calculation after buffer changes +* Incremental indentation and imenu generation after buffer changes * Supports `(comment-region)` and `(uncomment-region)` * Imenu support -* Minimal mode map* Tested using unit tests and integration tests +* Minimal mode map +* Tested using unit tests and integration tests * Travis support -* Included in ELPA +* Included in GNU ELPA package archives ## Develop diff --git a/docs/todo.md b/docs/todo.md index 2996673..ab92428 100644 --- a/docs/todo.md +++ b/docs/todo.md @@ -2,6 +2,7 @@ *With current progress estimates:* +* Add to MELPA package archive (50%) * A set of heuristics to improve large-file incremental change handling (50%) * Wisent LALR parser based on official PHP yacc parser automatically converted grammar (50%) * Full integration with Emacs Semantic subsystem (30%) @@ -10,6 +11,5 @@ * Eldoc support (0%) * Flymake support (0%) * PSR-2 auto-formatting tool based on lexer tokens (0%) -* Add to MELPA (0%) [Back to start](../../../) diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el index a8e8079..8ba81d5 100644 --- a/phps-mode-lexer.el +++ b/phps-mode-lexer.el @@ -148,9 +148,10 @@ "Exponent double number.") (defvar phps-mode-lexer-LABEL - "[a-zA-Z_\u0080-\u00FF][a-zA-Z0-9_\x80-\xff]*" + "[A-Za-z_[:nonascii:]][0-9A-Za-z_[:nonascii:]]*" "Labels are used for names.") -;; NOTE original \x80-\xff replaced with \u0080-\u00FF, since original means raw bytes in emacs-lisp +;; NOTE original is [a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]* +;; NOTE Rebuilt for comparability with emacs-lisp (defvar phps-mode-lexer-WHITESPACE "[ \n\r\t]+" "White-space.") @@ -160,6 +161,7 @@ (defvar phps-mode-lexer-TOKENS "[][;:,.()|^&+/*=%!~$<>?@-]" "Tokens.") +;; NOTE Original is [;:,.\[\]()|^&+-/*=%!~$<>?@] ;; NOTE The hyphen moved last since it has special meaning and to avoid it being interpreted as a range. (defvar phps-mode-lexer-ANY_CHAR ".\\|\n" diff --git a/phps-mode-test-lexer.el b/phps-mode-test-lexer.el index dd83226..4d5faef 100644 --- a/phps-mode-test-lexer.el +++ b/phps-mode-test-lexer.el @@ -37,7 +37,7 @@ "Run test for lexer." (phps-mode-test-with-buffer - "<?php\t$var=1; exit $var;\t?>" + "<?php\t$öar=1; exit $var;\t?>" "Simple PHP with two expression" (should (equal (phps-mode-lexer-get-tokens) '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 11 . 12) (T_LNUMBER 12 . 13) (";" 13 . 14) (T_EXIT 15 . 19) (T_VARIABLE 20 . 24) (";" 24 . 25) (";" 26 . 28) (T_CLOSE_TAG 26 . 28))))) @@ -72,7 +72,7 @@ "Run test for simple tokens." (phps-mode-test-with-buffer - "<?php echo $var = array('');" + "<?php echo $vür = array('');" "Simple PHP via array declaration" (should (equal (phps-mode-lexer-get-tokens) '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 16) ("=" 17 . 18) (T_ARRAY 19 . 24) ("(" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 27) (")" 27 . 28) (";" 28 . 29))))) diff --git a/phps-mode.el b/phps-mode.el index 8290f0a..fa6df56 100644 --- a/phps-mode.el +++ b/phps-mode.el @@ -6,7 +6,7 @@ ;; Maintainer: Christian Johansson <github.com/cjohansson> ;; Created: 3 Mar 2018 ;; Modified: 17 Jul 2019 -;; Version: 0.2.2 +;; Version: 0.2.3 ;; Keywords: tools, convenience ;; URL: https://github.com/cjohansson/emacs-phps-mode