override public void OnQuasiquoteExpression(QuasiquoteExpression node) { Visit(node.Node); CodeSerializer serializer = new CodeSerializer(); ReplaceCurrentNode(serializer.Serialize(node)); }
public void CodeSerializerTest() { CodeSerializer serializer = new CodeSerializer(); Console.WriteLine(serializer.ToString(CodeSerializer.ToCodeExpression(4))); Console.WriteLine(serializer.ToString(CodeSerializer.ToCodeExpression("Smith"))); Console.WriteLine(serializer.ToString(CodeSerializer.ToCodeExpression(new double[] { 1.1, 2.2, 3.3 }))); serializer.AddDefinition("x", (double)4); serializer.AddDefinition("s", "Smith"); object[] a = new object[5]; a[0] = "text"; a[1] = a[0]; a[2] = a; object[,] a2 = new object[2, 2]; a2[0, 0] = "text"; a2[0, 1] = a[0]; a2[1, 0] = a; a2[1, 1] = a2; a[3] = a2; serializer.AddDefinition("a", a); serializer.AddDefinition("a2", a2); //GaussianPlusOp op = new GaussianPlusOp(1,-1); //UnaryOp<Gaussian,double> op = new UnaryOp<Gaussian,double>(new Gaussian(0,1)); //serializer.AddDefinition("op", op); Console.WriteLine(serializer); }
public override void OnDeclarationStatement(DeclarationStatement node) { if (!node.ContainsAnnotation("PrivateScope")) { Field field; Field field1 = field = new Field(LexicalInfo.Empty); int num1 = (int)(field.Modifiers = TypeMemberModifiers.Public); string text1 = field.Name = "$"; TypeReference reference1 = field.Type = TypeReference.Lift(node.Declaration.Type); Expression expression1 = field.Initializer = Expression.Lift(node.Initializer); int num2 = (int)(field.IsVolatile = false); string text2 = field.Name = CodeSerializer.LiftName(node.Declaration.Name); Field item = field; item.LexicalInfo = node.LexicalInfo; this._class.Members.Add(item); this.RemoveCurrentNode(); } }