pyaiml21.interpreter.debugger.Debugger

class pyaiml21.interpreter.debugger.Debugger(bot: pyaiml21.bot._bot.Bot, session: pyaiml21.session.session.Session)[source][source]

Interactive AIML debugger.

This is built on top of the interpreter and allows simple debugging of AIML source code.

Methods

add_frame

Add stack frame for current <template>.

call

Update the stacktrace with input_.

cont

Continue evaluation.

enter

Start the evaluation of node.

eval

Evaluate node and return the result.

eval_seq

Evaluate a sequence of nodes, concatenating the results.

eval_unknown

Evaluate unknown tag by keeping the xml in the result.

fail

Interrupt the evaluation of the response, returning result.

fail_node

Announce the interpreter that evaluation of node failed.

help

Print help.

interact

Run the interactive loop, expecting commands from CLI.

leave

End the evaluation of _node, update stacks.

next

Make one eval step within this function (not stopping in <srai>).

p

Return the value of a _predicate or a variable, or return value.

pop_frame

Pop stack frame when leaving current <template>.

position

Print position of the node being evaluated.

quit

Quit debugging session.

register

Register a function used to interpret AIML, possibly overriding.

remove_bp

Remove chosen breakpoint.

set_break

Set a breakpoint on the file filename on line line.

step

Make one evaluation step, possibly using recursive <srai>.

stop

Interrupt execution.

stop_on_first

Pause the evaluation on the first interpreted node.

view_bps

Display set breakpoints.

where

Print stack trace.

Attributes

PROMPT

node

Return the node that is currently being evaluated.

stars

Access stars for current category.

vars

Access local variables for current category.

call(input_: str) str[source][source]

Update the stacktrace with input_.

cont()[source][source]

Continue evaluation.

enter(node: pyaiml21.ast.node.Node)[source][source]

Start the evaluation of node.

help()[source][source]

Print help.

interact()[source][source]

Run the interactive loop, expecting commands from CLI.

leave(_node: pyaiml21.ast.node.Node, result: str)[source][source]

End the evaluation of _node, update stacks.

next()[source][source]

Make one eval step within this function (not stopping in <srai>).

property node: Optional[pyaiml21.ast.node.Node][source]

Return the node that is currently being evaluated.

p(type_, name)[source][source]

Return the value of a _predicate or a variable, or return value.

position()[source][source]

Print position of the node being evaluated.

quit()[source][source]

Quit debugging session.

remove_bp(bp: str) None[source][source]

Remove chosen breakpoint.

set_break(filename, line)[source][source]

Set a breakpoint on the file filename on line line.

step()[source][source]

Make one evaluation step, possibly using recursive <srai>.

stop()[source][source]

Interrupt execution.

stop_on_first()[source][source]

Pause the evaluation on the first interpreted node.

view_bps() None[source][source]

Display set breakpoints.

where()[source][source]

Print stack trace.