mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-04-18 05:38:36 +01:00
Stmt -> Statement
This commit is contained in:
parent
2d10181de5
commit
cc5987fcde
34 changed files with 616 additions and 626 deletions
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
Bool PrsAsmImm(CCmpCtrl *cc,CAsmArg *arg)
|
||||
Bool ParseAsmImm(CCmpCtrl *cc,CAsmArg *arg)
|
||||
{
|
||||
if (arg->imm_or_off_present)
|
||||
LexExcept(cc,"Already one immediate at ");
|
||||
|
@ -32,7 +32,7 @@ Bool PrsAsmImm(CCmpCtrl *cc,CAsmArg *arg)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
U0 PrsAsmArg(CCmpCtrl *cc,CAsmArg *arg,Bool rel)
|
||||
U0 ParseAsmArg(CCmpCtrl *cc,CAsmArg *arg,Bool rel)
|
||||
{
|
||||
CHashGeneric *tmph,*tmph1;
|
||||
CHashReg *tmpr;
|
||||
|
@ -113,7 +113,7 @@ U0 PrsAsmArg(CCmpCtrl *cc,CAsmArg *arg,Bool rel)
|
|||
}
|
||||
} else {
|
||||
pa_asm_direct_imm:
|
||||
PrsAsmImm(cc,arg);
|
||||
ParseAsmImm(cc,arg);
|
||||
arg->num.abs_cnts=cc->abs_cnts;
|
||||
if (arg->size<=1 && !rel && arg->num.abs_cnts&1) {
|
||||
if (cc->aotc->seg_size==16)
|
||||
|
@ -161,7 +161,7 @@ pa_asm_direct_imm:
|
|||
Lex(cc); //skip '+'
|
||||
} else {
|
||||
pa_asm_indirect_imm:
|
||||
PrsAsmImm(cc,arg);
|
||||
ParseAsmImm(cc,arg);
|
||||
arg->num.abs_cnts=cc->abs_cnts;
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ Bool AsmStoreNum(CCmpCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
|
|||
|
||||
U8 asm_seg_prefixes[6]={0x26,0x2E,0x36,0x3E,0x64,0x65};
|
||||
|
||||
Bool PrsAsmInst(CCmpCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
|
||||
Bool ParseAsmInst(CCmpCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
I64 i,j,arg1,arg2,om,seg,arg1mask,arg2mask;
|
||||
|
@ -811,7 +811,7 @@ Bool PrsAsmInst(CCmpCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
|
|||
LexExcept(cc,"Invalid inst at ");
|
||||
}
|
||||
|
||||
U0 PrsAsmDefine(CCmpCtrl *cc,I64 U8_cnt)
|
||||
U0 ParseAsmDefine(CCmpCtrl *cc,I64 U8_cnt)
|
||||
{
|
||||
Bool is_dup;
|
||||
I64 i,dup_val;
|
||||
|
@ -885,7 +885,7 @@ U0 PrsAsmDefine(CCmpCtrl *cc,I64 U8_cnt)
|
|||
Lex(cc);
|
||||
}
|
||||
|
||||
U0 PrsBinFile(CCmpCtrl *cc)
|
||||
U0 ParseBinFile(CCmpCtrl *cc)
|
||||
{
|
||||
I64 i,size;
|
||||
U8 *buf,*st;
|
||||
|
@ -901,7 +901,7 @@ U0 PrsBinFile(CCmpCtrl *cc)
|
|||
Lex(cc);
|
||||
}
|
||||
|
||||
U0 PrsAsmBlk(CCmpCtrl *cc,I64 cmp_flags)
|
||||
U0 ParseAsmBlk(CCmpCtrl *cc,I64 cmp_flags)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
I64 i,j,k,argcnt,
|
||||
|
@ -973,19 +973,19 @@ U0 PrsAsmBlk(CCmpCtrl *cc,I64 cmp_flags)
|
|||
AOTStoreCodeU8(cc,k);
|
||||
break;
|
||||
case AKW_DU8:
|
||||
PrsAsmDefine(cc,1);
|
||||
ParseAsmDefine(cc,1);
|
||||
break;
|
||||
case AKW_DU16:
|
||||
PrsAsmDefine(cc,2);
|
||||
ParseAsmDefine(cc,2);
|
||||
break;
|
||||
case AKW_DU32:
|
||||
PrsAsmDefine(cc,4);
|
||||
ParseAsmDefine(cc,4);
|
||||
break;
|
||||
case AKW_DU64:
|
||||
PrsAsmDefine(cc,8);
|
||||
ParseAsmDefine(cc,8);
|
||||
break;
|
||||
case AKW_BINFILE:
|
||||
PrsBinFile(cc);
|
||||
ParseBinFile(cc);
|
||||
break;
|
||||
case AKW_LIST:
|
||||
aotc->lst=TRUE;
|
||||
|
@ -1012,9 +1012,9 @@ U0 PrsAsmBlk(CCmpCtrl *cc,I64 cmp_flags)
|
|||
if (tmpo->ins[0].arg1) {
|
||||
argcnt++;
|
||||
if (ARGT_REL8<=tmpo->ins[0].arg1<=ARGT_REL32)
|
||||
PrsAsmArg(cc,&aotc->arg1,TRUE);
|
||||
ParseAsmArg(cc,&aotc->arg1,TRUE);
|
||||
else
|
||||
PrsAsmArg(cc,&aotc->arg1,FALSE);
|
||||
ParseAsmArg(cc,&aotc->arg1,FALSE);
|
||||
if (tmpo->ins[0].arg2) {
|
||||
argcnt++;
|
||||
if (cc->token!=',')
|
||||
|
@ -1022,13 +1022,13 @@ U0 PrsAsmBlk(CCmpCtrl *cc,I64 cmp_flags)
|
|||
else {
|
||||
Lex(cc); //skip ','
|
||||
if (ARGT_REL8<=tmpo->ins[0].arg2<=ARGT_REL32)
|
||||
PrsAsmArg(cc,&aotc->arg2,TRUE);
|
||||
ParseAsmArg(cc,&aotc->arg2,TRUE);
|
||||
else
|
||||
PrsAsmArg(cc,&aotc->arg2,FALSE);
|
||||
ParseAsmArg(cc,&aotc->arg2,FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
PrsAsmInst(cc,tmpo,argcnt);
|
||||
ParseAsmInst(cc,tmpo,argcnt);
|
||||
} else if (cc->hash_entry->type & HTT_EXPORT_SYS_SYM) {
|
||||
if (Btr(&cc->hash_entry->type,HTf_UNRESOLVED)) {
|
||||
if (cc->hash_entry->type & HTF_LOCAL) {
|
||||
|
|
|
@ -77,7 +77,7 @@ U0 AsmHashLoad()
|
|||
i=LstMatch(cc->cur_str,"NONE\0R8\0R16\0R32\0R64\0SEG\0FSTK\0"
|
||||
"MM\0XMM\0OPCODE\0KEYWORD\0ASM_KEYWORD\0");
|
||||
if (i<=0)
|
||||
LexExcept(cc,"Unknown Stmt");
|
||||
LexExcept(cc,"Unknown Statement");
|
||||
Lex(cc); //skip keyword
|
||||
if (cc->token!=TK_IDENT)
|
||||
LexExcept(cc,"Expecting identifier at ");
|
||||
|
@ -196,7 +196,7 @@ U0 AsmHashLoad()
|
|||
CmpCtrlDel(cc);
|
||||
for (i=0;i<INTERNAL_TYPES_NUM;i++) {
|
||||
tmpit=&internal_types_table[i];
|
||||
tmpc=PrsClassNew;
|
||||
tmpc=ParseClassNew;
|
||||
tmpc->type=HTT_INTERNAL_TYPE;
|
||||
tmpc->raw_type=tmpit->type;
|
||||
Bts(&tmpc->flags,Cf_INTERNAL_TYPE);
|
||||
|
@ -205,5 +205,5 @@ U0 AsmHashLoad()
|
|||
HashAdd(tmpc,cmp.asm_hash);
|
||||
cmp.internal_types[tmpc->raw_type]=tmpc;
|
||||
}
|
||||
zenith_task->hash_table->next=cmp.asm_hash;
|
||||
zenith_task->hash_table->next=cmp.asm_hash;
|
||||
}
|
||||
|
|
|
@ -21,23 +21,23 @@ extern U0 OptPass5(CCmpCtrl *cc);
|
|||
extern U0 OptPass6(CCmpCtrl *cc);
|
||||
extern I64 OptPass789A(
|
||||
CCmpCtrl *cc,COptReg *reg_offsets,U8 *buf,CDebugInfo **_dbg);
|
||||
extern CHashClass *PrsClass(
|
||||
extern CHashClass *ParseClass(
|
||||
CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern);
|
||||
extern CHashFun *PrsFunJoin(
|
||||
extern CHashFun *ParseFunJoin(
|
||||
CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags);
|
||||
extern I64 PrsKeyWord(CCmpCtrl *cc);
|
||||
extern Bool PrsStmt(CCmpCtrl *cc,I64 try_cnt=0,
|
||||
extern I64 ParseKeyWord(CCmpCtrl *cc);
|
||||
extern Bool ParseStatement(CCmpCtrl *cc,I64 try_cnt=0,
|
||||
CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON);
|
||||
extern U0 PrsStreamBlk(CCmpCtrl *cc);
|
||||
extern CHashClass *PrsType(CCmpCtrl *cc,CHashClass **_tmpc1,
|
||||
extern U0 ParseStreamBlk(CCmpCtrl *cc);
|
||||
extern CHashClass *ParseType(CCmpCtrl *cc,CHashClass **_tmpc1,
|
||||
I64 *_mode,CMemberLst *tmpm,U8 **_ident,CHashFun **_fun_ptr,
|
||||
CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags);
|
||||
extern I64 PrsUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,
|
||||
extern I64 ParseUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,
|
||||
CMemberLst **_local_var,CArrayDim **_tmpad,I64 *unary_post_prec);
|
||||
extern I64 PrsUnaryTerm(
|
||||
extern I64 ParseUnaryTerm(
|
||||
CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,CArrayDim **_tmpad,
|
||||
I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec);
|
||||
extern U0 PrsVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
||||
extern U0 ParseVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
||||
CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass);
|
||||
_extern CMP_TEMPLATES U32 cmp_templates[1];
|
||||
_extern CMP_TEMPLATES_DONT_POP U32 cmp_templates_dont_pop[1];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
U8 *LexStmt2Bin(CCmpCtrl *cc,I64 *_type,I64 cmp_flags=0)
|
||||
U8 *LexStatement2Bin(CCmpCtrl *cc,I64 *_type,I64 cmp_flags=0)
|
||||
{//Compile one cc stmt to bin code.
|
||||
I64 size,i,j,k,*res=INVALID_PTR;
|
||||
CCodeCtrl *tmpcbh;
|
||||
|
@ -7,7 +7,7 @@ U8 *LexStmt2Bin(CCmpCtrl *cc,I64 *_type,I64 cmp_flags=0)
|
|||
if (cc->aot_depth==2)
|
||||
COCPush(cc);
|
||||
COCInit(cc);
|
||||
if (!PrsStmt(cc,,,cmp_flags)) {
|
||||
if (!ParseStatement(cc,,,cmp_flags)) {
|
||||
if (cc->coc.coc_head.next!=&cc->coc.coc_head) {
|
||||
cc->coc.coc_head.last->ic_flags&=~ICF_RES_NOT_USED;
|
||||
ICAdd(cc,IC_RETURN_VAL2,0,0);
|
||||
|
@ -81,7 +81,7 @@ CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
|
|||
cmp_flags|=CMPF_PRS_SEMICOLON;
|
||||
if (cc->flags&CCF_AOT_COMPILE) {
|
||||
while (cc->token!=TK_EOF) {
|
||||
buf=LexStmt2Bin(cc,NULL,cmp_flags);
|
||||
buf=LexStatement2Bin(cc,NULL,cmp_flags);
|
||||
if (buf!=INVALID_PTR) {
|
||||
tmpie=CAlloc(sizeof(CAOTImportExport));
|
||||
tmpie->type=IET_MAIN;
|
||||
|
@ -92,7 +92,7 @@ CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
|
|||
break;
|
||||
}
|
||||
} else
|
||||
PrsStmt(cc,,,cmp_flags);
|
||||
ParseStatement(cc,,,cmp_flags);
|
||||
AOTGlblsResolve(cc,res);
|
||||
} catch {
|
||||
if (Fs->except_ch=='Compiler' && !(cmp_flags&CMPF_ASM_BLK)) {
|
||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -21,17 +21,17 @@ CCmpGlbls cmp;
|
|||
CUAsmGlbls uasm;
|
||||
#include "CHash"
|
||||
#include "UAsm"
|
||||
#include "PrsLib"
|
||||
#include "ParseLib"
|
||||
#include "AsmInit"
|
||||
#include "AsmLib"
|
||||
#include "AsmResolve"
|
||||
#include "Asm"
|
||||
#include "OptLib"
|
||||
#include "PrsExp"
|
||||
#include "PrsVar"
|
||||
#include "ParseExp"
|
||||
#include "ParseVar"
|
||||
#include "CMisc"
|
||||
#include "CMain"
|
||||
#include "PrsStmt"
|
||||
#include "ParseStatement"
|
||||
#include "OptPass012"
|
||||
#include "OptPass3"
|
||||
#include "OptPass4"
|
||||
|
|
|
@ -50,7 +50,7 @@ public extern U0 LexPutLine(CCmpCtrl *cc,U8 *start);
|
|||
public extern U0 LexPutPos(CCmpCtrl *cc);
|
||||
public extern U0 LexPutToken(CCmpCtrl *cc);
|
||||
public extern U0 LexSkipEol(CCmpCtrl *cc);
|
||||
public extern U8 *LexStmt2Bin(
|
||||
public extern U8 *LexStatement2Bin(
|
||||
CCmpCtrl *cc,I64 *_type,I64 cmp_flags=CMPF_PRS_SEMICOLON);
|
||||
public extern U0 LexWarn(CCmpCtrl *cc,U8 *str=NULL);
|
||||
extern CMemberLst *MemberClassBaseFind(
|
||||
|
@ -60,7 +60,7 @@ extern U0 MemberLstDel(CMemberLst *tmpm);
|
|||
public extern I64 MemberMetaData(U8 *st,CMemberLst *ml);
|
||||
public extern CMemberLstMeta *MemberMetaFind(U8 *st,CMemberLst *ml);
|
||||
public extern CHashClass *OptClassFwd(CHashClass *tmpc);
|
||||
public extern I64 PrsKeyWord(CCmpCtrl *cc);
|
||||
public extern I64 ParseKeyWord(CCmpCtrl *cc);
|
||||
|
||||
#help_index "Compiler;Cmd Line (Typically)"
|
||||
extern I64 Cmp(U8 *filename,
|
||||
|
|
|
@ -816,7 +816,7 @@ lex_else:
|
|||
if (ch=='#') {
|
||||
if (!Lex(cc))
|
||||
goto lex_end;
|
||||
i=PrsKeyWord(cc);
|
||||
i=ParseKeyWord(cc);
|
||||
if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
|
||||
i==KW_IFAOT || i==KW_IFJIT)
|
||||
j++;
|
||||
|
@ -867,7 +867,7 @@ lex_if:
|
|||
if (ch=='#') {
|
||||
if (!Lex(cc))
|
||||
goto lex_end;
|
||||
i=PrsKeyWord(cc);
|
||||
i=ParseKeyWord(cc);
|
||||
if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
|
||||
i==KW_IFAOT || i==KW_IFJIT)
|
||||
j++;
|
||||
|
@ -906,7 +906,7 @@ lex_ifdef:
|
|||
if (ch=='#') {
|
||||
if (!Lex(cc))
|
||||
goto lex_end;
|
||||
i=PrsKeyWord(cc);
|
||||
i=ParseKeyWord(cc);
|
||||
if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
|
||||
i==KW_IFAOT || i==KW_IFJIT)
|
||||
j++;
|
||||
|
@ -943,7 +943,7 @@ lex_ifndef:
|
|||
if (ch=='#') {
|
||||
if (!Lex(cc))
|
||||
goto lex_end;
|
||||
i=PrsKeyWord(cc);
|
||||
i=ParseKeyWord(cc);
|
||||
if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
|
||||
i==KW_IFAOT || i==KW_IFJIT)
|
||||
j++;
|
||||
|
@ -972,7 +972,7 @@ lex_ifaot:
|
|||
if (ch=='#') {
|
||||
if (!Lex(cc))
|
||||
goto lex_end;
|
||||
i=PrsKeyWord(cc);
|
||||
i=ParseKeyWord(cc);
|
||||
if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
|
||||
i==KW_IFAOT || i==KW_IFJIT)
|
||||
j++;
|
||||
|
@ -1001,7 +1001,7 @@ lex_ifjit:
|
|||
if (ch=='#') {
|
||||
if (!Lex(cc))
|
||||
goto lex_end;
|
||||
i=PrsKeyWord(cc);
|
||||
i=ParseKeyWord(cc);
|
||||
if (i==KW_IF || i==KW_IFDEF || i==KW_IFNDEF ||
|
||||
i==KW_IFAOT || i==KW_IFJIT)
|
||||
j++;
|
||||
|
@ -1031,7 +1031,7 @@ lex_ifjit:
|
|||
case KW_EXE:
|
||||
if (!Lex(cc))
|
||||
goto lex_end;
|
||||
PrsStreamBlk(cc);
|
||||
ParseStreamBlk(cc);
|
||||
goto lex_end;
|
||||
case KW_HELP_INDEX:
|
||||
if (Lex(cc)!=TK_STR)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Pass#0
|
||||
When parsing the arg expressions to a function
|
||||
call, there is a call to OptPass012 to determine
|
||||
the type of the expression. $LK,"OptPass012",A="FF:::/Compiler/PrsExp.HC,OptPass012"$
|
||||
the type of the expression. $LK,"OptPass012",A="FF:::/Compiler/ParseExp.HC,OptPass012"$
|
||||
|
||||
Pass#1&2
|
||||
Constant expressions are simplified.
|
||||
|
@ -50,15 +50,15 @@ args.
|
|||
ps->ptr-=tmpi->ic_data>>2;
|
||||
break;
|
||||
case IS_2_ARG:
|
||||
tmpi2=PrsPop(ps);
|
||||
tmpi2=ParsePop(ps);
|
||||
tmpc2=tmpi2->ic_class;
|
||||
tmpi->t.arg2_tree=tmpi2;
|
||||
tmpi->t.arg2_class=PrsPop(ps);
|
||||
tmpi->t.arg2_class=ParsePop(ps);
|
||||
case IS_1_ARG:
|
||||
tmpi1=PrsPop(ps);
|
||||
tmpi1=ParsePop(ps);
|
||||
tmpc1=tmpi1->ic_class;
|
||||
tmpi->t.arg1_tree=tmpi1;
|
||||
tmpi->t.arg1_class=PrsPop(ps);
|
||||
tmpi->t.arg1_class=ParsePop(ps);
|
||||
break;
|
||||
case IS_0_ARG: //nobound switch
|
||||
break;
|
||||
|
@ -1265,8 +1265,8 @@ args.
|
|||
}
|
||||
}
|
||||
if (intermediate_code_table[tmpi_push->ic_code].res_cnt) {
|
||||
PrsPush(ps,tmpi->ic_class2);
|
||||
PrsPush(ps,tmpi_push);
|
||||
ParsePush(ps,tmpi->ic_class2);
|
||||
ParsePush(ps,tmpi_push);
|
||||
}
|
||||
if (tmpi->ic_class) {
|
||||
if (tmpi->ic_class->raw_type==RT_F64)
|
||||
|
|
|
@ -66,7 +66,7 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
|
|||
ps->ptr-=tmpi->ic_data>>3;
|
||||
break;
|
||||
case IS_2_ARG:
|
||||
tmpi2=PrsPop(ps);
|
||||
tmpi2=ParsePop(ps);
|
||||
if (tmpi2->ic_flags&ICF_RES_TO_F64)
|
||||
tmpc2=cmp.internal_types[RT_F64];
|
||||
else if (tmpi2->ic_flags & ICF_RES_TO_INT)
|
||||
|
@ -76,7 +76,7 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
|
|||
tmpi->arg2.type=MDF_STK+CmpRawType(tmpc2);
|
||||
tmpi->ic_flags|=ICF_ARG2_WAS_STK;
|
||||
case IS_1_ARG:
|
||||
tmpi1=PrsPop(ps);
|
||||
tmpi1=ParsePop(ps);
|
||||
if (tmpi1->ic_flags&ICF_RES_TO_F64)
|
||||
tmpc1=cmp.internal_types[RT_F64];
|
||||
else if (tmpi1->ic_flags & ICF_RES_TO_INT)
|
||||
|
@ -93,7 +93,7 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
|
|||
if (intermediate_code_table[code].res_cnt) {
|
||||
tmpi->res.type=MDF_STK+CmpRawType(tmpc);
|
||||
tmpi->ic_flags|=ICF_RES_WAS_STK;
|
||||
PrsPush(ps,tmpi);
|
||||
ParsePush(ps,tmpi);
|
||||
}
|
||||
switch [code] {
|
||||
case IC_IMM_F64:
|
||||
|
|
|
@ -171,10 +171,10 @@ U0 OptPass4(CCmpCtrl *cc,COptReg *reg_offsets,I64 *_type)
|
|||
ps->ptr-=tmpi->ic_data>>3;
|
||||
break;
|
||||
case IS_2_ARG:
|
||||
tmpi2=PrsPop(ps);
|
||||
tmpi2=ParsePop(ps);
|
||||
tmpc2=tmpi2->ic_class;
|
||||
case IS_1_ARG:
|
||||
tmpi1=PrsPop(ps);
|
||||
tmpi1=ParsePop(ps);
|
||||
tmpc1=tmpi1->ic_class;
|
||||
break;
|
||||
case IS_0_ARG: //nobound switch
|
||||
|
@ -677,7 +677,7 @@ p4_sib:
|
|||
while (OptIC4(tmpi));
|
||||
code=tmpi->ic_code;
|
||||
if (intermediate_code_table[code].res_cnt)
|
||||
PrsPush(ps,tmpi);
|
||||
ParsePush(ps,tmpi);
|
||||
}
|
||||
}
|
||||
tmpi=tmpi_next;
|
||||
|
|
|
@ -27,7 +27,7 @@ U0 OptPass5(CCmpCtrl *cc)
|
|||
ps->ptr--;
|
||||
}
|
||||
if (tmpi->arg2.type&MDF_STK) {
|
||||
tmpi1=PrsPop(ps);
|
||||
tmpi1=ParsePop(ps);
|
||||
if (tmpi1->ic_code==IC_MOV || tmpi1->ic_code==IC_REG) {
|
||||
if (tmpi1->ic_flags & ICF_RES_TO_INT) {
|
||||
if (tmpi1->arg1.type&MDF_IMM)
|
||||
|
@ -51,7 +51,7 @@ U0 OptPass5(CCmpCtrl *cc)
|
|||
}
|
||||
|
||||
if (tmpi->arg1.type&MDF_STK) {
|
||||
tmpi1=PrsPop(ps);
|
||||
tmpi1=ParsePop(ps);
|
||||
if (tmpi1->ic_code==IC_MOV || tmpi1->ic_code==IC_REG) {
|
||||
if (tmpi1->ic_flags & ICF_RES_TO_INT) {
|
||||
if (tmpi1->arg1.type&MDF_IMM)
|
||||
|
@ -79,7 +79,7 @@ U0 OptPass5(CCmpCtrl *cc)
|
|||
}
|
||||
if (tmpi->res.type&MDF_STK &&
|
||||
!(tmpi->ic_flags&ICF_RES_NOT_USED))
|
||||
PrsPush(ps,tmpi);
|
||||
ParsePush(ps,tmpi);
|
||||
}
|
||||
tmpi=tmpi->next;
|
||||
}
|
||||
|
|
|
@ -50,14 +50,14 @@ U0 OptPass6Lag(CCmpCtrl *cc,CPrsStk *ps,CIntermediateCode *tmpi,
|
|||
}
|
||||
}
|
||||
tmpi->ic_data=clobbered_stk_tmp_mask;
|
||||
PrsPush(ps,stk_ptr);
|
||||
PrsPush(ps,clobbered_stk_tmp_mask);
|
||||
ParsePush(ps,stk_ptr);
|
||||
ParsePush(ps,clobbered_stk_tmp_mask);
|
||||
} else if (code==IC_CALL_END) {
|
||||
tmpi->ic_data=PrsPop(ps);
|
||||
stk_ptr=PrsPop(ps);
|
||||
tmpi->ic_data=ParsePop(ps);
|
||||
stk_ptr=ParsePop(ps);
|
||||
} else if (code==IC_CALL_END2) {
|
||||
ps->ptr--;
|
||||
stk_ptr=PrsPop(ps);
|
||||
stk_ptr=ParsePop(ps);
|
||||
}
|
||||
if (intermediate_code_table[code].arg_cnt==IS_V_ARG)
|
||||
stk_ptr-=tmpi->ic_data>>3;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define PE_POP_ALL1 11
|
||||
#define PE_POP_ALL2 12
|
||||
|
||||
CIntermediateCode *PrsAddOp(CCmpCtrl *cc,I64 stk_op,CHashClass *tmpc)
|
||||
CIntermediateCode *ParseAddOp(CCmpCtrl *cc,I64 stk_op,CHashClass *tmpc)
|
||||
{
|
||||
CIntermediateCode *tmpi=cc->coc.coc_head.last;
|
||||
Bool div_sizeof=FALSE;
|
||||
|
@ -62,7 +62,7 @@ CIntermediateCode *PrsAddOp(CCmpCtrl *cc,I64 stk_op,CHashClass *tmpc)
|
|||
return tmpi;
|
||||
}
|
||||
|
||||
U0 PrsExpression2(CCmpCtrl *cc,I64 *_max_prec,CPrsStk *ps)
|
||||
U0 ParseExpression2(CCmpCtrl *cc,I64 *_max_prec,CPrsStk *ps)
|
||||
{
|
||||
I64 i,cur_op,stk_op,state,max_prec=PREC_NULL,unary_pre_prec,paren_prec,
|
||||
unary_post_prec,left_prec=PREC_MAX;
|
||||
|
@ -81,16 +81,16 @@ pe_unary_term1:
|
|||
cc->flags&=~(CCF_PAREN+CCF_PREINC+CCF_PREDEC+CCF_POSTINC+
|
||||
CCF_POSTDEC+CCF_FUN_EXP);
|
||||
case PE_UNARY_TERM2:
|
||||
state=PrsUnaryTerm(cc,ps,&local_var,&tmpad,
|
||||
state=ParseUnaryTerm(cc,ps,&local_var,&tmpad,
|
||||
&max_prec,&unary_pre_prec,&paren_prec);
|
||||
break;
|
||||
case PE_UNARY_MODIFIERS:
|
||||
state=PrsUnaryModifier(cc,ps,&local_var,&tmpad,&unary_post_prec);
|
||||
state=ParseUnaryModifier(cc,ps,&local_var,&tmpad,&unary_post_prec);
|
||||
break;
|
||||
case PE_MAYBE_MODIFIERS:
|
||||
if (cc->token=='(') { //Typecast or fun_ptr
|
||||
cc->flags|=CCF_RAX;
|
||||
state=PrsUnaryModifier(cc,ps,&local_var,&tmpad,&unary_post_prec);
|
||||
state=ParseUnaryModifier(cc,ps,&local_var,&tmpad,&unary_post_prec);
|
||||
} else
|
||||
goto pe_check_binary_ops1;
|
||||
break;
|
||||
|
@ -130,8 +130,8 @@ pe_check_binary_ops1:
|
|||
|
||||
case PE_CHECK_BINARY_OPS2:
|
||||
pe_check_binary_ops2:
|
||||
stk_op=PrsPop(ps);
|
||||
tmpc=PrsPop(ps);
|
||||
stk_op=ParsePop(ps);
|
||||
tmpc=ParsePop(ps);
|
||||
if (!(0<stk_op.u8[2]<=PREC_UNARY_PRE+ASSOC_MASK))
|
||||
goto pe_do_binary_op;
|
||||
|
||||
|
@ -140,10 +140,10 @@ pe_check_binary_ops2:
|
|||
stk_op.u16[0]==IC_UNARY_MINUS) {
|
||||
Lex(cc); //skip ` op
|
||||
left_prec=cur_op.i8[2];
|
||||
PrsPush(ps,tmpc);
|
||||
PrsPush(ps,stk_op);
|
||||
PrsPush(ps,cc->coc.coc_head.last->ic_class);
|
||||
PrsPush(ps,cur_op);
|
||||
ParsePush(ps,tmpc);
|
||||
ParsePush(ps,stk_op);
|
||||
ParsePush(ps,cc->coc.coc_head.last->ic_class);
|
||||
ParsePush(ps,cur_op);
|
||||
goto pe_unary_term1;
|
||||
} else {
|
||||
tmpi=cc->coc.coc_head.last;
|
||||
|
@ -164,8 +164,8 @@ pe_check_binary_ops2:
|
|||
|
||||
case PE_DO_BINARY_OP:
|
||||
pe_do_binary_op:
|
||||
PrsPush(ps,tmpc);
|
||||
PrsPush(ps,stk_op);
|
||||
ParsePush(ps,tmpc);
|
||||
ParsePush(ps,stk_op);
|
||||
if (!cur_op)
|
||||
goto pe_pop_all1;
|
||||
|
||||
|
@ -210,8 +210,8 @@ pe_do_binary_op:
|
|||
|
||||
case PE_POP_HIGHER:
|
||||
pe_pop_higher:
|
||||
stk_op=PrsPop(ps); //pop ops of higher prec
|
||||
tmpc=PrsPop(ps);
|
||||
stk_op=ParsePop(ps); //pop ops of higher prec
|
||||
tmpc=ParsePop(ps);
|
||||
if (!stk_op)
|
||||
goto pe_push_lower;
|
||||
else if (cur_op.u8[2]&~ASSOC_MASK==stk_op.u8[2]&~ASSOC_MASK) {
|
||||
|
@ -220,7 +220,7 @@ pe_pop_higher:
|
|||
} else if (cur_op.u8[2]&~ASSOC_MASK<=stk_op.u8[2]&~ASSOC_MASK)
|
||||
goto pe_push_lower;
|
||||
|
||||
tmpi=PrsAddOp(cc,stk_op,tmpc);
|
||||
tmpi=ParseAddOp(cc,stk_op,tmpc);
|
||||
|
||||
if (intermediate_code_table[cur_op.u16[0]].type==IST_CMP &&
|
||||
intermediate_code_table[stk_op.u16[0]].type==IST_CMP) {
|
||||
|
@ -234,10 +234,10 @@ pe_pop_higher:
|
|||
|
||||
case PE_PUSH_LOWER:
|
||||
pe_push_lower:
|
||||
PrsPush(ps,tmpc);
|
||||
PrsPush(ps,stk_op);
|
||||
PrsPush(ps,cc->coc.coc_head.last->ic_class);
|
||||
PrsPush(ps,cur_op);
|
||||
ParsePush(ps,tmpc);
|
||||
ParsePush(ps,stk_op);
|
||||
ParsePush(ps,cc->coc.coc_head.last->ic_class);
|
||||
ParsePush(ps,cur_op);
|
||||
goto pe_unary_term1;
|
||||
|
||||
case PE_POP_ALL1:
|
||||
|
@ -248,11 +248,11 @@ pe_pop_all1:
|
|||
ParenWarning(cc);
|
||||
case PE_POP_ALL2:
|
||||
pe_pop_all2:
|
||||
stk_op=PrsPop(ps);
|
||||
tmpc=PrsPop(ps);
|
||||
stk_op=ParsePop(ps);
|
||||
tmpc=ParsePop(ps);
|
||||
if (!stk_op.u16[0])
|
||||
goto pe_done;
|
||||
PrsAddOp(cc,stk_op,tmpc);
|
||||
ParseAddOp(cc,stk_op,tmpc);
|
||||
goto pe_pop_all2;
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ pe_done:
|
|||
*_max_prec=max_prec;
|
||||
}
|
||||
|
||||
Bool PrsExpression(CCmpCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStk *_ps=NULL)
|
||||
Bool ParseExpression(CCmpCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStk *_ps=NULL)
|
||||
{
|
||||
Bool res=TRUE;
|
||||
I64 old_flags=cc->flags;
|
||||
|
@ -273,11 +273,11 @@ Bool PrsExpression(CCmpCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStk *_ps=NULL)
|
|||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
}
|
||||
PrsPush(ps,0); //terminate
|
||||
PrsPush(ps,0); //terminate
|
||||
ParsePush(ps,0); //terminate
|
||||
ParsePush(ps,0); //terminate
|
||||
try
|
||||
//try catch causes noreg vars in function
|
||||
PrsExpression2(cc,_max_prec,ps);
|
||||
ParseExpression2(cc,_max_prec,ps);
|
||||
catch {
|
||||
if (Fs->except_ch=='Compiler') {
|
||||
res=FALSE;
|
||||
|
@ -300,7 +300,7 @@ Bool PrsExpression(CCmpCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStk *_ps=NULL)
|
|||
return res;
|
||||
}
|
||||
|
||||
U0 PrsSizeOf(CCmpCtrl *cc)
|
||||
U0 ParseSizeOf(CCmpCtrl *cc)
|
||||
{
|
||||
CHashClass *tmpc;
|
||||
CMemberLst *tmpm;
|
||||
|
@ -350,7 +350,7 @@ pu_sizeof_member:
|
|||
ICAdd(cc,IC_IMM_I64,i,cmp.internal_types[RT_I64]);
|
||||
}
|
||||
|
||||
U0 PrsOffsetOf(CCmpCtrl *cc)
|
||||
U0 ParseOffsetOf(CCmpCtrl *cc)
|
||||
{
|
||||
CHashClass *tmpc;
|
||||
CMemberLst *tmpm;
|
||||
|
@ -380,7 +380,7 @@ U0 PrsOffsetOf(CCmpCtrl *cc)
|
|||
ICAdd(cc,IC_IMM_I64,i,cmp.internal_types[RT_I64]);
|
||||
}
|
||||
|
||||
I64 PrsFunCall(CCmpCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
|
||||
I64 ParseFunCall(CCmpCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
|
||||
{
|
||||
I64 i,argc_cnt,dft_val;
|
||||
Bool is_first_arg=TRUE,needs_right_paren,is_print,is_putchars,
|
||||
|
@ -467,7 +467,7 @@ I64 PrsFunCall(CCmpCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
|
|||
} else
|
||||
ICAdd(cc,IC_IMM_I64,dft_val,tmpm->member_class);
|
||||
} else {
|
||||
if (!PrsExpression(cc,NULL,FALSE,ps))
|
||||
if (!ParseExpression(cc,NULL,FALSE,ps))
|
||||
throw('Compiler');
|
||||
else {
|
||||
COCPush(cc);
|
||||
|
@ -502,7 +502,7 @@ I64 PrsFunCall(CCmpCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
|
|||
LexExcept(cc,"Expecting ',' at ");
|
||||
}
|
||||
COCInit(cc);
|
||||
if (!PrsExpression(cc,NULL,FALSE,ps))
|
||||
if (!ParseExpression(cc,NULL,FALSE,ps))
|
||||
throw('Compiler');
|
||||
COCPush(cc);
|
||||
is_first_arg=FALSE;
|
||||
|
@ -519,7 +519,7 @@ I64 PrsFunCall(CCmpCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
|
|||
LexExcept(cc,"Expecting ',' at ");
|
||||
}
|
||||
COCInit(cc);
|
||||
if (!PrsExpression(cc,NULL,FALSE,ps))
|
||||
if (!ParseExpression(cc,NULL,FALSE,ps))
|
||||
throw('Compiler');
|
||||
COCPush(cc);
|
||||
is_first_arg=FALSE;
|
||||
|
@ -590,7 +590,7 @@ I64 PrsFunCall(CCmpCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
|
|||
return PE_UNARY_MODIFIERS;
|
||||
}
|
||||
|
||||
I64 PrsUnaryTerm(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
||||
I64 ParseUnaryTerm(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
||||
CArrayDim **_tmpad,I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec)
|
||||
{
|
||||
I64 i,j;
|
||||
|
@ -671,8 +671,8 @@ I64 PrsUnaryTerm(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
|||
i=IC_ADDR;
|
||||
break;
|
||||
end:
|
||||
PrsPush(ps,tmpc);
|
||||
PrsPush(ps,PREC_UNARY_PRE<<16+i);
|
||||
ParsePush(ps,tmpc);
|
||||
ParsePush(ps,PREC_UNARY_PRE<<16+i);
|
||||
return PE_UNARY_TERM2;
|
||||
|
||||
start:
|
||||
|
@ -736,7 +736,7 @@ I64 PrsUnaryTerm(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
|||
paren_warn=FALSE;
|
||||
else
|
||||
paren_warn=TRUE;
|
||||
if (!PrsExpression(cc,paren_prec,FALSE,ps))
|
||||
if (!ParseExpression(cc,paren_prec,FALSE,ps))
|
||||
throw('Compiler');
|
||||
if (!paren_warn)
|
||||
*paren_prec=PREC_NULL;
|
||||
|
@ -765,9 +765,9 @@ I64 PrsUnaryTerm(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
|||
cc->flags&=~(CCF_RAX|CCF_ARRAY|CCF_FUN_EXP);
|
||||
tmpc=tmpm->member_class+1;
|
||||
if (tmpm->flags & MLF_FUN && !(cc->flags&CCF_ASM_EXPRESSIONS)) {
|
||||
PrsPopDeref(ps);
|
||||
ParsePopDeref(ps);
|
||||
cc->flags|=CCF_FUN_EXP;
|
||||
PrsPush2(ps,tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
|
||||
ParsePush2(ps,tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
|
||||
}
|
||||
if (tmpm->dim.next) {
|
||||
*_tmpad=tmpm->dim.next;
|
||||
|
@ -783,7 +783,7 @@ I64 PrsUnaryTerm(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
|||
ICAdd(cc,IC_IMM_I64,tmpm->static_data,tmpc);
|
||||
} else {
|
||||
if (cc->flags&CCF_ASM_EXPRESSIONS) {
|
||||
i=PrsPop(ps);
|
||||
i=ParsePop(ps);
|
||||
ps->ptr--;
|
||||
if (i.u16[0]!=IC_ADDR)
|
||||
LexExcept(cc,"Expecting '&' at ");
|
||||
|
@ -863,7 +863,7 @@ pu_export_sys_sym:
|
|||
if (PREC_TERM>*max_prec)
|
||||
*max_prec=PREC_TERM;
|
||||
Lex(cc); //skip fun name
|
||||
return PrsFunCall(cc,ps,FALSE,tmpex);
|
||||
return ParseFunCall(cc,ps,FALSE,tmpex);
|
||||
case HTt_GLBL_VAR:
|
||||
if (PREC_TERM>*max_prec)
|
||||
*max_prec=PREC_TERM;
|
||||
|
@ -897,13 +897,13 @@ pu_export_sys_sym:
|
|||
}
|
||||
Lex(cc);
|
||||
if (tmpg->flags & GVF_FUN) {
|
||||
PrsPopDeref(ps);
|
||||
ParsePopDeref(ps);
|
||||
cc->flags|=CCF_FUN_EXP;
|
||||
PrsPush2(ps,tmpg->fun_ptr-tmpg->fun_ptr->ptr_stars_cnt);
|
||||
ParsePush2(ps,tmpg->fun_ptr-tmpg->fun_ptr->ptr_stars_cnt);
|
||||
}
|
||||
return PE_UNARY_MODIFIERS;
|
||||
case HTt_CLASS:
|
||||
PrsOffsetOf(cc);
|
||||
ParseOffsetOf(cc);
|
||||
return PE_MAYBE_MODIFIERS;
|
||||
case HTt_KEYWORD:
|
||||
switch (tmpex(CHashGeneric *)->user_data0) {
|
||||
|
@ -913,7 +913,7 @@ pu_export_sys_sym:
|
|||
j=0;
|
||||
while (Lex(cc)=='(')
|
||||
j++;
|
||||
PrsSizeOf(cc);
|
||||
ParseSizeOf(cc);
|
||||
while (j--) {
|
||||
if (cc->token!=')')
|
||||
LexExcept(cc,"Missing ')' at ");
|
||||
|
@ -926,7 +926,7 @@ pu_export_sys_sym:
|
|||
j=0;
|
||||
while (Lex(cc)=='(')
|
||||
j++;
|
||||
PrsOffsetOf(cc);
|
||||
ParseOffsetOf(cc);
|
||||
while (j--) {
|
||||
if (cc->token!=')')
|
||||
LexExcept(cc,"Missing ')' at ");
|
||||
|
@ -957,7 +957,7 @@ pu_export_sys_sym:
|
|||
LexExcept(cc,"Missing expression at ");
|
||||
}
|
||||
|
||||
I64 PrsUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
||||
I64 ParseUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
||||
CArrayDim **_tmpad,I64 *unary_post_prec)
|
||||
{
|
||||
CHashClass *tmpc,*tmpc1;
|
||||
|
@ -1007,8 +1007,8 @@ I64 PrsUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
|||
cc->flags|=CCF_ARRAY;
|
||||
}
|
||||
if(tmpm->flags & MLF_FUN) {
|
||||
PrsPopDeref(ps);
|
||||
PrsPush2(ps,tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
|
||||
ParsePopDeref(ps);
|
||||
ParsePush2(ps,tmpm->fun_ptr-tmpm->fun_ptr->ptr_stars_cnt);
|
||||
cc->flags|=CCF_FUN_EXP;
|
||||
}
|
||||
ICAdd(cc,IC_ADD,0,tmpc1);
|
||||
|
@ -1017,7 +1017,7 @@ I64 PrsUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
|||
if (cc->flags & CCF_FUN_EXP) {
|
||||
if (!*unary_post_prec)
|
||||
*unary_post_prec=PREC_TERM;
|
||||
return PrsFunCall(cc,ps,TRUE,PrsPop2(ps));
|
||||
return ParseFunCall(cc,ps,TRUE,ParsePop2(ps));
|
||||
}
|
||||
if (!*unary_post_prec)
|
||||
*unary_post_prec=PREC_TERM;
|
||||
|
@ -1029,11 +1029,11 @@ I64 PrsUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
|||
tmpc=cc->hash_entry;
|
||||
Lex(cc);
|
||||
mode=PRS0_TYPECAST|PRS1_NULL;
|
||||
tmpc=PrsType(cc,&tmpc,&mode,NULL,NULL,&fun_ptr,NULL,&tmpad2,0);
|
||||
tmpc=ParseType(cc,&tmpc,&mode,NULL,NULL,&fun_ptr,NULL,&tmpad2,0);
|
||||
if (fun_ptr) {
|
||||
PrsPopDeref(ps);
|
||||
ParsePopDeref(ps);
|
||||
Bts(&cc->flags,CCf_FUN_EXP);
|
||||
PrsPush2(ps,fun_ptr);
|
||||
ParsePush2(ps,fun_ptr);
|
||||
cm=COCMiscNew(cc,CMT_HASH_ENTRY);
|
||||
cm->h=fun_ptr;
|
||||
}
|
||||
|
@ -1070,7 +1070,7 @@ I64 PrsUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
|||
ICAdd(cc,IC_IMM_I64,tmpad1->total_cnt*tmpc1->size,tmpc);
|
||||
if (*_tmpad=tmpad1->next) {
|
||||
old_flags=cc->flags;
|
||||
if (!PrsExpression(cc,NULL,FALSE,ps))
|
||||
if (!ParseExpression(cc,NULL,FALSE,ps))
|
||||
throw('Compiler');
|
||||
cc->flags=cc->flags&~CCF_FUN_EXP|old_flags&CCF_FUN_EXP;
|
||||
if (cc->token!=']')
|
||||
|
@ -1086,7 +1086,7 @@ I64 PrsUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
|
|||
} else
|
||||
ICAdd(cc,IC_IMM_I64,tmpc1->size,tmpc);
|
||||
old_flags=cc->flags;
|
||||
if (!PrsExpression(cc,NULL,FALSE,ps))
|
||||
if (!ParseExpression(cc,NULL,FALSE,ps))
|
||||
throw('Compiler');
|
||||
cc->flags=cc->flags&~CCF_FUN_EXP|old_flags&CCF_FUN_EXP;
|
||||
if (cc->token!=']')
|
||||
|
@ -1121,7 +1121,7 @@ U8 *LexExpression2Bin(CCmpCtrl *cc,I64 *_type=NULL)
|
|||
Bool old_trace=Btr(&cc->flags,CCf_PASS_TRACE_PRESENT);
|
||||
COCPush(cc);
|
||||
COCInit(cc);
|
||||
if (PrsExpression(cc,NULL,FALSE)) {
|
||||
if (ParseExpression(cc,NULL,FALSE)) {
|
||||
ICAdd(cc,IC_RETURN_VAL,0,0);
|
||||
ICAdd(cc,IC_RET,0,0);
|
||||
res=COCCompile(cc,&size,NULL,_type);
|
|
@ -1,34 +1,34 @@
|
|||
U0 PrsPush(CPrsStk *ps,I64 val)
|
||||
U0 ParsePush(CPrsStk *ps,I64 val)
|
||||
{
|
||||
ps->stk[++ps->ptr]=val;
|
||||
}
|
||||
|
||||
I64 PrsPop(CPrsStk *ps)
|
||||
I64 ParsePop(CPrsStk *ps)
|
||||
{
|
||||
return ps->stk[ps->ptr--];
|
||||
}
|
||||
|
||||
U0 PrsPush2(CPrsStk *ps,I64 val)
|
||||
U0 ParsePush2(CPrsStk *ps,I64 val)
|
||||
{
|
||||
ps->stk2[++ps->ptr2]=val;
|
||||
}
|
||||
|
||||
I64 PrsPop2(CPrsStk *ps)
|
||||
I64 ParsePop2(CPrsStk *ps)
|
||||
{
|
||||
return ps->stk2[ps->ptr2--];
|
||||
}
|
||||
|
||||
U0 PrsPopDeref(CPrsStk *ps)
|
||||
U0 ParsePopDeref(CPrsStk *ps)
|
||||
{
|
||||
I64 i=PrsPop(ps);
|
||||
CHashClass *tmpc=PrsPop(ps);
|
||||
I64 i=ParsePop(ps);
|
||||
CHashClass *tmpc=ParsePop(ps);
|
||||
if (i.u16[0]!=IC_DEREF) {
|
||||
PrsPush(ps,tmpc);
|
||||
PrsPush(ps,i);
|
||||
ParsePush(ps,tmpc);
|
||||
ParsePush(ps,i);
|
||||
}
|
||||
}
|
||||
|
||||
I64 PrsKeyWord(CCmpCtrl *cc)
|
||||
I64 ParseKeyWord(CCmpCtrl *cc)
|
||||
{//Cvt cur token to $LK,"KEYWORD",A="FF:::/Compiler/OpCodes.DD,KEYWORD"$ or -1.
|
||||
CHashGeneric *tmph;
|
||||
if (cc->token==TK_IDENT &&(tmph=cc->hash_entry) && tmph->type&HTT_KEYWORD)
|
||||
|
@ -37,7 +37,7 @@ I64 PrsKeyWord(CCmpCtrl *cc)
|
|||
return -1;
|
||||
}
|
||||
|
||||
CHashClass *PrsClassNew()
|
||||
CHashClass *ParseClassNew()
|
||||
{/*Ptrs to classes are handled by
|
||||
allocating 5 structures for each
|
||||
new class and representing a pointer
|
||||
|
@ -59,7 +59,7 @@ for one * and two fwd for two **.
|
|||
return res;
|
||||
}
|
||||
|
||||
CHashFun *PrsFunNew()
|
||||
CHashFun *ParseFunNew()
|
||||
{
|
||||
I64 i;
|
||||
CHashFun *res=CAlloc(sizeof(CHashFun)*(PTR_STARS_NUM+1),Fs->code_heap),
|
|
@ -1,10 +1,10 @@
|
|||
CHashClass *PrsClass(CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
|
||||
CHashClass *ParseClass(CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
|
||||
{
|
||||
CHashClass *tmpc,*base_class;
|
||||
if (cc->token!=TK_IDENT)
|
||||
LexExcept(cc,"Expecting identifier at ");
|
||||
if (is_extern) {
|
||||
tmpc=PrsClassNew;
|
||||
tmpc=ParseClassNew;
|
||||
tmpc->str=cc->cur_str;
|
||||
cc->cur_str=NULL;
|
||||
HashAdd(tmpc,cc->htc.glbl_hash_table);
|
||||
|
@ -28,7 +28,7 @@ CHashClass *PrsClass(CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
|
|||
Free(tmpc->idx);
|
||||
tmpc->idx=NULL;
|
||||
} else {
|
||||
tmpc=PrsClassNew;
|
||||
tmpc=ParseClassNew;
|
||||
tmpc->str=cc->cur_str;
|
||||
cc->cur_str=NULL;
|
||||
HashAdd(tmpc,cc->htc.glbl_hash_table);
|
||||
|
@ -51,15 +51,15 @@ CHashClass *PrsClass(CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
|
|||
tmpc->size+=base_class->size;
|
||||
}
|
||||
if (keyword==KW_UNION)
|
||||
PrsVarLst(cc,tmpc,PRS0_NULL|PRS1_CLASS|PRSF_UNION);
|
||||
ParseVarLst(cc,tmpc,PRS0_NULL|PRS1_CLASS|PRSF_UNION);
|
||||
else
|
||||
PrsVarLst(cc,tmpc,PRS0_NULL|PRS1_CLASS);
|
||||
ParseVarLst(cc,tmpc,PRS0_NULL|PRS1_CLASS);
|
||||
tmpc->size+=tmpc->neg_offset;
|
||||
}
|
||||
return tmpc;
|
||||
}
|
||||
|
||||
CHashFun *PrsFunJoin(CCmpCtrl *cc,CHashClass *tmp_return,
|
||||
CHashFun *ParseFunJoin(CCmpCtrl *cc,CHashClass *tmp_return,
|
||||
U8 *name,I64 fsp_flags)
|
||||
{
|
||||
CMemberLst *tmpm,*header_lst;
|
||||
|
@ -93,7 +93,7 @@ CHashFun *PrsFunJoin(CCmpCtrl *cc,CHashClass *tmp_return,
|
|||
tmpf->member_lst_and_root=NULL;
|
||||
ClassMemberLstDel(tmpf);
|
||||
} else {
|
||||
tmpf=PrsFunNew;
|
||||
tmpf=ParseFunNew;
|
||||
header_return=NULL;
|
||||
tmpf->used_reg_mask=REGG_CLOBBERED+REGG_SAVED+REGG_STK_TMP;
|
||||
tmpf->clobbered_reg_mask=REGG_CLOBBERED+REGG_STK_TMP;
|
||||
|
@ -111,7 +111,7 @@ CHashFun *PrsFunJoin(CCmpCtrl *cc,CHashClass *tmp_return,
|
|||
tmpf->return_class=tmp_return;
|
||||
tmpf->use_cnt=0;
|
||||
HashSrcFileSet(cc,tmpf);
|
||||
PrsVarLst(cc,tmpf,PRS0_NULL|PRS1_FUN_ARG);
|
||||
ParseVarLst(cc,tmpf,PRS0_NULL|PRS1_FUN_ARG);
|
||||
tmpf->arg_cnt=tmpf->member_cnt;
|
||||
if (0<tmpf->arg_cnt<<3<=I16_MAX && !Bt(&tmpf->flags,Ff_DOT_DOT_DOT))
|
||||
LBts(&tmpf->flags,Ff_RET1);
|
||||
|
@ -137,7 +137,7 @@ CHashFun *PrsFunJoin(CCmpCtrl *cc,CHashClass *tmp_return,
|
|||
return tmpf;
|
||||
}
|
||||
|
||||
U0 PrsFun(CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
|
||||
U0 ParseFun(CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
|
||||
{
|
||||
CMemberLst *tmpm;
|
||||
CCodeMisc *saved_leave_label;
|
||||
|
@ -148,7 +148,7 @@ U0 PrsFun(CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
|
|||
cc->min_line=cc->max_line=cc->lex_include_stk->line_num;
|
||||
|
||||
cc->flags&=~CCF_NO_REG_OPT;
|
||||
cc->htc.local_var_lst=cc->htc.fun=PrsFunJoin(cc,tmp_return,name,fsp_flags);
|
||||
cc->htc.local_var_lst=cc->htc.fun=ParseFunJoin(cc,tmp_return,name,fsp_flags);
|
||||
|
||||
COCPush(cc);
|
||||
Btr(&cc->flags,CCf_PASS_TRACE_PRESENT);
|
||||
|
@ -157,7 +157,7 @@ U0 PrsFun(CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
|
|||
saved_leave_label=cc->lb_leave;
|
||||
cc->lb_leave=COCMiscNew(cc,CMT_LABEL);
|
||||
cc->flags&=~CCF_HAS_RETURN;
|
||||
PrsStmt(cc,,,0);
|
||||
ParseStatement(cc,,,0);
|
||||
|
||||
if (cc->max_line<cc->min_line)
|
||||
cc->max_line=cc->min_line;
|
||||
|
@ -206,7 +206,7 @@ U0 PrsFun(CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
|
|||
cc->htc.local_var_lst=cc->htc.fun=cc->fun_lex_file=NULL;
|
||||
}
|
||||
|
||||
U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
||||
U0 ParseGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
||||
I64 saved_val,I64 fsp_flags)
|
||||
{
|
||||
I64 i,j,mode,k,val;
|
||||
|
@ -220,7 +220,7 @@ U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
|||
CArrayDim tmpad;
|
||||
Bool has_alias,undef_array_size,is_array;
|
||||
while (TRUE) {
|
||||
tmpc=PrsType(cc,&saved_tmpc,&saved_mode,NULL,&st,
|
||||
tmpc=ParseType(cc,&saved_tmpc,&saved_mode,NULL,&st,
|
||||
&tmpf_fun_ptr,&tmpex,&tmpad,fsp_flags);
|
||||
|
||||
if (!st) return;
|
||||
|
@ -242,7 +242,7 @@ U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
|||
if (cc->token=='(') {
|
||||
switch (mode&255) {
|
||||
case PRS0__INTERN:
|
||||
tmpf=PrsFunJoin(cc,tmpc,st,fsp_flags);
|
||||
tmpf=ParseFunJoin(cc,tmpc,st,fsp_flags);
|
||||
tmpf->exe_addr=val;
|
||||
Bts(&tmpf->flags,Ff_INTERNAL);
|
||||
LBtr(&tmpf->flags,Cf_EXTERN);
|
||||
|
@ -250,7 +250,7 @@ U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
|||
case PRS0__EXTERN:
|
||||
if (!(fsp_flags&FSF__) && !(mode&PRS1_NOT_REALLY__EXTERN))
|
||||
LexExcept(cc,"Expecting label with underscore at ");
|
||||
tmpf=PrsFunJoin(cc,tmpc,st,fsp_flags);
|
||||
tmpf=ParseFunJoin(cc,tmpc,st,fsp_flags);
|
||||
tmpf->exe_addr=val;
|
||||
SysSymImportsResolve(tmpf->str);
|
||||
LBtr(&tmpf->flags,Cf_EXTERN);
|
||||
|
@ -260,7 +260,7 @@ U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
|||
tmpf->type|=HTF_RESOLVE;
|
||||
return;
|
||||
case PRS0_EXTERN:
|
||||
PrsFunJoin(cc,tmpc,st,fsp_flags);
|
||||
ParseFunJoin(cc,tmpc,st,fsp_flags);
|
||||
return;
|
||||
case PRS0__IMPORT:
|
||||
if (!(fsp_flags&FSF__))
|
||||
|
@ -269,7 +269,7 @@ U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
|||
if (!(cc->flags&CCF_AOT_COMPILE))
|
||||
LexExcept(cc,"import not needed at ");
|
||||
else {
|
||||
tmpf=PrsFunJoin(cc,tmpc,st,fsp_flags);
|
||||
tmpf=ParseFunJoin(cc,tmpc,st,fsp_flags);
|
||||
tmpf->type|=HTF_IMPORT;
|
||||
if (mode&255==PRS0__IMPORT)
|
||||
tmpf->import_name=StrNew(val);
|
||||
|
@ -278,7 +278,7 @@ U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
|||
}
|
||||
return;
|
||||
default:
|
||||
PrsFun(cc,tmpc,st,fsp_flags);
|
||||
ParseFun(cc,tmpc,st,fsp_flags);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -414,7 +414,7 @@ U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
|||
LexPush(cc);
|
||||
LexPush(cc);
|
||||
Lex(cc);
|
||||
PrsGlblInit(cc,tmpg,1);
|
||||
ParseGlblInit(cc,tmpg,1);
|
||||
LexPopNoRestore(cc);
|
||||
tmpg->size=tmpg->dim.total_cnt*tmpc->size;
|
||||
if (tmphg)
|
||||
|
@ -429,7 +429,7 @@ U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
|||
}
|
||||
LexPush(cc);
|
||||
Lex(cc);
|
||||
PrsGlblInit(cc,tmpg,2);
|
||||
ParseGlblInit(cc,tmpg,2);
|
||||
if (cc->flags&CCF_AOT_COMPILE)
|
||||
for (k=0;k<tmpg->size;k++)
|
||||
AOTStoreCodeU8At(cc,tmpg->data_addr_rip+k,tmpg->data_addr[k]);
|
||||
|
@ -456,34 +456,34 @@ U0 PrsGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
|
|||
}
|
||||
}
|
||||
|
||||
U0 PrsIf(CCmpCtrl *cc,I64 try_cnt,CCodeMisc *lb_break)
|
||||
U0 ParseIf(CCmpCtrl *cc,I64 try_cnt,CCodeMisc *lb_break)
|
||||
{
|
||||
CCodeMisc *lb,*lb1;
|
||||
I64 k;
|
||||
if (cc->token!='(')
|
||||
LexExcept(cc,"Expecting '(' at ");
|
||||
Lex(cc);
|
||||
if (!PrsExpression(cc,NULL,FALSE))
|
||||
if (!ParseExpression(cc,NULL,FALSE))
|
||||
throw('Compiler');
|
||||
if (cc->token!=')')
|
||||
LexExcept(cc,"Missing ')' at ");
|
||||
Lex(cc);
|
||||
lb=COCMiscNew(cc,CMT_LABEL);
|
||||
ICAdd(cc,IC_BR_ZERO,lb,0);
|
||||
PrsStmt(cc,try_cnt,lb_break);
|
||||
k=PrsKeyWord(cc);
|
||||
ParseStatement(cc,try_cnt,lb_break);
|
||||
k=ParseKeyWord(cc);
|
||||
if (k==KW_ELSE) {
|
||||
Lex(cc);
|
||||
lb1=COCMiscNew(cc,CMT_LABEL);
|
||||
ICAdd(cc,IC_JMP,lb1,0);
|
||||
ICAdd(cc,IC_LABEL,lb,0);
|
||||
PrsStmt(cc,try_cnt,lb_break);
|
||||
ParseStatement(cc,try_cnt,lb_break);
|
||||
ICAdd(cc,IC_LABEL,lb1,0);
|
||||
} else
|
||||
ICAdd(cc,IC_LABEL,lb,0);
|
||||
}
|
||||
|
||||
U0 PrsWhile(CCmpCtrl *cc,I64 try_cnt)
|
||||
U0 ParseWhile(CCmpCtrl *cc,I64 try_cnt)
|
||||
{
|
||||
CCodeMisc *lb,*lb_done;
|
||||
if (cc->token!='(')
|
||||
|
@ -491,31 +491,31 @@ U0 PrsWhile(CCmpCtrl *cc,I64 try_cnt)
|
|||
Lex(cc);
|
||||
lb=COCMiscNew(cc,CMT_LABEL);
|
||||
ICAdd(cc,IC_LABEL,lb,0);
|
||||
if (!PrsExpression(cc,NULL,FALSE))
|
||||
if (!ParseExpression(cc,NULL,FALSE))
|
||||
throw('Compiler');
|
||||
if (cc->token!=')')
|
||||
LexExcept(cc,"Missing ')' at ");
|
||||
Lex(cc);
|
||||
lb_done=COCMiscNew(cc,CMT_LABEL);
|
||||
ICAdd(cc,IC_BR_ZERO,lb_done,0);
|
||||
PrsStmt(cc,try_cnt,lb_done);
|
||||
ParseStatement(cc,try_cnt,lb_done);
|
||||
ICAdd(cc,IC_JMP,lb,0);
|
||||
ICAdd(cc,IC_LABEL,lb_done,0);
|
||||
}
|
||||
|
||||
U0 PrsDoWhile(CCmpCtrl *cc,I64 try_cnt)
|
||||
U0 ParseDoWhile(CCmpCtrl *cc,I64 try_cnt)
|
||||
{
|
||||
CCodeMisc *lb,*lb_done;
|
||||
lb=COCMiscNew(cc,CMT_LABEL);
|
||||
lb_done=COCMiscNew(cc,CMT_LABEL);
|
||||
ICAdd(cc,IC_LABEL,lb,0);
|
||||
PrsStmt(cc,try_cnt,lb_done);
|
||||
if (PrsKeyWord(cc)!=KW_WHILE)
|
||||
ParseStatement(cc,try_cnt,lb_done);
|
||||
if (ParseKeyWord(cc)!=KW_WHILE)
|
||||
LexExcept(cc,"Missing 'while' at");
|
||||
if (Lex(cc)!='(')
|
||||
LexExcept(cc,"Expecting '(' at ");
|
||||
Lex(cc);
|
||||
if (!PrsExpression(cc,NULL,FALSE))
|
||||
if (!ParseExpression(cc,NULL,FALSE))
|
||||
throw('Compiler');
|
||||
if (cc->token!=')')
|
||||
LexExcept(cc,"Missing ')' at ");
|
||||
|
@ -526,7 +526,7 @@ U0 PrsDoWhile(CCmpCtrl *cc,I64 try_cnt)
|
|||
Lex(cc);
|
||||
}
|
||||
|
||||
U0 PrsFor(CCmpCtrl *cc,I64 try_cnt)
|
||||
U0 ParseFor(CCmpCtrl *cc,I64 try_cnt)
|
||||
{
|
||||
CCodeCtrl *tmpcbh;
|
||||
CCodeMisc *lb,*lb_done;
|
||||
|
@ -534,11 +534,11 @@ U0 PrsFor(CCmpCtrl *cc,I64 try_cnt)
|
|||
if (cc->token!='(')
|
||||
LexExcept(cc,"Expecting '(' at ");
|
||||
Lex(cc);
|
||||
PrsStmt(cc,try_cnt);
|
||||
ParseStatement(cc,try_cnt);
|
||||
|
||||
lb=COCMiscNew(cc,CMT_LABEL);
|
||||
ICAdd(cc,IC_LABEL,lb,0);
|
||||
if (!PrsExpression(cc,NULL,FALSE))
|
||||
if (!ParseExpression(cc,NULL,FALSE))
|
||||
throw('Compiler');
|
||||
lb_done=COCMiscNew(cc,CMT_LABEL);
|
||||
ICAdd(cc,IC_BR_ZERO,lb_done,0);
|
||||
|
@ -549,7 +549,7 @@ U0 PrsFor(CCmpCtrl *cc,I64 try_cnt)
|
|||
COCPush(cc);
|
||||
COCInit(cc);
|
||||
if (cc->token!=')')
|
||||
PrsStmt(cc,try_cnt,NULL,0);
|
||||
ParseStatement(cc,try_cnt,NULL,0);
|
||||
COCPush(cc);
|
||||
tmpcbh=COCPopNoFree(cc);
|
||||
COCPop(cc);
|
||||
|
@ -557,7 +557,7 @@ U0 PrsFor(CCmpCtrl *cc,I64 try_cnt)
|
|||
LexExcept(cc,"Missing ')' at ");
|
||||
Lex(cc);
|
||||
|
||||
PrsStmt(cc,try_cnt,lb_done);
|
||||
ParseStatement(cc,try_cnt,lb_done);
|
||||
COCAppend(cc,tmpcbh);
|
||||
ICAdd(cc,IC_JMP,lb,0);
|
||||
ICAdd(cc,IC_LABEL,lb_done,0);
|
||||
|
@ -575,7 +575,7 @@ class CSwitchCase {
|
|||
CSubSwitch *ss;
|
||||
};
|
||||
|
||||
U0 PrsSwitch(CCmpCtrl *cc,I64 try_cnt)
|
||||
U0 ParseSwitch(CCmpCtrl *cc,I64 try_cnt)
|
||||
{
|
||||
CSwitchCase *header=NULL,*tmps,*tmps1; //Leaks on except
|
||||
CSubSwitch head,*tmpss; //Leaks on except
|
||||
|
@ -600,7 +600,7 @@ U0 PrsSwitch(CCmpCtrl *cc,I64 try_cnt)
|
|||
mc_jt=COCMiscNew(cc,CMT_JMP_TABLE);
|
||||
mc_jt->begin=COCMiscNew(cc,CMT_LABEL);
|
||||
mc_jt->begin->use_cnt++;
|
||||
if (!PrsExpression(cc,NULL,FALSE))
|
||||
if (!ParseExpression(cc,NULL,FALSE))
|
||||
throw('Compiler');
|
||||
tmpi_sub=ICAdd(cc,IC_IMM_I64,0,cmp.internal_types[RT_I64]);
|
||||
ICAdd(cc,IC_SUB,0,cmp.internal_types[RT_I64]);
|
||||
|
@ -621,7 +621,7 @@ U0 PrsSwitch(CCmpCtrl *cc,I64 try_cnt)
|
|||
while (TRUE) {
|
||||
while (cc->token && cc->token!='}') {
|
||||
sw_cont:
|
||||
switch (PrsKeyWord(cc)) {
|
||||
switch (ParseKeyWord(cc)) {
|
||||
case KW_END:
|
||||
goto sw_sub_end;
|
||||
case KW_START:
|
||||
|
@ -639,7 +639,7 @@ sw_cont:
|
|||
tmpss->lb_start=COCMiscNew(cc,CMT_LABEL);
|
||||
tmpi_start=ICAdd(cc,IC_LABEL,tmpss->lb_start,0);
|
||||
while (cc->token && cc->token!='}') {
|
||||
switch (PrsKeyWord(cc)) {
|
||||
switch (ParseKeyWord(cc)) {
|
||||
case KW_END:
|
||||
OptFree(tmpi_jmp);
|
||||
goto sw_sub_end;
|
||||
|
@ -656,7 +656,7 @@ sw_cont:
|
|||
}
|
||||
goto sw_cont;
|
||||
default:
|
||||
PrsStmt(cc,try_cnt);
|
||||
ParseStatement(cc,try_cnt);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -739,7 +739,7 @@ sw_cont:
|
|||
dft_found=TRUE;
|
||||
break;
|
||||
default:
|
||||
PrsStmt(cc,try_cnt,head.last->lb_break);
|
||||
ParseStatement(cc,try_cnt,head.last->lb_break);
|
||||
}
|
||||
}
|
||||
sw_sub_end:
|
||||
|
@ -753,7 +753,7 @@ sw_sub_end:
|
|||
} else {
|
||||
QueueRem(tmpss);
|
||||
Free(tmpss);
|
||||
if (PrsKeyWord(cc)!=KW_END)
|
||||
if (ParseKeyWord(cc)!=KW_END)
|
||||
LexExcept(cc,"Missing 'end' at ");
|
||||
if (Lex(cc)==':')
|
||||
Lex(cc);
|
||||
|
@ -788,7 +788,7 @@ sw_sub_end:
|
|||
mc_jt->range=range;
|
||||
}
|
||||
|
||||
U0 PrsNoWarn(CCmpCtrl *cc)
|
||||
U0 ParseNoWarn(CCmpCtrl *cc)
|
||||
{
|
||||
CMemberLst *tmpm;
|
||||
while (cc->token==TK_IDENT) {
|
||||
|
@ -802,7 +802,7 @@ U0 PrsNoWarn(CCmpCtrl *cc)
|
|||
}
|
||||
}
|
||||
|
||||
U0 PrsStreamBlk(CCmpCtrl *cc)
|
||||
U0 ParseStreamBlk(CCmpCtrl *cc)
|
||||
{
|
||||
CLexHashTableContext *htc=MAlloc(sizeof(CLexHashTableContext));
|
||||
CStreamBlk *tmpe=MAlloc(sizeof(CStreamBlk));
|
||||
|
@ -839,7 +839,7 @@ U0 PrsStreamBlk(CCmpCtrl *cc)
|
|||
Lex(cc); //Skip '}'
|
||||
}
|
||||
|
||||
U0 PrsTryBlk(CCmpCtrl *cc,I64 try_cnt)
|
||||
U0 ParseTryBlk(CCmpCtrl *cc,I64 try_cnt)
|
||||
{
|
||||
CCodeMisc *lb_catch,*lb_done,*lb_untry;
|
||||
CHashClass *tmpc=cmp.internal_types[RT_PTR];
|
||||
|
@ -874,7 +874,7 @@ U0 PrsTryBlk(CCmpCtrl *cc,I64 try_cnt)
|
|||
ICAdd(cc,IC_CALL_END,0,tmpc);
|
||||
ICAdd(cc,IC_END_EXP,0,0,ICF_RES_NOT_USED);
|
||||
|
||||
PrsStmt(cc,try_cnt+1);
|
||||
ParseStatement(cc,try_cnt+1);
|
||||
|
||||
ICAdd(cc,IC_LABEL,lb_untry,0);
|
||||
ICAdd(cc,IC_CALL_START,0,0);
|
||||
|
@ -891,17 +891,17 @@ U0 PrsTryBlk(CCmpCtrl *cc,I64 try_cnt)
|
|||
|
||||
ICAdd(cc,IC_JMP,lb_done,0);
|
||||
|
||||
if (PrsKeyWord(cc)!=KW_CATCH)
|
||||
if (ParseKeyWord(cc)!=KW_CATCH)
|
||||
LexExcept(cc,"Missing 'catch' at");
|
||||
|
||||
Lex(cc);
|
||||
ICAdd(cc,IC_LABEL,lb_catch,0);
|
||||
PrsStmt(cc,try_cnt+1);
|
||||
ParseStatement(cc,try_cnt+1);
|
||||
ICAdd(cc,IC_RET,0,tmpc);
|
||||
ICAdd(cc,IC_LABEL,lb_done,0);
|
||||
}
|
||||
|
||||
Bool PrsStmt(CCmpCtrl *cc,I64 try_cnt=0,
|
||||
Bool ParseStatement(CCmpCtrl *cc,I64 try_cnt=0,
|
||||
CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON)
|
||||
{
|
||||
I64 i,fsp_flags=0;
|
||||
|
@ -912,7 +912,7 @@ Bool PrsStmt(CCmpCtrl *cc,I64 try_cnt=0,
|
|||
CAOT *tmpaot;
|
||||
if (cmp_flags&CMPF_ONE_ASM_INS) {
|
||||
if (cc->flags&CCF_AOT_COMPILE || cc->aot_depth)
|
||||
PrsAsmBlk(cc,CMPF_ONE_ASM_INS);
|
||||
ParseAsmBlk(cc,CMPF_ONE_ASM_INS);
|
||||
else if (tmpaot=CmpJoin(cc,CMPF_ASM_BLK|CMPF_ONE_ASM_INS))
|
||||
CmpFixUpJITAsm(cc,tmpaot);
|
||||
fsp_flags=FSF_ASM;
|
||||
|
@ -923,7 +923,7 @@ Bool PrsStmt(CCmpCtrl *cc,I64 try_cnt=0,
|
|||
if (cc->token=='{') {
|
||||
Lex(cc);
|
||||
while (cc->token!='}' && cc->token!=TK_EOF)
|
||||
PrsStmt(cc,try_cnt,lb_break);
|
||||
ParseStatement(cc,try_cnt,lb_break);
|
||||
if (cc->lex_include_stk==cc->fun_lex_file)
|
||||
cc->max_line=cc->lex_include_stk->line_num;
|
||||
if (Lex(cc)!=',') goto sm_done;
|
||||
|
@ -949,7 +949,7 @@ Bool PrsStmt(CCmpCtrl *cc,I64 try_cnt=0,
|
|||
} else {
|
||||
if (cc->flags&CCF_AOT_COMPILE || cc->aot_depth) {
|
||||
Lex(cc);
|
||||
PrsAsmBlk(cc,0);
|
||||
ParseAsmBlk(cc,0);
|
||||
if (cc->flags&CCF_AOT_COMPILE && cc->aot_depth==1)
|
||||
Lex(cc); //Skip '}' of asm{}
|
||||
} else {
|
||||
|
@ -964,26 +964,26 @@ Bool PrsStmt(CCmpCtrl *cc,I64 try_cnt=0,
|
|||
Lex(cc);
|
||||
case KW_LOCK:
|
||||
cc->lock_cnt++;
|
||||
PrsStmt(cc,try_cnt);
|
||||
ParseStatement(cc,try_cnt);
|
||||
cc->lock_cnt--;
|
||||
break;
|
||||
case KW_TRY:
|
||||
PrsTryBlk(cc,try_cnt);
|
||||
ParseTryBlk(cc,try_cnt);
|
||||
break;
|
||||
case KW_IF:
|
||||
PrsIf(cc,try_cnt,lb_break);
|
||||
ParseIf(cc,try_cnt,lb_break);
|
||||
break;
|
||||
case KW_FOR:
|
||||
PrsFor(cc,try_cnt);
|
||||
ParseFor(cc,try_cnt);
|
||||
break;
|
||||
case KW_WHILE:
|
||||
PrsWhile(cc,try_cnt);
|
||||
ParseWhile(cc,try_cnt);
|
||||
break;
|
||||
case KW_DO:
|
||||
PrsDoWhile(cc,try_cnt);
|
||||
ParseDoWhile(cc,try_cnt);
|
||||
break;
|
||||
case KW_SWITCH:
|
||||
PrsSwitch(cc,try_cnt);
|
||||
ParseSwitch(cc,try_cnt);
|
||||
break;
|
||||
end:
|
||||
end:
|
||||
|
@ -1007,7 +1007,7 @@ Bool PrsStmt(CCmpCtrl *cc,I64 try_cnt=0,
|
|||
!(tmpex->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
|
||||
LexExcept(cc,"Expecting type at ");
|
||||
Lex(cc);
|
||||
PrsGlblVarLst(cc,PRS0__EXTERN|PRS1_NULL,tmpex,i,fsp_flags);
|
||||
ParseGlblVarLst(cc,PRS0__EXTERN|PRS1_NULL,tmpex,i,fsp_flags);
|
||||
break;
|
||||
case KW__IMPORT:
|
||||
sm_underscore_import:
|
||||
|
@ -1021,7 +1021,7 @@ sm_underscore_import:
|
|||
!(tmpex->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
|
||||
LexExcept(cc,"Expecting type at ");
|
||||
Lex(cc);
|
||||
PrsGlblVarLst(cc,PRS0__IMPORT|PRS1_NULL,tmpex,
|
||||
ParseGlblVarLst(cc,PRS0__IMPORT|PRS1_NULL,tmpex,
|
||||
import_name,fsp_flags);
|
||||
Free(import_name);
|
||||
break;
|
||||
|
@ -1029,10 +1029,10 @@ sm_underscore_import:
|
|||
if (cc->token!=TK_IDENT)
|
||||
LexExcept(cc,"Expecting type at ");
|
||||
tmpex=cc->hash_entry;
|
||||
i=PrsKeyWord(cc);
|
||||
i=ParseKeyWord(cc);
|
||||
if (i==KW_CLASS||i==KW_UNION) {
|
||||
Lex(cc);
|
||||
PrsClass(cc,i,fsp_flags,TRUE);
|
||||
ParseClass(cc,i,fsp_flags,TRUE);
|
||||
fsp_flags&=FSF_ASM;
|
||||
goto sm_semicolon;
|
||||
}
|
||||
|
@ -1042,7 +1042,7 @@ sm_underscore_import:
|
|||
if (Bt(&cc->opts,OPTf_EXTERNS_TO_IMPORTS))
|
||||
goto sm_import;
|
||||
Lex(cc);
|
||||
PrsGlblVarLst(cc,PRS0_EXTERN|PRS1_NULL,tmpex,0,fsp_flags);
|
||||
ParseGlblVarLst(cc,PRS0_EXTERN|PRS1_NULL,tmpex,0,fsp_flags);
|
||||
break;
|
||||
case KW_IMPORT:
|
||||
if (cc->token!=TK_IDENT || !(tmpex=cc->hash_entry) ||
|
||||
|
@ -1050,7 +1050,7 @@ sm_underscore_import:
|
|||
LexExcept(cc,"Expecting type at ");
|
||||
sm_import:
|
||||
Lex(cc);
|
||||
PrsGlblVarLst(cc,PRS0_IMPORT|PRS1_NULL,tmpex,0,fsp_flags);
|
||||
ParseGlblVarLst(cc,PRS0_IMPORT|PRS1_NULL,tmpex,0,fsp_flags);
|
||||
break;
|
||||
case KW__INTERN:
|
||||
i=LexExpressionI64(cc);
|
||||
|
@ -1058,7 +1058,7 @@ sm_import:
|
|||
!(tmpex->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
|
||||
LexExcept(cc,"Expecting type at ");
|
||||
Lex(cc);
|
||||
PrsGlblVarLst(cc,PRS0__INTERN|PRS1_NULL,tmpex,i,fsp_flags);
|
||||
ParseGlblVarLst(cc,PRS0__INTERN|PRS1_NULL,tmpex,i,fsp_flags);
|
||||
break;
|
||||
end:
|
||||
fsp_flags&=FSF_ASM;
|
||||
|
@ -1110,7 +1110,7 @@ sm_import:
|
|||
if (Lex(cc)!=';') {
|
||||
if (!cc->htc.fun->return_class->size)
|
||||
LexWarn(cc,"Function should NOT return val ");
|
||||
if (!PrsExpression(cc,NULL,FALSE))
|
||||
if (!ParseExpression(cc,NULL,FALSE))
|
||||
throw('Compiler');
|
||||
ICAdd(cc,IC_RETURN_VAL,0,cc->htc.fun->return_class);
|
||||
cc->flags|=CCF_HAS_RETURN;
|
||||
|
@ -1138,14 +1138,14 @@ sm_import:
|
|||
goto sm_semicolon;
|
||||
case KW_NO_WARN:
|
||||
Lex(cc);
|
||||
PrsNoWarn(cc);
|
||||
ParseNoWarn(cc);
|
||||
goto sm_semicolon;
|
||||
case KW_UNION:
|
||||
case KW_CLASS:
|
||||
Lex(cc);
|
||||
tmpex=PrsClass(cc,i,fsp_flags,FALSE);
|
||||
tmpex=ParseClass(cc,i,fsp_flags,FALSE);
|
||||
if (!cc->htc.fun && cc->token!=';') {
|
||||
PrsGlblVarLst(cc,PRS0_NULL|PRS1_NULL,tmpex,0,fsp_flags);
|
||||
ParseGlblVarLst(cc,PRS0_NULL|PRS1_NULL,tmpex,0,fsp_flags);
|
||||
fsp_flags&=FSF_ASM;
|
||||
break;
|
||||
} else {
|
||||
|
@ -1158,13 +1158,13 @@ sm_not_keyword_afterall:
|
|||
if (tmpex->type & (HTT_CLASS|HTT_INTERNAL_TYPE)) {
|
||||
if (cc->htc.fun) {
|
||||
if (fsp_flags&FSF_STATIC)
|
||||
PrsVarLst(cc,cc->htc.fun,PRS0_NULL|PRS1_STATIC_LOCAL_VAR);
|
||||
ParseVarLst(cc,cc->htc.fun,PRS0_NULL|PRS1_STATIC_LOCAL_VAR);
|
||||
else
|
||||
PrsVarLst(cc,cc->htc.fun,PRS0_NULL|PRS1_LOCAL_VAR);
|
||||
ParseVarLst(cc,cc->htc.fun,PRS0_NULL|PRS1_LOCAL_VAR);
|
||||
if (cc->token=='}') goto sm_done;
|
||||
} else {
|
||||
Lex(cc);
|
||||
PrsGlblVarLst(cc,PRS0_NULL|PRS1_NULL,tmpex,0,fsp_flags);
|
||||
ParseGlblVarLst(cc,PRS0_NULL|PRS1_NULL,tmpex,0,fsp_flags);
|
||||
}
|
||||
} else {
|
||||
if (tmpex->type & (HTT_OPCODE|HTT_ASM_KEYWORD)) {
|
||||
|
@ -1199,11 +1199,11 @@ sm_not_keyword_afterall:
|
|||
if (cc->token!=',') goto sm_done;
|
||||
}
|
||||
} else if (cc->token==TK_STR||cc->token==TK_CHAR_CONST) {
|
||||
PrsFunCall(cc,NULL,FALSE,NULL);
|
||||
ParseFunCall(cc,NULL,FALSE,NULL);
|
||||
goto sm_semicolon;
|
||||
} else if (cc->token!=TK_EOF) {//Non-cur_str symbol, num or something
|
||||
sm_prs_exp:
|
||||
if (!PrsExpression(cc,NULL,TRUE))
|
||||
if (!ParseExpression(cc,NULL,TRUE))
|
||||
throw('Compiler');
|
||||
sm_semicolon:
|
||||
if (cmp_flags&CMPF_PRS_SEMICOLON) {
|
|
@ -1,4 +1,4 @@
|
|||
U0 PrsVarInit(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,CArrayDim *tmpad,
|
||||
U0 ParseVarInit(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,CArrayDim *tmpad,
|
||||
U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass)
|
||||
{
|
||||
U8 *dst=*_dst,*machine_code;
|
||||
|
@ -18,7 +18,7 @@ U0 PrsVarInit(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,CArrayDim *tmpad,
|
|||
LexPush(cc);
|
||||
Lex(cc);
|
||||
while (tmpm) {
|
||||
PrsVarInit2(cc,&dst,tmpm->member_class,&tmpm->dim,
|
||||
ParseVarInit2(cc,&dst,tmpm->member_class,&tmpm->dim,
|
||||
data_addr_rip,_base,data_heap,pass);
|
||||
if (cc->token==',')
|
||||
Lex(cc);
|
||||
|
@ -68,7 +68,7 @@ U0 PrsVarInit(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,CArrayDim *tmpad,
|
|||
ICAdd(cc,IC_ABS_ADDR,data_addr_rip,tmpc+1);
|
||||
ICAdd(cc,IC_IMM_I64,dst-*_base,tmpc+1);
|
||||
ICAdd(cc,IC_ADD,0,tmpc+1);
|
||||
if (!PrsExpression(cc,NULL,TRUE))
|
||||
if (!ParseExpression(cc,NULL,TRUE))
|
||||
throw('Compiler');
|
||||
tmpi=cc->coc.coc_head.last;
|
||||
if (tmpi->ic_code==IC_END_EXP) {
|
||||
|
@ -120,7 +120,7 @@ class CVI2
|
|||
U0 base;
|
||||
};
|
||||
|
||||
U0 PrsVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
||||
U0 ParseVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
||||
CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass)
|
||||
{
|
||||
I64 i,j,cnt;
|
||||
|
@ -162,7 +162,7 @@ U0 PrsVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
|||
while (cc->token!='}') {
|
||||
tmpvi=MAlloc(offset(CVI2.base)+tmpad1->total_cnt*tmpc->size);
|
||||
_b=&tmpvi->base;
|
||||
PrsVarInit2(cc,&_b,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
|
||||
ParseVarInit2(cc,&_b,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
|
||||
QueueInsert(tmpvi,head.last);
|
||||
if (cc->token==',')
|
||||
Lex(cc);
|
||||
|
@ -189,7 +189,7 @@ U0 PrsVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
|||
*_dst=_b;
|
||||
} else {
|
||||
for (i=0;i<tmpad1->cnt;i++) {
|
||||
PrsVarInit2(cc,_dst,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
|
||||
ParseVarInit2(cc,_dst,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
|
||||
if (tmpad1->cnt>1 && cc->token==',')
|
||||
Lex(cc);
|
||||
}
|
||||
|
@ -198,21 +198,21 @@ U0 PrsVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
PrsVarInit(cc,_dst,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
|
||||
ParseVarInit(cc,_dst,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
|
||||
LexPush(cc);
|
||||
}
|
||||
}
|
||||
|
||||
U0 PrsGlblInit(CCmpCtrl *cc,CHashGlblVar *tmpg,I64 pass)
|
||||
U0 ParseGlblInit(CCmpCtrl *cc,CHashGlblVar *tmpg,I64 pass)
|
||||
{
|
||||
U8 *dst=tmpg->data_addr;
|
||||
PrsVarInit2(cc,&dst,tmpg->var_class,&tmpg->dim,
|
||||
ParseVarInit2(cc,&dst,tmpg->var_class,&tmpg->dim,
|
||||
tmpg->data_addr_rip,&tmpg->data_addr,
|
||||
Bt(&cc->opts,OPTf_GLBLS_ON_DATA_HEAP)||
|
||||
Bt(&cc->flags,CCf_AOT_COMPILE),pass);
|
||||
}
|
||||
|
||||
U0 PrsStaticInit(CCmpCtrl *cc,CMemberLst *tmpm,I64 pass)
|
||||
U0 ParseStaticInit(CCmpCtrl *cc,CMemberLst *tmpm,I64 pass)
|
||||
{
|
||||
U8 *machine_code,*dst=tmpm->static_data;
|
||||
CHashClass *tmpc=tmpm->member_class;
|
||||
|
@ -223,7 +223,7 @@ U0 PrsStaticInit(CCmpCtrl *cc,CMemberLst *tmpm,I64 pass)
|
|||
COCPush(cc);
|
||||
COCInit(cc);
|
||||
}
|
||||
PrsVarInit2(cc,&dst,tmpc,&tmpm->dim,tmpm->static_data_rip,
|
||||
ParseVarInit2(cc,&dst,tmpc,&tmpm->dim,tmpm->static_data_rip,
|
||||
&tmpm->static_data,Bt(&cc->flags,CCf_AOT_COMPILE),pass);
|
||||
if (cc->flags&CCF_AOT_COMPILE && pass==2) {
|
||||
if (cc->coc.coc_head.next!=&cc->coc.coc_head) {
|
||||
|
@ -244,7 +244,7 @@ U0 PrsStaticInit(CCmpCtrl *cc,CMemberLst *tmpm,I64 pass)
|
|||
}
|
||||
}
|
||||
|
||||
U0 PrsArrayDims(CCmpCtrl *cc,I64 mode,CArrayDim *dim)
|
||||
U0 ParseArrayDims(CCmpCtrl *cc,I64 mode,CArrayDim *dim)
|
||||
{//dim->next!=0 for array
|
||||
CArrayDim *tmpad,*tmpad1;
|
||||
I64 j;
|
||||
|
@ -282,7 +282,7 @@ U0 PrsArrayDims(CCmpCtrl *cc,I64 mode,CArrayDim *dim)
|
|||
}
|
||||
}
|
||||
|
||||
CHashClass *PrsType(CCmpCtrl *cc,CHashClass **_tmpc1,
|
||||
CHashClass *ParseType(CCmpCtrl *cc,CHashClass **_tmpc1,
|
||||
I64 *_mode,CMemberLst *tmpm,U8 **_ident,CHashFun **_fun_ptr,
|
||||
CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags)
|
||||
{
|
||||
|
@ -307,10 +307,10 @@ CHashClass *PrsType(CCmpCtrl *cc,CHashClass **_tmpc1,
|
|||
LexExcept(cc,"Too many *'s at ");
|
||||
}
|
||||
|
||||
k=PrsKeyWord(cc);
|
||||
k=ParseKeyWord(cc);
|
||||
if (k==KW_UNION || k==KW_CLASS) {
|
||||
Lex(cc);
|
||||
tmpc2=PrsClass(cc,k,fsp_flags,mode&255==PRS0_EXTERN);
|
||||
tmpc2=ParseClass(cc,k,fsp_flags,mode&255==PRS0_EXTERN);
|
||||
tmpc2->fwd_class=tmpc1;
|
||||
tmpc1=tmpc2;
|
||||
if (_tmpc1) *_tmpc1=tmpc1;
|
||||
|
@ -352,10 +352,10 @@ CHashClass *PrsType(CCmpCtrl *cc,CHashClass **_tmpc1,
|
|||
LexExcept(cc,"Missing ')' at ");
|
||||
if (Lex(cc)!='(')
|
||||
LexExcept(cc,"Expecting '(' at ");
|
||||
fun_ptr=PrsFunJoin(cc,tmpc1,NULL,fsp_flags)+ptr_stars_cnt;
|
||||
fun_ptr=ParseFunJoin(cc,tmpc1,NULL,fsp_flags)+ptr_stars_cnt;
|
||||
tmpc1=cmp.internal_types[RT_PTR]+ptr_stars_cnt;
|
||||
}
|
||||
PrsArrayDims(cc,mode,tmpad);
|
||||
ParseArrayDims(cc,mode,tmpad);
|
||||
|
||||
tmpc2=OptClassFwd(tmpc1);
|
||||
if (tmpc2->ptr_stars_cnt) {
|
||||
|
@ -370,7 +370,7 @@ CHashClass *PrsType(CCmpCtrl *cc,CHashClass **_tmpc1,
|
|||
return tmpc1;
|
||||
}
|
||||
|
||||
U0 PrsDotDotDot(CCmpCtrl *cc,CHashFun *tmpf,I64 _reg)
|
||||
U0 ParseDotDotDot(CCmpCtrl *cc,CHashFun *tmpf,I64 _reg)
|
||||
{
|
||||
CMemberLst *tmpm;
|
||||
CArrayDim *tmpad;
|
||||
|
@ -405,7 +405,7 @@ U0 PrsDotDotDot(CCmpCtrl *cc,CHashFun *tmpf,I64 _reg)
|
|||
Lex(cc);
|
||||
}
|
||||
|
||||
U0 PrsVarLst(CCmpCtrl *cc,CHashClass *tmpc,I64 mode,I64 union_base=0)
|
||||
U0 ParseVarLst(CCmpCtrl *cc,CHashClass *tmpc,I64 mode,I64 union_base=0)
|
||||
{
|
||||
I64 i,k,old_flags=cc->flags,old_flags2,type,_reg;
|
||||
CHashClass *tmpc1,*tmpc2;
|
||||
|
@ -448,7 +448,7 @@ U0 PrsVarLst(CCmpCtrl *cc,CHashClass *tmpc,I64 mode,I64 union_base=0)
|
|||
}
|
||||
_reg=REG_UNDEF;
|
||||
pvl_restart1:
|
||||
switch (PrsKeyWord(cc)) {
|
||||
switch (ParseKeyWord(cc)) {
|
||||
case KW_REG:
|
||||
_reg=REG_ALLOC;
|
||||
if (Lex(cc)==TK_IDENT) {
|
||||
|
@ -466,7 +466,7 @@ pvl_restart1:
|
|||
}
|
||||
|
||||
if (cc->token==TK_ELLIPSIS && mode.u8[1]==PRS1B_FUN_ARG) {
|
||||
PrsDotDotDot(cc,tmpc,_reg);
|
||||
ParseDotDotDot(cc,tmpc,_reg);
|
||||
goto pvl_done;
|
||||
}
|
||||
if (cc->token==TK_IDENT)
|
||||
|
@ -475,10 +475,10 @@ pvl_restart1:
|
|||
tmph=NULL;
|
||||
if (!tmph)
|
||||
LexExcept(cc,"Expecting type at ");
|
||||
k=PrsKeyWord(cc);
|
||||
k=ParseKeyWord(cc);
|
||||
if (k==KW_UNION) {
|
||||
Lex(cc);
|
||||
PrsVarLst(cc,tmpc,mode|PRSF_UNION,tmpc->size);
|
||||
ParseVarLst(cc,tmpc,mode|PRSF_UNION,tmpc->size);
|
||||
} else {
|
||||
if (!(tmph->type & (HTT_CLASS|HTT_INTERNAL_TYPE)))
|
||||
LexExcept(cc,"Expecting type at ");
|
||||
|
@ -495,7 +495,7 @@ pvl_restart2:
|
|||
}
|
||||
if (mode.u8[1]==PRS1B_FUN_ARG || mode.u8[1]==PRS1B_LOCAL_VAR) {
|
||||
pvl_restart3:
|
||||
switch (PrsKeyWord(cc)) {
|
||||
switch (ParseKeyWord(cc)) {
|
||||
case KW_REG:
|
||||
tmpm->reg=REG_ALLOC;
|
||||
LexPopNoRestore(cc);
|
||||
|
@ -518,7 +518,7 @@ pvl_restart3:
|
|||
goto pvl_restart3;
|
||||
}
|
||||
}
|
||||
tmpm->member_class=PrsType(cc,&tmpc1,&mode,tmpm,&tmpm->str,
|
||||
tmpm->member_class=ParseType(cc,&tmpc1,&mode,tmpm,&tmpm->str,
|
||||
&tmpm->fun_ptr,NULL,&tmpm->dim,0);
|
||||
if (tmpm->fun_ptr)
|
||||
tmpm->flags|=MLF_FUN;
|
||||
|
@ -560,7 +560,7 @@ pvl_restart3:
|
|||
LexPush(cc);
|
||||
LexPush(cc);
|
||||
Lex(cc); //skip =
|
||||
PrsStaticInit(cc,tmpm,1);
|
||||
ParseStaticInit(cc,tmpm,1);
|
||||
LexPopNoRestore(cc);
|
||||
i=tmpc2->size*tmpm->dim.total_cnt;
|
||||
k=(i+7)&~7;
|
||||
|
@ -575,7 +575,7 @@ pvl_restart3:
|
|||
}
|
||||
LexPush(cc);
|
||||
Lex(cc); //skip =
|
||||
PrsStaticInit(cc,tmpm,2);
|
||||
ParseStaticInit(cc,tmpm,2);
|
||||
LexPopNoRestore(cc);
|
||||
if (cc->flags&CCF_AOT_COMPILE)
|
||||
for (k=0;k<i;k++)
|
||||
|
@ -609,7 +609,7 @@ pvl_restart3:
|
|||
old_flags&CCF_DONT_MAKE_RES;
|
||||
LexPopRestore(cc);
|
||||
Lex(cc);
|
||||
if (!PrsExpression(cc,NULL,TRUE))
|
||||
if (!ParseExpression(cc,NULL,TRUE))
|
||||
throw('Compiler');
|
||||
tmpm->use_cnt=0;
|
||||
cc->flags|=CCF_DONT_MAKE_RES;
|
||||
|
@ -628,7 +628,7 @@ pvl_restart3:
|
|||
tmpm->size=8;
|
||||
if (cc->token=='=') {
|
||||
Lex(cc);
|
||||
if (PrsKeyWord(cc)==KW_LASTCLASS) {
|
||||
if (ParseKeyWord(cc)==KW_LASTCLASS) {
|
||||
tmpm->flags|=MLF_LASTCLASS;
|
||||
Lex(cc);
|
||||
} else {
|
|
@ -2,7 +2,7 @@
|
|||
$TR-C,"Main Compiler"$
|
||||
$ID,2$The mini compiler is like the main compiler, except the main compiler's lexical analyser removes comments and does preprocessing.$LK,"Lex",A="MN:Lex"$(),$LK,"Echo",A="MN:Echo"$(ON).
|
||||
|
||||
The main compiler generates $LK,"Intermediate Code",A="FF:::/Compiler/CompilerA.HH,IC_END"$ at the parser stage.See $LK,"PrsExpression",A="MN:PrsExpression"$(), $LK,"PrsStmt",A="MN:PrsStmt"$().
|
||||
The main compiler generates $LK,"Intermediate Code",A="FF:::/Compiler/CompilerA.HH,IC_END"$ at the parser stage.See $LK,"ParseExpression",A="MN:ParseExpression"$(), $LK,"ParseStatement",A="MN:ParseStatement"$().
|
||||
|
||||
The main compiler optimizes See $LK,"Intermediate Code Attributes",A="MN:intermediate_code_table"$, $LK,"Combining Consts",A="FF:::/Compiler/OptPass012.HC,case IC_MUL"$, $LK,"Choosing Reg Vars",A="FF:::/Compiler/OptPass3.HC,cmp.num_reg_vars"$.Use $LK,"PassTrace",A="MN:PassTrace"$() to see the optimization stages.
|
||||
|
||||
|
@ -89,8 +89,8 @@ I64 Lex(U8 **_src,I64 *num)
|
|||
|
||||
extern I64 Parse(U8 **_src,U8 **_dst);
|
||||
|
||||
U0 PrsTerm(U8 **_src,U8 **_dst,I64 prec)
|
||||
{//See $LK,"PrsExpression",A="MN:PrsExpression"$().
|
||||
U0 ParseTerm(U8 **_src,U8 **_dst,I64 prec)
|
||||
{//See $LK,"ParseExpression",A="MN:ParseExpression"$().
|
||||
I64 i;
|
||||
U8 *src2;
|
||||
U8 *dst2;
|
||||
|
@ -111,7 +111,7 @@ U0 PrsTerm(U8 **_src,U8 **_dst,I64 prec)
|
|||
}
|
||||
|
||||
I64 Parse(U8 **_src,U8 **_dst)
|
||||
{//See $LK,"PrsExpression",A="MN:PrsExpression"$().
|
||||
{//See $LK,"ParseExpression",A="MN:ParseExpression"$().
|
||||
//See $LK,"Opcode Fmts",A="FF:::/Compiler/OpCodes.DD,IDIV"$ for details on asm insts.
|
||||
I64 i;
|
||||
U8 *dst=*_dst;
|
||||
|
@ -130,7 +130,7 @@ I64 Parse(U8 **_src,U8 **_dst)
|
|||
*_dst=dst;
|
||||
return PREC_TERM;
|
||||
case TK_LEFT:
|
||||
PrsTerm(_src,_dst,PREC_PAREN);
|
||||
ParseTerm(_src,_dst,PREC_PAREN);
|
||||
if (Parse(_src,_dst)!=PREC_PAREN)
|
||||
throw;
|
||||
return PREC_TERM;
|
||||
|
@ -139,7 +139,7 @@ I64 Parse(U8 **_src,U8 **_dst)
|
|||
case TK_OP:
|
||||
switch (i) {
|
||||
case OP_MUL:
|
||||
PrsTerm(_src,&dst,PREC_MUL);
|
||||
ParseTerm(_src,&dst,PREC_MUL);
|
||||
*dst++=0x5A; //POP RDX
|
||||
*dst++=0x58; //POP RAX
|
||||
|
||||
|
@ -152,7 +152,7 @@ I64 Parse(U8 **_src,U8 **_dst)
|
|||
*_dst=dst;
|
||||
return PREC_MUL;
|
||||
case OP_DIV:
|
||||
PrsTerm(_src,&dst,PREC_MUL);
|
||||
ParseTerm(_src,&dst,PREC_MUL);
|
||||
*dst++=0x5B; //POP RBX
|
||||
*dst++=0x58; //POP RAX
|
||||
|
||||
|
@ -167,7 +167,7 @@ I64 Parse(U8 **_src,U8 **_dst)
|
|||
*_dst=dst;
|
||||
return PREC_MUL;
|
||||
case OP_ADD:
|
||||
PrsTerm(_src,&dst,PREC_ADD);
|
||||
ParseTerm(_src,&dst,PREC_ADD);
|
||||
*dst++=0x5A; //POP RDX
|
||||
*dst++=0x58; //POP RAX
|
||||
|
||||
|
@ -179,7 +179,7 @@ I64 Parse(U8 **_src,U8 **_dst)
|
|||
*_dst=dst;
|
||||
return PREC_ADD;
|
||||
case OP_SUB:
|
||||
PrsTerm(_src,&dst,PREC_ADD);
|
||||
ParseTerm(_src,&dst,PREC_ADD);
|
||||
*dst++=0x5A; //POP RDX
|
||||
*dst++=0x58; //POP RAX
|
||||
|
||||
|
@ -211,7 +211,7 @@ U0 Main()
|
|||
src2=src;
|
||||
dst=code;
|
||||
try {
|
||||
PrsTerm(&src2,&dst,PREC_PAREN);
|
||||
ParseTerm(&src2,&dst,PREC_PAREN);
|
||||
if (Parse(&src2,&dst)!=PREC_EOF)
|
||||
throw;
|
||||
"$$RED$$This code is not efficient, but the compiler is simple.$$FG$$\n";
|
||||
|
|
|
@ -4,8 +4,8 @@ $FG,4$$TX,"ZenithOS File Downloads (100% Public Domain)",HTML="http://www.temple
|
|||
|
||||
ZenithOS is a free, public domain, open source, x86_64, non-preemptive multi-tasking, multi-cored, ring-0-only, single-address-map (identity-mapped), non-networked, PC operating system. Paging is, basically, not used.
|
||||
|
||||
The CIA obsfucates to foil India, China, Russia and Korea. They make things more complicated than necessary. ZenithOS is more simple than necessary. It is obnoxiously simple. If you look at this $TX,"\"Hello World\" joke",HTML="http://www.ariel.com.au/jokes/The_Evolution_of_a_Programmer.html"$, you can see why I capped the line count of ZenithOS at 100,000.
|
||||
The CIA obsfucates to foil India, China, Russia and Korea. They make things more complicated than necessary. ZenithOS is more simple than necessary. It is obnoxiously simple. If you look at this $TX,"\"Hello World\" joke",HTML="http://www.ariel.com.au/jokes/The_Evolution_of_a_Programmer.html"$, you can see why I capped the line count of TempleOS at 100,000.
|
||||
|
||||
God said ZenithOS must be perfect, so backward compatibility is not promised.
|
||||
God said TempleOS must be perfect, so backward compatibility is not promised.
|
||||
|
||||
I, Terry Davis, wrote all $TX,"80,847",D="DD_TEMPLEOS_LOC"$ lines of ZenithOS over the last $TX,"13.9",D="DD_TEMPLEOS_AGE"$ years, including the 64-bit compiler. I have been a professional operating system developer since 1990 when I worked on Ticketmaster's VAX OS.
|
||||
I, Terry Davis, wrote all $TX,"80,849",D="DD_TEMPLEOS_LOC"$ lines of TempleOS over the last $TX,"16.5",D="DD_TEMPLEOS_AGE"$ years, including the 64-bit compiler. I have been a professional operating system developer since 1990 when I worked on Ticketmaster's VAX OS.
|
||||
|
|
|
@ -33,7 +33,7 @@ U0 LogStructDel(LogStruct *tmplg)
|
|||
Free(tmplg);
|
||||
}
|
||||
|
||||
U0 PrsSingleLogFile(LogStruct *head,U8 *name,CDate *_dstart,CDate *_dend)
|
||||
U0 ParseSingleLogFile(LogStruct *head,U8 *name,CDate *_dstart,CDate *_dend)
|
||||
{
|
||||
CDoc *doc=DocRead(name,
|
||||
DOCF_PLAIN_TEXT_TABS|DOCF_DBL_DOLLARS|DOCF_NO_CURSOR);
|
||||
|
@ -128,13 +128,13 @@ U0 PrsSingleLogFile(LogStruct *head,U8 *name,CDate *_dstart,CDate *_dend)
|
|||
DocDel(doc);
|
||||
}
|
||||
|
||||
LogStruct *PrsLogFiles(U8 *files_find_mask,CDate *_dstart,CDate *_dend)
|
||||
LogStruct *ParseLogFiles(U8 *files_find_mask,CDate *_dstart,CDate *_dend)
|
||||
{
|
||||
LogStruct *head=CAlloc(sizeof(LogStruct));
|
||||
CDirEntry *tmpde=FilesFind(files_find_mask),*tmpde1=tmpde;
|
||||
QueueInit(head);
|
||||
while (tmpde) {
|
||||
PrsSingleLogFile(head,tmpde->full_name,_dstart,_dend);
|
||||
ParseSingleLogFile(head,tmpde->full_name,_dstart,_dend);
|
||||
tmpde=tmpde->next;
|
||||
}
|
||||
DirTreeDel(tmpde1);
|
||||
|
@ -500,7 +500,7 @@ U0 WebLogRep(U8 *mask,U8 *output_filename)
|
|||
|
||||
DocMax;
|
||||
|
||||
head=PrsLogFiles(mask,&dstart,&dend);
|
||||
head=ParseLogFiles(mask,&dstart,&dend);
|
||||
if (dstart>dend)
|
||||
PrintErr("No Data.\n");
|
||||
else {
|
||||
|
|
|
@ -15,7 +15,7 @@ The format of DolDoc cmds is a two character code, +/-flags, a comma and args se
|
|||
|
||||
See $LK,"::/Doc/Widget.DD"$, $LK,"::/Demo/DolDoc/DemoDoc.DD"$, and $LK,"::/Demo/ToHtmlToTXTDemo/ToHtml.HC"$.
|
||||
|
||||
<$LK,"TwoLetterCmd",A="FF:::/Zenith/DolDoc/DocInit.HC,ST_DOC_CMDS"$> See $LK,"Type Defines",A="MN:DOCT_TEXT"$ and $LK,"PrsDollarCmd",A="MN:PrsDollarCmd"$().
|
||||
<$LK,"TwoLetterCmd",A="FF:::/Zenith/DolDoc/DocInit.HC,ST_DOC_CMDS"$> See $LK,"Type Defines",A="MN:DOCT_TEXT"$ and $LK,"ParseDollarCmd",A="MN:ParseDollarCmd"$().
|
||||
$TR,"TX Text"$
|
||||
$ID,2$Normally, text is not bracketed with '$FG,2$$$$FG$', but if you wish to specify flag attr, such as centering text, you can bracket them with '$FG,2$$$$FG$' and enter flags such as "$FG,2$+CX$FG$". You can't edit them normally if they are bracketed by '$FG,2$$$$FG$' unless you toggle to plain text mode with $FG,2$<CTRL-t>$FG$.
|
||||
$ID,-2$$TR,"CR Hard New Line"$
|
||||
|
|
|
@ -109,7 +109,7 @@ $FG,2$Prev$FG$ Previous
|
|||
$FG,2$Pri$FG$ Primary
|
||||
$FG,2$Prod$FG$ Product, Production
|
||||
$FG,2$Prof$FG$ Profile, Profiler
|
||||
$FG,2$Prs$FG$ Parse, Parser
|
||||
$FG,2$Parse$FG$ Parse, Parser
|
||||
$FG,2$Prt$FG$ Partition
|
||||
$FG,2$FunSeg$FG$ Program Section
|
||||
$FG,2$Pt$FG$ Point
|
||||
|
@ -139,7 +139,7 @@ $FG,2$Srv$FG$ Servant
|
|||
$FG,2$Stat$FG$ Status, Statistic
|
||||
$FG,2$Std$FG$ Standard
|
||||
$FG,2$Stk$FG$ Stack
|
||||
$FG,2$Stmt$FG$ Statement
|
||||
$FG,2$Statement$FG$ Statement
|
||||
$FG,2$Str$FG$ String
|
||||
$FG,2$Sym$FG$ Symbol
|
||||
$FG,2$Sync$FG$ Synchronization
|
||||
|
|
BIN
src/Kernel.BIN.C
BIN
src/Kernel.BIN.C
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
//Compiler initializes glbls in AOT bin modules to zero.
|
||||
//$LK,"Globals Set to Zero Here",A="FF:::/Compiler/PrsStmt.HC,Init AOT glbl to zero"$.
|
||||
//$LK,"Globals Set to Zero Here",A="FF:::/Compiler/ParseStatement.HC,Init AOT glbl to zero"$.
|
||||
|
||||
CJob sys_macro_head;
|
||||
CTask *sys_macro_task;
|
||||
|
@ -13,7 +13,7 @@ U8 *rev_bits_table, //Table with U8 bits revd
|
|||
*set_bits_table; //Table with count of set bits in a U8
|
||||
CDate local_time_offset;
|
||||
F64 *pow10_I64,
|
||||
sys_os_version=0.10;
|
||||
sys_os_version=0.10;
|
||||
|
||||
CAutoCompleteDictGlbls acd;
|
||||
CAutoCompleteGlbls ac;
|
||||
|
|
|
@ -336,7 +336,7 @@ I64 ExeCmdLine(CCmpCtrl *cc)
|
|||
MemCpy(ptr2,ptr,STR_LEN-1);
|
||||
}
|
||||
cc->flags&=~CCF_HAS_MISC_DATA;
|
||||
machine_code=LexStmt2Bin(cc,&type);
|
||||
machine_code=LexStatement2Bin(cc,&type);
|
||||
if (machine_code!=INVALID_PTR) {
|
||||
if (!(cc->flags&CCF_JUST_LOAD)) {
|
||||
t0=tS;
|
||||
|
|
|
@ -836,7 +836,7 @@ public class CHashDefineStr:CHashSrcSym
|
|||
#define Cf_INTERNAL_TYPE 1
|
||||
|
||||
public class CHashClass:CHashSrcSym
|
||||
{//See $LK,"PrsClassNew",A="MN:PrsClassNew"$(). base_class of $LK,"CHashFun",A="MN:CHashFun"$
|
||||
{//See $LK,"ParseClassNew",A="MN:ParseClassNew"$(). base_class of $LK,"CHashFun",A="MN:CHashFun"$
|
||||
I64 size,neg_offset;
|
||||
U32 member_cnt;
|
||||
U8 ptr_stars_cnt,raw_type;
|
||||
|
@ -859,7 +859,7 @@ public class CHashClass:CHashSrcSym
|
|||
#define Ff_RET1 15
|
||||
|
||||
public class CHashFun:CHashClass
|
||||
{//See $LK,"PrsFunNew",A="MN:PrsFunNew"$().
|
||||
{//See $LK,"ParseFunNew",A="MN:ParseFunNew"$().
|
||||
CHashClass *return_class;
|
||||
U32 arg_cnt,pad,
|
||||
used_reg_mask,clobbered_reg_mask;
|
||||
|
@ -1821,7 +1821,7 @@ I64 class CAbsCntsI64
|
|||
};
|
||||
|
||||
class CAsmUndefHash
|
||||
{//Only place created is $LK,"Exp Parser",A="FF:::/Compiler/PrsExp.HC,sizeof(CAsmUndefHash)"$ when an undef is found in an ASM exp.
|
||||
{//Only place created is $LK,"Exp Parser",A="FF:::/Compiler/ParseExp.HC,sizeof(CAsmUndefHash)"$ when an undef is found in an ASM exp.
|
||||
CAsmUndefHash *next;
|
||||
CHashExport *hash;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -70,7 +70,7 @@ I64 EdRILex(CRILex *rx)
|
|||
do {
|
||||
Lex(rx->cc1);
|
||||
Lex(rx->cc2);
|
||||
i=PrsKeyWord(rx->cc2);
|
||||
i=ParseKeyWord(rx->cc2);
|
||||
if (rx->cc1->token=='\n' && rx->cc2->token==';' || rx->cc2->token=='{' ||
|
||||
rx->cc2->token=='}' || rx->cc2->token==':' || rx->cc2->token==')' &&
|
||||
!rx->exp_depth || i==KW_ELSE || i==KW_CATCH || i==KW_DO)
|
||||
|
@ -117,7 +117,7 @@ U0 EdRIExp(CRILex *rx)
|
|||
EdRILex(rx);
|
||||
}
|
||||
|
||||
U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
U0 EdRIStatement(CRILex *rx,Bool indent)
|
||||
{
|
||||
I64 i;
|
||||
Bool cont;
|
||||
|
@ -125,55 +125,55 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
|||
rx->depth++;
|
||||
EdRILex(rx);
|
||||
while (rx->cc1->token && rx->cc1->token!='}')
|
||||
EdRIStmt(rx,FALSE);
|
||||
EdRIStatement(rx,FALSE);
|
||||
if (--rx->depth<0) rx->depth=0;
|
||||
EdRILex(rx);
|
||||
} else {
|
||||
if (indent) rx->depth++;
|
||||
do {
|
||||
cont=FALSE;
|
||||
switch (PrsKeyWord(rx->cc1)) {
|
||||
switch (ParseKeyWord(rx->cc1)) {
|
||||
case KW_IF:
|
||||
EdRILex(rx);
|
||||
EdRIExp(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
if (PrsKeyWord(rx->cc1)==KW_ELSE) {
|
||||
EdRIStatement(rx,TRUE);
|
||||
if (ParseKeyWord(rx->cc1)==KW_ELSE) {
|
||||
EdRILex(rx);
|
||||
if (PrsKeyWord(rx->cc1)==KW_IF && rx->cc2->token!='\n')
|
||||
EdRIStmt(rx,FALSE);
|
||||
if (ParseKeyWord(rx->cc1)==KW_IF && rx->cc2->token!='\n')
|
||||
EdRIStatement(rx,FALSE);
|
||||
else
|
||||
EdRIStmt(rx,TRUE);
|
||||
EdRIStatement(rx,TRUE);
|
||||
}
|
||||
break;
|
||||
case KW_TRY:
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
if (PrsKeyWord(rx->cc1)==KW_CATCH) {
|
||||
EdRIStatement(rx,TRUE);
|
||||
if (ParseKeyWord(rx->cc1)==KW_CATCH) {
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
EdRIStatement(rx,TRUE);
|
||||
}
|
||||
break;
|
||||
case KW_LOCK:
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
EdRIStatement(rx,TRUE);
|
||||
break;
|
||||
case KW_FOR:
|
||||
case KW_WHILE:
|
||||
EdRILex(rx);
|
||||
EdRIExp(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
EdRIStatement(rx,TRUE);
|
||||
break;
|
||||
case KW_ASM:
|
||||
case KW_CLASS:
|
||||
case KW_UNION:
|
||||
if (EdRILex(rx)==TK_IDENT)
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
EdRIStatement(rx,TRUE);
|
||||
break;
|
||||
case KW_DO:
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
if (PrsKeyWord(rx->cc1)==KW_WHILE) {
|
||||
EdRIStatement(rx,TRUE);
|
||||
if (ParseKeyWord(rx->cc1)==KW_WHILE) {
|
||||
EdRILex(rx);
|
||||
EdRIExp(rx);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
|||
EdRILex(rx);
|
||||
i=0;
|
||||
while (rx->cc1->token && rx->cc1->token!='}') {
|
||||
switch (PrsKeyWord(rx->cc1)) {
|
||||
switch (ParseKeyWord(rx->cc1)) {
|
||||
case KW_START:
|
||||
rx->depth+=i; i=0;
|
||||
while (EdRILex(rx) && rx->cc1->token!=':');
|
||||
|
@ -209,7 +209,7 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
|||
break;
|
||||
default:
|
||||
if (rx->cc1->token)
|
||||
EdRIStmt(rx,TRUE);
|
||||
EdRIStatement(rx,TRUE);
|
||||
}
|
||||
}
|
||||
if (--rx->depth<0) rx->depth=0;
|
||||
|
@ -259,7 +259,7 @@ CQueueVectU8 *EdRICode(CDoc *doc)
|
|||
rx->indent=QueueVectU8New(doc->cur_entry->y);
|
||||
|
||||
Lex(rx->cc1);
|
||||
EdRIStmt(rx,FALSE);
|
||||
EdRIStatement(rx,FALSE);
|
||||
|
||||
CmpCtrlDel(rx->cc1);
|
||||
CmpCtrlDel(rx->cc2);
|
||||
|
|
|
@ -35,7 +35,7 @@ U0 DocInit()
|
|||
if (tmph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_CMD)) {
|
||||
i=tmph->user_data0;
|
||||
Lex(cc);
|
||||
PrsDocFlags(cc,&doldoc.dft_de_flags[i],&doldoc.dft_type_flags[i]);
|
||||
ParseDocFlags(cc,&doldoc.dft_de_flags[i],&doldoc.dft_type_flags[i]);
|
||||
}
|
||||
if (cc->token==';')
|
||||
Lex(cc);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#help_index "DolDoc"
|
||||
|
||||
I64 PrsDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
|
||||
I64 ParseDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
|
||||
{
|
||||
I64 res=-1;
|
||||
CHashGeneric *tmph;
|
||||
|
@ -23,7 +23,7 @@ I64 PrsDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
|
|||
return res;
|
||||
}
|
||||
|
||||
I64 PrsDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
|
||||
I64 ParseDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
|
||||
{
|
||||
I64 res=-1;
|
||||
Bool turn_on;
|
||||
|
@ -35,7 +35,7 @@ I64 PrsDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
|
|||
else
|
||||
break;
|
||||
Lex(cc);
|
||||
res=PrsDocFlagSingle(cc,_de_flags,_type,turn_on);
|
||||
res=ParseDocFlagSingle(cc,_de_flags,_type,turn_on);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
|||
return buf2;
|
||||
}
|
||||
|
||||
CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
CDocEntry *ParseDollarCmd(CDoc *doc,U8 *st)
|
||||
{//Uses $LK-UL,"Lex",A="MN:Lex"$() to parse a string and make Doc entries.
|
||||
I64 i,j,de_flags,processed_flags,attr=DOC_DFT;
|
||||
U8 *ptr,*st2;
|
||||
|
@ -241,7 +241,7 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
|||
doc_e->type|=doldoc.dft_type_flags[i];
|
||||
doc_e->raw_type=RT_I64;
|
||||
doc_e->len=DOCE_LEN_DFT;
|
||||
j=PrsDocFlags(cc,&doc_e->de_flags,&doc_e->type);
|
||||
j=ParseDocFlags(cc,&doc_e->de_flags,&doc_e->type);
|
||||
cc->htc.hash_table_lst=old_hash_table_lst;
|
||||
switch [i] {
|
||||
case DOCT_CHECK_BOX:
|
||||
|
@ -296,7 +296,7 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
|||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
cc->htc.hash_table_lst=old_hash_table_lst;
|
||||
j=PrsDocFlagSingle(cc,&doc_e->de_flags,&doc_e->type,TRUE);
|
||||
j=ParseDocFlagSingle(cc,&doc_e->de_flags,&doc_e->type,TRUE);
|
||||
if (!(de_flags=~processed_flags & doc_e->de_flags & DOCEG_HAS_ARG))
|
||||
break;
|
||||
if (cc->token=='=')
|
||||
|
|
|
@ -117,7 +117,7 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
|||
*ptr4++=ch;
|
||||
}
|
||||
*ptr4=0;
|
||||
if (doc_e=PrsDollarCmd(doc,st2)) {
|
||||
if (doc_e=ParseDollarCmd(doc,st2)) {
|
||||
res=doc_e;
|
||||
DocInsEntry(doc,doc_e);
|
||||
}
|
||||
|
|
|
@ -10,11 +10,11 @@ Cd(__DIR__);;
|
|||
#include "GrDC"
|
||||
#include "GrInitB"
|
||||
#include "GrMath"
|
||||
#include "GrScreen"
|
||||
#include "GrScreen"
|
||||
#include "GrBitMap"
|
||||
#include "GrPrimatives"
|
||||
#include "GrComposites"
|
||||
#include "ScrnCast"
|
||||
#include "ScreenCast"
|
||||
|
||||
#define SPE_ABORT (-1)
|
||||
#define SPE_EXIT 0
|
||||
|
|
Loading…
Reference in a new issue