本文整理汇总了C#中IronRuby.StandardLibrary.StringScanner.StringScanner类的典型用法代码示例。如果您正苦于以下问题:C# StringScanner类的具体用法?C# StringScanner怎么用?C# StringScanner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringScanner类属于IronRuby.StandardLibrary.StringScanner命名空间,在下文中一共展示了StringScanner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: Concat
public static StringScanner Concat(StringScanner/*!*/ self, MutableString str)
{
self.ScanString.Append(str);
return self;
}
示例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;
}
示例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);
}
示例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;
}
示例6: ScanUntil
public static object ScanUntil(StringScanner/*!*/ self, [NotNull]RubyRegex/*!*/ pattern)
{
return SearchFull(self, pattern, true, true);
}
示例7: RestSize
public static int RestSize(StringScanner/*!*/ self)
{
return (self.CurrentPosition < self.Length) ? (self.Length - self.CurrentPosition) : 0;
}
示例8: Reset
public static StringScanner Reset(StringScanner/*!*/ self)
{
self.Reset();
return self;
}
示例9: GetString
public static MutableString GetString(StringScanner/*!*/ self)
{
return self.ScanString;
}
示例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);
}
示例11: GetCurrentPosition
public static int GetCurrentPosition(StringScanner/*!*/ self)
{
return self.CurrentPosition;
}
示例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);
}
示例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;
}
示例14: EndOfLine
public static bool EndOfLine(StringScanner/*!*/ self)
{
return self.CurrentPosition >= self.Length;
}
示例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;
}