Skip to content

Forward

[Source]

A forwarding parser is used to create mutually recursive parse rules. The forwarding parser can be used instead, and is updated when the real parse rule is created.

class ref Forward is
  Parser box

Implements


Constructors

create

[Source]

new ref create()
: Forward ref^

Returns


Public Functions

update

[Source]

Assign the real parser. Called via () sugar: fwd() = real_parser.

fun ref update(
  value: Parser box)
: None val

Parameters

Returns


parse

[Source]

fun box parse(
  source: Source val,
  offset: USize val,
  tree: Bool val,
  hidden: Parser box)
: (USize val , (AST val | Token val | NotPresent val | 
    Skipped val | Lex val | Parser box))

Parameters

Returns


complete

[Source]

True if a real parser has been assigned via update().

fun box complete()
: Bool val

Returns


error_msg

[Source]

fun box error_msg()
: String val

Returns


skip_hidden

[Source]

fun box skip_hidden(
  source: Source val,
  offset: USize val,
  hidden: Parser box)
: USize val

Parameters

Returns


result

[Source]

fun box result(
  source: Source val,
  offset: USize val,
  from: USize val,
  length: USize val,
  tree: Bool val,
  l: Label val = reference)
: (USize val , (AST val | Token val | NotPresent val | 
    Skipped val | Lex val | Parser box))

Parameters

Returns


mul

[Source]

fun box mul(
  that: Parser box)
: Sequence ref

Parameters

Returns


div

[Source]

fun box div(
  that: Parser box)
: Choice ref

Parameters

Returns


neg

[Source]

fun box neg()
: Skip ref

Returns


opt

[Source]

fun box opt()
: Option ref

Returns


many

[Source]

fun box many(
  sep: Parser box = reference)
: Many ref

Parameters

Returns


many1

[Source]

fun box many1(
  sep: Parser box = reference)
: Many ref

Parameters

Returns


op_not

[Source]

fun box op_not()
: Not ref

Returns


op_and

[Source]

fun box op_and()
: Not ref

Returns


hide

[Source]

fun box hide(
  that: Parser box)
: Hidden ref

Parameters

Returns


term

[Source]

fun box term(
  l: Label val = reference)
: Terminal ref

Parameters

  • l: Label val = reference

Returns


eof

[Source]

fun box eof()
: EndOfFile ref

Returns