Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18096640
PhutilPHPCodeSnippetContextFreeGrammar.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
PhutilPHPCodeSnippetContextFreeGrammar.php
View Options
<?php
final
class
PhutilPHPCodeSnippetContextFreeGrammar
extends
PhutilCLikeCodeSnippetContextFreeGrammar
{
protected
function
buildRuleSet
()
{
return
array_merge
(
parent
::
buildRuleSet
(),
$this
->
getClassRuleSets
());
}
protected
function
getStartGrammarSet
()
{
$start_grammar
=
parent
::
getStartGrammarSet
();
$start_grammar
[
'start'
][]
=
'[classdecl]'
;
$start_grammar
[
'start'
][]
=
'[classdecl]'
;
return
$start_grammar
;
}
protected
function
getExprGrammarSet
()
{
$expr
=
parent
::
getExprGrammarSet
();
$expr
[
'expr'
][]
=
'new [classname]([funccallparam])'
;
$expr
[
'expr'
][]
=
'[classname]::[funccall]'
;
return
$expr
;
}
protected
function
getVarNameGrammarSet
()
{
$varnames
=
parent
::
getVarNameGrammarSet
();
foreach
(
$varnames
as
$vn_key
=>
$vn_val
)
{
foreach
(
$vn_val
as
$vv_key
=>
$vv_value
)
{
$varnames
[
$vn_key
][
$vv_key
]
=
'$'
.
$vv_value
;
}
}
return
$varnames
;
}
protected
function
getFuncNameGrammarSet
()
{
return
$this
->
buildGrammarSet
(
'funcname'
,
array_mergev
(
get_defined_functions
()));
}
protected
function
getMethodCallGrammarSet
()
{
return
$this
->
buildGrammarSet
(
'methodcall'
,
array
(
'$this->[funccall]'
,
'self::[funccall]'
,
'static::[funccall]'
,
'[varname]->[funccall]'
,
'[classname]::[funccall]'
,
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Aug 10, 8:25 AM (7 h, 12 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8265905
Default Alt Text
PhutilPHPCodeSnippetContextFreeGrammar.php (1 KB)
Attached To
Mode
rPHU libphutil
Attached
Detach File
Event Timeline
Log In to Comment