Update Reference Sources to .NET Framework 4.6.1
[mono.git] / mcs / class / referencesource / System.Data.Entity / System / Data / Common / EntitySql / AST / Literal.cs
1 //---------------------------------------------------------------------
2 // <copyright file="Literal.cs" company="Microsoft">
3 //      Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //
6 // @owner  [....]
7 // @backupOwner [....]
8 //---------------------------------------------------------------------
9
10 namespace System.Data.Common.EntitySql.AST
11 {
12     using System;
13     using System.Diagnostics;
14     using System.Globalization;
15
16     /// <summary>
17     /// Defines literal value kind, including the eSQL untyped NULL.
18     /// </summary>
19     internal enum LiteralKind
20     {
21         Number,
22         String,
23         UnicodeString,
24         Boolean,
25         Binary,
26         DateTime,
27         Time,
28         DateTimeOffset,
29         Guid,
30         Null
31     }
32
33     /// <summary>
34     /// Represents a literal ast node.
35     /// </summary>
36     internal sealed class Literal : Node
37     {
38         private readonly LiteralKind _literalKind;
39         private string _originalValue;
40         private bool _wasValueComputed = false;
41         private object _computedValue;
42         private Type _type;
43         private static readonly Byte[] _emptyByteArray = new byte[0];
44
45         /// <summary>
46         /// Initializes a literal ast node.
47         /// </summary>
48         /// <param name="originalValue">literal value in cql string representation</param>
49         /// <param name="kind">literal value class</param>
50         /// <param name="query">query</param>
51         /// <param name="inputPos">input position</param>
52         internal Literal(string originalValue, LiteralKind kind, string query, int inputPos)
53             : base(query, inputPos)
54         {
55             _originalValue = originalValue;
56             _literalKind = kind;
57         }
58
59         /// <summary>
60         /// Static factory to create boolean literals by value only.
61         /// </summary>
62         /// <param name="value"></param>
63         internal static Literal NewBooleanLiteral(bool value) { return new Literal(value); }
64
65         private Literal(bool boolLiteral)
66             : base(null, 0)
67         {
68             _wasValueComputed = true;
69             _originalValue = String.Empty;
70             _computedValue = boolLiteral;
71             _type = typeof(System.Boolean);
72         }
73
74         /// <summary>
75         /// True if literal is a number.
76         /// </summary>
77         internal bool IsNumber
78         {
79             get
80             {
81                 return (_literalKind == LiteralKind.Number);
82             }
83         }
84
85         /// <summary>
86         /// True if literal is a signed number.
87         /// </summary>
88         internal bool IsSignedNumber
89         {
90             get
91             {
92                 return IsNumber && (_originalValue[0] == '-' || _originalValue[0] == '+');
93             }
94         }
95
96         /// <summary>
97         /// True if literal is a string.
98         /// </summary>
99         /// <remarks>
100         /// <exception cref="System.Data.EntityException"></exception>
101         /// </remarks>
102         internal bool IsString
103         {
104             get
105             {
106                 return _literalKind == LiteralKind.String || _literalKind == LiteralKind.UnicodeString;
107             }
108         }
109
110         /// <summary>
111         /// True if literal is a unicode string.
112         /// </summary>
113         /// <remarks>
114         /// <exception cref="System.Data.EntityException"></exception>
115         /// </remarks>
116         internal bool IsUnicodeString
117         {
118             get
119             {
120                 return _literalKind == LiteralKind.UnicodeString;
121             }
122         }
123
124         /// <summary>
125         /// True if literal is the eSQL untyped null.
126         /// </summary>
127         /// <remarks>
128         /// <exception cref="System.Data.EntityException"></exception>
129         /// </remarks>
130         internal bool IsNullLiteral
131         {
132             get
133             {
134                 return _literalKind == LiteralKind.Null;
135             }
136         }
137
138         /// <summary>
139         /// Returns the original literal value.
140         /// </summary>
141         internal string OriginalValue
142         {
143             get
144             {
145                 return _originalValue;
146             }
147         }
148
149         /// <summary>
150         /// Prefix a numeric literal with a sign.
151         /// </summary>
152         internal void PrefixSign(string sign)
153         {
154             System.Diagnostics.Debug.Assert(IsNumber && !IsSignedNumber);
155             System.Diagnostics.Debug.Assert(sign[0] == '-' || sign[0] == '+', "sign symbol must be + or -");
156             System.Diagnostics.Debug.Assert(_computedValue == null);
157
158             _originalValue = sign + _originalValue;
159         }
160
161         #region Computed members
162         /// <summary>
163         /// Returns literal converted value.
164         /// </summary>
165         /// <remarks>
166         /// <exception cref="System.Data.EntityException"></exception>
167         /// </remarks>
168         internal object Value
169         {
170             get
171             {
172                 ComputeValue();
173
174                 return _computedValue;
175             }
176         }
177
178         /// <summary>
179         /// Returns literal value type. If value is eSQL untyped null, returns null.
180         /// </summary>
181         /// <remarks>
182         /// <exception cref="System.Data.EntityException"></exception>
183         /// </remarks>
184         internal Type Type
185         {
186             get
187             {
188                 ComputeValue();
189
190                 return _type;
191             }
192         }
193         #endregion
194
195         private void ComputeValue()
196         {
197             if (!_wasValueComputed)
198             {
199                 _wasValueComputed = true;
200
201                 switch (_literalKind)
202                 {
203                     case LiteralKind.Number:
204                         _computedValue = ConvertNumericLiteral(ErrCtx, _originalValue);
205                         break;
206
207                     case LiteralKind.String:
208                         _computedValue = GetStringLiteralValue(_originalValue, false /* isUnicode */);
209                         break;
210
211                     case LiteralKind.UnicodeString:
212                         _computedValue = GetStringLiteralValue(_originalValue, true /* isUnicode */);
213                         break;
214
215                     case LiteralKind.Boolean:
216                         _computedValue = ConvertBooleanLiteralValue(ErrCtx, _originalValue);
217                         break;
218
219                     case LiteralKind.Binary:
220                         _computedValue = ConvertBinaryLiteralValue(ErrCtx, _originalValue);
221                         break;
222
223                     case LiteralKind.DateTime:
224                         _computedValue = ConvertDateTimeLiteralValue(ErrCtx, _originalValue);
225                         break;
226
227                     case LiteralKind.Time:
228                         _computedValue = ConvertTimeLiteralValue(ErrCtx, _originalValue);
229                         break;
230
231                     case LiteralKind.DateTimeOffset:
232                         _computedValue = ConvertDateTimeOffsetLiteralValue(ErrCtx, _originalValue);
233                         break;
234
235                     case LiteralKind.Guid:
236                         _computedValue = ConvertGuidLiteralValue(ErrCtx, _originalValue);
237                         break;
238
239                     case LiteralKind.Null:
240                         _computedValue = null;
241                         break;
242
243                     default:
244                         throw EntityUtil.NotSupported(System.Data.Entity.Strings.LiteralTypeNotSupported(_literalKind.ToString()));
245
246                 }
247
248                 _type = IsNullLiteral ? null : _computedValue.GetType();
249             }
250         }
251
252         #region Conversion Helpers
253         static char[] numberSuffixes = new char[] { 'U', 'u', 'L', 'l', 'F', 'f', 'M', 'm', 'D', 'd' };
254         static char[] floatTokens = new char[] { '.', 'E', 'e' };
255         private static object ConvertNumericLiteral(ErrorContext errCtx, string numericString)
256         {
257             int k = numericString.IndexOfAny(numberSuffixes);
258             if (-1 != k)
259             {
260                 string suffix = numericString.Substring(k).ToUpperInvariant();
261                 string numberPart = numericString.Substring(0, numericString.Length - suffix.Length);
262                 switch (suffix)
263                 {
264                     case "U":
265                         {
266                             UInt32 value;
267                             if (!UInt32.TryParse(numberPart, NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
268                             {
269                                 throw EntityUtil.EntitySqlError(errCtx, System.Data.Entity.Strings.CannotConvertNumericLiteral(numericString, "unsigned int"));
270                             }
271                             return value;
272                         }
273                         ;
274
275                     case "L":
276                         {
277                             long value;
278                             if (!Int64.TryParse(numberPart, NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
279                             {
280                                 throw EntityUtil.EntitySqlError(errCtx, System.Data.Entity.Strings.CannotConvertNumericLiteral(numericString, "long"));
281                             }
282                             return value;
283                         }
284                         ;
285
286                     case "UL":
287                     case "LU":
288                         {
289                             UInt64 value;
290                             if (!UInt64.TryParse(numberPart, NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
291                             {
292                                 throw EntityUtil.EntitySqlError(errCtx, System.Data.Entity.Strings.CannotConvertNumericLiteral(numericString, "unsigned long"));
293                             }
294                             return value;
295                         }
296                         ;
297
298                     case "F":
299                         {
300                             Single value;
301                             if (!Single.TryParse(numberPart, NumberStyles.Float, CultureInfo.InvariantCulture, out value))
302                             {
303                                 throw EntityUtil.EntitySqlError(errCtx, System.Data.Entity.Strings.CannotConvertNumericLiteral(numericString, "float"));
304                             }
305                             return value;
306                         }
307                         ;
308
309                     case "M":
310                         {
311                             Decimal value;
312                             if (!Decimal.TryParse(numberPart, NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out value))
313                             {
314                                 throw EntityUtil.EntitySqlError(errCtx, System.Data.Entity.Strings.CannotConvertNumericLiteral(numericString, "decimal"));
315                             }
316                             return value;
317                         }
318                         ;
319
320                     case "D":
321                         {
322                             Double value;
323                             if (!Double.TryParse(numberPart, NumberStyles.Float, CultureInfo.InvariantCulture, out value))
324                             {
325                                 throw EntityUtil.EntitySqlError(errCtx, System.Data.Entity.Strings.CannotConvertNumericLiteral(numericString, "double"));
326                             }
327                             return value;
328                         }
329                         ;
330
331                 }
332             }
333
334             //
335             // If hit this point, try default conversion
336             //
337             return DefaultNumericConversion(numericString, errCtx);
338         }
339
340         /// <summary>
341         /// Performs conversion of numeric strings that have no type suffix hint.
342         /// </summary>
343         private static object DefaultNumericConversion(string numericString, ErrorContext errCtx)
344         {
345
346             if (-1 != numericString.IndexOfAny(floatTokens))
347             {
348                 Double value;
349                 if (!Double.TryParse(numericString, NumberStyles.Float, CultureInfo.InvariantCulture, out value))
350                 {
351                     throw EntityUtil.EntitySqlError(errCtx, System.Data.Entity.Strings.CannotConvertNumericLiteral(numericString, "double"));
352                 }
353
354                 return value;
355             }
356             else
357             {
358                 Int32 int32Value;
359                 if (Int32.TryParse(numericString, NumberStyles.Integer, CultureInfo.InvariantCulture, out int32Value))
360                 {
361                     return int32Value;
362                 }
363
364                 Int64 int64Value;
365                 if (!Int64.TryParse(numericString, NumberStyles.Integer, CultureInfo.InvariantCulture, out int64Value))
366                 {
367                     throw EntityUtil.EntitySqlError(errCtx, System.Data.Entity.Strings.CannotConvertNumericLiteral(numericString, "long"));
368                 }
369
370                 return int64Value;
371             }
372
373         }
374
375         /// <summary>
376         /// Converts boolean literal value.
377         /// </summary>
378         private static bool ConvertBooleanLiteralValue(ErrorContext errCtx, string booleanLiteralValue)
379         {
380             bool result = false;
381             if (!Boolean.TryParse(booleanLiteralValue, out result))
382             {
383                 throw EntityUtil.EntitySqlError(errCtx, System.Data.Entity.Strings.InvalidLiteralFormat("Boolean", booleanLiteralValue));
384             }
385             return result;
386         }
387
388         /// <summary>
389         /// Returns the string literal value.
390         /// </summary>
391         private static string GetStringLiteralValue(string stringLiteralValue, bool isUnicode)
392         {
393             Debug.Assert(stringLiteralValue.Length >= 2);
394             Debug.Assert(isUnicode == ('N' == stringLiteralValue[0]), "invalid string literal value");
395
396             int startIndex = (isUnicode ? 2 : 1);
397             char delimiter = stringLiteralValue[startIndex - 1];
398
399             // NOTE: this is not a precondition validation. This validation is for security purposes based on the 
400             // paranoid assumption that all input is evil. we should not see this exception under normal 
401             // conditions.
402             if (delimiter != '\'' && delimiter != '\"')
403             {
404                 throw EntityUtil.EntitySqlError(System.Data.Entity.Strings.MalformedStringLiteralPayload);
405             }
406
407             string result = "";
408
409             // NOTE: this is not a precondition validation. This validation is for security purposes based on the 
410             // paranoid assumption that all input is evil. we should not see this exception under normal 
411             // conditions.
412             int before = stringLiteralValue.Split(new char[] { delimiter }).Length - 1;
413             Debug.Assert(before % 2 == 0, "must have an even number of delimiters in the string literal");
414             if (0 != (before % 2))
415             {
416                 throw EntityUtil.EntitySqlError(System.Data.Entity.Strings.MalformedStringLiteralPayload);
417             }
418
419             //
420             // Extract the payload and replace escaped chars that match the envelope delimiter
421             //
422             result = stringLiteralValue.Substring(startIndex, stringLiteralValue.Length - (1 + startIndex));
423             result = result.Replace(new String(delimiter, 2), new String(delimiter, 1));
424
425             // NOTE: this is not a precondition validation. This validation is for security purposes based on the 
426             // paranoid assumption that all input is evil. we should not see this exception under normal 
427             // conditions.
428             int after = result.Split(new char[] { delimiter }).Length - 1;
429             Debug.Assert(after == (before - 2) / 2);
430             if ((after != ((before - 2) / 2)))
431             {
432                 throw EntityUtil.EntitySqlError(System.Data.Entity.Strings.MalformedStringLiteralPayload);
433             }
434
435             return result;
436         }
437
438         /// <summary>
439         /// Converts hex string to byte array.
440         /// </summary>
441         private static byte[] ConvertBinaryLiteralValue(ErrorContext errCtx, string binaryLiteralValue)
442         {
443             Debug.Assert(null != binaryLiteralValue, "binaryStringLiteral must not be null");
444
445             if (String.IsNullOrEmpty(binaryLiteralValue))
446             {
447                 return _emptyByteArray;
448             }
449
450             int startIndex = 0;
451             int endIndex = binaryLiteralValue.Length - 1;
452             Debug.Assert(startIndex <= endIndex, "startIndex <= endIndex");
453             int binaryStringLen = endIndex - startIndex + 1;
454             int byteArrayLen = binaryStringLen / 2;
455             bool hasOddBytes = 0 != (binaryStringLen % 2);
456             if (hasOddBytes)
457             {
458                 byteArrayLen++;
459             }
460
461             byte[] binaryValue = new byte[byteArrayLen];
462             int arrayIndex = 0;
463             if (hasOddBytes)
464             {
465                 binaryValue[arrayIndex++] = (byte)HexDigitToBinaryValue(binaryLiteralValue[startIndex++]);
466             }
467
468             while (startIndex < endIndex)
469             {
470                 binaryValue[arrayIndex++] = (byte)((HexDigitToBinaryValue(binaryLiteralValue[startIndex++]) << 4) | HexDigitToBinaryValue(binaryLiteralValue[startIndex++]));
471             }
472
473             return binaryValue;
474         }
475
476         /// <summary>
477         /// Parse single hex char.
478         /// PRECONDITION - hexChar must be a valid hex digit.
479         /// </summary>
480         private static int HexDigitToBinaryValue(char hexChar)
481         {
482             if (hexChar >= '0' && hexChar <= '9') return (int)(hexChar - '0');
483             if (hexChar >= 'A' && hexChar <= 'F') return (int)(hexChar - 'A') + 10;
484             if (hexChar >= 'a' && hexChar <= 'f') return (int)(hexChar - 'a') + 10;
485             Debug.Assert(false, "Invalid Hexadecimal Digit");
486             throw EntityUtil.ArgumentOutOfRange("hexadecimal digit is not valid");
487         }
488
489
490         static readonly char[] _datetimeSeparators = new char[] { ' ', ':', '-', '.' };
491         static readonly char[] _dateSeparators = new char[] { '-' };
492         static readonly char[] _timeSeparators = new char[] { ':', '.' };
493         static readonly char[] _datetimeOffsetSeparators = new char[] { ' ', ':', '-', '.', '+', '-' };
494
495         /// <summary>
496         /// Converts datetime literal value.
497         /// </summary>
498         private static DateTime ConvertDateTimeLiteralValue(ErrorContext errCtx, string datetimeLiteralValue)
499         {
500             string[] datetimeParts = datetimeLiteralValue.Split(_datetimeSeparators, StringSplitOptions.RemoveEmptyEntries);
501
502             Debug.Assert(datetimeParts.Length >= 5, "datetime literal value must have at least 5 parts");
503
504             int year;
505             int month;
506             int day;
507             GetDateParts(datetimeLiteralValue, datetimeParts, out year, out month, out day);
508             int hour;
509             int minute;
510             int second;
511             int ticks;
512             GetTimeParts(datetimeLiteralValue, datetimeParts, 3, out hour, out minute, out second, out ticks);
513
514             Debug.Assert(year >= 1 && year <= 9999);
515             Debug.Assert(month >= 1 && month <= 12);
516             Debug.Assert(day >= 1 && day <= 31);
517             Debug.Assert(hour >= 0 && hour <= 24);
518             Debug.Assert(minute >= 0 && minute <= 59);
519             Debug.Assert(second >= 0 && second <= 59);
520             Debug.Assert(ticks >= 0 && ticks <= 9999999);
521             DateTime dateTime = new DateTime(year, month, day, hour, minute, second, 0);
522             dateTime = dateTime.AddTicks(ticks);
523             return dateTime;
524         }
525
526         private static DateTimeOffset ConvertDateTimeOffsetLiteralValue(ErrorContext errCtx, string datetimeLiteralValue)
527         {
528             string[] datetimeParts = datetimeLiteralValue.Split(_datetimeOffsetSeparators, StringSplitOptions.RemoveEmptyEntries);
529
530             Debug.Assert(datetimeParts.Length >= 7, "datetime literal value must have at least 7 parts");
531
532             int year;
533             int month;
534             int day;
535             GetDateParts(datetimeLiteralValue, datetimeParts, out year, out month, out day);
536             int hour;
537             int minute;
538             int second;
539             int ticks;
540             //Copy the time parts into a different array since the last two parts will be handled in this method.
541             string[] timeParts = new String[datetimeParts.Length - 2];
542             Array.Copy(datetimeParts, timeParts, datetimeParts.Length - 2);
543             GetTimeParts(datetimeLiteralValue, timeParts, 3, out hour, out minute, out second, out ticks);
544
545             Debug.Assert(year >= 1 && year <= 9999);
546             Debug.Assert(month >= 1 && month <= 12);
547             Debug.Assert(day >= 1 && day <= 31);
548             Debug.Assert(hour >= 0 && hour <= 24);
549             Debug.Assert(minute >= 0 && minute <= 59);
550             Debug.Assert(second >= 0 && second <= 59);
551             Debug.Assert(ticks >= 0 && ticks <= 9999999);
552             int offsetHours = Int32.Parse(datetimeParts[datetimeParts.Length - 2], NumberStyles.Integer, CultureInfo.InvariantCulture);
553             int offsetMinutes = Int32.Parse(datetimeParts[datetimeParts.Length - 1], NumberStyles.Integer, CultureInfo.InvariantCulture);
554             TimeSpan offsetTimeSpan = new TimeSpan(offsetHours, offsetMinutes, 0);
555
556             //If DateTimeOffset had a negative offset, we should negate the timespan
557             if (datetimeLiteralValue.IndexOf('+') == -1)
558             {
559                 offsetTimeSpan = offsetTimeSpan.Negate();
560             }
561             DateTime dateTime = new DateTime(year, month, day, hour, minute, second, 0);
562             dateTime = dateTime.AddTicks(ticks);
563
564             try
565             {
566                 return new DateTimeOffset(dateTime, offsetTimeSpan);
567             }
568             catch (ArgumentOutOfRangeException e)
569             {
570                 throw EntityUtil.EntitySqlError(errCtx, System.Data.Entity.Strings.InvalidDateTimeOffsetLiteral(datetimeLiteralValue), e);
571             }
572         }
573
574         /// <summary>
575         /// Converts time literal value.
576         /// </summary>
577         private static TimeSpan ConvertTimeLiteralValue(ErrorContext errCtx, string datetimeLiteralValue)
578         {
579             string[] datetimeParts = datetimeLiteralValue.Split(_datetimeSeparators, StringSplitOptions.RemoveEmptyEntries);
580
581             Debug.Assert(datetimeParts.Length >= 2, "time literal value must have at least 2 parts");
582
583             int hour;
584             int minute;
585             int second;
586             int ticks;
587             GetTimeParts(datetimeLiteralValue, datetimeParts, 0, out hour, out minute, out second, out ticks);
588
589             Debug.Assert(hour >= 0 && hour <= 24);
590             Debug.Assert(minute >= 0 && minute <= 59);
591             Debug.Assert(second >= 0 && second <= 59);
592             Debug.Assert(ticks >= 0 && ticks <= 9999999);
593             TimeSpan ts = new TimeSpan(hour, minute, second);
594             ts = ts.Add(new TimeSpan(ticks));
595             return ts;
596         }
597
598         private static void GetTimeParts(string datetimeLiteralValue, string[] datetimeParts, int timePartStartIndex, out int hour, out int minute, out int second, out int ticks)
599         {
600             hour = Int32.Parse(datetimeParts[timePartStartIndex], NumberStyles.Integer, CultureInfo.InvariantCulture);
601             if (hour > 23)
602             {
603                 throw EntityUtil.EntitySqlError(System.Data.Entity.Strings.InvalidHour(datetimeParts[timePartStartIndex], datetimeLiteralValue));
604             }
605             minute = Int32.Parse(datetimeParts[++timePartStartIndex], NumberStyles.Integer, CultureInfo.InvariantCulture);
606             if (minute > 59)
607             {
608                 throw EntityUtil.EntitySqlError(System.Data.Entity.Strings.InvalidMinute(datetimeParts[timePartStartIndex], datetimeLiteralValue));
609             }
610             second = 0;
611             ticks = 0;
612             timePartStartIndex++;
613             if (datetimeParts.Length > timePartStartIndex)
614             {
615                 second = Int32.Parse(datetimeParts[timePartStartIndex], NumberStyles.Integer, CultureInfo.InvariantCulture);
616                 if (second > 59)
617                 {
618                     throw EntityUtil.EntitySqlError(System.Data.Entity.Strings.InvalidSecond(datetimeParts[timePartStartIndex], datetimeLiteralValue));
619                 }
620                 timePartStartIndex++;
621                 if (datetimeParts.Length > timePartStartIndex)
622                 {
623                     //We need fractional time part to be seven digits
624                     string ticksString = datetimeParts[timePartStartIndex].PadRight(7, '0');
625                     ticks = Int32.Parse(ticksString, NumberStyles.Integer, CultureInfo.InvariantCulture);
626                 }
627
628             }
629         }
630
631         private static void GetDateParts(string datetimeLiteralValue, string[] datetimeParts, out int year, out int month, out int day)
632         {
633             year = Int32.Parse(datetimeParts[0], NumberStyles.Integer, CultureInfo.InvariantCulture);
634             if (year < 1 || year > 9999)
635             {
636                 throw EntityUtil.EntitySqlError(System.Data.Entity.Strings.InvalidYear(datetimeParts[0], datetimeLiteralValue));
637             }
638             month = Int32.Parse(datetimeParts[1], NumberStyles.Integer, CultureInfo.InvariantCulture);
639             if (month < 1 || month > 12)
640             {
641                 throw EntityUtil.EntitySqlError(System.Data.Entity.Strings.InvalidMonth(datetimeParts[1], datetimeLiteralValue));
642             }
643             day = Int32.Parse(datetimeParts[2], NumberStyles.Integer, CultureInfo.InvariantCulture);
644             if (day < 1)
645             {
646                 throw EntityUtil.EntitySqlError(System.Data.Entity.Strings.InvalidDay(datetimeParts[2], datetimeLiteralValue));
647             }
648             if (day > DateTime.DaysInMonth(year, month))
649             {
650                 throw EntityUtil.EntitySqlError(System.Data.Entity.Strings.InvalidDayInMonth(datetimeParts[2], datetimeParts[1], datetimeLiteralValue));
651             }
652         }
653
654         /// <summary>
655         /// Converts guid literal value.
656         /// </summary>
657         private static Guid ConvertGuidLiteralValue(ErrorContext errCtx, string guidLiteralValue)
658         {
659             return new Guid(guidLiteralValue);
660         }
661         #endregion
662     }
663 }