combinator

parsley.debug.combinator
object combinator

This object contains the combinators for attaching debuggers to parsers.

Attributes

Since

5.0.0

Source
combinator.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
combinator.type

Members list

Type members

Classlikes

implicit class DebuggerOps[A](par: Parsley[A])

Dot accessor versions of the combinators.

Dot accessor versions of the combinators.

Attributes

Source
combinator.scala
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def attach[A](parser: Parsley[A], view: DebugView, toStringRules: PartialFunction[Any, Boolean]): Parsley[A]

Attach a debugger to be rendered via a given view.

Attach a debugger to be rendered via a given view. This view will render whenever the parser produces debug content.

You would normally obtain a parsley.debug.DebugView from its respective package as either a static object or an instance object depending on whether the renderer stores state. In the latter case, it is better to regenerate the frontend with every new debugged parser. The view can be reusable (i.e. inherits from parsley.debug.DebugView.Reusable) or single-use (i.e. inherits from parsley.debug.DebugView.SingleUse).

The instrumented parser will automatically call the view to render the debug tree, so it may be recommended that you only use this with smaller parsers as large parsers may cause large amounts of memory to be used for rendering the tree.

Type parameters

A

Output type of parser.

Value parameters

parser

The parser to debug.

toStringRules

If a parser's result matches any of the predicates in this sequence, it will get turned into a string before storing in the debug tree. This is usually for memory-usage optimisation. By default, all function-like objects will be converted into strings, as closures are expensive to store.

view

The debug view instance to render with.

Attributes

Returns

A modified parser which will ask the view to render the produced debug tree after a call to Parsley.parse is made.

Note

Do not run a parser through this combinator multiple times.

Source
combinator.scala
def attach[A](parser: Parsley[A], view: DebugView): Parsley[A]

Attach a debugger to be rendered via a given view.

Attach a debugger to be rendered via a given view. This view will render whenever the parser produces debug content.

This assumes the default rules of converting only lambdas and closures into strings when storing in the output debug tree.

Type parameters

A

Output type of parser.

Value parameters

parser

The parser to debug.

view

The debug view instance to render with.

Attributes

Returns

A modified parser which will ask the view to render the produced debug tree after a call to Parsley.parse is made.

See also

The other overload of this method (attachDebugger) has more information on its usage.

Note

Do not run a parser through this combinator multiple times.

Source
combinator.scala
def attachReusable[A](parser: Parsley[A], view: => Reusable, toStringRules: PartialFunction[Any, Boolean]): () => Parsley[A]

Create a closure that freshly attaches a debugger and a tree-rendering view to a parser every time it is called.

Create a closure that freshly attaches a debugger and a tree-rendering view to a parser every time it is called.

Attributes

Returns

Generator closure for view-debugged versions of the input parser.

Note

Do not run a parser through this combinator multiple times.

Source
combinator.scala
def attachReusable[A](parser: Parsley[A], view: => Reusable): () => Parsley[A]

Create a closure that freshly attaches a debugger and a tree-rendering view to a parser every time it is called.

Create a closure that freshly attaches a debugger and a tree-rendering view to a parser every time it is called.

This assumes the default rules of converting only lambdas and closures into strings when storing in the output debug tree.

Attributes

Returns

Generator closure for view-debugged versions of the input parser.

See also

The other overload of this method (attachDebugger) has more information on its usage.

Note

Do not run a parser through this combinator multiple times.

Source
combinator.scala
def detectDivergence[A](parser: Parsley[A]): Parsley[A]

Attributes

Source
combinator.scala
def named[A](parser: Parsley[A], name: String): Parsley[A]

Attach a name to a parser, for display within the debugger output.

Attach a name to a parser, for display within the debugger output. Names assigned here have a higher precedence than names collected with parsley.debug.util.Collector.

Renaming the same parser multiple times simply overwrites its name to the most latest rename.

Attributes

Source
combinator.scala

Concrete fields

val DefaultStringRules: PartialFunction[Any, Boolean]

Returns true for any function type, which we ideally don't store as a string

Returns true for any function type, which we ideally don't store as a string

Attributes

Source
combinator.scala

Implicits

Implicits

final implicit def DebuggerOps[A](par: Parsley[A]): DebuggerOps[A]

Dot accessor versions of the combinators.

Dot accessor versions of the combinators.

Attributes

Source
combinator.scala