public UnifiedElement VisitPrimitiveExpression( PrimitiveExpression prim, object data) { if (prim.Value == null) { return(UnifiedNullLiteral.Create()); } if (prim.Value is bool) { return(UnifiedBooleanLiteral.Create((bool)prim.Value)); } if (prim.Value is Int32) { return(UnifiedIntegerLiteral.CreateInt32((Int32)prim.Value)); } if (prim.Value is UInt32) { return(UnifiedIntegerLiteral.CreateUInt32((UInt32)prim.Value)); } if (prim.Value is Int64) { return(UnifiedIntegerLiteral.CreateInt64((Int64)prim.Value)); } if (prim.Value is UInt64) { return(UnifiedIntegerLiteral.CreateUInt64((UInt64)prim.Value)); } if (prim.Value is Single) { return(UnifiedFractionLiteral.Create( (Single)prim.Value, UnifiedFractionLiteralKind.Single)); } if (prim.Value is double) { return(UnifiedFractionLiteral.Create( (double)prim.Value, UnifiedFractionLiteralKind.Double)); } if (prim.Value is char) { return(UnifiedCharLiteral.Create(((char)prim.Value).ToString())); } if (prim.Value is string) { return(UnifiedStringLiteral.Create(prim.LiteralValue)); } throw new NotImplementedException( "value type is " + prim.Value.GetType()); }
private static UnifiedExpression CreateNumberToken(NumberToken <uint> token) { return(UnifiedIntegerLiteral.CreateUInt32(token.NumberValue)); }