Store src data in tokens
This commit is contained in:
@@ -54,25 +54,25 @@ internal static class Program
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static List<ModuleNode> RunFrontend(string path)
|
||||
private static List<ModuleNode> RunFrontend(string rootFilePath)
|
||||
{
|
||||
List<ModuleNode> modules = [];
|
||||
RunFrontend(path, modules);
|
||||
RunFrontend(rootFilePath, modules);
|
||||
return modules;
|
||||
}
|
||||
|
||||
private static void RunFrontend(string path, List<ModuleNode> modules)
|
||||
private static void RunFrontend(string rootFilePath, List<ModuleNode> modules)
|
||||
{
|
||||
var files = Directory.EnumerateFiles(path, "*.nub", SearchOption.TopDirectoryOnly);
|
||||
var filePaths = Directory.EnumerateFiles(rootFilePath, "*.nub", SearchOption.TopDirectoryOnly);
|
||||
|
||||
List<Token> tokens = [];
|
||||
foreach (var file in files)
|
||||
foreach (var filePath in filePaths)
|
||||
{
|
||||
var src = File.ReadAllText(file);
|
||||
tokens.AddRange(Lexer.Lex(src));
|
||||
var src = File.ReadAllText(filePath);
|
||||
tokens.AddRange(Lexer.Lex(src, filePath));
|
||||
}
|
||||
|
||||
var module = Parser.ParseModule(tokens, path);
|
||||
var module = Parser.ParseModule(tokens, rootFilePath);
|
||||
modules.Add(module);
|
||||
|
||||
foreach (var import in module.Imports)
|
||||
|
||||
Reference in New Issue
Block a user