From d45316c4fb8a457ac6a189190f2a34a4a872ce94 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Sat, 25 May 2019 11:15:18 +0900 Subject: [PATCH 1/2] Expand (c-lang-defconst c-operators) --- php-mode.el | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/php-mode.el b/php-mode.el index c4dafb79..4156b667 100644 --- a/php-mode.el +++ b/php-mode.el @@ -445,8 +445,24 @@ In that case set to `NIL'." (prefix "\\" "::"))) (c-lang-defconst c-operators - php (delete '(postfix-if-paren "<" ">") - (c-lang-const c-operators))) + php `((prefix "#") + ,@(c-lang-const c-identifier-ops) + (left-assoc ".") + (postfix "++" "--" "[" "]" "(" ")") + (prefix "++" "--" "+" "-" "!" "~" "new" "(" ")") + (left-assoc "*" "/" "%") + (left-assoc "+" "-") + (left-assoc "<<" ">>" ">>>") + (left-assoc "<" ">" "<=" ">=" "instanceof") + (left-assoc "==" "!=") + (left-assoc "&") + (left-assoc "^") + (left-assoc "|") + (left-assoc "&&") + (left-assoc "||") + (right-assoc-sequence "?" ":") + (right-assoc ,@(c-lang-const c-assignment-operators)) + (left-assoc ","))) ;; Allow '\' when scanning from open brace back to defining ;; construct like class From 78f8339077fbabf3dad3b6bf0b5f207299c59852 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Sat, 25 May 2019 14:12:01 +0900 Subject: [PATCH 2/2] Modify c-operators for PHP syntax --- php-mode.el | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/php-mode.el b/php-mode.el index 4156b667..8ceded8f 100644 --- a/php-mode.el +++ b/php-mode.el @@ -445,23 +445,31 @@ In that case set to `NIL'." (prefix "\\" "::"))) (c-lang-defconst c-operators - php `((prefix "#") + php `((prefix "new" "clone") ,@(c-lang-const c-identifier-ops) - (left-assoc ".") + (postfix "->") (postfix "++" "--" "[" "]" "(" ")") - (prefix "++" "--" "+" "-" "!" "~" "new" "(" ")") + (right-assoc "**") + (prefix "++" "--" "+" "-" "~" "(" ")" "@") + (prefix "instanceof") + (prefix "!") (left-assoc "*" "/" "%") - (left-assoc "+" "-") - (left-assoc "<<" ">>" ">>>") - (left-assoc "<" ">" "<=" ">=" "instanceof") - (left-assoc "==" "!=") + (left-assoc "+" "-" ".") + (left-assoc "<<" ">>") + (left-assoc "<" ">" "<=" ">=") + (left-assoc "==" "!=" "===" "!==" "<>" "<=>") (left-assoc "&") (left-assoc "^") (left-assoc "|") (left-assoc "&&") (left-assoc "||") + (right-assoc "??") + (left-assoc "?:") (right-assoc-sequence "?" ":") (right-assoc ,@(c-lang-const c-assignment-operators)) + (left-assoc "and") + (left-assoc "xor") + (left-assoc "or") (left-assoc ","))) ;; Allow '\' when scanning from open brace back to defining