Print an expression
169370
public static String print(Expression expression) {
        return expression.match(new Expression.MatchBlock<String>() {

            @Override
            public String _case(LiteralExpression x) {
                return print(x.literal);
            }

            @Override
            public String _case(VariableExpression x) {
                return x.selector.match(new Optional.MatchBlock<Expression, String>() {
                    @Override
                    public String _case(Some<Expression> x) {
                        return print(x.value) + ".";
                    }

                    @Override
                    public String _case(None<Expression> x) {
                        return "";
                    }
                }) + x.identifier;
            }

            @Override
            public String _case(NestedExpression x) {
                return "( " + print(x.expression) + " )";
            }

            @Override
            public String _case(ClassReference x) {
                return print(x.type) + ".class";
            }

            @Override
            public String _case(TernaryExpression x) {
                return print(x.cond) + " ? " + print(x.trueExpression) + " : " + print (x.falseExpression);
            }

            @Override
            public String _case(BinaryExpression x) {
                return print(x.left) + " " + print(x.op) + " " +  print(x.right);
            }
        });
    }
847057
def p_expression_minus(self, p):
        ''
        p[0] = Minus(p[1], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
128847
def print_soln(self):
        """"""
        lmax = reduce(max,(len(x) for x in self.pnames), len('r chi sq'))

        if self.puncerts is None:
            for pn, val in zip(self.pnames, self.params):
                print('%s: %14g' % (pn.rjust(lmax), val))
        else:
            for pn, val, err in zip(self.pnames, self.params, self.puncerts):
                frac = abs(100. * err / val)
                print('%s: %14g +/- %14g (%.2f%%)' % (pn.rjust(lmax), val, err, frac))

        if self.rchisq is not None:
            print('%s: %14g' % ('r chi sq'.rjust(lmax), self.rchisq))
        elif self.chisq is not None:
            print('%s: %14g' % ('chi sq'.rjust(lmax), self.chisq))
        else:
            print('%s: unknown/undefined' % ('r chi sq'.rjust(lmax)))
        return self
858526
def parse(expression):
    
    result = []
    current = ""
    for i in expression:
        if i.isdigit() or i == '.':
            current += i
        else:
            if len(current) > 0:
                result.append(current)
                current = ""
            if i in __operators__ or i in __parenthesis__:
                result.append(i)
            else:
                raise Exception("invalid syntax " + i)

    if len(current) > 0:
        result.append(current)
    return result
640654
function ArrayExpression(node, print) {
  var elems = node.elements;
  var len = elems.length;

  this.push("[");
  print.printInnerComments();

  for (var i = 0; i < elems.length; i++) {
    var elem = elems[i];
    if (elem) {
      if (i > 0) this.space();
      print.plain(elem);
      if (i < len - 1) this.push(",");
    } else {
      // If the array expression ends with a hole, that hole
      // will be ignored by the interpreter, but if it ends with
      // two (or more) holes, we need to write out two (or more)
      // commas so that the resulting code is interpreted with
      // both (all) of the holes.
      this.push(",");
    }
  }

  this.push("]");
}
35039
def _display_expression(self, keys, user_substitutes={}):
        """"""
        # Create some pretty maths symbols for the display.
        sigma, alpha, nu, omega, l, variance = sym.var('\sigma, \alpha, \nu, \omega, \ell, \sigma^2')
        substitutes = {'scale': sigma, 'shape': alpha, 'lengthscale': l, 'variance': variance}
        substitutes.update(user_substitutes)

        function_substitutes = {normcdfln : lambda arg : sym.log(normcdf(arg)),
                                logisticln : lambda arg : -sym.log(1+sym.exp(-arg)),
                                logistic : lambda arg : 1/(1+sym.exp(-arg)),
                                erfcx : lambda arg : erfc(arg)/sym.exp(arg*arg),
                                gammaln : lambda arg : sym.log(sym.gamma(arg))}
        expr = getFromDict(self.expressions, keys)
        for var_name, sub in self.variable_sort(self.expressions['update_cache'], reverse=True):
            for var in self.variables['cache']:
                if var_name == var.name:
                    expr = expr.subs(var, sub)
                    break
        for var_name, sub in self.variable_sort(self.expressions['parameters_changed'], reverse=True):
            for var in self.variables['sub']:
                if var_name == var.name:
                    expr = expr.subs(var, sub)
                    break

        for var_name, sub in self.variable_sort(substitutes, reverse=True):
            for var in self.variables['theta']:
                if var_name == var.name:
                    expr = expr.subs(var, sub)
                    break
        for m, r in function_substitutes.items():
            expr = expr.replace(m, r)#normcdfln, lambda arg : sym.log(normcdf(arg)))
        return expr.simplify()
1306150
def p_expression_eq(self, p):
        ''
        p[0] = Eq(p[1], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
653502
def p_expression_srl(self, p):
        ''
        p[0] = Srl(p[1], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
864382
def ansiprint(self, *args, **kwargs):
        ''''''
        args = (self.parse(str(i)) for i in args)
        builtins.print(*args, **kwargs)
1335467
def p_expression_unor(self, p):
        ''
        p[0] = Unor(p[2], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
757412
def print(self):
        """"""
        if self.supported:
            print('  AF',  end='')
        else:
            print('  //', end='')
        fn_num = self.fn_num
        if fn_num is None:
            fn_num = 0
        print('({:2d}, {:8s}, {:2d}, {:10s}, {:8s}), // {:s}'.format(self.idx,
              self.func, fn_num, self.pin_type, self.ptr(), self.af_str))
1127499
function AssignmentExpression(node, print, parent) {
  // Somewhere inside a for statement `init` node but doesn't usually
  // needs a paren except for `in` expressions: `for (a in b ? a : b;;)`
  var parens = this._inForStatementInit && node.operator === "in" && !_node2["default"].needsParens(node, parent);

  if (parens) {
    this.push("(");
  }

  // todo: add cases where the spaces can be dropped when in compact mode
  print.plain(node.left);

  var spaces = node.operator === "in" || node.operator === "instanceof";
  spaces = true; // todo: https://github.com/babel/babel/issues/1835
  this.space(spaces);

  this.push(node.operator);

  if (!spaces) {
    // space is mandatory to avoid outputting <!--
    // http://javascript.spec.whatwg.org/#comment-syntax
    spaces = node.operator === "<" && t.isUnaryExpression(node.right, { prefix: true, operator: "!" }) && t.isUnaryExpression(node.right.argument, { prefix: true, operator: "--" });
  }

  this.space(spaces);

  print.plain(node.right);

  if (parens) {
    this.push(")");
  }
}
1140235
def p_expression_noteq(self, p):
        ''
        p[0] = NotEq(p[1], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
118301
def normal_print(raw):
    ''' '''
    lines = raw.split('\n')
    for line in lines:
        if line:
            print(line + '\n')
728902
def p_expression_Xor(self, p):
        ''
        p[0] = Xor(p[1], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
308837
def p_and_expression(tok):
        """"""
        if len(tok) == 4:
            tok[0] = LogicalBinOpRule(tok[2], tok[1], tok[3])
        else:
            tok[0] = tok[1]
1121794
def expr(self, items):
        
        return Expression({(self, name): value for name, value in items})