Skip to content

Instantly share code, notes, and snippets.

@takeshik
Created August 29, 2012 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takeshik/3515597 to your computer and use it in GitHub Desktop.
Save takeshik/3515597 to your computer and use it in GitHub Desktop.
Expression expr = YacqServices.Parse("Int32.(Parse '123').(ToString 'x2')");
SerializedExpression serializedExpr = YacqExpression.Serialize(expr);
var dumpedString = serializedExpr.SaveText();
SerializedExpression deserializedExpr = YacqExpression.LoadText(dumpedString);
expr = deserializedExpr.Reduce();
<?xml version="1.0"?>
<!-- Int32.(Parse '123').(ToString 'x2')
=> Int32.Parse("123").ToString("x2")
-->
<expression z:Id="i1" i:type="Call" xmlns="http://yacq.net/schema" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<Arguments>
<Node z:Id="i2" i:type="Constant">
<Type>
<Token>33554508</Token>
</Type>
<Value i:type="a:string" xmlns:a="http://www.w3.org/2001/XMLSchema">x2</Value>
</Node>
</Arguments>
<Method>
<Token>100666711</Token>
</Method>
<Object z:Id="i3" i:type="Call">
<Arguments>
<Node z:Id="i4" i:type="Constant">
<Type>
<Token>33554508</Token>
</Type>
<Value i:type="a:string" xmlns:a="http://www.w3.org/2001/XMLSchema">123</Value>
</Node>
</Arguments>
<Method>
<Token>100666714</Token>
</Method>
</Object>
</expression>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment