Skip to content

Repeat Statements

Benedict Albrecht edited this page Jun 2, 2026 · 4 revisions

Repeat Statements

The repeat statement matches a pattern zero or more times in succession.


Syntax

<? ... ?>

Example

A function with a comma-separated parameter list:

<:function:> function <<name>> ( <? <<var>> <| , <||> |> ?> ) { <---> } <:>
Input Repetitions
function myFunc ( ) { } 0
function myFunc ( x ) { } 1
function myFunc ( x , y ) { } 2
function myFunc ( x , y , z ) { } 3

Pattern: <| , <||> |> inside the repeat provides an optional comma separator between repetitions.



In Practice

The Basics grammar uses repeat in three places:

Object Repeat pattern What it captures
class <? <| , <||> <<NAME:down>> |> ?> Zero or more comma-separated parameters
function <? <| , <||> <<NAME:down>> |> ?> Zero or more comma-separated parameters
refference <? <| , <||> |> <<'name'>> ?> Zero or more comma-separated arguments

In the Test_Repo:

  • class C1 (a , b , c ) - repeat matches 3 times, capturing parameters a, b, c with :down scope
  • function F5 ( ) - repeat matches 0 times (empty parameter list)
  • C1.F1(aaa) - repeat matches 1 time, capturing reference 'aaa'

Next: Jump Instructions - Skipping tokens until a target is found.

Clone this wiki locally