IronRuby.Builtins.RegexpTransformer.ParseBackreference C# (CSharp) Method

ParseBackreference() private method

private ParseBackreference ( ) : void
return void
        private void ParseBackreference() {
            Debug.Assert(_rubyPattern[_index - 1] == 'k');
            
            int terminator;
            int c = Read();
            if (c == '<') {
                terminator = '>';                
            } else if (c == '\'') {
                terminator = '\'';
            } else {
                throw MakeError("invalid back reference");
            }

            Append('\\');
            Append('k');
            Append((char)c);

            // TODO: relative names: <name+n>, <m+n>, ..
            c = Read();
            if (c == terminator || c == -1) {
                throw MakeError("group name is empty");
            }
            while (true) {
                Append((char)c);
                c = Read();
                if (c == terminator) {
                    Append((char)c);
                    break;
                } else if (c == -1) {
                    throw MakeError("invalid group name");
                }
            }
        }