script: support triple-quoted strings and optimize lookups

- Add support for triple-quoted strings (''' and """) in the tokenizer
  and quote stripper.
- Avoid allocations in `stripQuotes` by returning slices.
- Optimize schema lookups using O(1) enum-based canonical resolution.
- Skip env var substitution if "$LP_" is not present in the string.
This commit is contained in:
Adrià Arrufat
2026-05-21 21:33:05 +02:00
parent 7f60d73338
commit d16f8a032e
7 changed files with 118 additions and 69 deletions

View File

@@ -17,9 +17,9 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! REPL-only meta slash commands and re-exports of the PandaScript schema
//! primitives. The actual slash-command grammar (which now IS PandaScript)
//! lives in `script/schema.zig`; this module keeps the agent-only meta
//! commands (`/help`, `/quit`, `/verbosity`) that aren't part of the script.
//! primitives. The actual slash-command grammar lives in `script/schema.zig`;
//! this module keeps the agent-only meta commands (`/help`, `/quit`,
//! `/verbosity`) that aren't part of the script.
const std = @import("std");
const lp = @import("lightpanda");
@@ -39,6 +39,7 @@ pub const max_hint_slots = schema.max_hint_slots;
pub const buildSchemas = schema.buildSchemas;
pub const globalSchemas = schema.globalSchemas;
pub const findSchema = schema.findSchema;
pub const findSchemaCanonical = schema.findSchemaCanonical;
pub const splitNameRest = schema.splitNameRest;
/// Meta slash commands handled directly by the agent (not by ToolExecutor).