Example #1
0
        public Error(string errorMessage, TextRegion location, string objectedText, ErrorCategory category = ErrorCategory.Syntactical)
        {
            if (errorMessage == null)
            {
                throw new ArgumentNullException("errorMessage");
            }
            if (objectedText == null)
            {
                throw new ArgumentNullException("objectedText");
            }

            ErrorMessage = string.Format("syntax error: {0}, at: {1}", errorMessage, location);
            Location     = location;
            ObjectedText = objectedText;
            Category     = category;
        }
Example #2
0
 public static Error Missing(TokenType expectedType, TextRegion region)
 {
     return(new Error("expected token " + expectedType.ToDisplayString(), region, String.Empty));
 }
Example #3
0
        public static Error Unexpected(TokenType expectedType, ClassDiagramToken actualToken)
        {
            var region = new TextRegion(actualToken.Line, actualToken.Start, actualToken.Length);

            return(new Error("unexpected token", region, actualToken.Value));
        }