Example #1
0
//
// SC_MustGetNumber
//
void SC_MustGetNumber (void)
{
	if (SC_GetNumber() == false)
	{
		SC_ScriptError ("Missing integer (unexpected end of file).");
	}
}
Example #2
0
void SC_MustGetNumber()
{
	if (SC_GetNumber() == false)
	{
		SC_ScriptError("Missing integer.");
	}
}
Example #3
0
void SC_MustGetNumber(void)
{
    if (!SC_GetNumber())
        SC_ScriptError("Missing integer.");
}
Example #4
0
static void PS_ParseOuter(void)
{
    while(SC_ReadTokens())
    {
        SC_Find();

        switch(sc_parser->tokentype)
        {
        case TK_NONE:
            break;
        case TK_EOF:
            return;
        case TK_IDENIFIER:
            PS_ParseIdentifier();
            break;
        case TK_POUND:
            {
                SC_Find();
                switch(sc_parser->tokentype)
                {
                case TK_INCLUDE:
                    {
                        static char includepath[256];

                        SC_GetString();
                        SC_PushParser();

                        sprintf(includepath, "%s%s",
                            ps_userdirectory, sc_stringbuffer);

                        SC_Open(includepath);
                        PS_ParseOuter();
                        SC_Close();
                    }
                    break;
                case TK_DEFINE:
                    SC_ExpectNextToken(TK_IDENIFIER);
                    SC_AddIdentifier();
                    break;
                case TK_UNDEF:
                    SC_ExpectNextToken(TK_IDENIFIER);
                    SC_RemoveIdentifier();
                    break;
                case TK_SETDIR:
                    SC_GetString();
                    sprintf(ps_userdirectory, "%s", sc_parser->token);
                    break;
                default:
                    break;
                }
            }
            break;
        case TK_MACRO:
            SC_ExpectNextToken(TK_NUMBER);
            M_NewMacro(SC_GetNumber());
            SC_ExpectNextToken(TK_LBRACK);
            PS_ParseInner();
            M_FinishMacro();
            break;
        default:
            SC_Error("Unknown token in outer block: %s", sc_parser->token);
            break;
        }
    }
}
Example #5
0
static void PS_ParseInner(void)
{
    while(SC_ReadTokens())
    {
        SC_Find();

        switch(sc_parser->tokentype)
        {
        case TK_NONE:
            break;
        case TK_EOF:
            return;
        case TK_NUMBER:
            {
                int special;
                int tag;

                special = SC_GetNumber();
                SC_ExpectNextToken(TK_COLON);
                SC_ExpectNextToken(TK_NUMBER);
                tag = SC_GetNumber();

                M_AppendAction(special, tag);

                SC_ExpectNextToken(TK_SEMICOLON);
            }
            break;
        case TK_RBRACK:
            if(ps_enterloop)
            {
                ps_enterloop = false;
                M_NewLine();
                M_AppendAction(204, ps_loopline);
                M_AppendAction(246, ps_loopvalue);
                M_NewLine();
            }
            return;
        case TK_IDENIFIER:
            PS_ParseIdentifier();
            break;
        case TK_WAIT:
            M_NewLine();
            SC_ExpectNextToken(TK_SEMICOLON);
            break;
        case TK_LOOP:
            if(ps_enterloop)
            {
                SC_Error("Nested loops is not allowed");
            }

            ps_enterloop = true;
            M_NewLine();
            ps_loopline = M_GetLine();
            SC_ExpectNextToken(TK_LPAREN);
            SC_ExpectNextToken(TK_NUMBER);
            ps_loopvalue = SC_GetNumber();
            SC_ExpectNextToken(TK_RPAREN);
            SC_ExpectNextToken(TK_LBRACK);
            PS_ParseInner();
            break;
        default:
            SC_Error("Unknown token in macro block: %s", sc_parser->token);
            break;
        }
    }
}