I use @ instead of #[] as attribute token. attribute use whitespace marks are 
closed. Of course you can start with @@ or #, other.
error control use @@ instead of @, add T_SILENCE token

new syntax:
one attribute: @attribute{WHITESPACE} @otherAttribute(12){WHITESPACE}
group attribute: @attribute1(1, 2),attribute2(343, 43)@attibute3(33)[WHITESPACE]

current syntax:
one attribute: #[attribute()] #[otherAttribute()]
group attribute: #[attribute1(1, 2),attribute2(343,),attibute3(33)]

below is comparison
new syntax:

@AttrA@AttrB(112, 334),AttrC
@AttrD
class A {
 @AttrE
 @AttrF @AttrG
 public $a;
 @AttrM
   public function m1(@AttrParma(1) $c) {}
}

$ab = @fn(1) fn()=> 1+2;
-----------
current syntax:

#[AttrA,AttrB(112, 334),AttrC]
#[AttrD]
class A {
 #[AttrE]
 #[AttrF]  #[AttrG]
 public $a;
 #[AttrM]
   public function m1(#[AttrParma(1)] $c) {}
}
$ab  = #[fn(1)] fn()=>1+2;

my implemented:
https://github.com/chopins/php-src/tree/new-syntax/attribute


Other new syntax implemented (Verification of feasibility) :
https://github.com/chopins/php-src/blob/php-alternative-syntax/alternative-syntax.md


Regards
Chopin Xiao

Reply via email to