/// <summary> /// Helper method used to generate a syntax node on an error condition. /// </summary> protected void Error() { TextSpan location = new TextSpan(_locationOnError, true); foreach (LanguageError err in _errors) { if (location.CompareTo(err.Location) == 0) { YYAbort(); } } _errors.Add(new LanguageError(String.Format("Unexpected token: {0}", SymbolToString(_tokenOnError)), location)); _errorOccured = true; yyerrok(); }
public static bool IsBetween(this TextSpan textSpan, TextSpan startTextSpan, TextSpan endTextSpan) { return(textSpan.CompareTo(startTextSpan) > 0 && textSpan.CompareTo(endTextSpan) < 0); }
public static bool IsAfter(this TextSpan textSpan, TextSpan otherTextSpan) { return(textSpan.CompareTo(otherTextSpan) > 0); }