Diagnostics · limit

limit[nesting-or-tokens]

{ ( [ nest deeper than maxNesting (20), or the source has more than maxTokens (6,000) words.

The bounds scan counts nesting outside strings, comments and source tags, before parsing, so deeply nested input is refused in linear time. Parentheses around conditions are rarely needed: AND binds tighter than OR.

Example

Through compileSource
CONTRACT Claim {
  ENFORCEMENT_MODE: enforced
  CONTEXT {
    ENTITIES Request {
      count: int
      region: string
      ready: bool
      ratio: float
    }
    CONSTANTS {
      zero: int == 0 [SOURCE:POLICY]
      cap: int == 25 [SOURCE:POLICY]
    }
  }
  TRIGGER {
    grant()
  }
  GUARANTEE {
    ENSURE grant() WHEN Request.ready == true [SOURCE:must_be_ready]
  }
  PROHIBITION {
    FORBID grant WHEN (((((((((((((((((((((Request.count > cap))))))))))))))))))))) [SOURCE:over_cap]
  }
}

rejected limit[nesting-or-tokens] at 22:41 source nesting or token cap exceeded

Fix

Remove the redundant parentheses.

Through compileSource
CONTRACT Claim {
  ENFORCEMENT_MODE: enforced
  CONTEXT {
    ENTITIES Request {
      count: int
      region: string
      ready: bool
      ratio: float
    }
    CONSTANTS {
      zero: int == 0 [SOURCE:POLICY]
      cap: int == 25 [SOURCE:POLICY]
    }
  }
  TRIGGER {
    grant()
  }
  GUARANTEE {
    ENSURE grant() WHEN Request.ready == true [SOURCE:must_be_ready]
  }
  PROHIBITION {
    FORBID grant WHEN Request.count > cap [SOURCE:over_cap]
  }
}

accepted

See also: the specification.