public RegexExpression MatchGrapheme(RegexMatchGrapheme node, KeyValuePair <SymbolId, int?> context) { return(RegexAccept.Create(node, context.Key, context.Value)); }
private void ProcessTerminal(SymbolId symbol, Capture <char> capture) { switch ((int)symbol) { case RegexLexer.SymWhitespace: if (!this.IgnorePatternWhitespace) { foreach (var ch in capture) { this.currentGroup.AppendExpression(RegexMatchSet.FromChars(ch)); } } break; case RegexLexer.SymSlash: if (this.BreakOnSlash) { goto case int.MinValue; // EOF } this.currentGroup.AppendExpression(RegexMatchSet.FromCodepoints('/')); break; case RegexLexer.SymCharset: this.currentGroup.AppendExpression(RegexMatchSet.FromNamedCharset(capture.AsString())); break; case RegexLexer.SymRegexLetter: this.currentGroup.AppendExpression(RegexMatchGrapheme.Create(capture.AsString())); break; case RegexLexer.SymRegexEscape: this.currentGroup.AppendExpression(RegexMatchSet.FromEscape(capture.AsString())); break; case RegexLexer.SymRegexCharset: this.currentGroup.AppendExpression(RegexMatchSet.FromSet(capture.AsString())); break; case RegexLexer.SymRegexDot: this.currentGroup.AppendExpression(RegexMatchSet.Dot()); break; case RegexLexer.SymQuantifyKleene: this.currentGroup.Quantify(RegexQuantifier.Kleene()); break; case RegexLexer.SymQuantifyAny: this.currentGroup.Quantify(RegexQuantifier.Any()); break; case RegexLexer.SymQuantifyOptional: this.currentGroup.Quantify(RegexQuantifier.Optional()); break; case RegexLexer.SymQuantifyRepeat: this.currentGroup.Quantify(RegexQuantifier.Repeat(capture.AsString())); break; case RegexLexer.SymAlternate: this.currentGroup.Alternate(); break; case RegexLexer.SymBeginGroup: this.currentGroup = this.currentGroup.BeginGroup(null); break; case RegexLexer.SymSensitiveGroup: this.currentGroup = this.currentGroup.BeginGroup(true); break; case RegexLexer.SymInsensitiveGroup: this.currentGroup = this.currentGroup.BeginGroup(false); break; case RegexLexer.SymEndGroup: this.currentGroup = this.currentGroup.EndGroup(); break; case int.MinValue: // EOF if (!this.currentGroup.IsRoot) { throw new InvalidOperationException("Regex has open groups"); } this.parseCallback?.Invoke(this.Flush()); break; default: throw new NotSupportedException("Unexpected symbol at index " + capture.Index); } }
public RxNode <TLetter> MatchGrapheme(RegexMatchGrapheme node, Context context) { return(context.Mapper.MapGrapheme(node.Text, context.CaseSensitive)); }