本文整理汇总了C#中RubyRegexOptions类的典型用法代码示例。如果您正苦于以下问题:C# RubyRegexOptions类的具体用法?C# RubyRegexOptions怎么用?C# RubyRegexOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RubyRegexOptions类属于命名空间,在下文中一共展示了RubyRegexOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegularExpression
public RegularExpression(List<Expression>/*!*/ pattern, RubyRegexOptions options, bool isCondition, SourceSpan location)
: base(location) {
Assert.NotNull(pattern);
_pattern = pattern;
_options = options;
}
示例2: Transform
internal static string Transform(string/*!*/ rubyPattern, RubyRegexOptions options) {
if (rubyPattern == "\\Af(?=[[:xdigit:]]{2}+\\z)") {
// pp.rb uses this pattern. The real fix requires cracking the entire regexp and so is left for later
return "\\Af(?=(?:[[:xdigit:]]{2})+\\z)";
}
RegexpTransformer transformer = new RegexpTransformer(rubyPattern);
return transformer.Transform();
}
示例3: Transform
internal static string Transform(string/*!*/ rubyPattern, RubyRegexOptions options, out bool hasGAnchor) {
if (rubyPattern == "\\Af(?=[[:xdigit:]]{2}+\\z)") {
// pp.rb uses this pattern. The real fix requires cracking the entire regexp and so is left for later
hasGAnchor = false;
return "\\Af(?=(?:[[:xdigit:]]{2})+\\z)";
}
RegexpTransformer transformer = new RegexpTransformer(rubyPattern);
var result = transformer.Transform();
hasGAnchor = transformer._hasGAnchor;
return result;
}
示例4: Transform
internal static string Transform(string/*!*/ rubyPattern, RubyRegexOptions options, out bool hasGAnchor) {
// TODO: surrogates (REXML uses this pattern)
if (rubyPattern == "^[\t\n\r -\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF]*$") {
hasGAnchor = false;
return "^(?:[\t\n\r -\uD7FF\uE000-\uFFFD]|[\uD800-\uDBFF][\uDC00-\uDFFF])*$";
}
RegexpTransformer transformer = new RegexpTransformer(rubyPattern);
var result = transformer.Transform();
hasGAnchor = transformer._hasGAnchor;
return result;
}
示例5: CreateRegexWorker
private static RubyRegex/*!*/ CreateRegexWorker(
RubyRegexOptions options,
StrongBox<RubyRegex> regexpCache,
bool isLiteralWithoutSubstitutions,
Func<RubyRegex> createRegex) {
try {
bool once = ((options & RubyRegexOptions.Once) == RubyRegexOptions.Once) || isLiteralWithoutSubstitutions;
if (once) {
// Note that the user is responsible for thread synchronization
if (regexpCache.Value == null) {
regexpCache.Value = createRegex();
}
return regexpCache.Value;
} else {
// In the future, we can consider caching the last Regexp. For some regexp literals
// with substitution, the substition will be the same most of the time
return createRegex();
}
} catch (RegexpError e) {
if (isLiteralWithoutSubstitutions) {
// Ideally, this should be thrown during parsing of the source, even if the
// expression happens to be unreachable at runtime.
throw new SyntaxError(e.Message);
} else {
throw;
}
}
}
示例6: CreateRegexN
public static RubyRegex/*!*/ CreateRegexN(object[]/*!*/ strings, RubyEncoding/*!*/ encoding, RubyRegexOptions options, StrongBox<RubyRegex> regexpCache) {
Func<RubyRegex> createRegex = delegate { return new RubyRegex(CreateMutableStringN(strings, encoding), options); };
return CreateRegexWorker(options, regexpCache, false, createRegex);
}
示例7: TransformPattern
internal static string/*!*/ TransformPattern(string/*!*/ pattern, RubyRegexOptions options) {
return RegexpTransformer.Transform(pattern, options);
}
示例8: GenericRegex
protected GenericRegex(RubyRegexOptions options) {
ContractUtils.Requires(RubyRegex.GetPersistedOptions(options) == options);
_options = options;
}
示例9: ToRegularExpression
public override GenericRegex/*!*/ ToRegularExpression(RubyRegexOptions options) {
// TODO: Fix BinaryRegex and use instead
return new StringRegex(ToString(), options);
}
示例10: CreateRegexM
public static RubyRegex/*!*/ CreateRegexM(MutableString str1, RubyRegexOptions options) {
return new RubyRegex(MutableString.CreateInternal(str1), options);
}
示例11: SetRegexOptions
internal void SetRegexOptions(RubyRegexOptions value) {
Integer1 = (int)value;
}
示例12: CreateRegexU
public static RubyRegex/*!*/ CreateRegexU(string/*!*/ str1, RubyRegexOptions options) {
return new RubyRegex(str1, options);
}
示例13: CreateRegexE
public static RubyRegex/*!*/ CreateRegexE(string/*!*/ str1, int codepage, RubyRegexOptions options) {
return new RubyRegex(str1, options);
}
示例14: CreateRegexN
public static RubyRegex/*!*/ CreateRegexN(object[]/*!*/ strings, int codepage, RubyRegexOptions options) {
return new RubyRegex(ConcatenateStrings(strings), options);
}
示例15: CreateRegexME
public static RubyRegex/*!*/ CreateRegexME(MutableString str1, string/*!*/ str2, int codepage, RubyRegexOptions options) {
return new RubyRegex(MutableString.CreateInternal(str1).Append(str2), options);
}