aboutsummaryrefslogtreecommitdiff
path: root/src/main_wasm.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main_wasm.zig')
-rw-r--r--src/main_wasm.zig31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main_wasm.zig b/src/main_wasm.zig
new file mode 100644
index 000000000..2adcbdce5
--- /dev/null
+++ b/src/main_wasm.zig
@@ -0,0 +1,31 @@
+const std = @import("std");
+const lex = @import("js_lexer.zig");
+const logger = @import("logger.zig");
+const alloc = @import("alloc.zig");
+
+pub fn main() anyerror!void {
+ 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");
+ // // return;
+ // // }
+
+ // // alloc
+ const msgs = std.ArrayList(logger.Msg).init(alloc.dynamic);
+ const log = logger.Log{
+ .msgs = msgs,
+ };
+
+ const source = logger.Source.initPathString("index.js", "for (let i = 0; i < 100; i++) { console.log('hi') aposkdpoaskdpokasdpokasdpokasdpokasdpoaksdpoaksdpoaskdpoaksdpoaksdpoaskdpoaskdpoasdk; }", alloc.dynamic);
+
+ var lexer = try lex.Lexer.init(log, source, alloc.dynamic);
+ lexer.next();
+ while (lexer.token != lex.T.t_end_of_file) {
+ lexer.next();
+ }
+ const v = try std.io.getStdOut().write("Finished");
+}