Test parsing
This commit is contained in:
parent
27f2917670
commit
d23a5cd70b
11
Program.cs
11
Program.cs
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
@ -27,12 +27,19 @@ public class Program
|
|||||||
Token[] tokens = new Tokenizer().Tokenize(File.ReadAllText(file));
|
Token[] tokens = new Tokenizer().Tokenize(File.ReadAllText(file));
|
||||||
if(debug)
|
if(debug)
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach(Token token in tokens)
|
foreach(Token token in tokens)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{token.region}: {token.type} {{{token.data}}}");
|
Console.WriteLine($"{token.region}: {token.type} {{{token.data}}}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Parser.ChunkNode root = new Parser().Parse(tokens);
|
||||||
|
Console.WriteLine("Parsed tree:");
|
||||||
|
Console.WriteLine("\tStats:");
|
||||||
|
foreach(Parser.StatNode node in root.block.stats)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"\t\t{node.startRegion}-{node.endRegion}: {node.GetType()}");
|
||||||
|
}
|
||||||
|
Console.WriteLine($"\tRetstat: {root.block.retstat?.startRegion}-{root.block.retstat?.endRegion}");
|
||||||
}
|
}
|
||||||
static readonly Dictionary<string, string> failedFiles = [];
|
static readonly Dictionary<string, string> failedFiles = [];
|
||||||
public static void Test(string directory)
|
public static void Test(string directory)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user