Update to version 1.0.0 #3
6 changed files with 32 additions and 43 deletions
16
src/Bofa.bf
16
src/Bofa.bf
|
@ -5,18 +5,8 @@ using System.Collections;
|
|||
|
||||
class Bofa
|
||||
{
|
||||
private String __line = null; //The actual line
|
||||
private String _line
|
||||
{
|
||||
get
|
||||
{
|
||||
return __line;
|
||||
}
|
||||
set
|
||||
{
|
||||
__line = value;
|
||||
}
|
||||
}
|
||||
|
||||
private String _line = null ~ if(_ != null) delete _; //The actual line
|
||||
private Bofa _lastObject = null; //If we are a container we keep track of the last container inside of us
|
||||
|
||||
public StringView Name;
|
||||
|
@ -156,8 +146,6 @@ class Bofa
|
|||
|
||||
public ~this()
|
||||
{
|
||||
if(_line != null)
|
||||
delete _line;
|
||||
if(Type == .Text)
|
||||
delete Value.Text;
|
||||
else if(Type == .Object)
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Security.Cryptography;
|
|||
using System.Collections;
|
||||
|
||||
using Bofa.Parser;
|
||||
using Bofa;
|
||||
|
||||
class BofaParser
|
||||
{
|
||||
|
@ -31,8 +32,7 @@ class BofaParser
|
|||
int64 line = 1;
|
||||
while (reader.Peek() case .Ok) //This might technically cause an issue when there is data added to the stream while we where busy processing, but if you hook this up to a network stream you deserve this happening to you
|
||||
{
|
||||
String l = new .();
|
||||
|
||||
String l = new String();
|
||||
if (reader.ReadLine(l) case .Err)
|
||||
{ //Despite data being here, we cannot read it
|
||||
delete l;
|
||||
|
@ -50,6 +50,8 @@ class BofaParser
|
|||
}
|
||||
if (entry.Type == .Error)
|
||||
{
|
||||
if(entry.Data.Bofa != null)
|
||||
delete entry.Data.Bofa;
|
||||
pErrors.Add(line);
|
||||
continue;
|
||||
}
|
||||
|
@ -193,19 +195,20 @@ class BofaParser
|
|||
Bofa bofaRes = new Bofa();
|
||||
bofaRes.[Friend]_line = pLine;
|
||||
bofaRes.Name = nameres.0;
|
||||
toReturn.Type = .Bofa;
|
||||
toReturn.Data.Bofa = bofaRes;
|
||||
bofaRes.Typename = typeName;
|
||||
if (type.0 == "o")
|
||||
{
|
||||
bofaRes.Type = .Object;
|
||||
bofaRes.Value.Object = new .();
|
||||
toReturn.Type = .Bofa;
|
||||
toReturn.Data.Bofa = bofaRes;
|
||||
return toReturn;
|
||||
}
|
||||
bofaRes.Type = .Array;
|
||||
bofaRes.Value.Array = new .();
|
||||
toReturn.Type = .Bofa;
|
||||
toReturn.Data.Bofa = bofaRes;
|
||||
else
|
||||
{
|
||||
bofaRes.Type = .Array;
|
||||
bofaRes.Value.Array = new .();
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
#endregion
|
||||
|
@ -219,6 +222,11 @@ class BofaParser
|
|||
Bofa bofaRes = new .();
|
||||
bofaRes.Name = nameres.0;
|
||||
bofaRes.Typename = typeName;
|
||||
|
||||
toReturn.Data.Bofa = bofaRes;
|
||||
bofaRes.[Friend]_line = pLine;
|
||||
|
||||
|
||||
switch (type.0)
|
||||
{
|
||||
case "n":
|
||||
|
@ -226,7 +234,6 @@ class BofaParser
|
|||
var result = float.Parse(line);
|
||||
if (result case .Err)
|
||||
{
|
||||
delete bofaRes;
|
||||
toReturn.Type = .Error;
|
||||
return toReturn;
|
||||
}
|
||||
|
@ -238,7 +245,6 @@ class BofaParser
|
|||
bofaRes.Value.Boolean = false;
|
||||
else
|
||||
{
|
||||
delete bofaRes;
|
||||
toReturn.Type = .Error;
|
||||
return toReturn;
|
||||
}
|
||||
|
@ -251,7 +257,6 @@ class BofaParser
|
|||
var result = double.Parse(line);
|
||||
if (result case .Err)
|
||||
{
|
||||
delete bofaRes;
|
||||
toReturn.Type = .Error;
|
||||
return toReturn;
|
||||
}
|
||||
|
@ -261,7 +266,6 @@ class BofaParser
|
|||
var result = int32.Parse(line);
|
||||
if (result case .Err)
|
||||
{
|
||||
delete bofaRes;
|
||||
toReturn.Type = .Error;
|
||||
return toReturn;
|
||||
}
|
||||
|
@ -271,7 +275,6 @@ class BofaParser
|
|||
var result = int64.Parse(line);
|
||||
if (result case .Err)
|
||||
{
|
||||
delete bofaRes;
|
||||
toReturn.Type = .Error;
|
||||
return toReturn;
|
||||
}
|
||||
|
@ -283,15 +286,12 @@ class BofaParser
|
|||
bofaRes.Value.Custom = line;
|
||||
bofaRes.Type = .Custom;
|
||||
default: //Unknown type
|
||||
delete bofaRes;
|
||||
toReturn.Type = .Error;
|
||||
return toReturn;
|
||||
}
|
||||
#endregion
|
||||
//If this ever returns something went wrong
|
||||
bofaRes.[Friend]_line = pLine;
|
||||
toReturn.Type = .Bofa;
|
||||
toReturn.Data.Bofa = bofaRes;
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ extension Bofa
|
|||
if(pToAdd.Type == .Text && target.Type == .Text)
|
||||
{
|
||||
target.Value.Text.Append(scope $"\n{pToAdd.Data.Text}");
|
||||
//delete pToAdd.Data.Text;
|
||||
return .Ok;
|
||||
}
|
||||
else if(target.Type == .Object)
|
||||
|
@ -41,7 +40,7 @@ extension Bofa
|
|||
return .Ok;
|
||||
}
|
||||
return .Err;
|
||||
|
||||
|
||||
/*
|
||||
//See if we can insert and do so
|
||||
if(pToAdd.Depth == 0 || (pToAdd.Type == .Text && pToAdd.Depth == 1))
|
||||
|
|
|
@ -5,6 +5,6 @@ using System;
|
|||
[Union]
|
||||
struct ParserEntryUnion
|
||||
{
|
||||
public Bofa Bofa;
|
||||
public Bofa Bofa = null;
|
||||
public StringView Text;
|
||||
}
|
|
@ -8,13 +8,14 @@ class Program
|
|||
|
||||
public static void Main()
|
||||
{
|
||||
|
||||
Bofa.Testing.Profiling.Profiling_Depth_Testing();
|
||||
Bofa.Testing.Profiling.Profiling_Depth_Testing_Medium();
|
||||
Bofa.Testing.Profiling.Profiling_Normal();
|
||||
Bofa.Testing.Profiling.Profiling_Normal_Medium();
|
||||
Bofa.Testing.Profiling.Profiling_Normal_Large();
|
||||
Bofa.Testing.Profiling.Profiling_Texts();
|
||||
Bofa.Testing.Profiling.Profiling_Texts_Large();
|
||||
Bofa.Testing.Profiling.Profiling_Depth_Testing();
|
||||
Bofa.Testing.Profiling.Profiling_Depth_Testing_Medium();
|
||||
Bofa.Testing.Profiling.Profiling_Normal();
|
||||
Bofa.Testing.Profiling.Profiling_Normal_Medium();
|
||||
Bofa.Testing.Profiling.Profiling_Normal_Large();
|
||||
Bofa.Testing.Profiling.Profiling_Texts();
|
||||
Bofa.Testing.Profiling.Profiling_Texts_Large();
|
||||
|
||||
Console.Read();
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ class Profiling
|
|||
{
|
||||
for (int i < 1000)
|
||||
{
|
||||
|
||||
String toParse = scope .();
|
||||
toParse.Append(scope $"""
|
||||
l one line of text
|
||||
|
@ -20,7 +21,7 @@ class Profiling
|
|||
t text goes here
|
||||
- Text addendum
|
||||
n tone 12.5
|
||||
#husdhfiudshfds
|
||||
husdhfiudshfds
|
||||
bn biggie 65645645645.6
|
||||
i int 234345
|
||||
bi bint 38432847329847329
|
||||
|
|
Loading…
Add table
Reference in a new issue