diff options
Diffstat (limited to 'src/main.zig')
-rw-r--r-- | src/main.zig | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/main.zig b/src/main.zig index e3619f8fd..73f03f9ad 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,18 +1,27 @@ const std = @import("std"); const lex = @import("js_lexer.zig"); +const logger = @import("logger.zig"); const alloc = @import("alloc.zig"); +const options = @import("options.zig"); +const js_parser = @import("js_parser.zig"); pub fn main() anyerror!void { - const args = try std.process.argsAlloc(alloc.dynamic); - const stdout = std.io.getStdOut(); - const stderr = std.io.getStdErr(); + try alloc.setup(std.heap.page_allocator); + // const args = try std.process.argsAlloc(alloc.dynamic); + // // const stdout = std.io.getStdOut(); + // // const stderr = std.io.getStdErr(); - if (args.len < 1) { - const len = stderr.write("Pass a file path"); - return; - } + // // if (args.len < 1) { + // // const len = stderr.write("Pass a file"); + // // return; + // // } - // const path = try std.fs.realpathAlloc(alloc.dynamic, args[args.len - 1]); - // const file = try std.fs.openFileAbsolute(path, std.fs.File.OpenFlags{}); - // const bytes = try file.readToEndAlloc(alloc.dynamic, std.math.maxInt(usize)); + // // alloc + + const entryPointName = "/var/foo/index.js"; + const code = "for (let i = 0; i < 100; i++) { console.log('hi') aposkdpoaskdpokasdpokasdpokasdpokasdpoaksdpoaksdpoaskdpoaksdpoaksdpoaskdpoaskdpoasdk; "; + var parser = try js_parser.Parser.init(try options.TransformOptions.initUncached(alloc.dynamic, entryPointName, code), alloc.dynamic); + var res = try parser.parse(); + + std.debug.print("{s}", .{res}); } |