Пример #1
0
		/// <summary> We can get at files by name or module id, eventually we will put functions in here too</summary>
		
		public ExpressionCache(DebugCLI cli)
		{
			m_builder = new ASTBuilder(true); // allow fdb's "*x" and "x." indirection operators
			m_expressions = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
			m_props = new IntProperties();
			m_cli = cli;
		}
Пример #2
0
        public static void  Main(String[] args)
        {
            ASTBuilder ab = new ASTBuilder(true);

            try
            {
                ab.addLong(5);
                ab.addOp(Operator.ARITH_SUB);
                ab.addLong(6);

                ValueExp exp1 = ab.done();

                ab.addLong(5);
                ab.addOp(Operator.ARITH_ADD);
                ab.addOp(Operator.OPEN_PAREN);
                ab.addLong(6);
                ab.addOp(Operator.ARITH_DIV);
                ab.addLong(4);
                ab.addOp(Operator.ARITH_MULT);
                ab.addLong(7);
                ab.addOp(Operator.CLOSE_PAREN);
                ab.addOp(Operator.BITWISE_RSHIFT);
                ab.addLong(2);

                ValueExp exp2 = ab.done();

                ValueExp exp3 = ab.parse(new StringReader("5-6"));                 //$NON-NLS-1$
                ValueExp exp4 = ab.parse(new StringReader("5 +(6/4*7 )>>2"));      //$NON-NLS-1$

                ValueExp exp5 = ab.parse(new StringReader(" 4 == 2"));             //$NON-NLS-1$

                Object o1 = exp1.evaluate(null);
                Object o2 = exp2.evaluate(null);
                Object o3 = exp3.evaluate(null);
                Object o4 = exp4.evaluate(null);
                Object o5 = exp5.evaluate(null);

                Console.Out.WriteLine("=" + o1 + "," + o2);      //$NON-NLS-1$ //$NON-NLS-2$
                Console.Out.WriteLine("=" + o3 + "," + o4);      //$NON-NLS-1$ //$NON-NLS-2$
                Console.Out.WriteLine("=" + o5);                 //$NON-NLS-1$
            }
            catch (Exception e)
            {
                if (Trace.error)
                {
                    Console.Error.Write(e.StackTrace);
                    Console.Error.Flush();
                }
            }
        }
Пример #3
0
		private void Manager_OnMouseHover(ScintillaControl sci, Int32 position)
		{
			DebuggerManager debugManager = PluginMain.debugManager;
			FlashInterface flashInterface = debugManager.FlashInterface;
			if (!PluginBase.MainForm.EditorMenu.Visible && flashInterface != null && flashInterface.isDebuggerStarted && flashInterface.isDebuggerSuspended)
			{
				if (debugManager.CurrentLocation != null && debugManager.CurrentLocation.File != null)
				{
					String localPath = debugManager.GetLocalPath(debugManager.CurrentLocation.File);
					if (localPath == null || localPath != PluginBase.MainForm.CurrentDocument.FileName)
					{
						return;
					}
				}
				else return;
				Point dataTipPoint = Control.MousePosition;
				Rectangle rect = new Rectangle(m_ToolTip.Location, m_ToolTip.Size);
				if (m_ToolTip.Visible && rect.Contains(dataTipPoint))
				{
					return;
				}
				position = sci.WordEndPosition(position, true);
				String leftword = GetWordAtPosition(sci, position);
				if (leftword != String.Empty)
				{
					try
					{
						ASTBuilder builder = new ASTBuilder(true);
						ValueExp exp = builder.parse(new System.IO.StringReader(leftword));
						ExpressionContext context = new ExpressionContext(flashInterface.Session);
						context.Depth = debugManager.CurrentFrame;
						Object obj = exp.evaluate(context);
						Show(dataTipPoint, (Variable)obj);
					}
					catch (Exception){}
				}
			}
		}
Пример #4
0
		public void UpdateElements()
		{
			treeControl.Tree.BeginUpdate();
			treeControl.Nodes.Clear();
			foreach (String item in watches)
			{
				DataNode node = new DataNode(item); // todo, introduce new Node types.
				try
				{
					ASTBuilder builder = new ASTBuilder(true);
					ValueExp exp = builder.parse(new System.IO.StringReader(item));
					ExpressionContext context = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session);
					context.Depth = PluginMain.debugManager.CurrentFrame;
					Object obj = exp.evaluate(context);
					node = new DataNode((Variable)obj);
				}
				catch { }
				node.Text = item;
				treeControl.AddNode(node);
			}
			treeControl.Tree.EndUpdate();
			treeControl.Enabled = true;
		}
Пример #5
0
		public static void  Main(String[] args)
		{
			ASTBuilder ab = new ASTBuilder(true);
			
			try
			{
				ab.addLong(5);
				ab.addOp(Operator.ARITH_SUB);
				ab.addLong(6);
				
				ValueExp exp1 = ab.done();
				
				ab.addLong(5);
				ab.addOp(Operator.ARITH_ADD);
				ab.addOp(Operator.OPEN_PAREN);
				ab.addLong(6);
				ab.addOp(Operator.ARITH_DIV);
				ab.addLong(4);
				ab.addOp(Operator.ARITH_MULT);
				ab.addLong(7);
				ab.addOp(Operator.CLOSE_PAREN);
				ab.addOp(Operator.BITWISE_RSHIFT);
				ab.addLong(2);
				
				ValueExp exp2 = ab.done();
				
				ValueExp exp3 = ab.parse(new StringReader("5-6")); //$NON-NLS-1$
				ValueExp exp4 = ab.parse(new StringReader("5 +(6/4*7 )>>2")); //$NON-NLS-1$
				
				ValueExp exp5 = ab.parse(new StringReader(" 4 == 2")); //$NON-NLS-1$
				
				Object o1 = exp1.evaluate(null);
				Object o2 = exp2.evaluate(null);
				Object o3 = exp3.evaluate(null);
				Object o4 = exp4.evaluate(null);
				Object o5 = exp5.evaluate(null);
				
				Console.Out.WriteLine("=" + o1 + "," + o2); //$NON-NLS-1$ //$NON-NLS-2$
				Console.Out.WriteLine("=" + o3 + "," + o4); //$NON-NLS-1$ //$NON-NLS-2$
				Console.Out.WriteLine("=" + o5); //$NON-NLS-1$
			}
			catch (Exception e)
			{
                if (Trace.error)
                {
                    Console.Error.Write(e.StackTrace);
                    Console.Error.Flush();
                }
			}
		}