Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F430354
PhutilPHPCodeSnippetContextFreeGrammar.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
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
Sat, May 3, 10:23 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
59864
Default Alt Text
PhutilPHPCodeSnippetContextFreeGrammar.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment