public static Operator SUBSCRIPT = new Operator(17, "Operator.SUBSCRIPT", null, Type.GetType("Flash.Tools.Debugger.Expression.SubscriptExp")); // a[k]; see ASTBuilder.addOp() //$NON-NLS-1$ /// <summary> We create an empty non-terminal node of the given type based on the /// operator. /// </summary> public NonTerminalExp createExpNode() // throws UnknownOperationException { NonTerminalExp node = null; if (expressionNodeClass == null) { throw new UnknownOperationException(this); } else { try { node = (NonTerminalExp)expressionNodeClass.GetConstructor(Type.EmptyTypes).Invoke(null); } catch (OutOfMemoryException e) { // should never happen if (Trace.error) { Trace.trace(e.Message); } } catch (AccessViolationException e) { // should never happen if (Trace.error) { Trace.trace(e.Message); } } } return(node); }
/// <summary> Helper to get the number of bytes that a string will need when it is sent /// across the socket to the Flash player. Do *not* use string.getLength(), /// because that will return an incorrect result for strings that have non- /// ASCII characters. /// </summary> public static int getStringLength(String s) { try { return(System.Text.Encoding.UTF8.GetByteCount(s)); //$NON-NLS-1$ } catch (IOException e) { if (Trace.error) { Trace.trace(e.ToString()); } return(0); } }