public LookAheadSet CreateIntersection(LookAheadSet set) { var result = new LookAheadSet(this.maxLength); var num = this.elements.Count - 1; for (var i = 0; i <= num; i++) { var seq = (Sequence)this.elements[i]; var seq2 = set.FindSequence(seq); var flag = seq2 != null && seq.IsRepetitive(); if (flag) { result.Add(seq2); } else { var flag2 = seq2 != null; if (flag2) { result.Add(seq); } } } return(result); }
public LookAheadSet CreateCombination(LookAheadSet set) { var result = new LookAheadSet(this.maxLength); var flag = this.Size() <= 0; LookAheadSet createCombination; if (flag) { createCombination = set; } else { var flag2 = set.Size() <= 0; if (flag2) { createCombination = this; } else { var num = this.elements.Count - 1; for (var i = 0; i <= num; i++) { var first = (Sequence)this.elements[i]; var flag3 = first.Length() >= this.maxLength; if (flag3) { result.Add(first); } else { var flag4 = first.Length() <= 0; if (flag4) { result.AddAll(set); } else { var num2 = set.elements.Count - 1; for (var j = 0; j <= num2; j++) { var second = (Sequence)set.elements[j]; result.Add(first.Concat(this.maxLength, second)); } } } } createCombination = result; } } return(createCombination); }
public LookAheadSet CreateFilter(LookAheadSet set) { var result = new LookAheadSet(this.maxLength); var flag = this.Size() <= 0 || set.Size() <= 0; LookAheadSet createFilter; if (flag) { createFilter = this; } else { var num = this.elements.Count - 1; for (var i = 0; i <= num; i++) { var first = (Sequence)this.elements[i]; var num2 = set.elements.Count - 1; for (var j = 0; j <= num2; j++) { var second = (Sequence)set.elements[j]; var flag2 = first.StartsWith(second); if (flag2) { result.Add(first.Subsequence(second.Length())); } } } createFilter = result; } return(createFilter); }
public LookAheadSet CreateRepetitive() { var result = new LookAheadSet(this.maxLength); var num = this.elements.Count - 1; for (var i = 0; i <= num; i++) { var seq = (Sequence)this.elements[i]; var flag = seq.IsRepetitive(); result.Add(flag ? seq : new Sequence(true, seq)); } return(result); }
public LookAheadSet CreateOverlaps(LookAheadSet set) { var result = new LookAheadSet(this.maxLength); var num = this.elements.Count - 1; for (var i = 0; i <= num; i++) { var seq = (Sequence)this.elements[i]; var flag = set.IsOverlap(seq); if (flag) { result.Add(seq); } } return(result); }
public LookAheadSet CreateNextSet(int token) { var result = new LookAheadSet(this.maxLength - 1); var num = this.elements.Count - 1; for (var i = 0; i <= num; i++) { var seq = (Sequence)this.elements[i]; var value = RuntimeHelpers.GetObjectValue(seq.GetToken(0)); var flag = value != null && token == Conversions.ToInteger(value); if (flag) { result.Add(seq.Subsequence(1)); } } return(result); }
// ReSharper disable once UnusedParameter.Local private LookAheadSet FindLookAhead(ProductionPatternElement elem, int length, int dummy, CallStack stack, LookAheadSet filter) { var flag = elem.IsToken(); LookAheadSet result; if (flag) { result = new LookAheadSet(length); result.Add(elem.Id); } else { var pattern = this.GetPattern(elem.Id); result = this.FindLookAhead(pattern, length, stack, filter); var flag2 = stack.Contains(pattern.Name); if (flag2) { result = result.CreateRepetitive(); } } return(result); }