First step to declare a variable with specified data type.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2018-09-20 17:06:23 +02:00
parent e6e59d299e
commit 241c7d8168
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 23 additions and 17 deletions

View File

@ -5248,12 +5248,10 @@ static const LangConstruct aLangConstruct[] = {
{ PH7_KEYWORD_RETURN, PH7_CompileReturn }, /* return statement */
{ PH7_KEYWORD_SWITCH, PH7_CompileSwitch }, /* Switch statement */
{ PH7_KEYWORD_DO, PH7_CompileDoWhile }, /* do{ }while(); statement */
{ PH7_KEYWORD_STATIC, PH7_CompileStatic }, /* static statement */
{ PH7_KEYWORD_EXIT, PH7_CompileHalt }, /* exit language construct */
{ PH7_KEYWORD_TRY, PH7_CompileTry }, /* try statement */
{ PH7_KEYWORD_THROW, PH7_CompileThrow }, /* throw statement */
{ PH7_KEYWORD_CONST, PH7_CompileConstant }, /* const statement */
{ PH7_KEYWORD_VAR, PH7_CompileVar }, /* var statement */
};
/*
* Return a pointer to the global scope handler routine associated
@ -5291,23 +5289,29 @@ static ProcLangConstruct PH7_GenStateGetStatementHandler(
SyToken *pLookahead /* Look-ahead token */
) {
sxu32 n = 0;
for(;;) {
if(n >= SX_ARRAYSIZE(aLangConstruct)) {
break;
}
if(aLangConstruct[n].nID == nKeywordID) {
if(nKeywordID == PH7_KEYWORD_STATIC && pLookahead && (pLookahead->nType & PH7_TK_OP)) {
const ph7_expr_op *pOp = (const ph7_expr_op *)pLookahead->pUserData;
if(pOp && pOp->iOp == EXPR_OP_DC /*::*/) {
/* 'static' (class context),return null */
return 0;
}
if((nKeywordID & PH7_KEYWORD_TYPEDEF) != 0) {
return PH7_CompileVar;
} else if(nKeywordID == PH7_KEYWORD_STATIC) {
if(pLookahead && (pLookahead->nType & PH7_TK_OP)) {
const ph7_expr_op *pOp = (const ph7_expr_op *)pLookahead->pUserData;
if(pOp && pOp->iOp == EXPR_OP_DC /*::*/) {
/* 'static' (class context),return null */
return 0;
}
/* Return a pointer to the handler.
*/
return aLangConstruct[n].xConstruct;
}
n++;
return PH7_CompileStatic;
} else {
for(;;) {
if(n >= SX_ARRAYSIZE(aLangConstruct)) {
break;
}
if(aLangConstruct[n].nID == nKeywordID) {
/* Return a pointer to the handler.
*/
return aLangConstruct[n].xConstruct;
}
n++;
}
}
/* Not a language construct */
return 0;

View File

@ -1618,6 +1618,8 @@ enum ph7_expr_id {
#define PH7_KEYWORD_CALLBACK 0x80000 /* callback: MUST BE A POWER OF TWO */
#define PH7_KEYWORD_RESOURCE 0x100000 /* resource: MUST BE A POWER OF TWO */
#define PH7_KEYWORD_MIXED 0x200000 /* mixed: MUST BE A POWER OF TWO */
#define PH7_KEYWORD_TYPEDEF (PH7_KEYWORD_VOID|PH7_KEYWORD_CHAR|PH7_KEYWORD_BOOL|PH7_KEYWORD_INT|PH7_KEYWORD_FLOAT|PH7_KEYWORD_STRING|PH7_KEYWORD_OBJECT|PH7_KEYWORD_CALLBACK|PH7_KEYWORD_RESOURCE|PH7_KEYWORD_MIXED)
/* JSON encoding/decoding related definition */
enum json_err_code {
JSON_ERROR_NONE = 0, /* No error has occurred. */