Example #1
0
 private void WriteLoadPrefix(MjoFlags flags, IColoredWriter writer)
 {
     WritePunctuation(flags.InvertMode() switch {
         MjoInvertMode.Numeric => "-",
         MjoInvertMode.Boolean => "!",
         MjoInvertMode.Bitwise => "~",
         _ => ""
     }, writer);
Example #2
0
 public Assignment(Expression value, uint hash, MjoFlags flags, MjoType type, BinaryOperation operation)
 {
     Value     = value;
     Hash      = hash;
     Flags     = flags;
     Type      = type;
     Operation = operation;
 }
Example #3
0
        private void WriteIdentifier(uint hash, MjoFlags flags, IColoredWriter writer)
        {
            writer.ForegroundColor = ConsoleColor.Red;
            char scope = flags.Scope() switch {
                MjoScope.Persistent => '#',
                MjoScope.SaveFile => '@',
                MjoScope.Thread => '%',
                MjoScope.Local => '_',
                _ => throw new ArgumentOutOfRangeException()
            };
            string type = flags.Type() switch {
                MjoType.Int => "",
                MjoType.Float => "%",
                MjoType.String => "$",
                MjoType.IntArray => "#",
                MjoType.FloatArray => "%#",
                MjoType.StringArray => "$#",
                MjoType.Unknown => "?",
                _ => throw new ArgumentOutOfRangeException()
            };

            writer.Write($"{scope}{{{hash:x8}}}{type}");
        }
Example #4
0
 public static MjoModifier Modifier(this MjoFlags flags) => (MjoModifier)((ushort)flags & (ushort)MjoFlagMask.Modifier);
Example #5
0
 public static MjoInvertMode InvertMode(this MjoFlags flags) => (MjoInvertMode)(((ushort)flags & (ushort)MjoFlagMask.Invert) >> 3);
Example #6
0
 public static MjoScope Scope(this MjoFlags flags) => (MjoScope)(((ushort)flags & (ushort)MjoFlagMask.Scope) >> 5);
Example #7
0
 public static MjoType Type(this MjoFlags flags) => (MjoType)(((ushort)flags & (ushort)MjoFlagMask.Type) >> 8);
Example #8
0
 public static int Dimension(this MjoFlags flags) => ((ushort)flags & (ushort)MjoFlagMask.Dim) >> 11;
Example #9
0
 public Identifier(uint hash, MjoFlags flags)
 {
     Hash  = hash;
     Flags = flags;
 }
Example #10
0
 public ArrayAssignment(Expression value, Expression[] indices, uint hash, MjoFlags flags, MjoType type, BinaryOperation operation)
     : base(value, hash, flags, type, operation)
 {
     Indices = indices;
 }
Example #11
0
 public ArrayAccess(uint hash, MjoFlags flags, Expression[] indices)
 {
     Hash    = hash;
     Flags   = flags;
     Indices = indices;
 }