System.Text.RegularExpressions.PatternCompiler.DecodeOp C# (CSharp) Method

DecodeOp() public static method

public static DecodeOp ( ushort word, System.Text.RegularExpressions.OpCode &op, OpFlags &flags ) : void
word ushort
op System.Text.RegularExpressions.OpCode
flags OpFlags
return void
		public static void DecodeOp (ushort word, out OpCode op, out OpFlags flags) {
			op = (OpCode)(word & 0x00ff);
			flags = (OpFlags)(word & 0xff00);
		}

Usage Example

Beispiel #1
0
        public static string DisassembleOp(ushort[] image, int pc)
        {
            OpCode  opCode;
            OpFlags opFlags;

            PatternCompiler.DecodeOp(image[pc], out opCode, out opFlags);
            string text = opCode.ToString();

            if (opFlags != OpFlags.None)
            {
                text = text + "[" + opFlags.ToString("f") + "]";
            }
            switch (opCode)
            {
            case OpCode.Position:
                text = text + " /" + (Position)image[pc + 1];
                break;

            case OpCode.String:
                text = text + " '" + Disassembler.ReadString(image, pc + 1) + "'";
                break;

            case OpCode.Reference:
            case OpCode.Open:
            case OpCode.Close:
                text = text + " " + image[pc + 1];
                break;

            case OpCode.Character:
                text = text + " '" + Disassembler.FormatChar((char)image[pc + 1]) + "'";
                break;

            case OpCode.Category:
            case OpCode.NotCategory:
                text = text + " /" + (Category)image[pc + 1];
                break;

            case OpCode.Range:
                text = text + " '" + Disassembler.FormatChar((char)image[pc + 1]) + "', ";
                text = text + " '" + Disassembler.FormatChar((char)image[pc + 2]) + "'";
                break;

            case OpCode.Set:
                text = text + " " + Disassembler.FormatSet(image, pc + 1);
                break;

            case OpCode.In:
            case OpCode.Sub:
            case OpCode.Branch:
            case OpCode.Jump:
                text = text + " :" + Disassembler.FormatAddress(pc + (int)image[pc + 1]);
                break;

            case OpCode.Balance:
            {
                string text2 = text;
                text = string.Concat(new object[]
                    {
                        text2,
                        " ",
                        image[pc + 1],
                        " ",
                        image[pc + 2]
                    });
                break;
            }

            case OpCode.IfDefined:
            case OpCode.Anchor:
                text = text + " :" + Disassembler.FormatAddress(pc + (int)image[pc + 1]);
                text = text + " " + image[pc + 2];
                break;

            case OpCode.Test:
                text = text + " :" + Disassembler.FormatAddress(pc + (int)image[pc + 1]);
                text = text + ", :" + Disassembler.FormatAddress(pc + (int)image[pc + 2]);
                break;

            case OpCode.Repeat:
            case OpCode.FastRepeat:
            {
                text = text + " :" + Disassembler.FormatAddress(pc + (int)image[pc + 1]);
                string text2 = text;
                text = string.Concat(new object[]
                    {
                        text2,
                        " (",
                        image[pc + 2],
                        ", "
                    });
                if (image[pc + 3] == 65535)
                {
                    text += "Inf";
                }
                else
                {
                    text += image[pc + 3];
                }
                text += ")";
                break;
            }

            case OpCode.Info:
            {
                text = text + " " + image[pc + 1];
                string text2 = text;
                text = string.Concat(new object[]
                    {
                        text2,
                        " (",
                        image[pc + 2],
                        ", ",
                        image[pc + 3],
                        ")"
                    });
                break;
            }
            }
            return(text);
        }
All Usage Examples Of System.Text.RegularExpressions.PatternCompiler::DecodeOp