From b7792dfc3d8237b63b3b0699cb9e8cd4d228d727 Mon Sep 17 00:00:00 2001 From: belliash Date: Mon, 30 Jul 2018 16:55:49 +0200 Subject: [PATCH] P# is not going to derive namespace syntax from PHP, but from C++. --- engine/compiler.c | 10 +++++----- engine/lexer.c | 2 +- engine/parser.c | 4 ++-- include/ph7int.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engine/compiler.c b/engine/compiler.c index 427097a..88b6772 100644 --- a/engine/compiler.c +++ b/engine/compiler.c @@ -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 * 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; sxi32 rc; - pGen->pIn++; /* Jump the 'use' keyword */ - /* Assemeble one or more real namespace path */ + pGen->pIn++; /* Jump the 'using' keyword */ + /* Assemble one or more real namespace path */ for(;;) { if(pGen->pIn >= pGen->pEnd) { break; @@ -3348,7 +3348,7 @@ static sxi32 GenStateCompileFunc( ph7_vm_func_closure_env sEnv; int got_this = 0; /* TRUE if $this have been seen */ 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; /* Closure,record environment variable */ pGen->pIn++; @@ -5474,7 +5474,7 @@ static const LangConstruct aLangConstruct[] = { { PH7_TKWRD_CONST, PH7_CompileConstant }, /* const statement */ { PH7_TKWRD_VAR, PH7_CompileVar }, /* var 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 diff --git a/engine/lexer.c b/engine/lexer.c index 9d0cbf3..285b6e2 100644 --- a/engine/lexer.c +++ b/engine/lexer.c @@ -603,7 +603,7 @@ static sxu32 KeywordCode(const char *z, int n) { {"const", PH7_TKWRD_CONST}, {"string", PH7_TKWRD_STRING}, {"global", PH7_TKWRD_GLOBAL}, - {"use", PH7_TKWRD_USE}, + {"using", PH7_TKWRD_USING}, {"elseif", PH7_TKWRD_ELIF}, {"else", PH7_TKWRD_ELSE}, {"if", PH7_TKWRD_IF}, diff --git a/engine/parser.c b/engine/parser.c index 83797cf..a3552d7 100644 --- a/engine/parser.c +++ b/engine/parser.c @@ -581,8 +581,8 @@ static sxi32 ExprAssembleAnnon(ph7_gen_state *pGen, SyToken **ppCur, SyToken *pE if(pIn->nType & PH7_TK_KEYWORD) { sxu32 nKey = SX_PTR_TO_INT(pIn->pUserData); /* Check if we are dealing with a closure */ - if(nKey == PH7_TKWRD_USE) { - pIn++; /* Jump the 'use' keyword */ + if(nKey == PH7_TKWRD_USING) { + pIn++; /* Jump the 'using' keyword */ if(pIn >= pEnd || (pIn->nType & PH7_TK_LPAREN) == 0) { /* Syntax error */ rc = PH7_GenCompileError(&(*pGen), E_ERROR, nLine, "Syntax error while declaring anonymous function"); diff --git a/include/ph7int.h b/include/ph7int.h index 6dc2c53..38b0231 100644 --- a/include/ph7int.h +++ b/include/ph7int.h @@ -1498,7 +1498,7 @@ enum ph7_expr_id { #define PH7_TKWRD_NEW 0x100 /* new: MUST BE A POWER OF TWO */ #define PH7_TKWRD_CONST 22 /* const */ #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_EVAL 27 /* eval */ #define PH7_TKWRD_VAR 28 /* var */