本文整理汇总了C#中IronRuby.StandardLibrary.StringScanner.StringScanner类的典型用法代码示例。如果您正苦于以下问题:C# StringScanner类的具体用法?C# StringScanner怎么用?C# StringScanner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringScanner类属于IronRuby.StandardLibrary.StringScanner命名空间,在下文中一共展示了StringScanner类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: InitializeFrom
private void InitializeFrom(StringScanner/*!*/ other) {
_currentPosition = other._currentPosition;
_foundPosition = other._foundPosition;
_lastMatch = other._lastMatch;
_lastMatchingGroups = other._lastMatchingGroups;
_previousPosition = other._previousPosition;
_scanString = other.ScanString;
}
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:8,代码来源:StringScanner.cs
示例2: Concat
public static StringScanner Concat(StringScanner/*!*/ self, MutableString str)
{
self.ScanString.Append(str);
return self;
}
开发者ID:TerabyteX,项目名称:main,代码行数:5,代码来源:StringScanner.cs
示例3: Unscan
public static StringScanner Unscan(StringScanner/*!*/ self)
{
if (self.LastMatch == null) {
// throw Exception StringScanner::Error
throw RubyExceptions.CreateRangeError("unscan failed: previous match had failed");
}
int position = self.PreviousPosition;
self.Reset();
self.CurrentPosition = position;
return self;
}
开发者ID:TerabyteX,项目名称:main,代码行数:11,代码来源:StringScanner.cs
示例4: SkipUntil
public static int? SkipUntil(StringScanner/*!*/ self, [NotNull]RubyRegex/*!*/ pattern)
{
bool match = self.Match(pattern, false, true);
if (!match) {
return null;
}
return (self.CurrentPosition - self.PreviousPosition);
}
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:StringScanner.cs
示例5: SetCurrentPosition
public static int SetCurrentPosition(StringScanner/*!*/ self, int newPosition)
{
int newPos = newPosition;
if (newPos < 0) {
newPos = self.Length - self.CurrentPosition;
}
if (newPos > self.Length) {
throw RubyExceptions.CreateRangeError("index out of range");
}
self.CurrentPosition = newPos;
return newPosition;
}
开发者ID:TerabyteX,项目名称:main,代码行数:12,代码来源:StringScanner.cs
示例6: ScanUntil
public static object ScanUntil(StringScanner/*!*/ self, [NotNull]RubyRegex/*!*/ pattern)
{
return SearchFull(self, pattern, true, true);
}
开发者ID:TerabyteX,项目名称:main,代码行数:4,代码来源:StringScanner.cs
示例7: RestSize
public static int RestSize(StringScanner/*!*/ self)
{
return (self.CurrentPosition < self.Length) ? (self.Length - self.CurrentPosition) : 0;
}
开发者ID:TerabyteX,项目名称:main,代码行数:4,代码来源:StringScanner.cs
示例8: Reset
public static StringScanner Reset(StringScanner/*!*/ self)
{
self.Reset();
return self;
}
开发者ID:TerabyteX,项目名称:main,代码行数:5,代码来源:StringScanner.cs
示例9: GetString
public static MutableString GetString(StringScanner/*!*/ self)
{
return self.ScanString;
}
开发者ID:TerabyteX,项目名称:main,代码行数:4,代码来源:StringScanner.cs
示例10: GetMatchSubgroup
public static MutableString GetMatchSubgroup(StringScanner/*!*/ self, int subgroup)
{
if (subgroup == 0 && self.LastMatch != null) {
return MutableString.Create(self.LastMatch);
}
if (self.LastMatchingGroups == null) {
return null;
}
if (subgroup < 0) {
subgroup = self.LastMatchingGroups.GroupCount - subgroup;
}
if (subgroup >= self.LastMatchingGroups.GroupCount) {
return null;
}
return self.LastMatchingGroups.GetGroupValue(subgroup);
}
开发者ID:TerabyteX,项目名称:main,代码行数:16,代码来源:StringScanner.cs
示例11: GetCurrentPosition
public static int GetCurrentPosition(StringScanner/*!*/ self)
{
return self.CurrentPosition;
}
开发者ID:TerabyteX,项目名称:main,代码行数:4,代码来源:StringScanner.cs
示例12: GetChar
public static MutableString GetChar(StringScanner/*!*/ self)
{
if (self.CurrentPosition >= self.Length) {
return null;
}
self.PreviousPosition = self.CurrentPosition;
self.FoundPosition = self.CurrentPosition;
self.LastMatch = self.ScanString.GetSlice(self.CurrentPosition++, 1);
return MutableString.Create(self.LastMatch);
}
开发者ID:TerabyteX,项目名称:main,代码行数:10,代码来源:StringScanner.cs
示例13: Exist
public static int? Exist(StringScanner/*!*/ self, [NotNull]RubyRegex/*!*/ pattern)
{
if (!self.Match(pattern, false, false)) {
return null;
}
return self.FoundPosition + self.LastMatch.Length;
}
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:StringScanner.cs
示例14: EndOfLine
public static bool EndOfLine(StringScanner/*!*/ self)
{
return self.CurrentPosition >= self.Length;
}
开发者ID:TerabyteX,项目名称:main,代码行数:4,代码来源:StringScanner.cs
示例15: Create
public static StringScanner Create(RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ scan, [Optional]object ignored)
{
var result = new StringScanner(self);
result.ScanString = scan;
result.Reset();
return result;
}
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:StringScanner.cs
示例16: PreMatch
public static MutableString PreMatch(StringScanner/*!*/ self)
{
if (self.LastMatch == null) {
return null;
}
return self.ScanString.GetSlice(0, self.FoundPosition);
}
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:StringScanner.cs
示例17: Reinitialize
public static void Reinitialize(StringScanner/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ scan, [Optional]object ignored)
{
self.ScanString = scan;
self.Reset();
}
开发者ID:TerabyteX,项目名称:main,代码行数:5,代码来源:StringScanner.cs
示例18: InitializeFrom
public static void InitializeFrom(StringScanner/*!*/ self, [DefaultProtocol, NotNull]StringScanner/*!*/ other)
{
self.InitializeFrom(other);
}
开发者ID:TerabyteX,项目名称:main,代码行数:4,代码来源:StringScanner.cs
示例19: Rest
public static MutableString Rest(StringScanner/*!*/ self)
{
int len = self.Length - self.CurrentPosition;
if (len <= 0) {
return MutableString.CreateEmpty();
}
return self.ScanString.GetSlice(self.CurrentPosition, len);
}
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:StringScanner.cs
示例20: IsRestLeft
public static bool IsRestLeft(StringScanner/*!*/ self)
{
return self.CurrentPosition < self.Length;
}
开发者ID:TerabyteX,项目名称:main,代码行数:4,代码来源:StringScanner.cs
注:本文中的IronRuby.StandardLibrary.StringScanner.StringScanner类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论