Example #1
0
StringRef FileInfo::GetExtension( StringRef file )
{
	intp index= file.IndexOf('.');
	if (index>0)
	{
		return file.SubString(index);
	}
	return StringRef::Empty;
}
Example #2
0
bool SirenTextParser::EndType(StringRef& refProto)
{
	refProto = refProto.TrimBegin();
	intp index = refProto.IndexOf('}');
	if (index < 0)
	{
		Log::Error("Cannot find }");
		return false;
	}

	refProto = refProto.SubString(index + 1);
	return EndBlock(refProto);;
}
Example #3
0
StringRef SirenTextParser::ReadAttribute(StringRef& refProto)
{
	refProto = refProto.TrimBegin();
	intp index = refProto.IndexOf(']');
	if (index < 0)
	{
		Log::Error("Cannot find ] on attribute");
		return false;
	}

	StringRef result = refProto.SubString(0, index);
	refProto = refProto.SubString(index + 1);


	return result;
}
Example #4
0
bool SirenTextParser::ReadFunctionArguments(StringRef& refProto, List<StringRef>& outArguments)
{
	//read arguments
	intp endIndex = refProto.IndexOf(')');
	if (endIndex < 0)
	{
		Log::Error("Invalid function.Lost ')' ");
		return false;
	}
	StringRef args = refProto.SubString(1, endIndex - 1);
	bool isSuccess = StringParser::Split(args, ",", outArguments, false);
	if (!isSuccess)
	{
		Log::FormatError("Invalid function argument:{}", args);
		return false;
	}

	refProto = refProto.SubString(endIndex);
	return EndBlock(refProto);
}
Example #5
0
bool ISirenFunction::Parse(SirenAssembly& assembly, StringRef& refProto)
{
	//read arguments
	intp endIndex = refProto.IndexOf(')');
	if (endIndex < 0)
	{
		Log::Error("Invalid function.Lost ')' ");
		return false;
	}
	StringRef args = refProto.SubString(1, endIndex - 1);
	bool isSuccess = StringParser::Split(args, ",", mArguments, false);
	if (!isSuccess)
	{
		Log::FormatError("Invalid function argument:{}", args);
		return false;
	}

	refProto = refProto.SubString(endIndex);
	return SirenTextParser::EndBlock(refProto);
}