Expert Text Prompt: AST-Based Prompt Parser Node for ComfyUI

ComfyUI Wikinews

A new ComfyUI custom node parses prompts as an AST: weighted wildcards, prompt groups, inline mute and solo, automatic negative routing and a built-in syntax checker.

Expert Text Prompt demo

The Expert Text Prompt node parses the whole prompt as a syntax tree instead of chaining regex nodes or wordlist files.

One node instead of a regex chain

Expert Text Prompt is a new custom node by v3rm1ll1on that replaces prompt regex nodes and wordlist files with a single AST-based parser. Instead of building a cascade of randomizer nodes, you write one prompt string and the node parses it into a syntax tree, which also enables its most practical feature: a built-in syntax check that pinpoints the exact character of a missed bracket instead of failing silently.

Feature tour

FeatureSyntaxWhat it does
Weighted wildcards{70% blue | 30% green}Custom probability per option
Skip chance{20%? sunglasses}20% chance to omit the tag entirely
Prompt groups[GRP:NAME]Organize long prompts into semantic sections
Inline mute// leather jacketComment out a tag or group without deleting it
Inline solo! tagRun only the soloed tags or groups
Negative extraction-sunglassesRoutes the tag into the negative output automatically
Number ranges{18-50} / {0-10:2}Random or stepped numeric wildcards
$negative placeholderanywhere in negative fieldControls exactly where extracted negatives are injected

SDXL-style weights (tag:1.2) and inline LoRA tags <lora:my_lora:1.1> survive parsing untouched, and a deterministic seed makes every wildcard roll reproducible. The node also reports the total number of possible prompt combinations as an integer output, useful for estimating how much of a variation space a batch actually samples.

Availability

The node is published on the ComfyUI Registry as Expert Text Prompt (Wildcards & AST) by v3rm1ll1on (MIT). Install through the ComfyUI Manager, or clone the repository into custom_nodes. The examples folder includes seven progressively harder prompt templates, ending in a masterclass character generator combining groups, weights and nested wildcards.

Comments

Sign in with GitHub to join the discussion.

Loading comments…
Expert Text Prompt: AST-Based Prompt Parser Node for ComfyUI | ComfyUI Wiki