aboutsummaryrefslogtreecommitdiff
path: root/src/js_parser/js_parser.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-07-30 00:50:29 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-07-30 00:50:29 -0700
commit7245f90b2dd686acacb9c8ee03f5d8fb05e09aeb (patch)
tree120d6d093ba609f93f1514fde16c0a3402855336 /src/js_parser/js_parser.zig
parentba743d776a6a417bdf42755b62a7868b15ebfe73 (diff)
downloadbun-7245f90b2dd686acacb9c8ee03f5d8fb05e09aeb.tar.gz
bun-7245f90b2dd686acacb9c8ee03f5d8fb05e09aeb.tar.zst
bun-7245f90b2dd686acacb9c8ee03f5d8fb05e09aeb.zip
little bit of errors, little bit of bytecode caching. neither finished
Former-commit-id: c774c395136d58330aa7cad7e9fa434bcef7d5c6
Diffstat (limited to 'src/js_parser/js_parser.zig')
-rw-r--r--src/js_parser/js_parser.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig
index 5ee6eab94..a987351c7 100644
--- a/src/js_parser/js_parser.zig
+++ b/src/js_parser/js_parser.zig
@@ -1,5 +1,19 @@
usingnamespace @import("imports.zig");
+// Dear reader,
+// There are some things you should know about this file to make it easier for humans to read
+// "P" is the internal parts of the parser
+// "p.e" allocates a new Expr
+// "p.b" allocates a new Binding
+// "p.s" allocates a new Stmt
+// We do it this way so if we want to refactor how these are allocated in the future, we only have to modify one function to change it everywhere
+// Everything in JavaScript is either an Expression, a Binding, or a Statement.
+// Expression: foo(1)
+// Statement: let a = 1;
+// Binding: 1
+// While the names for Expr, Binding, and Stmt are directly copied from esbuild, those were likely inspired by Go's parser.
+// which is another example of a very fast parser.
+
const TemplatePartTuple = std.meta.Tuple(&[_]type{ []E.TemplatePart, logger.Loc });
const ScopeOrderList = std.ArrayListUnmanaged(?ScopeOrder);