示例#1
0
        public static RubyArray /*!*/ Offset(MatchData /*!*/ self, [DefaultProtocol] int groupIndex)
        {
            self.RequireExistingGroup(groupIndex);
            RubyArray result = new RubyArray(2);

            if (self.GroupSuccess(groupIndex))
            {
                result.Add(self.GetGroupStart(groupIndex));
                result.Add(self.GetGroupEnd(groupIndex));
            }
            else
            {
                result.Add(null);
                result.Add(null);
            }
            return(result);
        }
示例#2
0
        private static void AppendLastCharOfLastMatchGroup(MatchData/*!*/ match, MutableString/*!*/ result) {
            int i = match.GroupCount - 1;
            // move to last successful match group
            while (i > 0 && !match.GroupSuccess(i)) {
                i--;
            }

            if (i > 0 && match.GroupSuccess(i)) {
                int length = match.GetGroupLength(i);
                if (length > 0) {
                   result.Append(match.OriginalString, match.GetGroupStart(i) + length - 1, 1);
                }
            }
        }
示例#3
0
 public static RubyArray/*!*/ Offset(MatchData/*!*/ self, [DefaultProtocol]int groupIndex) {
     self.RequireExistingGroup(groupIndex);
     RubyArray result = new RubyArray(2);
     if (self.GroupSuccess(groupIndex)) {
         result.Add(self.GetGroupStart(groupIndex));
         result.Add(self.GetGroupEnd(groupIndex));
     } else {
         result.Add(null);
         result.Add(null);
     }
     return result;
 }
示例#4
0
 public static object End(MatchData/*!*/ self, [DefaultProtocol]int groupIndex) {
     self.RequireExistingGroup(groupIndex);
     return self.GroupSuccess(groupIndex) ? ScriptingRuntimeHelpers.Int32ToObject(self.GetGroupEnd(groupIndex)) : null;
 }
示例#5
0
 public static object End(MatchData /*!*/ self, [DefaultProtocol] int groupIndex)
 {
     self.RequireExistingGroup(groupIndex);
     return(self.GroupSuccess(groupIndex) ? ScriptingRuntimeHelpers.Int32ToObject(self.GetGroupEnd(groupIndex)) : null);
 }