本文整理汇总了C#中IronRuby.Builtins.MatchData类的典型用法代码示例。如果您正苦于以下问题:C# MatchData类的具体用法?C# MatchData怎么用?C# MatchData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MatchData类属于IronRuby.Builtins命名空间,在下文中一共展示了MatchData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetGroup
public static RubyArray GetGroup(ConversionStorage<int>/*!*/ fixnumCast, MatchData/*!*/ self, [NotNull]Range/*!*/ range) {
int begin, count;
if (!IListOps.NormalizeRange(fixnumCast, self.Groups.Count, range, out begin, out count)) {
return null;
}
return GetGroup(fixnumCast.Context, self, begin, count);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:7,代码来源:MatchDataOps.cs
示例2: GetGroup
public static RubyArray GetGroup(RubyContext/*!*/ context, MatchData/*!*/ self, [NotNull]Range/*!*/ range) {
int begin, count;
if (!IListOps.NormalizeRange(context, self.Groups.Count, range, out begin, out count)) {
return null;
}
return GetGroup(context, self, begin, count);
}
开发者ID:mscottford,项目名称:ironruby,代码行数:7,代码来源:MatchDataOps.cs
示例3: Offset
public static RubyArray/*!*/ Offset(MatchData/*!*/ self, [DefaultProtocol]int groupIndex) {
var group = self.GetExistingGroup(groupIndex);
RubyArray result = new RubyArray(2);
if (group.Success) {
result.Add(group.Index);
result.Add(group.Index + group.Length);
} else {
result.Add(null);
result.Add(null);
}
return result;
}
开发者ID:jcteague,项目名称:ironruby,代码行数:12,代码来源:MatchDataOps.cs
示例4: Offset
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;
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:12,代码来源:MatchDataOps.cs
示例5: PreMatch
public static MutableString/*!*/ PreMatch(RubyContext/*!*/ context, MatchData/*!*/ self) {
return self.OriginalString.GetSlice(0, self.Index).TaintBy(self, context);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs
示例6: Captures
public static RubyArray/*!*/ Captures(RubyContext/*!*/ context, MatchData/*!*/ self) {
return ReturnMatchingGroups(context, self, 1);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs
示例7: MatchToScanResult
private static object MatchToScanResult(RubyScope/*!*/ scope, MutableString/*!*/ self, RubyRegex/*!*/ regex, MatchData/*!*/ match) {
if (match.GroupCount == 1) {
return match.GetValue().TaintBy(regex, scope);
} else {
var result = new RubyArray(match.GroupCount - 1);
for (int i = 1; i < match.GroupCount; i++) {
MutableString value = match.GetGroupValue(i);
result.Add(value != null ? value.TaintBy(regex, scope) : value);
}
return result;
}
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:12,代码来源:MutableStringOps.cs
示例8: AppendLastCharOfLastMatchGroup
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);
}
}
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:14,代码来源:MutableStringOps.cs
示例9: InitializeCopy
public static MatchData/*!*/ InitializeCopy(MatchData/*!*/ self, [NotNull]MatchData/*!*/ other) {
self.InitializeFrom(other);
return self;
}
开发者ID:jcteague,项目名称:ironruby,代码行数:4,代码来源:MatchDataOps.cs
示例10: ToS
public static MutableString/*!*/ ToS(RubyContext/*!*/ context, MatchData/*!*/ self) {
return MutableString.Create(self.Value).TaintBy(self, context);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs
示例11: Inspect
public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, MatchData/*!*/ self) {
return RubyUtils.ObjectToMutableString(context, self);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs
示例12: ValuesAt
public static RubyArray/*!*/ ValuesAt(ConversionStorage<int>/*!*/ conversionStorage,
MatchData/*!*/ self, [DefaultProtocol, NotNull]params int[]/*!*/ indices) {
RubyArray result = new RubyArray();
for (int i = 0; i < indices.Length; i++) {
result.Add(GetGroup(conversionStorage.Context, self, indices[i]));
}
return result;
}
开发者ID:jcteague,项目名称:ironruby,代码行数:9,代码来源:MatchDataOps.cs
示例13: Select
public static object Select(RubyContext/*!*/ context, [NotNull]BlockParam/*!*/ block, MatchData/*!*/ self) {
RubyArray result = new RubyArray();
for (int i = 0; i < self.Groups.Count; i++) {
MutableString value = self.GetGroupValue(context, i);
object blockResult;
if (block.Yield(value, out blockResult)) {
return blockResult;
}
if (RubyOps.IsTrue(blockResult)) {
result.Add(value);
}
}
return result;
}
开发者ID:jcteague,项目名称:ironruby,代码行数:16,代码来源:MatchDataOps.cs
示例14: ReturnFrozenString
public static MutableString/*!*/ ReturnFrozenString(RubyContext/*!*/ context, MatchData/*!*/ self) {
return MutableString.Create(self.OriginalString).TaintBy(self, context).Freeze();
}
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs
示例15: ToArray
public static RubyArray/*!*/ ToArray(RubyContext/*!*/ context, MatchData/*!*/ self) {
return ReturnMatchingGroups(context, self, 0);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:3,代码来源:MatchDataOps.cs
示例16: MatchData
protected MatchData(MatchData/*!*/ data)
: this(data._match, data._originalString, data._kIndices) {
}
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:3,代码来源:MatchData.cs
示例17: InitializeFrom
public void InitializeFrom(MatchData/*!*/ other) {
_match = other._match;
_kIndices = other._kIndices;
_originalString = other._originalString;
}
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:5,代码来源:MatchData.cs
示例18: AppendReplacementExpression
private static void AppendReplacementExpression(MutableString/*!*/ input, MatchData/*!*/ match, MutableString/*!*/ result,
MutableString/*!*/ replacement) {
int backslashCount = 0;
for (int i = 0; i < replacement.Length; i++) {
char c = replacement.GetChar(i);
if (c == '\\') {
backslashCount++;
} else if (backslashCount == 0) {
result.Append(c);
} else {
AppendBackslashes(backslashCount, result, 0);
// Odd number of \'s + digit means insert replacement expression
if ((backslashCount & 1) == 1) {
if (Char.IsDigit(c)) {
AppendGroupByIndex(match, c - '0', result);
} else if (c == '&') {
AppendGroupByIndex(match, match.GroupCount - 1, result);
} else if (c == '`') {
// Replace with everything in the input string BEFORE the match
result.Append(input, 0, match.Index);
} else if (c == '\'') {
// Replace with everything in the input string AFTER the match
int start = match.Index + match.Length;
// TODO:
result.Append(input, start, input.GetLength() - start);
} else if (c == '+') {
// Replace last character in last successful match group
AppendLastCharOfLastMatchGroup(match, result);
} else {
// unknown escaped replacement char, go ahead and replace untouched
result.Append('\\');
result.Append(c);
}
} else {
// Any other # of \'s or a non-digit character means insert literal \'s and character
AppendBackslashes(backslashCount, result, 1);
result.Append(c);
}
backslashCount = 0;
}
}
AppendBackslashes(backslashCount, result, 1);
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:44,代码来源:MutableStringOps.cs
示例19: AppendGroupByIndex
private static void AppendGroupByIndex(MatchData/*!*/ match, int index, MutableString/*!*/ result) {
var value = match.GetGroupValue(index);
if (value != null) {
result.Append(value);
}
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:6,代码来源:MutableStringOps.cs
示例20: AppendReplacementExpression
private static void AppendReplacementExpression(MutableString/*!*/ input, MatchData/*!*/ match, MutableString/*!*/ result, MutableString/*!*/ replacement) {
AppendReplacementExpression(input, match.Groups, result, replacement);
}
开发者ID:mscottford,项目名称:ironruby,代码行数:3,代码来源:MutableStringOps.cs
注:本文中的IronRuby.Builtins.MatchData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论