Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add individual faces #606

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

Add individual faces #606

wants to merge 29 commits into from

Conversation

minikN
Copy link
Contributor

@minikN minikN commented Jan 3, 2020

Hello, this PR is adding a lot of new faces to php-mode. Let me explain what I have added.
The following faces (and accompanying regex) have been added:

Classes

  • php-class-declaration: will fontify the words class, trait, interface.
  • php-class-declaration-spec: will fontify the words implements, extends.
  • php-namespace-declaration: will fontify the word namespace.
  • php-import-declaration: will fontify the words use ... as ....
  • php-class-modifier: will fontify abstract, final keywords in class declaration.

Methods

  • php-method-modifier: will fontify abstract, final keywords in method declaration.
  • php-method-access: will fontify private, protected, public in method declaration.
  • php-method-static: will fontify static keyword in method declaration.
  • php-return-type-colon: will fontify : in front of return type declaration.

Properties

  • php-property-access: will fontify private, protected, public in property declaration.
  • php-property-static: will fontify static keyword in property declaration.
  • php-property-const: will fontify const keyword in property declaration.

Statements

  • php-block-statement: will fontify if, elseif, for, foreach, while, declare, switch and catch keywords.
  • php-flow-control-statement: will fontify break, continue, die, exit, goto, return and throw keywords.
  • php-print-statement: will fontify echo, print and var_dump keywords.
  • php-include-statement: will fontify include, include_once, require and require_once keywords.

Other Stuff

  • php-constant-keyword: will fontify true, false and null.
  • php-function-keyword: will fontify function in ... function name(....
  • php-number: will fontify integers and floats (13, 4.3, ...)
  • php-string-quote: will fontify the string delimiters (', ")
  • php-block-delimiter: will fontify block delimiters ((, [, {, ), ], })
  • php-type-operator: will fontify insteadof and instanceof keywords.
  • php-string-op: will fontify . for string concatenation. I also bootstrapped that in my last PR but somehow forgot to actually implement it.

Default styles

The faces php-type-operator, php-block-delimiter and php-number inherit from default.
The face php-string-quote inherits from php-string.
All other faces inherit from php-keyword

So by default, everything should look the same.

Known issues

  • when applying a different style to php-string-qoute in comparison to php-string, occurences of string delimiters inside of the string will also be colored differently.
  • as usual, I believe most of the regex could be optimized in many ways. I'm open for suggestions as this is not my strong suite.
  • I know that insteadof is no type operator and therefore should not have been grouped in the type-operator face. However, since it's so similar to instanceof I put it in anyway.

@minikN minikN requested a review from zonuexe February 25, 2020 10:05
@@ -117,7 +117,7 @@
:tag "PHP Increment/Decrement Op")

(defface php-string-op '((t (:inherit php-operator)))
"PHP Mode face used to logical operators (.)."
"PHP Mode face used to string operator (.)."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@minikN
Copy link
Contributor Author

minikN commented Oct 6, 2020

Is this still being worked on? Just wondering.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants