コード例 #1
0
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;
}
コード例 #2
0
ファイル: qctx.cpp プロジェクト: earonesty/smx
inline void qCtx::ParseC(qStr *in, qStr *out, char c)
{
    if (c == '%') {
        ParseFunc(in, out);
    } else {
        out->PutC(c);
    }
}
コード例 #3
0
inline void qCtxComp::ParseC(qStr *in, qStr *out, char c)
{
	if (c == T_PCT) {
		ParseFunc(in, out);
	} else {
		OutC(c);
	}
}
コード例 #4
0
ファイル: Parser.cpp プロジェクト: Arkm4n/Syntaxer
 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));
 }
コード例 #5
0
ファイル: parser.cpp プロジェクト: ValeevaDA/compiler-236
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;
	}
}
コード例 #6
0
ファイル: qctx.cpp プロジェクト: earonesty/smx
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;
}
コード例 #7
0
int CProtocolUBX::Parse(unsigned char* pBuffer, int iSize)
{
    return ParseFunc(pBuffer, iSize);
}
コード例 #8
0
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;
}
コード例 #9
0
ファイル: Parser.cpp プロジェクト: Arkm4n/Syntaxer
 sptr<SymFunc> Parser::Parse()
 {
     return ParseFunc(true);
 }