/// <summary> /// Creates, inserts, and returns a new <see cref="IParserSyntaxError"/> /// which denotes a point within the source which is syntactically invalid. /// </summary> /// <param name="errorText">The <see cref="String"/> representing the /// specifics of the syntax error.</param> /// <param name="start">The <see cref="LineColumnPair"/> value which denotes /// the start of the <see cref="IParserSyntaxError"/> which results.</param> /// <param name="end">The <see cref="LineColumnPair"/> value which denotes /// the end of the <see cref="IParserSyntaxError"/> which results.</param> /// <param name="source">The <see cref="Uri"/> /// value associated to the file on which the error occurred.</param> /// <returns>A new <see cref="IParserSyntaxError"/> /// which denotes the point within the source on which the /// syntax error occurred.</returns> public IParserSyntaxError SyntaxError(string errorText, LineColumnPair start, LineColumnPair end, Uri source) { var result = new ParserSyntaxError(errorText, start, end, source); base.AddImpl(result); return(result); }
private static bool InRangeOf(IOilexerGrammarToken token, LineColumnPair start, LineColumnPair end) { bool nullWidthElement = start == end; if ((token.Line >= start.Line && token.Line <= end.Line)) { if (token.Line == start.Line) { if (start.Line == end.Line) { return(!nullWidthElement ? (token.Column + token.Length >= start.Column && token.Column + token.Length < end.Column) : token.Column == start.Column); } else { return(token.Column + token.Length >= start.Column); } } else if (token.Line == end.Line) { return(token.Column < end.Column); } else { return(true); } } return(false); }
/// <summary> /// Creates, inserts, and returns a new <see cref="IParserSyntaxWarning"/> /// which denotes a point within the source which is syntactically suspect. /// </summary> /// <param name="warningText">The <see cref="String"/> representing the /// specifics of the syntax warning.</param> /// <param name="start">The <see cref="LineColumnPair"/> which denotes the /// start location of the syntax warning.</param> /// <param name="end">The <see cref="LineColumnPair"/> which denotes the /// end location of the syntax warning.</param> /// <param name="source">The <see cref="Uri"/> value associated to the file on which the warning occurred.</param> /// <returns>A new <see cref="IParserSyntaxError"/> /// which denotes the point, within the source, on which the /// syntax warning occurred.</returns> public IParserSyntaxWarning SyntaxWarning(string warningText, LineColumnPair start, LineColumnPair end, Uri source) { var result = new ParserSyntaxWarning(warningText, start, end, source); base.AddImpl(result); return(result); }
/// <summary> /// Creates a new <see cref="SourceRelatedMessage"/> with the /// <paramref name="message"/>, <paramref name="start"/>, /// <paramref name="end"/> and <paramref name="source"/> provided. /// </summary> /// <param name="message">The <see cref="String"/> which denotes the message </param> /// <param name="start">The <see cref="LineColumnPair"/> which denotes /// the start point of the message.</param> /// <param name="end">The <see cref="LineColumnPair"/> which denotes /// the end point of the message.</param> /// <param name="source">The <see cref="Uri"/> instance /// which denotes where the origin of the <see cref="SourceRelatedMessage"/>.</param> protected SourceRelatedMessage(string message, LineColumnPair start, LineColumnPair end, Uri source) { this.Message = message; this.Start = start; this.End = end; this.Source = source; }
internal Tuple<LineColumnPair, char> SearchCharAfter(LineColumnPair startPoint, params char[] charsToSearch) { SharedFx.Assert(startPoint != null, "startPoint != null"); int line = startPoint.LineNumber - 1; int column = startPoint.ColumnNumber - 1; HashSet<char> charsToSearchSet = new HashSet<char>(charsToSearch); int index = this.GetIndex(line, column); if (index < 0) { return null; } bool firstLoop = true; foreach (Tuple<char, int> currentPair in this.Scan(index)) { if (firstLoop) { firstLoop = false; } else { if (charsToSearchSet.Contains(currentPair.Item1)) { LineColumnPair location = this.GetLocation(currentPair.Item2); SharedFx.Assert(location != null, "invalid location"); return Tuple.Create(location, currentPair.Item1); } } } return null; }
/// <summary> /// Creates and inserts a <see cref="ICompilerSourceError"/> /// with the <paramref name="message"/>, <paramref name="column"/>, <paramref name="line"/>, /// and <paramref name="source"/> provided. /// </summary> /// <param name="message">The <see cref="ICompilerReferenceError"/> value associated which /// defines the base message text.</param> /// <param name="start">The <see cref="LineColumnPair"/> value which denotes /// the start of the <see cref="ICompilerSourceError"/> which results.</param> /// <param name="end">The <see cref="LineColumnPair"/> value which denotes /// the end of the <see cref="ICompilerSourceError"/> which results.</param> /// <param name="source">The <see cref="Uri"/> value relative to where the file /// can be found.</param> /// <param name="replacements">A sequence of <see cref="String"/> values /// which denote the data points to replace within the <paramref name="message"/> provided.</param> /// <returns>A <see cref="ICompilerSourceError"/> instance /// which denotes the details of the compiler error.</returns> public ICompilerSourceError SourceError(ICompilerReferenceError message, LineColumnPair start, LineColumnPair end, Uri source, params string[] replacements) { CompilerSourceError error = new CompilerSourceError(message, source, start, end, replacements); base.AddImpl(error); return(error); }
public CompilerSourceError(ICompilerReferenceError message, Uri source, LineColumnPair start, LineColumnPair end, params string[] replacements) { if (message == null) { throw new ArgumentNullException("message"); } this.Source = source; this.replacements = replacements; this.message = message; this.Start = start; this.End = end; }
public ParserSyntaxError(string errorText, LineColumnPair start, LineColumnPair end, Uri source) : base(errorText, start, end, source) { }
public ParserSyntaxWarning(string warningText, LineColumnPair start, LineColumnPair end, Uri source) : base(warningText, start, end, source) { }
/// <summary> /// Creates a new <see cref="SourceRelatedError"/> with the /// <paramref name="message"/>, <paramref name="start"/>, /// <paramref name="end"/> and <paramref name="source"/> provided. /// </summary> /// <param name="message">The <see cref="String"/> which denotes the message </param> /// <param name="start">The <see cref="LineColumnPair"/> which denotes /// the start point of the message.</param> /// <param name="end">The <see cref="LineColumnPair"/> which denotes /// the end point of the message.</param> /// <param name="source">The <see cref="Uri"/> instance /// which denotes where the origin of the <see cref="SourceRelatedError"/>.</param> public SourceRelatedError(string errorText, LineColumnPair start, LineColumnPair end, Uri source) : base(errorText, start, end, source) { }
/// <summary> /// Creates and inserts a <see cref="ICompilerSourceModelWarning{T1, T2, T3, T4}"/> /// with the <paramref name="message"/>, <paramref name="start"/>, <paramref name="end"/>, /// <paramref name="source"/>, <paramref name="item1"/>, <paramref name="item2"/>, /// <paramref name="item3"/>, <paramref name="item4"/> and /// <paramref name="replacements"/> provided. /// </summary> /// <typeparam name="T1">The kind of <paramref name="item1"/> used to /// reference to the primary model element which caused the warning.</typeparam> /// <typeparam name="T2">The kind of <paramref name="item2"/> used to /// reference to the secondary model element which caused the warning.</typeparam> /// <typeparam name="T3">The kind of <paramref name="item3"/> used to /// reference to the tertiary model element which caused the warning.</typeparam> /// <typeparam name="T4">The kind of <paramref name="item4"/> used to /// reference to the quaternary model element which caused the warning.</typeparam> /// <param name="message">The <see cref="ICompilerReferenceWarning"/> value associated which /// defines the base message text.</param> /// <param name="start">The <see cref="LineColumnPair"/> value which denotes /// the start of the <see cref="ICompilerSourceModelWarning{T1, T2, T3, T4}"/> which results.</param> /// <param name="end">The <see cref="LineColumnPair"/> value which denotes /// the end of the <see cref="ICompilerSourceModelWarning{T1, T2, T3, T4}"/> which results.</param> /// <param name="source">The <see cref="Uri"/> value relative to where the file /// can be found.</param> /// <param name="item1">The primary target of the warning.</param> /// <param name="item2">The secondary target of the warning.</param> /// <param name="item3">The tertiary target of the warning.</param> /// <param name="item4">The quaternary target of the warning.</param> /// <param name="replacements">A sequence of <see cref="String"/> values /// which denote the data points to replace within the <paramref name="message"/> provided.</param> /// <returns>A <see cref="ICompilerSourceModelWarning{T1, T2, T3, T4}"/> /// which represents the warning.</returns> public ICompilerSourceModelWarning <T1, T2, T3, T4> SourceModelWarning <T1, T2, T3, T4>(ICompilerReferenceWarning message, LineColumnPair start, LineColumnPair end, Uri source, T1 item1, T2 item2, T3 item3, T4 item4, params string[] replacements) { var warning = new CompilerSourceModelWarning <T1, T2, T3, T4>(message, item1, item2, item3, item4, source, start, end, replacements); base.AddImpl(warning); return(warning); }
/// <summary> /// Creates and inserts a <see cref="ICompilerSourceWarning"/> /// with the <paramref name="message"/>, <paramref name="column"/>, <paramref name="line"/>, /// and <paramref name="source"/> provided. /// </summary> /// <param name="message">The <see cref="ICompilerReferenceWarning"/> instance from /// which the <see cref="ICompilerSourceWarning"/> obtains its message.</param> /// <param name="start">The <see cref="LineColumnPair"/> value which denotes /// the start of the <see cref="ICompilerSourceError"/> which results.</param> /// <param name="end">The <see cref="LineColumnPair"/> value which denotes /// the end of the <see cref="ICompilerSourceError"/> which results.</param> /// <param name="source">The <see cref="Uri"/> value relative to where the file /// can be found associated to the warning.</param> /// <param name="replacements">A sequence of <see cref="String"/> values /// which denote the data points to replace within the <paramref name="message"/> provided.</param> /// <returns>A <see cref="ICompilerSourceWarning"/> instance /// which denotes the details of the compiler warning.</returns> public ICompilerSourceWarning SourceWarning(ICompilerReferenceWarning message, LineColumnPair start, LineColumnPair end, Uri source, params string[] replacements) { CompilerSourceWarning warning = new CompilerSourceWarning(message, source, start, end, replacements); base.AddImpl(warning); return(warning); }
/// <summary> /// Creates and inserts a <see cref="ICompilerSourceModelError{T1, T2, T3}"/> /// with the <paramref name="message"/>, <paramref name="start"/>, <paramref name="end"/>, /// <paramref name="source"/>, <paramref name="item1"/>, <paramref name="item2"/>, <paramref name="item3"/> /// and <paramref name="replacements"/> provided. /// </summary> /// <typeparam name="T1">The kind of <paramref name="item1"/> used to /// reference to the primary model element which caused the error.</typeparam> /// <typeparam name="T2">The kind of <paramref name="item2"/> used to /// reference to the secondary model element which caused the error.</typeparam> /// <typeparam name="T3">The kind of <paramref name="item3"/> used to /// reference to the tertiary model element which caused the error.</typeparam> /// <param name="message">The <see cref="ICompilerReferenceError"/> value associated which /// defines the base message text.</param> /// <param name="start">The <see cref="LineColumnPair"/> value which denotes /// the start of the <see cref="ICompilerSourceModelError{T1, T2, T3}"/> which results.</param> /// <param name="end">The <see cref="LineColumnPair"/> value which denotes /// the end of the <see cref="ICompilerSourceModelError{T1, T2, T3}"/> which results.</param> /// <param name="source">The <see cref="Uri"/> value relative to where the file /// can be found.</param> /// <param name="item1">The primary target of the error.</param> /// <param name="item2">The secondary target of the error.</param> /// <param name="item3">The tertiary target of the error.</param> /// <param name="replacements">A sequence of <see cref="String"/> values /// which denote the data points to replace within the <paramref name="message"/> provided.</param> /// <returns>A <see cref="ICompilerSourceModelError{T1, T2, T3}"/> which represents the error.</returns> public ICompilerSourceModelError <T1, T2, T3> SourceModelError <T1, T2, T3>(ICompilerReferenceError message, LineColumnPair start, LineColumnPair end, Uri source, T1 item1, T2 item2, T3 item3, params string[] replacements) { var error = new CompilerSourceModelError <T1, T2, T3>(message, item1, item2, item3, source, start, end, replacements); base.AddImpl(error); return(error); }
/// <summary> /// Creates a new <see cref="CompilerSourceModelWarning{T1}"/> /// with the <paramref name="message"/>, <paramref name="item1"/>, /// <paramref name="source"/>, <paramref name="start"/>, /// <paramref name="end"/>, and <paramref name="replacements"/>. /// </summary> /// <param name="message">The <see cref="ICompilerReferenceWarning"/> /// which defines the string value that the current warning is built /// off of.</param> /// <param name="item1">The <typeparamref name="T1"/> value which /// denotes where within the model the warning is derived.</param> /// <param name="source">The <see cref="Uri"/> instance denoting /// the file in which the warning occurred.</param> /// <param name="start">The <see cref="LineColumnPair"/> which denotes /// the line and column of the start of the warning.</param> /// <param name="end">The <see cref="LineColumnPair"/> which denotes /// the line and column of the end of the warning.</param> /// <param name="replacements">The <see cref="String"/> array of /// elements which denotes the replacements within /// <paramref name="message"/> to build a unique message relative /// to the current warning.</param> public CompilerSourceModelWarning(ICompilerReferenceWarning message, T1 item1, Uri source, LineColumnPair start, LineColumnPair end, params string[] replacements) : base(message, source, start, end, replacements) { this.Item1 = item1; }
/// <summary> /// Creates a new <see cref="SourceRelatedWarning"/> with the /// <paramref name="message"/>, <paramref name="start"/>, /// <paramref name="end"/> and <paramref name="source"/> provided. /// </summary> /// <param name="message">The <see cref="String"/> which denotes the message </param> /// <param name="start">The <see cref="LineColumnPair"/> which denotes /// the start point of the message.</param> /// <param name="end">The <see cref="LineColumnPair"/> which denotes /// the end point of the message.</param> /// <param name="source">The <see cref="Uri"/> instance /// which denotes where the origin of the <see cref="SourceRelatedWarning"/>.</param> public SourceRelatedWarning(string warningText, LineColumnPair start, LineColumnPair end, Uri source) : base(warningText, start, end, source) { }