dword rbBytecode::LoadToken() { CurrentByte = GetCodeOffset(); ApplyScheduled( CurrentByte ); CheckBracket( CurrentByte ); byte b; Arc << b; dword token = b; if( token >= IdExtended ) { if( (token & 0xF0) == IdExtended ) { byte token2; Arc << token2; token = ((token-IdExtended)<<8) + token2; } ParseFunc(token); } else { ParseCode(token); } return token; }
inline void qCtx::ParseC(qStr *in, qStr *out, char c) { if (c == '%') { ParseFunc(in, out); } else { out->PutC(c); } }
inline void qCtxComp::ParseC(qStr *in, qStr *out, char c) { if (c == T_PCT) { ParseFunc(in, out); } else { OutC(c); } }
void Parser::ParseVarSymbols(sptr<SymTable> table, bool is_record) { table = table ? table : currSymTable; do { if (Match(PROCEDURE, FUNCTION)) { if (is_record) throw ParserException("functions is not allowed in records"); ParseFunc(); } else { ParseVarList(table); } } while (MatchSkip(SEMICOLON, -1)); }
void Parser::ParseDecl() { while (true) { if (t.GetValue() == "var") ParseVarDecl(); else if(t.GetValue() == "type") ParseTypeDecl(); else if(t.GetValue() == "const") ParseConstDecl(); else if(t.GetValue() == "procedure") ParseProc(); else if(t.GetValue() == "function") ParseFunc(); else break; } }
bool qCtx::ParseArg(qStr *in, qStrBuf &cur, char c) { bool more = true; int numsp = 0; char quoted = '\x0'; int qcnt = 0; int lpc = 0; if (c == '"') { quoted = '"'; c = in->GetC(); } else if (c == T_LC) { quoted = T_LC; c = in->GetC(); qcnt = 1; } do { if (c == T_ESC) { c = in->GetC(); if (c != EOF) cur << c; numsp = 0; } else if (c == '%') { ParseFunc(in, &cur); numsp = 0; } else if (quoted) { if (c == T_LC && quoted == T_LC) { ++qcnt; } else if (c == '"' && quoted == '"') { quoted = '\x0'; lpc = 0; numsp = 0; } else if ( (c == T_RC) && (quoted == T_LC) && (--qcnt <= 0) ) { quoted = '\x0'; numsp = 0; } else { cur << c; } } else if (lpc) { if (c == T_RP) { --lpc; cur << c; numsp = 0; } else if (c == T_LP) { ++lpc; cur << c; numsp = 0; } else if (isspace(c)) { cur << c; ++numsp; } else { numsp = 0; cur << c; } } else { if (c == ',') { if (numsp) cur.Grow(cur.Length() - numsp); break; } else if (c == T_LP) { cur << c; ++lpc; numsp = 0; } else if (c == T_RP) { if (numsp) cur.Grow(cur.Length() - numsp); more = false; break; } else if (isspace(c)) { ++numsp; cur << c; } else { numsp = 0; cur << c; } } } while (EOF != (c = in->GetC())); return c == EOF ? false : more; }
int CProtocolUBX::Parse(unsigned char* pBuffer, int iSize) { return ParseFunc(pBuffer, iSize); }
bool qCtxComp::ParseCompArg(qStr *in, qStrBuf &cur, char c) { bool more = true; int numsp = 0; char quoted = '\x0'; int qcnt = 0; int lpc = 0; CStr tmp; if (c == '"') { quoted = '"'; c = in->GetC(); } else if (c == T_LC) { quoted = T_LC; c = in->GetC(); qcnt = 1; } do { if (c == T_ESC) { c = in->GetC(); if (c != EOF) tmp << c; numsp = 0; } else if (c == '%') { if (tmp.Length()) { C_BASE b; b.bc = BC_OUT; b.ln = tmp.Length(); b.rn = myRn ? rand()%256 : 0; // 2003-05-21 more encryption cur.PutS((char *) &b, sizeof(b)); cur.PutS(tmp); tmp.Grow(0); } ParseFunc(in, &cur); OutFlush(&cur); numsp = 0; } else if (quoted) { if (c == T_LC && quoted == T_LC) { ++qcnt; } else if (c == '"' && quoted == '"') { quoted = '\x0'; lpc = 0; numsp = 0; } else if ( (c == T_RC) && (quoted == T_LC) && (--qcnt <= 0) ) { quoted = '\x0'; numsp = 0; } else { tmp << c; } } else if (lpc) { if (c == T_RP) { --lpc; tmp << c; numsp = 0; } else if (c == T_LP) { ++lpc; tmp << c; numsp = 0; } else if (isspace(c)) { tmp << c; ++numsp; } else { numsp = 0; tmp << c; } } else { if (c == ',') { if (numsp) tmp.Grow(tmp.Length() - numsp); break; } else if (c == T_LP) { tmp << c; ++lpc; numsp = 0; } else if (c == T_RP) { if (numsp) tmp.Grow(tmp.Length() - numsp); more = false; break; } else if (isspace(c)) { ++numsp; tmp << c; } else { numsp = 0; tmp << c; } } } while (EOF != (c = in->GetC())); if (tmp.Length()) { C_BASE b; b.bc = BC_OUT; b.ln = tmp.Length(); b.rn = myRn ? rand()%256 : 0; // 2003-05-21 more encryption cur.PutS((char *) &b, sizeof(b)); cur.PutS(tmp); tmp.Grow(0); } return c == EOF ? false : more; }
sptr<SymFunc> Parser::Parse() { return ParseFunc(true); }