Update to version 1.0.0 #3
4 changed files with 57 additions and 1 deletions
|
@ -3,3 +3,6 @@ Projects = {Bofa = {Path = "."}}
|
||||||
|
|
||||||
[Workspace]
|
[Workspace]
|
||||||
StartupProject = "Bofa"
|
StartupProject = "Bofa"
|
||||||
|
|
||||||
|
[Configs.Test.Win64]
|
||||||
|
LargeStrings = true
|
||||||
|
|
|
@ -1,5 +1,48 @@
|
||||||
namespace Bofa;
|
namespace Bofa;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
using Bofa.Parser;
|
||||||
|
|
||||||
class BofaParser
|
class BofaParser
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static Result<void, int64> Parse(StringView pToParse, List<Bofa> pResult)
|
||||||
|
{
|
||||||
|
StringStream stream = new .(pToParse, .Reference);
|
||||||
|
defer delete stream;
|
||||||
|
return Parse(stream, pResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result<void, int64> Parse(Stream pToParse, List<Bofa> pResult)
|
||||||
|
{
|
||||||
|
if(pToParse == null || pResult == null)
|
||||||
|
return .Err(-1);
|
||||||
|
|
||||||
|
StreamReader reader = new .(pToParse);
|
||||||
|
defer delete reader;
|
||||||
|
|
||||||
|
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 = scope .();
|
||||||
|
if(reader.ReadLine(l) case .Err)
|
||||||
|
return .Err(-2);
|
||||||
|
var entry = ParseLine(l, line);
|
||||||
|
line++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return .Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ParserEntry ParseLine(StringView pLine, int64 pLineNumber)
|
||||||
|
{
|
||||||
|
StringView line = pLine;
|
||||||
|
ParserEntry toReturn = .();
|
||||||
|
|
||||||
|
uint32 depth;
|
||||||
|
return .();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,8 @@ using System;
|
||||||
|
|
||||||
struct ParserEntry
|
struct ParserEntry
|
||||||
{
|
{
|
||||||
public uint64 Line;
|
public int64 Line;
|
||||||
|
public int64 Depth = 0;
|
||||||
public EParserEntryType Type;
|
public EParserEntryType Type;
|
||||||
public ParserEntryUnion Data;
|
public ParserEntryUnion Data;
|
||||||
}
|
}
|
|
@ -1,5 +1,14 @@
|
||||||
namespace Bofa.Testing;
|
namespace Bofa.Testing;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
class Default
|
class Default
|
||||||
{
|
{
|
||||||
|
[Test]
|
||||||
|
public static void Default_Test_1()
|
||||||
|
{
|
||||||
|
BofaParser.Parse("Without an ending", scope .()).IgnoreError();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue