From d3092115587beb9c9225c17ea4036ba6c087bc15 Mon Sep 17 00:00:00 2001 From: liquidev Date: Wed, 4 Sep 2024 22:11:24 +0200 Subject: [PATCH] allow up to 65536 parser events parser events don't take up enough memory to warrant a stricter limit. I do wonder if this limit is actually reachable with a 65536 character limit though. --- crates/haku/src/parser.rs | 3 +++ rkgk.toml | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/haku/src/parser.rs b/crates/haku/src/parser.rs index ae5511c..c8b89d2 100644 --- a/crates/haku/src/parser.rs +++ b/crates/haku/src/parser.rs @@ -37,6 +37,9 @@ enum EventKind { Advance, } +// We don't want events taking up too much memory all of a sudden. +const _: () = assert!(size_of::() == 1); + struct Open { index: Option, } diff --git a/rkgk.toml b/rkgk.toml index 1c2b2ce..4681177 100644 --- a/rkgk.toml +++ b/rkgk.toml @@ -73,7 +73,8 @@ max_defs = 256 max_tokens = 4096 # Maximum amount of events that the parser may emit in a single chunk. -max_parser_events = 4096 +# These don't take up that much memory (a byte per event), so having many of these isn't a big deal. +max_parser_events = 65536 # Maximum amount of AST nodes in a single parse. ast_capacity = 4096