branch: externals/phps-mode commit 808f6796ffc9ca62b7453b3d783a726862dd8b3e Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Moved TODO to separate doc and improved syntax coloring --- README.md | 41 +++++++++++++++-------------------------- docs/todo.md | 14 ++++++++++++++ phps-mode-lexer.el | 27 ++------------------------- 3 files changed, 31 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 16d640f..55af1d1 100644 --- a/README.md +++ b/README.md @@ -7,32 +7,21 @@ An Emacs major mode for PHP scripting language which aims at making a full seman This mode does not require PHP installed on your computer because it has a built-in elisp based lexer and parser. It supports all PHP versions and Emacs >= 26. -## Goals - -*With current progress estimates:* - -* GPLv3 license (100%) -* Flycheck support (PHP Mess Detector, PHP Code Sniffer) (100%) -* Lexer based on official PHP re2c lexer (100%) -* Syntax coloring based on lexer tokens (100%) -* PSR-1 and PSR-2 indentation based on lexer tokens (100%) -* Integration with `(electric-pair)` (100%) -* Incremental lexer and syntax coloring after buffer changes (100%) -* Incremental indentation and imenu calculation after buffer changes (100%) -* Supports `(comment-region)` and `(uncomment-region)` (100%) -* From first stable release, use master branch for stable releases and develop branch for on-going work (100%) -* Travis support (100%) -* Imenu support (100%) -* Minimal mode map (100%) -* 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%) -* Approach flycheck about including support for this module by default (0%) -* Eldoc support (0%) -* Flymake support (0%) -* PSR-2 auto-formatting tool based on lexer tokens (0%) -* Add to MELPA (0%) -* Add to ELPA (0%) +## Features + +* GPLv3 license +* Flycheck support (PHP Mess Detector, PHP Code Sniffer) +* Lexer based on official PHP re2c lexer +* Syntax coloring based on lexer tokens +* 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 +* Supports `(comment-region)` and `(uncomment-region)` +* From first stable release, use master branch for stable releases and develop branch for on-going work +* Travis support +* Imenu support +* Minimal mode map ## Tests diff --git a/docs/todo.md b/docs/todo.md new file mode 100644 index 0000000..60673c0 --- /dev/null +++ b/docs/todo.md @@ -0,0 +1,14 @@ +## TODOs + +*With current progress estimates:* + +* 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%) +* Approach flycheck about including support for this module by default (0%) +* Support indentation for HTML/XML, Javascript and CSS content inside inline_html content (0%) +* Eldoc support (0%) +* Flymake support (0%) +* PSR-2 auto-formatting tool based on lexer tokens (0%) +* Add to MELPA (0%) +* Add to ELPA (0%) diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el index b2eb694..c3f0eb1 100644 --- a/phps-mode-lexer.el +++ b/phps-mode-lexer.el @@ -131,9 +131,6 @@ (defconst phps-mode-lexer-ST_VAR_OFFSET 9 "Flag whether we are looking for variable offset or not.") -(defvar phps-mode-lexer-COLOR_SYNTAX-previous-token nil - "Store previous token for color-syntax.") - ;; REGULAR EXPRESSIONS @@ -239,12 +236,6 @@ (overlay-put (make-overlay start end) 'font-lock-face 'font-lock-string-face)) ((or - (string= token "(") - (string= token ")") - (string= token "[") - (string= token "]") - (string= token "{") - (string= token "}") (string= token 'T_DOLLAR_OPEN_CURLY_BRACES) (string= token 'T_CURLY_OPEN) (string= token 'T_OBJECT_OPERATOR) @@ -319,23 +310,11 @@ (overlay-put (make-overlay start end) 'font-lock-face 'font-lock-keyword-face)) ((or - (string= token "?") - (string= token "!") - (string= token "<") - (string= token ">") - (string= token ":") - (string= token ",") - (string= token ".") - (string= token "%") - (string= token "=") (string= token 'T_OPEN_TAG) (string= token 'T_OPEN_TAG_WITH_ECHO) (string= token 'T_CLOSE_TAG) (string= token 'T_START_HEREDOC) (string= token 'T_END_HEREDOC) - (string= token "`") - (string= token "\"") - (string= token ";") (string= token 'T_ELLIPSIS) (string= token 'T_COALESCE) (string= token 'T_DOUBLE_ARROW) @@ -391,9 +370,8 @@ ((string= token 'T_ERROR) (overlay-put (make-overlay start end) 'font-lock-face 'font-lock-warning-face)) - ) - - (setq phps-mode-lexer-COLOR_SYNTAX-previous-token token)) + (t (overlay-put (make-overlay start end) 'font-lock-face 'font-lock-constant-face))) + ) (defun phps-mode-lexer-RETURN_TOKEN (token start end) "Push TOKEN to list with START and END." @@ -1603,7 +1581,6 @@ (defun phps-mode-lexer-setup (start end) "Just prepare other lexers for lexing region START to END." ;; (message "phps-mode-lexer-setup %s %s" start end) - (setq phps-mode-lexer-COLOR_SYNTAX-previous-token nil) ;; Flag that buffer has not been processed (when (and (boundp 'phps-mode-functions-processed-buffer)