private void End(State start, State end, UTF8Sequence utf8, int upto, bool doAll) { if (upto == utf8.len - 1) { // Done recursing start.AddTransition(new Transition(utf8.ByteAt(upto) & (~MASKS[utf8.NumBits(upto) - 1]), utf8.ByteAt(upto), end)); // type=end } else { int startCode; if (utf8.NumBits(upto) == 5) { // special case -- avoid created unused edges (utf8 // doesn't accept certain byte sequences) -- there // are other cases we could optimize too: startCode = 194; } else { startCode = utf8.ByteAt(upto) & (~MASKS[utf8.NumBits(upto) - 1]); } if (doAll && utf8.ByteAt(upto) != startCode) { All(start, end, startCode, utf8.ByteAt(upto) - 1, utf8.len - upto - 1); } State n = NewUTF8State(); start.AddTransition(new Transition(utf8.ByteAt(upto), n)); // type=end End(n, end, utf8, 1 + upto, true); } }
private void Start(State start, State end, UTF8Sequence utf8, int upto, bool doAll) { if (upto == utf8.len - 1) { // Done recursing start.AddTransition(new Transition(utf8.ByteAt(upto), utf8.ByteAt(upto) | MASKS[utf8.NumBits(upto) - 1], end)); // type=start } else { State n = NewUTF8State(); start.AddTransition(new Transition(utf8.ByteAt(upto), n)); // type=start Start(n, end, utf8, 1 + upto, true); int endCode = utf8.ByteAt(upto) | MASKS[utf8.NumBits(upto) - 1]; if (doAll && utf8.ByteAt(upto) != endCode) { All(start, end, utf8.ByteAt(upto) + 1, endCode, utf8.len - upto - 1); } } }
private void End(State start, State end, UTF8Sequence utf8, int upto, bool doAll) { if (upto == utf8.Len - 1) { // Done recursing start.AddTransition(new Transition(utf8.ByteAt(upto) & (~MASKS[utf8.NumBits(upto) - 1]), utf8.ByteAt(upto), end)); // type=end } else { int startCode; if (utf8.NumBits(upto) == 5) { // special case -- avoid created unused edges (utf8 // doesn't accept certain byte sequences) -- there // are other cases we could optimize too: startCode = 194; } else { startCode = utf8.ByteAt(upto) & (~MASKS[utf8.NumBits(upto) - 1]); } if (doAll && utf8.ByteAt(upto) != startCode) { All(start, end, startCode, utf8.ByteAt(upto) - 1, utf8.Len - upto - 1); } State n = NewUTF8State(); start.AddTransition(new Transition(utf8.ByteAt(upto), n)); // type=end End(n, end, utf8, 1 + upto, true); } }
private void Start(State start, State end, UTF8Sequence utf8, int upto, bool doAll) { if (upto == utf8.Len - 1) { // Done recursing start.AddTransition(new Transition(utf8.ByteAt(upto), utf8.ByteAt(upto) | MASKS[utf8.NumBits(upto) - 1], end)); // type=start } else { State n = NewUTF8State(); start.AddTransition(new Transition(utf8.ByteAt(upto), n)); // type=start Start(n, end, utf8, 1 + upto, true); int endCode = utf8.ByteAt(upto) | MASKS[utf8.NumBits(upto) - 1]; if (doAll && utf8.ByteAt(upto) != endCode) { All(start, end, utf8.ByteAt(upto) + 1, endCode, utf8.Len - upto - 1); } } }