private bool MatchEndSequence(CharacterScanner scanner) { bool flag = false; while (!scanner.IsEndOfScan) { char currentCharacter = scanner.CurrentCharacter; if (this.skipString == null || flag || !scanner.MatchString(this.skipString)) { if ((int)currentCharacter == (int)this.endSequence[0] && !flag && scanner.MatchString(this.endSequence)) { return(true); } int num1; if (this.escapeCharacter.HasValue) { char?nullable = this.escapeCharacter; int num2 = (int)currentCharacter; num1 = (int)nullable.GetValueOrDefault() != num2 ? 0 : (nullable.HasValue ? 1 : 0); } else { num1 = 0; } flag = num1 != 0; scanner.MoveNext(); if (this.finishesOnEOL && (int)currentCharacter == 10) { return(true); } } } return(false); }
public IClassificationType Run(CharacterScanner scanner, RuleState startState, out RuleState endState) { endState = new RuleState(); if (!WordRule.IsCharIdentifierToken(scanner.Peek(-1))) { for (int index = 0; index < this.words.Count; ++index) { if (scanner.MatchString(this.words[index])) { if (scanner.IsEndOfScan || !WordRule.IsCharIdentifierToken(scanner.CurrentCharacter)) { return(this.classification); } scanner.Seek(-this.words[index].Length); } } } return((IClassificationType)null); }
public IClassificationType Run(CharacterScanner scanner, RuleState startState, out RuleState endState) { RuleState ruleState = startState; int cursor = scanner.Cursor; if (!ruleState.IsResuming && !string.IsNullOrEmpty(this.startSequence)) { if ((int)scanner.CurrentCharacter != (int)this.startSequence[0]) { endState = new RuleState(); return((IClassificationType)null); } if (!scanner.MatchString(this.startSequence)) { endState = new RuleState(); return((IClassificationType)null); } } bool flag = false; if (string.IsNullOrEmpty(this.endSequence)) { while (!scanner.IsEndOfScan) { if (this.finishesOnEOL && (int)scanner.CurrentCharacter == 10) { flag = true; break; } scanner.MoveNext(); } } else { flag = this.MatchEndSequence(scanner) || scanner.IsEndOfFile; } endState = new RuleState(!flag); return(this.classification); }