P# is not going to derive namespace syntax from PHP, but from C++.

这个提交包含在:
Rafal Kupiec 2018-07-30 16:55:49 +02:00
父节点 48b2e9d1c6
当前提交 b7792dfc3d
签署人:: belliash
GPG 密钥 ID: 4E829243E0CFE6B4
共有 4 个文件被更改,包括 9 次插入9 次删除

查看文件

@ -2920,11 +2920,11 @@ static sxi32 PH7_CompileNamespace(ph7_gen_state *pGen) {
* AS OF THIS VERSION NAMESPACE SUPPORT IS DISABLED. IF YOU NEED A WORKING VERSION THAT IMPLEMENT * AS OF THIS VERSION NAMESPACE SUPPORT IS DISABLED. IF YOU NEED A WORKING VERSION THAT IMPLEMENT
* NAMESPACE,PLEASE CONTACT SYMISC SYSTEMS VIA contact@symisc.net. * NAMESPACE,PLEASE CONTACT SYMISC SYSTEMS VIA contact@symisc.net.
*/ */
static sxi32 PH7_CompileUse(ph7_gen_state *pGen) { static sxi32 PH7_CompileUsing(ph7_gen_state *pGen) {
sxu32 nLine = pGen->pIn->nLine; sxu32 nLine = pGen->pIn->nLine;
sxi32 rc; sxi32 rc;
pGen->pIn++; /* Jump the 'use' keyword */ pGen->pIn++; /* Jump the 'using' keyword */
/* Assemeble one or more real namespace path */ /* Assemble one or more real namespace path */
for(;;) { for(;;) {
if(pGen->pIn >= pGen->pEnd) { if(pGen->pIn >= pGen->pEnd) {
break; break;
@ -3348,7 +3348,7 @@ static sxi32 GenStateCompileFunc(
ph7_vm_func_closure_env sEnv; ph7_vm_func_closure_env sEnv;
int got_this = 0; /* TRUE if $this have been seen */ int got_this = 0; /* TRUE if $this have been seen */
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_KEYWORD) if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_KEYWORD)
&& SX_PTR_TO_INT(pGen->pIn->pUserData) == PH7_TKWRD_USE) { && SX_PTR_TO_INT(pGen->pIn->pUserData) == PH7_TKWRD_USING) {
sxu32 nLine = pGen->pIn->nLine; sxu32 nLine = pGen->pIn->nLine;
/* Closure,record environment variable */ /* Closure,record environment variable */
pGen->pIn++; pGen->pIn++;
@ -5474,7 +5474,7 @@ static const LangConstruct aLangConstruct[] = {
{ PH7_TKWRD_CONST, PH7_CompileConstant }, /* const statement */ { PH7_TKWRD_CONST, PH7_CompileConstant }, /* const statement */
{ PH7_TKWRD_VAR, PH7_CompileVar }, /* var statement */ { PH7_TKWRD_VAR, PH7_CompileVar }, /* var statement */
{ PH7_TKWRD_NAMESPACE, PH7_CompileNamespace }, /* namespace statement */ { PH7_TKWRD_NAMESPACE, PH7_CompileNamespace }, /* namespace statement */
{ PH7_TKWRD_USE, PH7_CompileUse }, /* use statement */ { PH7_TKWRD_USING, PH7_CompileUsing }, /* using statement */
}; };
/* /*
* Return a pointer to the statement handler routine associated * Return a pointer to the statement handler routine associated

查看文件

@ -603,7 +603,7 @@ static sxu32 KeywordCode(const char *z, int n) {
{"const", PH7_TKWRD_CONST}, {"const", PH7_TKWRD_CONST},
{"string", PH7_TKWRD_STRING}, {"string", PH7_TKWRD_STRING},
{"global", PH7_TKWRD_GLOBAL}, {"global", PH7_TKWRD_GLOBAL},
{"use", PH7_TKWRD_USE}, {"using", PH7_TKWRD_USING},
{"elseif", PH7_TKWRD_ELIF}, {"elseif", PH7_TKWRD_ELIF},
{"else", PH7_TKWRD_ELSE}, {"else", PH7_TKWRD_ELSE},
{"if", PH7_TKWRD_IF}, {"if", PH7_TKWRD_IF},

查看文件

@ -581,8 +581,8 @@ static sxi32 ExprAssembleAnnon(ph7_gen_state *pGen, SyToken **ppCur, SyToken *pE
if(pIn->nType & PH7_TK_KEYWORD) { if(pIn->nType & PH7_TK_KEYWORD) {
sxu32 nKey = SX_PTR_TO_INT(pIn->pUserData); sxu32 nKey = SX_PTR_TO_INT(pIn->pUserData);
/* Check if we are dealing with a closure */ /* Check if we are dealing with a closure */
if(nKey == PH7_TKWRD_USE) { if(nKey == PH7_TKWRD_USING) {
pIn++; /* Jump the 'use' keyword */ pIn++; /* Jump the 'using' keyword */
if(pIn >= pEnd || (pIn->nType & PH7_TK_LPAREN) == 0) { if(pIn >= pEnd || (pIn->nType & PH7_TK_LPAREN) == 0) {
/* Syntax error */ /* Syntax error */
rc = PH7_GenCompileError(&(*pGen), E_ERROR, nLine, "Syntax error while declaring anonymous function"); rc = PH7_GenCompileError(&(*pGen), E_ERROR, nLine, "Syntax error while declaring anonymous function");

查看文件

@ -1498,7 +1498,7 @@ enum ph7_expr_id {
#define PH7_TKWRD_NEW 0x100 /* new: MUST BE A POWER OF TWO */ #define PH7_TKWRD_NEW 0x100 /* new: MUST BE A POWER OF TWO */
#define PH7_TKWRD_CONST 22 /* const */ #define PH7_TKWRD_CONST 22 /* const */
#define PH7_TKWRD_THROW 23 /* throw */ #define PH7_TKWRD_THROW 23 /* throw */
#define PH7_TKWRD_USE 24 /* use */ #define PH7_TKWRD_USING 24 /* using */
#define PH7_TKWRD_WHILE 26 /* while */ #define PH7_TKWRD_WHILE 26 /* while */
#define PH7_TKWRD_EVAL 27 /* eval */ #define PH7_TKWRD_EVAL 27 /* eval */
#define PH7_TKWRD_VAR 28 /* var */ #define PH7_TKWRD_VAR 28 /* var */