gleamunison/source_budget

One admission policy before grapheme expansion or recursive parsing. Limits are resource policy, not grammar; the parser still diagnoses syntax.

Types

pub type Budget {
  Budget(
    bytes: Int,
    tokens: Int,
    depth: Int,
    forms: Int,
    token_bytes: Int,
  )
}

Constructors

  • Budget(
      bytes: Int,
      tokens: Int,
      depth: Int,
      forms: Int,
      token_bytes: Int,
    )

Values

pub fn check(source: String) -> Result(Nil, String)
pub fn check_with(
  source: String,
  budget: Budget,
) -> Result(Nil, String)
✨ Search Document