Example #1
0
bool_t ParseMacroArg(char* src, uint32_t size)
{
	char* arg = fstk_GetMacroArgValue(src[1]);
    lex_SkipBytes(size);
	if(arg != NULL)
	    lex_UnputString(arg);
    return false;
}
Example #2
0
static void
expandEscapeSequence(char** destination, char escapeSymbol) {
    if (escapeSymbol == '@' || (escapeSymbol >= '0' && escapeSymbol <= '9')) {
        *destination += appendAndFreeString(*destination, fstk_GetMacroArgValue(escapeSymbol));
    } else {
        *(*destination)++ = '\\';
        *(*destination)++ = escapeSymbol;
    }
}
Example #3
0
static bool_t ParseSymbol(char* src, uint32_t size)
{
	stringbuffer* pBuffer = strbuf_Create();
	string* pString;
	uint32_t i;
	bool_t r;

	for(i = 0; i < size; ++i)
	{
		char ch = *src++;
		
		if(ch == '\\')
		{
			if(i + 1 < size)
			{
				char* marg = NULL;

				ch = *src++;
				++i;
				
				if(ch == '@')
					marg = fstk_GetMacroRunID();
				else if(ch >= '0' && ch <= '9')
					marg = fstk_GetMacroArgValue(ch);
					
				if(marg)
				{
					strbuf_AppendStringZero(pBuffer, marg);
					continue;
				}
			}

			prj_Fail(ERROR_ID_MALFORMED);
			strbuf_Free(pBuffer);
			return false;
		}

		strbuf_AppendChar(pBuffer, ch);
	}

	pString = strbuf_String(pBuffer);
	strbuf_Free(pBuffer);
	
	if(g_bDontExpandStrings == 0 && sym_IsString(pString))
	{
		string* pValue = sym_GetStringValueByName(pString);
		int len = str_Length(pValue);
		int i;

		lex_SkipBytes(size);
		lex_UnputString(str_String(pValue));

		for(i = 0; i < len; ++i)
		{
			if(str_CharAt(pValue, i) == '\n')
				g_pFileContext->LineNumber -= 1;
		}
		
		r = false;
		str_Free(pValue);
	}
	else
	{
		strcpy(g_CurrentToken.Value.aString, str_String(pString));
		r = true;
	}
	
	str_Free(pString);
	return r;
}