1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-13 05:44:11 +02:00

Show comptime emits as embedded sourceviews

This commit is contained in:
Brian Fiete 2022-04-16 06:27:54 -07:00
parent ee27f6fd02
commit 4d1e14a1c3
65 changed files with 3360 additions and 633 deletions

View file

@ -17,6 +17,48 @@ namespace IDE
public const char8 cNativeSlash = Path.DirectorySeparatorChar;
public const char8 cOtherSlash = Path.AltDirectorySeparatorChar;
public static bool GenericEquals(StringView lhs, StringView rhs)
{
void SkipGeneric(StringView str, ref int i)
{
int depth = 0;
while (i < str.Length)
{
char8 c = str[i++];
if (c == '<')
depth++;
if (c == '>')
{
if (--depth == 0)
return;
}
}
}
int li = 0;
int ri = 0;
while ((li < lhs.Length) && (ri < rhs.Length))
{
char8 lc = lhs[li];
char8 rc = rhs[ri];
if (lc != rc)
return false;
if (lc == '<')
{
SkipGeneric(lhs, ref li);
SkipGeneric(rhs, ref ri);
continue;
}
li++;
ri++;
}
return (li == lhs.Length) && (ri == rhs.Length);
}
public static void AppendWithOptionalQuotes(String targetStr, StringView srcFileName)
{
bool hasSpace = srcFileName.Contains(' ');