createVarEnd function

Parser createVarEnd([
  1. LiquidConfig? config
])

Creates a variable end delimiter parser with optional custom config.

Returns a parser that matches the variable end delimiter (e.g., }} or -}}). The whitespace-stripping variant (e.g., -}}) strips following whitespace.

If config is null, uses standard Liquid delimiters.

Example

final config = LiquidConfig(varStart: '[[', varEnd: ']]');
final myVarEnd = createVarEnd(config);
// Matches: ]] or -]]

Implementation

Parser createVarEnd([LiquidConfig? config]) {
  final cfg = config ?? LiquidConfig.standard;
  return (string(cfg.varEndStrip).trim() | string(cfg.varEnd)).labeled(
    'varEnd',
  );
}