Пример #1
0
        //
        //    Meant to match:
        //
        //    @break
        //
        public override PNode evaluate(PNode evaluateMe, PatternMatcher successfulMatch)
        {
            PatternMatcher match = successfulMatch;

            //	Extract the "arguments" from the PatternMatcher.
            List<PNode> M = match.Matching;			//	The pattern -> prose index from the match

            value = new ProseObject[1];
            //value[0] = new BreakPointObject("");
            value[0] = new BreakPointObject("# Breakpoint script - \n");

            PNode ret = replaceWithValueAt(evaluateMe, successfulMatch);
            value = null;
            return ret;
        }
Пример #2
0
        //
        //	Meant to match:
        //
        //	@break
        //

        public override PNode evaluate(PNode evaluateMe, PatternMatcher successfulMatch)
        {
            PatternMatcher match = successfulMatch;

            //	Extract the "arguments" from the PatternMatcher.
            List <PNode> M = match.Matching;                            //	The pattern -> prose index from the match

            value = new ProseObject[1];
            //value[0] = new BreakPointObject("");
            value[0] = new BreakPointObject("# Breakpoint script - \n");

            PNode ret = replaceWithValueAt(evaluateMe, successfulMatch);

            value = null;
            return(ret);
        }
Пример #3
0
        private PNode debugFilterIncomingPNode(PNode node)
        {
            node = filterIncomingPNode(node);

            bool filterAgain = false;                           //	Determines if we repeatedly apply this.

            do
            {
                if (node == null)
                {
                    break;
                }

                //	Check for breakpoints
                if (node.value is BreakPointObject)
                {
                    BreakPointObject             bp     = (BreakPointObject)node.value;
                    BreakPointObject.RuntimeData rtdata = new BreakPointObject.RuntimeData();

                    //	Do any action associated with the breakpoint and make the default callback if asked
                    if (bp.doBreakPoint(this, node, rtdata))
                    {
                        if (OnBreakPoint != null)
                        {
                            OnBreakPoint(this, node, rtdata, bp.BreakScript);
                        }
                    }

                    //	Remove the breakpoint
                    if (node.prev != null)
                    {
                        node.prev.next = node.next;
                    }
                    if (node.next != null)
                    {
                        node.next.prev = node.prev;
                    }

                    filterAgain = true;

                    //	Skip over the breakpoint
                    node = node.next;
                }
            } while (filterAgain);

            return(node);
        }
Пример #4
0
 //    Overriding instructions:
 //    Return true if you want the runtime to make the standard breakpoint callback.
 //    Return false if you prefer to handle the event yourself in the body of onBreak()
 public bool onBreak(ProseRuntime runtime, PNode source, BreakPointObject.RuntimeData rtdata)
 {
     //	Handle the breakpoint in a non-standard way if you want
     //	by putting something in the body of this function.
     return true;
 }
Пример #5
0
 public bool doBreakPoint(ProseRuntime runtime, PNode source, BreakPointObject.RuntimeData rtdata)
 {
     return onBreak (runtime, source, rtdata);
 }
Пример #6
0
        public static void onBreakPoint(ProseRuntime runtime, PNode source, BreakPointObject.RuntimeData rtdata, string script)
        {
            breakPointDepth++;

            runtime.read(script, runtime.GlobalClient);
            runtime.read("read file \"Libraries/REPL/onbreak.prose\"", runtime.GlobalClient);
            ProseREPLLoop();

            breakPointDepth--;
        }