Exemplo n.º 1
0
 public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
 {
     this.type.Pretty(builder, 0, false);
     builder.Append(" ");
     builder.Append(this.id);
     //builder.Append(this.type.ToString()+" "+this.id);
 }
Exemplo n.º 2
0
        public override string ToString()
        {
            var writer = new StringWriter();
            var pb     = new PrettyBuilder(writer);

            pb.Append($@"Data:
  Version:  v3
  Serial Number: {Tbs.SerialNumber.GetBytes().GetHexString()}
  Signature Algorithm: SHA1withRSA - 1.2.840.113549.1.1.5
  Issuer: {Tbs.Issuer}
  Validity: 
    Not Before: {Tbs.Validity.NotBefore}
    Not  After: {Tbs.Validity.NotAfter}
  Subject: {Tbs.Subject}
  Subject Public Key Info: 
    Algorithm: RSA - {Tbs.SubjectPublicKeyInfo.Algorithm}
    Public Key: 
      Exponent: 65537
      Public Key Modulus: (2048 bits) :
        E4:71:2A:CE:E4:24:DC:C4:AB:DF:A3:2E:80:42:0B:D9:
        CF:90:BE:88:4A:5C:C5:B3:73:BF:49:4D:77:31:8A:88:
        15:A7:56:5F:E4:93:68:83:00:BB:4F:C0:47:03:67:F1:
        30:79:43:08:1C:28:A8:97:70:40:CA:64:FA:9E:42:DF:
        35:3D:0E:75:C6:B9:F2:47:0B:D5:CE:24:DD:0A:F7:84:
        4E:FA:16:29:3B:91:D3:EE:24:E9:AF:F6:A1:49:E1:96:
        70:DE:6F:B2:BE:3A:07:1A:0B:FD:FE:2F:75:FD:F9:FC:
        63:69:36:B6:5B:09:C6:84:92:17:9C:3E:64:C3:C4:C9
  Signature: 
    Algorithm: SHA1withRSA - 1.2.840.113549.1.1.5
    Signature: 
      AA:96:65:3D:10:FA:C7:0B:74:38:2D:93:54:32:C0:5B:
      2F:18:93:E9:7C:32:E6:A4:4F:4E:38:93:61:83:3A:6A:
      A2:11:91:C2:D2:A3:48:07:6C:07:54:A8:B8:42:0E:B4:
      E4:AE:42:B4:B5:36:24:46:4F:83:61:64:13:69:03:DF:
      41:88:0B:CB:39:57:8C:6B:9F:52:7E:26:F9:24:5E:E7:
      BC:FB:FD:93:13:AF:24:3A:8F:DB:E3:DC:C9:F9:1F:67:
      A8:BD:0B:95:84:9D:EB:FC:02:95:A0:49:2C:05:D4:B0:
      35:EA:A6:80:30:20:FF:B1:85:C8:4B:74:D9:DC:BB:50");
            if (Tbs.Extensions.Any())
            {
                pb.Append("Extensions:");
                pb.IndentRight();
                foreach (var ext in Tbs.Extensions)
                {
                    pb.Append($"Identifier: {ext.Id.FriendlyName} - {ext.Id.Value}");
                    pb.IndentRight();
                    pb.Append($"Critical: {(ext.Critical ? "yes" : "no")}");
                    pb.Append(ext.ToString());
                    pb.IndentLeft();
                }
                pb.IndentLeft();
            }
            return(writer.GetStringBuilder().ToString());
        }
Exemplo n.º 3
0
 public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
 {
     builder.Append(id);
     if (list != null)
     {
         builder.Append("(");
         if (list != null)
         {
             list.Pretty(builder, 0, false);
         }
         builder.Append(")");
     }
 }
Exemplo n.º 4
0
 public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
 {
     builder.Append("while (");
     expr.Pretty(builder, 0, false);
     builder.Append(")");
     //builder.Indent();
     builder.NewLine();
     if (stmt != null)
     {
         stmt.Pretty(builder, 0, false);
     }
     //builder.Unindent();
 }
Exemplo n.º 5
0
        public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
        {
            var needsParenthesis = outerPrecedence > 9;

            builder.Append("-");
            if (needsParenthesis)
            {
                builder.Append("(");
            }
            s1.Pretty(builder, 9, false);
            if (needsParenthesis)
            {
                builder.Append(")");
            }
        }
Exemplo n.º 6
0
 public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
 {
     builder.Append("return ");
     e.Pretty(builder, 0, false);
     //builder.Append(" ;");
     //builder.NewLine();
 }
Exemplo n.º 7
0
        public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
        {
            var needsParenthesis = outerPrecedence > Precedences[type] ||
                                   opposite && (outerPrecedence == Precedences[type]);

            if (needsParenthesis)
            {
                builder.Append("(");
            }

            left.Pretty(builder, Precedences[type], Associativities[type] == Associativity.Right);
            builder.Append(Operators[type]);
            right.Pretty(builder, Precedences[type], Associativities[type] == Associativity.Left);

            if (needsParenthesis)
            {
                builder.Append(")");
            }
        }
Exemplo n.º 8
0
 public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
 {
     builder.Append("{");
     if (stmt != null)
     {
         builder.Indent();
         builder.NewLine();
         if (stmt != null)
         {
             stmt.Pretty(builder, 0, false);
         }
         builder.Unindent();
         builder.NewLine();
     }
     else
     {
         builder.NewLine();
     }
     builder.Append("}");
 }
Exemplo n.º 9
0
        public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
        {
            var needsParenthesis = outerPrecedence > 1 ||
                                   opposite && (outerPrecedence == 1);

            if (needsParenthesis)
            {
                builder.Append("(");
            }
            builder.Append(id);
            builder.Append(" = ");
            s.Pretty(builder, 1, false);

            if (needsParenthesis)
            {
                builder.Append(")");
            }
            //if (outerPrecedence == 0)
            //{
            //    builder.Append(" ;");
            //}
        }
Exemplo n.º 10
0
        public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
        {
            var first = true;

            foreach (var arg in list)
            {
                if (!first)
                {
                    builder.Append(", ");
                }
                first = false;
                arg.Pretty(builder, 0, false);
            }
        }
Exemplo n.º 11
0
 public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
 {
     if (head != null)
     {
         head.Pretty(builder, 0, false);
         //if(!head.complexStatement)
         //    builder.Append(";");
         builder.NewLine();
     }
     if (tail != null)
     {
         tail.Pretty(builder, 0, false);
         if (!tail.complexStatement)
         {
             builder.Append(";");
         }
     }
 }
Exemplo n.º 12
0
        public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
        {
            var first = true;

            foreach (var expr in exprs)
            {
                if (!first)
                {
                    builder.Append(", ");
                }
                else
                {
                    first = false;
                }

                expr.Pretty(builder, 0, false);
            }
        }
Exemplo n.º 13
0
 public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
 {
     builder.Append(this.value.ToString().ToLower());
 }
Exemplo n.º 14
0
 public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
 {
     builder.Append(num.ToString());
 }
Exemplo n.º 15
0
 public override void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite)
 {
     builder.Append("bool");
 }