Skip to content

NamedRule[S: (Any #read & Equatable[S]), optional D: Any #share, optional V: Any #share]

[Source]

Represents a named grammar rule. Memoization and left-recursion handling happens per named Rule.

class ref NamedRule[S: (Any #read & Equatable[S]), optional D: Any #share, optional V: Any #share] is
  RuleNodeWithBody[S, D, V] ref

Implements


Constructors

create

[Source]

new ref create(
  name': String val,
  body': (RuleNode[S, D, V] ref | None val) = reference,
  action': (Action[S, D, V] val | None val) = reference,
  memoize': Bool val = false)
: NamedRule[S, D, V] ref^

Parameters

Returns


Public fields

let name: String val

[Source]


let memoize: Bool val

[Source]


var left_recursive: Bool val

[Source]


Public Functions

action

[Source]

fun box action()
: (Action[S, D, V] val | None val)

Returns


body

[Source]

fun box body()
: (this->RuleNode[S, D, V] ref | None val)

Returns


has_body

[Source]

fun box has_body()
: Bool val

Returns


set_body

[Source]

fun ref set_body(
  body': RuleNode[S, D, V] ref,
  action': (Action[S, D, V] val | None val) = reference)
: None val

Parameters

Returns


set_left_recursive

[Source]

fun ref set_left_recursive()
: None val

Returns


call

[Source]

fun box call(
  depth: USize val,
  loc: Loc[S] val)
: (_BindFrame[S, D, V] ref | _CondFrame[S, D, V] ref | _ConjFrame[S, D, V] ref | 
    _DisjFrame[S, D, V] ref | _ErrorFrame[S, D, V] ref | _LiteralFrame[S, D, V] ref | 
    _LookFrame[S, D, V] ref | _NamedRuleFrame[S, D, V] ref | _NegFrame[S, D, V] ref | 
    _SingleFrame[S, D, V] ref | _StarFrame[S, D, V] ref)

Parameters

Returns

  • (_BindFrame[S, D, V] ref | _CondFrame[S, D, V] ref | _ConjFrame[S, D, V] ref | _DisjFrame[S, D, V] ref | _ErrorFrame[S, D, V] ref | _LiteralFrame[S, D, V] ref | _LookFrame[S, D, V] ref | _NamedRuleFrame[S, D, V] ref | _NegFrame[S, D, V] ref | _SingleFrame[S, D, V] ref | _StarFrame[S, D, V] ref)