public override void Match(ReaderBuffer buffer, TokenMatch match) { TokenPattern res = _automaton.Match(buffer, IgnoreCase); if (res != null) { match.Update(res.Pattern.Length, res); } }
public override void Match(ReaderBuffer buffer, TokenMatch match) { for (int i = 0; i < _regExps.Length; i++) { int length = _regExps[i].Match(buffer); if (length > 0) { match.Update(length, Patterns[i]); } } }
public int Match(ReaderBuffer buffer, TokenMatch match) { int length = 0; int pos = 1; NFAState state; // The first step of the match loop has been unrolled and // optimized for performance below. this._queue.Clear(); var peekChar = buffer.Peek(0); if (0 <= peekChar && peekChar < 128) { state = this._initialChar[peekChar]; if (state != null) { this._queue.AddLast(state); } } if (peekChar >= 0) { this._initial.MatchTransitions((char)peekChar, this._queue, true); } this._queue.MarkEnd(); peekChar = buffer.Peek(1); // The remaining match loop processes all subsequent states while (!this._queue.Empty) { if (this._queue.Marked) { pos++; peekChar = buffer.Peek(pos); this._queue.MarkEnd(); } state = this._queue.RemoveFirst(); if (state.Value != null) { match.Update(pos, state.Value); } if (peekChar >= 0) { state.MatchTransitions((char)peekChar, this._queue, false); } } return(length); }