build_template

build_template(qasm_body, symbol_names)[source]

Split a QASM string at symbol boundaries into a QASMTemplate.

Symbol names are matched longest-first to avoid partial-match issues (e.g., w_1 matching inside w_10). Matches require non-identifier characters on both sides, so a parameter named x does NOT match the x inside cx q[0],q[1];.

Parameters:
  • qasm_body (str) – The QASM body string containing symbolic parameter names.

  • symbol_names (tuple[str, ...]) – Ordered tuple of symbol name strings. The index in this tuple becomes the slot index used during rendering.

Return type:

QASMTemplate

Returns:

A QASMTemplate ready for render_template().