public float?GetFloatLiteral()
 {
     if (Type.IsScalarType() && Type != ShaderType.Bool)
     {
         if (!Single.TryParse(RefText, out var res))
         {
             return(null);
         }
         return(res);
     }
     return(null);
 }
 private static void EnsureSizeIfNotScalar(SSLVisitor vis, IToken token, string name, ShaderType vtype, ShaderType ctype, int vp, int cp)
 {
     if (!ctype.IsScalarType() && (ctype.GetComponentCount() != vtype.GetComponentCount()))
     {
         vis.Error(token, $"The built-in function '{name}' requires argument {cp} to be a scalar, or a matching vector size to argument {vp}.");
     }
 }
 // stype = the type of swizzle   -   0 = position, 1 = color, 2 = texcoord
 public static string GetSwizzle(ShaderType type, int stype)
 {
     if (type.IsScalarType() || type.IsVectorType())
     {
         var cc = type.GetComponentCount();
         if (cc == 1)
         {
             return((stype == 0) ? "x" : (stype == 1) ? "r" : "s");
         }
         if (cc == 2)
         {
             return((stype == 0) ? "xy" : (stype == 1) ? "rg" : "st");
         }
         if (cc == 3)
         {
             return((stype == 0) ? "xyz" : (stype == 1) ? "rgb" : "stp");
         }
         if (cc == 4)
         {
             return((stype == 0) ? "xyzw" : (stype == 1) ? "rgba" : "stpq");
         }
     }
     return(null);
 }