php-mode
php-mode copied to clipboard
Add individual faces
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 wordsclass
,trait
,interface
. -
php-class-declaration-spec
: will fontify the wordsimplements
,extends
. -
php-namespace-declaration
: will fontify the wordnamespace
. -
php-import-declaration
: will fontify the wordsuse ... as ...
. -
php-class-modifier
: will fontifyabstract
,final
keywords in class declaration.
Methods
-
php-method-modifier
: will fontifyabstract
,final
keywords in method declaration. -
php-method-access
: will fontifyprivate
,protected
,public
in method declaration. -
php-method-static
: will fontifystatic
keyword in method declaration. -
php-return-type-colon
: will fontify:
in front of return type declaration.
Properties
-
php-property-access
: will fontifyprivate
,protected
,public
in property declaration. -
php-property-static
: will fontifystatic
keyword in property declaration. -
php-property-const
: will fontifyconst
keyword in property declaration.
Statements
-
php-block-statement
: will fontifyif
,elseif
,for
,foreach
,while
,declare
,switch
andcatch
keywords. -
php-flow-control-statement
: will fontifybreak
,continue
,die
,exit
,goto
,return
andthrow
keywords. -
php-print-statement
: will fontifyecho
,print
andvar_dump
keywords. -
php-include-statement
: will fontifyinclude
,include_once
,require
andrequire_once
keywords.
Other Stuff
-
php-constant-keyword
: will fontifytrue
,false
andnull
. -
php-function-keyword
: will fontifyfunction
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 fontifyinsteadof
andinstanceof
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 tophp-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 thetype-operator
face. However, since it's so similar toinstanceof
I put it in anyway.
Is this still being worked on? Just wondering.