Skip to content

Rework AST memory layout for better memory usage and performance #7920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 176 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
0808d98
add std.MultiArrayList
andrewrk Jan 31, 2021
766b315
std.GeneralPurposeAllocator: logging improvements
andrewrk Jan 31, 2021
4dca99d
stage2: rework AST memory layout
andrewrk Jan 31, 2021
bf8fafc
stage2: tokenizer does not emit line comments anymore
andrewrk Feb 1, 2021
20554d3
zig fmt: start reworking with new memory layout
andrewrk Feb 2, 2021
272a0ab
zig fmt: implement "line comment followed by top-level comptime"
andrewrk Feb 2, 2021
0c6b98b
zig fmt: implement simple test with doc comments
andrewrk Feb 2, 2021
1a83b29
zig fmt: implement if, call, field access, assignment
andrewrk Feb 3, 2021
f5279cb
zig fmt: implement top-level fields
andrewrk Feb 4, 2021
725adf8
zig fmt: builtin calls and array access
andrewrk Feb 4, 2021
4428acf
zig fmt: deref, unwrap optional
kivikakk Feb 4, 2021
8e46d06
zig fmt: implement fn protos and defers
andrewrk Feb 4, 2021
7069459
zig fmt: implement struct init
andrewrk Feb 5, 2021
0b4bb9b
std.MultiArrayList: implement review comments
ifreund Feb 5, 2021
3e960cf
zig fmt: float literal with exponent
ifreund Feb 5, 2021
6f3b93e
zig fmt: struct and anon array initialization
ifreund Feb 5, 2021
0f3fa4d
zig fmt: array types
ifreund Feb 5, 2021
cf42ae1
std.MultiArrayList: use `@memset` builtin for undefined
andrewrk Feb 5, 2021
16a2562
zig fmt: implement container decls
andrewrk Feb 5, 2021
409ca88
zig fmt: trailing comma in fn parameter list
andrewrk Feb 6, 2021
d898945
zig fmt: builtin call with trailing comma
andrewrk Feb 6, 2021
33915cb
zig fmt: implement pointer types
ifreund Feb 6, 2021
0929fcb
zig fmt: implement slices
ifreund Feb 7, 2021
bb7b5ee
zig fmt: implement catch and return
ifreund Feb 7, 2021
1d71b19
zig fmt: implement error set decls
ifreund Feb 7, 2021
0e38362
zig fmt: split Slice and SliceSentinel
ifreund Feb 7, 2021
57cec38
std/zig/ast: fix Tree.lastToken() for blocks
ifreund Feb 7, 2021
aaf13a2
zig fmt: implement break
ifreund Feb 7, 2021
837cd74
zig fmt: fix block lbrace indent
ifreund Feb 8, 2021
d869133
zig fmt: implement switches
ifreund Feb 8, 2021
b1d8a0a
zig fmt: asm expressions
andrewrk Feb 9, 2021
bcafc51
zig fmt: fn protos and anytype
andrewrk Feb 9, 2021
1c79eea
zig fmt: while loops
andrewrk Feb 10, 2021
39acc4c
zig fmt: for loops
andrewrk Feb 10, 2021
ebf04c5
zig fmt: usingnamespace
andrewrk Feb 10, 2021
7295d4b
zig fmt: suspend blocks
andrewrk Feb 10, 2021
25bcf4e
zig fmt: grouped expressions
andrewrk Feb 10, 2021
36eee7b
zig fmt: anytype, fn calls with one param, trailing commas
andrewrk Feb 10, 2021
9d87e6a
zig fmt: remove dead code
andrewrk Feb 10, 2021
fa5fcdd
zig fmt: fix regression with many container members
andrewrk Feb 10, 2021
58db3d2
zig fmt: re-enable now-passing test cases
andrewrk Feb 10, 2021
80b719d
zig fmt: fix typo in firstToken() for pointer types
ifreund Feb 10, 2021
a524e57
zig fmt: support bodyless function decls
ifreund Feb 10, 2021
8c4f3e5
zig fmt: fix render of pointers with ** tokens
ifreund Feb 10, 2021
3110a73
zig fmt: implement Tree.lastToken() for array types
ifreund Feb 10, 2021
928f6f4
zig fmt: implement Tree.lastToken() for array init
ifreund Feb 10, 2021
5df7fc3
zig fmt: implement Tree.lastToken() for struct init
ifreund Feb 10, 2021
515d492
zig fmt: fix 0 element struct and array init
ifreund Feb 10, 2021
4c8caf3
zig fmt: implement Tree.lastToken() for all nodes
ifreund Feb 10, 2021
b6448a5
zig fmt: fix Tree.lastToken() for empty *Two nodes
ifreund Feb 11, 2021
faa3fa6
zig fmt: implement line comments
ifreund Feb 11, 2021
e228996
snake_case Token.Tag
Vexu Feb 11, 2021
bb22490
snake_case Node.Tag
Vexu Feb 11, 2021
288e180
snake_case render.Space
Vexu Feb 11, 2021
3d0f4b9
stage2: start reworking Module/astgen for memory layout changes
andrewrk Feb 12, 2021
b4e344b
Merge remote-tracking branch 'origin/master' into ast-memory-layout
andrewrk Feb 12, 2021
a9db40e
zig fmt: add failing test case for inline/callconv conversion
andrewrk Feb 12, 2021
7630a5c
stage2: more progress towards Module/astgen building with new mem layout
andrewrk Feb 13, 2021
75ba8d8
zig fmt: remove empty lines at start/end of block
ifreund Feb 12, 2021
24798b8
zig fmt: implement multiline string literals
ifreund Feb 13, 2021
c2b4d51
astgen: update a handful of expression types to new mem layout
andrewrk Feb 14, 2021
bbf5a4d
zig fmt: fix inferred error union return types
ifreund Feb 15, 2021
4006a3a
astgen: update more expression types to new mem layout
andrewrk Feb 16, 2021
7051ef3
translate-c: start creating intermediate AST
Vexu Dec 17, 2020
6ecec4c
translate-c: translate C types to stage2 types
Vexu Jan 31, 2021
d835f5c
translate-c: make Node more like Type
Vexu Jan 31, 2021
4c0c9b0
translate-c: convert transBinaryOperator
Vexu Feb 6, 2021
f5041ca
translate-c: more binaryoperator chagnes, blocks and unary type expre…
Vexu Feb 7, 2021
7514c0a
translate-c: unary operator, integers and misc
Vexu Feb 7, 2021
f36849f
translate-c: convert function translation
Vexu Feb 7, 2021
bb867b0
translate-c: convert vardecl and typedef
Vexu Feb 8, 2021
5dac368
translate-c: convert record and enum decls
Vexu Feb 8, 2021
d8b9fca
translate-c: convert casts and string/array init
Vexu Feb 10, 2021
66dd64e
translate-c: convert most control flow
Vexu Feb 10, 2021
cadd448
translate-c: convert switch
Vexu Feb 10, 2021
450b718
translate-c: convert field/array access, call, pre/postcrement
Vexu Feb 10, 2021
c30c2f7
translate-c: convert assignment and conditional exprs
Vexu Feb 11, 2021
66bbd75
translate-c: convert macro translation
Vexu Feb 11, 2021
2a74a1e
translate-c: bunch of small fixes to get it compiling
Vexu Feb 12, 2021
13a9db2
translate-c: begin implementing ast.render
Vexu Feb 12, 2021
d7460db
translate-c: render a bunch of simple nodes and calls
Vexu Feb 13, 2021
1147ecc
translate-c: render variables and builtin calls
Vexu Feb 13, 2021
685778c
translate-c: render unary ops
Vexu Feb 13, 2021
227f167
translate-c: render binops and break/continue
Vexu Feb 13, 2021
f191251
translate-c: render functions
Vexu Feb 13, 2021
c4dfabf
translate-c: render macro functions, use cast type as return type
Vexu Feb 14, 2021
62162a0
translate-c: render control flow
Vexu Feb 14, 2021
c054096
translate-c: render array stuff
Vexu Feb 14, 2021
77a11e6
translate-c: render records and enums
Vexu Feb 15, 2021
78fba4e
translate-c: get all run-translated-c tests passing
Vexu Feb 15, 2021
74e9d4c
translate-c: get all translate-c tests passing
Vexu Feb 16, 2021
9a826cc
translate-c: elide some unecessary casts of literals
Vexu Feb 16, 2021
070e548
std: remove io.AutoIndentingStream
ifreund Feb 16, 2021
895fb2b
zig fmt: implement 'zig fmt: (on|off)' directives
ifreund Feb 16, 2021
4b22628
zig fmt: get rid of Space.no_comment
ifreund Feb 16, 2021
e297475
translate-c: demote untranslatable declarations to externs
Vexu Feb 17, 2021
d5fecbd
translate-c: support scoped typedef, enum and record decls
Vexu Feb 17, 2021
3717bed
translate-c: Add test for using correct block label for StmtExpr
ehaas Feb 14, 2021
7ca53bd
translate-c: improve switch translation
Vexu Feb 17, 2021
c66481f
astgen: finish updating expressions to new mem layout
andrewrk Feb 18, 2021
5a2620f
stage2: fix some of the compilation errors in this branch
andrewrk Feb 18, 2021
29daf10
stage2: fix a couple more compilation errors
andrewrk Feb 18, 2021
df5a812
translate-c: small miscellaneous improvements
Vexu Feb 18, 2021
3aba1fa
translate-c: ensure failed macros don't get defined multiple times
Vexu Feb 18, 2021
9010bd8
stage2: astgen: fix most of the remaining compile errors
andrewrk Feb 19, 2021
914540d
astgen: fix remaining compile errors
andrewrk Feb 19, 2021
974a1c5
translate-c: small fixes to avoid generating invalid code for macros
Vexu Feb 19, 2021
d672c20
Merge pull request #7479 from ziglang/translate-c-ast
Vexu Feb 19, 2021
6f6568b
translate-c: correctly add semicolon to if statements
Vexu Feb 19, 2021
95b95ea
stage2: make same line doc comments a parse error
ifreund Feb 19, 2021
7487856
readme: update introduction link
andrewrk Feb 19, 2021
8fee41b
stage2: AST: clean up parse errors
andrewrk Feb 20, 2021
6959b17
stage2: test harness: panic on OOM rather than assert
andrewrk Feb 20, 2021
70761d7
stage2: remove incorrect newlines from log statements
andrewrk Feb 20, 2021
d8560ed
stage2: fix incorrect ast.Tree.getNodeSource impl
andrewrk Feb 20, 2021
5b597a1
stage2: fix not setting up ZIR arg instruction correctly
andrewrk Feb 20, 2021
ed1e5cb
stage2: fix a couple off by one errors
andrewrk Feb 20, 2021
669c205
stage2: debug line nops supports bigger padding
andrewrk Feb 20, 2021
4074e79
translate-c: use global scope for typedef/record/enum type translatio…
Vexu Feb 20, 2021
88d0e77
parse: implement error for invalid bit range and alignment
andrewrk Feb 21, 2021
15603f4
AST: use fn_proto not fn_decl for extern decls
andrewrk Feb 21, 2021
866f7dc
parser: support more recovery test cases
andrewrk Feb 22, 2021
2da2123
parser: remove support for a recovery test case
andrewrk Feb 22, 2021
79f1876
parser: remove support for recovering from extra top level end curlies
andrewrk Feb 22, 2021
1247b7b
parser: modify another recovery test case
andrewrk Feb 22, 2021
878e99d
parser: fix recovery for missing semicolons
andrewrk Feb 22, 2021
c6efb23
zig fmt: rewrite inline functions as callconv(.Inline)
andrewrk Feb 22, 2021
a17a5ca
translate-c: fix fn_decl vs fn_proto
andrewrk Feb 22, 2021
621ad24
zig fmt: if nested
andrewrk Feb 22, 2021
67dac29
parser: warn on missing for loop payload, recover from invalid global…
Vexu Feb 22, 2021
69d5a10
render: handle comments ending in EOF
Vexu Feb 22, 2021
9287903
zig fmt: correct Node.firstToken for .fn_decl, add error for missing …
Vexu Feb 22, 2021
34c08a9
zig fmt: fix formatting of parser tests
ifreund Feb 22, 2021
ce9b3ee
parser: anytype is not a vaild return type
ifreund Feb 22, 2021
011bc1b
translate-c: switch default should have an empty block not break
Vexu Feb 22, 2021
f3ee10b
zig fmt: fix comments ending with EOF after decls
ifreund Feb 22, 2021
d83698a
translate-c: check for noreturn in switch in more cases
Vexu Feb 22, 2021
4758e0c
update docgen to use new ast
Vexu Feb 22, 2021
550688f
zig fmt: insert trailing comma in switches
ifreund Feb 22, 2021
4563485
zig fmt: fix firstToken() for extern fn_protos
ifreund Feb 22, 2021
253906f
zig fmt: 2nd arg multiline string
andrewrk Feb 22, 2021
b301999
zig fmt: if condition wraps
andrewrk Feb 22, 2021
ec987a7
zig fmt: if condition has line break but must not wrap
andrewrk Feb 22, 2021
20cfa0b
zig fmt: if condition has line break, no fn call comma
andrewrk Feb 23, 2021
fec51ad
zig fmt: while
andrewrk Feb 23, 2021
a6038f0
zig fmt: function params should align nicely
andrewrk Feb 23, 2021
8379fff
zig fmt: alignment in anonymous literal
andrewrk Feb 23, 2021
1253903
zig fmt: struct literal containing a multiline expression
andrewrk Feb 23, 2021
1e3a200
zig fmt: array literal with hint
andrewrk Feb 23, 2021
1f62e87
fix formatting in translate-c test case
Vexu Feb 23, 2021
5306b1a
zig fmt: container doc comments
ifreund Feb 23, 2021
5820bd0
zig fmt: insert trailing comma in fn params with comment
ifreund Feb 23, 2021
0f24b61
zig fmt: insert trailing comma in struct init with comment
ifreund Feb 23, 2021
6b9f19a
zig fmt: remove stray std.debug.print()
ifreund Feb 23, 2021
abfe213
zig fmt: enable array init trailing comment insertion test
ifreund Feb 23, 2021
b028a92
zig fmt: handle comments in array type/init/access
ifreund Feb 23, 2021
01e89c9
translate-c: update to latest AST tag changes
andrewrk Feb 23, 2021
f041425
translate-c: fix using wrong slice and AST tag
andrewrk Feb 23, 2021
ca92593
zig fmt now intentionally respects all empty line comments
andrewrk Feb 23, 2021
4ee368c
zig fmt: comments/line breaks in field access chain
ifreund Feb 23, 2021
6f4a1ba
zig fmt: fn call with comments and multiline strings
andrewrk Feb 23, 2021
bb89c61
zig fmt: multiline string literals + array init
andrewrk Feb 24, 2021
08107a5
zig fmt: fix inline assembly test cases
andrewrk Feb 24, 2021
988f1c6
zig fmt: fn proto end with anytype and comma
andrewrk Feb 24, 2021
4420fe9
zig fmt: for loop with ptr payload and index
andrewrk Feb 24, 2021
05f3048
zig fmt: add 3 more disabled failing test cases
andrewrk Feb 24, 2021
bf64220
std.MultiArrayList: add workaround for LLVM bug
andrewrk Feb 24, 2021
db4c15b
zig fmt: respect extra newline between fn and pub usingnamespace
andrewrk Feb 24, 2021
1b8eca0
zig fmt: fix firstToken() for switch_case
ifreund Feb 24, 2021
15c7c6a
zig fmt: handle comments in switch case value list
ifreund Feb 24, 2021
371b21b
zig fmt: fix comment indent after multiline single statement if/while…
ifreund Feb 24, 2021
52c45bf
zig fmt: rework single statement if/while/for indentation
ifreund Feb 24, 2021
38441b5
MultiArrayList: use @memcpy as a workaround
andrewrk Feb 24, 2021
8e6c2b7
Merge remote-tracking branch 'origin/master' into ast-memory-layout
andrewrk Feb 24, 2021
c79ee1f
build.zig: expose a strip option
andrewrk Feb 24, 2021
9ada763
zig fmt: function with labeled block as return type
andrewrk Feb 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/lib/std/heap.zig"
"${CMAKE_SOURCE_DIR}/lib/std/heap/arena_allocator.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/auto_indenting_stream.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/buffered_atomic_file.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/buffered_writer.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/change_detection_stream.zig"
Expand Down Expand Up @@ -408,6 +407,7 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/lib/std/meta.zig"
"${CMAKE_SOURCE_DIR}/lib/std/meta/trailer_flags.zig"
"${CMAKE_SOURCE_DIR}/lib/std/meta/trait.zig"
"${CMAKE_SOURCE_DIR}/lib/std/multi_array_list.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os/bits.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os/bits/linux.zig"
Expand Down Expand Up @@ -573,6 +573,7 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/src/target.zig"
"${CMAKE_SOURCE_DIR}/src/tracy.zig"
"${CMAKE_SOURCE_DIR}/src/translate_c.zig"
"${CMAKE_SOURCE_DIR}/src/translate_c/ast.zig"
"${CMAKE_SOURCE_DIR}/src/type.zig"
"${CMAKE_SOURCE_DIR}/src/value.zig"
"${CMAKE_SOURCE_DIR}/src/windows_sdk.zig"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A general-purpose programming language and toolchain for maintaining

## Resources

* [Introduction](https://ziglang.org/#Introduction)
* [Introduction](https://ziglang.org/learn/#introduction)
* [Download & Documentation](https://ziglang.org/download)
* [Chapter 0 - Getting Started | ZigLearn.org](https://ziglearn.org/)
* [Community](https://github.com/ziglang/zig/wiki/Community)
Expand Down
2 changes: 2 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ pub fn build(b: *Builder) !void {

const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source");
const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse enable_llvm;
const strip = b.option(bool, "strip", "Omit debug information") orelse false;

const main_file = if (is_stage1) "src/stage1.zig" else "src/main.zig";

var exe = b.addExecutable("zig", main_file);
exe.strip = strip;
exe.install();
exe.setBuildMode(mode);
exe.setTarget(target);
Expand Down
255 changes: 134 additions & 121 deletions doc/docgen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -781,106 +781,119 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: anytype, source_token:
next_tok_is_fn = false;

const token = tokenizer.next();
if (mem.indexOf(u8, src[index..token.loc.start], "//")) |comment_start_off| {
// render one comment
const comment_start = index + comment_start_off;
const comment_end_off = mem.indexOf(u8, src[comment_start .. token.loc.start], "\n");
const comment_end = if (comment_end_off) |o| comment_start + o else token.loc.start;

try writeEscaped(out, src[index..comment_start]);
try out.writeAll("<span class=\"tok-comment\">");
try writeEscaped(out, src[comment_start .. comment_end]);
try out.writeAll("</span>");
index = comment_end;
tokenizer.index = index;
continue;
}

try writeEscaped(out, src[index..token.loc.start]);
switch (token.id) {
.Eof => break,

.Keyword_align,
.Keyword_and,
.Keyword_asm,
.Keyword_async,
.Keyword_await,
.Keyword_break,
.Keyword_catch,
.Keyword_comptime,
.Keyword_const,
.Keyword_continue,
.Keyword_defer,
.Keyword_else,
.Keyword_enum,
.Keyword_errdefer,
.Keyword_error,
.Keyword_export,
.Keyword_extern,
.Keyword_for,
.Keyword_if,
.Keyword_inline,
.Keyword_noalias,
.Keyword_noinline,
.Keyword_nosuspend,
.Keyword_opaque,
.Keyword_or,
.Keyword_orelse,
.Keyword_packed,
.Keyword_anyframe,
.Keyword_pub,
.Keyword_resume,
.Keyword_return,
.Keyword_linksection,
.Keyword_callconv,
.Keyword_struct,
.Keyword_suspend,
.Keyword_switch,
.Keyword_test,
.Keyword_threadlocal,
.Keyword_try,
.Keyword_union,
.Keyword_unreachable,
.Keyword_usingnamespace,
.Keyword_var,
.Keyword_volatile,
.Keyword_allowzero,
.Keyword_while,
.Keyword_anytype,
switch (token.tag) {
.eof => break,

.keyword_align,
.keyword_and,
.keyword_asm,
.keyword_async,
.keyword_await,
.keyword_break,
.keyword_catch,
.keyword_comptime,
.keyword_const,
.keyword_continue,
.keyword_defer,
.keyword_else,
.keyword_enum,
.keyword_errdefer,
.keyword_error,
.keyword_export,
.keyword_extern,
.keyword_for,
.keyword_if,
.keyword_inline,
.keyword_noalias,
.keyword_noinline,
.keyword_nosuspend,
.keyword_opaque,
.keyword_or,
.keyword_orelse,
.keyword_packed,
.keyword_anyframe,
.keyword_pub,
.keyword_resume,
.keyword_return,
.keyword_linksection,
.keyword_callconv,
.keyword_struct,
.keyword_suspend,
.keyword_switch,
.keyword_test,
.keyword_threadlocal,
.keyword_try,
.keyword_union,
.keyword_unreachable,
.keyword_usingnamespace,
.keyword_var,
.keyword_volatile,
.keyword_allowzero,
.keyword_while,
.keyword_anytype,
=> {
try out.writeAll("<span class=\"tok-kw\">");
try writeEscaped(out, src[token.loc.start..token.loc.end]);
try out.writeAll("</span>");
},

.Keyword_fn => {
.keyword_fn => {
try out.writeAll("<span class=\"tok-kw\">");
try writeEscaped(out, src[token.loc.start..token.loc.end]);
try out.writeAll("</span>");
next_tok_is_fn = true;
},

.Keyword_undefined,
.Keyword_null,
.Keyword_true,
.Keyword_false,
.keyword_undefined,
.keyword_null,
.keyword_true,
.keyword_false,
=> {
try out.writeAll("<span class=\"tok-null\">");
try writeEscaped(out, src[token.loc.start..token.loc.end]);
try out.writeAll("</span>");
},

.StringLiteral,
.MultilineStringLiteralLine,
.CharLiteral,
.string_literal,
.multiline_string_literal_line,
.char_literal,
=> {
try out.writeAll("<span class=\"tok-str\">");
try writeEscaped(out, src[token.loc.start..token.loc.end]);
try out.writeAll("</span>");
},

.Builtin => {
.builtin => {
try out.writeAll("<span class=\"tok-builtin\">");
try writeEscaped(out, src[token.loc.start..token.loc.end]);
try out.writeAll("</span>");
},

.LineComment,
.DocComment,
.ContainerDocComment,
.ShebangLine,
.doc_comment,
.container_doc_comment,
=> {
try out.writeAll("<span class=\"tok-comment\">");
try writeEscaped(out, src[token.loc.start..token.loc.end]);
try out.writeAll("</span>");
},

.Identifier => {
.identifier => {
if (prev_tok_was_fn) {
try out.writeAll("<span class=\"tok-fn\">");
try writeEscaped(out, src[token.loc.start..token.loc.end]);
Expand Down Expand Up @@ -908,71 +921,71 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: anytype, source_token:
}
},

.IntegerLiteral,
.FloatLiteral,
.integer_literal,
.float_literal,
=> {
try out.writeAll("<span class=\"tok-number\">");
try writeEscaped(out, src[token.loc.start..token.loc.end]);
try out.writeAll("</span>");
},

.Bang,
.Pipe,
.PipePipe,
.PipeEqual,
.Equal,
.EqualEqual,
.EqualAngleBracketRight,
.BangEqual,
.LParen,
.RParen,
.Semicolon,
.Percent,
.PercentEqual,
.LBrace,
.RBrace,
.LBracket,
.RBracket,
.Period,
.PeriodAsterisk,
.Ellipsis2,
.Ellipsis3,
.Caret,
.CaretEqual,
.Plus,
.PlusPlus,
.PlusEqual,
.PlusPercent,
.PlusPercentEqual,
.Minus,
.MinusEqual,
.MinusPercent,
.MinusPercentEqual,
.Asterisk,
.AsteriskEqual,
.AsteriskAsterisk,
.AsteriskPercent,
.AsteriskPercentEqual,
.Arrow,
.Colon,
.Slash,
.SlashEqual,
.Comma,
.Ampersand,
.AmpersandEqual,
.QuestionMark,
.AngleBracketLeft,
.AngleBracketLeftEqual,
.AngleBracketAngleBracketLeft,
.AngleBracketAngleBracketLeftEqual,
.AngleBracketRight,
.AngleBracketRightEqual,
.AngleBracketAngleBracketRight,
.AngleBracketAngleBracketRightEqual,
.Tilde,
.bang,
.pipe,
.pipe_pipe,
.pipe_equal,
.equal,
.equal_equal,
.equal_angle_bracket_right,
.bang_equal,
.l_paren,
.r_paren,
.semicolon,
.percent,
.percent_equal,
.l_brace,
.r_brace,
.l_bracket,
.r_bracket,
.period,
.period_asterisk,
.ellipsis2,
.ellipsis3,
.caret,
.caret_equal,
.plus,
.plus_plus,
.plus_equal,
.plus_percent,
.plus_percent_equal,
.minus,
.minus_equal,
.minus_percent,
.minus_percent_equal,
.asterisk,
.asterisk_equal,
.asterisk_asterisk,
.asterisk_percent,
.asterisk_percent_equal,
.arrow,
.colon,
.slash,
.slash_equal,
.comma,
.ampersand,
.ampersand_equal,
.question_mark,
.angle_bracket_left,
.angle_bracket_left_equal,
.angle_bracket_angle_bracket_left,
.angle_bracket_angle_bracket_left_equal,
.angle_bracket_right,
.angle_bracket_right_equal,
.angle_bracket_angle_bracket_right,
.angle_bracket_angle_bracket_right_equal,
.tilde,
=> try writeEscaped(out, src[token.loc.start..token.loc.end]),

.Invalid, .Invalid_ampersands, .Invalid_periodasterisks => return parseError(
.invalid, .invalid_ampersands, .invalid_periodasterisks => return parseError(
docgen_tokenizer,
source_token,
"syntax error",
Expand Down
Loading